* Re: [UPDATE][PATCH] tools/power/x86: A tool to validate Intel Speed Select commands
From: Srinivas Pandruvada @ 2019-06-30 17:12 UTC (permalink / raw)
To: dvhart, andy, andriy.shevchenko, corbet
Cc: rjw, alan, lenb, prarit, darcari, linux-doc, linux-kernel,
platform-driver-x86
In-Reply-To: <20190630171054.8353-1-srinivas.pandruvada@linux.intel.com>
Please ignore. I will send again.
On Sun, 2019-06-30 at 10:10 -0700, Srinivas Pandruvada wrote:
> The Intel(R) Speed select technologies contains four features.
>
> Performance profile:An non architectural mechanism that allows
> multiple
> optimized performance profiles per system via static and/or dynamic
> adjustment of core count, workload, Tjmax, and TDP, etc. aka ISS
> in the documentation.
>
> Base Frequency: Enables users to increase guaranteed base frequency
> on
> certain cores (high priority cores) in exchange for lower base
> frequency
> on remaining cores (low priority cores). aka PBF in the documenation.
>
> Turbo frequency: Enables the ability to set different turbo ratio
> limits
> to cores based on priority. aka FACT in the documentation.
>
> Core power: An Interface that allows user to define per core/tile
> priority.
>
> There is a multi level help for commands and options. This can be
> used
> to check required arguments for each feature and commands for the
> feature.
>
> To start navigating the features start with
>
> $sudo intel-speed-select --help
>
> For help on a specific feature for example
> $sudo intel-speed-select perf-profile --help
>
> To get help for a command for a feature for example
> $sudo intel-speed-select perf-profile get-lock-status --help
>
> Signed-off-by: Srinivas Pandruvada <
> srinivas.pandruvada@linux.intel.com>
> ---
> Updates:
> - Copied Makefile from tools/gpio and moified the Makefile here
> - Added entry to tools/build/Makefile
> - Rename directory to match the executable name
> - Fix one error message
>
> tools/Makefile | 12 +-
> tools/power/x86/intel-speed-select/Build | 1 +
> tools/power/x86/intel-speed-select/Makefile | 56 +
> .../x86/intel-speed-select/isst-config.c | 1607
> +++++++++++++++++
> .../power/x86/intel-speed-select/isst-core.c | 721 ++++++++
> .../x86/intel-speed-select/isst-display.c | 479 +++++
> tools/power/x86/intel-speed-select/isst.h | 231 +++
> 7 files changed, 3102 insertions(+), 5 deletions(-)
> create mode 100644 tools/power/x86/intel-speed-select/Build
> create mode 100644 tools/power/x86/intel-speed-select/Makefile
> create mode 100644 tools/power/x86/intel-speed-select/isst-config.c
> create mode 100644 tools/power/x86/intel-speed-select/isst-core.c
> create mode 100644 tools/power/x86/intel-speed-select/isst-display.c
> create mode 100644 tools/power/x86/intel-speed-select/isst.h
>
> diff --git a/tools/Makefile b/tools/Makefile
> index 3dfd72ae6c1a..68defd7ecf5d 100644
> --- a/tools/Makefile
> +++ b/tools/Makefile
> @@ -19,6 +19,7 @@ help:
> @echo ' gpio - GPIO tools'
> @echo ' hv - tools used when in Hyper-V
> clients'
> @echo ' iio - IIO tools'
> + @echo ' intel-speed-select - Intel Speed Select tool'
> @echo ' kvm_stat - top-like utility for
> displaying kvm statistics'
> @echo ' leds - LEDs tools'
> @echo ' liblockdep - user-space wrapper for kernel
> locking-validator'
> @@ -82,7 +83,7 @@ perf: FORCE
> selftests: FORCE
> $(call descend,testing/$@)
>
> -turbostat x86_energy_perf_policy: FORCE
> +turbostat x86_energy_perf_policy intel-speed-select: FORCE
> $(call descend,power/x86/$@)
>
> tmon: FORCE
> @@ -115,7 +116,7 @@ liblockdep_install:
> selftests_install:
> $(call descend,testing/$(@:_install=),install)
>
> -turbostat_install x86_energy_perf_policy_install:
> +turbostat_install x86_energy_perf_policy_install intel-speed-
> select_install:
> $(call descend,power/x86/$(@:_install=),install)
>
> tmon_install:
> @@ -132,7 +133,7 @@ install: acpi_install cgroup_install
> cpupower_install gpio_install \
> perf_install selftests_install turbostat_install
> usb_install \
> virtio_install vm_install bpf_install
> x86_energy_perf_policy_install \
> tmon_install freefall_install objtool_install
> kvm_stat_install \
> - wmi_install pci_install debugging_install
> + wmi_install pci_install debugging_install intel-speed-
> select_install
>
> acpi_clean:
> $(call descend,power/acpi,clean)
> @@ -162,7 +163,7 @@ perf_clean:
> selftests_clean:
> $(call descend,testing/$(@:_clean=),clean)
>
> -turbostat_clean x86_energy_perf_policy_clean:
> +turbostat_clean x86_energy_perf_policy_clean intel-speed-
> select_clean:
> $(call descend,power/x86/$(@:_clean=),clean)
>
> tmon_clean:
> @@ -178,6 +179,7 @@ clean: acpi_clean cgroup_clean cpupower_clean
> hv_clean firewire_clean \
> perf_clean selftests_clean turbostat_clean spi_clean
> usb_clean virtio_clean \
> vm_clean bpf_clean iio_clean
> x86_energy_perf_policy_clean tmon_clean \
> freefall_clean build_clean libbpf_clean libsubcmd_clean
> liblockdep_clean \
> - gpio_clean objtool_clean leds_clean wmi_clean pci_clean
> firmware_clean debugging_clean
> + gpio_clean objtool_clean leds_clean wmi_clean pci_clean
> firmware_clean debugging_clean \
> + intel-speed-select_clean
>
> .PHONY: FORCE
> diff --git a/tools/power/x86/intel-speed-select/Build
> b/tools/power/x86/intel-speed-select/Build
> new file mode 100644
> index 000000000000..b61456d75190
> --- /dev/null
> +++ b/tools/power/x86/intel-speed-select/Build
> @@ -0,0 +1 @@
> +intel-speed-select-y += isst-config.o isst-core.o isst-display.o
> diff --git a/tools/power/x86/intel-speed-select/Makefile
> b/tools/power/x86/intel-speed-select/Makefile
> new file mode 100644
> index 000000000000..12c6939dca2a
> --- /dev/null
> +++ b/tools/power/x86/intel-speed-select/Makefile
> @@ -0,0 +1,56 @@
> +# SPDX-License-Identifier: GPL-2.0
> +include ../../../scripts/Makefile.include
> +
> +bindir ?= /usr/bin
> +
> +ifeq ($(srctree),)
> +srctree := $(patsubst %/,%,$(dir $(CURDIR)))
> +srctree := $(patsubst %/,%,$(dir $(srctree)))
> +srctree := $(patsubst %/,%,$(dir $(srctree)))
> +srctree := $(patsubst %/,%,$(dir $(srctree)))
> +endif
> +
> +# Do not use make's built-in rules
> +# (this improves performance and avoids hard-to-debug behaviour);
> +MAKEFLAGS += -r
> +
> +override CFLAGS += -O2 -Wall -g -D_GNU_SOURCE -I$(OUTPUT)include
> +
> +ALL_TARGETS := intel-speed-select
> +ALL_PROGRAMS := $(patsubst %,$(OUTPUT)%,$(ALL_TARGETS))
> +
> +all: $(ALL_PROGRAMS)
> +
> +export srctree OUTPUT CC LD CFLAGS
> +include $(srctree)/tools/build/Makefile.include
> +
> +#
> +# We need the following to be outside of kernel tree
> +#
> +$(OUTPUT)include/linux/isst_if.h:
> ../../../../include/uapi/linux/isst_if.h
> + mkdir -p $(OUTPUT)include/linux 2>&1 || true
> + ln -sf $(CURDIR)/../../../../include/uapi/linux/isst_if.h $@
> +
> +prepare: $(OUTPUT)include/linux/isst_if.h
> +
> +ISST_IN := $(OUTPUT)intel-speed-select-in.o
> +
> +$(ISST_IN): prepare FORCE
> + $(Q)$(MAKE) $(build)=intel-speed-select
> +$(OUTPUT)intel-speed-select: $(ISST_IN)
> + $(QUIET_LINK)$(CC) $(CFLAGS) $(LDFLAGS) $< -o $@
> +
> +clean:
> + rm -f $(ALL_PROGRAMS)
> + rm -rf $(OUTPUT)include/linux/isst_if.h
> + find $(if $(OUTPUT),$(OUTPUT),.) -name '*.o' -delete -o -name
> '\.*.d' -delete
> +
> +install: $(ALL_PROGRAMS)
> + install -d -m 755 $(DESTDIR)$(bindir); \
> + for program in $(ALL_PROGRAMS); do \
> + install $$program $(DESTDIR)$(bindir); \
> + done
> +
> +FORCE:
> +
> +.PHONY: all install clean FORCE prepare
> diff --git a/tools/power/x86/intel-speed-select/isst-config.c
> b/tools/power/x86/intel-speed-select/isst-config.c
> new file mode 100644
> index 000000000000..91c5ad1685a1
> --- /dev/null
> +++ b/tools/power/x86/intel-speed-select/isst-config.c
> @@ -0,0 +1,1607 @@
> +// SPDX-License-Identifier: GPL-2.0
> +/*
> + * Intel Speed Select -- Enumerate and control features
> + * Copyright (c) 2019 Intel Corporation.
> + */
> +
> +#include <linux/isst_if.h>
> +
> +#include "isst.h"
> +
> +struct process_cmd_struct {
> + char *feature;
> + char *command;
> + void (*process_fn)(void);
> +};
> +
> +static const char *version_str = "v1.0";
> +static const int supported_api_ver = 1;
> +static struct isst_if_platform_info isst_platform_info;
> +static char *progname;
> +static int debug_flag;
> +static FILE *outf;
> +
> +static int cpu_model;
> +
> +#define MAX_CPUS_IN_ONE_REQ 64
> +static short max_target_cpus;
> +static unsigned short target_cpus[MAX_CPUS_IN_ONE_REQ];
> +
> +static int topo_max_cpus;
> +static size_t present_cpumask_size;
> +static cpu_set_t *present_cpumask;
> +static size_t target_cpumask_size;
> +static cpu_set_t *target_cpumask;
> +static int tdp_level = 0xFF;
> +static int fact_bucket = 0xFF;
> +static int fact_avx = 0xFF;
> +static unsigned long long fact_trl;
> +static int out_format_json;
> +static int cmd_help;
> +
> +/* clos related */
> +static int current_clos = -1;
> +static int clos_epp = -1;
> +static int clos_prop_prio = -1;
> +static int clos_min = -1;
> +static int clos_max = -1;
> +static int clos_desired = -1;
> +static int clos_priority_type;
> +
> +struct _cpu_map {
> + unsigned short core_id;
> + unsigned short pkg_id;
> + unsigned short die_id;
> + unsigned short punit_cpu;
> + unsigned short punit_cpu_core;
> +};
> +struct _cpu_map *cpu_map;
> +
> +void debug_printf(const char *format, ...)
> +{
> + va_list args;
> +
> + va_start(args, format);
> +
> + if (debug_flag)
> + vprintf(format, args);
> +
> + va_end(args);
> +}
> +
> +static void update_cpu_model(void)
> +{
> + unsigned int ebx, ecx, edx;
> + unsigned int fms, family;
> +
> + __cpuid(1, fms, ebx, ecx, edx);
> + family = (fms >> 8) & 0xf;
> + cpu_model = (fms >> 4) & 0xf;
> + if (family == 6 || family == 0xf)
> + cpu_model += ((fms >> 16) & 0xf) << 4;
> +}
> +
> +/* Open a file, and exit on failure */
> +static FILE *fopen_or_exit(const char *path, const char *mode)
> +{
> + FILE *filep = fopen(path, mode);
> +
> + if (!filep)
> + err(1, "%s: open failed", path);
> +
> + return filep;
> +}
> +
> +/* Parse a file containing a single int */
> +static int parse_int_file(int fatal, const char *fmt, ...)
> +{
> + va_list args;
> + char path[PATH_MAX];
> + FILE *filep;
> + int value;
> +
> + va_start(args, fmt);
> + vsnprintf(path, sizeof(path), fmt, args);
> + va_end(args);
> + if (fatal) {
> + filep = fopen_or_exit(path, "r");
> + } else {
> + filep = fopen(path, "r");
> + if (!filep)
> + return -1;
> + }
> + if (fscanf(filep, "%d", &value) != 1)
> + err(1, "%s: failed to parse number from file", path);
> + fclose(filep);
> +
> + return value;
> +}
> +
> +int cpufreq_sysfs_present(void)
> +{
> + DIR *dir;
> +
> + dir = opendir("/sys/devices/system/cpu/cpu0/cpufreq");
> + if (dir) {
> + closedir(dir);
> + return 1;
> + }
> +
> + return 0;
> +}
> +
> +int out_format_is_json(void)
> +{
> + return out_format_json;
> +}
> +
> +int get_physical_package_id(int cpu)
> +{
> + return parse_int_file(
> + 1,
> "/sys/devices/system/cpu/cpu%d/topology/physical_package_id",
> + cpu);
> +}
> +
> +int get_physical_core_id(int cpu)
> +{
> + return parse_int_file(
> + 1, "/sys/devices/system/cpu/cpu%d/topology/core_id",
> cpu);
> +}
> +
> +int get_physical_die_id(int cpu)
> +{
> + int ret;
> +
> + ret = parse_int_file(0,
> "/sys/devices/system/cpu/cpu%d/topology/die_id",
> + cpu);
> + if (ret < 0)
> + ret = 0;
> +
> + return ret;
> +}
> +
> +int get_topo_max_cpus(void)
> +{
> + return topo_max_cpus;
> +}
> +
> +#define MAX_PACKAGE_COUNT 8
> +#define MAX_DIE_PER_PACKAGE 2
> +static void for_each_online_package_in_set(void (*callback)(int,
> void *, void *,
> + void *,
> void *),
> + void *arg1, void *arg2, void
> *arg3,
> + void *arg4)
> +{
> + int max_packages[MAX_PACKAGE_COUNT * MAX_PACKAGE_COUNT];
> + int pkg_index = 0, i;
> +
> + memset(max_packages, 0xff, sizeof(max_packages));
> + for (i = 0; i < topo_max_cpus; ++i) {
> + int j, online, pkg_id, die_id = 0, skip = 0;
> +
> + if (!CPU_ISSET_S(i, present_cpumask_size,
> present_cpumask))
> + continue;
> + if (i)
> + online = parse_int_file(
> + 1,
> "/sys/devices/system/cpu/cpu%d/online", i);
> + else
> + online =
> + 1; /* online entry for CPU 0 needs some
> special configs */
> +
> + die_id = get_physical_die_id(i);
> + if (die_id < 0)
> + die_id = 0;
> + pkg_id = get_physical_package_id(i);
> + /* Create an unique id for package, die combination to
> store */
> + pkg_id = (MAX_PACKAGE_COUNT * pkg_id + die_id);
> +
> + for (j = 0; j < pkg_index; ++j) {
> + if (max_packages[j] == pkg_id) {
> + skip = 1;
> + break;
> + }
> + }
> +
> + if (!skip && online && callback) {
> + callback(i, arg1, arg2, arg3, arg4);
> + max_packages[pkg_index++] = pkg_id;
> + }
> + }
> +}
> +
> +static void for_each_online_target_cpu_in_set(
> + void (*callback)(int, void *, void *, void *, void *), void
> *arg1,
> + void *arg2, void *arg3, void *arg4)
> +{
> + int i;
> +
> + for (i = 0; i < topo_max_cpus; ++i) {
> + int online;
> +
> + if (!CPU_ISSET_S(i, target_cpumask_size,
> target_cpumask))
> + continue;
> + if (i)
> + online = parse_int_file(
> + 1,
> "/sys/devices/system/cpu/cpu%d/online", i);
> + else
> + online =
> + 1; /* online entry for CPU 0 needs some
> special configs */
> +
> + if (online && callback)
> + callback(i, arg1, arg2, arg3, arg4);
> + }
> +}
> +
> +#define BITMASK_SIZE 32
> +static void set_max_cpu_num(void)
> +{
> + FILE *filep;
> + unsigned long dummy;
> +
> + topo_max_cpus = 0;
> + filep = fopen_or_exit(
> + "/sys/devices/system/cpu/cpu0/topology/thread_siblings"
> , "r");
> + while (fscanf(filep, "%lx,", &dummy) == 1)
> + topo_max_cpus += BITMASK_SIZE;
> + fclose(filep);
> + topo_max_cpus--; /* 0 based */
> +
> + debug_printf("max cpus %d\n", topo_max_cpus);
> +}
> +
> +size_t alloc_cpu_set(cpu_set_t **cpu_set)
> +{
> + cpu_set_t *_cpu_set;
> + size_t size;
> +
> + _cpu_set = CPU_ALLOC((topo_max_cpus + 1));
> + if (_cpu_set == NULL)
> + err(3, "CPU_ALLOC");
> + size = CPU_ALLOC_SIZE((topo_max_cpus + 1));
> + CPU_ZERO_S(size, _cpu_set);
> +
> + *cpu_set = _cpu_set;
> + return size;
> +}
> +
> +void free_cpu_set(cpu_set_t *cpu_set)
> +{
> + CPU_FREE(cpu_set);
> +}
> +
> +static int cpu_cnt[MAX_PACKAGE_COUNT][MAX_DIE_PER_PACKAGE];
> +static void set_cpu_present_cpu_mask(void)
> +{
> + size_t size;
> + DIR *dir;
> + int i;
> +
> + size = alloc_cpu_set(&present_cpumask);
> + present_cpumask_size = size;
> + for (i = 0; i < topo_max_cpus; ++i) {
> + char buffer[256];
> +
> + snprintf(buffer, sizeof(buffer),
> + "/sys/devices/system/cpu/cpu%d", i);
> + dir = opendir(buffer);
> + if (dir) {
> + int pkg_id, die_id;
> +
> + CPU_SET_S(i, size, present_cpumask);
> + die_id = get_physical_die_id(i);
> + if (die_id < 0)
> + die_id = 0;
> +
> + pkg_id = get_physical_package_id(i);
> + if (pkg_id < MAX_PACKAGE_COUNT &&
> + die_id < MAX_DIE_PER_PACKAGE)
> + cpu_cnt[pkg_id][die_id]++;
> + }
> + closedir(dir);
> + }
> +}
> +
> +int get_cpu_count(int pkg_id, int die_id)
> +{
> + if (pkg_id < MAX_PACKAGE_COUNT && die_id < MAX_DIE_PER_PACKAGE)
> + return cpu_cnt[pkg_id][die_id] + 1;
> +
> + return 0;
> +}
> +
> +static void set_cpu_target_cpu_mask(void)
> +{
> + size_t size;
> + int i;
> +
> + size = alloc_cpu_set(&target_cpumask);
> + target_cpumask_size = size;
> + for (i = 0; i < max_target_cpus; ++i) {
> + if (!CPU_ISSET_S(target_cpus[i], present_cpumask_size,
> + present_cpumask))
> + continue;
> +
> + CPU_SET_S(target_cpus[i], size, target_cpumask);
> + }
> +}
> +
> +static void create_cpu_map(void)
> +{
> + const char *pathname = "/dev/isst_interface";
> + int i, fd = 0;
> + struct isst_if_cpu_maps map;
> +
> + cpu_map = malloc(sizeof(*cpu_map) * topo_max_cpus);
> + if (!cpu_map)
> + err(3, "cpumap");
> +
> + fd = open(pathname, O_RDWR);
> + if (fd < 0)
> + err(-1, "%s open failed", pathname);
> +
> + for (i = 0; i < topo_max_cpus; ++i) {
> + if (!CPU_ISSET_S(i, present_cpumask_size,
> present_cpumask))
> + continue;
> +
> + map.cmd_count = 1;
> + map.cpu_map[0].logical_cpu = i;
> +
> + debug_printf(" map logical_cpu:%d\n",
> + map.cpu_map[0].logical_cpu);
> + if (ioctl(fd, ISST_IF_GET_PHY_ID, &map) == -1) {
> + perror("ISST_IF_GET_PHY_ID");
> + fprintf(outf, "Error: map logical_cpu:%d\n",
> + map.cpu_map[0].logical_cpu);
> + continue;
> + }
> + cpu_map[i].core_id = get_physical_core_id(i);
> + cpu_map[i].pkg_id = get_physical_package_id(i);
> + cpu_map[i].die_id = get_physical_die_id(i);
> + cpu_map[i].punit_cpu = map.cpu_map[0].physical_cpu;
> + cpu_map[i].punit_cpu_core =
> (map.cpu_map[0].physical_cpu >>
> + 1); // shift to get core
> id
> +
> + debug_printf(
> + "map logical_cpu:%d core: %d die:%d pkg:%d
> punit_cpu:%d punit_core:%d\n",
> + i, cpu_map[i].core_id, cpu_map[i].die_id,
> + cpu_map[i].pkg_id, cpu_map[i].punit_cpu,
> + cpu_map[i].punit_cpu_core);
> + }
> +
> + if (fd)
> + close(fd);
> +}
> +
> +int find_logical_cpu(int pkg_id, int die_id, int punit_core_id)
> +{
> + int i;
> +
> + for (i = 0; i < topo_max_cpus; ++i) {
> + if (cpu_map[i].pkg_id == pkg_id &&
> + cpu_map[i].die_id == die_id &&
> + cpu_map[i].punit_cpu_core == punit_core_id)
> + return i;
> + }
> +
> + return -EINVAL;
> +}
> +
> +void set_cpu_mask_from_punit_coremask(int cpu, unsigned long long
> core_mask,
> + size_t core_cpumask_size,
> + cpu_set_t *core_cpumask, int
> *cpu_cnt)
> +{
> + int i, cnt = 0;
> + int die_id, pkg_id;
> +
> + *cpu_cnt = 0;
> + die_id = get_physical_die_id(cpu);
> + pkg_id = get_physical_package_id(cpu);
> +
> + for (i = 0; i < 64; ++i) {
> + if (core_mask & BIT(i)) {
> + int j;
> +
> + for (j = 0; j < topo_max_cpus; ++j) {
> + if (cpu_map[j].pkg_id == pkg_id &&
> + cpu_map[j].die_id == die_id &&
> + cpu_map[j].punit_cpu_core == i) {
> + CPU_SET_S(j, core_cpumask_size,
> + core_cpumask);
> + ++cnt;
> + }
> + }
> + }
> + }
> +
> + *cpu_cnt = cnt;
> +}
> +
> +int find_phy_core_num(int logical_cpu)
> +{
> + if (logical_cpu < topo_max_cpus)
> + return cpu_map[logical_cpu].punit_cpu_core;
> +
> + return -EINVAL;
> +}
> +
> +static int isst_send_mmio_command(unsigned int cpu, unsigned int
> reg, int write,
> + unsigned int *value)
> +{
> + struct isst_if_io_regs io_regs;
> + const char *pathname = "/dev/isst_interface";
> + int cmd;
> + int fd;
> +
> + debug_printf("mmio_cmd cpu:%d reg:%d write:%d\n", cpu, reg,
> write);
> +
> + fd = open(pathname, O_RDWR);
> + if (fd < 0)
> + err(-1, "%s open failed", pathname);
> +
> + io_regs.req_count = 1;
> + io_regs.io_reg[0].logical_cpu = cpu;
> + io_regs.io_reg[0].reg = reg;
> + cmd = ISST_IF_IO_CMD;
> + if (write) {
> + io_regs.io_reg[0].read_write = 1;
> + io_regs.io_reg[0].value = *value;
> + } else {
> + io_regs.io_reg[0].read_write = 0;
> + }
> +
> + if (ioctl(fd, cmd, &io_regs) == -1) {
> + perror("ISST_IF_IO_CMD");
> + fprintf(outf, "Error: mmio_cmd cpu:%d reg:%x
> read_write:%x\n",
> + cpu, reg, write);
> + } else {
> + if (!write)
> + *value = io_regs.io_reg[0].value;
> +
> + debug_printf(
> + "mmio_cmd response: cpu:%d reg:%x rd_write:%x
> resp:%x\n",
> + cpu, reg, write, *value);
> + }
> +
> + close(fd);
> +
> + return 0;
> +}
> +
> +int isst_send_mbox_command(unsigned int cpu, unsigned char command,
> + unsigned char sub_command, unsigned int
> parameter,
> + unsigned int req_data, unsigned int *resp)
> +{
> + const char *pathname = "/dev/isst_interface";
> + int fd;
> + struct isst_if_mbox_cmds mbox_cmds = { 0 };
> +
> + debug_printf(
> + "mbox_send: cpu:%d command:%x sub_command:%x
> parameter:%x req_data:%x\n",
> + cpu, command, sub_command, parameter, req_data);
> +
> + if (isst_platform_info.mmio_supported && command ==
> CONFIG_CLOS) {
> + unsigned int value;
> + int write = 0;
> + int clos_id, core_id, ret = 0;
> +
> + debug_printf("CLOS %d\n", cpu);
> +
> + if (parameter & BIT(MBOX_CMD_WRITE_BIT)) {
> + value = req_data;
> + write = 1;
> + }
> +
> + switch (sub_command) {
> + case CLOS_PQR_ASSOC:
> + core_id = parameter & 0xff;
> + ret = isst_send_mmio_command(
> + cpu, PQR_ASSOC_OFFSET + core_id * 4,
> write,
> + &value);
> + if (!ret && !write)
> + *resp = value;
> + break;
> + case CLOS_PM_CLOS:
> + clos_id = parameter & 0x03;
> + ret = isst_send_mmio_command(
> + cpu, PM_CLOS_OFFSET + clos_id * 4,
> write,
> + &value);
> + if (!ret && !write)
> + *resp = value;
> + break;
> + case CLOS_PM_QOS_CONFIG:
> + ret = isst_send_mmio_command(cpu,
> PM_QOS_CONFIG_OFFSET,
> + write, &value);
> + if (!ret && !write)
> + *resp = value;
> + break;
> + case CLOS_STATUS:
> + break;
> + default:
> + break;
> + }
> + return ret;
> + }
> +
> + mbox_cmds.cmd_count = 1;
> + mbox_cmds.mbox_cmd[0].logical_cpu = cpu;
> + mbox_cmds.mbox_cmd[0].command = command;
> + mbox_cmds.mbox_cmd[0].sub_command = sub_command;
> + mbox_cmds.mbox_cmd[0].parameter = parameter;
> + mbox_cmds.mbox_cmd[0].req_data = req_data;
> +
> + fd = open(pathname, O_RDWR);
> + if (fd < 0)
> + err(-1, "%s open failed", pathname);
> +
> + if (ioctl(fd, ISST_IF_MBOX_COMMAND, &mbox_cmds) == -1) {
> + perror("ISST_IF_MBOX_COMMAND");
> + fprintf(outf,
> + "Error: mbox_cmd cpu:%d command:%x
> sub_command:%x parameter:%x req_data:%x\n",
> + cpu, command, sub_command, parameter,
> req_data);
> + } else {
> + *resp = mbox_cmds.mbox_cmd[0].resp_data;
> + debug_printf(
> + "mbox_cmd response: cpu:%d command:%x
> sub_command:%x parameter:%x req_data:%x resp:%x\n",
> + cpu, command, sub_command, parameter, req_data,
> *resp);
> + }
> +
> + close(fd);
> +
> + return 0;
> +}
> +
> +int isst_send_msr_command(unsigned int cpu, unsigned int msr, int
> write,
> + unsigned long long *req_resp)
> +{
> + struct isst_if_msr_cmds msr_cmds;
> + const char *pathname = "/dev/isst_interface";
> + int fd;
> +
> + fd = open(pathname, O_RDWR);
> + if (fd < 0)
> + err(-1, "%s open failed", pathname);
> +
> + msr_cmds.cmd_count = 1;
> + msr_cmds.msr_cmd[0].logical_cpu = cpu;
> + msr_cmds.msr_cmd[0].msr = msr;
> + msr_cmds.msr_cmd[0].read_write = write;
> + if (write)
> + msr_cmds.msr_cmd[0].data = *req_resp;
> +
> + if (ioctl(fd, ISST_IF_MSR_COMMAND, &msr_cmds) == -1) {
> + perror("ISST_IF_MSR_COMMAD");
> + fprintf(outf, "Error: msr_cmd cpu:%d msr:%x
> read_write:%d\n",
> + cpu, msr, write);
> + } else {
> + if (!write)
> + *req_resp = msr_cmds.msr_cmd[0].data;
> +
> + debug_printf(
> + "msr_cmd response: cpu:%d msr:%x rd_write:%x
> resp:%llx %llx\n",
> + cpu, msr, write, *req_resp,
> msr_cmds.msr_cmd[0].data);
> + }
> +
> + close(fd);
> +
> + return 0;
> +}
> +
> +static int isst_fill_platform_info(void)
> +{
> + const char *pathname = "/dev/isst_interface";
> + int fd;
> +
> + fd = open(pathname, O_RDWR);
> + if (fd < 0)
> + err(-1, "%s open failed", pathname);
> +
> + if (ioctl(fd, ISST_IF_GET_PLATFORM_INFO, &isst_platform_info)
> == -1) {
> + perror("ISST_IF_GET_PLATFORM_INFO");
> + close(fd);
> + return -1;
> + }
> +
> + close(fd);
> +
> + return 0;
> +}
> +
> +static void isst_print_platform_information(void)
> +{
> + struct isst_if_platform_info platform_info;
> + const char *pathname = "/dev/isst_interface";
> + int fd;
> +
> + fd = open(pathname, O_RDWR);
> + if (fd < 0)
> + err(-1, "%s open failed", pathname);
> +
> + if (ioctl(fd, ISST_IF_GET_PLATFORM_INFO, &platform_info) == -1)
> {
> + perror("ISST_IF_GET_PLATFORM_INFO");
> + } else {
> + fprintf(outf, "Platform: API version : %d\n",
> + platform_info.api_version);
> + fprintf(outf, "Platform: Driver version : %d\n",
> + platform_info.driver_version);
> + fprintf(outf, "Platform: mbox supported : %d\n",
> + platform_info.mbox_supported);
> + fprintf(outf, "Platform: mmio supported : %d\n",
> + platform_info.mmio_supported);
> + }
> +
> + close(fd);
> +
> + exit(0);
> +}
> +
> +static void exec_on_get_ctdp_cpu(int cpu, void *arg1, void *arg2,
> void *arg3,
> + void *arg4)
> +{
> + int (*fn_ptr)(int cpu, void *arg);
> + int ret;
> +
> + fn_ptr = arg1;
> + ret = fn_ptr(cpu, arg2);
> + if (ret)
> + perror("get_tdp_*");
> + else
> + isst_display_result(cpu, outf, "perf-profile", (char
> *)arg3,
> + *(unsigned int *)arg4);
> +}
> +
> +#define _get_tdp_level(desc, suffix, object,
> help) \
> + static void
> get_tdp_##object(void) \
> + {
> \
> + struct isst_pkg_ctdp
> ctdp; \
> +\
> + if (cmd_help)
> { \
> + fprintf(stderr,
> \
> + "Print %s [No command arguments are
> required]\n", \
> + help);
> \
> + exit(0);
> \
> + }
> \
> + isst_ctdp_display_information_start(outf);
> \
> + if
> (max_target_cpus) \
> + for_each_online_target_cpu_in_set(
> \
> + exec_on_get_ctdp_cpu,
> isst_get_ctdp_##suffix, \
> + &ctdp, desc,
> &ctdp.object); \
> + else
> \
> + for_each_online_package_in_set(exec_on_get_ctdp
> _cpu, \
> + isst_get_ctdp_##
> suffix, \
> + &ctdp,
> desc, \
> + &ctdp.object);
> \
> + isst_ctdp_display_information_end(outf);
> \
> + }
> +
> +_get_tdp_level("get-config-levels", levels, levels, "TDP levels");
> +_get_tdp_level("get-config-version", levels, version, "TDP
> version");
> +_get_tdp_level("get-config-enabled", levels, enabled, "TDP enable
> status");
> +_get_tdp_level("get-config-current_level", levels, current_level,
> + "Current TDP Level");
> +_get_tdp_level("get-lock-status", levels, locked, "TDP lock
> status");
> +
> +static void dump_isst_config_for_cpu(int cpu, void *arg1, void
> *arg2,
> + void *arg3, void *arg4)
> +{
> + struct isst_pkg_ctdp pkg_dev;
> + int ret;
> +
> + memset(&pkg_dev, 0, sizeof(pkg_dev));
> + ret = isst_get_process_ctdp(cpu, tdp_level, &pkg_dev);
> + if (ret) {
> + perror("isst_get_process_ctdp");
> + } else {
> + isst_ctdp_display_information(cpu, outf, tdp_level,
> &pkg_dev);
> + isst_get_process_ctdp_complete(cpu, &pkg_dev);
> + }
> +}
> +
> +static void dump_isst_config(void)
> +{
> + if (cmd_help) {
> + fprintf(stderr,
> + "Print Intel(R) Speed Select Technology
> Performance profile configuration\n");
> + fprintf(stderr,
> + "including base frequency and turbo frequency
> configurations\n");
> + fprintf(stderr, "Optional: -l|--level : Specify tdp
> level\n");
> + fprintf(stderr,
> + "\tIf no arguments, dump information for all
> TDP levels\n");
> + exit(0);
> + }
> +
> + isst_ctdp_display_information_start(outf);
> +
> + if (max_target_cpus)
> + for_each_online_target_cpu_in_set(dump_isst_config_for_
> cpu,
> + NULL, NULL, NULL,
> NULL);
> + else
> + for_each_online_package_in_set(dump_isst_config_for_cpu
> , NULL,
> + NULL, NULL, NULL);
> +
> + isst_ctdp_display_information_end(outf);
> +}
> +
> +static void set_tdp_level_for_cpu(int cpu, void *arg1, void *arg2,
> void *arg3,
> + void *arg4)
> +{
> + int ret;
> +
> + ret = isst_set_tdp_level(cpu, tdp_level);
> + if (ret)
> + perror("set_tdp_level_for_cpu");
> + else
> + isst_display_result(cpu, outf, "perf-profile",
> "set_tdp_level",
> + ret);
> +}
> +
> +static void set_tdp_level(void)
> +{
> + if (cmd_help) {
> + fprintf(stderr, "Set Config TDP level\n");
> + fprintf(stderr,
> + "\t Arguments: -l|--level : Specify tdp
> level\n");
> + exit(0);
> + }
> +
> + if (tdp_level == 0xff) {
> + fprintf(outf, "Invalid command: specify tdp_level\n");
> + exit(1);
> + }
> + isst_ctdp_display_information_start(outf);
> + if (max_target_cpus)
> + for_each_online_target_cpu_in_set(set_tdp_level_for_cpu
> , NULL,
> + NULL, NULL, NULL);
> + else
> + for_each_online_package_in_set(set_tdp_level_for_cpu,
> NULL,
> + NULL, NULL, NULL);
> + isst_ctdp_display_information_end(outf);
> +}
> +
> +static void dump_pbf_config_for_cpu(int cpu, void *arg1, void *arg2,
> void *arg3,
> + void *arg4)
> +{
> + struct isst_pbf_info pbf_info;
> + int ret;
> +
> + ret = isst_get_pbf_info(cpu, tdp_level, &pbf_info);
> + if (ret) {
> + perror("isst_get_pbf_info");
> + } else {
> + isst_pbf_display_information(cpu, outf, tdp_level,
> &pbf_info);
> + isst_get_pbf_info_complete(&pbf_info);
> + }
> +}
> +
> +static void dump_pbf_config(void)
> +{
> + if (cmd_help) {
> + fprintf(stderr,
> + "Print Intel(R) Speed Select Technology base
> frequency configuration for a TDP level\n");
> + fprintf(stderr,
> + "\tArguments: -l|--level : Specify tdp
> level\n");
> + exit(0);
> + }
> +
> + if (tdp_level == 0xff) {
> + fprintf(outf, "Invalid command: specify tdp_level\n");
> + exit(1);
> + }
> +
> + isst_ctdp_display_information_start(outf);
> + if (max_target_cpus)
> + for_each_online_target_cpu_in_set(dump_pbf_config_for_c
> pu, NULL,
> + NULL, NULL, NULL);
> + else
> + for_each_online_package_in_set(dump_pbf_config_for_cpu,
> NULL,
> + NULL, NULL, NULL);
> + isst_ctdp_display_information_end(outf);
> +}
> +
> +static void set_pbf_for_cpu(int cpu, void *arg1, void *arg2, void
> *arg3,
> + void *arg4)
> +{
> + int ret;
> + int status = *(int *)arg4;
> +
> + ret = isst_set_pbf_fact_status(cpu, 1, status);
> + if (ret) {
> + perror("isst_set_pbf");
> + } else {
> + if (status)
> + isst_display_result(cpu, outf, "base-freq",
> "enable",
> + ret);
> + else
> + isst_display_result(cpu, outf, "base-freq",
> "disable",
> + ret);
> + }
> +}
> +
> +static void set_pbf_enable(void)
> +{
> + int status = 1;
> +
> + if (cmd_help) {
> + fprintf(stderr,
> + "Enable Intel Speed Select Technology base
> frequency feature [No command arguments are required]\n");
> + exit(0);
> + }
> +
> + isst_ctdp_display_information_start(outf);
> + if (max_target_cpus)
> + for_each_online_target_cpu_in_set(set_pbf_for_cpu,
> NULL, NULL,
> + NULL, &status);
> + else
> + for_each_online_package_in_set(set_pbf_for_cpu, NULL,
> NULL,
> + NULL, &status);
> + isst_ctdp_display_information_end(outf);
> +}
> +
> +static void set_pbf_disable(void)
> +{
> + int status = 0;
> +
> + if (cmd_help) {
> + fprintf(stderr,
> + "Disable Intel Speed Select Technology base
> frequency feature [No command arguments are required]\n");
> + exit(0);
> + }
> +
> + isst_ctdp_display_information_start(outf);
> + if (max_target_cpus)
> + for_each_online_target_cpu_in_set(set_pbf_for_cpu,
> NULL, NULL,
> + NULL, &status);
> + else
> + for_each_online_package_in_set(set_pbf_for_cpu, NULL,
> NULL,
> + NULL, &status);
> + isst_ctdp_display_information_end(outf);
> +}
> +
> +static void dump_fact_config_for_cpu(int cpu, void *arg1, void
> *arg2,
> + void *arg3, void *arg4)
> +{
> + struct isst_fact_info fact_info;
> + int ret;
> +
> + ret = isst_get_fact_info(cpu, tdp_level, &fact_info);
> + if (ret)
> + perror("isst_get_fact_bucket_info");
> + else
> + isst_fact_display_information(cpu, outf, tdp_level,
> fact_bucket,
> + fact_avx, &fact_info);
> +}
> +
> +static void dump_fact_config(void)
> +{
> + if (cmd_help) {
> + fprintf(stderr,
> + "Print complete Intel Speed Select Technology
> turbo frequency configuration for a TDP level. Other arguments are
> optional.\n");
> + fprintf(stderr,
> + "\tArguments: -l|--level : Specify tdp
> level\n");
> + fprintf(stderr,
> + "\tArguments: -b|--bucket : Bucket index to
> dump\n");
> + fprintf(stderr,
> + "\tArguments: -r|--trl-type : Specify trl type:
> sse|avx2|avx512\n");
> + exit(0);
> + }
> +
> + if (tdp_level == 0xff) {
> + fprintf(outf, "Invalid command: specify tdp_level\n");
> + exit(1);
> + }
> +
> + isst_ctdp_display_information_start(outf);
> + if (max_target_cpus)
> + for_each_online_target_cpu_in_set(dump_fact_config_for_
> cpu,
> + NULL, NULL, NULL,
> NULL);
> + else
> + for_each_online_package_in_set(dump_fact_config_for_cpu
> , NULL,
> + NULL, NULL, NULL);
> + isst_ctdp_display_information_end(outf);
> +}
> +
> +static void set_fact_for_cpu(int cpu, void *arg1, void *arg2, void
> *arg3,
> + void *arg4)
> +{
> + int ret;
> + int status = *(int *)arg4;
> +
> + ret = isst_set_pbf_fact_status(cpu, 0, status);
> + if (ret)
> + perror("isst_set_fact");
> + else {
> + if (status) {
> + struct isst_pkg_ctdp pkg_dev;
> +
> + ret = isst_get_ctdp_levels(cpu, &pkg_dev);
> + if (ret) {
> + isst_display_result(cpu, outf, "turbo-
> freq",
> + "enable", ret);
> + return;
> + }
> + ret = isst_set_trl(cpu, fact_trl);
> + isst_display_result(cpu, outf, "turbo-freq",
> "enable",
> + ret);
> + } else {
> + /* Since we modified TRL during Fact enable,
> restore it */
> + isst_set_trl_from_current_tdp(cpu, fact_trl);
> + isst_display_result(cpu, outf, "turbo-freq",
> "disable",
> + ret);
> + }
> + }
> +}
> +
> +static void set_fact_enable(void)
> +{
> + int status = 1;
> +
> + if (cmd_help) {
> + fprintf(stderr,
> + "Enable Intel Speed Select Technology Turbo
> frequency feature\n");
> + fprintf(stderr,
> + "Optional: -t|--trl : Specify turbo ratio
> limit\n");
> + exit(0);
> + }
> +
> + isst_ctdp_display_information_start(outf);
> + if (max_target_cpus)
> + for_each_online_target_cpu_in_set(set_fact_for_cpu,
> NULL, NULL,
> + NULL, &status);
> + else
> + for_each_online_package_in_set(set_fact_for_cpu, NULL,
> NULL,
> + NULL, &status);
> + isst_ctdp_display_information_end(outf);
> +}
> +
> +static void set_fact_disable(void)
> +{
> + int status = 0;
> +
> + if (cmd_help) {
> + fprintf(stderr,
> + "Disable Intel Speed Select Technology turbo
> frequency feature\n");
> + fprintf(stderr,
> + "Optional: -t|--trl : Specify turbo ratio
> limit\n");
> + exit(0);
> + }
> +
> + isst_ctdp_display_information_start(outf);
> + if (max_target_cpus)
> + for_each_online_target_cpu_in_set(set_fact_for_cpu,
> NULL, NULL,
> + NULL, &status);
> + else
> + for_each_online_package_in_set(set_fact_for_cpu, NULL,
> NULL,
> + NULL, &status);
> + isst_ctdp_display_information_end(outf);
> +}
> +
> +static void enable_clos_qos_config(int cpu, void *arg1, void *arg2,
> void *arg3,
> + void *arg4)
> +{
> + int ret;
> + int status = *(int *)arg4;
> +
> + ret = isst_pm_qos_config(cpu, status, clos_priority_type);
> + if (ret) {
> + perror("isst_pm_qos_config");
> + } else {
> + if (status)
> + isst_display_result(cpu, outf, "core-power",
> "enable",
> + ret);
> + else
> + isst_display_result(cpu, outf, "core-power",
> "disable",
> + ret);
> + }
> +}
> +
> +static void set_clos_enable(void)
> +{
> + int status = 1;
> +
> + if (cmd_help) {
> + fprintf(stderr, "Enable core-power for a
> package/die\n");
> + fprintf(stderr,
> + "\tClos Enable: Specify priority type with [
> --priority|-p]\n");
> + fprintf(stderr, "\t\t 0: Proportional, 1: Ordered\n");
> + exit(0);
> + }
> +
> + if (cpufreq_sysfs_present()) {
> + fprintf(stderr,
> + "cpufreq subsystem and core-power enable will
> interfere with each other!\n");
> + }
> +
> + isst_ctdp_display_information_start(outf);
> + if (max_target_cpus)
> + for_each_online_target_cpu_in_set(enable_clos_qos_confi
> g, NULL,
> + NULL, NULL, &status);
> + else
> + for_each_online_package_in_set(enable_clos_qos_config,
> NULL,
> + NULL, NULL, &status);
> + isst_ctdp_display_information_end(outf);
> +}
> +
> +static void set_clos_disable(void)
> +{
> + int status = 0;
> +
> + if (cmd_help) {
> + fprintf(stderr,
> + "Disable core-power: [No command arguments are
> required]\n");
> + exit(0);
> + }
> +
> + isst_ctdp_display_information_start(outf);
> + if (max_target_cpus)
> + for_each_online_target_cpu_in_set(enable_clos_qos_confi
> g, NULL,
> + NULL, NULL, &status);
> + else
> + for_each_online_package_in_set(enable_clos_qos_config,
> NULL,
> + NULL, NULL, &status);
> + isst_ctdp_display_information_end(outf);
> +}
> +
> +static void dump_clos_config_for_cpu(int cpu, void *arg1, void
> *arg2,
> + void *arg3, void *arg4)
> +{
> + struct isst_clos_config clos_config;
> + int ret;
> +
> + ret = isst_pm_get_clos(cpu, current_clos, &clos_config);
> + if (ret)
> + perror("isst_pm_get_clos");
> + else
> + isst_clos_display_information(cpu, outf, current_clos,
> + &clos_config);
> +}
> +
> +static void dump_clos_config(void)
> +{
> + if (cmd_help) {
> + fprintf(stderr,
> + "Print Intel Speed Select Technology core power
> configuration\n");
> + fprintf(stderr,
> + "\tArguments: [-c | --clos]: Specify clos
> id\n");
> + exit(0);
> + }
> + if (current_clos < 0 || current_clos > 3) {
> + fprintf(stderr, "Invalid clos id\n");
> + exit(0);
> + }
> +
> + isst_ctdp_display_information_start(outf);
> + if (max_target_cpus)
> + for_each_online_target_cpu_in_set(dump_clos_config_for_
> cpu,
> + NULL, NULL, NULL,
> NULL);
> + else
> + for_each_online_package_in_set(dump_clos_config_for_cpu
> , NULL,
> + NULL, NULL, NULL);
> + isst_ctdp_display_information_end(outf);
> +}
> +
> +static void set_clos_config_for_cpu(int cpu, void *arg1, void *arg2,
> void *arg3,
> + void *arg4)
> +{
> + struct isst_clos_config clos_config;
> + int ret;
> +
> + clos_config.pkg_id = get_physical_package_id(cpu);
> + clos_config.die_id = get_physical_die_id(cpu);
> +
> + clos_config.epp = clos_epp;
> + clos_config.clos_prop_prio = clos_prop_prio;
> + clos_config.clos_min = clos_min;
> + clos_config.clos_max = clos_max;
> + clos_config.clos_desired = clos_desired;
> + ret = isst_set_clos(cpu, current_clos, &clos_config);
> + if (ret)
> + perror("isst_set_clos");
> + else
> + isst_display_result(cpu, outf, "core-power", "config",
> ret);
> +}
> +
> +static void set_clos_config(void)
> +{
> + if (cmd_help) {
> + fprintf(stderr,
> + "Set core-power configuration for one of the
> four clos ids\n");
> + fprintf(stderr,
> + "\tSpecify targeted clos id with [--clos|-
> c]\n");
> + fprintf(stderr, "\tSpecify clos EPP with [--epp|-
> e]\n");
> + fprintf(stderr,
> + "\tSpecify clos Proportional Priority [
> --weight|-w]\n");
> + fprintf(stderr, "\tSpecify clos min with [--min|-
> n]\n");
> + fprintf(stderr, "\tSpecify clos max with [--max|-
> m]\n");
> + fprintf(stderr, "\tSpecify clos desired with [
> --desired|-d]\n");
> + exit(0);
> + }
> +
> + if (current_clos < 0 || current_clos > 3) {
> + fprintf(stderr, "Invalid clos id\n");
> + exit(0);
> + }
> + if (clos_epp < 0 || clos_epp > 0x0F) {
> + fprintf(stderr, "clos epp is not specified, default:
> 0\n");
> + clos_epp = 0;
> + }
> + if (clos_prop_prio < 0 || clos_prop_prio > 0x0F) {
> + fprintf(stderr,
> + "clos frequency weight is not specified,
> default: 0\n");
> + clos_prop_prio = 0;
> + }
> + if (clos_min < 0) {
> + fprintf(stderr, "clos min is not specified, default:
> 0\n");
> + clos_min = 0;
> + }
> + if (clos_max < 0) {
> + fprintf(stderr, "clos max is not specified, default:
> 0xff\n");
> + clos_max = 0xff;
> + }
> + if (clos_desired < 0) {
> + fprintf(stderr, "clos desired is not specified,
> default: 0\n");
> + clos_desired = 0x00;
> + }
> +
> + isst_ctdp_display_information_start(outf);
> + if (max_target_cpus)
> + for_each_online_target_cpu_in_set(set_clos_config_for_c
> pu, NULL,
> + NULL, NULL, NULL);
> + else
> + for_each_online_package_in_set(set_clos_config_for_cpu,
> NULL,
> + NULL, NULL, NULL);
> + isst_ctdp_display_information_end(outf);
> +}
> +
> +static void set_clos_assoc_for_cpu(int cpu, void *arg1, void *arg2,
> void *arg3,
> + void *arg4)
> +{
> + int ret;
> +
> + ret = isst_clos_associate(cpu, current_clos);
> + if (ret)
> + perror("isst_clos_associate");
> + else
> + isst_display_result(cpu, outf, "core-power", "assoc",
> ret);
> +}
> +
> +static void set_clos_assoc(void)
> +{
> + if (cmd_help) {
> + fprintf(stderr, "Associate a clos id to a CPU\n");
> + fprintf(stderr,
> + "\tSpecify targeted clos id with [--clos|-
> c]\n");
> + exit(0);
> + }
> +
> + if (current_clos < 0 || current_clos > 3) {
> + fprintf(stderr, "Invalid clos id\n");
> + exit(0);
> + }
> + if (max_target_cpus)
> + for_each_online_target_cpu_in_set(set_clos_assoc_for_cp
> u, NULL,
> + NULL, NULL, NULL);
> + else {
> + fprintf(stderr,
> + "Invalid target cpu. Specify with [-c|
> --cpu]\n");
> + }
> +}
> +
> +static void get_clos_assoc_for_cpu(int cpu, void *arg1, void *arg2,
> void *arg3,
> + void *arg4)
> +{
> + int clos, ret;
> +
> + ret = isst_clos_get_assoc_status(cpu, &clos);
> + if (ret)
> + perror("isst_clos_get_assoc_status");
> + else
> + isst_display_result(cpu, outf, "core-power", "get-
> assoc", clos);
> +}
> +
> +static void get_clos_assoc(void)
> +{
> + if (cmd_help) {
> + fprintf(stderr, "Get associate clos id to a CPU\n");
> + fprintf(stderr, "\tSpecify targeted cpu id with [
> --cpu|-c]\n");
> + exit(0);
> + }
> + if (max_target_cpus)
> + for_each_online_target_cpu_in_set(get_clos_assoc_for_cp
> u, NULL,
> + NULL, NULL, NULL);
> + else {
> + fprintf(stderr,
> + "Invalid target cpu. Specify with [-c|
> --cpu]\n");
> + }
> +}
> +
> +static struct process_cmd_struct isst_cmds[] = {
> + { "perf-profile", "get-lock-status", get_tdp_locked },
> + { "perf-profile", "get-config-levels", get_tdp_levels },
> + { "perf-profile", "get-config-version", get_tdp_version },
> + { "perf-profile", "get-config-enabled", get_tdp_enabled },
> + { "perf-profile", "get-config-current-level",
> get_tdp_current_level },
> + { "perf-profile", "set-config-level", set_tdp_level },
> + { "perf-profile", "info", dump_isst_config },
> + { "base-freq", "info", dump_pbf_config },
> + { "base-freq", "enable", set_pbf_enable },
> + { "base-freq", "disable", set_pbf_disable },
> + { "turbo-freq", "info", dump_fact_config },
> + { "turbo-freq", "enable", set_fact_enable },
> + { "turbo-freq", "disable", set_fact_disable },
> + { "core-power", "info", dump_clos_config },
> + { "core-power", "enable", set_clos_enable },
> + { "core-power", "disable", set_clos_disable },
> + { "core-power", "config", set_clos_config },
> + { "core-power", "assoc", set_clos_assoc },
> + { "core-power", "get-assoc", get_clos_assoc },
> + { NULL, NULL, NULL }
> +};
> +
> +/*
> + * parse cpuset with following syntax
> + * 1,2,4..6,8-10 and set bits in cpu_subset
> + */
> +void parse_cpu_command(char *optarg)
> +{
> + unsigned int start, end;
> + char *next;
> +
> + next = optarg;
> +
> + while (next && *next) {
> + if (*next == '-') /* no negative cpu numbers */
> + goto error;
> +
> + start = strtoul(next, &next, 10);
> +
> + if (max_target_cpus < MAX_CPUS_IN_ONE_REQ)
> + target_cpus[max_target_cpus++] = start;
> +
> + if (*next == '\0')
> + break;
> +
> + if (*next == ',') {
> + next += 1;
> + continue;
> + }
> +
> + if (*next == '-') {
> + next += 1; /* start range */
> + } else if (*next == '.') {
> + next += 1;
> + if (*next == '.')
> + next += 1; /* start range */
> + else
> + goto error;
> + }
> +
> + end = strtoul(next, &next, 10);
> + if (end <= start)
> + goto error;
> +
> + while (++start <= end) {
> + if (max_target_cpus < MAX_CPUS_IN_ONE_REQ)
> + target_cpus[max_target_cpus++] = start;
> + }
> +
> + if (*next == ',')
> + next += 1;
> + else if (*next != '\0')
> + goto error;
> + }
> +
> +#ifdef DEBUG
> + {
> + int i;
> +
> + for (i = 0; i < max_target_cpus; ++i)
> + printf("cpu [%d] in arg\n", target_cpus[i]);
> + }
> +#endif
> + return;
> +
> +error:
> + fprintf(stderr, "\"--cpu %s\" malformed\n", optarg);
> + exit(-1);
> +}
> +
> +static void parse_cmd_args(int argc, int start, char **argv)
> +{
> + int opt;
> + int option_index;
> +
> + static struct option long_options[] = {
> + { "bucket", required_argument, 0, 'b' },
> + { "level", required_argument, 0, 'l' },
> + { "trl-type", required_argument, 0, 'r' },
> + { "trl", required_argument, 0, 't' },
> + { "help", no_argument, 0, 'h' },
> + { "clos", required_argument, 0, 'c' },
> + { "desired", required_argument, 0, 'd' },
> + { "epp", required_argument, 0, 'e' },
> + { "min", required_argument, 0, 'n' },
> + { "max", required_argument, 0, 'm' },
> + { "priority", required_argument, 0, 'p' },
> + { "weight", required_argument, 0, 'w' },
> + { 0, 0, 0, 0 }
> + };
> +
> + option_index = start;
> +
> + optind = start + 1;
> + while ((opt = getopt_long(argc, argv, "b:l:t:c:d:e:n:m:p:w:h",
> + long_options, &option_index)) != -1)
> {
> + switch (opt) {
> + case 'b':
> + fact_bucket = atoi(optarg);
> + break;
> + case 'h':
> + cmd_help = 1;
> + break;
> + case 'l':
> + tdp_level = atoi(optarg);
> + break;
> + case 't':
> + sscanf(optarg, "0x%llx", &fact_trl);
> + break;
> + case 'r':
> + if (!strncmp(optarg, "sse", 3)) {
> + fact_avx = 0x01;
> + } else if (!strncmp(optarg, "avx2", 4)) {
> + fact_avx = 0x02;
> + } else if (!strncmp(optarg, "avx512", 4)) {
> + fact_avx = 0x04;
> + } else {
> + fprintf(outf, "Invalid sse,avx
> options\n");
> + exit(1);
> + }
> + break;
> + /* CLOS related */
> + case 'c':
> + current_clos = atoi(optarg);
> + printf("clos %d\n", current_clos);
> + break;
> + case 'd':
> + clos_desired = atoi(optarg);
> + break;
> + case 'e':
> + clos_epp = atoi(optarg);
> + break;
> + case 'n':
> + clos_min = atoi(optarg);
> + break;
> + case 'm':
> + clos_max = atoi(optarg);
> + break;
> + case 'p':
> + clos_priority_type = atoi(optarg);
> + break;
> + case 'w':
> + clos_prop_prio = atoi(optarg);
> + break;
> + default:
> + printf("no match\n");
> + }
> + }
> +}
> +
> +static void isst_help(void)
> +{
> + printf("perf-profile:\tAn architectural mechanism that allows
> multiple optimized \n\
> + performance profiles per system via static and/or
> dynamic\n\
> + adjustment of core count, workload, Tjmax, and\n\
> + TDP, etc.\n");
> + printf("\nCommands : For feature=perf-profile\n");
> + printf("\tinfo\n");
> + printf("\tget-lock-status\n");
> + printf("\tget-config-levels\n");
> + printf("\tget-config-version\n");
> + printf("\tget-config-enabled\n");
> + printf("\tget-config-current-level\n");
> + printf("\tset-config-level\n");
> +}
> +
> +static void pbf_help(void)
> +{
> + printf("base-freq:\tEnables users to increase guaranteed base
> frequency\n\
> + on certain cores (high priority cores) in exchange for
> lower\n\
> + base frequency on remaining cores (low priority
> cores).\n");
> + printf("\tcommand : info\n");
> + printf("\tcommand : enable\n");
> + printf("\tcommand : disable\n");
> +}
> +
> +static void fact_help(void)
> +{
> + printf("turbo-freq:\tEnables the ability to set different turbo
> ratio\n\
> + limits to cores based on priority.\n");
> + printf("\nCommand: For feature=turbo-freq\n");
> + printf("\tcommand : info\n");
> + printf("\tcommand : enable\n");
> + printf("\tcommand : disable\n");
> +}
> +
> +static void core_power_help(void)
> +{
> + printf("core-power:\tInterface that allows user to define per
> core/tile\n\
> + priority.\n");
> + printf("\nCommands : For feature=core-power\n");
> + printf("\tinfo\n");
> + printf("\tenable\n");
> + printf("\tdisable\n");
> + printf("\tconfig\n");
> + printf("\tassoc\n");
> + printf("\tget-assoc\n");
> +}
> +
> +struct process_cmd_help_struct {
> + char *feature;
> + void (*process_fn)(void);
> +};
> +
> +static struct process_cmd_help_struct isst_help_cmds[] = {
> + { "perf-profile", isst_help },
> + { "base-freq", pbf_help },
> + { "turbo-freq", fact_help },
> + { "core-power", core_power_help },
> + { NULL, NULL }
> +};
> +
> +void process_command(int argc, char **argv)
> +{
> + int i = 0, matched = 0;
> + char *feature = argv[optind];
> + char *cmd = argv[optind + 1];
> +
> + if (!feature || !cmd)
> + return;
> +
> + debug_printf("feature name [%s] command [%s]\n", feature, cmd);
> + if (!strcmp(cmd, "-h") || !strcmp(cmd, "--help")) {
> + while (isst_help_cmds[i].feature) {
> + if (!strcmp(isst_help_cmds[i].feature,
> feature)) {
> + isst_help_cmds[i].process_fn();
> + exit(0);
> + }
> + ++i;
> + }
> + }
> +
> + create_cpu_map();
> +
> + i = 0;
> + while (isst_cmds[i].feature) {
> + if (!strcmp(isst_cmds[i].feature, feature) &&
> + !strcmp(isst_cmds[i].command, cmd)) {
> + parse_cmd_args(argc, optind + 1, argv);
> + isst_cmds[i].process_fn();
> + matched = 1;
> + break;
> + }
> + ++i;
> + }
> +
> + if (!matched)
> + fprintf(stderr, "Invalid command\n");
> +}
> +
> +static void usage(void)
> +{
> + printf("Intel(R) Speed Select Technology\n");
> + printf("\nUsage:\n");
> + printf("intel-speed-select [OPTIONS] FEATURE COMMAND
> COMMAND_ARGUMENTS\n");
> + printf("\nUse this tool to enumerate and control the Intel
> Speed Select Technology features,\n");
> + printf("\nFEATURE : [perf-profile|base-freq|turbo-freq|core-
> power]\n");
> + printf("\nFor help on each feature, use --h|--help\n");
> + printf("\tFor example: intel-speed-select perf-profile -h\n");
> +
> + printf("\nFor additional help on each command for a feature,
> use --h|--help\n");
> + printf("\tFor example: intel-speed-select perf-profile get-
> lock-status -h\n");
> + printf("\t\t This will print help for the command \"get-lock-
> status\" for the feature \"perf-profile\"\n");
> +
> + printf("\nOPTIONS\n");
> + printf("\t[-c|--cpu] : logical cpu number\n");
> + printf("\t\tDefault: Die scoped for all dies in the system with
> multiple dies/package\n");
> + printf("\t\t\t Or Package scoped for all Packages when each
> package contains one die\n");
> + printf("\t[-d|--debug] : Debug mode\n");
> + printf("\t[-h|--help] : Print help\n");
> + printf("\t[-i|--info] : Print platform information\n");
> + printf("\t[-o|--out] : Output file\n");
> + printf("\t\t\tDefault : stderr\n");
> + printf("\t[-f|--format] : output format [json|text]. Default:
> text\n");
> + printf("\t[-v|--version] : Print version\n");
> +
> + printf("\nResult format\n");
> + printf("\tResult display uses a common format for each
> command:\n");
> + printf("\tResults are formatted in text/JSON with\n");
> + printf("\t\tPackage, Die, CPU, and command specific
> results.\n");
> + printf("\t\t\tFor Set commands, status is 0 for success and
> rest for failures\n");
> + exit(1);
> +}
> +
> +static void print_version(void)
> +{
> + fprintf(outf, "Version %s\n", version_str);
> + fprintf(outf, "Build date %s time %s\n", __DATE__, __TIME__);
> + exit(0);
> +}
> +
> +static void cmdline(int argc, char **argv)
> +{
> + int opt;
> + int option_index = 0;
> +
> + static struct option long_options[] = {
> + { "cpu", required_argument, 0, 'c' },
> + { "debug", no_argument, 0, 'd' },
> + { "format", required_argument, 0, 'f' },
> + { "help", no_argument, 0, 'h' },
> + { "info", no_argument, 0, 'i' },
> + { "out", required_argument, 0, 'o' },
> + { "version", no_argument, 0, 'v' },
> + { 0, 0, 0, 0 }
> + };
> +
> + progname = argv[0];
> + while ((opt = getopt_long_only(argc, argv, "+c:df:hio:v",
> long_options,
> + &option_index)) != -1) {
> + switch (opt) {
> + case 'c':
> + parse_cpu_command(optarg);
> + break;
> + case 'd':
> + debug_flag = 1;
> + printf("Debug Mode ON\n");
> + break;
> + case 'f':
> + if (!strncmp(optarg, "json", 4))
> + out_format_json = 1;
> + break;
> + case 'h':
> + usage();
> + break;
> + case 'i':
> + isst_print_platform_information();
> + break;
> + case 'o':
> + if (outf)
> + fclose(outf);
> + outf = fopen_or_exit(optarg, "w");
> + break;
> + case 'v':
> + print_version();
> + break;
> + default:
> + usage();
> + }
> + }
> +
> + if (geteuid() != 0) {
> + fprintf(stderr, "Must run as root\n");
> + exit(0);
> + }
> +
> + if (optind > (argc - 2)) {
> + fprintf(stderr, "Feature name and|or command not
> specified\n");
> + exit(0);
> + }
> + update_cpu_model();
> + printf("Intel(R) Speed Select Technology\n");
> + printf("Executing on CPU model:%d[0x%x]\n", cpu_model,
> cpu_model);
> + set_max_cpu_num();
> + set_cpu_present_cpu_mask();
> + set_cpu_target_cpu_mask();
> + isst_fill_platform_info();
> + if (isst_platform_info.api_version > supported_api_ver) {
> + printf("Incompatible API versions; Upgrade of tool is
> required\n");
> + exit(0);
> + }
> +
> + process_command(argc, argv);
> +}
> +
> +int main(int argc, char **argv)
> +{
> + outf = stderr;
> + cmdline(argc, argv);
> + return 0;
> +}
> diff --git a/tools/power/x86/intel-speed-select/isst-core.c
> b/tools/power/x86/intel-speed-select/isst-core.c
> new file mode 100644
> index 000000000000..8de4ac39a008
> --- /dev/null
> +++ b/tools/power/x86/intel-speed-select/isst-core.c
> @@ -0,0 +1,721 @@
> +// SPDX-License-Identifier: GPL-2.0
> +/*
> + * Intel Speed Select -- Enumerate and control features
> + * Copyright (c) 2019 Intel Corporation.
> + */
> +
> +#include "isst.h"
> +
> +int isst_get_ctdp_levels(int cpu, struct isst_pkg_ctdp *pkg_dev)
> +{
> + unsigned int resp;
> + int ret;
> +
> + ret = isst_send_mbox_command(cpu, CONFIG_TDP,
> + CONFIG_TDP_GET_LEVELS_INFO, 0, 0,
> &resp);
> + if (ret)
> + return ret;
> +
> + debug_printf("cpu:%d CONFIG_TDP_GET_LEVELS_INFO resp:%x\n",
> cpu, resp);
> +
> + pkg_dev->version = resp & 0xff;
> + pkg_dev->levels = (resp >> 8) & 0xff;
> + pkg_dev->current_level = (resp >> 16) & 0xff;
> + pkg_dev->locked = !!(resp & BIT(24));
> + pkg_dev->enabled = !!(resp & BIT(31));
> +
> + return 0;
> +}
> +
> +int isst_get_ctdp_control(int cpu, int config_index,
> + struct isst_pkg_ctdp_level_info *ctdp_level)
> +{
> + unsigned int resp;
> + int ret;
> +
> + ret = isst_send_mbox_command(cpu, CONFIG_TDP,
> + CONFIG_TDP_GET_TDP_CONTROL, 0,
> + config_index, &resp);
> + if (ret)
> + return ret;
> +
> + ctdp_level->fact_support = resp & BIT(0);
> + ctdp_level->pbf_support = !!(resp & BIT(1));
> + ctdp_level->fact_enabled = !!(resp & BIT(16));
> + ctdp_level->pbf_enabled = !!(resp & BIT(17));
> +
> + debug_printf(
> + "cpu:%d CONFIG_TDP_GET_TDP_CONTROL resp:%x
> fact_support:%d pbf_support: %d fact_enabled:%d pbf_enabled:%d\n",
> + cpu, resp, ctdp_level->fact_support, ctdp_level-
> >pbf_support,
> + ctdp_level->fact_enabled, ctdp_level->pbf_enabled);
> +
> + return 0;
> +}
> +
> +int isst_get_tdp_info(int cpu, int config_index,
> + struct isst_pkg_ctdp_level_info *ctdp_level)
> +{
> + unsigned int resp;
> + int ret;
> +
> + ret = isst_send_mbox_command(cpu, CONFIG_TDP,
> CONFIG_TDP_GET_TDP_INFO,
> + 0, config_index, &resp);
> + if (ret)
> + return ret;
> +
> + ctdp_level->pkg_tdp = resp & GENMASK(14, 0);
> + ctdp_level->tdp_ratio = (resp & GENMASK(23, 16)) >> 16;
> +
> + debug_printf(
> + "cpu:%d ctdp:%d CONFIG_TDP_GET_TDP_INFO resp:%x
> tdp_ratio:%d pkg_tdp:%d\n",
> + cpu, config_index, resp, ctdp_level->tdp_ratio,
> + ctdp_level->pkg_tdp);
> + return 0;
> +}
> +
> +int isst_get_pwr_info(int cpu, int config_index,
> + struct isst_pkg_ctdp_level_info *ctdp_level)
> +{
> + unsigned int resp;
> + int ret;
> +
> + ret = isst_send_mbox_command(cpu, CONFIG_TDP,
> CONFIG_TDP_GET_PWR_INFO,
> + 0, config_index, &resp);
> + if (ret)
> + return ret;
> +
> + ctdp_level->pkg_max_power = resp & GENMASK(14, 0);
> + ctdp_level->pkg_min_power = (resp & GENMASK(30, 16)) >> 16;
> +
> + debug_printf(
> + "cpu:%d ctdp:%d CONFIG_TDP_GET_PWR_INFO resp:%x
> pkg_max_power:%d pkg_min_power:%d\n",
> + cpu, config_index, resp, ctdp_level->pkg_max_power,
> + ctdp_level->pkg_min_power);
> +
> + return 0;
> +}
> +
> +int isst_get_tjmax_info(int cpu, int config_index,
> + struct isst_pkg_ctdp_level_info *ctdp_level)
> +{
> + unsigned int resp;
> + int ret;
> +
> + ret = isst_send_mbox_command(cpu, CONFIG_TDP,
> CONFIG_TDP_GET_TJMAX_INFO,
> + 0, config_index, &resp);
> + if (ret)
> + return ret;
> +
> + ctdp_level->t_proc_hot = resp & GENMASK(7, 0);
> +
> + debug_printf(
> + "cpu:%d ctdp:%d CONFIG_TDP_GET_TJMAX_INFO resp:%x
> t_proc_hot:%d\n",
> + cpu, config_index, resp, ctdp_level->t_proc_hot);
> +
> + return 0;
> +}
> +
> +int isst_get_coremask_info(int cpu, int config_index,
> + struct isst_pkg_ctdp_level_info *ctdp_level)
> +{
> + unsigned int resp;
> + int i, ret;
> +
> + ctdp_level->cpu_count = 0;
> + for (i = 0; i < 2; ++i) {
> + unsigned long long mask;
> + int cpu_count = 0;
> +
> + ret = isst_send_mbox_command(cpu, CONFIG_TDP,
> + CONFIG_TDP_GET_CORE_MASK,
> 0,
> + (i << 8) | config_index,
> &resp);
> + if (ret)
> + return ret;
> +
> + debug_printf(
> + "cpu:%d ctdp:%d mask:%d
> CONFIG_TDP_GET_CORE_MASK resp:%x\n",
> + cpu, config_index, i, resp);
> +
> + mask = (unsigned long long)resp << (32 * i);
> + set_cpu_mask_from_punit_coremask(cpu, mask,
> + ctdp_level-
> >core_cpumask_size,
> + ctdp_level-
> >core_cpumask,
> + &cpu_count);
> + ctdp_level->cpu_count += cpu_count;
> + debug_printf("cpu:%d ctdp:%d mask:%d cpu count:%d\n",
> cpu,
> + config_index, i, ctdp_level->cpu_count);
> + }
> +
> + return 0;
> +}
> +
> +int isst_get_get_trl(int cpu, int level, int avx_level, int *trl)
> +{
> + unsigned int req, resp;
> + int ret;
> +
> + req = level | (avx_level << 16);
> + ret = isst_send_mbox_command(cpu, CONFIG_TDP,
> + CONFIG_TDP_GET_TURBO_LIMIT_RATIOS,
> 0, req,
> + &resp);
> + if (ret)
> + return ret;
> +
> + debug_printf(
> + "cpu:%d CONFIG_TDP_GET_TURBO_LIMIT_RATIOS req:%x
> resp:%x\n",
> + cpu, req, resp);
> +
> + trl[0] = resp & GENMASK(7, 0);
> + trl[1] = (resp & GENMASK(15, 8)) >> 8;
> + trl[2] = (resp & GENMASK(23, 16)) >> 16;
> + trl[3] = (resp & GENMASK(31, 24)) >> 24;
> +
> + req = level | BIT(8) | (avx_level << 16);
> + ret = isst_send_mbox_command(cpu, CONFIG_TDP,
> + CONFIG_TDP_GET_TURBO_LIMIT_RATIOS,
> 0, req,
> + &resp);
> + if (ret)
> + return ret;
> +
> + debug_printf("cpu:%d CONFIG_TDP_GET_TURBO_LIMIT req:%x
> resp:%x\n", cpu,
> + req, resp);
> +
> + trl[4] = resp & GENMASK(7, 0);
> + trl[5] = (resp & GENMASK(15, 8)) >> 8;
> + trl[6] = (resp & GENMASK(23, 16)) >> 16;
> + trl[7] = (resp & GENMASK(31, 24)) >> 24;
> +
> + return 0;
> +}
> +
> +int isst_set_tdp_level_msr(int cpu, int tdp_level)
> +{
> + int ret;
> +
> + debug_printf("cpu: tdp_level via MSR %d\n", cpu, tdp_level);
> +
> + if (isst_get_config_tdp_lock_status(cpu)) {
> + debug_printf("cpu: tdp_locked %d\n", cpu);
> + return -1;
> + }
> +
> + if (tdp_level > 2)
> + return -1; /* invalid value */
> +
> + ret = isst_send_msr_command(cpu, 0x64b, 1,
> + (unsigned long long *)&tdp_level);
> + if (ret)
> + return ret;
> +
> + debug_printf("cpu: tdp_level via MSR successful %d\n", cpu,
> tdp_level);
> +
> + return 0;
> +}
> +
> +int isst_set_tdp_level(int cpu, int tdp_level)
> +{
> + unsigned int resp;
> + int ret;
> +
> + ret = isst_send_mbox_command(cpu, CONFIG_TDP,
> CONFIG_TDP_SET_LEVEL, 0,
> + tdp_level, &resp);
> + if (ret)
> + return isst_set_tdp_level_msr(cpu, tdp_level);
> +
> + return 0;
> +}
> +
> +int isst_get_pbf_info(int cpu, int level, struct isst_pbf_info
> *pbf_info)
> +{
> + unsigned int req, resp;
> + int i, ret;
> +
> + pbf_info->core_cpumask_size = alloc_cpu_set(&pbf_info-
> >core_cpumask);
> +
> + for (i = 0; i < 2; ++i) {
> + unsigned long long mask;
> + int count;
> +
> + ret = isst_send_mbox_command(cpu, CONFIG_TDP,
> + CONFIG_TDP_PBF_GET_CORE_MA
> SK_INFO,
> + 0, (i << 8) | level,
> &resp);
> + if (ret)
> + return ret;
> +
> + debug_printf(
> + "cpu:%d CONFIG_TDP_PBF_GET_CORE_MASK_INFO
> resp:%x\n",
> + cpu, resp);
> +
> + mask = (unsigned long long)resp << (32 * i);
> + set_cpu_mask_from_punit_coremask(cpu, mask,
> + pbf_info-
> >core_cpumask_size,
> + pbf_info-
> >core_cpumask,
> + &count);
> + }
> +
> + req = level;
> + ret = isst_send_mbox_command(cpu, CONFIG_TDP,
> + CONFIG_TDP_PBF_GET_P1HI_P1LO_INFO,
> 0, req,
> + &resp);
> + if (ret)
> + return ret;
> +
> + debug_printf("cpu:%d CONFIG_TDP_PBF_GET_P1HI_P1LO_INFO
> resp:%x\n", cpu,
> + resp);
> +
> + pbf_info->p1_low = resp & 0xff;
> + pbf_info->p1_high = (resp & GENMASK(15, 8)) >> 8;
> +
> + req = level;
> + ret = isst_send_mbox_command(
> + cpu, CONFIG_TDP, CONFIG_TDP_PBF_GET_TDP_INFO, 0, req,
> &resp);
> + if (ret)
> + return ret;
> +
> + debug_printf("cpu:%d CONFIG_TDP_PBF_GET_TDP_INFO resp:%x\n",
> cpu, resp);
> +
> + pbf_info->tdp = resp & 0xffff;
> +
> + req = level;
> + ret = isst_send_mbox_command(
> + cpu, CONFIG_TDP, CONFIG_TDP_PBF_GET_TJ_MAX_INFO, 0,
> req, &resp);
> + if (ret)
> + return ret;
> +
> + debug_printf("cpu:%d CONFIG_TDP_PBF_GET_TJ_MAX_INFO resp:%x\n",
> cpu,
> + resp);
> + pbf_info->t_control = (resp >> 8) & 0xff;
> + pbf_info->t_prochot = resp & 0xff;
> +
> + return 0;
> +}
> +
> +void isst_get_pbf_info_complete(struct isst_pbf_info *pbf_info)
> +{
> + free_cpu_set(pbf_info->core_cpumask);
> +}
> +
> +int isst_set_pbf_fact_status(int cpu, int pbf, int enable)
> +{
> + struct isst_pkg_ctdp pkg_dev;
> + struct isst_pkg_ctdp_level_info ctdp_level;
> + int current_level;
> + unsigned int req = 0, resp;
> + int ret;
> +
> + ret = isst_get_ctdp_levels(cpu, &pkg_dev);
> + if (ret)
> + return ret;
> +
> + current_level = pkg_dev.current_level;
> +
> + ret = isst_get_ctdp_control(cpu, current_level, &ctdp_level);
> + if (ret)
> + return ret;
> +
> + if (pbf) {
> + if (ctdp_level.fact_enabled)
> + req = BIT(16);
> +
> + if (enable)
> + req |= BIT(17);
> + else
> + req &= ~BIT(17);
> + } else {
> + if (ctdp_level.pbf_enabled)
> + req = BIT(17);
> +
> + if (enable)
> + req |= BIT(16);
> + else
> + req &= ~BIT(16);
> + }
> +
> + ret = isst_send_mbox_command(cpu, CONFIG_TDP,
> + CONFIG_TDP_SET_TDP_CONTROL, 0,
> req, &resp);
> + if (ret)
> + return ret;
> +
> + debug_printf("cpu:%d CONFIG_TDP_SET_TDP_CONTROL pbf/fact:%d
> req:%x\n",
> + cpu, pbf, req);
> +
> + return 0;
> +}
> +
> +int isst_get_fact_bucket_info(int cpu, int level,
> + struct isst_fact_bucket_info
> *bucket_info)
> +{
> + unsigned int resp;
> + int i, k, ret;
> +
> + for (i = 0; i < 2; ++i) {
> + int j;
> +
> + ret = isst_send_mbox_command(
> + cpu, CONFIG_TDP,
> + CONFIG_TDP_GET_FACT_HP_TURBO_LIMIT_NUMCORES, 0,
> + (i << 8) | level, &resp);
> + if (ret)
> + return ret;
> +
> + debug_printf(
> + "cpu:%d
> CONFIG_TDP_GET_FACT_HP_TURBO_LIMIT_NUMCORES index:%d level:%d
> resp:%x\n",
> + cpu, i, level, resp);
> +
> + for (j = 0; j < 4; ++j) {
> + bucket_info[j + (i *
> 4)].high_priority_cores_count =
> + (resp >> (j * 8)) & 0xff;
> + }
> + }
> +
> + for (k = 0; k < 3; ++k) {
> + for (i = 0; i < 2; ++i) {
> + int j;
> +
> + ret = isst_send_mbox_command(
> + cpu, CONFIG_TDP,
> + CONFIG_TDP_GET_FACT_HP_TURBO_LIMIT_RATI
> OS, 0,
> + (k << 16) | (i << 8) | level, &resp);
> + if (ret)
> + return ret;
> +
> + debug_printf(
> + "cpu:%d
> CONFIG_TDP_GET_FACT_HP_TURBO_LIMIT_RATIOS index:%d level:%d avx:%d
> resp:%x\n",
> + cpu, i, level, k, resp);
> +
> + for (j = 0; j < 4; ++j) {
> + switch (k) {
> + case 0:
> + bucket_info[j + (i *
> 4)].sse_trl =
> + (resp >> (j * 8)) &
> 0xff;
> + break;
> + case 1:
> + bucket_info[j + (i *
> 4)].avx_trl =
> + (resp >> (j * 8)) &
> 0xff;
> + break;
> + case 2:
> + bucket_info[j + (i *
> 4)].avx512_trl =
> + (resp >> (j * 8)) &
> 0xff;
> + break;
> + default:
> + break;
> + }
> + }
> + }
> + }
> +
> + return 0;
> +}
> +
> +int isst_get_fact_info(int cpu, int level, struct isst_fact_info
> *fact_info)
> +{
> + unsigned int resp;
> + int ret;
> +
> + ret = isst_send_mbox_command(cpu, CONFIG_TDP,
> + CONFIG_TDP_GET_FACT_LP_CLIPPING_RA
> TIO, 0,
> + level, &resp);
> + if (ret)
> + return ret;
> +
> + debug_printf("cpu:%d CONFIG_TDP_GET_FACT_LP_CLIPPING_RATIO
> resp:%x\n",
> + cpu, resp);
> +
> + fact_info->lp_clipping_ratio_license_sse = resp & 0xff;
> + fact_info->lp_clipping_ratio_license_avx2 = (resp >> 8) & 0xff;
> + fact_info->lp_clipping_ratio_license_avx512 = (resp >> 16) &
> 0xff;
> +
> + ret = isst_get_fact_bucket_info(cpu, level, fact_info-
> >bucket_info);
> +
> + return ret;
> +}
> +
> +int isst_set_trl(int cpu, unsigned long long trl)
> +{
> + int ret;
> +
> + if (!trl)
> + trl = 0xFFFFFFFFFFFFFFFFULL;
> +
> + ret = isst_send_msr_command(cpu, 0x1AD, 1, &trl);
> + if (ret)
> + return ret;
> +
> + return 0;
> +}
> +
> +int isst_set_trl_from_current_tdp(int cpu, unsigned long long trl)
> +{
> + unsigned long long msr_trl;
> + int ret;
> +
> + if (trl) {
> + msr_trl = trl;
> + } else {
> + struct isst_pkg_ctdp pkg_dev;
> + int trl[8];
> + int i;
> +
> + ret = isst_get_ctdp_levels(cpu, &pkg_dev);
> + if (ret)
> + return ret;
> +
> + ret = isst_get_get_trl(cpu, pkg_dev.current_level, 0,
> trl);
> + if (ret)
> + return ret;
> +
> + msr_trl = 0;
> + for (i = 0; i < 8; ++i) {
> + unsigned long long _trl = trl[i];
> +
> + msr_trl |= (_trl << (i * 8));
> + }
> + }
> + ret = isst_send_msr_command(cpu, 0x1AD, 1, &msr_trl);
> + if (ret)
> + return ret;
> +
> + return 0;
> +}
> +
> +/* Return 1 if locked */
> +int isst_get_config_tdp_lock_status(int cpu)
> +{
> + unsigned long long tdp_control = 0;
> + int ret;
> +
> + ret = isst_send_msr_command(cpu, 0x64b, 0, &tdp_control);
> + if (ret)
> + return ret;
> +
> + ret = !!(tdp_control & BIT(31));
> +
> + return ret;
> +}
> +
> +void isst_get_process_ctdp_complete(int cpu, struct isst_pkg_ctdp
> *pkg_dev)
> +{
> + int i;
> +
> + if (!pkg_dev->processed)
> + return;
> +
> + for (i = 0; i < pkg_dev->levels; ++i) {
> + struct isst_pkg_ctdp_level_info *ctdp_level;
> +
> + ctdp_level = &pkg_dev->ctdp_level[i];
> + if (ctdp_level->pbf_support)
> + free_cpu_set(ctdp_level-
> >pbf_info.core_cpumask);
> + free_cpu_set(ctdp_level->core_cpumask);
> + }
> +}
> +
> +int isst_get_process_ctdp(int cpu, int tdp_level, struct
> isst_pkg_ctdp *pkg_dev)
> +{
> + int i, ret;
> +
> + if (pkg_dev->processed)
> + return 0;
> +
> + ret = isst_get_ctdp_levels(cpu, pkg_dev);
> + if (ret)
> + return ret;
> +
> + debug_printf("cpu: %d ctdp enable:%d current level: %d
> levels:%d\n",
> + cpu, pkg_dev->enabled, pkg_dev->current_level,
> + pkg_dev->levels);
> +
> + for (i = 0; i <= pkg_dev->levels; ++i) {
> + struct isst_pkg_ctdp_level_info *ctdp_level;
> +
> + if (tdp_level != 0xff && i != tdp_level)
> + continue;
> +
> + debug_printf("cpu:%d Get Information for TDP
> level:%d\n", cpu,
> + i);
> + ctdp_level = &pkg_dev->ctdp_level[i];
> +
> + ctdp_level->processed = 1;
> + ctdp_level->level = i;
> + ctdp_level->control_cpu = cpu;
> + ctdp_level->pkg_id = get_physical_package_id(cpu);
> + ctdp_level->die_id = get_physical_die_id(cpu);
> +
> + ret = isst_get_ctdp_control(cpu, i, ctdp_level);
> + if (ret)
> + return ret;
> +
> + ret = isst_get_tdp_info(cpu, i, ctdp_level);
> + if (ret)
> + return ret;
> +
> + ret = isst_get_pwr_info(cpu, i, ctdp_level);
> + if (ret)
> + return ret;
> +
> + ret = isst_get_tjmax_info(cpu, i, ctdp_level);
> + if (ret)
> + return ret;
> +
> + ctdp_level->core_cpumask_size =
> + alloc_cpu_set(&ctdp_level->core_cpumask);
> + ret = isst_get_coremask_info(cpu, i, ctdp_level);
> + if (ret)
> + return ret;
> +
> + ret = isst_get_get_trl(cpu, i, 0,
> + ctdp_level-
> >trl_sse_active_cores);
> + if (ret)
> + return ret;
> +
> + ret = isst_get_get_trl(cpu, i, 1,
> + ctdp_level-
> >trl_avx_active_cores);
> + if (ret)
> + return ret;
> +
> + ret = isst_get_get_trl(cpu, i, 2,
> + ctdp_level-
> >trl_avx_512_active_cores);
> + if (ret)
> + return ret;
> +
> + if (ctdp_level->pbf_support) {
> + ret = isst_get_pbf_info(cpu, i, &ctdp_level-
> >pbf_info);
> + if (!ret)
> + ctdp_level->pbf_found = 1;
> + }
> +
> + if (ctdp_level->fact_support) {
> + ret = isst_get_fact_info(cpu, i,
> + &ctdp_level-
> >fact_info);
> + if (ret)
> + return ret;
> + }
> + }
> +
> + pkg_dev->processed = 1;
> +
> + return 0;
> +}
> +
> +int isst_pm_qos_config(int cpu, int enable_clos, int priority_type)
> +{
> + unsigned int req, resp;
> + int ret;
> +
> + ret = isst_send_mbox_command(cpu, CONFIG_CLOS,
> CLOS_PM_QOS_CONFIG, 0, 0,
> + &resp);
> + if (ret)
> + return ret;
> +
> + debug_printf("cpu:%d CLOS_PM_QOS_CONFIG resp:%x\n", cpu, resp);
> +
> + req = resp;
> +
> + if (enable_clos)
> + req = req | BIT(1);
> + else
> + req = req & ~BIT(1);
> +
> + if (priority_type)
> + req = req | BIT(2);
> + else
> + req = req & ~BIT(2);
> +
> + ret = isst_send_mbox_command(cpu, CONFIG_CLOS,
> CLOS_PM_QOS_CONFIG,
> + BIT(MBOX_CMD_WRITE_BIT), req,
> &resp);
> + if (ret)
> + return ret;
> +
> + debug_printf("cpu:%d CLOS_PM_QOS_CONFIG priority type:%d
> req:%x\n", cpu,
> + priority_type, req);
> +
> + return 0;
> +}
> +
> +int isst_pm_get_clos(int cpu, int clos, struct isst_clos_config
> *clos_config)
> +{
> + unsigned int resp;
> + int ret;
> +
> + ret = isst_send_mbox_command(cpu, CONFIG_CLOS, CLOS_PM_CLOS,
> clos, 0,
> + &resp);
> + if (ret)
> + return ret;
> +
> + clos_config->pkg_id = get_physical_package_id(cpu);
> + clos_config->die_id = get_physical_die_id(cpu);
> +
> + clos_config->epp = resp & 0x0f;
> + clos_config->clos_prop_prio = (resp >> 4) & 0x0f;
> + clos_config->clos_min = (resp >> 8) & 0xff;
> + clos_config->clos_max = (resp >> 16) & 0xff;
> + clos_config->clos_desired = (resp >> 24) & 0xff;
> +
> + return 0;
> +}
> +
> +int isst_set_clos(int cpu, int clos, struct isst_clos_config
> *clos_config)
> +{
> + unsigned int req, resp;
> + unsigned int param;
> + int ret;
> +
> + req = clos_config->epp & 0x0f;
> + req |= (clos_config->clos_prop_prio & 0x0f) << 4;
> + req |= (clos_config->clos_min & 0xff) << 8;
> + req |= (clos_config->clos_max & 0xff) << 16;
> + req |= (clos_config->clos_desired & 0xff) << 24;
> +
> + param = BIT(MBOX_CMD_WRITE_BIT) | clos;
> +
> + ret = isst_send_mbox_command(cpu, CONFIG_CLOS, CLOS_PM_CLOS,
> param, req,
> + &resp);
> + if (ret)
> + return ret;
> +
> + debug_printf("cpu:%d CLOS_PM_CLOS param:%x req:%x\n", cpu,
> param, req);
> +
> + return 0;
> +}
> +
> +int isst_clos_get_assoc_status(int cpu, int *clos_id)
> +{
> + unsigned int resp;
> + unsigned int param;
> + int core_id, ret;
> +
> + core_id = find_phy_core_num(cpu);
> + param = core_id;
> +
> + ret = isst_send_mbox_command(cpu, CONFIG_CLOS, CLOS_PQR_ASSOC,
> param, 0,
> + &resp);
> + if (ret)
> + return ret;
> +
> + debug_printf("cpu:%d CLOS_PQR_ASSOC param:%x resp:%x\n", cpu,
> param,
> + resp);
> + *clos_id = (resp >> 16) & 0x03;
> +
> + return 0;
> +}
> +
> +int isst_clos_associate(int cpu, int clos_id)
> +{
> + unsigned int req, resp;
> + unsigned int param;
> + int core_id, ret;
> +
> + req = (clos_id & 0x03) << 16;
> + core_id = find_phy_core_num(cpu);
> + param = BIT(MBOX_CMD_WRITE_BIT) | core_id;
> +
> + ret = isst_send_mbox_command(cpu, CONFIG_CLOS, CLOS_PQR_ASSOC,
> param,
> + req, &resp);
> + if (ret)
> + return ret;
> +
> + debug_printf("cpu:%d CLOS_PQR_ASSOC param:%x req:%x\n", cpu,
> param,
> + req);
> +
> + return 0;
> +}
> diff --git a/tools/power/x86/intel-speed-select/isst-display.c
> b/tools/power/x86/intel-speed-select/isst-display.c
> new file mode 100644
> index 000000000000..f368b8323742
> --- /dev/null
> +++ b/tools/power/x86/intel-speed-select/isst-display.c
> @@ -0,0 +1,479 @@
> +// SPDX-License-Identifier: GPL-2.0
> +/*
> + * Intel dynamic_speed_select -- Enumerate and control features
> + * Copyright (c) 2019 Intel Corporation.
> + */
> +
> +#include "isst.h"
> +
> +#define DISP_FREQ_MULTIPLIER 100000
> +
> +static void printcpumask(int str_len, char *str, int mask_size,
> + cpu_set_t *cpu_mask)
> +{
> + int i, max_cpus = get_topo_max_cpus();
> + unsigned int *mask;
> + int size, index, curr_index;
> +
> + size = max_cpus / (sizeof(unsigned int) * 8);
> + if (max_cpus % (sizeof(unsigned int) * 8))
> + size++;
> +
> + mask = calloc(size, sizeof(unsigned int));
> + if (!mask)
> + return;
> +
> + for (i = 0; i < max_cpus; ++i) {
> + int mask_index, bit_index;
> +
> + if (!CPU_ISSET_S(i, mask_size, cpu_mask))
> + continue;
> +
> + mask_index = i / (sizeof(unsigned int) * 8);
> + bit_index = i % (sizeof(unsigned int) * 8);
> + mask[mask_index] |= BIT(bit_index);
> + }
> +
> + curr_index = 0;
> + for (i = size - 1; i >= 0; --i) {
> + index = snprintf(&str[curr_index], str_len -
> curr_index, "%08x",
> + mask[i]);
> + curr_index += index;
> + if (i) {
> + strncat(&str[curr_index], ",", str_len -
> curr_index);
> + curr_index++;
> + }
> + }
> +
> + free(mask);
> +}
> +
> +static void format_and_print_txt(FILE *outf, int level, char
> *header,
> + char *value)
> +{
> + char *spaces = " ";
> + static char delimiters[256];
> + int i, j = 0;
> +
> + if (!level)
> + return;
> +
> + if (level == 1) {
> + strcpy(delimiters, " ");
> + } else {
> + for (i = 0; i < level - 1; ++i)
> + j += snprintf(&delimiters[j],
> sizeof(delimiters) - j,
> + "%s", spaces);
> + }
> +
> + if (header && value) {
> + fprintf(outf, "%s", delimiters);
> + fprintf(outf, "%s:%s\n", header, value);
> + } else if (header) {
> + fprintf(outf, "%s", delimiters);
> + fprintf(outf, "%s\n", header);
> + }
> +}
> +
> +static int last_level;
> +static void format_and_print(FILE *outf, int level, char *header,
> char *value)
> +{
> + char *spaces = " ";
> + static char delimiters[256];
> + int i;
> +
> + if (!out_format_is_json()) {
> + format_and_print_txt(outf, level, header, value);
> + return;
> + }
> +
> + if (level == 0) {
> + if (header)
> + fprintf(outf, "{");
> + else
> + fprintf(outf, "\n}\n");
> +
> + } else {
> + int j = 0;
> +
> + for (i = 0; i < level; ++i)
> + j += snprintf(&delimiters[j],
> sizeof(delimiters) - j,
> + "%s", spaces);
> +
> + if (last_level == level)
> + fprintf(outf, ",\n");
> +
> + if (value) {
> + if (last_level != level)
> + fprintf(outf, "\n");
> +
> + fprintf(outf, "%s\"%s\": ", delimiters,
> header);
> + fprintf(outf, "\"%s\"", value);
> + } else {
> + for (i = last_level - 1; i >= level; --i) {
> + int k = 0;
> +
> + for (j = i; j > 0; --j)
> + k += snprintf(&delimiters[k],
> + sizeof(delimiters
> ) - k,
> + "%s", spaces);
> + if (i == level && header)
> + fprintf(outf, "\n%s},",
> delimiters);
> + else
> + fprintf(outf, "\n%s}",
> delimiters);
> + }
> + if (abs(last_level - level) < 3)
> + fprintf(outf, "\n");
> + if (header)
> + fprintf(outf, "%s\"%s\": {",
> delimiters,
> + header);
> + }
> + }
> +
> + last_level = level;
> +}
> +
> +static void print_packag_info(int cpu, FILE *outf)
> +{
> + char header[256];
> +
> + snprintf(header, sizeof(header), "package-%d",
> + get_physical_package_id(cpu));
> + format_and_print(outf, 1, header, NULL);
> + snprintf(header, sizeof(header), "die-%d",
> get_physical_die_id(cpu));
> + format_and_print(outf, 2, header, NULL);
> + snprintf(header, sizeof(header), "cpu-%d", cpu);
> + format_and_print(outf, 3, header, NULL);
> +}
> +
> +static void _isst_pbf_display_information(int cpu, FILE *outf, int
> level,
> + struct isst_pbf_info
> *pbf_info,
> + int disp_level)
> +{
> + char header[256];
> + char value[256];
> +
> + snprintf(header, sizeof(header), "speed-select-base-freq");
> + format_and_print(outf, disp_level, header, NULL);
> +
> + snprintf(header, sizeof(header), "high-priority-base-
> frequency(KHz)");
> + snprintf(value, sizeof(value), "%d",
> + pbf_info->p1_high * DISP_FREQ_MULTIPLIER);
> + format_and_print(outf, disp_level + 1, header, value);
> +
> + snprintf(header, sizeof(header), "high-priority-cpu-mask");
> + printcpumask(sizeof(value), value, pbf_info->core_cpumask_size,
> + pbf_info->core_cpumask);
> + format_and_print(outf, disp_level + 1, header, value);
> +
> + snprintf(header, sizeof(header), "low-priority-base-
> frequency(KHz)");
> + snprintf(value, sizeof(value), "%d",
> + pbf_info->p1_low * DISP_FREQ_MULTIPLIER);
> + format_and_print(outf, disp_level + 1, header, value);
> +
> + snprintf(header, sizeof(header), "tjunction-temperature(C)");
> + snprintf(value, sizeof(value), "%d", pbf_info->t_prochot);
> + format_and_print(outf, disp_level + 1, header, value);
> +
> + snprintf(header, sizeof(header), "thermal-design-power(W)");
> + snprintf(value, sizeof(value), "%d", pbf_info->tdp);
> + format_and_print(outf, disp_level + 1, header, value);
> +}
> +
> +static void _isst_fact_display_information(int cpu, FILE *outf, int
> level,
> + int fact_bucket, int
> fact_avx,
> + struct isst_fact_info
> *fact_info,
> + int base_level)
> +{
> + struct isst_fact_bucket_info *bucket_info = fact_info-
> >bucket_info;
> + char header[256];
> + char value[256];
> + int j;
> +
> + snprintf(header, sizeof(header), "speed-select-turbo-freq");
> + format_and_print(outf, base_level, header, NULL);
> + for (j = 0; j < ISST_FACT_MAX_BUCKETS; ++j) {
> + if (fact_bucket != 0xff && fact_bucket != j)
> + continue;
> +
> + if (!bucket_info[j].high_priority_cores_count)
> + break;
> +
> + snprintf(header, sizeof(header), "bucket-%d", j);
> + format_and_print(outf, base_level + 1, header, NULL);
> +
> + snprintf(header, sizeof(header), "high-priority-cores-
> count");
> + snprintf(value, sizeof(value), "%d",
> + bucket_info[j].high_priority_cores_count);
> + format_and_print(outf, base_level + 2, header, value);
> +
> + if (fact_avx & 0x01) {
> + snprintf(header, sizeof(header),
> + "high-priority-max-frequency(KHz)");
> + snprintf(value, sizeof(value), "%d",
> + bucket_info[j].sse_trl *
> DISP_FREQ_MULTIPLIER);
> + format_and_print(outf, base_level + 2, header,
> value);
> + }
> +
> + if (fact_avx & 0x02) {
> + snprintf(header, sizeof(header),
> + "high-priority-max-avx2-
> frequency(KHz)");
> + snprintf(value, sizeof(value), "%d",
> + bucket_info[j].avx_trl *
> DISP_FREQ_MULTIPLIER);
> + format_and_print(outf, base_level + 2, header,
> value);
> + }
> +
> + if (fact_avx & 0x04) {
> + snprintf(header, sizeof(header),
> + "high-priority-max-avx512-
> frequency(KHz)");
> + snprintf(value, sizeof(value), "%d",
> + bucket_info[j].avx512_trl *
> + DISP_FREQ_MULTIPLIER);
> + format_and_print(outf, base_level + 2, header,
> value);
> + }
> + }
> + snprintf(header, sizeof(header),
> + "speed-select-turbo-freq-clip-frequencies");
> + format_and_print(outf, base_level + 1, header, NULL);
> + snprintf(header, sizeof(header), "low-priority-max-
> frequency(KHz)");
> + snprintf(value, sizeof(value), "%d",
> + fact_info->lp_clipping_ratio_license_sse *
> + DISP_FREQ_MULTIPLIER);
> + format_and_print(outf, base_level + 2, header, value);
> + snprintf(header, sizeof(header),
> + "low-priority-max-avx2-frequency(KHz)");
> + snprintf(value, sizeof(value), "%d",
> + fact_info->lp_clipping_ratio_license_avx2 *
> + DISP_FREQ_MULTIPLIER);
> + format_and_print(outf, base_level + 2, header, value);
> + snprintf(header, sizeof(header),
> + "low-priority-max-avx512-frequency(KHz)");
> + snprintf(value, sizeof(value), "%d",
> + fact_info->lp_clipping_ratio_license_avx512 *
> + DISP_FREQ_MULTIPLIER);
> + format_and_print(outf, base_level + 2, header, value);
> +}
> +
> +void isst_ctdp_display_information(int cpu, FILE *outf, int
> tdp_level,
> + struct isst_pkg_ctdp *pkg_dev)
> +{
> + char header[256];
> + char value[256];
> + int i, base_level = 1;
> +
> + print_packag_info(cpu, outf);
> +
> + for (i = 0; i <= pkg_dev->levels; ++i) {
> + struct isst_pkg_ctdp_level_info *ctdp_level;
> + int j;
> +
> + ctdp_level = &pkg_dev->ctdp_level[i];
> + if (!ctdp_level->processed)
> + continue;
> +
> + snprintf(header, sizeof(header), "perf-profile-level-
> %d",
> + ctdp_level->level);
> + format_and_print(outf, base_level + 3, header, NULL);
> +
> + snprintf(header, sizeof(header), "cpu-count");
> + j = get_cpu_count(get_physical_die_id(cpu),
> + get_physical_die_id(cpu));
> + snprintf(value, sizeof(value), "%d", j);
> + format_and_print(outf, base_level + 4, header, value);
> +
> + snprintf(header, sizeof(header), "enable-cpu-mask");
> + printcpumask(sizeof(value), value,
> + ctdp_level->core_cpumask_size,
> + ctdp_level->core_cpumask);
> + format_and_print(outf, base_level + 4, header, value);
> +
> + snprintf(header, sizeof(header), "thermal-design-power-
> ratio");
> + snprintf(value, sizeof(value), "%d", ctdp_level-
> >tdp_ratio);
> + format_and_print(outf, base_level + 4, header, value);
> +
> + snprintf(header, sizeof(header), "base-
> frequency(KHz)");
> + snprintf(value, sizeof(value), "%d",
> + ctdp_level->tdp_ratio * DISP_FREQ_MULTIPLIER);
> + format_and_print(outf, base_level + 4, header, value);
> +
> + snprintf(header, sizeof(header),
> + "speed-select-turbo-freq-support");
> + snprintf(value, sizeof(value), "%d", ctdp_level-
> >fact_support);
> + format_and_print(outf, base_level + 4, header, value);
> +
> + snprintf(header, sizeof(header),
> + "speed-select-base-freq-support");
> + snprintf(value, sizeof(value), "%d", ctdp_level-
> >pbf_support);
> + format_and_print(outf, base_level + 4, header, value);
> +
> + snprintf(header, sizeof(header),
> + "speed-select-base-freq-enabled");
> + snprintf(value, sizeof(value), "%d", ctdp_level-
> >pbf_enabled);
> + format_and_print(outf, base_level + 4, header, value);
> +
> + snprintf(header, sizeof(header),
> + "speed-select-turbo-freq-enabled");
> + snprintf(value, sizeof(value), "%d", ctdp_level-
> >fact_enabled);
> + format_and_print(outf, base_level + 4, header, value);
> +
> + snprintf(header, sizeof(header), "thermal-design-
> power(W)");
> + snprintf(value, sizeof(value), "%d", ctdp_level-
> >pkg_tdp);
> + format_and_print(outf, base_level + 4, header, value);
> +
> + snprintf(header, sizeof(header), "tjunction-max(C)");
> + snprintf(value, sizeof(value), "%d", ctdp_level-
> >t_proc_hot);
> + format_and_print(outf, base_level + 4, header, value);
> +
> + snprintf(header, sizeof(header), "turbo-ratio-limits-
> sse");
> + format_and_print(outf, base_level + 4, header, NULL);
> + for (j = 0; j < 8; ++j) {
> + snprintf(header, sizeof(header), "bucket-%d",
> j);
> + format_and_print(outf, base_level + 5, header,
> NULL);
> +
> + snprintf(header, sizeof(header), "core-count");
> + snprintf(value, sizeof(value), "%d", j);
> + format_and_print(outf, base_level + 6, header,
> value);
> +
> + snprintf(header, sizeof(header), "turbo-
> ratio");
> + snprintf(value, sizeof(value), "%d",
> + ctdp_level->trl_sse_active_cores[j]);
> + format_and_print(outf, base_level + 6, header,
> value);
> + }
> + snprintf(header, sizeof(header), "turbo-ratio-limits-
> avx");
> + format_and_print(outf, base_level + 4, header, NULL);
> + for (j = 0; j < 8; ++j) {
> + snprintf(header, sizeof(header), "bucket-%d",
> j);
> + format_and_print(outf, base_level + 5, header,
> NULL);
> +
> + snprintf(header, sizeof(header), "core-count");
> + snprintf(value, sizeof(value), "%d", j);
> + format_and_print(outf, base_level + 6, header,
> value);
> +
> + snprintf(header, sizeof(header), "turbo-
> ratio");
> + snprintf(value, sizeof(value), "%d",
> + ctdp_level->trl_avx_active_cores[j]);
> + format_and_print(outf, base_level + 6, header,
> value);
> + }
> +
> + snprintf(header, sizeof(header), "turbo-ratio-limits-
> avx512");
> + format_and_print(outf, base_level + 4, header, NULL);
> + for (j = 0; j < 8; ++j) {
> + snprintf(header, sizeof(header), "bucket-%d",
> j);
> + format_and_print(outf, base_level + 5, header,
> NULL);
> +
> + snprintf(header, sizeof(header), "core-count");
> + snprintf(value, sizeof(value), "%d", j);
> + format_and_print(outf, base_level + 6, header,
> value);
> +
> + snprintf(header, sizeof(header), "turbo-
> ratio");
> + snprintf(value, sizeof(value), "%d",
> + ctdp_level-
> >trl_avx_512_active_cores[j]);
> + format_and_print(outf, base_level + 6, header,
> value);
> + }
> + if (ctdp_level->pbf_support)
> + _isst_pbf_display_information(cpu, outf, i,
> + &ctdp_level-
> >pbf_info,
> + base_level + 4);
> + if (ctdp_level->fact_support)
> + _isst_fact_display_information(cpu, outf, i,
> 0xff, 0xff,
> + &ctdp_level-
> >fact_info,
> + base_level + 4);
> + }
> +
> + format_and_print(outf, 1, NULL, NULL);
> +}
> +
> +void isst_ctdp_display_information_start(FILE *outf)
> +{
> + last_level = 0;
> + format_and_print(outf, 0, "start", NULL);
> +}
> +
> +void isst_ctdp_display_information_end(FILE *outf)
> +{
> + format_and_print(outf, 0, NULL, NULL);
> +}
> +
> +void isst_pbf_display_information(int cpu, FILE *outf, int level,
> + struct isst_pbf_info *pbf_info)
> +{
> + print_packag_info(cpu, outf);
> + _isst_pbf_display_information(cpu, outf, level, pbf_info, 4);
> + format_and_print(outf, 1, NULL, NULL);
> +}
> +
> +void isst_fact_display_information(int cpu, FILE *outf, int level,
> + int fact_bucket, int fact_avx,
> + struct isst_fact_info *fact_info)
> +{
> + print_packag_info(cpu, outf);
> + _isst_fact_display_information(cpu, outf, level, fact_bucket,
> fact_avx,
> + fact_info, 4);
> + format_and_print(outf, 1, NULL, NULL);
> +}
> +
> +void isst_clos_display_information(int cpu, FILE *outf, int clos,
> + struct isst_clos_config
> *clos_config)
> +{
> + char header[256];
> + char value[256];
> +
> + snprintf(header, sizeof(header), "package-%d",
> + get_physical_package_id(cpu));
> + format_and_print(outf, 1, header, NULL);
> + snprintf(header, sizeof(header), "die-%d",
> get_physical_die_id(cpu));
> + format_and_print(outf, 2, header, NULL);
> + snprintf(header, sizeof(header), "cpu-%d", cpu);
> + format_and_print(outf, 3, header, NULL);
> +
> + snprintf(header, sizeof(header), "core-power");
> + format_and_print(outf, 4, header, NULL);
> +
> + snprintf(header, sizeof(header), "clos");
> + snprintf(value, sizeof(value), "%d", clos);
> + format_and_print(outf, 5, header, value);
> +
> + snprintf(header, sizeof(header), "epp");
> + snprintf(value, sizeof(value), "%d", clos_config->epp);
> + format_and_print(outf, 5, header, value);
> +
> + snprintf(header, sizeof(header), "clos-proportional-priority");
> + snprintf(value, sizeof(value), "%d", clos_config-
> >clos_prop_prio);
> + format_and_print(outf, 5, header, value);
> +
> + snprintf(header, sizeof(header), "clos-min");
> + snprintf(value, sizeof(value), "%d", clos_config->clos_min);
> + format_and_print(outf, 5, header, value);
> +
> + snprintf(header, sizeof(header), "clos-max");
> + snprintf(value, sizeof(value), "%d", clos_config->clos_max);
> + format_and_print(outf, 5, header, value);
> +
> + snprintf(header, sizeof(header), "clos-desired");
> + snprintf(value, sizeof(value), "%d", clos_config-
> >clos_desired);
> + format_and_print(outf, 5, header, value);
> +
> + format_and_print(outf, 1, NULL, NULL);
> +}
> +
> +void isst_display_result(int cpu, FILE *outf, char *feature, char
> *cmd,
> + int result)
> +{
> + char header[256];
> + char value[256];
> +
> + snprintf(header, sizeof(header), "package-%d",
> + get_physical_package_id(cpu));
> + format_and_print(outf, 1, header, NULL);
> + snprintf(header, sizeof(header), "die-%d",
> get_physical_die_id(cpu));
> + format_and_print(outf, 2, header, NULL);
> + snprintf(header, sizeof(header), "cpu-%d", cpu);
> + format_and_print(outf, 3, header, NULL);
> + snprintf(header, sizeof(header), "%s", feature);
> + format_and_print(outf, 4, header, NULL);
> + snprintf(header, sizeof(header), "%s", cmd);
> + snprintf(value, sizeof(value), "%d", result);
> + format_and_print(outf, 5, header, value);
> +
> + format_and_print(outf, 1, NULL, NULL);
> +}
> diff --git a/tools/power/x86/intel-speed-select/isst.h
> b/tools/power/x86/intel-speed-select/isst.h
> new file mode 100644
> index 000000000000..221881761609
> --- /dev/null
> +++ b/tools/power/x86/intel-speed-select/isst.h
> @@ -0,0 +1,231 @@
> +/* SPDX-License-Identifier: GPL-2.0 */
> +/*
> + * Intel Speed Select -- Enumerate and control features
> + * Copyright (c) 2019 Intel Corporation.
> + */
> +
> +#ifndef _ISST_H_
> +#define _ISST_H_
> +
> +#include <stdio.h>
> +#include <unistd.h>
> +#include <sys/types.h>
> +#include <sched.h>
> +#include <sys/stat.h>
> +#include <sys/resource.h>
> +#include <getopt.h>
> +#include <err.h>
> +#include <fcntl.h>
> +#include <signal.h>
> +#include <sys/time.h>
> +#include <limits.h>
> +#include <stdlib.h>
> +#include <string.h>
> +#include <cpuid.h>
> +#include <dirent.h>
> +#include <errno.h>
> +
> +#include <stdarg.h>
> +#include <sys/ioctl.h>
> +
> +#define BIT(x) (1 << (x))
> +#define GENMASK(h, l) (((~0UL) << (l)) & (~0UL >> (sizeof(long) * 8
> - 1 - (h))))
> +#define GENMASK_ULL(h,
> l) \
> + (((~0ULL) << (l)) & (~0ULL >> (sizeof(long long) * 8 - 1 -
> (h))))
> +
> +#define CONFIG_TDP 0x7f
> +#define CONFIG_TDP_GET_LEVELS_INFO 0x00
> +#define CONFIG_TDP_GET_TDP_CONTROL 0x01
> +#define CONFIG_TDP_SET_TDP_CONTROL 0x02
> +#define CONFIG_TDP_GET_TDP_INFO 0x03
> +#define CONFIG_TDP_GET_PWR_INFO 0x04
> +#define CONFIG_TDP_GET_TJMAX_INFO 0x05
> +#define CONFIG_TDP_GET_CORE_MASK 0x06
> +#define CONFIG_TDP_GET_TURBO_LIMIT_RATIOS 0x07
> +#define CONFIG_TDP_SET_LEVEL 0x08
> +#define CONFIG_TDP_GET_UNCORE_P0_P1_INFO 0X09
> +#define CONFIG_TDP_GET_P1_INFO 0x0a
> +#define CONFIG_TDP_GET_MEM_FREQ 0x0b
> +
> +#define CONFIG_TDP_GET_FACT_HP_TURBO_LIMIT_NUMCORES 0x10
> +#define CONFIG_TDP_GET_FACT_HP_TURBO_LIMIT_RATIOS 0x11
> +#define CONFIG_TDP_GET_FACT_LP_CLIPPING_RATIO 0x12
> +
> +#define CONFIG_TDP_PBF_GET_CORE_MASK_INFO 0x20
> +#define CONFIG_TDP_PBF_GET_P1HI_P1LO_INFO 0x21
> +#define CONFIG_TDP_PBF_GET_TJ_MAX_INFO 0x22
> +#define CONFIG_TDP_PBF_GET_TDP_INFO 0X23
> +
> +#define CONFIG_CLOS 0xd0
> +#define CLOS_PQR_ASSOC 0x00
> +#define CLOS_PM_CLOS 0x01
> +#define CLOS_PM_QOS_CONFIG 0x02
> +#define CLOS_STATUS 0x03
> +
> +#define MBOX_CMD_WRITE_BIT 0x08
> +
> +#define PM_QOS_INFO_OFFSET 0x00
> +#define PM_QOS_CONFIG_OFFSET 0x04
> +#define PM_CLOS_OFFSET 0x08
> +#define PQR_ASSOC_OFFSET 0x20
> +
> +struct isst_clos_config {
> + int pkg_id;
> + int die_id;
> + unsigned char epp;
> + unsigned char clos_prop_prio;
> + unsigned char clos_min;
> + unsigned char clos_max;
> + unsigned char clos_desired;
> +};
> +
> +struct isst_fact_bucket_info {
> + int high_priority_cores_count;
> + int sse_trl;
> + int avx_trl;
> + int avx512_trl;
> +};
> +
> +struct isst_pbf_info {
> + int pbf_acticated;
> + int pbf_available;
> + size_t core_cpumask_size;
> + cpu_set_t *core_cpumask;
> + int p1_high;
> + int p1_low;
> + int t_control;
> + int t_prochot;
> + int tdp;
> +};
> +
> +#define ISST_TRL_MAX_ACTIVE_CORES 8
> +#define ISST_FACT_MAX_BUCKETS 8
> +struct isst_fact_info {
> + int lp_clipping_ratio_license_sse;
> + int lp_clipping_ratio_license_avx2;
> + int lp_clipping_ratio_license_avx512;
> + struct isst_fact_bucket_info
> bucket_info[ISST_FACT_MAX_BUCKETS];
> +};
> +
> +struct isst_pkg_ctdp_level_info {
> + int processed;
> + int control_cpu;
> + int pkg_id;
> + int die_id;
> + int level;
> + int fact_support;
> + int pbf_support;
> + int fact_enabled;
> + int pbf_enabled;
> + int tdp_ratio;
> + int active;
> + int tdp_control;
> + int pkg_tdp;
> + int pkg_min_power;
> + int pkg_max_power;
> + int fact;
> + int t_proc_hot;
> + int uncore_p0;
> + int uncore_p1;
> + int sse_p1;
> + int avx2_p1;
> + int avx512_p1;
> + int mem_freq;
> + size_t core_cpumask_size;
> + cpu_set_t *core_cpumask;
> + int cpu_count;
> + int trl_sse_active_cores[ISST_TRL_MAX_ACTIVE_CORES];
> + int trl_avx_active_cores[ISST_TRL_MAX_ACTIVE_CORES];
> + int trl_avx_512_active_cores[ISST_TRL_MAX_ACTIVE_CORES];
> + int kobj_bucket_index;
> + int active_bucket;
> + int fact_max_index;
> + int fact_max_config;
> + int pbf_found;
> + int pbf_active;
> + struct isst_pbf_info pbf_info;
> + struct isst_fact_info fact_info;
> +};
> +
> +#define ISST_MAX_TDP_LEVELS (4 + 1) /* +1 for base config */
> +struct isst_pkg_ctdp {
> + int locked;
> + int version;
> + int processed;
> + int levels;
> + int current_level;
> + int enabled;
> + struct isst_pkg_ctdp_level_info
> ctdp_level[ISST_MAX_TDP_LEVELS];
> +};
> +
> +extern int get_topo_max_cpus(void);
> +extern int get_cpu_count(int pkg_id, int die_id);
> +
> +/* Common interfaces */
> +extern void debug_printf(const char *format, ...);
> +extern int out_format_is_json(void);
> +extern int get_physical_package_id(int cpu);
> +extern int get_physical_die_id(int cpu);
> +extern size_t alloc_cpu_set(cpu_set_t **cpu_set);
> +extern void free_cpu_set(cpu_set_t *cpu_set);
> +extern int find_logical_cpu(int pkg_id, int die_id, int phy_cpu);
> +extern int find_phy_cpu_num(int logical_cpu);
> +extern int find_phy_core_num(int logical_cpu);
> +extern void set_cpu_mask_from_punit_coremask(int cpu,
> + unsigned long long
> core_mask,
> + size_t core_cpumask_size,
> + cpu_set_t *core_cpumask,
> + int *cpu_cnt);
> +
> +extern int isst_send_mbox_command(unsigned int cpu, unsigned char
> command,
> + unsigned char sub_command,
> + unsigned int write,
> + unsigned int req_data, unsigned int
> *resp);
> +
> +extern int isst_send_msr_command(unsigned int cpu, unsigned int
> command,
> + int write, unsigned long long
> *req_resp);
> +
> +extern int isst_get_ctdp_levels(int cpu, struct isst_pkg_ctdp
> *pkg_dev);
> +extern int isst_get_process_ctdp(int cpu, int tdp_level,
> + struct isst_pkg_ctdp *pkg_dev);
> +extern void isst_get_process_ctdp_complete(int cpu,
> + struct isst_pkg_ctdp
> *pkg_dev);
> +extern void isst_ctdp_display_information(int cpu, FILE *outf, int
> tdp_level,
> + struct isst_pkg_ctdp
> *pkg_dev);
> +extern void isst_ctdp_display_information_start(FILE *outf);
> +extern void isst_ctdp_display_information_end(FILE *outf);
> +extern void isst_pbf_display_information(int cpu, FILE *outf, int
> level,
> + struct isst_pbf_info *info);
> +extern int isst_set_tdp_level(int cpu, int tdp_level);
> +extern int isst_set_tdp_level_msr(int cpu, int tdp_level);
> +extern int isst_set_pbf_fact_status(int cpu, int pbf, int enable);
> +extern int isst_get_pbf_info(int cpu, int level,
> + struct isst_pbf_info *pbf_info);
> +extern void isst_get_pbf_info_complete(struct isst_pbf_info
> *pbf_info);
> +extern int isst_get_fact_info(int cpu, int level,
> + struct isst_fact_info *fact_info);
> +extern int isst_get_fact_bucket_info(int cpu, int level,
> + struct isst_fact_bucket_info
> *bucket_info);
> +extern void isst_fact_display_information(int cpu, FILE *outf, int
> level,
> + int fact_bucket, int
> fact_avx,
> + struct isst_fact_info
> *fact_info);
> +extern int isst_set_trl(int cpu, unsigned long long trl);
> +extern int isst_set_trl_from_current_tdp(int cpu, unsigned long long
> trl);
> +extern int isst_get_config_tdp_lock_status(int cpu);
> +
> +extern int isst_pm_qos_config(int cpu, int enable_clos, int
> priority_type);
> +extern int isst_pm_get_clos(int cpu, int clos,
> + struct isst_clos_config *clos_config);
> +extern int isst_set_clos(int cpu, int clos,
> + struct isst_clos_config *clos_config);
> +extern int isst_clos_associate(int cpu, int clos);
> +extern int isst_clos_get_assoc_status(int cpu, int *clos_id);
> +extern void isst_clos_display_information(int cpu, FILE *outf, int
> clos,
> + struct isst_clos_config
> *clos_config);
> +
> +extern int isst_read_reg(unsigned short reg, unsigned int *val);
> +extern int isst_write_reg(int reg, unsigned int val);
> +
> +extern void isst_display_result(int cpu, FILE *outf, char *feature,
> char *cmd,
> + int result);
> +#endif
^ permalink raw reply
* Re: [PATCH 10/10] tools/power/x86: A tool to validate Intel Speed Select commands
From: Srinivas Pandruvada @ 2019-06-30 17:11 UTC (permalink / raw)
To: Andy Shevchenko
Cc: Darren Hart, Andy Shevchenko, Andriy Shevchenko, Jonathan Corbet,
Rafael J. Wysocki, Alan Cox, Len Brown, prarit, darcari,
Linux Documentation List, Linux Kernel Mailing List,
Platform Driver
In-Reply-To: <CAHp75VfZLjtAKwFWYp32YgPc_Nq6nCGpNwrXYCp-=m38+2r-Mg@mail.gmail.com>
On Sat, 2019-06-29 at 19:00 +0300, Andy Shevchenko wrote:
> On Sat, Jun 29, 2019 at 5:53 PM Srinivas Pandruvada
> <srinivas.pandruvada@linux.intel.com> wrote:
> > On Sat, 2019-06-29 at 17:31 +0300, Andy Shevchenko wrote:
> > > On Thu, Jun 27, 2019 at 1:39 AM Srinivas Pandruvada
> > > <srinivas.pandruvada@linux.intel.com> wrote:
> > > > +++ b/tools/power/x86/intel_speed_select/Makefile
> > >
> > > My experience with some tools are not good in order of their
> > > build
> > > process.
> > > Can this one use tools build infrastructure from the day 1?
> >
> > Can you give some pointers?
>
> Sure.
>
> At least simple ones are under tools/gpio, tools/iio, etc.
>
> You may compare them to see what's different and what's common and
> base Makefile here on that.
>
> I dunno if there is any tool under tools/power to use that, it might
> give an example of `descend` feature in Makefile.
Sent an update to include this change.
Thanks,
Srinivas
>
> > > > @@ -0,0 +1,31 @@
> > > > +# SPDX-License-Identifier: GPL-2.0
> > > > +CC = $(CROSS_COMPILE)gcc
> > > > +BUILD_OUTPUT := $(CURDIR)
> > > > +PREFIX ?= /usr
> > > > +DESTDIR ?=
> > > > +
> > > > +override CFLAGS += -D__EXPORTED_HEADERS__ -Wall -D_GNU_SOURCE
> > > > +override CFLAGS += -I$(CURDIR)/../../../../include/uapi/
> > > > +override CFLAGS += -I$(CURDIR)/../../../../include/
> > > > +
> > > > +%: %.c
> > > > + @mkdir -p $(BUILD_OUTPUT)
> > > > + $(CC) $(CFLAGS) $< -o $(BUILD_OUTPUT)/$@ $(LDFLAGS)
> > > > +
> > > > +DEPS = isst.h
> > > > +OBJ = isst_config.o isst_core.o isst_display.o
> > > > +
> > > > +%.o: %.c $(DEPS)
> > > > + $(CC) -c -o $(BUILD_OUTPUT)/$@ $< $(CFLAGS)
> > > > +
> > > > +intel-speed-select: $(OBJ)
> > > > + $(CC) -o $(BUILD_OUTPUT)/$@ $^ $(CFLAGS)
> > > > +
> > > > +.PHONY : clean
> > > > +clean :
> > > > + @rm -f $(BUILD_OUTPUT)/intel-speed-select
> > > > + @rm -f $(BUILD_OUTPUT)/*.o
> > > > +
> > > > +install : intel-speed-select
> > > > + install -d $(DESTDIR)$(PREFIX)/sbin
> > > > + install $(BUILD_OUTPUT)/intel-speed-select
> > > > $(DESTDIR)$(PREFIX)/sbin/intel-speed-select
>
>
^ permalink raw reply
* [UPDATE][PATCH] tools/power/x86: A tool to validate Intel Speed Select commands
From: Srinivas Pandruvada @ 2019-06-30 17:10 UTC (permalink / raw)
To: dvhart, andy, andriy.shevchenko, corbet
Cc: rjw, alan, lenb, prarit, darcari, linux-doc, linux-kernel,
platform-driver-x86, Srinivas Pandruvada
The Intel(R) Speed select technologies contains four features.
Performance profile:An non architectural mechanism that allows multiple
optimized performance profiles per system via static and/or dynamic
adjustment of core count, workload, Tjmax, and TDP, etc. aka ISS
in the documentation.
Base Frequency: Enables users to increase guaranteed base frequency on
certain cores (high priority cores) in exchange for lower base frequency
on remaining cores (low priority cores). aka PBF in the documenation.
Turbo frequency: Enables the ability to set different turbo ratio limits
to cores based on priority. aka FACT in the documentation.
Core power: An Interface that allows user to define per core/tile
priority.
There is a multi level help for commands and options. This can be used
to check required arguments for each feature and commands for the
feature.
To start navigating the features start with
$sudo intel-speed-select --help
For help on a specific feature for example
$sudo intel-speed-select perf-profile --help
To get help for a command for a feature for example
$sudo intel-speed-select perf-profile get-lock-status --help
Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
---
Updates:
- Copied Makefile from tools/gpio and moified the Makefile here
- Added entry to tools/build/Makefile
- Rename directory to match the executable name
- Fix one error message
tools/Makefile | 12 +-
tools/power/x86/intel-speed-select/Build | 1 +
tools/power/x86/intel-speed-select/Makefile | 56 +
.../x86/intel-speed-select/isst-config.c | 1607 +++++++++++++++++
.../power/x86/intel-speed-select/isst-core.c | 721 ++++++++
.../x86/intel-speed-select/isst-display.c | 479 +++++
tools/power/x86/intel-speed-select/isst.h | 231 +++
7 files changed, 3102 insertions(+), 5 deletions(-)
create mode 100644 tools/power/x86/intel-speed-select/Build
create mode 100644 tools/power/x86/intel-speed-select/Makefile
create mode 100644 tools/power/x86/intel-speed-select/isst-config.c
create mode 100644 tools/power/x86/intel-speed-select/isst-core.c
create mode 100644 tools/power/x86/intel-speed-select/isst-display.c
create mode 100644 tools/power/x86/intel-speed-select/isst.h
diff --git a/tools/Makefile b/tools/Makefile
index 3dfd72ae6c1a..68defd7ecf5d 100644
--- a/tools/Makefile
+++ b/tools/Makefile
@@ -19,6 +19,7 @@ help:
@echo ' gpio - GPIO tools'
@echo ' hv - tools used when in Hyper-V clients'
@echo ' iio - IIO tools'
+ @echo ' intel-speed-select - Intel Speed Select tool'
@echo ' kvm_stat - top-like utility for displaying kvm statistics'
@echo ' leds - LEDs tools'
@echo ' liblockdep - user-space wrapper for kernel locking-validator'
@@ -82,7 +83,7 @@ perf: FORCE
selftests: FORCE
$(call descend,testing/$@)
-turbostat x86_energy_perf_policy: FORCE
+turbostat x86_energy_perf_policy intel-speed-select: FORCE
$(call descend,power/x86/$@)
tmon: FORCE
@@ -115,7 +116,7 @@ liblockdep_install:
selftests_install:
$(call descend,testing/$(@:_install=),install)
-turbostat_install x86_energy_perf_policy_install:
+turbostat_install x86_energy_perf_policy_install intel-speed-select_install:
$(call descend,power/x86/$(@:_install=),install)
tmon_install:
@@ -132,7 +133,7 @@ install: acpi_install cgroup_install cpupower_install gpio_install \
perf_install selftests_install turbostat_install usb_install \
virtio_install vm_install bpf_install x86_energy_perf_policy_install \
tmon_install freefall_install objtool_install kvm_stat_install \
- wmi_install pci_install debugging_install
+ wmi_install pci_install debugging_install intel-speed-select_install
acpi_clean:
$(call descend,power/acpi,clean)
@@ -162,7 +163,7 @@ perf_clean:
selftests_clean:
$(call descend,testing/$(@:_clean=),clean)
-turbostat_clean x86_energy_perf_policy_clean:
+turbostat_clean x86_energy_perf_policy_clean intel-speed-select_clean:
$(call descend,power/x86/$(@:_clean=),clean)
tmon_clean:
@@ -178,6 +179,7 @@ clean: acpi_clean cgroup_clean cpupower_clean hv_clean firewire_clean \
perf_clean selftests_clean turbostat_clean spi_clean usb_clean virtio_clean \
vm_clean bpf_clean iio_clean x86_energy_perf_policy_clean tmon_clean \
freefall_clean build_clean libbpf_clean libsubcmd_clean liblockdep_clean \
- gpio_clean objtool_clean leds_clean wmi_clean pci_clean firmware_clean debugging_clean
+ gpio_clean objtool_clean leds_clean wmi_clean pci_clean firmware_clean debugging_clean \
+ intel-speed-select_clean
.PHONY: FORCE
diff --git a/tools/power/x86/intel-speed-select/Build b/tools/power/x86/intel-speed-select/Build
new file mode 100644
index 000000000000..b61456d75190
--- /dev/null
+++ b/tools/power/x86/intel-speed-select/Build
@@ -0,0 +1 @@
+intel-speed-select-y += isst-config.o isst-core.o isst-display.o
diff --git a/tools/power/x86/intel-speed-select/Makefile b/tools/power/x86/intel-speed-select/Makefile
new file mode 100644
index 000000000000..12c6939dca2a
--- /dev/null
+++ b/tools/power/x86/intel-speed-select/Makefile
@@ -0,0 +1,56 @@
+# SPDX-License-Identifier: GPL-2.0
+include ../../../scripts/Makefile.include
+
+bindir ?= /usr/bin
+
+ifeq ($(srctree),)
+srctree := $(patsubst %/,%,$(dir $(CURDIR)))
+srctree := $(patsubst %/,%,$(dir $(srctree)))
+srctree := $(patsubst %/,%,$(dir $(srctree)))
+srctree := $(patsubst %/,%,$(dir $(srctree)))
+endif
+
+# Do not use make's built-in rules
+# (this improves performance and avoids hard-to-debug behaviour);
+MAKEFLAGS += -r
+
+override CFLAGS += -O2 -Wall -g -D_GNU_SOURCE -I$(OUTPUT)include
+
+ALL_TARGETS := intel-speed-select
+ALL_PROGRAMS := $(patsubst %,$(OUTPUT)%,$(ALL_TARGETS))
+
+all: $(ALL_PROGRAMS)
+
+export srctree OUTPUT CC LD CFLAGS
+include $(srctree)/tools/build/Makefile.include
+
+#
+# We need the following to be outside of kernel tree
+#
+$(OUTPUT)include/linux/isst_if.h: ../../../../include/uapi/linux/isst_if.h
+ mkdir -p $(OUTPUT)include/linux 2>&1 || true
+ ln -sf $(CURDIR)/../../../../include/uapi/linux/isst_if.h $@
+
+prepare: $(OUTPUT)include/linux/isst_if.h
+
+ISST_IN := $(OUTPUT)intel-speed-select-in.o
+
+$(ISST_IN): prepare FORCE
+ $(Q)$(MAKE) $(build)=intel-speed-select
+$(OUTPUT)intel-speed-select: $(ISST_IN)
+ $(QUIET_LINK)$(CC) $(CFLAGS) $(LDFLAGS) $< -o $@
+
+clean:
+ rm -f $(ALL_PROGRAMS)
+ rm -rf $(OUTPUT)include/linux/isst_if.h
+ find $(if $(OUTPUT),$(OUTPUT),.) -name '*.o' -delete -o -name '\.*.d' -delete
+
+install: $(ALL_PROGRAMS)
+ install -d -m 755 $(DESTDIR)$(bindir); \
+ for program in $(ALL_PROGRAMS); do \
+ install $$program $(DESTDIR)$(bindir); \
+ done
+
+FORCE:
+
+.PHONY: all install clean FORCE prepare
diff --git a/tools/power/x86/intel-speed-select/isst-config.c b/tools/power/x86/intel-speed-select/isst-config.c
new file mode 100644
index 000000000000..91c5ad1685a1
--- /dev/null
+++ b/tools/power/x86/intel-speed-select/isst-config.c
@@ -0,0 +1,1607 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Intel Speed Select -- Enumerate and control features
+ * Copyright (c) 2019 Intel Corporation.
+ */
+
+#include <linux/isst_if.h>
+
+#include "isst.h"
+
+struct process_cmd_struct {
+ char *feature;
+ char *command;
+ void (*process_fn)(void);
+};
+
+static const char *version_str = "v1.0";
+static const int supported_api_ver = 1;
+static struct isst_if_platform_info isst_platform_info;
+static char *progname;
+static int debug_flag;
+static FILE *outf;
+
+static int cpu_model;
+
+#define MAX_CPUS_IN_ONE_REQ 64
+static short max_target_cpus;
+static unsigned short target_cpus[MAX_CPUS_IN_ONE_REQ];
+
+static int topo_max_cpus;
+static size_t present_cpumask_size;
+static cpu_set_t *present_cpumask;
+static size_t target_cpumask_size;
+static cpu_set_t *target_cpumask;
+static int tdp_level = 0xFF;
+static int fact_bucket = 0xFF;
+static int fact_avx = 0xFF;
+static unsigned long long fact_trl;
+static int out_format_json;
+static int cmd_help;
+
+/* clos related */
+static int current_clos = -1;
+static int clos_epp = -1;
+static int clos_prop_prio = -1;
+static int clos_min = -1;
+static int clos_max = -1;
+static int clos_desired = -1;
+static int clos_priority_type;
+
+struct _cpu_map {
+ unsigned short core_id;
+ unsigned short pkg_id;
+ unsigned short die_id;
+ unsigned short punit_cpu;
+ unsigned short punit_cpu_core;
+};
+struct _cpu_map *cpu_map;
+
+void debug_printf(const char *format, ...)
+{
+ va_list args;
+
+ va_start(args, format);
+
+ if (debug_flag)
+ vprintf(format, args);
+
+ va_end(args);
+}
+
+static void update_cpu_model(void)
+{
+ unsigned int ebx, ecx, edx;
+ unsigned int fms, family;
+
+ __cpuid(1, fms, ebx, ecx, edx);
+ family = (fms >> 8) & 0xf;
+ cpu_model = (fms >> 4) & 0xf;
+ if (family == 6 || family == 0xf)
+ cpu_model += ((fms >> 16) & 0xf) << 4;
+}
+
+/* Open a file, and exit on failure */
+static FILE *fopen_or_exit(const char *path, const char *mode)
+{
+ FILE *filep = fopen(path, mode);
+
+ if (!filep)
+ err(1, "%s: open failed", path);
+
+ return filep;
+}
+
+/* Parse a file containing a single int */
+static int parse_int_file(int fatal, const char *fmt, ...)
+{
+ va_list args;
+ char path[PATH_MAX];
+ FILE *filep;
+ int value;
+
+ va_start(args, fmt);
+ vsnprintf(path, sizeof(path), fmt, args);
+ va_end(args);
+ if (fatal) {
+ filep = fopen_or_exit(path, "r");
+ } else {
+ filep = fopen(path, "r");
+ if (!filep)
+ return -1;
+ }
+ if (fscanf(filep, "%d", &value) != 1)
+ err(1, "%s: failed to parse number from file", path);
+ fclose(filep);
+
+ return value;
+}
+
+int cpufreq_sysfs_present(void)
+{
+ DIR *dir;
+
+ dir = opendir("/sys/devices/system/cpu/cpu0/cpufreq");
+ if (dir) {
+ closedir(dir);
+ return 1;
+ }
+
+ return 0;
+}
+
+int out_format_is_json(void)
+{
+ return out_format_json;
+}
+
+int get_physical_package_id(int cpu)
+{
+ return parse_int_file(
+ 1, "/sys/devices/system/cpu/cpu%d/topology/physical_package_id",
+ cpu);
+}
+
+int get_physical_core_id(int cpu)
+{
+ return parse_int_file(
+ 1, "/sys/devices/system/cpu/cpu%d/topology/core_id", cpu);
+}
+
+int get_physical_die_id(int cpu)
+{
+ int ret;
+
+ ret = parse_int_file(0, "/sys/devices/system/cpu/cpu%d/topology/die_id",
+ cpu);
+ if (ret < 0)
+ ret = 0;
+
+ return ret;
+}
+
+int get_topo_max_cpus(void)
+{
+ return topo_max_cpus;
+}
+
+#define MAX_PACKAGE_COUNT 8
+#define MAX_DIE_PER_PACKAGE 2
+static void for_each_online_package_in_set(void (*callback)(int, void *, void *,
+ void *, void *),
+ void *arg1, void *arg2, void *arg3,
+ void *arg4)
+{
+ int max_packages[MAX_PACKAGE_COUNT * MAX_PACKAGE_COUNT];
+ int pkg_index = 0, i;
+
+ memset(max_packages, 0xff, sizeof(max_packages));
+ for (i = 0; i < topo_max_cpus; ++i) {
+ int j, online, pkg_id, die_id = 0, skip = 0;
+
+ if (!CPU_ISSET_S(i, present_cpumask_size, present_cpumask))
+ continue;
+ if (i)
+ online = parse_int_file(
+ 1, "/sys/devices/system/cpu/cpu%d/online", i);
+ else
+ online =
+ 1; /* online entry for CPU 0 needs some special configs */
+
+ die_id = get_physical_die_id(i);
+ if (die_id < 0)
+ die_id = 0;
+ pkg_id = get_physical_package_id(i);
+ /* Create an unique id for package, die combination to store */
+ pkg_id = (MAX_PACKAGE_COUNT * pkg_id + die_id);
+
+ for (j = 0; j < pkg_index; ++j) {
+ if (max_packages[j] == pkg_id) {
+ skip = 1;
+ break;
+ }
+ }
+
+ if (!skip && online && callback) {
+ callback(i, arg1, arg2, arg3, arg4);
+ max_packages[pkg_index++] = pkg_id;
+ }
+ }
+}
+
+static void for_each_online_target_cpu_in_set(
+ void (*callback)(int, void *, void *, void *, void *), void *arg1,
+ void *arg2, void *arg3, void *arg4)
+{
+ int i;
+
+ for (i = 0; i < topo_max_cpus; ++i) {
+ int online;
+
+ if (!CPU_ISSET_S(i, target_cpumask_size, target_cpumask))
+ continue;
+ if (i)
+ online = parse_int_file(
+ 1, "/sys/devices/system/cpu/cpu%d/online", i);
+ else
+ online =
+ 1; /* online entry for CPU 0 needs some special configs */
+
+ if (online && callback)
+ callback(i, arg1, arg2, arg3, arg4);
+ }
+}
+
+#define BITMASK_SIZE 32
+static void set_max_cpu_num(void)
+{
+ FILE *filep;
+ unsigned long dummy;
+
+ topo_max_cpus = 0;
+ filep = fopen_or_exit(
+ "/sys/devices/system/cpu/cpu0/topology/thread_siblings", "r");
+ while (fscanf(filep, "%lx,", &dummy) == 1)
+ topo_max_cpus += BITMASK_SIZE;
+ fclose(filep);
+ topo_max_cpus--; /* 0 based */
+
+ debug_printf("max cpus %d\n", topo_max_cpus);
+}
+
+size_t alloc_cpu_set(cpu_set_t **cpu_set)
+{
+ cpu_set_t *_cpu_set;
+ size_t size;
+
+ _cpu_set = CPU_ALLOC((topo_max_cpus + 1));
+ if (_cpu_set == NULL)
+ err(3, "CPU_ALLOC");
+ size = CPU_ALLOC_SIZE((topo_max_cpus + 1));
+ CPU_ZERO_S(size, _cpu_set);
+
+ *cpu_set = _cpu_set;
+ return size;
+}
+
+void free_cpu_set(cpu_set_t *cpu_set)
+{
+ CPU_FREE(cpu_set);
+}
+
+static int cpu_cnt[MAX_PACKAGE_COUNT][MAX_DIE_PER_PACKAGE];
+static void set_cpu_present_cpu_mask(void)
+{
+ size_t size;
+ DIR *dir;
+ int i;
+
+ size = alloc_cpu_set(&present_cpumask);
+ present_cpumask_size = size;
+ for (i = 0; i < topo_max_cpus; ++i) {
+ char buffer[256];
+
+ snprintf(buffer, sizeof(buffer),
+ "/sys/devices/system/cpu/cpu%d", i);
+ dir = opendir(buffer);
+ if (dir) {
+ int pkg_id, die_id;
+
+ CPU_SET_S(i, size, present_cpumask);
+ die_id = get_physical_die_id(i);
+ if (die_id < 0)
+ die_id = 0;
+
+ pkg_id = get_physical_package_id(i);
+ if (pkg_id < MAX_PACKAGE_COUNT &&
+ die_id < MAX_DIE_PER_PACKAGE)
+ cpu_cnt[pkg_id][die_id]++;
+ }
+ closedir(dir);
+ }
+}
+
+int get_cpu_count(int pkg_id, int die_id)
+{
+ if (pkg_id < MAX_PACKAGE_COUNT && die_id < MAX_DIE_PER_PACKAGE)
+ return cpu_cnt[pkg_id][die_id] + 1;
+
+ return 0;
+}
+
+static void set_cpu_target_cpu_mask(void)
+{
+ size_t size;
+ int i;
+
+ size = alloc_cpu_set(&target_cpumask);
+ target_cpumask_size = size;
+ for (i = 0; i < max_target_cpus; ++i) {
+ if (!CPU_ISSET_S(target_cpus[i], present_cpumask_size,
+ present_cpumask))
+ continue;
+
+ CPU_SET_S(target_cpus[i], size, target_cpumask);
+ }
+}
+
+static void create_cpu_map(void)
+{
+ const char *pathname = "/dev/isst_interface";
+ int i, fd = 0;
+ struct isst_if_cpu_maps map;
+
+ cpu_map = malloc(sizeof(*cpu_map) * topo_max_cpus);
+ if (!cpu_map)
+ err(3, "cpumap");
+
+ fd = open(pathname, O_RDWR);
+ if (fd < 0)
+ err(-1, "%s open failed", pathname);
+
+ for (i = 0; i < topo_max_cpus; ++i) {
+ if (!CPU_ISSET_S(i, present_cpumask_size, present_cpumask))
+ continue;
+
+ map.cmd_count = 1;
+ map.cpu_map[0].logical_cpu = i;
+
+ debug_printf(" map logical_cpu:%d\n",
+ map.cpu_map[0].logical_cpu);
+ if (ioctl(fd, ISST_IF_GET_PHY_ID, &map) == -1) {
+ perror("ISST_IF_GET_PHY_ID");
+ fprintf(outf, "Error: map logical_cpu:%d\n",
+ map.cpu_map[0].logical_cpu);
+ continue;
+ }
+ cpu_map[i].core_id = get_physical_core_id(i);
+ cpu_map[i].pkg_id = get_physical_package_id(i);
+ cpu_map[i].die_id = get_physical_die_id(i);
+ cpu_map[i].punit_cpu = map.cpu_map[0].physical_cpu;
+ cpu_map[i].punit_cpu_core = (map.cpu_map[0].physical_cpu >>
+ 1); // shift to get core id
+
+ debug_printf(
+ "map logical_cpu:%d core: %d die:%d pkg:%d punit_cpu:%d punit_core:%d\n",
+ i, cpu_map[i].core_id, cpu_map[i].die_id,
+ cpu_map[i].pkg_id, cpu_map[i].punit_cpu,
+ cpu_map[i].punit_cpu_core);
+ }
+
+ if (fd)
+ close(fd);
+}
+
+int find_logical_cpu(int pkg_id, int die_id, int punit_core_id)
+{
+ int i;
+
+ for (i = 0; i < topo_max_cpus; ++i) {
+ if (cpu_map[i].pkg_id == pkg_id &&
+ cpu_map[i].die_id == die_id &&
+ cpu_map[i].punit_cpu_core == punit_core_id)
+ return i;
+ }
+
+ return -EINVAL;
+}
+
+void set_cpu_mask_from_punit_coremask(int cpu, unsigned long long core_mask,
+ size_t core_cpumask_size,
+ cpu_set_t *core_cpumask, int *cpu_cnt)
+{
+ int i, cnt = 0;
+ int die_id, pkg_id;
+
+ *cpu_cnt = 0;
+ die_id = get_physical_die_id(cpu);
+ pkg_id = get_physical_package_id(cpu);
+
+ for (i = 0; i < 64; ++i) {
+ if (core_mask & BIT(i)) {
+ int j;
+
+ for (j = 0; j < topo_max_cpus; ++j) {
+ if (cpu_map[j].pkg_id == pkg_id &&
+ cpu_map[j].die_id == die_id &&
+ cpu_map[j].punit_cpu_core == i) {
+ CPU_SET_S(j, core_cpumask_size,
+ core_cpumask);
+ ++cnt;
+ }
+ }
+ }
+ }
+
+ *cpu_cnt = cnt;
+}
+
+int find_phy_core_num(int logical_cpu)
+{
+ if (logical_cpu < topo_max_cpus)
+ return cpu_map[logical_cpu].punit_cpu_core;
+
+ return -EINVAL;
+}
+
+static int isst_send_mmio_command(unsigned int cpu, unsigned int reg, int write,
+ unsigned int *value)
+{
+ struct isst_if_io_regs io_regs;
+ const char *pathname = "/dev/isst_interface";
+ int cmd;
+ int fd;
+
+ debug_printf("mmio_cmd cpu:%d reg:%d write:%d\n", cpu, reg, write);
+
+ fd = open(pathname, O_RDWR);
+ if (fd < 0)
+ err(-1, "%s open failed", pathname);
+
+ io_regs.req_count = 1;
+ io_regs.io_reg[0].logical_cpu = cpu;
+ io_regs.io_reg[0].reg = reg;
+ cmd = ISST_IF_IO_CMD;
+ if (write) {
+ io_regs.io_reg[0].read_write = 1;
+ io_regs.io_reg[0].value = *value;
+ } else {
+ io_regs.io_reg[0].read_write = 0;
+ }
+
+ if (ioctl(fd, cmd, &io_regs) == -1) {
+ perror("ISST_IF_IO_CMD");
+ fprintf(outf, "Error: mmio_cmd cpu:%d reg:%x read_write:%x\n",
+ cpu, reg, write);
+ } else {
+ if (!write)
+ *value = io_regs.io_reg[0].value;
+
+ debug_printf(
+ "mmio_cmd response: cpu:%d reg:%x rd_write:%x resp:%x\n",
+ cpu, reg, write, *value);
+ }
+
+ close(fd);
+
+ return 0;
+}
+
+int isst_send_mbox_command(unsigned int cpu, unsigned char command,
+ unsigned char sub_command, unsigned int parameter,
+ unsigned int req_data, unsigned int *resp)
+{
+ const char *pathname = "/dev/isst_interface";
+ int fd;
+ struct isst_if_mbox_cmds mbox_cmds = { 0 };
+
+ debug_printf(
+ "mbox_send: cpu:%d command:%x sub_command:%x parameter:%x req_data:%x\n",
+ cpu, command, sub_command, parameter, req_data);
+
+ if (isst_platform_info.mmio_supported && command == CONFIG_CLOS) {
+ unsigned int value;
+ int write = 0;
+ int clos_id, core_id, ret = 0;
+
+ debug_printf("CLOS %d\n", cpu);
+
+ if (parameter & BIT(MBOX_CMD_WRITE_BIT)) {
+ value = req_data;
+ write = 1;
+ }
+
+ switch (sub_command) {
+ case CLOS_PQR_ASSOC:
+ core_id = parameter & 0xff;
+ ret = isst_send_mmio_command(
+ cpu, PQR_ASSOC_OFFSET + core_id * 4, write,
+ &value);
+ if (!ret && !write)
+ *resp = value;
+ break;
+ case CLOS_PM_CLOS:
+ clos_id = parameter & 0x03;
+ ret = isst_send_mmio_command(
+ cpu, PM_CLOS_OFFSET + clos_id * 4, write,
+ &value);
+ if (!ret && !write)
+ *resp = value;
+ break;
+ case CLOS_PM_QOS_CONFIG:
+ ret = isst_send_mmio_command(cpu, PM_QOS_CONFIG_OFFSET,
+ write, &value);
+ if (!ret && !write)
+ *resp = value;
+ break;
+ case CLOS_STATUS:
+ break;
+ default:
+ break;
+ }
+ return ret;
+ }
+
+ mbox_cmds.cmd_count = 1;
+ mbox_cmds.mbox_cmd[0].logical_cpu = cpu;
+ mbox_cmds.mbox_cmd[0].command = command;
+ mbox_cmds.mbox_cmd[0].sub_command = sub_command;
+ mbox_cmds.mbox_cmd[0].parameter = parameter;
+ mbox_cmds.mbox_cmd[0].req_data = req_data;
+
+ fd = open(pathname, O_RDWR);
+ if (fd < 0)
+ err(-1, "%s open failed", pathname);
+
+ if (ioctl(fd, ISST_IF_MBOX_COMMAND, &mbox_cmds) == -1) {
+ perror("ISST_IF_MBOX_COMMAND");
+ fprintf(outf,
+ "Error: mbox_cmd cpu:%d command:%x sub_command:%x parameter:%x req_data:%x\n",
+ cpu, command, sub_command, parameter, req_data);
+ } else {
+ *resp = mbox_cmds.mbox_cmd[0].resp_data;
+ debug_printf(
+ "mbox_cmd response: cpu:%d command:%x sub_command:%x parameter:%x req_data:%x resp:%x\n",
+ cpu, command, sub_command, parameter, req_data, *resp);
+ }
+
+ close(fd);
+
+ return 0;
+}
+
+int isst_send_msr_command(unsigned int cpu, unsigned int msr, int write,
+ unsigned long long *req_resp)
+{
+ struct isst_if_msr_cmds msr_cmds;
+ const char *pathname = "/dev/isst_interface";
+ int fd;
+
+ fd = open(pathname, O_RDWR);
+ if (fd < 0)
+ err(-1, "%s open failed", pathname);
+
+ msr_cmds.cmd_count = 1;
+ msr_cmds.msr_cmd[0].logical_cpu = cpu;
+ msr_cmds.msr_cmd[0].msr = msr;
+ msr_cmds.msr_cmd[0].read_write = write;
+ if (write)
+ msr_cmds.msr_cmd[0].data = *req_resp;
+
+ if (ioctl(fd, ISST_IF_MSR_COMMAND, &msr_cmds) == -1) {
+ perror("ISST_IF_MSR_COMMAD");
+ fprintf(outf, "Error: msr_cmd cpu:%d msr:%x read_write:%d\n",
+ cpu, msr, write);
+ } else {
+ if (!write)
+ *req_resp = msr_cmds.msr_cmd[0].data;
+
+ debug_printf(
+ "msr_cmd response: cpu:%d msr:%x rd_write:%x resp:%llx %llx\n",
+ cpu, msr, write, *req_resp, msr_cmds.msr_cmd[0].data);
+ }
+
+ close(fd);
+
+ return 0;
+}
+
+static int isst_fill_platform_info(void)
+{
+ const char *pathname = "/dev/isst_interface";
+ int fd;
+
+ fd = open(pathname, O_RDWR);
+ if (fd < 0)
+ err(-1, "%s open failed", pathname);
+
+ if (ioctl(fd, ISST_IF_GET_PLATFORM_INFO, &isst_platform_info) == -1) {
+ perror("ISST_IF_GET_PLATFORM_INFO");
+ close(fd);
+ return -1;
+ }
+
+ close(fd);
+
+ return 0;
+}
+
+static void isst_print_platform_information(void)
+{
+ struct isst_if_platform_info platform_info;
+ const char *pathname = "/dev/isst_interface";
+ int fd;
+
+ fd = open(pathname, O_RDWR);
+ if (fd < 0)
+ err(-1, "%s open failed", pathname);
+
+ if (ioctl(fd, ISST_IF_GET_PLATFORM_INFO, &platform_info) == -1) {
+ perror("ISST_IF_GET_PLATFORM_INFO");
+ } else {
+ fprintf(outf, "Platform: API version : %d\n",
+ platform_info.api_version);
+ fprintf(outf, "Platform: Driver version : %d\n",
+ platform_info.driver_version);
+ fprintf(outf, "Platform: mbox supported : %d\n",
+ platform_info.mbox_supported);
+ fprintf(outf, "Platform: mmio supported : %d\n",
+ platform_info.mmio_supported);
+ }
+
+ close(fd);
+
+ exit(0);
+}
+
+static void exec_on_get_ctdp_cpu(int cpu, void *arg1, void *arg2, void *arg3,
+ void *arg4)
+{
+ int (*fn_ptr)(int cpu, void *arg);
+ int ret;
+
+ fn_ptr = arg1;
+ ret = fn_ptr(cpu, arg2);
+ if (ret)
+ perror("get_tdp_*");
+ else
+ isst_display_result(cpu, outf, "perf-profile", (char *)arg3,
+ *(unsigned int *)arg4);
+}
+
+#define _get_tdp_level(desc, suffix, object, help) \
+ static void get_tdp_##object(void) \
+ { \
+ struct isst_pkg_ctdp ctdp; \
+\
+ if (cmd_help) { \
+ fprintf(stderr, \
+ "Print %s [No command arguments are required]\n", \
+ help); \
+ exit(0); \
+ } \
+ isst_ctdp_display_information_start(outf); \
+ if (max_target_cpus) \
+ for_each_online_target_cpu_in_set( \
+ exec_on_get_ctdp_cpu, isst_get_ctdp_##suffix, \
+ &ctdp, desc, &ctdp.object); \
+ else \
+ for_each_online_package_in_set(exec_on_get_ctdp_cpu, \
+ isst_get_ctdp_##suffix, \
+ &ctdp, desc, \
+ &ctdp.object); \
+ isst_ctdp_display_information_end(outf); \
+ }
+
+_get_tdp_level("get-config-levels", levels, levels, "TDP levels");
+_get_tdp_level("get-config-version", levels, version, "TDP version");
+_get_tdp_level("get-config-enabled", levels, enabled, "TDP enable status");
+_get_tdp_level("get-config-current_level", levels, current_level,
+ "Current TDP Level");
+_get_tdp_level("get-lock-status", levels, locked, "TDP lock status");
+
+static void dump_isst_config_for_cpu(int cpu, void *arg1, void *arg2,
+ void *arg3, void *arg4)
+{
+ struct isst_pkg_ctdp pkg_dev;
+ int ret;
+
+ memset(&pkg_dev, 0, sizeof(pkg_dev));
+ ret = isst_get_process_ctdp(cpu, tdp_level, &pkg_dev);
+ if (ret) {
+ perror("isst_get_process_ctdp");
+ } else {
+ isst_ctdp_display_information(cpu, outf, tdp_level, &pkg_dev);
+ isst_get_process_ctdp_complete(cpu, &pkg_dev);
+ }
+}
+
+static void dump_isst_config(void)
+{
+ if (cmd_help) {
+ fprintf(stderr,
+ "Print Intel(R) Speed Select Technology Performance profile configuration\n");
+ fprintf(stderr,
+ "including base frequency and turbo frequency configurations\n");
+ fprintf(stderr, "Optional: -l|--level : Specify tdp level\n");
+ fprintf(stderr,
+ "\tIf no arguments, dump information for all TDP levels\n");
+ exit(0);
+ }
+
+ isst_ctdp_display_information_start(outf);
+
+ if (max_target_cpus)
+ for_each_online_target_cpu_in_set(dump_isst_config_for_cpu,
+ NULL, NULL, NULL, NULL);
+ else
+ for_each_online_package_in_set(dump_isst_config_for_cpu, NULL,
+ NULL, NULL, NULL);
+
+ isst_ctdp_display_information_end(outf);
+}
+
+static void set_tdp_level_for_cpu(int cpu, void *arg1, void *arg2, void *arg3,
+ void *arg4)
+{
+ int ret;
+
+ ret = isst_set_tdp_level(cpu, tdp_level);
+ if (ret)
+ perror("set_tdp_level_for_cpu");
+ else
+ isst_display_result(cpu, outf, "perf-profile", "set_tdp_level",
+ ret);
+}
+
+static void set_tdp_level(void)
+{
+ if (cmd_help) {
+ fprintf(stderr, "Set Config TDP level\n");
+ fprintf(stderr,
+ "\t Arguments: -l|--level : Specify tdp level\n");
+ exit(0);
+ }
+
+ if (tdp_level == 0xff) {
+ fprintf(outf, "Invalid command: specify tdp_level\n");
+ exit(1);
+ }
+ isst_ctdp_display_information_start(outf);
+ if (max_target_cpus)
+ for_each_online_target_cpu_in_set(set_tdp_level_for_cpu, NULL,
+ NULL, NULL, NULL);
+ else
+ for_each_online_package_in_set(set_tdp_level_for_cpu, NULL,
+ NULL, NULL, NULL);
+ isst_ctdp_display_information_end(outf);
+}
+
+static void dump_pbf_config_for_cpu(int cpu, void *arg1, void *arg2, void *arg3,
+ void *arg4)
+{
+ struct isst_pbf_info pbf_info;
+ int ret;
+
+ ret = isst_get_pbf_info(cpu, tdp_level, &pbf_info);
+ if (ret) {
+ perror("isst_get_pbf_info");
+ } else {
+ isst_pbf_display_information(cpu, outf, tdp_level, &pbf_info);
+ isst_get_pbf_info_complete(&pbf_info);
+ }
+}
+
+static void dump_pbf_config(void)
+{
+ if (cmd_help) {
+ fprintf(stderr,
+ "Print Intel(R) Speed Select Technology base frequency configuration for a TDP level\n");
+ fprintf(stderr,
+ "\tArguments: -l|--level : Specify tdp level\n");
+ exit(0);
+ }
+
+ if (tdp_level == 0xff) {
+ fprintf(outf, "Invalid command: specify tdp_level\n");
+ exit(1);
+ }
+
+ isst_ctdp_display_information_start(outf);
+ if (max_target_cpus)
+ for_each_online_target_cpu_in_set(dump_pbf_config_for_cpu, NULL,
+ NULL, NULL, NULL);
+ else
+ for_each_online_package_in_set(dump_pbf_config_for_cpu, NULL,
+ NULL, NULL, NULL);
+ isst_ctdp_display_information_end(outf);
+}
+
+static void set_pbf_for_cpu(int cpu, void *arg1, void *arg2, void *arg3,
+ void *arg4)
+{
+ int ret;
+ int status = *(int *)arg4;
+
+ ret = isst_set_pbf_fact_status(cpu, 1, status);
+ if (ret) {
+ perror("isst_set_pbf");
+ } else {
+ if (status)
+ isst_display_result(cpu, outf, "base-freq", "enable",
+ ret);
+ else
+ isst_display_result(cpu, outf, "base-freq", "disable",
+ ret);
+ }
+}
+
+static void set_pbf_enable(void)
+{
+ int status = 1;
+
+ if (cmd_help) {
+ fprintf(stderr,
+ "Enable Intel Speed Select Technology base frequency feature [No command arguments are required]\n");
+ exit(0);
+ }
+
+ isst_ctdp_display_information_start(outf);
+ if (max_target_cpus)
+ for_each_online_target_cpu_in_set(set_pbf_for_cpu, NULL, NULL,
+ NULL, &status);
+ else
+ for_each_online_package_in_set(set_pbf_for_cpu, NULL, NULL,
+ NULL, &status);
+ isst_ctdp_display_information_end(outf);
+}
+
+static void set_pbf_disable(void)
+{
+ int status = 0;
+
+ if (cmd_help) {
+ fprintf(stderr,
+ "Disable Intel Speed Select Technology base frequency feature [No command arguments are required]\n");
+ exit(0);
+ }
+
+ isst_ctdp_display_information_start(outf);
+ if (max_target_cpus)
+ for_each_online_target_cpu_in_set(set_pbf_for_cpu, NULL, NULL,
+ NULL, &status);
+ else
+ for_each_online_package_in_set(set_pbf_for_cpu, NULL, NULL,
+ NULL, &status);
+ isst_ctdp_display_information_end(outf);
+}
+
+static void dump_fact_config_for_cpu(int cpu, void *arg1, void *arg2,
+ void *arg3, void *arg4)
+{
+ struct isst_fact_info fact_info;
+ int ret;
+
+ ret = isst_get_fact_info(cpu, tdp_level, &fact_info);
+ if (ret)
+ perror("isst_get_fact_bucket_info");
+ else
+ isst_fact_display_information(cpu, outf, tdp_level, fact_bucket,
+ fact_avx, &fact_info);
+}
+
+static void dump_fact_config(void)
+{
+ if (cmd_help) {
+ fprintf(stderr,
+ "Print complete Intel Speed Select Technology turbo frequency configuration for a TDP level. Other arguments are optional.\n");
+ fprintf(stderr,
+ "\tArguments: -l|--level : Specify tdp level\n");
+ fprintf(stderr,
+ "\tArguments: -b|--bucket : Bucket index to dump\n");
+ fprintf(stderr,
+ "\tArguments: -r|--trl-type : Specify trl type: sse|avx2|avx512\n");
+ exit(0);
+ }
+
+ if (tdp_level == 0xff) {
+ fprintf(outf, "Invalid command: specify tdp_level\n");
+ exit(1);
+ }
+
+ isst_ctdp_display_information_start(outf);
+ if (max_target_cpus)
+ for_each_online_target_cpu_in_set(dump_fact_config_for_cpu,
+ NULL, NULL, NULL, NULL);
+ else
+ for_each_online_package_in_set(dump_fact_config_for_cpu, NULL,
+ NULL, NULL, NULL);
+ isst_ctdp_display_information_end(outf);
+}
+
+static void set_fact_for_cpu(int cpu, void *arg1, void *arg2, void *arg3,
+ void *arg4)
+{
+ int ret;
+ int status = *(int *)arg4;
+
+ ret = isst_set_pbf_fact_status(cpu, 0, status);
+ if (ret)
+ perror("isst_set_fact");
+ else {
+ if (status) {
+ struct isst_pkg_ctdp pkg_dev;
+
+ ret = isst_get_ctdp_levels(cpu, &pkg_dev);
+ if (ret) {
+ isst_display_result(cpu, outf, "turbo-freq",
+ "enable", ret);
+ return;
+ }
+ ret = isst_set_trl(cpu, fact_trl);
+ isst_display_result(cpu, outf, "turbo-freq", "enable",
+ ret);
+ } else {
+ /* Since we modified TRL during Fact enable, restore it */
+ isst_set_trl_from_current_tdp(cpu, fact_trl);
+ isst_display_result(cpu, outf, "turbo-freq", "disable",
+ ret);
+ }
+ }
+}
+
+static void set_fact_enable(void)
+{
+ int status = 1;
+
+ if (cmd_help) {
+ fprintf(stderr,
+ "Enable Intel Speed Select Technology Turbo frequency feature\n");
+ fprintf(stderr,
+ "Optional: -t|--trl : Specify turbo ratio limit\n");
+ exit(0);
+ }
+
+ isst_ctdp_display_information_start(outf);
+ if (max_target_cpus)
+ for_each_online_target_cpu_in_set(set_fact_for_cpu, NULL, NULL,
+ NULL, &status);
+ else
+ for_each_online_package_in_set(set_fact_for_cpu, NULL, NULL,
+ NULL, &status);
+ isst_ctdp_display_information_end(outf);
+}
+
+static void set_fact_disable(void)
+{
+ int status = 0;
+
+ if (cmd_help) {
+ fprintf(stderr,
+ "Disable Intel Speed Select Technology turbo frequency feature\n");
+ fprintf(stderr,
+ "Optional: -t|--trl : Specify turbo ratio limit\n");
+ exit(0);
+ }
+
+ isst_ctdp_display_information_start(outf);
+ if (max_target_cpus)
+ for_each_online_target_cpu_in_set(set_fact_for_cpu, NULL, NULL,
+ NULL, &status);
+ else
+ for_each_online_package_in_set(set_fact_for_cpu, NULL, NULL,
+ NULL, &status);
+ isst_ctdp_display_information_end(outf);
+}
+
+static void enable_clos_qos_config(int cpu, void *arg1, void *arg2, void *arg3,
+ void *arg4)
+{
+ int ret;
+ int status = *(int *)arg4;
+
+ ret = isst_pm_qos_config(cpu, status, clos_priority_type);
+ if (ret) {
+ perror("isst_pm_qos_config");
+ } else {
+ if (status)
+ isst_display_result(cpu, outf, "core-power", "enable",
+ ret);
+ else
+ isst_display_result(cpu, outf, "core-power", "disable",
+ ret);
+ }
+}
+
+static void set_clos_enable(void)
+{
+ int status = 1;
+
+ if (cmd_help) {
+ fprintf(stderr, "Enable core-power for a package/die\n");
+ fprintf(stderr,
+ "\tClos Enable: Specify priority type with [--priority|-p]\n");
+ fprintf(stderr, "\t\t 0: Proportional, 1: Ordered\n");
+ exit(0);
+ }
+
+ if (cpufreq_sysfs_present()) {
+ fprintf(stderr,
+ "cpufreq subsystem and core-power enable will interfere with each other!\n");
+ }
+
+ isst_ctdp_display_information_start(outf);
+ if (max_target_cpus)
+ for_each_online_target_cpu_in_set(enable_clos_qos_config, NULL,
+ NULL, NULL, &status);
+ else
+ for_each_online_package_in_set(enable_clos_qos_config, NULL,
+ NULL, NULL, &status);
+ isst_ctdp_display_information_end(outf);
+}
+
+static void set_clos_disable(void)
+{
+ int status = 0;
+
+ if (cmd_help) {
+ fprintf(stderr,
+ "Disable core-power: [No command arguments are required]\n");
+ exit(0);
+ }
+
+ isst_ctdp_display_information_start(outf);
+ if (max_target_cpus)
+ for_each_online_target_cpu_in_set(enable_clos_qos_config, NULL,
+ NULL, NULL, &status);
+ else
+ for_each_online_package_in_set(enable_clos_qos_config, NULL,
+ NULL, NULL, &status);
+ isst_ctdp_display_information_end(outf);
+}
+
+static void dump_clos_config_for_cpu(int cpu, void *arg1, void *arg2,
+ void *arg3, void *arg4)
+{
+ struct isst_clos_config clos_config;
+ int ret;
+
+ ret = isst_pm_get_clos(cpu, current_clos, &clos_config);
+ if (ret)
+ perror("isst_pm_get_clos");
+ else
+ isst_clos_display_information(cpu, outf, current_clos,
+ &clos_config);
+}
+
+static void dump_clos_config(void)
+{
+ if (cmd_help) {
+ fprintf(stderr,
+ "Print Intel Speed Select Technology core power configuration\n");
+ fprintf(stderr,
+ "\tArguments: [-c | --clos]: Specify clos id\n");
+ exit(0);
+ }
+ if (current_clos < 0 || current_clos > 3) {
+ fprintf(stderr, "Invalid clos id\n");
+ exit(0);
+ }
+
+ isst_ctdp_display_information_start(outf);
+ if (max_target_cpus)
+ for_each_online_target_cpu_in_set(dump_clos_config_for_cpu,
+ NULL, NULL, NULL, NULL);
+ else
+ for_each_online_package_in_set(dump_clos_config_for_cpu, NULL,
+ NULL, NULL, NULL);
+ isst_ctdp_display_information_end(outf);
+}
+
+static void set_clos_config_for_cpu(int cpu, void *arg1, void *arg2, void *arg3,
+ void *arg4)
+{
+ struct isst_clos_config clos_config;
+ int ret;
+
+ clos_config.pkg_id = get_physical_package_id(cpu);
+ clos_config.die_id = get_physical_die_id(cpu);
+
+ clos_config.epp = clos_epp;
+ clos_config.clos_prop_prio = clos_prop_prio;
+ clos_config.clos_min = clos_min;
+ clos_config.clos_max = clos_max;
+ clos_config.clos_desired = clos_desired;
+ ret = isst_set_clos(cpu, current_clos, &clos_config);
+ if (ret)
+ perror("isst_set_clos");
+ else
+ isst_display_result(cpu, outf, "core-power", "config", ret);
+}
+
+static void set_clos_config(void)
+{
+ if (cmd_help) {
+ fprintf(stderr,
+ "Set core-power configuration for one of the four clos ids\n");
+ fprintf(stderr,
+ "\tSpecify targeted clos id with [--clos|-c]\n");
+ fprintf(stderr, "\tSpecify clos EPP with [--epp|-e]\n");
+ fprintf(stderr,
+ "\tSpecify clos Proportional Priority [--weight|-w]\n");
+ fprintf(stderr, "\tSpecify clos min with [--min|-n]\n");
+ fprintf(stderr, "\tSpecify clos max with [--max|-m]\n");
+ fprintf(stderr, "\tSpecify clos desired with [--desired|-d]\n");
+ exit(0);
+ }
+
+ if (current_clos < 0 || current_clos > 3) {
+ fprintf(stderr, "Invalid clos id\n");
+ exit(0);
+ }
+ if (clos_epp < 0 || clos_epp > 0x0F) {
+ fprintf(stderr, "clos epp is not specified, default: 0\n");
+ clos_epp = 0;
+ }
+ if (clos_prop_prio < 0 || clos_prop_prio > 0x0F) {
+ fprintf(stderr,
+ "clos frequency weight is not specified, default: 0\n");
+ clos_prop_prio = 0;
+ }
+ if (clos_min < 0) {
+ fprintf(stderr, "clos min is not specified, default: 0\n");
+ clos_min = 0;
+ }
+ if (clos_max < 0) {
+ fprintf(stderr, "clos max is not specified, default: 0xff\n");
+ clos_max = 0xff;
+ }
+ if (clos_desired < 0) {
+ fprintf(stderr, "clos desired is not specified, default: 0\n");
+ clos_desired = 0x00;
+ }
+
+ isst_ctdp_display_information_start(outf);
+ if (max_target_cpus)
+ for_each_online_target_cpu_in_set(set_clos_config_for_cpu, NULL,
+ NULL, NULL, NULL);
+ else
+ for_each_online_package_in_set(set_clos_config_for_cpu, NULL,
+ NULL, NULL, NULL);
+ isst_ctdp_display_information_end(outf);
+}
+
+static void set_clos_assoc_for_cpu(int cpu, void *arg1, void *arg2, void *arg3,
+ void *arg4)
+{
+ int ret;
+
+ ret = isst_clos_associate(cpu, current_clos);
+ if (ret)
+ perror("isst_clos_associate");
+ else
+ isst_display_result(cpu, outf, "core-power", "assoc", ret);
+}
+
+static void set_clos_assoc(void)
+{
+ if (cmd_help) {
+ fprintf(stderr, "Associate a clos id to a CPU\n");
+ fprintf(stderr,
+ "\tSpecify targeted clos id with [--clos|-c]\n");
+ exit(0);
+ }
+
+ if (current_clos < 0 || current_clos > 3) {
+ fprintf(stderr, "Invalid clos id\n");
+ exit(0);
+ }
+ if (max_target_cpus)
+ for_each_online_target_cpu_in_set(set_clos_assoc_for_cpu, NULL,
+ NULL, NULL, NULL);
+ else {
+ fprintf(stderr,
+ "Invalid target cpu. Specify with [-c|--cpu]\n");
+ }
+}
+
+static void get_clos_assoc_for_cpu(int cpu, void *arg1, void *arg2, void *arg3,
+ void *arg4)
+{
+ int clos, ret;
+
+ ret = isst_clos_get_assoc_status(cpu, &clos);
+ if (ret)
+ perror("isst_clos_get_assoc_status");
+ else
+ isst_display_result(cpu, outf, "core-power", "get-assoc", clos);
+}
+
+static void get_clos_assoc(void)
+{
+ if (cmd_help) {
+ fprintf(stderr, "Get associate clos id to a CPU\n");
+ fprintf(stderr, "\tSpecify targeted cpu id with [--cpu|-c]\n");
+ exit(0);
+ }
+ if (max_target_cpus)
+ for_each_online_target_cpu_in_set(get_clos_assoc_for_cpu, NULL,
+ NULL, NULL, NULL);
+ else {
+ fprintf(stderr,
+ "Invalid target cpu. Specify with [-c|--cpu]\n");
+ }
+}
+
+static struct process_cmd_struct isst_cmds[] = {
+ { "perf-profile", "get-lock-status", get_tdp_locked },
+ { "perf-profile", "get-config-levels", get_tdp_levels },
+ { "perf-profile", "get-config-version", get_tdp_version },
+ { "perf-profile", "get-config-enabled", get_tdp_enabled },
+ { "perf-profile", "get-config-current-level", get_tdp_current_level },
+ { "perf-profile", "set-config-level", set_tdp_level },
+ { "perf-profile", "info", dump_isst_config },
+ { "base-freq", "info", dump_pbf_config },
+ { "base-freq", "enable", set_pbf_enable },
+ { "base-freq", "disable", set_pbf_disable },
+ { "turbo-freq", "info", dump_fact_config },
+ { "turbo-freq", "enable", set_fact_enable },
+ { "turbo-freq", "disable", set_fact_disable },
+ { "core-power", "info", dump_clos_config },
+ { "core-power", "enable", set_clos_enable },
+ { "core-power", "disable", set_clos_disable },
+ { "core-power", "config", set_clos_config },
+ { "core-power", "assoc", set_clos_assoc },
+ { "core-power", "get-assoc", get_clos_assoc },
+ { NULL, NULL, NULL }
+};
+
+/*
+ * parse cpuset with following syntax
+ * 1,2,4..6,8-10 and set bits in cpu_subset
+ */
+void parse_cpu_command(char *optarg)
+{
+ unsigned int start, end;
+ char *next;
+
+ next = optarg;
+
+ while (next && *next) {
+ if (*next == '-') /* no negative cpu numbers */
+ goto error;
+
+ start = strtoul(next, &next, 10);
+
+ if (max_target_cpus < MAX_CPUS_IN_ONE_REQ)
+ target_cpus[max_target_cpus++] = start;
+
+ if (*next == '\0')
+ break;
+
+ if (*next == ',') {
+ next += 1;
+ continue;
+ }
+
+ if (*next == '-') {
+ next += 1; /* start range */
+ } else if (*next == '.') {
+ next += 1;
+ if (*next == '.')
+ next += 1; /* start range */
+ else
+ goto error;
+ }
+
+ end = strtoul(next, &next, 10);
+ if (end <= start)
+ goto error;
+
+ while (++start <= end) {
+ if (max_target_cpus < MAX_CPUS_IN_ONE_REQ)
+ target_cpus[max_target_cpus++] = start;
+ }
+
+ if (*next == ',')
+ next += 1;
+ else if (*next != '\0')
+ goto error;
+ }
+
+#ifdef DEBUG
+ {
+ int i;
+
+ for (i = 0; i < max_target_cpus; ++i)
+ printf("cpu [%d] in arg\n", target_cpus[i]);
+ }
+#endif
+ return;
+
+error:
+ fprintf(stderr, "\"--cpu %s\" malformed\n", optarg);
+ exit(-1);
+}
+
+static void parse_cmd_args(int argc, int start, char **argv)
+{
+ int opt;
+ int option_index;
+
+ static struct option long_options[] = {
+ { "bucket", required_argument, 0, 'b' },
+ { "level", required_argument, 0, 'l' },
+ { "trl-type", required_argument, 0, 'r' },
+ { "trl", required_argument, 0, 't' },
+ { "help", no_argument, 0, 'h' },
+ { "clos", required_argument, 0, 'c' },
+ { "desired", required_argument, 0, 'd' },
+ { "epp", required_argument, 0, 'e' },
+ { "min", required_argument, 0, 'n' },
+ { "max", required_argument, 0, 'm' },
+ { "priority", required_argument, 0, 'p' },
+ { "weight", required_argument, 0, 'w' },
+ { 0, 0, 0, 0 }
+ };
+
+ option_index = start;
+
+ optind = start + 1;
+ while ((opt = getopt_long(argc, argv, "b:l:t:c:d:e:n:m:p:w:h",
+ long_options, &option_index)) != -1) {
+ switch (opt) {
+ case 'b':
+ fact_bucket = atoi(optarg);
+ break;
+ case 'h':
+ cmd_help = 1;
+ break;
+ case 'l':
+ tdp_level = atoi(optarg);
+ break;
+ case 't':
+ sscanf(optarg, "0x%llx", &fact_trl);
+ break;
+ case 'r':
+ if (!strncmp(optarg, "sse", 3)) {
+ fact_avx = 0x01;
+ } else if (!strncmp(optarg, "avx2", 4)) {
+ fact_avx = 0x02;
+ } else if (!strncmp(optarg, "avx512", 4)) {
+ fact_avx = 0x04;
+ } else {
+ fprintf(outf, "Invalid sse,avx options\n");
+ exit(1);
+ }
+ break;
+ /* CLOS related */
+ case 'c':
+ current_clos = atoi(optarg);
+ printf("clos %d\n", current_clos);
+ break;
+ case 'd':
+ clos_desired = atoi(optarg);
+ break;
+ case 'e':
+ clos_epp = atoi(optarg);
+ break;
+ case 'n':
+ clos_min = atoi(optarg);
+ break;
+ case 'm':
+ clos_max = atoi(optarg);
+ break;
+ case 'p':
+ clos_priority_type = atoi(optarg);
+ break;
+ case 'w':
+ clos_prop_prio = atoi(optarg);
+ break;
+ default:
+ printf("no match\n");
+ }
+ }
+}
+
+static void isst_help(void)
+{
+ printf("perf-profile:\tAn architectural mechanism that allows multiple optimized \n\
+ performance profiles per system via static and/or dynamic\n\
+ adjustment of core count, workload, Tjmax, and\n\
+ TDP, etc.\n");
+ printf("\nCommands : For feature=perf-profile\n");
+ printf("\tinfo\n");
+ printf("\tget-lock-status\n");
+ printf("\tget-config-levels\n");
+ printf("\tget-config-version\n");
+ printf("\tget-config-enabled\n");
+ printf("\tget-config-current-level\n");
+ printf("\tset-config-level\n");
+}
+
+static void pbf_help(void)
+{
+ printf("base-freq:\tEnables users to increase guaranteed base frequency\n\
+ on certain cores (high priority cores) in exchange for lower\n\
+ base frequency on remaining cores (low priority cores).\n");
+ printf("\tcommand : info\n");
+ printf("\tcommand : enable\n");
+ printf("\tcommand : disable\n");
+}
+
+static void fact_help(void)
+{
+ printf("turbo-freq:\tEnables the ability to set different turbo ratio\n\
+ limits to cores based on priority.\n");
+ printf("\nCommand: For feature=turbo-freq\n");
+ printf("\tcommand : info\n");
+ printf("\tcommand : enable\n");
+ printf("\tcommand : disable\n");
+}
+
+static void core_power_help(void)
+{
+ printf("core-power:\tInterface that allows user to define per core/tile\n\
+ priority.\n");
+ printf("\nCommands : For feature=core-power\n");
+ printf("\tinfo\n");
+ printf("\tenable\n");
+ printf("\tdisable\n");
+ printf("\tconfig\n");
+ printf("\tassoc\n");
+ printf("\tget-assoc\n");
+}
+
+struct process_cmd_help_struct {
+ char *feature;
+ void (*process_fn)(void);
+};
+
+static struct process_cmd_help_struct isst_help_cmds[] = {
+ { "perf-profile", isst_help },
+ { "base-freq", pbf_help },
+ { "turbo-freq", fact_help },
+ { "core-power", core_power_help },
+ { NULL, NULL }
+};
+
+void process_command(int argc, char **argv)
+{
+ int i = 0, matched = 0;
+ char *feature = argv[optind];
+ char *cmd = argv[optind + 1];
+
+ if (!feature || !cmd)
+ return;
+
+ debug_printf("feature name [%s] command [%s]\n", feature, cmd);
+ if (!strcmp(cmd, "-h") || !strcmp(cmd, "--help")) {
+ while (isst_help_cmds[i].feature) {
+ if (!strcmp(isst_help_cmds[i].feature, feature)) {
+ isst_help_cmds[i].process_fn();
+ exit(0);
+ }
+ ++i;
+ }
+ }
+
+ create_cpu_map();
+
+ i = 0;
+ while (isst_cmds[i].feature) {
+ if (!strcmp(isst_cmds[i].feature, feature) &&
+ !strcmp(isst_cmds[i].command, cmd)) {
+ parse_cmd_args(argc, optind + 1, argv);
+ isst_cmds[i].process_fn();
+ matched = 1;
+ break;
+ }
+ ++i;
+ }
+
+ if (!matched)
+ fprintf(stderr, "Invalid command\n");
+}
+
+static void usage(void)
+{
+ printf("Intel(R) Speed Select Technology\n");
+ printf("\nUsage:\n");
+ printf("intel-speed-select [OPTIONS] FEATURE COMMAND COMMAND_ARGUMENTS\n");
+ printf("\nUse this tool to enumerate and control the Intel Speed Select Technology features,\n");
+ printf("\nFEATURE : [perf-profile|base-freq|turbo-freq|core-power]\n");
+ printf("\nFor help on each feature, use --h|--help\n");
+ printf("\tFor example: intel-speed-select perf-profile -h\n");
+
+ printf("\nFor additional help on each command for a feature, use --h|--help\n");
+ printf("\tFor example: intel-speed-select perf-profile get-lock-status -h\n");
+ printf("\t\t This will print help for the command \"get-lock-status\" for the feature \"perf-profile\"\n");
+
+ printf("\nOPTIONS\n");
+ printf("\t[-c|--cpu] : logical cpu number\n");
+ printf("\t\tDefault: Die scoped for all dies in the system with multiple dies/package\n");
+ printf("\t\t\t Or Package scoped for all Packages when each package contains one die\n");
+ printf("\t[-d|--debug] : Debug mode\n");
+ printf("\t[-h|--help] : Print help\n");
+ printf("\t[-i|--info] : Print platform information\n");
+ printf("\t[-o|--out] : Output file\n");
+ printf("\t\t\tDefault : stderr\n");
+ printf("\t[-f|--format] : output format [json|text]. Default: text\n");
+ printf("\t[-v|--version] : Print version\n");
+
+ printf("\nResult format\n");
+ printf("\tResult display uses a common format for each command:\n");
+ printf("\tResults are formatted in text/JSON with\n");
+ printf("\t\tPackage, Die, CPU, and command specific results.\n");
+ printf("\t\t\tFor Set commands, status is 0 for success and rest for failures\n");
+ exit(1);
+}
+
+static void print_version(void)
+{
+ fprintf(outf, "Version %s\n", version_str);
+ fprintf(outf, "Build date %s time %s\n", __DATE__, __TIME__);
+ exit(0);
+}
+
+static void cmdline(int argc, char **argv)
+{
+ int opt;
+ int option_index = 0;
+
+ static struct option long_options[] = {
+ { "cpu", required_argument, 0, 'c' },
+ { "debug", no_argument, 0, 'd' },
+ { "format", required_argument, 0, 'f' },
+ { "help", no_argument, 0, 'h' },
+ { "info", no_argument, 0, 'i' },
+ { "out", required_argument, 0, 'o' },
+ { "version", no_argument, 0, 'v' },
+ { 0, 0, 0, 0 }
+ };
+
+ progname = argv[0];
+ while ((opt = getopt_long_only(argc, argv, "+c:df:hio:v", long_options,
+ &option_index)) != -1) {
+ switch (opt) {
+ case 'c':
+ parse_cpu_command(optarg);
+ break;
+ case 'd':
+ debug_flag = 1;
+ printf("Debug Mode ON\n");
+ break;
+ case 'f':
+ if (!strncmp(optarg, "json", 4))
+ out_format_json = 1;
+ break;
+ case 'h':
+ usage();
+ break;
+ case 'i':
+ isst_print_platform_information();
+ break;
+ case 'o':
+ if (outf)
+ fclose(outf);
+ outf = fopen_or_exit(optarg, "w");
+ break;
+ case 'v':
+ print_version();
+ break;
+ default:
+ usage();
+ }
+ }
+
+ if (geteuid() != 0) {
+ fprintf(stderr, "Must run as root\n");
+ exit(0);
+ }
+
+ if (optind > (argc - 2)) {
+ fprintf(stderr, "Feature name and|or command not specified\n");
+ exit(0);
+ }
+ update_cpu_model();
+ printf("Intel(R) Speed Select Technology\n");
+ printf("Executing on CPU model:%d[0x%x]\n", cpu_model, cpu_model);
+ set_max_cpu_num();
+ set_cpu_present_cpu_mask();
+ set_cpu_target_cpu_mask();
+ isst_fill_platform_info();
+ if (isst_platform_info.api_version > supported_api_ver) {
+ printf("Incompatible API versions; Upgrade of tool is required\n");
+ exit(0);
+ }
+
+ process_command(argc, argv);
+}
+
+int main(int argc, char **argv)
+{
+ outf = stderr;
+ cmdline(argc, argv);
+ return 0;
+}
diff --git a/tools/power/x86/intel-speed-select/isst-core.c b/tools/power/x86/intel-speed-select/isst-core.c
new file mode 100644
index 000000000000..8de4ac39a008
--- /dev/null
+++ b/tools/power/x86/intel-speed-select/isst-core.c
@@ -0,0 +1,721 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Intel Speed Select -- Enumerate and control features
+ * Copyright (c) 2019 Intel Corporation.
+ */
+
+#include "isst.h"
+
+int isst_get_ctdp_levels(int cpu, struct isst_pkg_ctdp *pkg_dev)
+{
+ unsigned int resp;
+ int ret;
+
+ ret = isst_send_mbox_command(cpu, CONFIG_TDP,
+ CONFIG_TDP_GET_LEVELS_INFO, 0, 0, &resp);
+ if (ret)
+ return ret;
+
+ debug_printf("cpu:%d CONFIG_TDP_GET_LEVELS_INFO resp:%x\n", cpu, resp);
+
+ pkg_dev->version = resp & 0xff;
+ pkg_dev->levels = (resp >> 8) & 0xff;
+ pkg_dev->current_level = (resp >> 16) & 0xff;
+ pkg_dev->locked = !!(resp & BIT(24));
+ pkg_dev->enabled = !!(resp & BIT(31));
+
+ return 0;
+}
+
+int isst_get_ctdp_control(int cpu, int config_index,
+ struct isst_pkg_ctdp_level_info *ctdp_level)
+{
+ unsigned int resp;
+ int ret;
+
+ ret = isst_send_mbox_command(cpu, CONFIG_TDP,
+ CONFIG_TDP_GET_TDP_CONTROL, 0,
+ config_index, &resp);
+ if (ret)
+ return ret;
+
+ ctdp_level->fact_support = resp & BIT(0);
+ ctdp_level->pbf_support = !!(resp & BIT(1));
+ ctdp_level->fact_enabled = !!(resp & BIT(16));
+ ctdp_level->pbf_enabled = !!(resp & BIT(17));
+
+ debug_printf(
+ "cpu:%d CONFIG_TDP_GET_TDP_CONTROL resp:%x fact_support:%d pbf_support: %d fact_enabled:%d pbf_enabled:%d\n",
+ cpu, resp, ctdp_level->fact_support, ctdp_level->pbf_support,
+ ctdp_level->fact_enabled, ctdp_level->pbf_enabled);
+
+ return 0;
+}
+
+int isst_get_tdp_info(int cpu, int config_index,
+ struct isst_pkg_ctdp_level_info *ctdp_level)
+{
+ unsigned int resp;
+ int ret;
+
+ ret = isst_send_mbox_command(cpu, CONFIG_TDP, CONFIG_TDP_GET_TDP_INFO,
+ 0, config_index, &resp);
+ if (ret)
+ return ret;
+
+ ctdp_level->pkg_tdp = resp & GENMASK(14, 0);
+ ctdp_level->tdp_ratio = (resp & GENMASK(23, 16)) >> 16;
+
+ debug_printf(
+ "cpu:%d ctdp:%d CONFIG_TDP_GET_TDP_INFO resp:%x tdp_ratio:%d pkg_tdp:%d\n",
+ cpu, config_index, resp, ctdp_level->tdp_ratio,
+ ctdp_level->pkg_tdp);
+ return 0;
+}
+
+int isst_get_pwr_info(int cpu, int config_index,
+ struct isst_pkg_ctdp_level_info *ctdp_level)
+{
+ unsigned int resp;
+ int ret;
+
+ ret = isst_send_mbox_command(cpu, CONFIG_TDP, CONFIG_TDP_GET_PWR_INFO,
+ 0, config_index, &resp);
+ if (ret)
+ return ret;
+
+ ctdp_level->pkg_max_power = resp & GENMASK(14, 0);
+ ctdp_level->pkg_min_power = (resp & GENMASK(30, 16)) >> 16;
+
+ debug_printf(
+ "cpu:%d ctdp:%d CONFIG_TDP_GET_PWR_INFO resp:%x pkg_max_power:%d pkg_min_power:%d\n",
+ cpu, config_index, resp, ctdp_level->pkg_max_power,
+ ctdp_level->pkg_min_power);
+
+ return 0;
+}
+
+int isst_get_tjmax_info(int cpu, int config_index,
+ struct isst_pkg_ctdp_level_info *ctdp_level)
+{
+ unsigned int resp;
+ int ret;
+
+ ret = isst_send_mbox_command(cpu, CONFIG_TDP, CONFIG_TDP_GET_TJMAX_INFO,
+ 0, config_index, &resp);
+ if (ret)
+ return ret;
+
+ ctdp_level->t_proc_hot = resp & GENMASK(7, 0);
+
+ debug_printf(
+ "cpu:%d ctdp:%d CONFIG_TDP_GET_TJMAX_INFO resp:%x t_proc_hot:%d\n",
+ cpu, config_index, resp, ctdp_level->t_proc_hot);
+
+ return 0;
+}
+
+int isst_get_coremask_info(int cpu, int config_index,
+ struct isst_pkg_ctdp_level_info *ctdp_level)
+{
+ unsigned int resp;
+ int i, ret;
+
+ ctdp_level->cpu_count = 0;
+ for (i = 0; i < 2; ++i) {
+ unsigned long long mask;
+ int cpu_count = 0;
+
+ ret = isst_send_mbox_command(cpu, CONFIG_TDP,
+ CONFIG_TDP_GET_CORE_MASK, 0,
+ (i << 8) | config_index, &resp);
+ if (ret)
+ return ret;
+
+ debug_printf(
+ "cpu:%d ctdp:%d mask:%d CONFIG_TDP_GET_CORE_MASK resp:%x\n",
+ cpu, config_index, i, resp);
+
+ mask = (unsigned long long)resp << (32 * i);
+ set_cpu_mask_from_punit_coremask(cpu, mask,
+ ctdp_level->core_cpumask_size,
+ ctdp_level->core_cpumask,
+ &cpu_count);
+ ctdp_level->cpu_count += cpu_count;
+ debug_printf("cpu:%d ctdp:%d mask:%d cpu count:%d\n", cpu,
+ config_index, i, ctdp_level->cpu_count);
+ }
+
+ return 0;
+}
+
+int isst_get_get_trl(int cpu, int level, int avx_level, int *trl)
+{
+ unsigned int req, resp;
+ int ret;
+
+ req = level | (avx_level << 16);
+ ret = isst_send_mbox_command(cpu, CONFIG_TDP,
+ CONFIG_TDP_GET_TURBO_LIMIT_RATIOS, 0, req,
+ &resp);
+ if (ret)
+ return ret;
+
+ debug_printf(
+ "cpu:%d CONFIG_TDP_GET_TURBO_LIMIT_RATIOS req:%x resp:%x\n",
+ cpu, req, resp);
+
+ trl[0] = resp & GENMASK(7, 0);
+ trl[1] = (resp & GENMASK(15, 8)) >> 8;
+ trl[2] = (resp & GENMASK(23, 16)) >> 16;
+ trl[3] = (resp & GENMASK(31, 24)) >> 24;
+
+ req = level | BIT(8) | (avx_level << 16);
+ ret = isst_send_mbox_command(cpu, CONFIG_TDP,
+ CONFIG_TDP_GET_TURBO_LIMIT_RATIOS, 0, req,
+ &resp);
+ if (ret)
+ return ret;
+
+ debug_printf("cpu:%d CONFIG_TDP_GET_TURBO_LIMIT req:%x resp:%x\n", cpu,
+ req, resp);
+
+ trl[4] = resp & GENMASK(7, 0);
+ trl[5] = (resp & GENMASK(15, 8)) >> 8;
+ trl[6] = (resp & GENMASK(23, 16)) >> 16;
+ trl[7] = (resp & GENMASK(31, 24)) >> 24;
+
+ return 0;
+}
+
+int isst_set_tdp_level_msr(int cpu, int tdp_level)
+{
+ int ret;
+
+ debug_printf("cpu: tdp_level via MSR %d\n", cpu, tdp_level);
+
+ if (isst_get_config_tdp_lock_status(cpu)) {
+ debug_printf("cpu: tdp_locked %d\n", cpu);
+ return -1;
+ }
+
+ if (tdp_level > 2)
+ return -1; /* invalid value */
+
+ ret = isst_send_msr_command(cpu, 0x64b, 1,
+ (unsigned long long *)&tdp_level);
+ if (ret)
+ return ret;
+
+ debug_printf("cpu: tdp_level via MSR successful %d\n", cpu, tdp_level);
+
+ return 0;
+}
+
+int isst_set_tdp_level(int cpu, int tdp_level)
+{
+ unsigned int resp;
+ int ret;
+
+ ret = isst_send_mbox_command(cpu, CONFIG_TDP, CONFIG_TDP_SET_LEVEL, 0,
+ tdp_level, &resp);
+ if (ret)
+ return isst_set_tdp_level_msr(cpu, tdp_level);
+
+ return 0;
+}
+
+int isst_get_pbf_info(int cpu, int level, struct isst_pbf_info *pbf_info)
+{
+ unsigned int req, resp;
+ int i, ret;
+
+ pbf_info->core_cpumask_size = alloc_cpu_set(&pbf_info->core_cpumask);
+
+ for (i = 0; i < 2; ++i) {
+ unsigned long long mask;
+ int count;
+
+ ret = isst_send_mbox_command(cpu, CONFIG_TDP,
+ CONFIG_TDP_PBF_GET_CORE_MASK_INFO,
+ 0, (i << 8) | level, &resp);
+ if (ret)
+ return ret;
+
+ debug_printf(
+ "cpu:%d CONFIG_TDP_PBF_GET_CORE_MASK_INFO resp:%x\n",
+ cpu, resp);
+
+ mask = (unsigned long long)resp << (32 * i);
+ set_cpu_mask_from_punit_coremask(cpu, mask,
+ pbf_info->core_cpumask_size,
+ pbf_info->core_cpumask,
+ &count);
+ }
+
+ req = level;
+ ret = isst_send_mbox_command(cpu, CONFIG_TDP,
+ CONFIG_TDP_PBF_GET_P1HI_P1LO_INFO, 0, req,
+ &resp);
+ if (ret)
+ return ret;
+
+ debug_printf("cpu:%d CONFIG_TDP_PBF_GET_P1HI_P1LO_INFO resp:%x\n", cpu,
+ resp);
+
+ pbf_info->p1_low = resp & 0xff;
+ pbf_info->p1_high = (resp & GENMASK(15, 8)) >> 8;
+
+ req = level;
+ ret = isst_send_mbox_command(
+ cpu, CONFIG_TDP, CONFIG_TDP_PBF_GET_TDP_INFO, 0, req, &resp);
+ if (ret)
+ return ret;
+
+ debug_printf("cpu:%d CONFIG_TDP_PBF_GET_TDP_INFO resp:%x\n", cpu, resp);
+
+ pbf_info->tdp = resp & 0xffff;
+
+ req = level;
+ ret = isst_send_mbox_command(
+ cpu, CONFIG_TDP, CONFIG_TDP_PBF_GET_TJ_MAX_INFO, 0, req, &resp);
+ if (ret)
+ return ret;
+
+ debug_printf("cpu:%d CONFIG_TDP_PBF_GET_TJ_MAX_INFO resp:%x\n", cpu,
+ resp);
+ pbf_info->t_control = (resp >> 8) & 0xff;
+ pbf_info->t_prochot = resp & 0xff;
+
+ return 0;
+}
+
+void isst_get_pbf_info_complete(struct isst_pbf_info *pbf_info)
+{
+ free_cpu_set(pbf_info->core_cpumask);
+}
+
+int isst_set_pbf_fact_status(int cpu, int pbf, int enable)
+{
+ struct isst_pkg_ctdp pkg_dev;
+ struct isst_pkg_ctdp_level_info ctdp_level;
+ int current_level;
+ unsigned int req = 0, resp;
+ int ret;
+
+ ret = isst_get_ctdp_levels(cpu, &pkg_dev);
+ if (ret)
+ return ret;
+
+ current_level = pkg_dev.current_level;
+
+ ret = isst_get_ctdp_control(cpu, current_level, &ctdp_level);
+ if (ret)
+ return ret;
+
+ if (pbf) {
+ if (ctdp_level.fact_enabled)
+ req = BIT(16);
+
+ if (enable)
+ req |= BIT(17);
+ else
+ req &= ~BIT(17);
+ } else {
+ if (ctdp_level.pbf_enabled)
+ req = BIT(17);
+
+ if (enable)
+ req |= BIT(16);
+ else
+ req &= ~BIT(16);
+ }
+
+ ret = isst_send_mbox_command(cpu, CONFIG_TDP,
+ CONFIG_TDP_SET_TDP_CONTROL, 0, req, &resp);
+ if (ret)
+ return ret;
+
+ debug_printf("cpu:%d CONFIG_TDP_SET_TDP_CONTROL pbf/fact:%d req:%x\n",
+ cpu, pbf, req);
+
+ return 0;
+}
+
+int isst_get_fact_bucket_info(int cpu, int level,
+ struct isst_fact_bucket_info *bucket_info)
+{
+ unsigned int resp;
+ int i, k, ret;
+
+ for (i = 0; i < 2; ++i) {
+ int j;
+
+ ret = isst_send_mbox_command(
+ cpu, CONFIG_TDP,
+ CONFIG_TDP_GET_FACT_HP_TURBO_LIMIT_NUMCORES, 0,
+ (i << 8) | level, &resp);
+ if (ret)
+ return ret;
+
+ debug_printf(
+ "cpu:%d CONFIG_TDP_GET_FACT_HP_TURBO_LIMIT_NUMCORES index:%d level:%d resp:%x\n",
+ cpu, i, level, resp);
+
+ for (j = 0; j < 4; ++j) {
+ bucket_info[j + (i * 4)].high_priority_cores_count =
+ (resp >> (j * 8)) & 0xff;
+ }
+ }
+
+ for (k = 0; k < 3; ++k) {
+ for (i = 0; i < 2; ++i) {
+ int j;
+
+ ret = isst_send_mbox_command(
+ cpu, CONFIG_TDP,
+ CONFIG_TDP_GET_FACT_HP_TURBO_LIMIT_RATIOS, 0,
+ (k << 16) | (i << 8) | level, &resp);
+ if (ret)
+ return ret;
+
+ debug_printf(
+ "cpu:%d CONFIG_TDP_GET_FACT_HP_TURBO_LIMIT_RATIOS index:%d level:%d avx:%d resp:%x\n",
+ cpu, i, level, k, resp);
+
+ for (j = 0; j < 4; ++j) {
+ switch (k) {
+ case 0:
+ bucket_info[j + (i * 4)].sse_trl =
+ (resp >> (j * 8)) & 0xff;
+ break;
+ case 1:
+ bucket_info[j + (i * 4)].avx_trl =
+ (resp >> (j * 8)) & 0xff;
+ break;
+ case 2:
+ bucket_info[j + (i * 4)].avx512_trl =
+ (resp >> (j * 8)) & 0xff;
+ break;
+ default:
+ break;
+ }
+ }
+ }
+ }
+
+ return 0;
+}
+
+int isst_get_fact_info(int cpu, int level, struct isst_fact_info *fact_info)
+{
+ unsigned int resp;
+ int ret;
+
+ ret = isst_send_mbox_command(cpu, CONFIG_TDP,
+ CONFIG_TDP_GET_FACT_LP_CLIPPING_RATIO, 0,
+ level, &resp);
+ if (ret)
+ return ret;
+
+ debug_printf("cpu:%d CONFIG_TDP_GET_FACT_LP_CLIPPING_RATIO resp:%x\n",
+ cpu, resp);
+
+ fact_info->lp_clipping_ratio_license_sse = resp & 0xff;
+ fact_info->lp_clipping_ratio_license_avx2 = (resp >> 8) & 0xff;
+ fact_info->lp_clipping_ratio_license_avx512 = (resp >> 16) & 0xff;
+
+ ret = isst_get_fact_bucket_info(cpu, level, fact_info->bucket_info);
+
+ return ret;
+}
+
+int isst_set_trl(int cpu, unsigned long long trl)
+{
+ int ret;
+
+ if (!trl)
+ trl = 0xFFFFFFFFFFFFFFFFULL;
+
+ ret = isst_send_msr_command(cpu, 0x1AD, 1, &trl);
+ if (ret)
+ return ret;
+
+ return 0;
+}
+
+int isst_set_trl_from_current_tdp(int cpu, unsigned long long trl)
+{
+ unsigned long long msr_trl;
+ int ret;
+
+ if (trl) {
+ msr_trl = trl;
+ } else {
+ struct isst_pkg_ctdp pkg_dev;
+ int trl[8];
+ int i;
+
+ ret = isst_get_ctdp_levels(cpu, &pkg_dev);
+ if (ret)
+ return ret;
+
+ ret = isst_get_get_trl(cpu, pkg_dev.current_level, 0, trl);
+ if (ret)
+ return ret;
+
+ msr_trl = 0;
+ for (i = 0; i < 8; ++i) {
+ unsigned long long _trl = trl[i];
+
+ msr_trl |= (_trl << (i * 8));
+ }
+ }
+ ret = isst_send_msr_command(cpu, 0x1AD, 1, &msr_trl);
+ if (ret)
+ return ret;
+
+ return 0;
+}
+
+/* Return 1 if locked */
+int isst_get_config_tdp_lock_status(int cpu)
+{
+ unsigned long long tdp_control = 0;
+ int ret;
+
+ ret = isst_send_msr_command(cpu, 0x64b, 0, &tdp_control);
+ if (ret)
+ return ret;
+
+ ret = !!(tdp_control & BIT(31));
+
+ return ret;
+}
+
+void isst_get_process_ctdp_complete(int cpu, struct isst_pkg_ctdp *pkg_dev)
+{
+ int i;
+
+ if (!pkg_dev->processed)
+ return;
+
+ for (i = 0; i < pkg_dev->levels; ++i) {
+ struct isst_pkg_ctdp_level_info *ctdp_level;
+
+ ctdp_level = &pkg_dev->ctdp_level[i];
+ if (ctdp_level->pbf_support)
+ free_cpu_set(ctdp_level->pbf_info.core_cpumask);
+ free_cpu_set(ctdp_level->core_cpumask);
+ }
+}
+
+int isst_get_process_ctdp(int cpu, int tdp_level, struct isst_pkg_ctdp *pkg_dev)
+{
+ int i, ret;
+
+ if (pkg_dev->processed)
+ return 0;
+
+ ret = isst_get_ctdp_levels(cpu, pkg_dev);
+ if (ret)
+ return ret;
+
+ debug_printf("cpu: %d ctdp enable:%d current level: %d levels:%d\n",
+ cpu, pkg_dev->enabled, pkg_dev->current_level,
+ pkg_dev->levels);
+
+ for (i = 0; i <= pkg_dev->levels; ++i) {
+ struct isst_pkg_ctdp_level_info *ctdp_level;
+
+ if (tdp_level != 0xff && i != tdp_level)
+ continue;
+
+ debug_printf("cpu:%d Get Information for TDP level:%d\n", cpu,
+ i);
+ ctdp_level = &pkg_dev->ctdp_level[i];
+
+ ctdp_level->processed = 1;
+ ctdp_level->level = i;
+ ctdp_level->control_cpu = cpu;
+ ctdp_level->pkg_id = get_physical_package_id(cpu);
+ ctdp_level->die_id = get_physical_die_id(cpu);
+
+ ret = isst_get_ctdp_control(cpu, i, ctdp_level);
+ if (ret)
+ return ret;
+
+ ret = isst_get_tdp_info(cpu, i, ctdp_level);
+ if (ret)
+ return ret;
+
+ ret = isst_get_pwr_info(cpu, i, ctdp_level);
+ if (ret)
+ return ret;
+
+ ret = isst_get_tjmax_info(cpu, i, ctdp_level);
+ if (ret)
+ return ret;
+
+ ctdp_level->core_cpumask_size =
+ alloc_cpu_set(&ctdp_level->core_cpumask);
+ ret = isst_get_coremask_info(cpu, i, ctdp_level);
+ if (ret)
+ return ret;
+
+ ret = isst_get_get_trl(cpu, i, 0,
+ ctdp_level->trl_sse_active_cores);
+ if (ret)
+ return ret;
+
+ ret = isst_get_get_trl(cpu, i, 1,
+ ctdp_level->trl_avx_active_cores);
+ if (ret)
+ return ret;
+
+ ret = isst_get_get_trl(cpu, i, 2,
+ ctdp_level->trl_avx_512_active_cores);
+ if (ret)
+ return ret;
+
+ if (ctdp_level->pbf_support) {
+ ret = isst_get_pbf_info(cpu, i, &ctdp_level->pbf_info);
+ if (!ret)
+ ctdp_level->pbf_found = 1;
+ }
+
+ if (ctdp_level->fact_support) {
+ ret = isst_get_fact_info(cpu, i,
+ &ctdp_level->fact_info);
+ if (ret)
+ return ret;
+ }
+ }
+
+ pkg_dev->processed = 1;
+
+ return 0;
+}
+
+int isst_pm_qos_config(int cpu, int enable_clos, int priority_type)
+{
+ unsigned int req, resp;
+ int ret;
+
+ ret = isst_send_mbox_command(cpu, CONFIG_CLOS, CLOS_PM_QOS_CONFIG, 0, 0,
+ &resp);
+ if (ret)
+ return ret;
+
+ debug_printf("cpu:%d CLOS_PM_QOS_CONFIG resp:%x\n", cpu, resp);
+
+ req = resp;
+
+ if (enable_clos)
+ req = req | BIT(1);
+ else
+ req = req & ~BIT(1);
+
+ if (priority_type)
+ req = req | BIT(2);
+ else
+ req = req & ~BIT(2);
+
+ ret = isst_send_mbox_command(cpu, CONFIG_CLOS, CLOS_PM_QOS_CONFIG,
+ BIT(MBOX_CMD_WRITE_BIT), req, &resp);
+ if (ret)
+ return ret;
+
+ debug_printf("cpu:%d CLOS_PM_QOS_CONFIG priority type:%d req:%x\n", cpu,
+ priority_type, req);
+
+ return 0;
+}
+
+int isst_pm_get_clos(int cpu, int clos, struct isst_clos_config *clos_config)
+{
+ unsigned int resp;
+ int ret;
+
+ ret = isst_send_mbox_command(cpu, CONFIG_CLOS, CLOS_PM_CLOS, clos, 0,
+ &resp);
+ if (ret)
+ return ret;
+
+ clos_config->pkg_id = get_physical_package_id(cpu);
+ clos_config->die_id = get_physical_die_id(cpu);
+
+ clos_config->epp = resp & 0x0f;
+ clos_config->clos_prop_prio = (resp >> 4) & 0x0f;
+ clos_config->clos_min = (resp >> 8) & 0xff;
+ clos_config->clos_max = (resp >> 16) & 0xff;
+ clos_config->clos_desired = (resp >> 24) & 0xff;
+
+ return 0;
+}
+
+int isst_set_clos(int cpu, int clos, struct isst_clos_config *clos_config)
+{
+ unsigned int req, resp;
+ unsigned int param;
+ int ret;
+
+ req = clos_config->epp & 0x0f;
+ req |= (clos_config->clos_prop_prio & 0x0f) << 4;
+ req |= (clos_config->clos_min & 0xff) << 8;
+ req |= (clos_config->clos_max & 0xff) << 16;
+ req |= (clos_config->clos_desired & 0xff) << 24;
+
+ param = BIT(MBOX_CMD_WRITE_BIT) | clos;
+
+ ret = isst_send_mbox_command(cpu, CONFIG_CLOS, CLOS_PM_CLOS, param, req,
+ &resp);
+ if (ret)
+ return ret;
+
+ debug_printf("cpu:%d CLOS_PM_CLOS param:%x req:%x\n", cpu, param, req);
+
+ return 0;
+}
+
+int isst_clos_get_assoc_status(int cpu, int *clos_id)
+{
+ unsigned int resp;
+ unsigned int param;
+ int core_id, ret;
+
+ core_id = find_phy_core_num(cpu);
+ param = core_id;
+
+ ret = isst_send_mbox_command(cpu, CONFIG_CLOS, CLOS_PQR_ASSOC, param, 0,
+ &resp);
+ if (ret)
+ return ret;
+
+ debug_printf("cpu:%d CLOS_PQR_ASSOC param:%x resp:%x\n", cpu, param,
+ resp);
+ *clos_id = (resp >> 16) & 0x03;
+
+ return 0;
+}
+
+int isst_clos_associate(int cpu, int clos_id)
+{
+ unsigned int req, resp;
+ unsigned int param;
+ int core_id, ret;
+
+ req = (clos_id & 0x03) << 16;
+ core_id = find_phy_core_num(cpu);
+ param = BIT(MBOX_CMD_WRITE_BIT) | core_id;
+
+ ret = isst_send_mbox_command(cpu, CONFIG_CLOS, CLOS_PQR_ASSOC, param,
+ req, &resp);
+ if (ret)
+ return ret;
+
+ debug_printf("cpu:%d CLOS_PQR_ASSOC param:%x req:%x\n", cpu, param,
+ req);
+
+ return 0;
+}
diff --git a/tools/power/x86/intel-speed-select/isst-display.c b/tools/power/x86/intel-speed-select/isst-display.c
new file mode 100644
index 000000000000..f368b8323742
--- /dev/null
+++ b/tools/power/x86/intel-speed-select/isst-display.c
@@ -0,0 +1,479 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Intel dynamic_speed_select -- Enumerate and control features
+ * Copyright (c) 2019 Intel Corporation.
+ */
+
+#include "isst.h"
+
+#define DISP_FREQ_MULTIPLIER 100000
+
+static void printcpumask(int str_len, char *str, int mask_size,
+ cpu_set_t *cpu_mask)
+{
+ int i, max_cpus = get_topo_max_cpus();
+ unsigned int *mask;
+ int size, index, curr_index;
+
+ size = max_cpus / (sizeof(unsigned int) * 8);
+ if (max_cpus % (sizeof(unsigned int) * 8))
+ size++;
+
+ mask = calloc(size, sizeof(unsigned int));
+ if (!mask)
+ return;
+
+ for (i = 0; i < max_cpus; ++i) {
+ int mask_index, bit_index;
+
+ if (!CPU_ISSET_S(i, mask_size, cpu_mask))
+ continue;
+
+ mask_index = i / (sizeof(unsigned int) * 8);
+ bit_index = i % (sizeof(unsigned int) * 8);
+ mask[mask_index] |= BIT(bit_index);
+ }
+
+ curr_index = 0;
+ for (i = size - 1; i >= 0; --i) {
+ index = snprintf(&str[curr_index], str_len - curr_index, "%08x",
+ mask[i]);
+ curr_index += index;
+ if (i) {
+ strncat(&str[curr_index], ",", str_len - curr_index);
+ curr_index++;
+ }
+ }
+
+ free(mask);
+}
+
+static void format_and_print_txt(FILE *outf, int level, char *header,
+ char *value)
+{
+ char *spaces = " ";
+ static char delimiters[256];
+ int i, j = 0;
+
+ if (!level)
+ return;
+
+ if (level == 1) {
+ strcpy(delimiters, " ");
+ } else {
+ for (i = 0; i < level - 1; ++i)
+ j += snprintf(&delimiters[j], sizeof(delimiters) - j,
+ "%s", spaces);
+ }
+
+ if (header && value) {
+ fprintf(outf, "%s", delimiters);
+ fprintf(outf, "%s:%s\n", header, value);
+ } else if (header) {
+ fprintf(outf, "%s", delimiters);
+ fprintf(outf, "%s\n", header);
+ }
+}
+
+static int last_level;
+static void format_and_print(FILE *outf, int level, char *header, char *value)
+{
+ char *spaces = " ";
+ static char delimiters[256];
+ int i;
+
+ if (!out_format_is_json()) {
+ format_and_print_txt(outf, level, header, value);
+ return;
+ }
+
+ if (level == 0) {
+ if (header)
+ fprintf(outf, "{");
+ else
+ fprintf(outf, "\n}\n");
+
+ } else {
+ int j = 0;
+
+ for (i = 0; i < level; ++i)
+ j += snprintf(&delimiters[j], sizeof(delimiters) - j,
+ "%s", spaces);
+
+ if (last_level == level)
+ fprintf(outf, ",\n");
+
+ if (value) {
+ if (last_level != level)
+ fprintf(outf, "\n");
+
+ fprintf(outf, "%s\"%s\": ", delimiters, header);
+ fprintf(outf, "\"%s\"", value);
+ } else {
+ for (i = last_level - 1; i >= level; --i) {
+ int k = 0;
+
+ for (j = i; j > 0; --j)
+ k += snprintf(&delimiters[k],
+ sizeof(delimiters) - k,
+ "%s", spaces);
+ if (i == level && header)
+ fprintf(outf, "\n%s},", delimiters);
+ else
+ fprintf(outf, "\n%s}", delimiters);
+ }
+ if (abs(last_level - level) < 3)
+ fprintf(outf, "\n");
+ if (header)
+ fprintf(outf, "%s\"%s\": {", delimiters,
+ header);
+ }
+ }
+
+ last_level = level;
+}
+
+static void print_packag_info(int cpu, FILE *outf)
+{
+ char header[256];
+
+ snprintf(header, sizeof(header), "package-%d",
+ get_physical_package_id(cpu));
+ format_and_print(outf, 1, header, NULL);
+ snprintf(header, sizeof(header), "die-%d", get_physical_die_id(cpu));
+ format_and_print(outf, 2, header, NULL);
+ snprintf(header, sizeof(header), "cpu-%d", cpu);
+ format_and_print(outf, 3, header, NULL);
+}
+
+static void _isst_pbf_display_information(int cpu, FILE *outf, int level,
+ struct isst_pbf_info *pbf_info,
+ int disp_level)
+{
+ char header[256];
+ char value[256];
+
+ snprintf(header, sizeof(header), "speed-select-base-freq");
+ format_and_print(outf, disp_level, header, NULL);
+
+ snprintf(header, sizeof(header), "high-priority-base-frequency(KHz)");
+ snprintf(value, sizeof(value), "%d",
+ pbf_info->p1_high * DISP_FREQ_MULTIPLIER);
+ format_and_print(outf, disp_level + 1, header, value);
+
+ snprintf(header, sizeof(header), "high-priority-cpu-mask");
+ printcpumask(sizeof(value), value, pbf_info->core_cpumask_size,
+ pbf_info->core_cpumask);
+ format_and_print(outf, disp_level + 1, header, value);
+
+ snprintf(header, sizeof(header), "low-priority-base-frequency(KHz)");
+ snprintf(value, sizeof(value), "%d",
+ pbf_info->p1_low * DISP_FREQ_MULTIPLIER);
+ format_and_print(outf, disp_level + 1, header, value);
+
+ snprintf(header, sizeof(header), "tjunction-temperature(C)");
+ snprintf(value, sizeof(value), "%d", pbf_info->t_prochot);
+ format_and_print(outf, disp_level + 1, header, value);
+
+ snprintf(header, sizeof(header), "thermal-design-power(W)");
+ snprintf(value, sizeof(value), "%d", pbf_info->tdp);
+ format_and_print(outf, disp_level + 1, header, value);
+}
+
+static void _isst_fact_display_information(int cpu, FILE *outf, int level,
+ int fact_bucket, int fact_avx,
+ struct isst_fact_info *fact_info,
+ int base_level)
+{
+ struct isst_fact_bucket_info *bucket_info = fact_info->bucket_info;
+ char header[256];
+ char value[256];
+ int j;
+
+ snprintf(header, sizeof(header), "speed-select-turbo-freq");
+ format_and_print(outf, base_level, header, NULL);
+ for (j = 0; j < ISST_FACT_MAX_BUCKETS; ++j) {
+ if (fact_bucket != 0xff && fact_bucket != j)
+ continue;
+
+ if (!bucket_info[j].high_priority_cores_count)
+ break;
+
+ snprintf(header, sizeof(header), "bucket-%d", j);
+ format_and_print(outf, base_level + 1, header, NULL);
+
+ snprintf(header, sizeof(header), "high-priority-cores-count");
+ snprintf(value, sizeof(value), "%d",
+ bucket_info[j].high_priority_cores_count);
+ format_and_print(outf, base_level + 2, header, value);
+
+ if (fact_avx & 0x01) {
+ snprintf(header, sizeof(header),
+ "high-priority-max-frequency(KHz)");
+ snprintf(value, sizeof(value), "%d",
+ bucket_info[j].sse_trl * DISP_FREQ_MULTIPLIER);
+ format_and_print(outf, base_level + 2, header, value);
+ }
+
+ if (fact_avx & 0x02) {
+ snprintf(header, sizeof(header),
+ "high-priority-max-avx2-frequency(KHz)");
+ snprintf(value, sizeof(value), "%d",
+ bucket_info[j].avx_trl * DISP_FREQ_MULTIPLIER);
+ format_and_print(outf, base_level + 2, header, value);
+ }
+
+ if (fact_avx & 0x04) {
+ snprintf(header, sizeof(header),
+ "high-priority-max-avx512-frequency(KHz)");
+ snprintf(value, sizeof(value), "%d",
+ bucket_info[j].avx512_trl *
+ DISP_FREQ_MULTIPLIER);
+ format_and_print(outf, base_level + 2, header, value);
+ }
+ }
+ snprintf(header, sizeof(header),
+ "speed-select-turbo-freq-clip-frequencies");
+ format_and_print(outf, base_level + 1, header, NULL);
+ snprintf(header, sizeof(header), "low-priority-max-frequency(KHz)");
+ snprintf(value, sizeof(value), "%d",
+ fact_info->lp_clipping_ratio_license_sse *
+ DISP_FREQ_MULTIPLIER);
+ format_and_print(outf, base_level + 2, header, value);
+ snprintf(header, sizeof(header),
+ "low-priority-max-avx2-frequency(KHz)");
+ snprintf(value, sizeof(value), "%d",
+ fact_info->lp_clipping_ratio_license_avx2 *
+ DISP_FREQ_MULTIPLIER);
+ format_and_print(outf, base_level + 2, header, value);
+ snprintf(header, sizeof(header),
+ "low-priority-max-avx512-frequency(KHz)");
+ snprintf(value, sizeof(value), "%d",
+ fact_info->lp_clipping_ratio_license_avx512 *
+ DISP_FREQ_MULTIPLIER);
+ format_and_print(outf, base_level + 2, header, value);
+}
+
+void isst_ctdp_display_information(int cpu, FILE *outf, int tdp_level,
+ struct isst_pkg_ctdp *pkg_dev)
+{
+ char header[256];
+ char value[256];
+ int i, base_level = 1;
+
+ print_packag_info(cpu, outf);
+
+ for (i = 0; i <= pkg_dev->levels; ++i) {
+ struct isst_pkg_ctdp_level_info *ctdp_level;
+ int j;
+
+ ctdp_level = &pkg_dev->ctdp_level[i];
+ if (!ctdp_level->processed)
+ continue;
+
+ snprintf(header, sizeof(header), "perf-profile-level-%d",
+ ctdp_level->level);
+ format_and_print(outf, base_level + 3, header, NULL);
+
+ snprintf(header, sizeof(header), "cpu-count");
+ j = get_cpu_count(get_physical_die_id(cpu),
+ get_physical_die_id(cpu));
+ snprintf(value, sizeof(value), "%d", j);
+ format_and_print(outf, base_level + 4, header, value);
+
+ snprintf(header, sizeof(header), "enable-cpu-mask");
+ printcpumask(sizeof(value), value,
+ ctdp_level->core_cpumask_size,
+ ctdp_level->core_cpumask);
+ format_and_print(outf, base_level + 4, header, value);
+
+ snprintf(header, sizeof(header), "thermal-design-power-ratio");
+ snprintf(value, sizeof(value), "%d", ctdp_level->tdp_ratio);
+ format_and_print(outf, base_level + 4, header, value);
+
+ snprintf(header, sizeof(header), "base-frequency(KHz)");
+ snprintf(value, sizeof(value), "%d",
+ ctdp_level->tdp_ratio * DISP_FREQ_MULTIPLIER);
+ format_and_print(outf, base_level + 4, header, value);
+
+ snprintf(header, sizeof(header),
+ "speed-select-turbo-freq-support");
+ snprintf(value, sizeof(value), "%d", ctdp_level->fact_support);
+ format_and_print(outf, base_level + 4, header, value);
+
+ snprintf(header, sizeof(header),
+ "speed-select-base-freq-support");
+ snprintf(value, sizeof(value), "%d", ctdp_level->pbf_support);
+ format_and_print(outf, base_level + 4, header, value);
+
+ snprintf(header, sizeof(header),
+ "speed-select-base-freq-enabled");
+ snprintf(value, sizeof(value), "%d", ctdp_level->pbf_enabled);
+ format_and_print(outf, base_level + 4, header, value);
+
+ snprintf(header, sizeof(header),
+ "speed-select-turbo-freq-enabled");
+ snprintf(value, sizeof(value), "%d", ctdp_level->fact_enabled);
+ format_and_print(outf, base_level + 4, header, value);
+
+ snprintf(header, sizeof(header), "thermal-design-power(W)");
+ snprintf(value, sizeof(value), "%d", ctdp_level->pkg_tdp);
+ format_and_print(outf, base_level + 4, header, value);
+
+ snprintf(header, sizeof(header), "tjunction-max(C)");
+ snprintf(value, sizeof(value), "%d", ctdp_level->t_proc_hot);
+ format_and_print(outf, base_level + 4, header, value);
+
+ snprintf(header, sizeof(header), "turbo-ratio-limits-sse");
+ format_and_print(outf, base_level + 4, header, NULL);
+ for (j = 0; j < 8; ++j) {
+ snprintf(header, sizeof(header), "bucket-%d", j);
+ format_and_print(outf, base_level + 5, header, NULL);
+
+ snprintf(header, sizeof(header), "core-count");
+ snprintf(value, sizeof(value), "%d", j);
+ format_and_print(outf, base_level + 6, header, value);
+
+ snprintf(header, sizeof(header), "turbo-ratio");
+ snprintf(value, sizeof(value), "%d",
+ ctdp_level->trl_sse_active_cores[j]);
+ format_and_print(outf, base_level + 6, header, value);
+ }
+ snprintf(header, sizeof(header), "turbo-ratio-limits-avx");
+ format_and_print(outf, base_level + 4, header, NULL);
+ for (j = 0; j < 8; ++j) {
+ snprintf(header, sizeof(header), "bucket-%d", j);
+ format_and_print(outf, base_level + 5, header, NULL);
+
+ snprintf(header, sizeof(header), "core-count");
+ snprintf(value, sizeof(value), "%d", j);
+ format_and_print(outf, base_level + 6, header, value);
+
+ snprintf(header, sizeof(header), "turbo-ratio");
+ snprintf(value, sizeof(value), "%d",
+ ctdp_level->trl_avx_active_cores[j]);
+ format_and_print(outf, base_level + 6, header, value);
+ }
+
+ snprintf(header, sizeof(header), "turbo-ratio-limits-avx512");
+ format_and_print(outf, base_level + 4, header, NULL);
+ for (j = 0; j < 8; ++j) {
+ snprintf(header, sizeof(header), "bucket-%d", j);
+ format_and_print(outf, base_level + 5, header, NULL);
+
+ snprintf(header, sizeof(header), "core-count");
+ snprintf(value, sizeof(value), "%d", j);
+ format_and_print(outf, base_level + 6, header, value);
+
+ snprintf(header, sizeof(header), "turbo-ratio");
+ snprintf(value, sizeof(value), "%d",
+ ctdp_level->trl_avx_512_active_cores[j]);
+ format_and_print(outf, base_level + 6, header, value);
+ }
+ if (ctdp_level->pbf_support)
+ _isst_pbf_display_information(cpu, outf, i,
+ &ctdp_level->pbf_info,
+ base_level + 4);
+ if (ctdp_level->fact_support)
+ _isst_fact_display_information(cpu, outf, i, 0xff, 0xff,
+ &ctdp_level->fact_info,
+ base_level + 4);
+ }
+
+ format_and_print(outf, 1, NULL, NULL);
+}
+
+void isst_ctdp_display_information_start(FILE *outf)
+{
+ last_level = 0;
+ format_and_print(outf, 0, "start", NULL);
+}
+
+void isst_ctdp_display_information_end(FILE *outf)
+{
+ format_and_print(outf, 0, NULL, NULL);
+}
+
+void isst_pbf_display_information(int cpu, FILE *outf, int level,
+ struct isst_pbf_info *pbf_info)
+{
+ print_packag_info(cpu, outf);
+ _isst_pbf_display_information(cpu, outf, level, pbf_info, 4);
+ format_and_print(outf, 1, NULL, NULL);
+}
+
+void isst_fact_display_information(int cpu, FILE *outf, int level,
+ int fact_bucket, int fact_avx,
+ struct isst_fact_info *fact_info)
+{
+ print_packag_info(cpu, outf);
+ _isst_fact_display_information(cpu, outf, level, fact_bucket, fact_avx,
+ fact_info, 4);
+ format_and_print(outf, 1, NULL, NULL);
+}
+
+void isst_clos_display_information(int cpu, FILE *outf, int clos,
+ struct isst_clos_config *clos_config)
+{
+ char header[256];
+ char value[256];
+
+ snprintf(header, sizeof(header), "package-%d",
+ get_physical_package_id(cpu));
+ format_and_print(outf, 1, header, NULL);
+ snprintf(header, sizeof(header), "die-%d", get_physical_die_id(cpu));
+ format_and_print(outf, 2, header, NULL);
+ snprintf(header, sizeof(header), "cpu-%d", cpu);
+ format_and_print(outf, 3, header, NULL);
+
+ snprintf(header, sizeof(header), "core-power");
+ format_and_print(outf, 4, header, NULL);
+
+ snprintf(header, sizeof(header), "clos");
+ snprintf(value, sizeof(value), "%d", clos);
+ format_and_print(outf, 5, header, value);
+
+ snprintf(header, sizeof(header), "epp");
+ snprintf(value, sizeof(value), "%d", clos_config->epp);
+ format_and_print(outf, 5, header, value);
+
+ snprintf(header, sizeof(header), "clos-proportional-priority");
+ snprintf(value, sizeof(value), "%d", clos_config->clos_prop_prio);
+ format_and_print(outf, 5, header, value);
+
+ snprintf(header, sizeof(header), "clos-min");
+ snprintf(value, sizeof(value), "%d", clos_config->clos_min);
+ format_and_print(outf, 5, header, value);
+
+ snprintf(header, sizeof(header), "clos-max");
+ snprintf(value, sizeof(value), "%d", clos_config->clos_max);
+ format_and_print(outf, 5, header, value);
+
+ snprintf(header, sizeof(header), "clos-desired");
+ snprintf(value, sizeof(value), "%d", clos_config->clos_desired);
+ format_and_print(outf, 5, header, value);
+
+ format_and_print(outf, 1, NULL, NULL);
+}
+
+void isst_display_result(int cpu, FILE *outf, char *feature, char *cmd,
+ int result)
+{
+ char header[256];
+ char value[256];
+
+ snprintf(header, sizeof(header), "package-%d",
+ get_physical_package_id(cpu));
+ format_and_print(outf, 1, header, NULL);
+ snprintf(header, sizeof(header), "die-%d", get_physical_die_id(cpu));
+ format_and_print(outf, 2, header, NULL);
+ snprintf(header, sizeof(header), "cpu-%d", cpu);
+ format_and_print(outf, 3, header, NULL);
+ snprintf(header, sizeof(header), "%s", feature);
+ format_and_print(outf, 4, header, NULL);
+ snprintf(header, sizeof(header), "%s", cmd);
+ snprintf(value, sizeof(value), "%d", result);
+ format_and_print(outf, 5, header, value);
+
+ format_and_print(outf, 1, NULL, NULL);
+}
diff --git a/tools/power/x86/intel-speed-select/isst.h b/tools/power/x86/intel-speed-select/isst.h
new file mode 100644
index 000000000000..221881761609
--- /dev/null
+++ b/tools/power/x86/intel-speed-select/isst.h
@@ -0,0 +1,231 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+/*
+ * Intel Speed Select -- Enumerate and control features
+ * Copyright (c) 2019 Intel Corporation.
+ */
+
+#ifndef _ISST_H_
+#define _ISST_H_
+
+#include <stdio.h>
+#include <unistd.h>
+#include <sys/types.h>
+#include <sched.h>
+#include <sys/stat.h>
+#include <sys/resource.h>
+#include <getopt.h>
+#include <err.h>
+#include <fcntl.h>
+#include <signal.h>
+#include <sys/time.h>
+#include <limits.h>
+#include <stdlib.h>
+#include <string.h>
+#include <cpuid.h>
+#include <dirent.h>
+#include <errno.h>
+
+#include <stdarg.h>
+#include <sys/ioctl.h>
+
+#define BIT(x) (1 << (x))
+#define GENMASK(h, l) (((~0UL) << (l)) & (~0UL >> (sizeof(long) * 8 - 1 - (h))))
+#define GENMASK_ULL(h, l) \
+ (((~0ULL) << (l)) & (~0ULL >> (sizeof(long long) * 8 - 1 - (h))))
+
+#define CONFIG_TDP 0x7f
+#define CONFIG_TDP_GET_LEVELS_INFO 0x00
+#define CONFIG_TDP_GET_TDP_CONTROL 0x01
+#define CONFIG_TDP_SET_TDP_CONTROL 0x02
+#define CONFIG_TDP_GET_TDP_INFO 0x03
+#define CONFIG_TDP_GET_PWR_INFO 0x04
+#define CONFIG_TDP_GET_TJMAX_INFO 0x05
+#define CONFIG_TDP_GET_CORE_MASK 0x06
+#define CONFIG_TDP_GET_TURBO_LIMIT_RATIOS 0x07
+#define CONFIG_TDP_SET_LEVEL 0x08
+#define CONFIG_TDP_GET_UNCORE_P0_P1_INFO 0X09
+#define CONFIG_TDP_GET_P1_INFO 0x0a
+#define CONFIG_TDP_GET_MEM_FREQ 0x0b
+
+#define CONFIG_TDP_GET_FACT_HP_TURBO_LIMIT_NUMCORES 0x10
+#define CONFIG_TDP_GET_FACT_HP_TURBO_LIMIT_RATIOS 0x11
+#define CONFIG_TDP_GET_FACT_LP_CLIPPING_RATIO 0x12
+
+#define CONFIG_TDP_PBF_GET_CORE_MASK_INFO 0x20
+#define CONFIG_TDP_PBF_GET_P1HI_P1LO_INFO 0x21
+#define CONFIG_TDP_PBF_GET_TJ_MAX_INFO 0x22
+#define CONFIG_TDP_PBF_GET_TDP_INFO 0X23
+
+#define CONFIG_CLOS 0xd0
+#define CLOS_PQR_ASSOC 0x00
+#define CLOS_PM_CLOS 0x01
+#define CLOS_PM_QOS_CONFIG 0x02
+#define CLOS_STATUS 0x03
+
+#define MBOX_CMD_WRITE_BIT 0x08
+
+#define PM_QOS_INFO_OFFSET 0x00
+#define PM_QOS_CONFIG_OFFSET 0x04
+#define PM_CLOS_OFFSET 0x08
+#define PQR_ASSOC_OFFSET 0x20
+
+struct isst_clos_config {
+ int pkg_id;
+ int die_id;
+ unsigned char epp;
+ unsigned char clos_prop_prio;
+ unsigned char clos_min;
+ unsigned char clos_max;
+ unsigned char clos_desired;
+};
+
+struct isst_fact_bucket_info {
+ int high_priority_cores_count;
+ int sse_trl;
+ int avx_trl;
+ int avx512_trl;
+};
+
+struct isst_pbf_info {
+ int pbf_acticated;
+ int pbf_available;
+ size_t core_cpumask_size;
+ cpu_set_t *core_cpumask;
+ int p1_high;
+ int p1_low;
+ int t_control;
+ int t_prochot;
+ int tdp;
+};
+
+#define ISST_TRL_MAX_ACTIVE_CORES 8
+#define ISST_FACT_MAX_BUCKETS 8
+struct isst_fact_info {
+ int lp_clipping_ratio_license_sse;
+ int lp_clipping_ratio_license_avx2;
+ int lp_clipping_ratio_license_avx512;
+ struct isst_fact_bucket_info bucket_info[ISST_FACT_MAX_BUCKETS];
+};
+
+struct isst_pkg_ctdp_level_info {
+ int processed;
+ int control_cpu;
+ int pkg_id;
+ int die_id;
+ int level;
+ int fact_support;
+ int pbf_support;
+ int fact_enabled;
+ int pbf_enabled;
+ int tdp_ratio;
+ int active;
+ int tdp_control;
+ int pkg_tdp;
+ int pkg_min_power;
+ int pkg_max_power;
+ int fact;
+ int t_proc_hot;
+ int uncore_p0;
+ int uncore_p1;
+ int sse_p1;
+ int avx2_p1;
+ int avx512_p1;
+ int mem_freq;
+ size_t core_cpumask_size;
+ cpu_set_t *core_cpumask;
+ int cpu_count;
+ int trl_sse_active_cores[ISST_TRL_MAX_ACTIVE_CORES];
+ int trl_avx_active_cores[ISST_TRL_MAX_ACTIVE_CORES];
+ int trl_avx_512_active_cores[ISST_TRL_MAX_ACTIVE_CORES];
+ int kobj_bucket_index;
+ int active_bucket;
+ int fact_max_index;
+ int fact_max_config;
+ int pbf_found;
+ int pbf_active;
+ struct isst_pbf_info pbf_info;
+ struct isst_fact_info fact_info;
+};
+
+#define ISST_MAX_TDP_LEVELS (4 + 1) /* +1 for base config */
+struct isst_pkg_ctdp {
+ int locked;
+ int version;
+ int processed;
+ int levels;
+ int current_level;
+ int enabled;
+ struct isst_pkg_ctdp_level_info ctdp_level[ISST_MAX_TDP_LEVELS];
+};
+
+extern int get_topo_max_cpus(void);
+extern int get_cpu_count(int pkg_id, int die_id);
+
+/* Common interfaces */
+extern void debug_printf(const char *format, ...);
+extern int out_format_is_json(void);
+extern int get_physical_package_id(int cpu);
+extern int get_physical_die_id(int cpu);
+extern size_t alloc_cpu_set(cpu_set_t **cpu_set);
+extern void free_cpu_set(cpu_set_t *cpu_set);
+extern int find_logical_cpu(int pkg_id, int die_id, int phy_cpu);
+extern int find_phy_cpu_num(int logical_cpu);
+extern int find_phy_core_num(int logical_cpu);
+extern void set_cpu_mask_from_punit_coremask(int cpu,
+ unsigned long long core_mask,
+ size_t core_cpumask_size,
+ cpu_set_t *core_cpumask,
+ int *cpu_cnt);
+
+extern int isst_send_mbox_command(unsigned int cpu, unsigned char command,
+ unsigned char sub_command,
+ unsigned int write,
+ unsigned int req_data, unsigned int *resp);
+
+extern int isst_send_msr_command(unsigned int cpu, unsigned int command,
+ int write, unsigned long long *req_resp);
+
+extern int isst_get_ctdp_levels(int cpu, struct isst_pkg_ctdp *pkg_dev);
+extern int isst_get_process_ctdp(int cpu, int tdp_level,
+ struct isst_pkg_ctdp *pkg_dev);
+extern void isst_get_process_ctdp_complete(int cpu,
+ struct isst_pkg_ctdp *pkg_dev);
+extern void isst_ctdp_display_information(int cpu, FILE *outf, int tdp_level,
+ struct isst_pkg_ctdp *pkg_dev);
+extern void isst_ctdp_display_information_start(FILE *outf);
+extern void isst_ctdp_display_information_end(FILE *outf);
+extern void isst_pbf_display_information(int cpu, FILE *outf, int level,
+ struct isst_pbf_info *info);
+extern int isst_set_tdp_level(int cpu, int tdp_level);
+extern int isst_set_tdp_level_msr(int cpu, int tdp_level);
+extern int isst_set_pbf_fact_status(int cpu, int pbf, int enable);
+extern int isst_get_pbf_info(int cpu, int level,
+ struct isst_pbf_info *pbf_info);
+extern void isst_get_pbf_info_complete(struct isst_pbf_info *pbf_info);
+extern int isst_get_fact_info(int cpu, int level,
+ struct isst_fact_info *fact_info);
+extern int isst_get_fact_bucket_info(int cpu, int level,
+ struct isst_fact_bucket_info *bucket_info);
+extern void isst_fact_display_information(int cpu, FILE *outf, int level,
+ int fact_bucket, int fact_avx,
+ struct isst_fact_info *fact_info);
+extern int isst_set_trl(int cpu, unsigned long long trl);
+extern int isst_set_trl_from_current_tdp(int cpu, unsigned long long trl);
+extern int isst_get_config_tdp_lock_status(int cpu);
+
+extern int isst_pm_qos_config(int cpu, int enable_clos, int priority_type);
+extern int isst_pm_get_clos(int cpu, int clos,
+ struct isst_clos_config *clos_config);
+extern int isst_set_clos(int cpu, int clos,
+ struct isst_clos_config *clos_config);
+extern int isst_clos_associate(int cpu, int clos);
+extern int isst_clos_get_assoc_status(int cpu, int *clos_id);
+extern void isst_clos_display_information(int cpu, FILE *outf, int clos,
+ struct isst_clos_config *clos_config);
+
+extern int isst_read_reg(unsigned short reg, unsigned int *val);
+extern int isst_write_reg(int reg, unsigned int val);
+
+extern void isst_display_result(int cpu, FILE *outf, char *feature, char *cmd,
+ int result);
+#endif
--
2.17.2
^ permalink raw reply related
* Re: [linux-kernel-mentees] [PATCH v1] Doc : fs : convert xfs.txt to ReST
From: Sheriff Esseson @ 2019-06-30 16:50 UTC (permalink / raw)
To: skhan
Cc: linux-kernel-mentees, darrick.wong, linux-xfs, corbet, linux-doc,
linux-kernel
On Sat, Jun 29, 2019 at 09:57:59PM +0100, Sheriff Esseson wrote:
> Signed-off-by: Sheriff Esseson <sheriffesseson@gmail.com>
> ---
>
> In v3:
> Update MAINTAINERS. Fix Indentation/long line issues. Insert Sphinx tag.
>
> --
> 2.22.0
>
Signed-off-by: Sheriff Esseson <sheriffesseson@gmail.com>
---
In v4:
dax.txt :
fix broken reference to xfs.rst
Documentation/filesystems/dax.txt | 2 +-
Documentation/filesystems/index.rst | 5 +-
Documentation/filesystems/xfs.rst | 468 +++++++++++++++++++++++++++
Documentation/filesystems/xfs.txt | 470 ----------------------------
MAINTAINERS | 2 +-
5 files changed, 473 insertions(+), 474 deletions(-)
create mode 100644 Documentation/filesystems/xfs.rst
delete mode 100644 Documentation/filesystems/xfs.txt
diff --git a/Documentation/filesystems/dax.txt b/Documentation/filesystems/dax.txt
index 6d2c0d340..c333285b8 100644
--- a/Documentation/filesystems/dax.txt
+++ b/Documentation/filesystems/dax.txt
@@ -76,7 +76,7 @@ exposure of uninitialized data through mmap.
These filesystems may be used for inspiration:
- ext2: see Documentation/filesystems/ext2.txt
- ext4: see Documentation/filesystems/ext4/
-- xfs: see Documentation/filesystems/xfs.txt
+- xfs: see Documentation/filesystems/xfs.rst
Handling Media Errors
diff --git a/Documentation/filesystems/index.rst b/Documentation/filesystems/index.rst
index 1131c34d7..a4cf5fca4 100644
--- a/Documentation/filesystems/index.rst
+++ b/Documentation/filesystems/index.rst
@@ -16,7 +16,7 @@ algorithms work.
.. toctree::
:maxdepth: 2
- path-lookup.rst
+ path-lookup
api-summary
splice
@@ -40,4 +40,5 @@ Documentation for individual filesystem types can be found here.
.. toctree::
:maxdepth: 2
- binderfs.rst
+ binderfs
+ xfs
diff --git a/Documentation/filesystems/xfs.rst b/Documentation/filesystems/xfs.rst
new file mode 100644
index 000000000..d36ef042c
--- /dev/null
+++ b/Documentation/filesystems/xfs.rst
@@ -0,0 +1,468 @@
+.. SPDX-License-Identifier: GPL-2.0
+======================
+The SGI XFS Filesystem
+======================
+
+XFS is a high performance journaling filesystem which originated
+on the SGI IRIX platform. It is completely multi-threaded, can
+support large files and large filesystems, extended attributes,
+variable block sizes, is extent based, and makes extensive use of
+Btrees (directories, extents, free space) to aid both performance
+and scalability.
+
+Refer to the documentation at https://xfs.wiki.kernel.org/
+for further details. This implementation is on-disk compatible
+with the IRIX version of XFS.
+
+
+Mount Options
+=============
+
+When mounting an XFS filesystem, the following options are accepted. For
+boolean mount options, the names with the "(*)" prefix is the default behaviour.
+For example, take a behaviour enabled by default to be a one (1) or, a zero (0)
+otherwise, ``(*)[no]default`` would be 0 while ``[no](*)default`` , a 1.
+
+ allocsize=<size>
+ Sets the buffered I/O end-of-file preallocation size when doing delayed
+ allocation writeout (default size is 64KiB). Valid values for this
+ option are page size (typically 4KiB) through to 1GiB, inclusive, in
+ power-of-2 increments.
+
+ The default behaviour is for dynamic end-of-file preallocation size,
+ which uses a set of heuristics to optimise the preallocation size based
+ on the current allocation patterns within the file and the access
+ patterns to the file. Specifying a fixed allocsize value turns off the
+ dynamic behaviour.
+
+ [no]attr2
+ The options enable/disable an "opportunistic" improvement to be made in
+ the way inline extended attributes are stored on-disk. When the new
+ form is used for the first time when ``attr2`` is selected (either when
+ setting or removing extended attributes) the on-disk superblock feature
+ bit field will be updated to reflect this format being in use.
+
+ The default behaviour is determined by the on-disk feature bit
+ indicating that ``attr2`` behaviour is active. If either mount option is
+ set, then that becomes the new default used by the filesystem. However
+ on CRC enabled filesystems, the ``attr2`` format is always used , and so
+ will reject the ``noattr2`` mount option if it is set.
+
+ (*)[no]discard
+ Enable/disable the issuing of commands to let the block device reclaim
+ space freed by the filesystem. This is useful for SSD devices, thinly
+ provisioned LUNs and virtual machine images, but may have a performance
+ impact.
+
+ Note: It is currently recommended that you use the ``fstrim``
+ application to discard unused blocks rather than the ``discard`` mount
+ option because the performance impact of this option is quite severe.
+
+ grpid/bsdgroups
+ nogrpid/(*)sysvgroups
+ These options define what group ID a newly created file gets. When
+ ``grpid`` is set, it takes the group ID of the directory in which it is
+ created; otherwise it takes the ``fsgid`` of the current process, unless
+ the directory has the ``setgid`` bit set, in which case it takes the
+ ``gid`` from the parent directory, and also gets the ``setgid`` bit set
+ if it is a directory itself.
+
+ filestreams
+ Make the data allocator use the filestreams allocation mode across the
+ entire filesystem rather than just on directories configured to use it.
+
+ (*)[no]ikeep
+ When ``ikeep`` is specified, XFS does not delete empty inode clusters
+ and keeps them around on disk. When ``noikeep`` is specified, empty
+ inode clusters are returned to the free space pool.
+
+ inode32 | (*)inode64
+ When ``inode32`` is specified, it indicates that XFS limits inode
+ creation to locations which will not result in inode numbers with more
+ than 32 bits of significance.
+
+ When ``inode64`` is specified, it indicates that XFS is allowed to
+ create inodes at any location in the filesystem, including those which
+ will result in inode numbers occupying more than 32 bits of
+ significance.
+
+ ``inode32`` is provided for backwards compatibility with older systems
+ and applications, since 64 bits inode numbers might cause problems for
+ some applications that cannot handle large inode numbers. If
+ applications are in use which do not handle inode numbers bigger than 32
+ bits, the ``inode32`` option should be specified.
+
+
+ (*)[no]largeio
+ If ``nolargeio`` is specified, the optimal I/O reported in st_blksize by
+ **stat(2)** will be as small as possible to allow user applications to
+ avoid inefficient read/modify/write I/O. This is typically the page
+ size of the machine, as this is the granularity of the page cache.
+
+ If ``largeio`` is specified, a filesystem that was created with a
+ ``swidth`` specified will return the ``swidth`` value (in bytes) in
+ st_blksize. If the filesystem does not have a ``swidth`` specified but
+ does specify an ``allocsize`` then ``allocsize`` (in bytes) will be
+ returned instead. Otherwise the behaviour is the same as if
+ ``nolargeio`` was specified.
+
+ logbufs=<value>
+ Set the number of in-memory log buffers to ``value``. Valid numbers
+ range from 2-8 inclusive.
+
+ The default value is 8 buffers.
+
+ If the memory cost of 8 log buffers is too high on small systems, then
+ it may be reduced at some cost to performance on metadata intensive
+ workloads. The ``logbsize`` option below controls the size of each
+ buffer and so is also relevant to this case.
+
+ logbsize=<value>
+ Set the size of each in-memory log buffer to ``value``. The size may be
+ specified in bytes, or in kilobytes with a "k" suffix. Valid sizes for
+ version 1 and version 2 logs are 16384 (16k) and 32768 (32k). Valid
+ sizes for version 2 logs also include 65536 (64k), 131072 (128k) and
+ 262144 (256k). The ``logbsize`` must be an integer multiple of the
+ "log stripe unit" configured at mkfs time.
+
+ The default value for for version 1 logs is 32768, while the default
+ value for version 2 logs is ``MAX(32768, log_sunit)``.
+
+ logdev=<device>
+ Use ``device`` as an external log (metadata journal). In an XFS
+ filesystem, the log device can be separate from the data device or
+ contained within it.
+
+ rtdev=<device>
+ An XFS filesystem has up to three parts: a data section, a log section,
+ and a real-time section. The real-time section is optional. If
+ enabled, ``rtdev`` sets ``device`` to be used as an external real-time
+ section, similar to ``logdev`` above.
+
+ noalign
+ Data allocations will not be aligned at stripe unit boundaries. This is
+ only relevant to filesystems created with non-zero data alignment
+ parameters (sunit, swidth) by mkfs.
+
+ norecovery
+ The filesystem will be mounted without running log recovery. If the
+ filesystem was not cleanly unmounted, it is likely to be inconsistent
+ when mounted in ``norecovery`` mode. Some files or directories may not
+ be accessible because of this. Filesystems mounted ``norecovery`` must
+ be mounted read-only or the mount will fail.
+
+ nouuid
+ Don't check for double mounted file systems using the file system uuid.
+ This is useful to mount LVM snapshot volumes, and often used in
+ combination with ``norecovery`` for mounting read-only snapshots.
+
+ noquota
+ Forcibly turns off all quota accounting and enforcement
+ within the filesystem.
+
+ uquota/usrquota/uqnoenforce/quota
+ User disk quota accounting enabled, and limits (optionally) enforced.
+ Refer to **xfs_quota(8)** for further details.
+
+ gquota/grpquota/gqnoenforce
+ Group disk quota accounting enabled and limits (optionally) enforced.
+ Refer to **xfs_quota(8)** for further details.
+
+ pquota/prjquota/pqnoenforce
+ Project disk quota accounting enabled and limits (optionally) enforced.
+ Refer to **xfs_quota(8)** for further details.
+
+ sunit=<value>
+ Used to specify the stripe unit for a RAID device or (in conjunction
+ with ``swidth`` below) a stripe volume. ``value`` must be specified in
+ 512-byte block units. This option is only relevant to filesystems that
+ were created with non-zero data alignment parameters.
+
+ The ``sunit`` parameter specified must be compatible with the existing
+ filesystem alignment characteristics. In general, that means the only
+ valid changes to ``sunit`` are increasing it by a power-of-2 multiple.
+
+ Typically, this mount option is necessary only after an underlying RAID
+ device has had its geometry modified, such as adding a new disk to a
+ RAID5 lun and reshaping it.
+
+ swidth=<value>
+ Used to specify the stripe width for a RAID device or (in conjunction
+ with ``sunit`` above) a stripe volume. ``value`` must be specified in
+ 512-byte block units. This option, like ``sunit`` above, is only
+ relevant to filesystems that were created with non-zero data alignment
+ parameters.
+
+ The ``swidth`` parameter specified must be compatible with the existing
+ filesystem alignment characteristics. In general, that means the only
+ valid swidth values are any integer multiple of a valid ``sunit`` value.
+
+ Typically, this mount option is necessary only after an underlying RAID
+ device has had its geometry modified, such as adding a new disk to a
+ RAID5 lun and reshaping it.
+
+
+ swalloc
+ Data allocations will be rounded up to stripe width boundaries when the
+ current end of file is being extended and the file size is larger than
+ the stripe width size.
+
+ wsync
+ When specified, all filesystem namespace operations are executed
+ synchronously. This ensures that when the namespace operation (create,
+ unlink, etc) completes, the change to the namespace is on stable
+ storage. This is useful in HA setups where failover must not result in
+ clients seeing inconsistent namespace presentation during or after a
+ failover event.
+
+
+Deprecated Mount Options
+========================
+
+ Name Removal Schedule
+ ---- ----------------
+
+
+Removed Mount Options
+=====================
+
+ Name Removed
+ ---- -------
+ delaylog/nodelaylog v4.0
+ ihashsize v4.0
+ irixsgid v4.0
+ osyncisdsync/osyncisosync v4.0
+ barrier v4.19
+ nobarrier v4.19
+
+
+sysctls
+=======
+
+The following sysctls are available for the XFS filesystem:
+
+ fs.xfs.stats_clear (Min: 0 Default: 0 Max: 1)
+ Setting this to "1" clears accumulated XFS statistics
+ in /proc/fs/xfs/stat. It then immediately resets to "0".
+
+ fs.xfs.xfssyncd_centisecs (Min: 100 Default: 3000 Max: 720000)
+ The interval at which the filesystem flushes metadata
+ out to disk and runs internal cache cleanup routines.
+
+ fs.xfs.filestream_centisecs (Min: 1 Default: 3000 Max: 360000)
+ The interval at which the filesystem ages filestreams cache
+ references and returns timed-out AGs back to the free stream
+ pool.
+
+ fs.xfs.speculative_prealloc_lifetime
+ (Units: seconds Min: 1 Default: 300 Max: 86400)
+ The interval at which the background scanning for inodes
+ with unused speculative preallocation runs. The scan
+ removes unused preallocation from clean inodes and releases
+ the unused space back to the free pool.
+
+ fs.xfs.error_level (Min: 0 Default: 3 Max: 11)
+ A volume knob for error reporting when internal errors occur.
+ This will generate detailed messages & backtraces for filesystem
+ shutdowns, for example. Current threshold values are:
+
+ XFS_ERRLEVEL_OFF: 0
+ XFS_ERRLEVEL_LOW: 1
+ XFS_ERRLEVEL_HIGH: 5
+
+ fs.xfs.panic_mask (Min: 0 Default: 0 Max: 256)
+ Causes certain error conditions to call BUG(). Value is a bitmask;
+ OR together the tags which represent errors which should cause panics:
+
+ XFS_NO_PTAG 0
+ XFS_PTAG_IFLUSH 0x00000001
+ XFS_PTAG_LOGRES 0x00000002
+ XFS_PTAG_AILDELETE 0x00000004
+ XFS_PTAG_ERROR_REPORT 0x00000008
+ XFS_PTAG_SHUTDOWN_CORRUPT 0x00000010
+ XFS_PTAG_SHUTDOWN_IOERROR 0x00000020
+ XFS_PTAG_SHUTDOWN_LOGERROR 0x00000040
+ XFS_PTAG_FSBLOCK_ZERO 0x00000080
+ XFS_PTAG_VERIFIER_ERROR 0x00000100
+
+ This option is intended for debugging only.
+
+ fs.xfs.irix_symlink_mode (Min: 0 Default: 0 Max: 1)
+ Controls whether symlinks are created with mode 0777 (default)
+ or whether their mode is affected by the umask (irix mode).
+
+ fs.xfs.irix_sgid_inherit (Min: 0 Default: 0 Max: 1)
+ Controls files created in SGID directories.
+ If the group ID of the new file does not match the effective group
+ ID or one of the supplementary group IDs of the parent dir, the
+ ISGID bit is cleared if the irix_sgid_inherit compatibility sysctl
+ is set.
+
+ fs.xfs.inherit_sync (Min: 0 Default: 1 Max: 1)
+ Setting this to "1" will cause the "sync" flag set
+ by the **xfs_io(8)** chattr command on a directory to be
+ inherited by files in that directory.
+
+ fs.xfs.inherit_nodump (Min: 0 Default: 1 Max: 1)
+ Setting this to "1" will cause the "nodump" flag set
+ by the **xfs_io(8)** chattr command on a directory to be
+ inherited by files in that directory.
+
+ fs.xfs.inherit_noatime (Min: 0 Default: 1 Max: 1)
+ Setting this to "1" will cause the "noatime" flag set
+ by the **xfs_io(8)** chattr command on a directory to be
+ inherited by files in that directory.
+
+ fs.xfs.inherit_nosymlinks (Min: 0 Default: 1 Max: 1)
+ Setting this to "1" will cause the "nosymlinks" flag set
+ by the **xfs_io(8)** chattr command on a directory to be
+ inherited by files in that directory.
+
+ fs.xfs.inherit_nodefrag (Min: 0 Default: 1 Max: 1)
+ Setting this to "1" will cause the "nodefrag" flag set
+ by the **xfs_io(8)** chattr command on a directory to be
+ inherited by files in that directory.
+
+ fs.xfs.rotorstep (Min: 1 Default: 1 Max: 256)
+ In "inode32" allocation mode, this option determines how many
+ files the allocator attempts to allocate in the same allocation
+ group before moving to the next allocation group. The intent
+ is to control the rate at which the allocator moves between
+ allocation groups when allocating extents for new files.
+
+Deprecated Sysctls
+==================
+
+None at present.
+
+
+Removed Sysctls
+===============
+
+ Name Removed
+ ---- -------
+ fs.xfs.xfsbufd_centisec v4.0
+ fs.xfs.age_buffer_centisecs v4.0
+
+
+Error handling
+==============
+
+XFS can act differently according to the type of error found during its
+operation. The implementation introduces the following concepts to the error
+handler:
+
+ -failure speed:
+ Defines how fast XFS should propagate an error upwards when a specific
+ error is found during the filesystem operation. It can propagate
+ immediately, after a defined number of retries, after a set time period,
+ or simply retry forever.
+
+ -error classes:
+ Specifies the subsystem the error configuration will apply to, such as
+ metadata IO or memory allocation. Different subsystems will have
+ different error handlers for which behaviour can be configured.
+
+ -error handlers:
+ Defines the behavior for a specific error.
+
+The filesystem behavior during an error can be set via sysfs files. Each
+error handler works independently - the first condition met by an error handler
+for a specific class will cause the error to be propagated rather than reset and
+retried.
+
+The action taken by the filesystem when the error is propagated is context
+dependent - it may cause a shut down in the case of an unrecoverable error,
+it may be reported back to userspace, or it may even be ignored because
+there's nothing useful we can with the error or anyone we can report it to (e.g.
+during unmount).
+
+The configuration files are organized into the following hierarchy for each
+mounted filesystem:
+
+ /sys/fs/xfs/<dev>/error/<class>/<error>/
+
+Where:
+ <dev>
+ The short device name of the mounted filesystem. This is the same device
+ name that shows up in XFS kernel error messages as "XFS(<dev>): ..."
+
+ <class>
+ The subsystem the error configuration belongs to. As of 4.9, the defined
+ classes are:
+
+ - "metadata": applies metadata buffer write IO
+
+ <error>
+ The individual error handler configurations.
+
+
+Each filesystem has "global" error configuration options defined in their top
+level directory:
+
+ /sys/fs/xfs/<dev>/error/
+
+ fail_at_unmount (Min: 0 Default: 1 Max: 1)
+ Defines the filesystem error behavior at unmount time.
+
+ If set to a value of 1, XFS will override all other error configurations
+ during unmount and replace them with "immediate fail" characteristics.
+ i.e. no retries, no retry timeout. This will always allow unmount to
+ succeed when there are persistent errors present.
+
+ If set to 0, the configured retry behaviour will continue until all
+ retries and/or timeouts have been exhausted. This will delay unmount
+ completion when there are persistent errors, and it may prevent the
+ filesystem from ever unmounting fully in the case of "retry forever"
+ handler configurations.
+
+ Note: there is no guarantee that fail_at_unmount can be set while an
+ unmount is in progress. It is possible that the sysfs entries are
+ removed by the unmounting filesystem before a "retry forever" error
+ handler configuration causes unmount to hang, and hence the filesystem
+ must be configured appropriately before unmount begins to prevent
+ unmount hangs.
+
+Each filesystem has specific error class handlers that define the error
+propagation behaviour for specific errors. There is also a "default" error
+handler defined, which defines the behaviour for all errors that don't have
+specific handlers defined. Where multiple retry constraints are configuredi for
+a single error, the first retry configuration that expires will cause the error
+to be propagated. The handler configurations are found in the directory:
+
+ /sys/fs/xfs/<dev>/error/<class>/<error>/
+
+ max_retries (Min: -1 Default: Varies Max: INTMAX)
+ Defines the allowed number of retries of a specific error before
+ the filesystem will propagate the error. The retry count for a given
+ error context (e.g. a specific metadata buffer) is reset every time
+ there is a successful completion of the operation.
+
+ Setting the value to "-1" will cause XFS to retry forever for this
+ specific error.
+
+ Setting the value to "0" will cause XFS to fail immediately when the
+ specific error is reported.
+
+ Setting the value to "N" (where 0 < N < Max) will make XFS retry the
+ operation "N" times before propagating the error.
+
+ retry_timeout_seconds (Min: -1 Default: Varies Max: 1 day)
+ Define the amount of time (in seconds) that the filesystem is
+ allowed to retry its operations when the specific error is
+ found.
+
+ Setting the value to "-1" will allow XFS to retry forever for this
+ specific error.
+
+ Setting the value to "0" will cause XFS to fail immediately when the
+ specific error is reported.
+
+ Setting the value to "N" (where 0 < N < Max) will allow XFS to retry the
+ operation for up to "N" seconds before propagating the error.
+
+Note: The default behaviour for a specific error handler is dependent on both
+the class and error context. For example, the default values for
+"metadata/ENODEV" are "0" rather than "-1" so that this error handler defaults
+to "fail immediately" behaviour. This is done because ENODEV is a fatal,
+unrecoverable error no matter how many times the metadata IO is retried.
diff --git a/Documentation/filesystems/xfs.txt b/Documentation/filesystems/xfs.txt
deleted file mode 100644
index a5cbb5e0e..000000000
--- a/Documentation/filesystems/xfs.txt
+++ /dev/null
@@ -1,470 +0,0 @@
-
-The SGI XFS Filesystem
-======================
-
-XFS is a high performance journaling filesystem which originated
-on the SGI IRIX platform. It is completely multi-threaded, can
-support large files and large filesystems, extended attributes,
-variable block sizes, is extent based, and makes extensive use of
-Btrees (directories, extents, free space) to aid both performance
-and scalability.
-
-Refer to the documentation at https://xfs.wiki.kernel.org/
-for further details. This implementation is on-disk compatible
-with the IRIX version of XFS.
-
-
-Mount Options
-=============
-
-When mounting an XFS filesystem, the following options are accepted.
-For boolean mount options, the names with the (*) suffix is the
-default behaviour.
-
- allocsize=size
- Sets the buffered I/O end-of-file preallocation size when
- doing delayed allocation writeout (default size is 64KiB).
- Valid values for this option are page size (typically 4KiB)
- through to 1GiB, inclusive, in power-of-2 increments.
-
- The default behaviour is for dynamic end-of-file
- preallocation size, which uses a set of heuristics to
- optimise the preallocation size based on the current
- allocation patterns within the file and the access patterns
- to the file. Specifying a fixed allocsize value turns off
- the dynamic behaviour.
-
- attr2
- noattr2
- The options enable/disable an "opportunistic" improvement to
- be made in the way inline extended attributes are stored
- on-disk. When the new form is used for the first time when
- attr2 is selected (either when setting or removing extended
- attributes) the on-disk superblock feature bit field will be
- updated to reflect this format being in use.
-
- The default behaviour is determined by the on-disk feature
- bit indicating that attr2 behaviour is active. If either
- mount option it set, then that becomes the new default used
- by the filesystem.
-
- CRC enabled filesystems always use the attr2 format, and so
- will reject the noattr2 mount option if it is set.
-
- discard
- nodiscard (*)
- Enable/disable the issuing of commands to let the block
- device reclaim space freed by the filesystem. This is
- useful for SSD devices, thinly provisioned LUNs and virtual
- machine images, but may have a performance impact.
-
- Note: It is currently recommended that you use the fstrim
- application to discard unused blocks rather than the discard
- mount option because the performance impact of this option
- is quite severe.
-
- grpid/bsdgroups
- nogrpid/sysvgroups (*)
- These options define what group ID a newly created file
- gets. When grpid is set, it takes the group ID of the
- directory in which it is created; otherwise it takes the
- fsgid of the current process, unless the directory has the
- setgid bit set, in which case it takes the gid from the
- parent directory, and also gets the setgid bit set if it is
- a directory itself.
-
- filestreams
- Make the data allocator use the filestreams allocation mode
- across the entire filesystem rather than just on directories
- configured to use it.
-
- ikeep
- noikeep (*)
- When ikeep is specified, XFS does not delete empty inode
- clusters and keeps them around on disk. When noikeep is
- specified, empty inode clusters are returned to the free
- space pool.
-
- inode32
- inode64 (*)
- When inode32 is specified, it indicates that XFS limits
- inode creation to locations which will not result in inode
- numbers with more than 32 bits of significance.
-
- When inode64 is specified, it indicates that XFS is allowed
- to create inodes at any location in the filesystem,
- including those which will result in inode numbers occupying
- more than 32 bits of significance.
-
- inode32 is provided for backwards compatibility with older
- systems and applications, since 64 bits inode numbers might
- cause problems for some applications that cannot handle
- large inode numbers. If applications are in use which do
- not handle inode numbers bigger than 32 bits, the inode32
- option should be specified.
-
-
- largeio
- nolargeio (*)
- If "nolargeio" is specified, the optimal I/O reported in
- st_blksize by stat(2) will be as small as possible to allow
- user applications to avoid inefficient read/modify/write
- I/O. This is typically the page size of the machine, as
- this is the granularity of the page cache.
-
- If "largeio" specified, a filesystem that was created with a
- "swidth" specified will return the "swidth" value (in bytes)
- in st_blksize. If the filesystem does not have a "swidth"
- specified but does specify an "allocsize" then "allocsize"
- (in bytes) will be returned instead. Otherwise the behaviour
- is the same as if "nolargeio" was specified.
-
- logbufs=value
- Set the number of in-memory log buffers. Valid numbers
- range from 2-8 inclusive.
-
- The default value is 8 buffers.
-
- If the memory cost of 8 log buffers is too high on small
- systems, then it may be reduced at some cost to performance
- on metadata intensive workloads. The logbsize option below
- controls the size of each buffer and so is also relevant to
- this case.
-
- logbsize=value
- Set the size of each in-memory log buffer. The size may be
- specified in bytes, or in kilobytes with a "k" suffix.
- Valid sizes for version 1 and version 2 logs are 16384 (16k)
- and 32768 (32k). Valid sizes for version 2 logs also
- include 65536 (64k), 131072 (128k) and 262144 (256k). The
- logbsize must be an integer multiple of the log
- stripe unit configured at mkfs time.
-
- The default value for for version 1 logs is 32768, while the
- default value for version 2 logs is MAX(32768, log_sunit).
-
- logdev=device and rtdev=device
- Use an external log (metadata journal) and/or real-time device.
- An XFS filesystem has up to three parts: a data section, a log
- section, and a real-time section. The real-time section is
- optional, and the log section can be separate from the data
- section or contained within it.
-
- noalign
- Data allocations will not be aligned at stripe unit
- boundaries. This is only relevant to filesystems created
- with non-zero data alignment parameters (sunit, swidth) by
- mkfs.
-
- norecovery
- The filesystem will be mounted without running log recovery.
- If the filesystem was not cleanly unmounted, it is likely to
- be inconsistent when mounted in "norecovery" mode.
- Some files or directories may not be accessible because of this.
- Filesystems mounted "norecovery" must be mounted read-only or
- the mount will fail.
-
- nouuid
- Don't check for double mounted file systems using the file
- system uuid. This is useful to mount LVM snapshot volumes,
- and often used in combination with "norecovery" for mounting
- read-only snapshots.
-
- noquota
- Forcibly turns off all quota accounting and enforcement
- within the filesystem.
-
- uquota/usrquota/uqnoenforce/quota
- User disk quota accounting enabled, and limits (optionally)
- enforced. Refer to xfs_quota(8) for further details.
-
- gquota/grpquota/gqnoenforce
- Group disk quota accounting enabled and limits (optionally)
- enforced. Refer to xfs_quota(8) for further details.
-
- pquota/prjquota/pqnoenforce
- Project disk quota accounting enabled and limits (optionally)
- enforced. Refer to xfs_quota(8) for further details.
-
- sunit=value and swidth=value
- Used to specify the stripe unit and width for a RAID device
- or a stripe volume. "value" must be specified in 512-byte
- block units. These options are only relevant to filesystems
- that were created with non-zero data alignment parameters.
-
- The sunit and swidth parameters specified must be compatible
- with the existing filesystem alignment characteristics. In
- general, that means the only valid changes to sunit are
- increasing it by a power-of-2 multiple. Valid swidth values
- are any integer multiple of a valid sunit value.
-
- Typically the only time these mount options are necessary if
- after an underlying RAID device has had it's geometry
- modified, such as adding a new disk to a RAID5 lun and
- reshaping it.
-
- swalloc
- Data allocations will be rounded up to stripe width boundaries
- when the current end of file is being extended and the file
- size is larger than the stripe width size.
-
- wsync
- When specified, all filesystem namespace operations are
- executed synchronously. This ensures that when the namespace
- operation (create, unlink, etc) completes, the change to the
- namespace is on stable storage. This is useful in HA setups
- where failover must not result in clients seeing
- inconsistent namespace presentation during or after a
- failover event.
-
-
-Deprecated Mount Options
-========================
-
- Name Removal Schedule
- ---- ----------------
-
-
-Removed Mount Options
-=====================
-
- Name Removed
- ---- -------
- delaylog/nodelaylog v4.0
- ihashsize v4.0
- irixsgid v4.0
- osyncisdsync/osyncisosync v4.0
- barrier v4.19
- nobarrier v4.19
-
-
-sysctls
-=======
-
-The following sysctls are available for the XFS filesystem:
-
- fs.xfs.stats_clear (Min: 0 Default: 0 Max: 1)
- Setting this to "1" clears accumulated XFS statistics
- in /proc/fs/xfs/stat. It then immediately resets to "0".
-
- fs.xfs.xfssyncd_centisecs (Min: 100 Default: 3000 Max: 720000)
- The interval at which the filesystem flushes metadata
- out to disk and runs internal cache cleanup routines.
-
- fs.xfs.filestream_centisecs (Min: 1 Default: 3000 Max: 360000)
- The interval at which the filesystem ages filestreams cache
- references and returns timed-out AGs back to the free stream
- pool.
-
- fs.xfs.speculative_prealloc_lifetime
- (Units: seconds Min: 1 Default: 300 Max: 86400)
- The interval at which the background scanning for inodes
- with unused speculative preallocation runs. The scan
- removes unused preallocation from clean inodes and releases
- the unused space back to the free pool.
-
- fs.xfs.error_level (Min: 0 Default: 3 Max: 11)
- A volume knob for error reporting when internal errors occur.
- This will generate detailed messages & backtraces for filesystem
- shutdowns, for example. Current threshold values are:
-
- XFS_ERRLEVEL_OFF: 0
- XFS_ERRLEVEL_LOW: 1
- XFS_ERRLEVEL_HIGH: 5
-
- fs.xfs.panic_mask (Min: 0 Default: 0 Max: 256)
- Causes certain error conditions to call BUG(). Value is a bitmask;
- OR together the tags which represent errors which should cause panics:
-
- XFS_NO_PTAG 0
- XFS_PTAG_IFLUSH 0x00000001
- XFS_PTAG_LOGRES 0x00000002
- XFS_PTAG_AILDELETE 0x00000004
- XFS_PTAG_ERROR_REPORT 0x00000008
- XFS_PTAG_SHUTDOWN_CORRUPT 0x00000010
- XFS_PTAG_SHUTDOWN_IOERROR 0x00000020
- XFS_PTAG_SHUTDOWN_LOGERROR 0x00000040
- XFS_PTAG_FSBLOCK_ZERO 0x00000080
- XFS_PTAG_VERIFIER_ERROR 0x00000100
-
- This option is intended for debugging only.
-
- fs.xfs.irix_symlink_mode (Min: 0 Default: 0 Max: 1)
- Controls whether symlinks are created with mode 0777 (default)
- or whether their mode is affected by the umask (irix mode).
-
- fs.xfs.irix_sgid_inherit (Min: 0 Default: 0 Max: 1)
- Controls files created in SGID directories.
- If the group ID of the new file does not match the effective group
- ID or one of the supplementary group IDs of the parent dir, the
- ISGID bit is cleared if the irix_sgid_inherit compatibility sysctl
- is set.
-
- fs.xfs.inherit_sync (Min: 0 Default: 1 Max: 1)
- Setting this to "1" will cause the "sync" flag set
- by the xfs_io(8) chattr command on a directory to be
- inherited by files in that directory.
-
- fs.xfs.inherit_nodump (Min: 0 Default: 1 Max: 1)
- Setting this to "1" will cause the "nodump" flag set
- by the xfs_io(8) chattr command on a directory to be
- inherited by files in that directory.
-
- fs.xfs.inherit_noatime (Min: 0 Default: 1 Max: 1)
- Setting this to "1" will cause the "noatime" flag set
- by the xfs_io(8) chattr command on a directory to be
- inherited by files in that directory.
-
- fs.xfs.inherit_nosymlinks (Min: 0 Default: 1 Max: 1)
- Setting this to "1" will cause the "nosymlinks" flag set
- by the xfs_io(8) chattr command on a directory to be
- inherited by files in that directory.
-
- fs.xfs.inherit_nodefrag (Min: 0 Default: 1 Max: 1)
- Setting this to "1" will cause the "nodefrag" flag set
- by the xfs_io(8) chattr command on a directory to be
- inherited by files in that directory.
-
- fs.xfs.rotorstep (Min: 1 Default: 1 Max: 256)
- In "inode32" allocation mode, this option determines how many
- files the allocator attempts to allocate in the same allocation
- group before moving to the next allocation group. The intent
- is to control the rate at which the allocator moves between
- allocation groups when allocating extents for new files.
-
-Deprecated Sysctls
-==================
-
-None at present.
-
-
-Removed Sysctls
-===============
-
- Name Removed
- ---- -------
- fs.xfs.xfsbufd_centisec v4.0
- fs.xfs.age_buffer_centisecs v4.0
-
-
-Error handling
-==============
-
-XFS can act differently according to the type of error found during its
-operation. The implementation introduces the following concepts to the error
-handler:
-
- -failure speed:
- Defines how fast XFS should propagate an error upwards when a specific
- error is found during the filesystem operation. It can propagate
- immediately, after a defined number of retries, after a set time period,
- or simply retry forever.
-
- -error classes:
- Specifies the subsystem the error configuration will apply to, such as
- metadata IO or memory allocation. Different subsystems will have
- different error handlers for which behaviour can be configured.
-
- -error handlers:
- Defines the behavior for a specific error.
-
-The filesystem behavior during an error can be set via sysfs files. Each
-error handler works independently - the first condition met by an error handler
-for a specific class will cause the error to be propagated rather than reset and
-retried.
-
-The action taken by the filesystem when the error is propagated is context
-dependent - it may cause a shut down in the case of an unrecoverable error,
-it may be reported back to userspace, or it may even be ignored because
-there's nothing useful we can with the error or anyone we can report it to (e.g.
-during unmount).
-
-The configuration files are organized into the following hierarchy for each
-mounted filesystem:
-
- /sys/fs/xfs/<dev>/error/<class>/<error>/
-
-Where:
- <dev>
- The short device name of the mounted filesystem. This is the same device
- name that shows up in XFS kernel error messages as "XFS(<dev>): ..."
-
- <class>
- The subsystem the error configuration belongs to. As of 4.9, the defined
- classes are:
-
- - "metadata": applies metadata buffer write IO
-
- <error>
- The individual error handler configurations.
-
-
-Each filesystem has "global" error configuration options defined in their top
-level directory:
-
- /sys/fs/xfs/<dev>/error/
-
- fail_at_unmount (Min: 0 Default: 1 Max: 1)
- Defines the filesystem error behavior at unmount time.
-
- If set to a value of 1, XFS will override all other error configurations
- during unmount and replace them with "immediate fail" characteristics.
- i.e. no retries, no retry timeout. This will always allow unmount to
- succeed when there are persistent errors present.
-
- If set to 0, the configured retry behaviour will continue until all
- retries and/or timeouts have been exhausted. This will delay unmount
- completion when there are persistent errors, and it may prevent the
- filesystem from ever unmounting fully in the case of "retry forever"
- handler configurations.
-
- Note: there is no guarantee that fail_at_unmount can be set while an
- unmount is in progress. It is possible that the sysfs entries are
- removed by the unmounting filesystem before a "retry forever" error
- handler configuration causes unmount to hang, and hence the filesystem
- must be configured appropriately before unmount begins to prevent
- unmount hangs.
-
-Each filesystem has specific error class handlers that define the error
-propagation behaviour for specific errors. There is also a "default" error
-handler defined, which defines the behaviour for all errors that don't have
-specific handlers defined. Where multiple retry constraints are configuredi for
-a single error, the first retry configuration that expires will cause the error
-to be propagated. The handler configurations are found in the directory:
-
- /sys/fs/xfs/<dev>/error/<class>/<error>/
-
- max_retries (Min: -1 Default: Varies Max: INTMAX)
- Defines the allowed number of retries of a specific error before
- the filesystem will propagate the error. The retry count for a given
- error context (e.g. a specific metadata buffer) is reset every time
- there is a successful completion of the operation.
-
- Setting the value to "-1" will cause XFS to retry forever for this
- specific error.
-
- Setting the value to "0" will cause XFS to fail immediately when the
- specific error is reported.
-
- Setting the value to "N" (where 0 < N < Max) will make XFS retry the
- operation "N" times before propagating the error.
-
- retry_timeout_seconds (Min: -1 Default: Varies Max: 1 day)
- Define the amount of time (in seconds) that the filesystem is
- allowed to retry its operations when the specific error is
- found.
-
- Setting the value to "-1" will allow XFS to retry forever for this
- specific error.
-
- Setting the value to "0" will cause XFS to fail immediately when the
- specific error is reported.
-
- Setting the value to "N" (where 0 < N < Max) will allow XFS to retry the
- operation for up to "N" seconds before propagating the error.
-
-Note: The default behaviour for a specific error handler is dependent on both
-the class and error context. For example, the default values for
-"metadata/ENODEV" are "0" rather than "-1" so that this error handler defaults
-to "fail immediately" behaviour. This is done because ENODEV is a fatal,
-unrecoverable error no matter how many times the metadata IO is retried.
diff --git a/MAINTAINERS b/MAINTAINERS
index d0ed73599..66e972e9a 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -17364,7 +17364,7 @@ L: linux-xfs@vger.kernel.org
W: http://xfs.org/
T: git git://git.kernel.org/pub/scm/fs/xfs/xfs-linux.git
S: Supported
-F: Documentation/filesystems/xfs.txt
+F: Documentation/filesystems/xfs.rst
F: fs/xfs/
XILINX AXI ETHERNET DRIVER
--
2.22.0
^ permalink raw reply related
* Re: [linux-kernel-mentees] [PATCH] Doc : doc-guide : Fix a typo
From: Jonathan Corbet @ 2019-06-30 13:40 UTC (permalink / raw)
To: Sheriff Esseson; +Cc: skhan, linux-kernel-mentees, linux-doc, linux-kernel
In-Reply-To: <20190630071707.GA12881@localhost>
On Sun, 30 Jun 2019 08:17:07 +0100
Sheriff Esseson <sheriffesseson@gmail.com> wrote:
> > fix the disjunction by replacing "of" with "or".
> >
> > Signed-off-by: Sheriff Esseson <sheriffesseson@gmail.com>
> > ---
> > --
> > 2.22.0
> >
>
> Signed-off-by: Sheriff Esseson <sheriffesseson@gmail.com>
> ---
>
> changes in v2:
> - cc-ed Corbet.
>
> Documentation/doc-guide/kernel-doc.rst | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
So why are you sending me this again? I applied it a few days ago and
told you so at the time.
jon
^ permalink raw reply
* Re: [linux-kernel-mentees] [PATCH] Doc : doc-guide : Fix a typo
From: Sheriff Esseson @ 2019-06-30 7:17 UTC (permalink / raw)
To: skhan; +Cc: linux-kernel-mentees, corbet, linux-doc, linux-kernel
In-Reply-To: <20190628060111.24851-1-sheriffesseson@gmail.com>
On Fri, Jun 28, 2019 at 07:01:11AM +0100, Sheriff Esseson wrote:
> fix the disjunction by replacing "of" with "or".
>
> Signed-off-by: Sheriff Esseson <sheriffesseson@gmail.com>
> ---
> --
> 2.22.0
>
Signed-off-by: Sheriff Esseson <sheriffesseson@gmail.com>
---
changes in v2:
- cc-ed Corbet.
Documentation/doc-guide/kernel-doc.rst | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/Documentation/doc-guide/kernel-doc.rst b/Documentation/doc-guide/kernel-doc.rst
index f96059767..192c36af3 100644
--- a/Documentation/doc-guide/kernel-doc.rst
+++ b/Documentation/doc-guide/kernel-doc.rst
@@ -359,7 +359,7 @@ Domain`_ references.
``monospaced font``.
Useful if you need to use special characters that would otherwise have some
- meaning either by kernel-doc script of by reStructuredText.
+ meaning either by kernel-doc script or by reStructuredText.
This is particularly useful if you need to use things like ``%ph`` inside
a function description.
--
2.22.0
^ permalink raw reply related
* RE: [PATCH] Documentation: misc-devices: mei: Convert mei txt files to reST
From: Winkler, Tomas @ 2019-06-30 6:23 UTC (permalink / raw)
To: Shreeya Patel, skhan@linuxfoundation.org, corbet@lwn.net,
linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-kernel-mentees@lists.linuxfoundation.org
In-Reply-To: <20190629213203.5887-1-shreeya.patel23498@gmail.com>
> -----Original Message-----
> From: Shreeya Patel [mailto:shreeya.patel23498@gmail.com]
> Sent: Sunday, June 30, 2019 00:32
> To: skhan@linuxfoundation.org; corbet@lwn.net; Winkler, Tomas
> <tomas.winkler@intel.com>; linux-doc@vger.kernel.org; linux-
> kernel@vger.kernel.org; linux-kernel-mentees@lists.linuxfoundation.org
> Subject: [PATCH] Documentation: misc-devices: mei: Convert mei txt files to
> reST
>
> Convert the MEI misc device's documentation files from .txt to
> reStructuredText format. Make a minor change of correcting the wrong macro
> name MEI_CONNECT_CLIENT_IOCTL to IOCTL_MEI_CONNECT_CLIENT.
> Add an index file in mei as there are two sections for it in the documentation.
>
> Signed-off-by: Shreeya Patel <shreeya.patel23498@gmail.com>
> ---
Sorry you are late, we've already done that, it should be merged via Greg's char-misc tree.
Thanks
Tomas
> I am not sure if I have placed the Documentation in the right place so I would
> like to get some suggestions from the MAINTAINERS on this part.
>
> Documentation/misc-devices/index.rst | 1 +
> Documentation/misc-devices/mei/index.rst | 15 +
> .../misc-devices/mei/mei-client-bus.rst | 151 +++++++++
> .../misc-devices/mei/mei-client-bus.txt | 141 ---------
> Documentation/misc-devices/mei/mei.rst | 289 ++++++++++++++++++
> Documentation/misc-devices/mei/mei.txt | 266 ----------------
> 6 files changed, 456 insertions(+), 407 deletions(-) create mode 100644
> Documentation/misc-devices/mei/index.rst
> create mode 100644 Documentation/misc-devices/mei/mei-client-bus.rst
> delete mode 100644 Documentation/misc-devices/mei/mei-client-bus.txt
> create mode 100644 Documentation/misc-devices/mei/mei.rst
> delete mode 100644 Documentation/misc-devices/mei/mei.txt
>
> diff --git a/Documentation/misc-devices/index.rst b/Documentation/misc-
> devices/index.rst
> index dfd1f45a3127..e788a12b2b19 100644
> --- a/Documentation/misc-devices/index.rst
> +++ b/Documentation/misc-devices/index.rst
> @@ -15,3 +15,4 @@ fit into other categories.
> :maxdepth: 2
>
> ibmvmc
> + mei/index
> diff --git a/Documentation/misc-devices/mei/index.rst b/Documentation/misc-
> devices/mei/index.rst
> new file mode 100644
> index 000000000000..3018098ad075
> --- /dev/null
> +++ b/Documentation/misc-devices/mei/index.rst
> @@ -0,0 +1,15 @@
> +.. SPDX-License-Identifier: GPL-2.0
> +
> +===============================================================
> ==
> +Intel(R) Management Engine Interface Kernel Driver (Intel(R) MEI)
> +===============================================================
> ==
> +
> +.. class:: toc-title
> +
> + Table of contents
> +
> +.. toctree::
> + :maxdepth: 2
> +
> + mei
> + mei-client-bus
> diff --git a/Documentation/misc-devices/mei/mei-client-bus.rst
> b/Documentation/misc-devices/mei/mei-client-bus.rst
> new file mode 100644
> index 000000000000..82d455afae78
> --- /dev/null
> +++ b/Documentation/misc-devices/mei/mei-client-bus.rst
> @@ -0,0 +1,151 @@
> +.. SPDX-License-Identifier: GPL-2.0
> +
> +==============================================
> +Intel(R) Management Engine (ME) Client bus API
> +==============================================
> +
> +
> +Rationale
> +=========
> +
> +MEI misc character device is useful for dedicated applications to send
> +and receive data to the many FW appliance found in Intel's ME from the user
> space.
> +However for some of the ME functionalities it make sense to leverage
> +existing software stack and expose them through existing kernel subsystems.
> +
> +In order to plug seamlessly into the kernel device driver model we add
> +kernel virtual bus abstraction on top of the MEI driver. This allows
> +implementing linux kernel drivers for the various MEI features as a stand
> alone entities found in their respective subsystem.
> +Existing device drivers can even potentially be re-used by adding an
> +MEI CL bus layer to the existing code.
> +
> +
> +MEI CL bus API
> +==============
> +
> +A driver implementation for an MEI Client is very similar to existing
> +bus based device drivers. The driver registers itself as an MEI CL bus
> +driver through the :c:type:`mei_cl_driver` structure:
> +
> +::
> +
> + struct mei_cl_driver {
> + struct device_driver driver;
> + const char *name;
> +
> + const struct mei_cl_device_id *id_table;
> +
> + int (*probe)(struct mei_cl_device *dev, const struct mei_cl_id
> *id);
> + int (*remove)(struct mei_cl_device *dev);
> + };
> +
> + struct mei_cl_id {
> + char name[MEI_NAME_SIZE];
> + kernel_ulong_t driver_info;
> + };
> +
> +
> +The :c:type:`mei_cl_id` structure allows the driver to bind itself against a
> device name.
> +
> +To actually register a driver on the ME Client bus one must call the
> +:c:func:`mei_cl_add_driver()` API. This is typically called at module init time.
> +
> +Once registered on the ME Client bus, a driver will typically try to do
> +some I/O on this bus and this should be done through the
> +:c:func:`mei_cl_send()` and :c:func:`mei_cl_recv()` routines. The latter is
> synchronous (blocks and sleeps until data shows up).
> +In order for drivers to be notified of pending events waiting for them (e.g.
> +an Rx event) they can register an event handler through the
> +:c:func:`mei_cl_register_event_cb()` routine. Currently only the
> +:c:macro:`MEI_EVENT_RX` event will trigger an event handler call and
> +the driver implementation is supposed to call :c:func:`mei_recv()` from
> +the event handler in order to fetch the pending received buffers.
> +
> +
> +Example
> +=======
> +
> +As a theoretical example let's pretend the ME comes with a "contact" NFC IP.
> +The driver init and exit routines for this device would look like:
> +
> +::
> +
> + #define CONTACT_DRIVER_NAME "contact"
> +
> + static struct mei_cl_device_id contact_mei_cl_tbl[] = {
> + { CONTACT_DRIVER_NAME, },
> + /* required last entry */
> + { }
> + };
> + MODULE_DEVICE_TABLE(mei_cl, contact_mei_cl_tbl);
> +
> + static struct mei_cl_driver contact_driver = {
> + .id_table = contact_mei_tbl,
> + .name = CONTACT_DRIVER_NAME,
> + .probe = contact_probe,
> + .remove = contact_remove,
> + };
> +
> + static int contact_init(void)
> + {
> + int r;
> +
> + r = mei_cl_driver_register(&contact_driver);
> + if (r) {
> + pr_err(CONTACT_DRIVER_NAME ": driver registration
> failed\n");
> + return r;
> + }
> +
> + return 0;
> + }
> +
> + static void __exit contact_exit(void)
> + {
> + mei_cl_driver_unregister(&contact_driver);
> + }
> +
> + module_init(contact_init);
> + module_exit(contact_exit);
> +
> +And the driver's simplified probe routine would look like that:
> +
> +::
> +
> + int contact_probe(struct mei_cl_device *dev, struct mei_cl_device_id
> *id)
> + {
> + struct contact_driver *contact;
> +
> + [...]
> + mei_cl_enable_device(dev);
> +
> + mei_cl_register_event_cb(dev, contact_event_cb, contact);
> +
> + return 0;
> + }
> +
> +In the probe routine the driver first enable the MEI device and then
> +registers an ME bus event handler which is as close as it can get to
> +registering a threaded IRQ handler.
> +The handler implementation will typically call some I/O routine
> +depending on the pending events:
> +
> +::
> +
> + #define MAX_NFC_PAYLOAD 128
> +
> + static void contact_event_cb(struct mei_cl_device *dev, u32 events,
> + void *context)
> + {
> + struct contact_driver *contact = context;
> +
> + if (events & BIT(MEI_EVENT_RX)) {
> + u8 payload[MAX_NFC_PAYLOAD];
> + int payload_size;
> +
> + payload_size = mei_recv(dev, payload,
> MAX_NFC_PAYLOAD);
> + if (payload_size <= 0)
> + return;
> +
> + /* Hook to the NFC subsystem */
> + nfc_hci_recv_frame(contact->hdev, payload,
> payload_size);
> + }
> + }
> diff --git a/Documentation/misc-devices/mei/mei-client-bus.txt
> b/Documentation/misc-devices/mei/mei-client-bus.txt
> deleted file mode 100644
> index 743be4ec8989..000000000000
> --- a/Documentation/misc-devices/mei/mei-client-bus.txt
> +++ /dev/null
> @@ -1,141 +0,0 @@
> -Intel(R) Management Engine (ME) Client bus API -
> ==============================================
> -
> -
> -Rationale
> -=========
> -
> -MEI misc character device is useful for dedicated applications to send and
> receive -data to the many FW appliance found in Intel's ME from the user
> space.
> -However for some of the ME functionalities it make sense to leverage existing
> software -stack and expose them through existing kernel subsystems.
> -
> -In order to plug seamlessly into the kernel device driver model we add kernel
> virtual -bus abstraction on top of the MEI driver. This allows implementing linux
> kernel drivers -for the various MEI features as a stand alone entities found in
> their respective subsystem.
> -Existing device drivers can even potentially be re-used by adding an MEI CL
> bus layer to -the existing code.
> -
> -
> -MEI CL bus API
> -==============
> -
> -A driver implementation for an MEI Client is very similar to existing bus -based
> device drivers. The driver registers itself as an MEI CL bus driver through -the
> mei_cl_driver structure:
> -
> -struct mei_cl_driver {
> - struct device_driver driver;
> - const char *name;
> -
> - const struct mei_cl_device_id *id_table;
> -
> - int (*probe)(struct mei_cl_device *dev, const struct mei_cl_id *id);
> - int (*remove)(struct mei_cl_device *dev);
> -};
> -
> -struct mei_cl_id {
> - char name[MEI_NAME_SIZE];
> - kernel_ulong_t driver_info;
> -};
> -
> -The mei_cl_id structure allows the driver to bind itself against a device name.
> -
> -To actually register a driver on the ME Client bus one must call the
> mei_cl_add_driver() -API. This is typically called at module init time.
> -
> -Once registered on the ME Client bus, a driver will typically try to do some I/O
> on -this bus and this should be done through the mei_cl_send() and
> mei_cl_recv() -routines. The latter is synchronous (blocks and sleeps until data
> shows up).
> -In order for drivers to be notified of pending events waiting for them (e.g.
> -an Rx event) they can register an event handler through the
> -mei_cl_register_event_cb() routine. Currently only the MEI_EVENT_RX event -
> will trigger an event handler call and the driver implementation is supposed -to
> call mei_recv() from the event handler in order to fetch the pending -received
> buffers.
> -
> -
> -Example
> -=======
> -
> -As a theoretical example let's pretend the ME comes with a "contact" NFC IP.
> -The driver init and exit routines for this device would look like:
> -
> -#define CONTACT_DRIVER_NAME "contact"
> -
> -static struct mei_cl_device_id contact_mei_cl_tbl[] = {
> - { CONTACT_DRIVER_NAME, },
> -
> - /* required last entry */
> - { }
> -};
> -MODULE_DEVICE_TABLE(mei_cl, contact_mei_cl_tbl);
> -
> -static struct mei_cl_driver contact_driver = {
> - .id_table = contact_mei_tbl,
> - .name = CONTACT_DRIVER_NAME,
> -
> - .probe = contact_probe,
> - .remove = contact_remove,
> -};
> -
> -static int contact_init(void)
> -{
> - int r;
> -
> - r = mei_cl_driver_register(&contact_driver);
> - if (r) {
> - pr_err(CONTACT_DRIVER_NAME ": driver registration
> failed\n");
> - return r;
> - }
> -
> - return 0;
> -}
> -
> -static void __exit contact_exit(void)
> -{
> - mei_cl_driver_unregister(&contact_driver);
> -}
> -
> -module_init(contact_init);
> -module_exit(contact_exit);
> -
> -And the driver's simplified probe routine would look like that:
> -
> -int contact_probe(struct mei_cl_device *dev, struct mei_cl_device_id *id) -{
> - struct contact_driver *contact;
> -
> - [...]
> - mei_cl_enable_device(dev);
> -
> - mei_cl_register_event_cb(dev, contact_event_cb, contact);
> -
> - return 0;
> -}
> -
> -In the probe routine the driver first enable the MEI device and then registers -
> an ME bus event handler which is as close as it can get to registering a -
> threaded IRQ handler.
> -The handler implementation will typically call some I/O routine depending on -
> the pending events:
> -
> -#define MAX_NFC_PAYLOAD 128
> -
> -static void contact_event_cb(struct mei_cl_device *dev, u32 events,
> - void *context)
> -{
> - struct contact_driver *contact = context;
> -
> - if (events & BIT(MEI_EVENT_RX)) {
> - u8 payload[MAX_NFC_PAYLOAD];
> - int payload_size;
> -
> - payload_size = mei_recv(dev, payload, MAX_NFC_PAYLOAD);
> - if (payload_size <= 0)
> - return;
> -
> - /* Hook to the NFC subsystem */
> - nfc_hci_recv_frame(contact->hdev, payload, payload_size);
> - }
> -}
> diff --git a/Documentation/misc-devices/mei/mei.rst b/Documentation/misc-
> devices/mei/mei.rst
> new file mode 100644
> index 000000000000..e91ac2570b4d
> --- /dev/null
> +++ b/Documentation/misc-devices/mei/mei.rst
> @@ -0,0 +1,289 @@
> +.. SPDX-License-Identifier: GPL-2.0
> +
> +====================================
> +Intel(R) Management Engine Interface
> +====================================
> +
> +Introduction
> +============
> +
> +The Intel Management Engine (Intel ME) is an isolated and protected
> +computing resource (Co-processor) residing inside certain Intel
> +chipsets. The Intel ME provides support for computer/IT management
> +features. The feature set depends on the Intel chipset SKU.
> +
> +The Intel Management Engine Interface (Intel MEI, previously known as
> +HECI) is the interface between the Host and Intel ME. This interface is
> +exposed to the host as a PCI device. The Intel MEI Driver is in charge
> +of the communication channel between a host application and the Intel ME
> feature.
> +
> +Each Intel ME feature (Intel ME Client) is addressed by a GUID/UUID and
> +each client has its own protocol. The protocol is message-based with a
> +header and payload up to 512 bytes.
> +
> +Prominent usage of the Intel ME Interface is to communicate with
> +Intel(R) Active Management Technology (Intel AMT) implemented in
> +firmware running on the Intel ME.
> +
> +Intel AMT provides the ability to manage a host remotely out-of-band
> +(OOB) even when the operating system running on the host processor has
> +crashed or is in a sleep state.
> +
> +Some examples of Intel AMT usage are:
> + * Monitoring hardware state and platform components
> + * Remote power off/on (useful for green computing or overnight IT
> + maintenance)
> + * OS updates
> + * Storage of useful platform information such as software assets
> + * Built-in hardware KVM
> + * Selective network isolation of Ethernet and IP protocol flows based
> + on policies set by a remote management console
> + * IDE device redirection from remote management console
> +
> +Intel AMT (OOB) communication is based on SOAP (deprecated starting
> +with Release 6.0) over HTTP/S or WS-Management protocol over HTTP/S
> +that are received from a remote management console application.
> +
> +For more information about Intel AMT:
> +`<http://software.intel.com/sites/manageability/AMT_Implementation_and_
> +Reference_Guide>`_
> +
> +
> +Intel MEI Driver
> +================
> +
> +The driver exposes a misc device called :file:`/dev/mei`.
> +
> +An application maintains communication with an Intel ME feature while
> +:file:`/dev/mei` is open. The binding to a specific feature is
> +performed by calling :c:macro:`IOCTL_MEI_CONNECT_CLIENT`, which passes
> the desired UUID.
> +The number of instances of an Intel ME feature that can be opened at
> +the same time depends on the Intel ME feature, but most of the features
> +allow only a single instance.
> +
> +The Intel AMT Host Interface (Intel AMTHI) feature supports multiple
> +simultaneous user connected applications. The Intel MEI driver handles
> +this internally by maintaining request queues for the applications.
> +
> +The driver is transparent to data that are passed between firmware
> +feature and host application.
> +
> +Because some of the Intel ME features can change the system
> +configuration, the driver by default allows only a privileged user to
> +access it.
> +
> +A code snippet for an application communicating with Intel AMTHI client:
> +
> +::
> +
> + struct mei_connect_client_data data;
> + fd = open(MEI_DEVICE);
> +
> + data.d.in_client_uuid = AMTHI_UUID;
> +
> + ioctl(fd, IOCTL_MEI_CONNECT_CLIENT, &data);
> +
> + printf("Ver=%d, MaxLen=%ld\n",
> + data.d.in_client_uuid.protocol_version,
> + data.d.in_client_uuid.max_msg_length);
> +
> + [...]
> +
> + write(fd, amthi_req_data, amthi_req_data_len);
> +
> + [...]
> +
> + read(fd, &amthi_res_data, amthi_res_data_len);
> +
> + [...]
> +
> + close(fd);
> +
> +
> +IOCTL
> +=====
> +
> +The Intel MEI Driver supports the following IOCTL commands:
> +
> +
> +:c:macro:`IOCTL_MEI_CONNECT_CLIENT`
> +-------------------------------------
> +Connect to firmware Feature (client)
> +
> +**Usage:**
> +
> +::
> +
> + struct mei_connect_client_data clientData;
> + ioctl(fd, IOCTL_MEI_CONNECT_CLIENT, &clientData);
> +
> +**Inputs:**
> + :c:type:`mei_connect_client_data` - structure contain the following
> + input field.
> +
> + :c:data:`in_client_uuid` - UUID of the FW Feature that needs to connect
> to.
> +
> +**Outputs:**
> + :c:data:`out_client_properties` - Client Properties: MTU and Protocol
> Version.
> +
> +**Error returns:**
> + | :c:macro:`EINVAL` - Wrong IOCTL Number.
> + | :c:macro:`ENODEV` - Device or Connection is not initialized or ready.
> (e.g. Wrong UUID).
> + | :c:macro:`ENOMEM` - Unable to allocate memory to client internal
> data.
> + | :c:macro:`EFAULT` - Fatal Error (e.g. Unable to access user input data).
> + | :c:macro:`EBUSY` - Connection Already Open.
> +
> +**Notes:**
> + :c:data:`max_msg_length` (MTU) in client properties describes the
> maximum
> + data that can be sent or received. (e.g. if MTU=2K, can send
> + requests up to bytes 2k and received responses up to 2k bytes).
> +
> +
> +:c:macro:`IOCTL_MEI_NOTIFY_SET`
> +-------------------------------
> +Enable or disable event notifications
> +
> +**Usage:**
> +
> +::
> +
> + uint32_t enable;
> + ioctl(fd, IOCTL_MEI_NOTIFY_SET, &enable);
> +
> +**Inputs:**
> + | :c:data:`uint32_t enable = 1;`
> + | or
> + | :c:data:`uint32_t enable[disable] = 0;`
> +
> +**Error returns:**
> + | :c:macro:`EINVAL` - Wrong IOCTL Number.
> + | :c:macro:`ENODEV` - Device is not initialized or the client not
> connected.
> + | :c:macro:`ENOMEM` - Unable to allocate memory to client internal
> data.
> + | :c:macro:`EFAULT` - Fatal Error (e.g. Unable to access user input data).
> + | :c:macro:`EOPNOTSUPP` - if the device doesn't support the feature.
> +
> +**Notes:**
> + The client must be connected in order to enable notification events.
> +
> +
> +:c:macro:`IOCTL_MEI_NOTIFY_GET`
> +-------------------------------
> +Retrieve event
> +
> +**Usage:**
> +
> +::
> +
> + uint32_t event;
> + ioctl(fd, IOCTL_MEI_NOTIFY_GET, &event);
> +
> +**Outputs:**
> + | 1 - if an event is pending.
> + | 0 - if there is no even pending.
> +
> +**Error returns:**
> + | :c:macro:`EINVAL` - Wrong IOCTL Number.
> + | :c:macro:`ENODEV` - Device is not initialized or the client not
> connected.
> + | :c:macro:`ENOMEM` - Unable to allocate memory to client internal
> data.
> + | :c:macro:`EFAULT` - Fatal Error (e.g. Unable to access user input data).
> + | :c:macro:`EOPNOTSUPP` - if the device doesn't support the feature.
> +
> +**Notes:**
> + The client must be connected and event notification has to be enabled
> + in order to receive an event.
> +
> +
> +Intel ME Applications
> +=====================
> +
> +1) Intel Local Management Service (Intel LMS)
> +
> + Applications running locally on the platform communicate with Intel AMT
> Release
> + 2.0 and later releases in the same way that network applications do via
> SOAP
> + over HTTP (deprecated starting with Release 6.0) or with WS-
> Management over
> + SOAP over HTTP. This means that some Intel AMT features can be
> accessed from a
> + local application using the same network interface as a remote
> application
> + communicating with Intel AMT over the network.
> +
> + When a local application sends a message addressed to the local Intel
> AMT host
> + name, the Intel LMS, which listens for traffic directed to the host name,
> + intercepts the message and routes it to the Intel MEI.
> + For more information:
> +
> `<http://software.intel.com/sites/manageability/AMT_Implementation_and_Re
> ference_Guide>`_
> + Under "About Intel AMT" => "Local Access"
> +
> + For downloading Intel LMS:
> +
> + `<http://software.intel.com/en-us/articles/download-the-latest-intel-a
> + mt-open-source-drivers/>`_
> +
> + The Intel LMS opens a connection using the Intel MEI driver to the Intel
> LMS
> + firmware feature using a defined UUID and then communicates with the
> feature
> + using a protocol called Intel AMT Port Forwarding Protocol (Intel APF
> protocol).
> + The protocol is used to maintain multiple sessions with Intel AMT from a
> + single application.
> +
> + See the protocol specification in the `Intel AMT Software Development
> Kit (SDK)
> +
> <http://software.intel.com/sites/manageability/AMT_Implementation_and_Ref
> erence_Guide>`_
> + Under "SDK Resources" => "Intel(R) vPro(TM) Gateway (MPS)"
> + => "Information for Intel(R) vPro(TM) Gateway Developers"
> + => "Description of the Intel AMT Port Forwarding (APF) Protocol"
> +
> +2) Intel AMT Remote configuration using a Local Agent
> +
> + A Local Agent enables IT personnel to configure Intel AMT out-of-the-box
> + without requiring installing additional data to enable setup. The remote
> + configuration process may involve an ISV-developed remote
> configuration
> + agent that runs on the host.
> + For more information:
> +
> `<http://software.intel.com/sites/manageability/AMT_Implementation_and_Re
> ference_Guide>`_
> + Under "Setup and Configuration of Intel AMT" =>
> + "SDK Tools Supporting Setup and Configuration" =>
> + "Using the Local Agent Sample"
> +
> + An open source Intel AMT configuration utility, implementing a local
> agent
> + that accesses the Intel MEI driver, can be found here:
> +
> + `<http://software.intel.com/en-us/articles/download-the-latest-intel-a
> + mt-open-source-drivers/>`
> +
> +
> +Intel AMT OS Health Watchdog
> +============================
> +
> +The Intel AMT Watchdog is an OS Health (Hang/Crash) watchdog.
> +Whenever the OS hangs or crashes, Intel AMT will send an event to any
> +subscriber to this event. This mechanism means that IT knows when a
> +platform crashes even when there is a hard failure on the host.
> +
> +The Intel AMT Watchdog is composed of two parts:
> + 1) Firmware feature - receives the heartbeats
> + and sends an event when the heartbeats stop.
> + 2) Intel MEI iAMT watchdog driver - connects to the watchdog feature,
> + configures the watchdog and sends the heartbeats.
> +
> +The Intel iAMT watchdog MEI driver uses the kernel watchdog API to
> +configure the Intel AMT Watchdog and to send heartbeats to it. The
> +default timeout of the watchdog is 120 seconds.
> +
> +If the Intel AMT is not enabled in the firmware then the watchdog
> +client won't enumerate on the me client bus and watchdog devices won't be
> exposed.
> +
> +
> +Supported Chipsets
> +==================
> +
> +| 7 Series Chipset Family
> +| 6 Series Chipset Family
> +| 5 Series Chipset Family
> +| 4 Series Chipset Family
> +| Mobile 4 Series Chipset Family
> +| ICH9
> +| 82946GZ/GL
> +| 82G35 Express
> +| 82Q963/Q965
> +| 82P965/G965
> +| Mobile PM965/GM965
> +| Mobile GME965/GLE960
> +| 82Q35 Express
> +| 82G33/G31/P35/P31 Express
> +| 82Q33 Express
> +| 82X38/X48 Express
> +
> +---
> +linux-mei@linux.intel.com
> diff --git a/Documentation/misc-devices/mei/mei.txt b/Documentation/misc-
> devices/mei/mei.txt
> deleted file mode 100644
> index 2b80a0cd621f..000000000000
> --- a/Documentation/misc-devices/mei/mei.txt
> +++ /dev/null
> @@ -1,266 +0,0 @@
> -Intel(R) Management Engine Interface (Intel(R) MEI) -
> ===================================================
> -
> -Introduction
> -============
> -
> -The Intel Management Engine (Intel ME) is an isolated and protected
> computing -resource (Co-processor) residing inside certain Intel chipsets. The
> Intel ME -provides support for computer/IT management features. The feature
> set -depends on the Intel chipset SKU.
> -
> -The Intel Management Engine Interface (Intel MEI, previously known as HECI)
> -is the interface between the Host and Intel ME. This interface is exposed -to
> the host as a PCI device. The Intel MEI Driver is in charge of the -
> communication channel between a host application and the Intel ME feature.
> -
> -Each Intel ME feature (Intel ME Client) is addressed by a GUID/UUID and -each
> client has its own protocol. The protocol is message-based with a -header and
> payload up to 512 bytes.
> -
> -Prominent usage of the Intel ME Interface is to communicate with Intel(R) -
> Active Management Technology (Intel AMT) implemented in firmware running
> on -the Intel ME.
> -
> -Intel AMT provides the ability to manage a host remotely out-of-band (OOB) -
> even when the operating system running on the host processor has crashed or -
> is in a sleep state.
> -
> -Some examples of Intel AMT usage are:
> - - Monitoring hardware state and platform components
> - - Remote power off/on (useful for green computing or overnight IT
> - maintenance)
> - - OS updates
> - - Storage of useful platform information such as software assets
> - - Built-in hardware KVM
> - - Selective network isolation of Ethernet and IP protocol flows based
> - on policies set by a remote management console
> - - IDE device redirection from remote management console
> -
> -Intel AMT (OOB) communication is based on SOAP (deprecated -starting with
> Release 6.0) over HTTP/S or WS-Management protocol over -HTTP/S that are
> received from a remote management console application.
> -
> -For more information about Intel AMT:
> -
> http://software.intel.com/sites/manageability/AMT_Implementation_and_Refe
> rence_Guide
> -
> -
> -Intel MEI Driver
> -================
> -
> -The driver exposes a misc device called /dev/mei.
> -
> -An application maintains communication with an Intel ME feature while -
> /dev/mei is open. The binding to a specific feature is performed by calling -
> MEI_CONNECT_CLIENT_IOCTL, which passes the desired UUID.
> -The number of instances of an Intel ME feature that can be opened -at the
> same time depends on the Intel ME feature, but most of the -features allow
> only a single instance.
> -
> -The Intel AMT Host Interface (Intel AMTHI) feature supports multiple -
> simultaneous user connected applications. The Intel MEI driver -handles this
> internally by maintaining request queues for the applications.
> -
> -The driver is transparent to data that are passed between firmware feature -
> and host application.
> -
> -Because some of the Intel ME features can change the system -configuration,
> the driver by default allows only a privileged -user to access it.
> -
> -A code snippet for an application communicating with Intel AMTHI client:
> -
> - struct mei_connect_client_data data;
> - fd = open(MEI_DEVICE);
> -
> - data.d.in_client_uuid = AMTHI_UUID;
> -
> - ioctl(fd, IOCTL_MEI_CONNECT_CLIENT, &data);
> -
> - printf("Ver=%d, MaxLen=%ld\n",
> - data.d.in_client_uuid.protocol_version,
> - data.d.in_client_uuid.max_msg_length);
> -
> - [...]
> -
> - write(fd, amthi_req_data, amthi_req_data_len);
> -
> - [...]
> -
> - read(fd, &amthi_res_data, amthi_res_data_len);
> -
> - [...]
> - close(fd);
> -
> -
> -IOCTL
> -=====
> -
> -The Intel MEI Driver supports the following IOCTL commands:
> - IOCTL_MEI_CONNECT_CLIENT Connect to firmware Feature (client).
> -
> - usage:
> - struct mei_connect_client_data clientData;
> - ioctl(fd, IOCTL_MEI_CONNECT_CLIENT, &clientData);
> -
> - inputs:
> - mei_connect_client_data struct contain the following
> - input field:
> -
> - in_client_uuid - UUID of the FW Feature that needs
> - to connect to.
> - outputs:
> - out_client_properties - Client Properties: MTU and Protocol
> Version.
> -
> - error returns:
> - EINVAL Wrong IOCTL Number
> - ENODEV Device or Connection is not initialized or
> ready.
> - (e.g. Wrong UUID)
> - ENOMEM Unable to allocate memory to client internal
> data.
> - EFAULT Fatal Error (e.g. Unable to access user input data)
> - EBUSY Connection Already Open
> -
> - Notes:
> - max_msg_length (MTU) in client properties describes the maximum
> - data that can be sent or received. (e.g. if MTU=2K, can send
> - requests up to bytes 2k and received responses up to 2k bytes).
> -
> - IOCTL_MEI_NOTIFY_SET: enable or disable event notifications
> -
> - Usage:
> - uint32_t enable;
> - ioctl(fd, IOCTL_MEI_NOTIFY_SET, &enable);
> -
> - Inputs:
> - uint32_t enable = 1;
> - or
> - uint32_t enable[disable] = 0;
> -
> - Error returns:
> - EINVAL Wrong IOCTL Number
> - ENODEV Device is not initialized or the client not
> connected
> - ENOMEM Unable to allocate memory to client internal
> data.
> - EFAULT Fatal Error (e.g. Unable to access user input data)
> - EOPNOTSUPP if the device doesn't support the feature
> -
> - Notes:
> - The client must be connected in order to enable notification events
> -
> -
> - IOCTL_MEI_NOTIFY_GET : retrieve event
> -
> - Usage:
> - uint32_t event;
> - ioctl(fd, IOCTL_MEI_NOTIFY_GET, &event);
> -
> - Outputs:
> - 1 - if an event is pending
> - 0 - if there is no even pending
> -
> - Error returns:
> - EINVAL Wrong IOCTL Number
> - ENODEV Device is not initialized or the client not
> connected
> - ENOMEM Unable to allocate memory to client internal
> data.
> - EFAULT Fatal Error (e.g. Unable to access user input data)
> - EOPNOTSUPP if the device doesn't support the feature
> -
> - Notes:
> - The client must be connected and event notification has to be enabled
> - in order to receive an event
> -
> -
> -Intel ME Applications
> -=====================
> -
> - 1) Intel Local Management Service (Intel LMS)
> -
> - Applications running locally on the platform communicate with Intel
> AMT Release
> - 2.0 and later releases in the same way that network applications do
> via SOAP
> - over HTTP (deprecated starting with Release 6.0) or with WS-
> Management over
> - SOAP over HTTP. This means that some Intel AMT features can be
> accessed from a
> - local application using the same network interface as a remote
> application
> - communicating with Intel AMT over the network.
> -
> - When a local application sends a message addressed to the local Intel
> AMT host
> - name, the Intel LMS, which listens for traffic directed to the host
> name,
> - intercepts the message and routes it to the Intel MEI.
> - For more information:
> -
> http://software.intel.com/sites/manageability/AMT_Implementation_and_Refe
> rence_Guide
> - Under "About Intel AMT" => "Local Access"
> -
> - For downloading Intel LMS:
> - http://software.intel.com/en-us/articles/download-the-latest-intel-
> amt-open-source-drivers/
> -
> - The Intel LMS opens a connection using the Intel MEI driver to the
> Intel LMS
> - firmware feature using a defined UUID and then communicates with
> the feature
> - using a protocol called Intel AMT Port Forwarding Protocol (Intel APF
> protocol).
> - The protocol is used to maintain multiple sessions with Intel AMT
> from a
> - single application.
> -
> - See the protocol specification in the Intel AMT Software Development
> Kit (SDK)
> -
> http://software.intel.com/sites/manageability/AMT_Implementation_and_Refe
> rence_Guide
> - Under "SDK Resources" => "Intel(R) vPro(TM) Gateway (MPS)"
> - => "Information for Intel(R) vPro(TM) Gateway Developers"
> - => "Description of the Intel AMT Port Forwarding (APF) Protocol"
> -
> - 2) Intel AMT Remote configuration using a Local Agent
> -
> - A Local Agent enables IT personnel to configure Intel AMT out-of-the-
> box
> - without requiring installing additional data to enable setup. The
> remote
> - configuration process may involve an ISV-developed remote
> configuration
> - agent that runs on the host.
> - For more information:
> -
> http://software.intel.com/sites/manageability/AMT_Implementation_and_Refe
> rence_Guide
> - Under "Setup and Configuration of Intel AMT" =>
> - "SDK Tools Supporting Setup and Configuration" =>
> - "Using the Local Agent Sample"
> -
> - An open source Intel AMT configuration utility, implementing a local
> agent
> - that accesses the Intel MEI driver, can be found here:
> - http://software.intel.com/en-us/articles/download-the-latest-intel-
> amt-open-source-drivers/
> -
> -
> -Intel AMT OS Health Watchdog
> -============================
> -
> -The Intel AMT Watchdog is an OS Health (Hang/Crash) watchdog.
> -Whenever the OS hangs or crashes, Intel AMT will send an event -to any
> subscriber to this event. This mechanism means that -IT knows when a platform
> crashes even when there is a hard failure on the host.
> -
> -The Intel AMT Watchdog is composed of two parts:
> - 1) Firmware feature - receives the heartbeats
> - and sends an event when the heartbeats stop.
> - 2) Intel MEI iAMT watchdog driver - connects to the watchdog feature,
> - configures the watchdog and sends the heartbeats.
> -
> -The Intel iAMT watchdog MEI driver uses the kernel watchdog API to configure
> -the Intel AMT Watchdog and to send heartbeats to it. The default timeout of
> the -watchdog is 120 seconds.
> -
> -If the Intel AMT is not enabled in the firmware then the watchdog client won't
> enumerate -on the me client bus and watchdog devices won't be exposed.
> -
> -
> -Supported Chipsets
> -==================
> -
> -7 Series Chipset Family
> -6 Series Chipset Family
> -5 Series Chipset Family
> -4 Series Chipset Family
> -Mobile 4 Series Chipset Family
> -ICH9
> -82946GZ/GL
> -82G35 Express
> -82Q963/Q965
> -82P965/G965
> -Mobile PM965/GM965
> -Mobile GME965/GLE960
> -82Q35 Express
> -82G33/G31/P35/P31 Express
> -82Q33 Express
> -82X38/X48 Express
> -
> ----
> -linux-mei@linux.intel.com
> --
> 2.17.1
^ permalink raw reply
* Re: [PATCH 0/2] hwspinlock: add the 'in_atomic' API
From: Bjorn Andersson @ 2019-06-30 4:08 UTC (permalink / raw)
To: Fabien Dessenne
Cc: Ohad Ben-Cohen, Jonathan Corbet, linux-remoteproc, linux-doc,
linux-kernel, Benjamin Gaignard, Alexandre Torgue
In-Reply-To: <1551974303-24542-1-git-send-email-fabien.dessenne@st.com>
On Thu 07 Mar 07:58 PST 2019, Fabien Dessenne wrote:
> In its current implementation, the hwspinlock framework relies on jiffies
> to handle the timeout of the hwspin_lock_timeout_xxx() API.
> In an atomic context (or more precisely when irq are disabled) jiffies does not
> increase, which prevents the timeout to reach its target value (infinite loop).
>
> Note that there is already an hwspinlock user that runs in atomic context
> (drivers/irqchip/irq-stm32-exti.c) and that has to handle by itself the
> timeout.
>
> The first patch of the series completes the Documentation (the 'raw' API
> is not documented), and the second patch provides with the 'in_atomic' API.
>
Applied
Thanks,
Bjorn
> Fabien Dessenne (2):
> hwspinlock: document the hwspinlock 'raw' API
> hwspinlock: add the 'in_atomic' API
>
> Documentation/hwspinlock.txt | 81 ++++++++++++++++++++++++++++++++++++
> drivers/hwspinlock/hwspinlock_core.c | 43 +++++++++++++------
> include/linux/hwspinlock.h | 61 +++++++++++++++++++++++++--
> 3 files changed, 169 insertions(+), 16 deletions(-)
>
> --
> 2.7.4
>
^ permalink raw reply
* Re: [PATCH] binfmt_elf: Extract .note.gnu.property from an ELF file
From: Andy Lutomirski @ 2019-06-29 23:51 UTC (permalink / raw)
To: Florian Weimer
Cc: Andy Lutomirski, Dave Martin, Yu-cheng Yu, X86 ML, H. Peter Anvin,
Thomas Gleixner, Ingo Molnar, LKML, open list:DOCUMENTATION,
Linux-MM, linux-arch, Linux API, Arnd Bergmann, Balbir Singh,
Cyrill Gorcunov, Dave Hansen, Eugene Syromiatnikov, H.J. Lu,
Jann Horn, Jonathan Corbet, Kees Cook, Mike Kravetz, Nadav Amit,
Oleg Nesterov, Pavel Machek, Peter Zijlstra, Randy Dunlap,
Ravi V. Shankar, Vedvyas Shanbhogue, Szabolcs Nagy, libc-alpha
In-Reply-To: <87ef3fweoq.fsf@oldenburg2.str.redhat.com>
On Thu, Jun 27, 2019 at 2:39 AM Florian Weimer <fweimer@redhat.com> wrote:
>
> * Andy Lutomirski:
>
> > Also, I don't think there's any actual requirement that the upstream
> > kernel recognize existing CET-enabled RHEL 8 binaries as being
> > CET-enabled. I tend to think that RHEL 8 jumped the gun here.
>
> The ABI was supposed to be finalized and everyone involved thought it
> had been reviewed by the GNU gABI community and other interested
> parties. It had been included in binutils for several releases.
>
> From my point of view, the kernel is just a consumer of the ABI. The
> kernel would not change an instruction encoding if it doesn't like it
> for some reason, either.
I read the only relevant gABI thing I could find easily, and it seems
to document the "gnu property" thing. I have no problem with that.
>
> > While the upstream kernel should make some reasonble effort to make
> > sure that RHEL 8 binaries will continue to run, I don't see why we
> > need to go out of our way to keep the full set of mitigations
> > available for binaries that were developed against a non-upstream
> > kernel.
>
> They were developed against the ABI specification.
>
> I do not have a strong opinion what the kernel should do going forward.
> I just want to make clear what happened.
I admit that I'm not really clear on exactly what RHEL 8 shipped.
Some of this stuff is very much an ELF ABI that belongs to the
toolchain, but some if it is kernel API. For example, the IBT legacy
bitmap API is very much in flux, and I don't think anything credible
has been submitted for upstream inclusion. Does RHEL 8's glibc
attempt to cope with the case where some libraries are CET-compatible
and some are not? If so, how does this work? What, if any, services
does the RHEL 8 kernel provide in this direction?
^ permalink raw reply
* Re: [RFC PATCH 3/3] Prevent user from writing to IBT bitmap.
From: Andy Lutomirski @ 2019-06-29 23:44 UTC (permalink / raw)
To: Yu-cheng Yu
Cc: X86 ML, H. Peter Anvin, Thomas Gleixner, Ingo Molnar, LKML,
open list:DOCUMENTATION, Linux-MM, linux-arch, Linux API,
Arnd Bergmann, Balbir Singh, Borislav Petkov, Cyrill Gorcunov,
Dave Hansen, Eugene Syromiatnikov, Florian Weimer, H.J. Lu,
Jann Horn, Jonathan Corbet, Kees Cook, Mike Kravetz, Nadav Amit,
Oleg Nesterov, Pavel Machek, Peter Zijlstra, Randy Dunlap,
Ravi V. Shankar, Vedvyas Shanbhogue, Dave Martin
In-Reply-To: <20190628194158.2431-3-yu-cheng.yu@intel.com>
On Fri, Jun 28, 2019 at 12:50 PM Yu-cheng Yu <yu-cheng.yu@intel.com> wrote:
>
> The IBT bitmap is visiable from user-mode, but not writable.
>
> Signed-off-by: Yu-cheng Yu <yu-cheng.yu@intel.com>
>
> ---
> arch/x86/mm/fault.c | 7 +++++++
> 1 file changed, 7 insertions(+)
>
> diff --git a/arch/x86/mm/fault.c b/arch/x86/mm/fault.c
> index 59f4f66e4f2e..231196abb62e 100644
> --- a/arch/x86/mm/fault.c
> +++ b/arch/x86/mm/fault.c
> @@ -1454,6 +1454,13 @@ void do_user_addr_fault(struct pt_regs *regs,
> * we can handle it..
> */
> good_area:
> +#define USER_MODE_WRITE (FAULT_FLAG_WRITE | FAULT_FLAG_USER)
> + if (((flags & USER_MODE_WRITE) == USER_MODE_WRITE) &&
> + (vma->vm_flags & VM_IBT)) {
> + bad_area_access_error(regs, hw_error_code, address, vma);
> + return;
> + }
> +
Just make the VMA have VM_WRITE and VM_MAYWRITE clear. No new code
like this should be required.
^ permalink raw reply
* Re: [RFC PATCH 2/3] Introduce arch_prctl(ARCH_X86_CET_MARK_LEGACY_CODE)
From: Andy Lutomirski @ 2019-06-29 23:43 UTC (permalink / raw)
To: Yu-cheng Yu
Cc: X86 ML, H. Peter Anvin, Thomas Gleixner, Ingo Molnar, LKML,
open list:DOCUMENTATION, Linux-MM, linux-arch, Linux API,
Arnd Bergmann, Balbir Singh, Borislav Petkov, Cyrill Gorcunov,
Dave Hansen, Eugene Syromiatnikov, Florian Weimer, H.J. Lu,
Jann Horn, Jonathan Corbet, Kees Cook, Mike Kravetz, Nadav Amit,
Oleg Nesterov, Pavel Machek, Peter Zijlstra, Randy Dunlap,
Ravi V. Shankar, Vedvyas Shanbhogue, Dave Martin
In-Reply-To: <20190628194158.2431-2-yu-cheng.yu@intel.com>
> On Jun 28, 2019, at 12:41 PM, Yu-cheng Yu <yu-cheng.yu@intel.com> wrote:
>
> The CET legacy code bitmap covers the whole user-mode address space and is
> located at the top of the user-mode address space. It is allocated only
> when the first time arch_prctl(ARCH_X86_MARK_LEGACY_CODE) is called from
> an application.
>
> Introduce:
>
> arch_prctl(ARCH_X86_MARK_LEGACY_CODE, unsigned long *buf)
> Mark an address range as IBT legacy code.
How about defining a struct for this?
The change log should discuss where the bitmap goes and how it’s allocated.
> +static int alloc_bitmap(void)
> +{
> + unsigned long addr;
> + u64 msr_ia32_u_cet;
> +
> + addr = do_mmap_locked(NULL, IBT_BITMAP_ADDR, IBT_BITMAP_SIZE,
> + PROT_READ | PROT_WRITE,
> + MAP_ANONYMOUS | MAP_PRIVATE | MAP_FIXED_NOREPLACE,
> + VM_IBT | VM_NORESERVE, NULL);
> +
> + if (IS_ERR((void *)addr))
> + return addr;
> +
> + current->thread.cet.ibt_bitmap_addr = addr;
addr is a constant. Why are you storing it? If it ends up not being
constant, you should wire up mremap like the vDSO does.
> +static int set_user_bits(unsigned long __user *buf, unsigned long buf_size,
> + unsigned long start_bit, unsigned long end_bit, unsigned long set)
> +{
> + unsigned long start_ul, end_ul, total_ul;
> + int i, j, r;
> +
> + if (round_up(end_bit, BITS_PER_BYTE) / BITS_PER_BYTE > buf_size)
> + end_bit = buf_size * BITS_PER_BYTE - 1;
> +
> + start_ul = start_bit / BITS_PER_LONG;
> + end_ul = end_bit / BITS_PER_LONG;
> + total_ul = (end_ul - start_ul + 1);
> +
> + i = start_bit % BITS_PER_LONG;
> + j = end_bit % BITS_PER_LONG;
> +
> + r = 0;
> + put_user_try {
put_user_try is obsolete. Just use get_user(), etc.
Also, I must be missing something fundamental, because this series
claims that user code can't write directly to the bitmap. This means
that this entire function shouldn't work at all.
^ permalink raw reply
* Re: [PATCH 10/10] tools/power/x86: A tool to validate Intel Speed Select commands
From: Srinivas Pandruvada @ 2019-06-29 22:17 UTC (permalink / raw)
To: Andy Shevchenko
Cc: Darren Hart, Andy Shevchenko, Andriy Shevchenko, Jonathan Corbet,
Rafael J. Wysocki, Alan Cox, Len Brown, prarit, darcari,
Linux Documentation List, Linux Kernel Mailing List,
Platform Driver
In-Reply-To: <CAHp75VduxgJ6k4J2bB83Xbif0D0AGkxyDAdwvN64ybxdxXHXcw@mail.gmail.com>
On Sat, 2019-06-29 at 19:03 +0300, Andy Shevchenko wrote:
> On Sat, Jun 29, 2019 at 5:53 PM Srinivas Pandruvada
> <srinivas.pandruvada@linux.intel.com> wrote:
> > On Sat, 2019-06-29 at 17:31 +0300, Andy Shevchenko wrote:
> > > On Thu, Jun 27, 2019 at 1:39 AM Srinivas Pandruvada
> > > <srinivas.pandruvada@linux.intel.com> wrote:
> > > I need an Ack from tools/power maintainer(s) for this.
> > > Also see below.
> >
> > MAINTAINER file doesn't call for any special name in this folder.
>
> And this tells me perhaps this driver needs a MAINTAINER record?
I will submit a MAINTAINER file update. I was waiting for reviews.
Thanks,
Srinivas
>
> > $./scripts/get_maintainer.pl 0010-tools-power-x86-A-tool-to-
> > validate-
> > Intel-Speed-Selec.patch
> > Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
> > (commit_signer:1/1=100%,authored:1/1=100%,added_lines:31/31=100%,ad
> > ded_
> > lines:231/231=100%,added_lines:1607/1607=100%,added_lines:721/721=1
> > 00%,
> > added_lines:479/479=100%)
> > linux-kernel@vger.kernel.org (open list)
> >
> > Len and Rafael can you ACK this tool patch?
>
>
^ permalink raw reply
* [PATCH] Documentation: misc-devices: mei: Convert mei txt files to reST
From: Shreeya Patel @ 2019-06-29 21:32 UTC (permalink / raw)
To: skhan, corbet, tomas.winkler, linux-doc, linux-kernel,
linux-kernel-mentees
Convert the MEI misc device's documentation files from .txt to
reStructuredText format. Make a minor change of correcting the
wrong macro name MEI_CONNECT_CLIENT_IOCTL to IOCTL_MEI_CONNECT_CLIENT.
Add an index file in mei as there are two sections for it in the
documentation.
Signed-off-by: Shreeya Patel <shreeya.patel23498@gmail.com>
---
I am not sure if I have placed the Documentation in the right place
so I would like to get some suggestions from the MAINTAINERS on this
part.
Documentation/misc-devices/index.rst | 1 +
Documentation/misc-devices/mei/index.rst | 15 +
.../misc-devices/mei/mei-client-bus.rst | 151 +++++++++
.../misc-devices/mei/mei-client-bus.txt | 141 ---------
Documentation/misc-devices/mei/mei.rst | 289 ++++++++++++++++++
Documentation/misc-devices/mei/mei.txt | 266 ----------------
6 files changed, 456 insertions(+), 407 deletions(-)
create mode 100644 Documentation/misc-devices/mei/index.rst
create mode 100644 Documentation/misc-devices/mei/mei-client-bus.rst
delete mode 100644 Documentation/misc-devices/mei/mei-client-bus.txt
create mode 100644 Documentation/misc-devices/mei/mei.rst
delete mode 100644 Documentation/misc-devices/mei/mei.txt
diff --git a/Documentation/misc-devices/index.rst b/Documentation/misc-devices/index.rst
index dfd1f45a3127..e788a12b2b19 100644
--- a/Documentation/misc-devices/index.rst
+++ b/Documentation/misc-devices/index.rst
@@ -15,3 +15,4 @@ fit into other categories.
:maxdepth: 2
ibmvmc
+ mei/index
diff --git a/Documentation/misc-devices/mei/index.rst b/Documentation/misc-devices/mei/index.rst
new file mode 100644
index 000000000000..3018098ad075
--- /dev/null
+++ b/Documentation/misc-devices/mei/index.rst
@@ -0,0 +1,15 @@
+.. SPDX-License-Identifier: GPL-2.0
+
+=================================================================
+Intel(R) Management Engine Interface Kernel Driver (Intel(R) MEI)
+=================================================================
+
+.. class:: toc-title
+
+ Table of contents
+
+.. toctree::
+ :maxdepth: 2
+
+ mei
+ mei-client-bus
diff --git a/Documentation/misc-devices/mei/mei-client-bus.rst b/Documentation/misc-devices/mei/mei-client-bus.rst
new file mode 100644
index 000000000000..82d455afae78
--- /dev/null
+++ b/Documentation/misc-devices/mei/mei-client-bus.rst
@@ -0,0 +1,151 @@
+.. SPDX-License-Identifier: GPL-2.0
+
+==============================================
+Intel(R) Management Engine (ME) Client bus API
+==============================================
+
+
+Rationale
+=========
+
+MEI misc character device is useful for dedicated applications to send and receive
+data to the many FW appliance found in Intel's ME from the user space.
+However for some of the ME functionalities it make sense to leverage existing software
+stack and expose them through existing kernel subsystems.
+
+In order to plug seamlessly into the kernel device driver model we add kernel virtual
+bus abstraction on top of the MEI driver. This allows implementing linux kernel drivers
+for the various MEI features as a stand alone entities found in their respective subsystem.
+Existing device drivers can even potentially be re-used by adding an MEI CL bus layer to
+the existing code.
+
+
+MEI CL bus API
+==============
+
+A driver implementation for an MEI Client is very similar to existing bus
+based device drivers. The driver registers itself as an MEI CL bus driver through
+the :c:type:`mei_cl_driver` structure:
+
+::
+
+ struct mei_cl_driver {
+ struct device_driver driver;
+ const char *name;
+
+ const struct mei_cl_device_id *id_table;
+
+ int (*probe)(struct mei_cl_device *dev, const struct mei_cl_id *id);
+ int (*remove)(struct mei_cl_device *dev);
+ };
+
+ struct mei_cl_id {
+ char name[MEI_NAME_SIZE];
+ kernel_ulong_t driver_info;
+ };
+
+
+The :c:type:`mei_cl_id` structure allows the driver to bind itself against a device name.
+
+To actually register a driver on the ME Client bus one must call the :c:func:`mei_cl_add_driver()`
+API. This is typically called at module init time.
+
+Once registered on the ME Client bus, a driver will typically try to do some I/O on
+this bus and this should be done through the :c:func:`mei_cl_send()` and :c:func:`mei_cl_recv()`
+routines. The latter is synchronous (blocks and sleeps until data shows up).
+In order for drivers to be notified of pending events waiting for them (e.g.
+an Rx event) they can register an event handler through the
+:c:func:`mei_cl_register_event_cb()` routine. Currently only the :c:macro:`MEI_EVENT_RX` event
+will trigger an event handler call and the driver implementation is supposed
+to call :c:func:`mei_recv()` from the event handler in order to fetch the pending
+received buffers.
+
+
+Example
+=======
+
+As a theoretical example let's pretend the ME comes with a "contact" NFC IP.
+The driver init and exit routines for this device would look like:
+
+::
+
+ #define CONTACT_DRIVER_NAME "contact"
+
+ static struct mei_cl_device_id contact_mei_cl_tbl[] = {
+ { CONTACT_DRIVER_NAME, },
+ /* required last entry */
+ { }
+ };
+ MODULE_DEVICE_TABLE(mei_cl, contact_mei_cl_tbl);
+
+ static struct mei_cl_driver contact_driver = {
+ .id_table = contact_mei_tbl,
+ .name = CONTACT_DRIVER_NAME,
+ .probe = contact_probe,
+ .remove = contact_remove,
+ };
+
+ static int contact_init(void)
+ {
+ int r;
+
+ r = mei_cl_driver_register(&contact_driver);
+ if (r) {
+ pr_err(CONTACT_DRIVER_NAME ": driver registration failed\n");
+ return r;
+ }
+
+ return 0;
+ }
+
+ static void __exit contact_exit(void)
+ {
+ mei_cl_driver_unregister(&contact_driver);
+ }
+
+ module_init(contact_init);
+ module_exit(contact_exit);
+
+And the driver's simplified probe routine would look like that:
+
+::
+
+ int contact_probe(struct mei_cl_device *dev, struct mei_cl_device_id *id)
+ {
+ struct contact_driver *contact;
+
+ [...]
+ mei_cl_enable_device(dev);
+
+ mei_cl_register_event_cb(dev, contact_event_cb, contact);
+
+ return 0;
+ }
+
+In the probe routine the driver first enable the MEI device and then registers
+an ME bus event handler which is as close as it can get to registering a
+threaded IRQ handler.
+The handler implementation will typically call some I/O routine depending on
+the pending events:
+
+::
+
+ #define MAX_NFC_PAYLOAD 128
+
+ static void contact_event_cb(struct mei_cl_device *dev, u32 events,
+ void *context)
+ {
+ struct contact_driver *contact = context;
+
+ if (events & BIT(MEI_EVENT_RX)) {
+ u8 payload[MAX_NFC_PAYLOAD];
+ int payload_size;
+
+ payload_size = mei_recv(dev, payload, MAX_NFC_PAYLOAD);
+ if (payload_size <= 0)
+ return;
+
+ /* Hook to the NFC subsystem */
+ nfc_hci_recv_frame(contact->hdev, payload, payload_size);
+ }
+ }
diff --git a/Documentation/misc-devices/mei/mei-client-bus.txt b/Documentation/misc-devices/mei/mei-client-bus.txt
deleted file mode 100644
index 743be4ec8989..000000000000
--- a/Documentation/misc-devices/mei/mei-client-bus.txt
+++ /dev/null
@@ -1,141 +0,0 @@
-Intel(R) Management Engine (ME) Client bus API
-==============================================
-
-
-Rationale
-=========
-
-MEI misc character device is useful for dedicated applications to send and receive
-data to the many FW appliance found in Intel's ME from the user space.
-However for some of the ME functionalities it make sense to leverage existing software
-stack and expose them through existing kernel subsystems.
-
-In order to plug seamlessly into the kernel device driver model we add kernel virtual
-bus abstraction on top of the MEI driver. This allows implementing linux kernel drivers
-for the various MEI features as a stand alone entities found in their respective subsystem.
-Existing device drivers can even potentially be re-used by adding an MEI CL bus layer to
-the existing code.
-
-
-MEI CL bus API
-==============
-
-A driver implementation for an MEI Client is very similar to existing bus
-based device drivers. The driver registers itself as an MEI CL bus driver through
-the mei_cl_driver structure:
-
-struct mei_cl_driver {
- struct device_driver driver;
- const char *name;
-
- const struct mei_cl_device_id *id_table;
-
- int (*probe)(struct mei_cl_device *dev, const struct mei_cl_id *id);
- int (*remove)(struct mei_cl_device *dev);
-};
-
-struct mei_cl_id {
- char name[MEI_NAME_SIZE];
- kernel_ulong_t driver_info;
-};
-
-The mei_cl_id structure allows the driver to bind itself against a device name.
-
-To actually register a driver on the ME Client bus one must call the mei_cl_add_driver()
-API. This is typically called at module init time.
-
-Once registered on the ME Client bus, a driver will typically try to do some I/O on
-this bus and this should be done through the mei_cl_send() and mei_cl_recv()
-routines. The latter is synchronous (blocks and sleeps until data shows up).
-In order for drivers to be notified of pending events waiting for them (e.g.
-an Rx event) they can register an event handler through the
-mei_cl_register_event_cb() routine. Currently only the MEI_EVENT_RX event
-will trigger an event handler call and the driver implementation is supposed
-to call mei_recv() from the event handler in order to fetch the pending
-received buffers.
-
-
-Example
-=======
-
-As a theoretical example let's pretend the ME comes with a "contact" NFC IP.
-The driver init and exit routines for this device would look like:
-
-#define CONTACT_DRIVER_NAME "contact"
-
-static struct mei_cl_device_id contact_mei_cl_tbl[] = {
- { CONTACT_DRIVER_NAME, },
-
- /* required last entry */
- { }
-};
-MODULE_DEVICE_TABLE(mei_cl, contact_mei_cl_tbl);
-
-static struct mei_cl_driver contact_driver = {
- .id_table = contact_mei_tbl,
- .name = CONTACT_DRIVER_NAME,
-
- .probe = contact_probe,
- .remove = contact_remove,
-};
-
-static int contact_init(void)
-{
- int r;
-
- r = mei_cl_driver_register(&contact_driver);
- if (r) {
- pr_err(CONTACT_DRIVER_NAME ": driver registration failed\n");
- return r;
- }
-
- return 0;
-}
-
-static void __exit contact_exit(void)
-{
- mei_cl_driver_unregister(&contact_driver);
-}
-
-module_init(contact_init);
-module_exit(contact_exit);
-
-And the driver's simplified probe routine would look like that:
-
-int contact_probe(struct mei_cl_device *dev, struct mei_cl_device_id *id)
-{
- struct contact_driver *contact;
-
- [...]
- mei_cl_enable_device(dev);
-
- mei_cl_register_event_cb(dev, contact_event_cb, contact);
-
- return 0;
-}
-
-In the probe routine the driver first enable the MEI device and then registers
-an ME bus event handler which is as close as it can get to registering a
-threaded IRQ handler.
-The handler implementation will typically call some I/O routine depending on
-the pending events:
-
-#define MAX_NFC_PAYLOAD 128
-
-static void contact_event_cb(struct mei_cl_device *dev, u32 events,
- void *context)
-{
- struct contact_driver *contact = context;
-
- if (events & BIT(MEI_EVENT_RX)) {
- u8 payload[MAX_NFC_PAYLOAD];
- int payload_size;
-
- payload_size = mei_recv(dev, payload, MAX_NFC_PAYLOAD);
- if (payload_size <= 0)
- return;
-
- /* Hook to the NFC subsystem */
- nfc_hci_recv_frame(contact->hdev, payload, payload_size);
- }
-}
diff --git a/Documentation/misc-devices/mei/mei.rst b/Documentation/misc-devices/mei/mei.rst
new file mode 100644
index 000000000000..e91ac2570b4d
--- /dev/null
+++ b/Documentation/misc-devices/mei/mei.rst
@@ -0,0 +1,289 @@
+.. SPDX-License-Identifier: GPL-2.0
+
+====================================
+Intel(R) Management Engine Interface
+====================================
+
+Introduction
+============
+
+The Intel Management Engine (Intel ME) is an isolated and protected computing
+resource (Co-processor) residing inside certain Intel chipsets. The Intel ME
+provides support for computer/IT management features. The feature set
+depends on the Intel chipset SKU.
+
+The Intel Management Engine Interface (Intel MEI, previously known as HECI)
+is the interface between the Host and Intel ME. This interface is exposed
+to the host as a PCI device. The Intel MEI Driver is in charge of the
+communication channel between a host application and the Intel ME feature.
+
+Each Intel ME feature (Intel ME Client) is addressed by a GUID/UUID and
+each client has its own protocol. The protocol is message-based with a
+header and payload up to 512 bytes.
+
+Prominent usage of the Intel ME Interface is to communicate with Intel(R)
+Active Management Technology (Intel AMT) implemented in firmware running on
+the Intel ME.
+
+Intel AMT provides the ability to manage a host remotely out-of-band (OOB)
+even when the operating system running on the host processor has crashed or
+is in a sleep state.
+
+Some examples of Intel AMT usage are:
+ * Monitoring hardware state and platform components
+ * Remote power off/on (useful for green computing or overnight IT
+ maintenance)
+ * OS updates
+ * Storage of useful platform information such as software assets
+ * Built-in hardware KVM
+ * Selective network isolation of Ethernet and IP protocol flows based
+ on policies set by a remote management console
+ * IDE device redirection from remote management console
+
+Intel AMT (OOB) communication is based on SOAP (deprecated
+starting with Release 6.0) over HTTP/S or WS-Management protocol over
+HTTP/S that are received from a remote management console application.
+
+For more information about Intel AMT:
+`<http://software.intel.com/sites/manageability/AMT_Implementation_and_Reference_Guide>`_
+
+
+Intel MEI Driver
+================
+
+The driver exposes a misc device called :file:`/dev/mei`.
+
+An application maintains communication with an Intel ME feature while
+:file:`/dev/mei` is open. The binding to a specific feature is performed by calling
+:c:macro:`IOCTL_MEI_CONNECT_CLIENT`, which passes the desired UUID.
+The number of instances of an Intel ME feature that can be opened
+at the same time depends on the Intel ME feature, but most of the
+features allow only a single instance.
+
+The Intel AMT Host Interface (Intel AMTHI) feature supports multiple
+simultaneous user connected applications. The Intel MEI driver
+handles this internally by maintaining request queues for the applications.
+
+The driver is transparent to data that are passed between firmware feature
+and host application.
+
+Because some of the Intel ME features can change the system
+configuration, the driver by default allows only a privileged
+user to access it.
+
+A code snippet for an application communicating with Intel AMTHI client:
+
+::
+
+ struct mei_connect_client_data data;
+ fd = open(MEI_DEVICE);
+
+ data.d.in_client_uuid = AMTHI_UUID;
+
+ ioctl(fd, IOCTL_MEI_CONNECT_CLIENT, &data);
+
+ printf("Ver=%d, MaxLen=%ld\n",
+ data.d.in_client_uuid.protocol_version,
+ data.d.in_client_uuid.max_msg_length);
+
+ [...]
+
+ write(fd, amthi_req_data, amthi_req_data_len);
+
+ [...]
+
+ read(fd, &amthi_res_data, amthi_res_data_len);
+
+ [...]
+
+ close(fd);
+
+
+IOCTL
+=====
+
+The Intel MEI Driver supports the following IOCTL commands:
+
+
+:c:macro:`IOCTL_MEI_CONNECT_CLIENT`
+-------------------------------------
+Connect to firmware Feature (client)
+
+**Usage:**
+
+::
+
+ struct mei_connect_client_data clientData;
+ ioctl(fd, IOCTL_MEI_CONNECT_CLIENT, &clientData);
+
+**Inputs:**
+ :c:type:`mei_connect_client_data` - structure contain the following
+ input field.
+
+ :c:data:`in_client_uuid` - UUID of the FW Feature that needs to connect to.
+
+**Outputs:**
+ :c:data:`out_client_properties` - Client Properties: MTU and Protocol Version.
+
+**Error returns:**
+ | :c:macro:`EINVAL` - Wrong IOCTL Number.
+ | :c:macro:`ENODEV` - Device or Connection is not initialized or ready. (e.g. Wrong UUID).
+ | :c:macro:`ENOMEM` - Unable to allocate memory to client internal data.
+ | :c:macro:`EFAULT` - Fatal Error (e.g. Unable to access user input data).
+ | :c:macro:`EBUSY` - Connection Already Open.
+
+**Notes:**
+ :c:data:`max_msg_length` (MTU) in client properties describes the maximum
+ data that can be sent or received. (e.g. if MTU=2K, can send
+ requests up to bytes 2k and received responses up to 2k bytes).
+
+
+:c:macro:`IOCTL_MEI_NOTIFY_SET`
+-------------------------------
+Enable or disable event notifications
+
+**Usage:**
+
+::
+
+ uint32_t enable;
+ ioctl(fd, IOCTL_MEI_NOTIFY_SET, &enable);
+
+**Inputs:**
+ | :c:data:`uint32_t enable = 1;`
+ | or
+ | :c:data:`uint32_t enable[disable] = 0;`
+
+**Error returns:**
+ | :c:macro:`EINVAL` - Wrong IOCTL Number.
+ | :c:macro:`ENODEV` - Device is not initialized or the client not connected.
+ | :c:macro:`ENOMEM` - Unable to allocate memory to client internal data.
+ | :c:macro:`EFAULT` - Fatal Error (e.g. Unable to access user input data).
+ | :c:macro:`EOPNOTSUPP` - if the device doesn't support the feature.
+
+**Notes:**
+ The client must be connected in order to enable notification events.
+
+
+:c:macro:`IOCTL_MEI_NOTIFY_GET`
+-------------------------------
+Retrieve event
+
+**Usage:**
+
+::
+
+ uint32_t event;
+ ioctl(fd, IOCTL_MEI_NOTIFY_GET, &event);
+
+**Outputs:**
+ | 1 - if an event is pending.
+ | 0 - if there is no even pending.
+
+**Error returns:**
+ | :c:macro:`EINVAL` - Wrong IOCTL Number.
+ | :c:macro:`ENODEV` - Device is not initialized or the client not connected.
+ | :c:macro:`ENOMEM` - Unable to allocate memory to client internal data.
+ | :c:macro:`EFAULT` - Fatal Error (e.g. Unable to access user input data).
+ | :c:macro:`EOPNOTSUPP` - if the device doesn't support the feature.
+
+**Notes:**
+ The client must be connected and event notification has to be enabled
+ in order to receive an event.
+
+
+Intel ME Applications
+=====================
+
+1) Intel Local Management Service (Intel LMS)
+
+ Applications running locally on the platform communicate with Intel AMT Release
+ 2.0 and later releases in the same way that network applications do via SOAP
+ over HTTP (deprecated starting with Release 6.0) or with WS-Management over
+ SOAP over HTTP. This means that some Intel AMT features can be accessed from a
+ local application using the same network interface as a remote application
+ communicating with Intel AMT over the network.
+
+ When a local application sends a message addressed to the local Intel AMT host
+ name, the Intel LMS, which listens for traffic directed to the host name,
+ intercepts the message and routes it to the Intel MEI.
+ For more information:
+ `<http://software.intel.com/sites/manageability/AMT_Implementation_and_Reference_Guide>`_
+ Under "About Intel AMT" => "Local Access"
+
+ For downloading Intel LMS:
+ `<http://software.intel.com/en-us/articles/download-the-latest-intel-amt-open-source-drivers/>`_
+
+ The Intel LMS opens a connection using the Intel MEI driver to the Intel LMS
+ firmware feature using a defined UUID and then communicates with the feature
+ using a protocol called Intel AMT Port Forwarding Protocol (Intel APF protocol).
+ The protocol is used to maintain multiple sessions with Intel AMT from a
+ single application.
+
+ See the protocol specification in the `Intel AMT Software Development Kit (SDK)
+ <http://software.intel.com/sites/manageability/AMT_Implementation_and_Reference_Guide>`_
+ Under "SDK Resources" => "Intel(R) vPro(TM) Gateway (MPS)"
+ => "Information for Intel(R) vPro(TM) Gateway Developers"
+ => "Description of the Intel AMT Port Forwarding (APF) Protocol"
+
+2) Intel AMT Remote configuration using a Local Agent
+
+ A Local Agent enables IT personnel to configure Intel AMT out-of-the-box
+ without requiring installing additional data to enable setup. The remote
+ configuration process may involve an ISV-developed remote configuration
+ agent that runs on the host.
+ For more information:
+ `<http://software.intel.com/sites/manageability/AMT_Implementation_and_Reference_Guide>`_
+ Under "Setup and Configuration of Intel AMT" =>
+ "SDK Tools Supporting Setup and Configuration" =>
+ "Using the Local Agent Sample"
+
+ An open source Intel AMT configuration utility, implementing a local agent
+ that accesses the Intel MEI driver, can be found here:
+ `<http://software.intel.com/en-us/articles/download-the-latest-intel-amt-open-source-drivers/>`
+
+
+Intel AMT OS Health Watchdog
+============================
+
+The Intel AMT Watchdog is an OS Health (Hang/Crash) watchdog.
+Whenever the OS hangs or crashes, Intel AMT will send an event
+to any subscriber to this event. This mechanism means that
+IT knows when a platform crashes even when there is a hard failure on the host.
+
+The Intel AMT Watchdog is composed of two parts:
+ 1) Firmware feature - receives the heartbeats
+ and sends an event when the heartbeats stop.
+ 2) Intel MEI iAMT watchdog driver - connects to the watchdog feature,
+ configures the watchdog and sends the heartbeats.
+
+The Intel iAMT watchdog MEI driver uses the kernel watchdog API to configure
+the Intel AMT Watchdog and to send heartbeats to it. The default timeout of the
+watchdog is 120 seconds.
+
+If the Intel AMT is not enabled in the firmware then the watchdog client won't enumerate
+on the me client bus and watchdog devices won't be exposed.
+
+
+Supported Chipsets
+==================
+
+| 7 Series Chipset Family
+| 6 Series Chipset Family
+| 5 Series Chipset Family
+| 4 Series Chipset Family
+| Mobile 4 Series Chipset Family
+| ICH9
+| 82946GZ/GL
+| 82G35 Express
+| 82Q963/Q965
+| 82P965/G965
+| Mobile PM965/GM965
+| Mobile GME965/GLE960
+| 82Q35 Express
+| 82G33/G31/P35/P31 Express
+| 82Q33 Express
+| 82X38/X48 Express
+
+---
+linux-mei@linux.intel.com
diff --git a/Documentation/misc-devices/mei/mei.txt b/Documentation/misc-devices/mei/mei.txt
deleted file mode 100644
index 2b80a0cd621f..000000000000
--- a/Documentation/misc-devices/mei/mei.txt
+++ /dev/null
@@ -1,266 +0,0 @@
-Intel(R) Management Engine Interface (Intel(R) MEI)
-===================================================
-
-Introduction
-============
-
-The Intel Management Engine (Intel ME) is an isolated and protected computing
-resource (Co-processor) residing inside certain Intel chipsets. The Intel ME
-provides support for computer/IT management features. The feature set
-depends on the Intel chipset SKU.
-
-The Intel Management Engine Interface (Intel MEI, previously known as HECI)
-is the interface between the Host and Intel ME. This interface is exposed
-to the host as a PCI device. The Intel MEI Driver is in charge of the
-communication channel between a host application and the Intel ME feature.
-
-Each Intel ME feature (Intel ME Client) is addressed by a GUID/UUID and
-each client has its own protocol. The protocol is message-based with a
-header and payload up to 512 bytes.
-
-Prominent usage of the Intel ME Interface is to communicate with Intel(R)
-Active Management Technology (Intel AMT) implemented in firmware running on
-the Intel ME.
-
-Intel AMT provides the ability to manage a host remotely out-of-band (OOB)
-even when the operating system running on the host processor has crashed or
-is in a sleep state.
-
-Some examples of Intel AMT usage are:
- - Monitoring hardware state and platform components
- - Remote power off/on (useful for green computing or overnight IT
- maintenance)
- - OS updates
- - Storage of useful platform information such as software assets
- - Built-in hardware KVM
- - Selective network isolation of Ethernet and IP protocol flows based
- on policies set by a remote management console
- - IDE device redirection from remote management console
-
-Intel AMT (OOB) communication is based on SOAP (deprecated
-starting with Release 6.0) over HTTP/S or WS-Management protocol over
-HTTP/S that are received from a remote management console application.
-
-For more information about Intel AMT:
-http://software.intel.com/sites/manageability/AMT_Implementation_and_Reference_Guide
-
-
-Intel MEI Driver
-================
-
-The driver exposes a misc device called /dev/mei.
-
-An application maintains communication with an Intel ME feature while
-/dev/mei is open. The binding to a specific feature is performed by calling
-MEI_CONNECT_CLIENT_IOCTL, which passes the desired UUID.
-The number of instances of an Intel ME feature that can be opened
-at the same time depends on the Intel ME feature, but most of the
-features allow only a single instance.
-
-The Intel AMT Host Interface (Intel AMTHI) feature supports multiple
-simultaneous user connected applications. The Intel MEI driver
-handles this internally by maintaining request queues for the applications.
-
-The driver is transparent to data that are passed between firmware feature
-and host application.
-
-Because some of the Intel ME features can change the system
-configuration, the driver by default allows only a privileged
-user to access it.
-
-A code snippet for an application communicating with Intel AMTHI client:
-
- struct mei_connect_client_data data;
- fd = open(MEI_DEVICE);
-
- data.d.in_client_uuid = AMTHI_UUID;
-
- ioctl(fd, IOCTL_MEI_CONNECT_CLIENT, &data);
-
- printf("Ver=%d, MaxLen=%ld\n",
- data.d.in_client_uuid.protocol_version,
- data.d.in_client_uuid.max_msg_length);
-
- [...]
-
- write(fd, amthi_req_data, amthi_req_data_len);
-
- [...]
-
- read(fd, &amthi_res_data, amthi_res_data_len);
-
- [...]
- close(fd);
-
-
-IOCTL
-=====
-
-The Intel MEI Driver supports the following IOCTL commands:
- IOCTL_MEI_CONNECT_CLIENT Connect to firmware Feature (client).
-
- usage:
- struct mei_connect_client_data clientData;
- ioctl(fd, IOCTL_MEI_CONNECT_CLIENT, &clientData);
-
- inputs:
- mei_connect_client_data struct contain the following
- input field:
-
- in_client_uuid - UUID of the FW Feature that needs
- to connect to.
- outputs:
- out_client_properties - Client Properties: MTU and Protocol Version.
-
- error returns:
- EINVAL Wrong IOCTL Number
- ENODEV Device or Connection is not initialized or ready.
- (e.g. Wrong UUID)
- ENOMEM Unable to allocate memory to client internal data.
- EFAULT Fatal Error (e.g. Unable to access user input data)
- EBUSY Connection Already Open
-
- Notes:
- max_msg_length (MTU) in client properties describes the maximum
- data that can be sent or received. (e.g. if MTU=2K, can send
- requests up to bytes 2k and received responses up to 2k bytes).
-
- IOCTL_MEI_NOTIFY_SET: enable or disable event notifications
-
- Usage:
- uint32_t enable;
- ioctl(fd, IOCTL_MEI_NOTIFY_SET, &enable);
-
- Inputs:
- uint32_t enable = 1;
- or
- uint32_t enable[disable] = 0;
-
- Error returns:
- EINVAL Wrong IOCTL Number
- ENODEV Device is not initialized or the client not connected
- ENOMEM Unable to allocate memory to client internal data.
- EFAULT Fatal Error (e.g. Unable to access user input data)
- EOPNOTSUPP if the device doesn't support the feature
-
- Notes:
- The client must be connected in order to enable notification events
-
-
- IOCTL_MEI_NOTIFY_GET : retrieve event
-
- Usage:
- uint32_t event;
- ioctl(fd, IOCTL_MEI_NOTIFY_GET, &event);
-
- Outputs:
- 1 - if an event is pending
- 0 - if there is no even pending
-
- Error returns:
- EINVAL Wrong IOCTL Number
- ENODEV Device is not initialized or the client not connected
- ENOMEM Unable to allocate memory to client internal data.
- EFAULT Fatal Error (e.g. Unable to access user input data)
- EOPNOTSUPP if the device doesn't support the feature
-
- Notes:
- The client must be connected and event notification has to be enabled
- in order to receive an event
-
-
-Intel ME Applications
-=====================
-
- 1) Intel Local Management Service (Intel LMS)
-
- Applications running locally on the platform communicate with Intel AMT Release
- 2.0 and later releases in the same way that network applications do via SOAP
- over HTTP (deprecated starting with Release 6.0) or with WS-Management over
- SOAP over HTTP. This means that some Intel AMT features can be accessed from a
- local application using the same network interface as a remote application
- communicating with Intel AMT over the network.
-
- When a local application sends a message addressed to the local Intel AMT host
- name, the Intel LMS, which listens for traffic directed to the host name,
- intercepts the message and routes it to the Intel MEI.
- For more information:
- http://software.intel.com/sites/manageability/AMT_Implementation_and_Reference_Guide
- Under "About Intel AMT" => "Local Access"
-
- For downloading Intel LMS:
- http://software.intel.com/en-us/articles/download-the-latest-intel-amt-open-source-drivers/
-
- The Intel LMS opens a connection using the Intel MEI driver to the Intel LMS
- firmware feature using a defined UUID and then communicates with the feature
- using a protocol called Intel AMT Port Forwarding Protocol (Intel APF protocol).
- The protocol is used to maintain multiple sessions with Intel AMT from a
- single application.
-
- See the protocol specification in the Intel AMT Software Development Kit (SDK)
- http://software.intel.com/sites/manageability/AMT_Implementation_and_Reference_Guide
- Under "SDK Resources" => "Intel(R) vPro(TM) Gateway (MPS)"
- => "Information for Intel(R) vPro(TM) Gateway Developers"
- => "Description of the Intel AMT Port Forwarding (APF) Protocol"
-
- 2) Intel AMT Remote configuration using a Local Agent
-
- A Local Agent enables IT personnel to configure Intel AMT out-of-the-box
- without requiring installing additional data to enable setup. The remote
- configuration process may involve an ISV-developed remote configuration
- agent that runs on the host.
- For more information:
- http://software.intel.com/sites/manageability/AMT_Implementation_and_Reference_Guide
- Under "Setup and Configuration of Intel AMT" =>
- "SDK Tools Supporting Setup and Configuration" =>
- "Using the Local Agent Sample"
-
- An open source Intel AMT configuration utility, implementing a local agent
- that accesses the Intel MEI driver, can be found here:
- http://software.intel.com/en-us/articles/download-the-latest-intel-amt-open-source-drivers/
-
-
-Intel AMT OS Health Watchdog
-============================
-
-The Intel AMT Watchdog is an OS Health (Hang/Crash) watchdog.
-Whenever the OS hangs or crashes, Intel AMT will send an event
-to any subscriber to this event. This mechanism means that
-IT knows when a platform crashes even when there is a hard failure on the host.
-
-The Intel AMT Watchdog is composed of two parts:
- 1) Firmware feature - receives the heartbeats
- and sends an event when the heartbeats stop.
- 2) Intel MEI iAMT watchdog driver - connects to the watchdog feature,
- configures the watchdog and sends the heartbeats.
-
-The Intel iAMT watchdog MEI driver uses the kernel watchdog API to configure
-the Intel AMT Watchdog and to send heartbeats to it. The default timeout of the
-watchdog is 120 seconds.
-
-If the Intel AMT is not enabled in the firmware then the watchdog client won't enumerate
-on the me client bus and watchdog devices won't be exposed.
-
-
-Supported Chipsets
-==================
-
-7 Series Chipset Family
-6 Series Chipset Family
-5 Series Chipset Family
-4 Series Chipset Family
-Mobile 4 Series Chipset Family
-ICH9
-82946GZ/GL
-82G35 Express
-82Q963/Q965
-82P965/G965
-Mobile PM965/GM965
-Mobile GME965/GLE960
-82Q35 Express
-82G33/G31/P35/P31 Express
-82Q33 Express
-82X38/X48 Express
-
----
-linux-mei@linux.intel.com
--
2.17.1
^ permalink raw reply related
* Re: [linux-kernel-mentees] [PATCH v1] Doc : fs : convert xfs.txt to ReST
From: Sheriff Esseson @ 2019-06-29 20:59 UTC (permalink / raw)
To: skhan
Cc: linux-xfs, darrick.wong, corbet, linux-doc, linux-kernel,
linux-kernel-mentees
In-Reply-To: <20190629150155.GB10491@localhost>
Signed-off-by: Sheriff Esseson <sheriffesseson@gmail.com>
---
In v3:
Update MAINTAINERS. Fix Indentation/long line issues. Insert Sphinx tag.
Documentation/filesystems/index.rst | 5 +-
Documentation/filesystems/xfs.rst | 468 +++++++++++++++++++++++++++
Documentation/filesystems/xfs.txt | 470 ----------------------------
MAINTAINERS | 2 +-
4 files changed, 472 insertions(+), 473 deletions(-)
create mode 100644 Documentation/filesystems/xfs.rst
delete mode 100644 Documentation/filesystems/xfs.txt
diff --git a/Documentation/filesystems/index.rst b/Documentation/filesystems/index.rst
index 1131c34d7..a4cf5fca4 100644
--- a/Documentation/filesystems/index.rst
+++ b/Documentation/filesystems/index.rst
@@ -16,7 +16,7 @@ algorithms work.
.. toctree::
:maxdepth: 2
- path-lookup.rst
+ path-lookup
api-summary
splice
@@ -40,4 +40,5 @@ Documentation for individual filesystem types can be found here.
.. toctree::
:maxdepth: 2
- binderfs.rst
+ binderfs
+ xfs
diff --git a/Documentation/filesystems/xfs.rst b/Documentation/filesystems/xfs.rst
new file mode 100644
index 000000000..d36ef042c
--- /dev/null
+++ b/Documentation/filesystems/xfs.rst
@@ -0,0 +1,468 @@
+.. SPDX-License-Identifier: GPL-2.0
+======================
+The SGI XFS Filesystem
+======================
+
+XFS is a high performance journaling filesystem which originated
+on the SGI IRIX platform. It is completely multi-threaded, can
+support large files and large filesystems, extended attributes,
+variable block sizes, is extent based, and makes extensive use of
+Btrees (directories, extents, free space) to aid both performance
+and scalability.
+
+Refer to the documentation at https://xfs.wiki.kernel.org/
+for further details. This implementation is on-disk compatible
+with the IRIX version of XFS.
+
+
+Mount Options
+=============
+
+When mounting an XFS filesystem, the following options are accepted. For
+boolean mount options, the names with the "(*)" prefix is the default behaviour.
+For example, take a behaviour enabled by default to be a one (1) or, a zero (0)
+otherwise, ``(*)[no]default`` would be 0 while ``[no](*)default`` , a 1.
+
+ allocsize=<size>
+ Sets the buffered I/O end-of-file preallocation size when doing delayed
+ allocation writeout (default size is 64KiB). Valid values for this
+ option are page size (typically 4KiB) through to 1GiB, inclusive, in
+ power-of-2 increments.
+
+ The default behaviour is for dynamic end-of-file preallocation size,
+ which uses a set of heuristics to optimise the preallocation size based
+ on the current allocation patterns within the file and the access
+ patterns to the file. Specifying a fixed allocsize value turns off the
+ dynamic behaviour.
+
+ [no]attr2
+ The options enable/disable an "opportunistic" improvement to be made in
+ the way inline extended attributes are stored on-disk. When the new
+ form is used for the first time when ``attr2`` is selected (either when
+ setting or removing extended attributes) the on-disk superblock feature
+ bit field will be updated to reflect this format being in use.
+
+ The default behaviour is determined by the on-disk feature bit
+ indicating that ``attr2`` behaviour is active. If either mount option is
+ set, then that becomes the new default used by the filesystem. However
+ on CRC enabled filesystems, the ``attr2`` format is always used , and so
+ will reject the ``noattr2`` mount option if it is set.
+
+ (*)[no]discard
+ Enable/disable the issuing of commands to let the block device reclaim
+ space freed by the filesystem. This is useful for SSD devices, thinly
+ provisioned LUNs and virtual machine images, but may have a performance
+ impact.
+
+ Note: It is currently recommended that you use the ``fstrim``
+ application to discard unused blocks rather than the ``discard`` mount
+ option because the performance impact of this option is quite severe.
+
+ grpid/bsdgroups
+ nogrpid/(*)sysvgroups
+ These options define what group ID a newly created file gets. When
+ ``grpid`` is set, it takes the group ID of the directory in which it is
+ created; otherwise it takes the ``fsgid`` of the current process, unless
+ the directory has the ``setgid`` bit set, in which case it takes the
+ ``gid`` from the parent directory, and also gets the ``setgid`` bit set
+ if it is a directory itself.
+
+ filestreams
+ Make the data allocator use the filestreams allocation mode across the
+ entire filesystem rather than just on directories configured to use it.
+
+ (*)[no]ikeep
+ When ``ikeep`` is specified, XFS does not delete empty inode clusters
+ and keeps them around on disk. When ``noikeep`` is specified, empty
+ inode clusters are returned to the free space pool.
+
+ inode32 | (*)inode64
+ When ``inode32`` is specified, it indicates that XFS limits inode
+ creation to locations which will not result in inode numbers with more
+ than 32 bits of significance.
+
+ When ``inode64`` is specified, it indicates that XFS is allowed to
+ create inodes at any location in the filesystem, including those which
+ will result in inode numbers occupying more than 32 bits of
+ significance.
+
+ ``inode32`` is provided for backwards compatibility with older systems
+ and applications, since 64 bits inode numbers might cause problems for
+ some applications that cannot handle large inode numbers. If
+ applications are in use which do not handle inode numbers bigger than 32
+ bits, the ``inode32`` option should be specified.
+
+
+ (*)[no]largeio
+ If ``nolargeio`` is specified, the optimal I/O reported in st_blksize by
+ **stat(2)** will be as small as possible to allow user applications to
+ avoid inefficient read/modify/write I/O. This is typically the page
+ size of the machine, as this is the granularity of the page cache.
+
+ If ``largeio`` is specified, a filesystem that was created with a
+ ``swidth`` specified will return the ``swidth`` value (in bytes) in
+ st_blksize. If the filesystem does not have a ``swidth`` specified but
+ does specify an ``allocsize`` then ``allocsize`` (in bytes) will be
+ returned instead. Otherwise the behaviour is the same as if
+ ``nolargeio`` was specified.
+
+ logbufs=<value>
+ Set the number of in-memory log buffers to ``value``. Valid numbers
+ range from 2-8 inclusive.
+
+ The default value is 8 buffers.
+
+ If the memory cost of 8 log buffers is too high on small systems, then
+ it may be reduced at some cost to performance on metadata intensive
+ workloads. The ``logbsize`` option below controls the size of each
+ buffer and so is also relevant to this case.
+
+ logbsize=<value>
+ Set the size of each in-memory log buffer to ``value``. The size may be
+ specified in bytes, or in kilobytes with a "k" suffix. Valid sizes for
+ version 1 and version 2 logs are 16384 (16k) and 32768 (32k). Valid
+ sizes for version 2 logs also include 65536 (64k), 131072 (128k) and
+ 262144 (256k). The ``logbsize`` must be an integer multiple of the
+ "log stripe unit" configured at mkfs time.
+
+ The default value for for version 1 logs is 32768, while the default
+ value for version 2 logs is ``MAX(32768, log_sunit)``.
+
+ logdev=<device>
+ Use ``device`` as an external log (metadata journal). In an XFS
+ filesystem, the log device can be separate from the data device or
+ contained within it.
+
+ rtdev=<device>
+ An XFS filesystem has up to three parts: a data section, a log section,
+ and a real-time section. The real-time section is optional. If
+ enabled, ``rtdev`` sets ``device`` to be used as an external real-time
+ section, similar to ``logdev`` above.
+
+ noalign
+ Data allocations will not be aligned at stripe unit boundaries. This is
+ only relevant to filesystems created with non-zero data alignment
+ parameters (sunit, swidth) by mkfs.
+
+ norecovery
+ The filesystem will be mounted without running log recovery. If the
+ filesystem was not cleanly unmounted, it is likely to be inconsistent
+ when mounted in ``norecovery`` mode. Some files or directories may not
+ be accessible because of this. Filesystems mounted ``norecovery`` must
+ be mounted read-only or the mount will fail.
+
+ nouuid
+ Don't check for double mounted file systems using the file system uuid.
+ This is useful to mount LVM snapshot volumes, and often used in
+ combination with ``norecovery`` for mounting read-only snapshots.
+
+ noquota
+ Forcibly turns off all quota accounting and enforcement
+ within the filesystem.
+
+ uquota/usrquota/uqnoenforce/quota
+ User disk quota accounting enabled, and limits (optionally) enforced.
+ Refer to **xfs_quota(8)** for further details.
+
+ gquota/grpquota/gqnoenforce
+ Group disk quota accounting enabled and limits (optionally) enforced.
+ Refer to **xfs_quota(8)** for further details.
+
+ pquota/prjquota/pqnoenforce
+ Project disk quota accounting enabled and limits (optionally) enforced.
+ Refer to **xfs_quota(8)** for further details.
+
+ sunit=<value>
+ Used to specify the stripe unit for a RAID device or (in conjunction
+ with ``swidth`` below) a stripe volume. ``value`` must be specified in
+ 512-byte block units. This option is only relevant to filesystems that
+ were created with non-zero data alignment parameters.
+
+ The ``sunit`` parameter specified must be compatible with the existing
+ filesystem alignment characteristics. In general, that means the only
+ valid changes to ``sunit`` are increasing it by a power-of-2 multiple.
+
+ Typically, this mount option is necessary only after an underlying RAID
+ device has had its geometry modified, such as adding a new disk to a
+ RAID5 lun and reshaping it.
+
+ swidth=<value>
+ Used to specify the stripe width for a RAID device or (in conjunction
+ with ``sunit`` above) a stripe volume. ``value`` must be specified in
+ 512-byte block units. This option, like ``sunit`` above, is only
+ relevant to filesystems that were created with non-zero data alignment
+ parameters.
+
+ The ``swidth`` parameter specified must be compatible with the existing
+ filesystem alignment characteristics. In general, that means the only
+ valid swidth values are any integer multiple of a valid ``sunit`` value.
+
+ Typically, this mount option is necessary only after an underlying RAID
+ device has had its geometry modified, such as adding a new disk to a
+ RAID5 lun and reshaping it.
+
+
+ swalloc
+ Data allocations will be rounded up to stripe width boundaries when the
+ current end of file is being extended and the file size is larger than
+ the stripe width size.
+
+ wsync
+ When specified, all filesystem namespace operations are executed
+ synchronously. This ensures that when the namespace operation (create,
+ unlink, etc) completes, the change to the namespace is on stable
+ storage. This is useful in HA setups where failover must not result in
+ clients seeing inconsistent namespace presentation during or after a
+ failover event.
+
+
+Deprecated Mount Options
+========================
+
+ Name Removal Schedule
+ ---- ----------------
+
+
+Removed Mount Options
+=====================
+
+ Name Removed
+ ---- -------
+ delaylog/nodelaylog v4.0
+ ihashsize v4.0
+ irixsgid v4.0
+ osyncisdsync/osyncisosync v4.0
+ barrier v4.19
+ nobarrier v4.19
+
+
+sysctls
+=======
+
+The following sysctls are available for the XFS filesystem:
+
+ fs.xfs.stats_clear (Min: 0 Default: 0 Max: 1)
+ Setting this to "1" clears accumulated XFS statistics
+ in /proc/fs/xfs/stat. It then immediately resets to "0".
+
+ fs.xfs.xfssyncd_centisecs (Min: 100 Default: 3000 Max: 720000)
+ The interval at which the filesystem flushes metadata
+ out to disk and runs internal cache cleanup routines.
+
+ fs.xfs.filestream_centisecs (Min: 1 Default: 3000 Max: 360000)
+ The interval at which the filesystem ages filestreams cache
+ references and returns timed-out AGs back to the free stream
+ pool.
+
+ fs.xfs.speculative_prealloc_lifetime
+ (Units: seconds Min: 1 Default: 300 Max: 86400)
+ The interval at which the background scanning for inodes
+ with unused speculative preallocation runs. The scan
+ removes unused preallocation from clean inodes and releases
+ the unused space back to the free pool.
+
+ fs.xfs.error_level (Min: 0 Default: 3 Max: 11)
+ A volume knob for error reporting when internal errors occur.
+ This will generate detailed messages & backtraces for filesystem
+ shutdowns, for example. Current threshold values are:
+
+ XFS_ERRLEVEL_OFF: 0
+ XFS_ERRLEVEL_LOW: 1
+ XFS_ERRLEVEL_HIGH: 5
+
+ fs.xfs.panic_mask (Min: 0 Default: 0 Max: 256)
+ Causes certain error conditions to call BUG(). Value is a bitmask;
+ OR together the tags which represent errors which should cause panics:
+
+ XFS_NO_PTAG 0
+ XFS_PTAG_IFLUSH 0x00000001
+ XFS_PTAG_LOGRES 0x00000002
+ XFS_PTAG_AILDELETE 0x00000004
+ XFS_PTAG_ERROR_REPORT 0x00000008
+ XFS_PTAG_SHUTDOWN_CORRUPT 0x00000010
+ XFS_PTAG_SHUTDOWN_IOERROR 0x00000020
+ XFS_PTAG_SHUTDOWN_LOGERROR 0x00000040
+ XFS_PTAG_FSBLOCK_ZERO 0x00000080
+ XFS_PTAG_VERIFIER_ERROR 0x00000100
+
+ This option is intended for debugging only.
+
+ fs.xfs.irix_symlink_mode (Min: 0 Default: 0 Max: 1)
+ Controls whether symlinks are created with mode 0777 (default)
+ or whether their mode is affected by the umask (irix mode).
+
+ fs.xfs.irix_sgid_inherit (Min: 0 Default: 0 Max: 1)
+ Controls files created in SGID directories.
+ If the group ID of the new file does not match the effective group
+ ID or one of the supplementary group IDs of the parent dir, the
+ ISGID bit is cleared if the irix_sgid_inherit compatibility sysctl
+ is set.
+
+ fs.xfs.inherit_sync (Min: 0 Default: 1 Max: 1)
+ Setting this to "1" will cause the "sync" flag set
+ by the **xfs_io(8)** chattr command on a directory to be
+ inherited by files in that directory.
+
+ fs.xfs.inherit_nodump (Min: 0 Default: 1 Max: 1)
+ Setting this to "1" will cause the "nodump" flag set
+ by the **xfs_io(8)** chattr command on a directory to be
+ inherited by files in that directory.
+
+ fs.xfs.inherit_noatime (Min: 0 Default: 1 Max: 1)
+ Setting this to "1" will cause the "noatime" flag set
+ by the **xfs_io(8)** chattr command on a directory to be
+ inherited by files in that directory.
+
+ fs.xfs.inherit_nosymlinks (Min: 0 Default: 1 Max: 1)
+ Setting this to "1" will cause the "nosymlinks" flag set
+ by the **xfs_io(8)** chattr command on a directory to be
+ inherited by files in that directory.
+
+ fs.xfs.inherit_nodefrag (Min: 0 Default: 1 Max: 1)
+ Setting this to "1" will cause the "nodefrag" flag set
+ by the **xfs_io(8)** chattr command on a directory to be
+ inherited by files in that directory.
+
+ fs.xfs.rotorstep (Min: 1 Default: 1 Max: 256)
+ In "inode32" allocation mode, this option determines how many
+ files the allocator attempts to allocate in the same allocation
+ group before moving to the next allocation group. The intent
+ is to control the rate at which the allocator moves between
+ allocation groups when allocating extents for new files.
+
+Deprecated Sysctls
+==================
+
+None at present.
+
+
+Removed Sysctls
+===============
+
+ Name Removed
+ ---- -------
+ fs.xfs.xfsbufd_centisec v4.0
+ fs.xfs.age_buffer_centisecs v4.0
+
+
+Error handling
+==============
+
+XFS can act differently according to the type of error found during its
+operation. The implementation introduces the following concepts to the error
+handler:
+
+ -failure speed:
+ Defines how fast XFS should propagate an error upwards when a specific
+ error is found during the filesystem operation. It can propagate
+ immediately, after a defined number of retries, after a set time period,
+ or simply retry forever.
+
+ -error classes:
+ Specifies the subsystem the error configuration will apply to, such as
+ metadata IO or memory allocation. Different subsystems will have
+ different error handlers for which behaviour can be configured.
+
+ -error handlers:
+ Defines the behavior for a specific error.
+
+The filesystem behavior during an error can be set via sysfs files. Each
+error handler works independently - the first condition met by an error handler
+for a specific class will cause the error to be propagated rather than reset and
+retried.
+
+The action taken by the filesystem when the error is propagated is context
+dependent - it may cause a shut down in the case of an unrecoverable error,
+it may be reported back to userspace, or it may even be ignored because
+there's nothing useful we can with the error or anyone we can report it to (e.g.
+during unmount).
+
+The configuration files are organized into the following hierarchy for each
+mounted filesystem:
+
+ /sys/fs/xfs/<dev>/error/<class>/<error>/
+
+Where:
+ <dev>
+ The short device name of the mounted filesystem. This is the same device
+ name that shows up in XFS kernel error messages as "XFS(<dev>): ..."
+
+ <class>
+ The subsystem the error configuration belongs to. As of 4.9, the defined
+ classes are:
+
+ - "metadata": applies metadata buffer write IO
+
+ <error>
+ The individual error handler configurations.
+
+
+Each filesystem has "global" error configuration options defined in their top
+level directory:
+
+ /sys/fs/xfs/<dev>/error/
+
+ fail_at_unmount (Min: 0 Default: 1 Max: 1)
+ Defines the filesystem error behavior at unmount time.
+
+ If set to a value of 1, XFS will override all other error configurations
+ during unmount and replace them with "immediate fail" characteristics.
+ i.e. no retries, no retry timeout. This will always allow unmount to
+ succeed when there are persistent errors present.
+
+ If set to 0, the configured retry behaviour will continue until all
+ retries and/or timeouts have been exhausted. This will delay unmount
+ completion when there are persistent errors, and it may prevent the
+ filesystem from ever unmounting fully in the case of "retry forever"
+ handler configurations.
+
+ Note: there is no guarantee that fail_at_unmount can be set while an
+ unmount is in progress. It is possible that the sysfs entries are
+ removed by the unmounting filesystem before a "retry forever" error
+ handler configuration causes unmount to hang, and hence the filesystem
+ must be configured appropriately before unmount begins to prevent
+ unmount hangs.
+
+Each filesystem has specific error class handlers that define the error
+propagation behaviour for specific errors. There is also a "default" error
+handler defined, which defines the behaviour for all errors that don't have
+specific handlers defined. Where multiple retry constraints are configuredi for
+a single error, the first retry configuration that expires will cause the error
+to be propagated. The handler configurations are found in the directory:
+
+ /sys/fs/xfs/<dev>/error/<class>/<error>/
+
+ max_retries (Min: -1 Default: Varies Max: INTMAX)
+ Defines the allowed number of retries of a specific error before
+ the filesystem will propagate the error. The retry count for a given
+ error context (e.g. a specific metadata buffer) is reset every time
+ there is a successful completion of the operation.
+
+ Setting the value to "-1" will cause XFS to retry forever for this
+ specific error.
+
+ Setting the value to "0" will cause XFS to fail immediately when the
+ specific error is reported.
+
+ Setting the value to "N" (where 0 < N < Max) will make XFS retry the
+ operation "N" times before propagating the error.
+
+ retry_timeout_seconds (Min: -1 Default: Varies Max: 1 day)
+ Define the amount of time (in seconds) that the filesystem is
+ allowed to retry its operations when the specific error is
+ found.
+
+ Setting the value to "-1" will allow XFS to retry forever for this
+ specific error.
+
+ Setting the value to "0" will cause XFS to fail immediately when the
+ specific error is reported.
+
+ Setting the value to "N" (where 0 < N < Max) will allow XFS to retry the
+ operation for up to "N" seconds before propagating the error.
+
+Note: The default behaviour for a specific error handler is dependent on both
+the class and error context. For example, the default values for
+"metadata/ENODEV" are "0" rather than "-1" so that this error handler defaults
+to "fail immediately" behaviour. This is done because ENODEV is a fatal,
+unrecoverable error no matter how many times the metadata IO is retried.
diff --git a/Documentation/filesystems/xfs.txt b/Documentation/filesystems/xfs.txt
deleted file mode 100644
index a5cbb5e0e..000000000
--- a/Documentation/filesystems/xfs.txt
+++ /dev/null
@@ -1,470 +0,0 @@
-
-The SGI XFS Filesystem
-======================
-
-XFS is a high performance journaling filesystem which originated
-on the SGI IRIX platform. It is completely multi-threaded, can
-support large files and large filesystems, extended attributes,
-variable block sizes, is extent based, and makes extensive use of
-Btrees (directories, extents, free space) to aid both performance
-and scalability.
-
-Refer to the documentation at https://xfs.wiki.kernel.org/
-for further details. This implementation is on-disk compatible
-with the IRIX version of XFS.
-
-
-Mount Options
-=============
-
-When mounting an XFS filesystem, the following options are accepted.
-For boolean mount options, the names with the (*) suffix is the
-default behaviour.
-
- allocsize=size
- Sets the buffered I/O end-of-file preallocation size when
- doing delayed allocation writeout (default size is 64KiB).
- Valid values for this option are page size (typically 4KiB)
- through to 1GiB, inclusive, in power-of-2 increments.
-
- The default behaviour is for dynamic end-of-file
- preallocation size, which uses a set of heuristics to
- optimise the preallocation size based on the current
- allocation patterns within the file and the access patterns
- to the file. Specifying a fixed allocsize value turns off
- the dynamic behaviour.
-
- attr2
- noattr2
- The options enable/disable an "opportunistic" improvement to
- be made in the way inline extended attributes are stored
- on-disk. When the new form is used for the first time when
- attr2 is selected (either when setting or removing extended
- attributes) the on-disk superblock feature bit field will be
- updated to reflect this format being in use.
-
- The default behaviour is determined by the on-disk feature
- bit indicating that attr2 behaviour is active. If either
- mount option it set, then that becomes the new default used
- by the filesystem.
-
- CRC enabled filesystems always use the attr2 format, and so
- will reject the noattr2 mount option if it is set.
-
- discard
- nodiscard (*)
- Enable/disable the issuing of commands to let the block
- device reclaim space freed by the filesystem. This is
- useful for SSD devices, thinly provisioned LUNs and virtual
- machine images, but may have a performance impact.
-
- Note: It is currently recommended that you use the fstrim
- application to discard unused blocks rather than the discard
- mount option because the performance impact of this option
- is quite severe.
-
- grpid/bsdgroups
- nogrpid/sysvgroups (*)
- These options define what group ID a newly created file
- gets. When grpid is set, it takes the group ID of the
- directory in which it is created; otherwise it takes the
- fsgid of the current process, unless the directory has the
- setgid bit set, in which case it takes the gid from the
- parent directory, and also gets the setgid bit set if it is
- a directory itself.
-
- filestreams
- Make the data allocator use the filestreams allocation mode
- across the entire filesystem rather than just on directories
- configured to use it.
-
- ikeep
- noikeep (*)
- When ikeep is specified, XFS does not delete empty inode
- clusters and keeps them around on disk. When noikeep is
- specified, empty inode clusters are returned to the free
- space pool.
-
- inode32
- inode64 (*)
- When inode32 is specified, it indicates that XFS limits
- inode creation to locations which will not result in inode
- numbers with more than 32 bits of significance.
-
- When inode64 is specified, it indicates that XFS is allowed
- to create inodes at any location in the filesystem,
- including those which will result in inode numbers occupying
- more than 32 bits of significance.
-
- inode32 is provided for backwards compatibility with older
- systems and applications, since 64 bits inode numbers might
- cause problems for some applications that cannot handle
- large inode numbers. If applications are in use which do
- not handle inode numbers bigger than 32 bits, the inode32
- option should be specified.
-
-
- largeio
- nolargeio (*)
- If "nolargeio" is specified, the optimal I/O reported in
- st_blksize by stat(2) will be as small as possible to allow
- user applications to avoid inefficient read/modify/write
- I/O. This is typically the page size of the machine, as
- this is the granularity of the page cache.
-
- If "largeio" specified, a filesystem that was created with a
- "swidth" specified will return the "swidth" value (in bytes)
- in st_blksize. If the filesystem does not have a "swidth"
- specified but does specify an "allocsize" then "allocsize"
- (in bytes) will be returned instead. Otherwise the behaviour
- is the same as if "nolargeio" was specified.
-
- logbufs=value
- Set the number of in-memory log buffers. Valid numbers
- range from 2-8 inclusive.
-
- The default value is 8 buffers.
-
- If the memory cost of 8 log buffers is too high on small
- systems, then it may be reduced at some cost to performance
- on metadata intensive workloads. The logbsize option below
- controls the size of each buffer and so is also relevant to
- this case.
-
- logbsize=value
- Set the size of each in-memory log buffer. The size may be
- specified in bytes, or in kilobytes with a "k" suffix.
- Valid sizes for version 1 and version 2 logs are 16384 (16k)
- and 32768 (32k). Valid sizes for version 2 logs also
- include 65536 (64k), 131072 (128k) and 262144 (256k). The
- logbsize must be an integer multiple of the log
- stripe unit configured at mkfs time.
-
- The default value for for version 1 logs is 32768, while the
- default value for version 2 logs is MAX(32768, log_sunit).
-
- logdev=device and rtdev=device
- Use an external log (metadata journal) and/or real-time device.
- An XFS filesystem has up to three parts: a data section, a log
- section, and a real-time section. The real-time section is
- optional, and the log section can be separate from the data
- section or contained within it.
-
- noalign
- Data allocations will not be aligned at stripe unit
- boundaries. This is only relevant to filesystems created
- with non-zero data alignment parameters (sunit, swidth) by
- mkfs.
-
- norecovery
- The filesystem will be mounted without running log recovery.
- If the filesystem was not cleanly unmounted, it is likely to
- be inconsistent when mounted in "norecovery" mode.
- Some files or directories may not be accessible because of this.
- Filesystems mounted "norecovery" must be mounted read-only or
- the mount will fail.
-
- nouuid
- Don't check for double mounted file systems using the file
- system uuid. This is useful to mount LVM snapshot volumes,
- and often used in combination with "norecovery" for mounting
- read-only snapshots.
-
- noquota
- Forcibly turns off all quota accounting and enforcement
- within the filesystem.
-
- uquota/usrquota/uqnoenforce/quota
- User disk quota accounting enabled, and limits (optionally)
- enforced. Refer to xfs_quota(8) for further details.
-
- gquota/grpquota/gqnoenforce
- Group disk quota accounting enabled and limits (optionally)
- enforced. Refer to xfs_quota(8) for further details.
-
- pquota/prjquota/pqnoenforce
- Project disk quota accounting enabled and limits (optionally)
- enforced. Refer to xfs_quota(8) for further details.
-
- sunit=value and swidth=value
- Used to specify the stripe unit and width for a RAID device
- or a stripe volume. "value" must be specified in 512-byte
- block units. These options are only relevant to filesystems
- that were created with non-zero data alignment parameters.
-
- The sunit and swidth parameters specified must be compatible
- with the existing filesystem alignment characteristics. In
- general, that means the only valid changes to sunit are
- increasing it by a power-of-2 multiple. Valid swidth values
- are any integer multiple of a valid sunit value.
-
- Typically the only time these mount options are necessary if
- after an underlying RAID device has had it's geometry
- modified, such as adding a new disk to a RAID5 lun and
- reshaping it.
-
- swalloc
- Data allocations will be rounded up to stripe width boundaries
- when the current end of file is being extended and the file
- size is larger than the stripe width size.
-
- wsync
- When specified, all filesystem namespace operations are
- executed synchronously. This ensures that when the namespace
- operation (create, unlink, etc) completes, the change to the
- namespace is on stable storage. This is useful in HA setups
- where failover must not result in clients seeing
- inconsistent namespace presentation during or after a
- failover event.
-
-
-Deprecated Mount Options
-========================
-
- Name Removal Schedule
- ---- ----------------
-
-
-Removed Mount Options
-=====================
-
- Name Removed
- ---- -------
- delaylog/nodelaylog v4.0
- ihashsize v4.0
- irixsgid v4.0
- osyncisdsync/osyncisosync v4.0
- barrier v4.19
- nobarrier v4.19
-
-
-sysctls
-=======
-
-The following sysctls are available for the XFS filesystem:
-
- fs.xfs.stats_clear (Min: 0 Default: 0 Max: 1)
- Setting this to "1" clears accumulated XFS statistics
- in /proc/fs/xfs/stat. It then immediately resets to "0".
-
- fs.xfs.xfssyncd_centisecs (Min: 100 Default: 3000 Max: 720000)
- The interval at which the filesystem flushes metadata
- out to disk and runs internal cache cleanup routines.
-
- fs.xfs.filestream_centisecs (Min: 1 Default: 3000 Max: 360000)
- The interval at which the filesystem ages filestreams cache
- references and returns timed-out AGs back to the free stream
- pool.
-
- fs.xfs.speculative_prealloc_lifetime
- (Units: seconds Min: 1 Default: 300 Max: 86400)
- The interval at which the background scanning for inodes
- with unused speculative preallocation runs. The scan
- removes unused preallocation from clean inodes and releases
- the unused space back to the free pool.
-
- fs.xfs.error_level (Min: 0 Default: 3 Max: 11)
- A volume knob for error reporting when internal errors occur.
- This will generate detailed messages & backtraces for filesystem
- shutdowns, for example. Current threshold values are:
-
- XFS_ERRLEVEL_OFF: 0
- XFS_ERRLEVEL_LOW: 1
- XFS_ERRLEVEL_HIGH: 5
-
- fs.xfs.panic_mask (Min: 0 Default: 0 Max: 256)
- Causes certain error conditions to call BUG(). Value is a bitmask;
- OR together the tags which represent errors which should cause panics:
-
- XFS_NO_PTAG 0
- XFS_PTAG_IFLUSH 0x00000001
- XFS_PTAG_LOGRES 0x00000002
- XFS_PTAG_AILDELETE 0x00000004
- XFS_PTAG_ERROR_REPORT 0x00000008
- XFS_PTAG_SHUTDOWN_CORRUPT 0x00000010
- XFS_PTAG_SHUTDOWN_IOERROR 0x00000020
- XFS_PTAG_SHUTDOWN_LOGERROR 0x00000040
- XFS_PTAG_FSBLOCK_ZERO 0x00000080
- XFS_PTAG_VERIFIER_ERROR 0x00000100
-
- This option is intended for debugging only.
-
- fs.xfs.irix_symlink_mode (Min: 0 Default: 0 Max: 1)
- Controls whether symlinks are created with mode 0777 (default)
- or whether their mode is affected by the umask (irix mode).
-
- fs.xfs.irix_sgid_inherit (Min: 0 Default: 0 Max: 1)
- Controls files created in SGID directories.
- If the group ID of the new file does not match the effective group
- ID or one of the supplementary group IDs of the parent dir, the
- ISGID bit is cleared if the irix_sgid_inherit compatibility sysctl
- is set.
-
- fs.xfs.inherit_sync (Min: 0 Default: 1 Max: 1)
- Setting this to "1" will cause the "sync" flag set
- by the xfs_io(8) chattr command on a directory to be
- inherited by files in that directory.
-
- fs.xfs.inherit_nodump (Min: 0 Default: 1 Max: 1)
- Setting this to "1" will cause the "nodump" flag set
- by the xfs_io(8) chattr command on a directory to be
- inherited by files in that directory.
-
- fs.xfs.inherit_noatime (Min: 0 Default: 1 Max: 1)
- Setting this to "1" will cause the "noatime" flag set
- by the xfs_io(8) chattr command on a directory to be
- inherited by files in that directory.
-
- fs.xfs.inherit_nosymlinks (Min: 0 Default: 1 Max: 1)
- Setting this to "1" will cause the "nosymlinks" flag set
- by the xfs_io(8) chattr command on a directory to be
- inherited by files in that directory.
-
- fs.xfs.inherit_nodefrag (Min: 0 Default: 1 Max: 1)
- Setting this to "1" will cause the "nodefrag" flag set
- by the xfs_io(8) chattr command on a directory to be
- inherited by files in that directory.
-
- fs.xfs.rotorstep (Min: 1 Default: 1 Max: 256)
- In "inode32" allocation mode, this option determines how many
- files the allocator attempts to allocate in the same allocation
- group before moving to the next allocation group. The intent
- is to control the rate at which the allocator moves between
- allocation groups when allocating extents for new files.
-
-Deprecated Sysctls
-==================
-
-None at present.
-
-
-Removed Sysctls
-===============
-
- Name Removed
- ---- -------
- fs.xfs.xfsbufd_centisec v4.0
- fs.xfs.age_buffer_centisecs v4.0
-
-
-Error handling
-==============
-
-XFS can act differently according to the type of error found during its
-operation. The implementation introduces the following concepts to the error
-handler:
-
- -failure speed:
- Defines how fast XFS should propagate an error upwards when a specific
- error is found during the filesystem operation. It can propagate
- immediately, after a defined number of retries, after a set time period,
- or simply retry forever.
-
- -error classes:
- Specifies the subsystem the error configuration will apply to, such as
- metadata IO or memory allocation. Different subsystems will have
- different error handlers for which behaviour can be configured.
-
- -error handlers:
- Defines the behavior for a specific error.
-
-The filesystem behavior during an error can be set via sysfs files. Each
-error handler works independently - the first condition met by an error handler
-for a specific class will cause the error to be propagated rather than reset and
-retried.
-
-The action taken by the filesystem when the error is propagated is context
-dependent - it may cause a shut down in the case of an unrecoverable error,
-it may be reported back to userspace, or it may even be ignored because
-there's nothing useful we can with the error or anyone we can report it to (e.g.
-during unmount).
-
-The configuration files are organized into the following hierarchy for each
-mounted filesystem:
-
- /sys/fs/xfs/<dev>/error/<class>/<error>/
-
-Where:
- <dev>
- The short device name of the mounted filesystem. This is the same device
- name that shows up in XFS kernel error messages as "XFS(<dev>): ..."
-
- <class>
- The subsystem the error configuration belongs to. As of 4.9, the defined
- classes are:
-
- - "metadata": applies metadata buffer write IO
-
- <error>
- The individual error handler configurations.
-
-
-Each filesystem has "global" error configuration options defined in their top
-level directory:
-
- /sys/fs/xfs/<dev>/error/
-
- fail_at_unmount (Min: 0 Default: 1 Max: 1)
- Defines the filesystem error behavior at unmount time.
-
- If set to a value of 1, XFS will override all other error configurations
- during unmount and replace them with "immediate fail" characteristics.
- i.e. no retries, no retry timeout. This will always allow unmount to
- succeed when there are persistent errors present.
-
- If set to 0, the configured retry behaviour will continue until all
- retries and/or timeouts have been exhausted. This will delay unmount
- completion when there are persistent errors, and it may prevent the
- filesystem from ever unmounting fully in the case of "retry forever"
- handler configurations.
-
- Note: there is no guarantee that fail_at_unmount can be set while an
- unmount is in progress. It is possible that the sysfs entries are
- removed by the unmounting filesystem before a "retry forever" error
- handler configuration causes unmount to hang, and hence the filesystem
- must be configured appropriately before unmount begins to prevent
- unmount hangs.
-
-Each filesystem has specific error class handlers that define the error
-propagation behaviour for specific errors. There is also a "default" error
-handler defined, which defines the behaviour for all errors that don't have
-specific handlers defined. Where multiple retry constraints are configuredi for
-a single error, the first retry configuration that expires will cause the error
-to be propagated. The handler configurations are found in the directory:
-
- /sys/fs/xfs/<dev>/error/<class>/<error>/
-
- max_retries (Min: -1 Default: Varies Max: INTMAX)
- Defines the allowed number of retries of a specific error before
- the filesystem will propagate the error. The retry count for a given
- error context (e.g. a specific metadata buffer) is reset every time
- there is a successful completion of the operation.
-
- Setting the value to "-1" will cause XFS to retry forever for this
- specific error.
-
- Setting the value to "0" will cause XFS to fail immediately when the
- specific error is reported.
-
- Setting the value to "N" (where 0 < N < Max) will make XFS retry the
- operation "N" times before propagating the error.
-
- retry_timeout_seconds (Min: -1 Default: Varies Max: 1 day)
- Define the amount of time (in seconds) that the filesystem is
- allowed to retry its operations when the specific error is
- found.
-
- Setting the value to "-1" will allow XFS to retry forever for this
- specific error.
-
- Setting the value to "0" will cause XFS to fail immediately when the
- specific error is reported.
-
- Setting the value to "N" (where 0 < N < Max) will allow XFS to retry the
- operation for up to "N" seconds before propagating the error.
-
-Note: The default behaviour for a specific error handler is dependent on both
-the class and error context. For example, the default values for
-"metadata/ENODEV" are "0" rather than "-1" so that this error handler defaults
-to "fail immediately" behaviour. This is done because ENODEV is a fatal,
-unrecoverable error no matter how many times the metadata IO is retried.
diff --git a/MAINTAINERS b/MAINTAINERS
index d0ed73599..66e972e9a 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -17364,7 +17364,7 @@ L: linux-xfs@vger.kernel.org
W: http://xfs.org/
T: git git://git.kernel.org/pub/scm/fs/xfs/xfs-linux.git
S: Supported
-F: Documentation/filesystems/xfs.txt
+F: Documentation/filesystems/xfs.rst
F: fs/xfs/
XILINX AXI ETHERNET DRIVER
--
2.22.0
^ permalink raw reply related
* Re: [linux-kernel-mentees] [PATCH v1] Doc : fs : convert xfs.txt to ReST
From: Sheriff Esseson @ 2019-06-29 20:57 UTC (permalink / raw)
To: skhan
Cc: linux-xfs, darrick.wong, corbet, linux-doc, linux-kernel,
linux-kernel-mentees
In-Reply-To: <20190629150155.GB10491@localhost>
Signed-off-by: Sheriff Esseson <sheriffesseson@gmail.com>
---
In v3:
Update MAINTAINERS. Fix Indentation/long line issues. Insert Sphinx tag.
Documentation/filesystems/index.rst | 5 +-
Documentation/filesystems/xfs.rst | 468 +++++++++++++++++++++++++++
Documentation/filesystems/xfs.txt | 470 ----------------------------
MAINTAINERS | 2 +-
4 files changed, 472 insertions(+), 473 deletions(-)
create mode 100644 Documentation/filesystems/xfs.rst
delete mode 100644 Documentation/filesystems/xfs.txt
diff --git a/Documentation/filesystems/index.rst b/Documentation/filesystems/index.rst
index 1131c34d7..a4cf5fca4 100644
--- a/Documentation/filesystems/index.rst
+++ b/Documentation/filesystems/index.rst
@@ -16,7 +16,7 @@ algorithms work.
.. toctree::
:maxdepth: 2
- path-lookup.rst
+ path-lookup
api-summary
splice
@@ -40,4 +40,5 @@ Documentation for individual filesystem types can be found here.
.. toctree::
:maxdepth: 2
- binderfs.rst
+ binderfs
+ xfs
diff --git a/Documentation/filesystems/xfs.rst b/Documentation/filesystems/xfs.rst
new file mode 100644
index 000000000..d36ef042c
--- /dev/null
+++ b/Documentation/filesystems/xfs.rst
@@ -0,0 +1,468 @@
+.. SPDX-License-Identifier: GPL-2.0
+======================
+The SGI XFS Filesystem
+======================
+
+XFS is a high performance journaling filesystem which originated
+on the SGI IRIX platform. It is completely multi-threaded, can
+support large files and large filesystems, extended attributes,
+variable block sizes, is extent based, and makes extensive use of
+Btrees (directories, extents, free space) to aid both performance
+and scalability.
+
+Refer to the documentation at https://xfs.wiki.kernel.org/
+for further details. This implementation is on-disk compatible
+with the IRIX version of XFS.
+
+
+Mount Options
+=============
+
+When mounting an XFS filesystem, the following options are accepted. For
+boolean mount options, the names with the "(*)" prefix is the default behaviour.
+For example, take a behaviour enabled by default to be a one (1) or, a zero (0)
+otherwise, ``(*)[no]default`` would be 0 while ``[no](*)default`` , a 1.
+
+ allocsize=<size>
+ Sets the buffered I/O end-of-file preallocation size when doing delayed
+ allocation writeout (default size is 64KiB). Valid values for this
+ option are page size (typically 4KiB) through to 1GiB, inclusive, in
+ power-of-2 increments.
+
+ The default behaviour is for dynamic end-of-file preallocation size,
+ which uses a set of heuristics to optimise the preallocation size based
+ on the current allocation patterns within the file and the access
+ patterns to the file. Specifying a fixed allocsize value turns off the
+ dynamic behaviour.
+
+ [no]attr2
+ The options enable/disable an "opportunistic" improvement to be made in
+ the way inline extended attributes are stored on-disk. When the new
+ form is used for the first time when ``attr2`` is selected (either when
+ setting or removing extended attributes) the on-disk superblock feature
+ bit field will be updated to reflect this format being in use.
+
+ The default behaviour is determined by the on-disk feature bit
+ indicating that ``attr2`` behaviour is active. If either mount option is
+ set, then that becomes the new default used by the filesystem. However
+ on CRC enabled filesystems, the ``attr2`` format is always used , and so
+ will reject the ``noattr2`` mount option if it is set.
+
+ (*)[no]discard
+ Enable/disable the issuing of commands to let the block device reclaim
+ space freed by the filesystem. This is useful for SSD devices, thinly
+ provisioned LUNs and virtual machine images, but may have a performance
+ impact.
+
+ Note: It is currently recommended that you use the ``fstrim``
+ application to discard unused blocks rather than the ``discard`` mount
+ option because the performance impact of this option is quite severe.
+
+ grpid/bsdgroups
+ nogrpid/(*)sysvgroups
+ These options define what group ID a newly created file gets. When
+ ``grpid`` is set, it takes the group ID of the directory in which it is
+ created; otherwise it takes the ``fsgid`` of the current process, unless
+ the directory has the ``setgid`` bit set, in which case it takes the
+ ``gid`` from the parent directory, and also gets the ``setgid`` bit set
+ if it is a directory itself.
+
+ filestreams
+ Make the data allocator use the filestreams allocation mode across the
+ entire filesystem rather than just on directories configured to use it.
+
+ (*)[no]ikeep
+ When ``ikeep`` is specified, XFS does not delete empty inode clusters
+ and keeps them around on disk. When ``noikeep`` is specified, empty
+ inode clusters are returned to the free space pool.
+
+ inode32 | (*)inode64
+ When ``inode32`` is specified, it indicates that XFS limits inode
+ creation to locations which will not result in inode numbers with more
+ than 32 bits of significance.
+
+ When ``inode64`` is specified, it indicates that XFS is allowed to
+ create inodes at any location in the filesystem, including those which
+ will result in inode numbers occupying more than 32 bits of
+ significance.
+
+ ``inode32`` is provided for backwards compatibility with older systems
+ and applications, since 64 bits inode numbers might cause problems for
+ some applications that cannot handle large inode numbers. If
+ applications are in use which do not handle inode numbers bigger than 32
+ bits, the ``inode32`` option should be specified.
+
+
+ (*)[no]largeio
+ If ``nolargeio`` is specified, the optimal I/O reported in st_blksize by
+ **stat(2)** will be as small as possible to allow user applications to
+ avoid inefficient read/modify/write I/O. This is typically the page
+ size of the machine, as this is the granularity of the page cache.
+
+ If ``largeio`` is specified, a filesystem that was created with a
+ ``swidth`` specified will return the ``swidth`` value (in bytes) in
+ st_blksize. If the filesystem does not have a ``swidth`` specified but
+ does specify an ``allocsize`` then ``allocsize`` (in bytes) will be
+ returned instead. Otherwise the behaviour is the same as if
+ ``nolargeio`` was specified.
+
+ logbufs=<value>
+ Set the number of in-memory log buffers to ``value``. Valid numbers
+ range from 2-8 inclusive.
+
+ The default value is 8 buffers.
+
+ If the memory cost of 8 log buffers is too high on small systems, then
+ it may be reduced at some cost to performance on metadata intensive
+ workloads. The ``logbsize`` option below controls the size of each
+ buffer and so is also relevant to this case.
+
+ logbsize=<value>
+ Set the size of each in-memory log buffer to ``value``. The size may be
+ specified in bytes, or in kilobytes with a "k" suffix. Valid sizes for
+ version 1 and version 2 logs are 16384 (16k) and 32768 (32k). Valid
+ sizes for version 2 logs also include 65536 (64k), 131072 (128k) and
+ 262144 (256k). The ``logbsize`` must be an integer multiple of the
+ "log stripe unit" configured at mkfs time.
+
+ The default value for for version 1 logs is 32768, while the default
+ value for version 2 logs is ``MAX(32768, log_sunit)``.
+
+ logdev=<device>
+ Use ``device`` as an external log (metadata journal). In an XFS
+ filesystem, the log device can be separate from the data device or
+ contained within it.
+
+ rtdev=<device>
+ An XFS filesystem has up to three parts: a data section, a log section,
+ and a real-time section. The real-time section is optional. If
+ enabled, ``rtdev`` sets ``device`` to be used as an external real-time
+ section, similar to ``logdev`` above.
+
+ noalign
+ Data allocations will not be aligned at stripe unit boundaries. This is
+ only relevant to filesystems created with non-zero data alignment
+ parameters (sunit, swidth) by mkfs.
+
+ norecovery
+ The filesystem will be mounted without running log recovery. If the
+ filesystem was not cleanly unmounted, it is likely to be inconsistent
+ when mounted in ``norecovery`` mode. Some files or directories may not
+ be accessible because of this. Filesystems mounted ``norecovery`` must
+ be mounted read-only or the mount will fail.
+
+ nouuid
+ Don't check for double mounted file systems using the file system uuid.
+ This is useful to mount LVM snapshot volumes, and often used in
+ combination with ``norecovery`` for mounting read-only snapshots.
+
+ noquota
+ Forcibly turns off all quota accounting and enforcement
+ within the filesystem.
+
+ uquota/usrquota/uqnoenforce/quota
+ User disk quota accounting enabled, and limits (optionally) enforced.
+ Refer to **xfs_quota(8)** for further details.
+
+ gquota/grpquota/gqnoenforce
+ Group disk quota accounting enabled and limits (optionally) enforced.
+ Refer to **xfs_quota(8)** for further details.
+
+ pquota/prjquota/pqnoenforce
+ Project disk quota accounting enabled and limits (optionally) enforced.
+ Refer to **xfs_quota(8)** for further details.
+
+ sunit=<value>
+ Used to specify the stripe unit for a RAID device or (in conjunction
+ with ``swidth`` below) a stripe volume. ``value`` must be specified in
+ 512-byte block units. This option is only relevant to filesystems that
+ were created with non-zero data alignment parameters.
+
+ The ``sunit`` parameter specified must be compatible with the existing
+ filesystem alignment characteristics. In general, that means the only
+ valid changes to ``sunit`` are increasing it by a power-of-2 multiple.
+
+ Typically, this mount option is necessary only after an underlying RAID
+ device has had its geometry modified, such as adding a new disk to a
+ RAID5 lun and reshaping it.
+
+ swidth=<value>
+ Used to specify the stripe width for a RAID device or (in conjunction
+ with ``sunit`` above) a stripe volume. ``value`` must be specified in
+ 512-byte block units. This option, like ``sunit`` above, is only
+ relevant to filesystems that were created with non-zero data alignment
+ parameters.
+
+ The ``swidth`` parameter specified must be compatible with the existing
+ filesystem alignment characteristics. In general, that means the only
+ valid swidth values are any integer multiple of a valid ``sunit`` value.
+
+ Typically, this mount option is necessary only after an underlying RAID
+ device has had its geometry modified, such as adding a new disk to a
+ RAID5 lun and reshaping it.
+
+
+ swalloc
+ Data allocations will be rounded up to stripe width boundaries when the
+ current end of file is being extended and the file size is larger than
+ the stripe width size.
+
+ wsync
+ When specified, all filesystem namespace operations are executed
+ synchronously. This ensures that when the namespace operation (create,
+ unlink, etc) completes, the change to the namespace is on stable
+ storage. This is useful in HA setups where failover must not result in
+ clients seeing inconsistent namespace presentation during or after a
+ failover event.
+
+
+Deprecated Mount Options
+========================
+
+ Name Removal Schedule
+ ---- ----------------
+
+
+Removed Mount Options
+=====================
+
+ Name Removed
+ ---- -------
+ delaylog/nodelaylog v4.0
+ ihashsize v4.0
+ irixsgid v4.0
+ osyncisdsync/osyncisosync v4.0
+ barrier v4.19
+ nobarrier v4.19
+
+
+sysctls
+=======
+
+The following sysctls are available for the XFS filesystem:
+
+ fs.xfs.stats_clear (Min: 0 Default: 0 Max: 1)
+ Setting this to "1" clears accumulated XFS statistics
+ in /proc/fs/xfs/stat. It then immediately resets to "0".
+
+ fs.xfs.xfssyncd_centisecs (Min: 100 Default: 3000 Max: 720000)
+ The interval at which the filesystem flushes metadata
+ out to disk and runs internal cache cleanup routines.
+
+ fs.xfs.filestream_centisecs (Min: 1 Default: 3000 Max: 360000)
+ The interval at which the filesystem ages filestreams cache
+ references and returns timed-out AGs back to the free stream
+ pool.
+
+ fs.xfs.speculative_prealloc_lifetime
+ (Units: seconds Min: 1 Default: 300 Max: 86400)
+ The interval at which the background scanning for inodes
+ with unused speculative preallocation runs. The scan
+ removes unused preallocation from clean inodes and releases
+ the unused space back to the free pool.
+
+ fs.xfs.error_level (Min: 0 Default: 3 Max: 11)
+ A volume knob for error reporting when internal errors occur.
+ This will generate detailed messages & backtraces for filesystem
+ shutdowns, for example. Current threshold values are:
+
+ XFS_ERRLEVEL_OFF: 0
+ XFS_ERRLEVEL_LOW: 1
+ XFS_ERRLEVEL_HIGH: 5
+
+ fs.xfs.panic_mask (Min: 0 Default: 0 Max: 256)
+ Causes certain error conditions to call BUG(). Value is a bitmask;
+ OR together the tags which represent errors which should cause panics:
+
+ XFS_NO_PTAG 0
+ XFS_PTAG_IFLUSH 0x00000001
+ XFS_PTAG_LOGRES 0x00000002
+ XFS_PTAG_AILDELETE 0x00000004
+ XFS_PTAG_ERROR_REPORT 0x00000008
+ XFS_PTAG_SHUTDOWN_CORRUPT 0x00000010
+ XFS_PTAG_SHUTDOWN_IOERROR 0x00000020
+ XFS_PTAG_SHUTDOWN_LOGERROR 0x00000040
+ XFS_PTAG_FSBLOCK_ZERO 0x00000080
+ XFS_PTAG_VERIFIER_ERROR 0x00000100
+
+ This option is intended for debugging only.
+
+ fs.xfs.irix_symlink_mode (Min: 0 Default: 0 Max: 1)
+ Controls whether symlinks are created with mode 0777 (default)
+ or whether their mode is affected by the umask (irix mode).
+
+ fs.xfs.irix_sgid_inherit (Min: 0 Default: 0 Max: 1)
+ Controls files created in SGID directories.
+ If the group ID of the new file does not match the effective group
+ ID or one of the supplementary group IDs of the parent dir, the
+ ISGID bit is cleared if the irix_sgid_inherit compatibility sysctl
+ is set.
+
+ fs.xfs.inherit_sync (Min: 0 Default: 1 Max: 1)
+ Setting this to "1" will cause the "sync" flag set
+ by the **xfs_io(8)** chattr command on a directory to be
+ inherited by files in that directory.
+
+ fs.xfs.inherit_nodump (Min: 0 Default: 1 Max: 1)
+ Setting this to "1" will cause the "nodump" flag set
+ by the **xfs_io(8)** chattr command on a directory to be
+ inherited by files in that directory.
+
+ fs.xfs.inherit_noatime (Min: 0 Default: 1 Max: 1)
+ Setting this to "1" will cause the "noatime" flag set
+ by the **xfs_io(8)** chattr command on a directory to be
+ inherited by files in that directory.
+
+ fs.xfs.inherit_nosymlinks (Min: 0 Default: 1 Max: 1)
+ Setting this to "1" will cause the "nosymlinks" flag set
+ by the **xfs_io(8)** chattr command on a directory to be
+ inherited by files in that directory.
+
+ fs.xfs.inherit_nodefrag (Min: 0 Default: 1 Max: 1)
+ Setting this to "1" will cause the "nodefrag" flag set
+ by the **xfs_io(8)** chattr command on a directory to be
+ inherited by files in that directory.
+
+ fs.xfs.rotorstep (Min: 1 Default: 1 Max: 256)
+ In "inode32" allocation mode, this option determines how many
+ files the allocator attempts to allocate in the same allocation
+ group before moving to the next allocation group. The intent
+ is to control the rate at which the allocator moves between
+ allocation groups when allocating extents for new files.
+
+Deprecated Sysctls
+==================
+
+None at present.
+
+
+Removed Sysctls
+===============
+
+ Name Removed
+ ---- -------
+ fs.xfs.xfsbufd_centisec v4.0
+ fs.xfs.age_buffer_centisecs v4.0
+
+
+Error handling
+==============
+
+XFS can act differently according to the type of error found during its
+operation. The implementation introduces the following concepts to the error
+handler:
+
+ -failure speed:
+ Defines how fast XFS should propagate an error upwards when a specific
+ error is found during the filesystem operation. It can propagate
+ immediately, after a defined number of retries, after a set time period,
+ or simply retry forever.
+
+ -error classes:
+ Specifies the subsystem the error configuration will apply to, such as
+ metadata IO or memory allocation. Different subsystems will have
+ different error handlers for which behaviour can be configured.
+
+ -error handlers:
+ Defines the behavior for a specific error.
+
+The filesystem behavior during an error can be set via sysfs files. Each
+error handler works independently - the first condition met by an error handler
+for a specific class will cause the error to be propagated rather than reset and
+retried.
+
+The action taken by the filesystem when the error is propagated is context
+dependent - it may cause a shut down in the case of an unrecoverable error,
+it may be reported back to userspace, or it may even be ignored because
+there's nothing useful we can with the error or anyone we can report it to (e.g.
+during unmount).
+
+The configuration files are organized into the following hierarchy for each
+mounted filesystem:
+
+ /sys/fs/xfs/<dev>/error/<class>/<error>/
+
+Where:
+ <dev>
+ The short device name of the mounted filesystem. This is the same device
+ name that shows up in XFS kernel error messages as "XFS(<dev>): ..."
+
+ <class>
+ The subsystem the error configuration belongs to. As of 4.9, the defined
+ classes are:
+
+ - "metadata": applies metadata buffer write IO
+
+ <error>
+ The individual error handler configurations.
+
+
+Each filesystem has "global" error configuration options defined in their top
+level directory:
+
+ /sys/fs/xfs/<dev>/error/
+
+ fail_at_unmount (Min: 0 Default: 1 Max: 1)
+ Defines the filesystem error behavior at unmount time.
+
+ If set to a value of 1, XFS will override all other error configurations
+ during unmount and replace them with "immediate fail" characteristics.
+ i.e. no retries, no retry timeout. This will always allow unmount to
+ succeed when there are persistent errors present.
+
+ If set to 0, the configured retry behaviour will continue until all
+ retries and/or timeouts have been exhausted. This will delay unmount
+ completion when there are persistent errors, and it may prevent the
+ filesystem from ever unmounting fully in the case of "retry forever"
+ handler configurations.
+
+ Note: there is no guarantee that fail_at_unmount can be set while an
+ unmount is in progress. It is possible that the sysfs entries are
+ removed by the unmounting filesystem before a "retry forever" error
+ handler configuration causes unmount to hang, and hence the filesystem
+ must be configured appropriately before unmount begins to prevent
+ unmount hangs.
+
+Each filesystem has specific error class handlers that define the error
+propagation behaviour for specific errors. There is also a "default" error
+handler defined, which defines the behaviour for all errors that don't have
+specific handlers defined. Where multiple retry constraints are configuredi for
+a single error, the first retry configuration that expires will cause the error
+to be propagated. The handler configurations are found in the directory:
+
+ /sys/fs/xfs/<dev>/error/<class>/<error>/
+
+ max_retries (Min: -1 Default: Varies Max: INTMAX)
+ Defines the allowed number of retries of a specific error before
+ the filesystem will propagate the error. The retry count for a given
+ error context (e.g. a specific metadata buffer) is reset every time
+ there is a successful completion of the operation.
+
+ Setting the value to "-1" will cause XFS to retry forever for this
+ specific error.
+
+ Setting the value to "0" will cause XFS to fail immediately when the
+ specific error is reported.
+
+ Setting the value to "N" (where 0 < N < Max) will make XFS retry the
+ operation "N" times before propagating the error.
+
+ retry_timeout_seconds (Min: -1 Default: Varies Max: 1 day)
+ Define the amount of time (in seconds) that the filesystem is
+ allowed to retry its operations when the specific error is
+ found.
+
+ Setting the value to "-1" will allow XFS to retry forever for this
+ specific error.
+
+ Setting the value to "0" will cause XFS to fail immediately when the
+ specific error is reported.
+
+ Setting the value to "N" (where 0 < N < Max) will allow XFS to retry the
+ operation for up to "N" seconds before propagating the error.
+
+Note: The default behaviour for a specific error handler is dependent on both
+the class and error context. For example, the default values for
+"metadata/ENODEV" are "0" rather than "-1" so that this error handler defaults
+to "fail immediately" behaviour. This is done because ENODEV is a fatal,
+unrecoverable error no matter how many times the metadata IO is retried.
diff --git a/Documentation/filesystems/xfs.txt b/Documentation/filesystems/xfs.txt
deleted file mode 100644
index a5cbb5e0e..000000000
--- a/Documentation/filesystems/xfs.txt
+++ /dev/null
@@ -1,470 +0,0 @@
-
-The SGI XFS Filesystem
-======================
-
-XFS is a high performance journaling filesystem which originated
-on the SGI IRIX platform. It is completely multi-threaded, can
-support large files and large filesystems, extended attributes,
-variable block sizes, is extent based, and makes extensive use of
-Btrees (directories, extents, free space) to aid both performance
-and scalability.
-
-Refer to the documentation at https://xfs.wiki.kernel.org/
-for further details. This implementation is on-disk compatible
-with the IRIX version of XFS.
-
-
-Mount Options
-=============
-
-When mounting an XFS filesystem, the following options are accepted.
-For boolean mount options, the names with the (*) suffix is the
-default behaviour.
-
- allocsize=size
- Sets the buffered I/O end-of-file preallocation size when
- doing delayed allocation writeout (default size is 64KiB).
- Valid values for this option are page size (typically 4KiB)
- through to 1GiB, inclusive, in power-of-2 increments.
-
- The default behaviour is for dynamic end-of-file
- preallocation size, which uses a set of heuristics to
- optimise the preallocation size based on the current
- allocation patterns within the file and the access patterns
- to the file. Specifying a fixed allocsize value turns off
- the dynamic behaviour.
-
- attr2
- noattr2
- The options enable/disable an "opportunistic" improvement to
- be made in the way inline extended attributes are stored
- on-disk. When the new form is used for the first time when
- attr2 is selected (either when setting or removing extended
- attributes) the on-disk superblock feature bit field will be
- updated to reflect this format being in use.
-
- The default behaviour is determined by the on-disk feature
- bit indicating that attr2 behaviour is active. If either
- mount option it set, then that becomes the new default used
- by the filesystem.
-
- CRC enabled filesystems always use the attr2 format, and so
- will reject the noattr2 mount option if it is set.
-
- discard
- nodiscard (*)
- Enable/disable the issuing of commands to let the block
- device reclaim space freed by the filesystem. This is
- useful for SSD devices, thinly provisioned LUNs and virtual
- machine images, but may have a performance impact.
-
- Note: It is currently recommended that you use the fstrim
- application to discard unused blocks rather than the discard
- mount option because the performance impact of this option
- is quite severe.
-
- grpid/bsdgroups
- nogrpid/sysvgroups (*)
- These options define what group ID a newly created file
- gets. When grpid is set, it takes the group ID of the
- directory in which it is created; otherwise it takes the
- fsgid of the current process, unless the directory has the
- setgid bit set, in which case it takes the gid from the
- parent directory, and also gets the setgid bit set if it is
- a directory itself.
-
- filestreams
- Make the data allocator use the filestreams allocation mode
- across the entire filesystem rather than just on directories
- configured to use it.
-
- ikeep
- noikeep (*)
- When ikeep is specified, XFS does not delete empty inode
- clusters and keeps them around on disk. When noikeep is
- specified, empty inode clusters are returned to the free
- space pool.
-
- inode32
- inode64 (*)
- When inode32 is specified, it indicates that XFS limits
- inode creation to locations which will not result in inode
- numbers with more than 32 bits of significance.
-
- When inode64 is specified, it indicates that XFS is allowed
- to create inodes at any location in the filesystem,
- including those which will result in inode numbers occupying
- more than 32 bits of significance.
-
- inode32 is provided for backwards compatibility with older
- systems and applications, since 64 bits inode numbers might
- cause problems for some applications that cannot handle
- large inode numbers. If applications are in use which do
- not handle inode numbers bigger than 32 bits, the inode32
- option should be specified.
-
-
- largeio
- nolargeio (*)
- If "nolargeio" is specified, the optimal I/O reported in
- st_blksize by stat(2) will be as small as possible to allow
- user applications to avoid inefficient read/modify/write
- I/O. This is typically the page size of the machine, as
- this is the granularity of the page cache.
-
- If "largeio" specified, a filesystem that was created with a
- "swidth" specified will return the "swidth" value (in bytes)
- in st_blksize. If the filesystem does not have a "swidth"
- specified but does specify an "allocsize" then "allocsize"
- (in bytes) will be returned instead. Otherwise the behaviour
- is the same as if "nolargeio" was specified.
-
- logbufs=value
- Set the number of in-memory log buffers. Valid numbers
- range from 2-8 inclusive.
-
- The default value is 8 buffers.
-
- If the memory cost of 8 log buffers is too high on small
- systems, then it may be reduced at some cost to performance
- on metadata intensive workloads. The logbsize option below
- controls the size of each buffer and so is also relevant to
- this case.
-
- logbsize=value
- Set the size of each in-memory log buffer. The size may be
- specified in bytes, or in kilobytes with a "k" suffix.
- Valid sizes for version 1 and version 2 logs are 16384 (16k)
- and 32768 (32k). Valid sizes for version 2 logs also
- include 65536 (64k), 131072 (128k) and 262144 (256k). The
- logbsize must be an integer multiple of the log
- stripe unit configured at mkfs time.
-
- The default value for for version 1 logs is 32768, while the
- default value for version 2 logs is MAX(32768, log_sunit).
-
- logdev=device and rtdev=device
- Use an external log (metadata journal) and/or real-time device.
- An XFS filesystem has up to three parts: a data section, a log
- section, and a real-time section. The real-time section is
- optional, and the log section can be separate from the data
- section or contained within it.
-
- noalign
- Data allocations will not be aligned at stripe unit
- boundaries. This is only relevant to filesystems created
- with non-zero data alignment parameters (sunit, swidth) by
- mkfs.
-
- norecovery
- The filesystem will be mounted without running log recovery.
- If the filesystem was not cleanly unmounted, it is likely to
- be inconsistent when mounted in "norecovery" mode.
- Some files or directories may not be accessible because of this.
- Filesystems mounted "norecovery" must be mounted read-only or
- the mount will fail.
-
- nouuid
- Don't check for double mounted file systems using the file
- system uuid. This is useful to mount LVM snapshot volumes,
- and often used in combination with "norecovery" for mounting
- read-only snapshots.
-
- noquota
- Forcibly turns off all quota accounting and enforcement
- within the filesystem.
-
- uquota/usrquota/uqnoenforce/quota
- User disk quota accounting enabled, and limits (optionally)
- enforced. Refer to xfs_quota(8) for further details.
-
- gquota/grpquota/gqnoenforce
- Group disk quota accounting enabled and limits (optionally)
- enforced. Refer to xfs_quota(8) for further details.
-
- pquota/prjquota/pqnoenforce
- Project disk quota accounting enabled and limits (optionally)
- enforced. Refer to xfs_quota(8) for further details.
-
- sunit=value and swidth=value
- Used to specify the stripe unit and width for a RAID device
- or a stripe volume. "value" must be specified in 512-byte
- block units. These options are only relevant to filesystems
- that were created with non-zero data alignment parameters.
-
- The sunit and swidth parameters specified must be compatible
- with the existing filesystem alignment characteristics. In
- general, that means the only valid changes to sunit are
- increasing it by a power-of-2 multiple. Valid swidth values
- are any integer multiple of a valid sunit value.
-
- Typically the only time these mount options are necessary if
- after an underlying RAID device has had it's geometry
- modified, such as adding a new disk to a RAID5 lun and
- reshaping it.
-
- swalloc
- Data allocations will be rounded up to stripe width boundaries
- when the current end of file is being extended and the file
- size is larger than the stripe width size.
-
- wsync
- When specified, all filesystem namespace operations are
- executed synchronously. This ensures that when the namespace
- operation (create, unlink, etc) completes, the change to the
- namespace is on stable storage. This is useful in HA setups
- where failover must not result in clients seeing
- inconsistent namespace presentation during or after a
- failover event.
-
-
-Deprecated Mount Options
-========================
-
- Name Removal Schedule
- ---- ----------------
-
-
-Removed Mount Options
-=====================
-
- Name Removed
- ---- -------
- delaylog/nodelaylog v4.0
- ihashsize v4.0
- irixsgid v4.0
- osyncisdsync/osyncisosync v4.0
- barrier v4.19
- nobarrier v4.19
-
-
-sysctls
-=======
-
-The following sysctls are available for the XFS filesystem:
-
- fs.xfs.stats_clear (Min: 0 Default: 0 Max: 1)
- Setting this to "1" clears accumulated XFS statistics
- in /proc/fs/xfs/stat. It then immediately resets to "0".
-
- fs.xfs.xfssyncd_centisecs (Min: 100 Default: 3000 Max: 720000)
- The interval at which the filesystem flushes metadata
- out to disk and runs internal cache cleanup routines.
-
- fs.xfs.filestream_centisecs (Min: 1 Default: 3000 Max: 360000)
- The interval at which the filesystem ages filestreams cache
- references and returns timed-out AGs back to the free stream
- pool.
-
- fs.xfs.speculative_prealloc_lifetime
- (Units: seconds Min: 1 Default: 300 Max: 86400)
- The interval at which the background scanning for inodes
- with unused speculative preallocation runs. The scan
- removes unused preallocation from clean inodes and releases
- the unused space back to the free pool.
-
- fs.xfs.error_level (Min: 0 Default: 3 Max: 11)
- A volume knob for error reporting when internal errors occur.
- This will generate detailed messages & backtraces for filesystem
- shutdowns, for example. Current threshold values are:
-
- XFS_ERRLEVEL_OFF: 0
- XFS_ERRLEVEL_LOW: 1
- XFS_ERRLEVEL_HIGH: 5
-
- fs.xfs.panic_mask (Min: 0 Default: 0 Max: 256)
- Causes certain error conditions to call BUG(). Value is a bitmask;
- OR together the tags which represent errors which should cause panics:
-
- XFS_NO_PTAG 0
- XFS_PTAG_IFLUSH 0x00000001
- XFS_PTAG_LOGRES 0x00000002
- XFS_PTAG_AILDELETE 0x00000004
- XFS_PTAG_ERROR_REPORT 0x00000008
- XFS_PTAG_SHUTDOWN_CORRUPT 0x00000010
- XFS_PTAG_SHUTDOWN_IOERROR 0x00000020
- XFS_PTAG_SHUTDOWN_LOGERROR 0x00000040
- XFS_PTAG_FSBLOCK_ZERO 0x00000080
- XFS_PTAG_VERIFIER_ERROR 0x00000100
-
- This option is intended for debugging only.
-
- fs.xfs.irix_symlink_mode (Min: 0 Default: 0 Max: 1)
- Controls whether symlinks are created with mode 0777 (default)
- or whether their mode is affected by the umask (irix mode).
-
- fs.xfs.irix_sgid_inherit (Min: 0 Default: 0 Max: 1)
- Controls files created in SGID directories.
- If the group ID of the new file does not match the effective group
- ID or one of the supplementary group IDs of the parent dir, the
- ISGID bit is cleared if the irix_sgid_inherit compatibility sysctl
- is set.
-
- fs.xfs.inherit_sync (Min: 0 Default: 1 Max: 1)
- Setting this to "1" will cause the "sync" flag set
- by the xfs_io(8) chattr command on a directory to be
- inherited by files in that directory.
-
- fs.xfs.inherit_nodump (Min: 0 Default: 1 Max: 1)
- Setting this to "1" will cause the "nodump" flag set
- by the xfs_io(8) chattr command on a directory to be
- inherited by files in that directory.
-
- fs.xfs.inherit_noatime (Min: 0 Default: 1 Max: 1)
- Setting this to "1" will cause the "noatime" flag set
- by the xfs_io(8) chattr command on a directory to be
- inherited by files in that directory.
-
- fs.xfs.inherit_nosymlinks (Min: 0 Default: 1 Max: 1)
- Setting this to "1" will cause the "nosymlinks" flag set
- by the xfs_io(8) chattr command on a directory to be
- inherited by files in that directory.
-
- fs.xfs.inherit_nodefrag (Min: 0 Default: 1 Max: 1)
- Setting this to "1" will cause the "nodefrag" flag set
- by the xfs_io(8) chattr command on a directory to be
- inherited by files in that directory.
-
- fs.xfs.rotorstep (Min: 1 Default: 1 Max: 256)
- In "inode32" allocation mode, this option determines how many
- files the allocator attempts to allocate in the same allocation
- group before moving to the next allocation group. The intent
- is to control the rate at which the allocator moves between
- allocation groups when allocating extents for new files.
-
-Deprecated Sysctls
-==================
-
-None at present.
-
-
-Removed Sysctls
-===============
-
- Name Removed
- ---- -------
- fs.xfs.xfsbufd_centisec v4.0
- fs.xfs.age_buffer_centisecs v4.0
-
-
-Error handling
-==============
-
-XFS can act differently according to the type of error found during its
-operation. The implementation introduces the following concepts to the error
-handler:
-
- -failure speed:
- Defines how fast XFS should propagate an error upwards when a specific
- error is found during the filesystem operation. It can propagate
- immediately, after a defined number of retries, after a set time period,
- or simply retry forever.
-
- -error classes:
- Specifies the subsystem the error configuration will apply to, such as
- metadata IO or memory allocation. Different subsystems will have
- different error handlers for which behaviour can be configured.
-
- -error handlers:
- Defines the behavior for a specific error.
-
-The filesystem behavior during an error can be set via sysfs files. Each
-error handler works independently - the first condition met by an error handler
-for a specific class will cause the error to be propagated rather than reset and
-retried.
-
-The action taken by the filesystem when the error is propagated is context
-dependent - it may cause a shut down in the case of an unrecoverable error,
-it may be reported back to userspace, or it may even be ignored because
-there's nothing useful we can with the error or anyone we can report it to (e.g.
-during unmount).
-
-The configuration files are organized into the following hierarchy for each
-mounted filesystem:
-
- /sys/fs/xfs/<dev>/error/<class>/<error>/
-
-Where:
- <dev>
- The short device name of the mounted filesystem. This is the same device
- name that shows up in XFS kernel error messages as "XFS(<dev>): ..."
-
- <class>
- The subsystem the error configuration belongs to. As of 4.9, the defined
- classes are:
-
- - "metadata": applies metadata buffer write IO
-
- <error>
- The individual error handler configurations.
-
-
-Each filesystem has "global" error configuration options defined in their top
-level directory:
-
- /sys/fs/xfs/<dev>/error/
-
- fail_at_unmount (Min: 0 Default: 1 Max: 1)
- Defines the filesystem error behavior at unmount time.
-
- If set to a value of 1, XFS will override all other error configurations
- during unmount and replace them with "immediate fail" characteristics.
- i.e. no retries, no retry timeout. This will always allow unmount to
- succeed when there are persistent errors present.
-
- If set to 0, the configured retry behaviour will continue until all
- retries and/or timeouts have been exhausted. This will delay unmount
- completion when there are persistent errors, and it may prevent the
- filesystem from ever unmounting fully in the case of "retry forever"
- handler configurations.
-
- Note: there is no guarantee that fail_at_unmount can be set while an
- unmount is in progress. It is possible that the sysfs entries are
- removed by the unmounting filesystem before a "retry forever" error
- handler configuration causes unmount to hang, and hence the filesystem
- must be configured appropriately before unmount begins to prevent
- unmount hangs.
-
-Each filesystem has specific error class handlers that define the error
-propagation behaviour for specific errors. There is also a "default" error
-handler defined, which defines the behaviour for all errors that don't have
-specific handlers defined. Where multiple retry constraints are configuredi for
-a single error, the first retry configuration that expires will cause the error
-to be propagated. The handler configurations are found in the directory:
-
- /sys/fs/xfs/<dev>/error/<class>/<error>/
-
- max_retries (Min: -1 Default: Varies Max: INTMAX)
- Defines the allowed number of retries of a specific error before
- the filesystem will propagate the error. The retry count for a given
- error context (e.g. a specific metadata buffer) is reset every time
- there is a successful completion of the operation.
-
- Setting the value to "-1" will cause XFS to retry forever for this
- specific error.
-
- Setting the value to "0" will cause XFS to fail immediately when the
- specific error is reported.
-
- Setting the value to "N" (where 0 < N < Max) will make XFS retry the
- operation "N" times before propagating the error.
-
- retry_timeout_seconds (Min: -1 Default: Varies Max: 1 day)
- Define the amount of time (in seconds) that the filesystem is
- allowed to retry its operations when the specific error is
- found.
-
- Setting the value to "-1" will allow XFS to retry forever for this
- specific error.
-
- Setting the value to "0" will cause XFS to fail immediately when the
- specific error is reported.
-
- Setting the value to "N" (where 0 < N < Max) will allow XFS to retry the
- operation for up to "N" seconds before propagating the error.
-
-Note: The default behaviour for a specific error handler is dependent on both
-the class and error context. For example, the default values for
-"metadata/ENODEV" are "0" rather than "-1" so that this error handler defaults
-to "fail immediately" behaviour. This is done because ENODEV is a fatal,
-unrecoverable error no matter how many times the metadata IO is retried.
diff --git a/MAINTAINERS b/MAINTAINERS
index d0ed73599..66e972e9a 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -17364,7 +17364,7 @@ L: linux-xfs@vger.kernel.org
W: http://xfs.org/
T: git git://git.kernel.org/pub/scm/fs/xfs/xfs-linux.git
S: Supported
-F: Documentation/filesystems/xfs.txt
+F: Documentation/filesystems/xfs.rst
F: fs/xfs/
XILINX AXI ETHERNET DRIVER
--
2.22.0
^ permalink raw reply related
* Re: [PATCH v5] Documentation:sh:convert register-banks.txt and new-machine.txt to rst format.
From: Mauro Carvalho Chehab @ 2019-06-29 16:48 UTC (permalink / raw)
To: Vandana BN
Cc: Yoshinori Sato, Rich Felker, Jonathan Corbet, linux-sh, linux-doc,
linux-kernel, skhan, gregkh, linux-kernel-mentees
In-Reply-To: <20190629162501.4901-1-bnvandana@gmail.com>
Em Sat, 29 Jun 2019 21:55:01 +0530
Vandana BN <bnvandana@gmail.com> escreveu:
> This patch converts new-machine.txt and register-banks.txt
> to ReST format, No content change.
> Added interfaces.rst to contain kernel-doc markups from index.rst
> Added interfaces.rst,new-machine.rst and register-banks.rst to sh/index.rst
> Added SPDX tag in index.rst
> Fixed broken reference in arch/sh/Kconfig.cpu
>
> Signed-off-by: Vandana BN <bnvandana@gmail.com>
Reviewed-by: Mauro Carvalho Chehab <mchehab@kernel.org>
> ---
> Documentation/sh/index.rst | 65 +------
> Documentation/sh/interface.rst | 59 ++++++
> .../sh/{new-machine.txt => new-machine.rst} | 171 +++++++++---------
> ...{register-banks.txt => register-banks.rst} | 8 +-
> arch/sh/Kconfig.cpu | 2 +-
> 5 files changed, 164 insertions(+), 141 deletions(-)
> create mode 100644 Documentation/sh/interface.rst
> rename Documentation/sh/{new-machine.txt => new-machine.rst} (79%)
> rename Documentation/sh/{register-banks.txt => register-banks.rst} (90%)
>
> diff --git a/Documentation/sh/index.rst b/Documentation/sh/index.rst
> index bc8db7ba894a..fec3c405b6b9 100644
> --- a/Documentation/sh/index.rst
> +++ b/Documentation/sh/index.rst
> @@ -1,59 +1,14 @@
> -=======================
> -SuperH Interfaces Guide
> -=======================
> +.. SPDX-License-Identifier: GPL-2.0
>
> -:Author: Paul Mundt
> -
> -Memory Management
> -=================
> -
> -SH-4
> -----
> -
> -Store Queue API
> -~~~~~~~~~~~~~~~
> -
> -.. kernel-doc:: arch/sh/kernel/cpu/sh4/sq.c
> - :export:
> -
> -SH-5
> -----
> -
> -TLB Interfaces
> -~~~~~~~~~~~~~~
> -
> -.. kernel-doc:: arch/sh/mm/tlb-sh5.c
> - :internal:
> -
> -.. kernel-doc:: arch/sh/include/asm/tlb_64.h
> - :internal:
> +====================
> +SuperH Documentation
> +====================
>
> -Machine Specific Interfaces
> -===========================
> -
> -mach-dreamcast
> ---------------
> -
> -.. kernel-doc:: arch/sh/boards/mach-dreamcast/rtc.c
> - :internal:
> -
> -mach-x3proto
> -------------
> -
> -.. kernel-doc:: arch/sh/boards/mach-x3proto/ilsel.c
> - :export:
> -
> -Busses
> -======
> -
> -SuperHyway
> -----------
> -
> -.. kernel-doc:: drivers/sh/superhyway/superhyway.c
> - :export:
> +:Author: Paul Mundt
>
> -Maple
> ------
> +.. toctree::
> + :maxdepth: 2
>
> -.. kernel-doc:: drivers/sh/maple/maple.c
> - :export:
> + interface
> + new-machine
> + register-banks
> diff --git a/Documentation/sh/interface.rst b/Documentation/sh/interface.rst
> new file mode 100644
> index 000000000000..bc8db7ba894a
> --- /dev/null
> +++ b/Documentation/sh/interface.rst
> @@ -0,0 +1,59 @@
> +=======================
> +SuperH Interfaces Guide
> +=======================
> +
> +:Author: Paul Mundt
> +
> +Memory Management
> +=================
> +
> +SH-4
> +----
> +
> +Store Queue API
> +~~~~~~~~~~~~~~~
> +
> +.. kernel-doc:: arch/sh/kernel/cpu/sh4/sq.c
> + :export:
> +
> +SH-5
> +----
> +
> +TLB Interfaces
> +~~~~~~~~~~~~~~
> +
> +.. kernel-doc:: arch/sh/mm/tlb-sh5.c
> + :internal:
> +
> +.. kernel-doc:: arch/sh/include/asm/tlb_64.h
> + :internal:
> +
> +Machine Specific Interfaces
> +===========================
> +
> +mach-dreamcast
> +--------------
> +
> +.. kernel-doc:: arch/sh/boards/mach-dreamcast/rtc.c
> + :internal:
> +
> +mach-x3proto
> +------------
> +
> +.. kernel-doc:: arch/sh/boards/mach-x3proto/ilsel.c
> + :export:
> +
> +Busses
> +======
> +
> +SuperHyway
> +----------
> +
> +.. kernel-doc:: drivers/sh/superhyway/superhyway.c
> + :export:
> +
> +Maple
> +-----
> +
> +.. kernel-doc:: drivers/sh/maple/maple.c
> + :export:
> diff --git a/Documentation/sh/new-machine.txt b/Documentation/sh/new-machine.rst
> similarity index 79%
> rename from Documentation/sh/new-machine.txt
> rename to Documentation/sh/new-machine.rst
> index e0961a66130b..b16c33342642 100644
> --- a/Documentation/sh/new-machine.txt
> +++ b/Documentation/sh/new-machine.rst
> @@ -1,8 +1,8 @@
> +================================
> +Adding a new board to LinuxSH
> +================================
>
> - Adding a new board to LinuxSH
> - ================================
> -
> - Paul Mundt <lethal@linux-sh.org>
> +Paul Mundt <lethal@linux-sh.org>
>
> This document attempts to outline what steps are necessary to add support
> for new boards to the LinuxSH port under the new 2.5 and 2.6 kernels. This
> @@ -19,65 +19,67 @@ include/asm-sh/. For the new kernel, things are broken out by board type,
> companion chip type, and CPU type. Looking at a tree view of this directory
> hierarchy looks like the following:
>
> -Board-specific code:
> -
> -.
> -|-- arch
> -| `-- sh
> -| `-- boards
> -| |-- adx
> -| | `-- board-specific files
> -| |-- bigsur
> -| | `-- board-specific files
> -| |
> -| ... more boards here ...
> -|
> -`-- include
> - `-- asm-sh
> - |-- adx
> - | `-- board-specific headers
> - |-- bigsur
> - | `-- board-specific headers
> - |
> - .. more boards here ...
> -
> -Next, for companion chips:
> -.
> -`-- arch
> - `-- sh
> - `-- cchips
> - `-- hd6446x
> - `-- hd64461
> - `-- cchip-specific files
> +Board-specific code::
> +
> + .
> + |-- arch
> + | `-- sh
> + | `-- boards
> + | |-- adx
> + | | `-- board-specific files
> + | |-- bigsur
> + | | `-- board-specific files
> + | |
> + | ... more boards here ...
> + |
> + `-- include
> + `-- asm-sh
> + |-- adx
> + | `-- board-specific headers
> + |-- bigsur
> + | `-- board-specific headers
> + |
> + .. more boards here ...
> +
> +Next, for companion chips::
> +
> + .
> + `-- arch
> + `-- sh
> + `-- cchips
> + `-- hd6446x
> + `-- hd64461
> + `-- cchip-specific files
>
> ... and so on. Headers for the companion chips are treated the same way as
> board-specific headers. Thus, include/asm-sh/hd64461 is home to all of the
> hd64461-specific headers.
>
> -Finally, CPU family support is also abstracted:
> -.
> -|-- arch
> -| `-- sh
> -| |-- kernel
> -| | `-- cpu
> -| | |-- sh2
> -| | | `-- SH-2 generic files
> -| | |-- sh3
> -| | | `-- SH-3 generic files
> -| | `-- sh4
> -| | `-- SH-4 generic files
> -| `-- mm
> -| `-- This is also broken out per CPU family, so each family can
> -| have their own set of cache/tlb functions.
> -|
> -`-- include
> - `-- asm-sh
> - |-- cpu-sh2
> - | `-- SH-2 specific headers
> - |-- cpu-sh3
> - | `-- SH-3 specific headers
> - `-- cpu-sh4
> - `-- SH-4 specific headers
> +Finally, CPU family support is also abstracted::
> +
> + .
> + |-- arch
> + | `-- sh
> + | |-- kernel
> + | | `-- cpu
> + | | |-- sh2
> + | | | `-- SH-2 generic files
> + | | |-- sh3
> + | | | `-- SH-3 generic files
> + | | `-- sh4
> + | | `-- SH-4 generic files
> + | `-- mm
> + | `-- This is also broken out per CPU family, so each family can
> + | have their own set of cache/tlb functions.
> + |
> + `-- include
> + `-- asm-sh
> + |-- cpu-sh2
> + | `-- SH-2 specific headers
> + |-- cpu-sh3
> + | `-- SH-3 specific headers
> + `-- cpu-sh4
> + `-- SH-4 specific headers
>
> It should be noted that CPU subtypes are _not_ abstracted. Thus, these still
> need to be dealt with by the CPU family specific code.
> @@ -112,18 +114,20 @@ setup code, we're required at the very least to provide definitions for
> get_system_type() and platform_setup(). For our imaginary board, this
> might look something like:
>
> -/*
> - * arch/sh/boards/vapor/setup.c - Setup code for imaginary board
> - */
> -#include <linux/init.h>
> +.. code-block:: c
> +
> + /*
> + * arch/sh/boards/vapor/setup.c - Setup code for imaginary board
> + */
> + #include <linux/init.h>
>
> -const char *get_system_type(void)
> -{
> - return "FooTech Vaporboard";
> -}
> + const char *get_system_type(void)
> + {
> + return "FooTech Vaporboard";
> + }
>
> -int __init platform_setup(void)
> -{
> + int __init platform_setup(void)
> + {
> /*
> * If our hardware actually existed, we would do real
> * setup here. Though it's also sane to leave this empty
> @@ -136,7 +140,8 @@ int __init platform_setup(void)
> /* And whatever else ... */
>
> return 0;
> -}
> + }
> +
>
> Our new imaginary board will also have to tie into the machvec in order for it
> to be of any use.
> @@ -172,16 +177,17 @@ sufficient.
> vector.
>
> Note that these prototypes are generated automatically by setting
> - __IO_PREFIX to something sensible. A typical example would be:
> + __IO_PREFIX to something sensible. A typical example would be::
>
> #define __IO_PREFIX vapor
> #include <asm/io_generic.h>
>
> +
> somewhere in the board-specific header. Any boards being ported that still
> have a legacy io.h should remove it entirely and switch to the new model.
>
> - Add machine vector definitions to the board's setup.c. At a bare minimum,
> - this must be defined as something like:
> + this must be defined as something like::
>
> struct sh_machine_vector mv_vapor __initmv = {
> .mv_name = "vapor",
> @@ -202,11 +208,11 @@ Large portions of the build system are now entirely dynamic, and merely
> require the proper entry here and there in order to get things done.
>
> The first thing to do is to add an entry to arch/sh/Kconfig, under the
> -"System type" menu:
> +"System type" menu::
>
> -config SH_VAPOR
> - bool "Vapor"
> - help
> + config SH_VAPOR
> + bool "Vapor"
> + help
> select Vapor if configuring for a FooTech Vaporboard.
>
> next, this has to be added into arch/sh/Makefile. All boards require a
> @@ -232,6 +238,8 @@ space restating it here. After this is done, you will be able to use
> implicit checks for your board if you need this somewhere throughout the
> common code, such as:
>
> +::
> +
> /* Make sure we're on the FooTech Vaporboard */
> if (!mach_is_vapor())
> return -ENODEV;
> @@ -253,12 +261,13 @@ build target, and it will be implicitly listed as such in the help text.
> Looking at the 'make help' output, you should now see something like:
>
> Architecture specific targets (sh):
> - zImage - Compressed kernel image (arch/sh/boot/zImage)
> - adx_defconfig - Build for adx
> - cqreek_defconfig - Build for cqreek
> - dreamcast_defconfig - Build for dreamcast
> -...
> - vapor_defconfig - Build for vapor
> +
> + - zImage - Compressed kernel image (arch/sh/boot/zImage)
> + - adx_defconfig - Build for adx
> + - cqreek_defconfig - Build for cqreek
> + - dreamcast_defconfig - Build for dreamcast
> + - ...
> + - vapor_defconfig - Build for vapor
>
> which then allows you to do:
>
> diff --git a/Documentation/sh/register-banks.txt b/Documentation/sh/register-banks.rst
> similarity index 90%
> rename from Documentation/sh/register-banks.txt
> rename to Documentation/sh/register-banks.rst
> index a6719f2f6594..acccfaf80355 100644
> --- a/Documentation/sh/register-banks.txt
> +++ b/Documentation/sh/register-banks.rst
> @@ -1,8 +1,9 @@
> - Notes on register bank usage in the kernel
> - ==========================================
> +==========================================
> +Notes on register bank usage in the kernel
> +==========================================
>
> Introduction
> -------------
> +============
>
> The SH-3 and SH-4 CPU families traditionally include a single partial register
> bank (selected by SR.RB, only r0 ... r7 are banked), whereas other families
> @@ -30,4 +31,3 @@ Presently the kernel uses several of these registers.
> - The SR.IMASK interrupt handler makes use of this to set the
> interrupt priority level (used by local_irq_enable())
> - r7_bank (current)
> -
> diff --git a/arch/sh/Kconfig.cpu b/arch/sh/Kconfig.cpu
> index 4a4edc7e03d4..07ad7597cbe7 100644
> --- a/arch/sh/Kconfig.cpu
> +++ b/arch/sh/Kconfig.cpu
> @@ -94,7 +94,7 @@ config CPU_HAS_SR_RB
> that are lacking this bit must have another method in place for
> accomplishing what is taken care of by the banked registers.
>
> - See <file:Documentation/sh/register-banks.txt> for further
> + See <file:Documentation/sh/register-banks.rst> for further
> information on SR.RB and register banking in the kernel in general.
>
> config CPU_HAS_PTEAEX
> --
> 2.17.1
>
Thanks,
Mauro
^ permalink raw reply
* [PATCH v5] Documentation:sh:convert register-banks.txt and new-machine.txt to rst format.
From: Vandana BN @ 2019-06-29 16:25 UTC (permalink / raw)
To: Yoshinori Sato, Rich Felker, Jonathan Corbet, linux-sh, linux-doc,
linux-kernel, mchehab
Cc: skhan, gregkh, linux-kernel-mentees, Vandana BN
In-Reply-To: <20190627063347.11137-1-bnvandana@gmail.com>
This patch converts new-machine.txt and register-banks.txt
to ReST format, No content change.
Added interfaces.rst to contain kernel-doc markups from index.rst
Added interfaces.rst,new-machine.rst and register-banks.rst to sh/index.rst
Added SPDX tag in index.rst
Fixed broken reference in arch/sh/Kconfig.cpu
Signed-off-by: Vandana BN <bnvandana@gmail.com>
---
Documentation/sh/index.rst | 65 +------
Documentation/sh/interface.rst | 59 ++++++
.../sh/{new-machine.txt => new-machine.rst} | 171 +++++++++---------
...{register-banks.txt => register-banks.rst} | 8 +-
arch/sh/Kconfig.cpu | 2 +-
5 files changed, 164 insertions(+), 141 deletions(-)
create mode 100644 Documentation/sh/interface.rst
rename Documentation/sh/{new-machine.txt => new-machine.rst} (79%)
rename Documentation/sh/{register-banks.txt => register-banks.rst} (90%)
diff --git a/Documentation/sh/index.rst b/Documentation/sh/index.rst
index bc8db7ba894a..fec3c405b6b9 100644
--- a/Documentation/sh/index.rst
+++ b/Documentation/sh/index.rst
@@ -1,59 +1,14 @@
-=======================
-SuperH Interfaces Guide
-=======================
+.. SPDX-License-Identifier: GPL-2.0
-:Author: Paul Mundt
-
-Memory Management
-=================
-
-SH-4
-----
-
-Store Queue API
-~~~~~~~~~~~~~~~
-
-.. kernel-doc:: arch/sh/kernel/cpu/sh4/sq.c
- :export:
-
-SH-5
-----
-
-TLB Interfaces
-~~~~~~~~~~~~~~
-
-.. kernel-doc:: arch/sh/mm/tlb-sh5.c
- :internal:
-
-.. kernel-doc:: arch/sh/include/asm/tlb_64.h
- :internal:
+====================
+SuperH Documentation
+====================
-Machine Specific Interfaces
-===========================
-
-mach-dreamcast
---------------
-
-.. kernel-doc:: arch/sh/boards/mach-dreamcast/rtc.c
- :internal:
-
-mach-x3proto
-------------
-
-.. kernel-doc:: arch/sh/boards/mach-x3proto/ilsel.c
- :export:
-
-Busses
-======
-
-SuperHyway
-----------
-
-.. kernel-doc:: drivers/sh/superhyway/superhyway.c
- :export:
+:Author: Paul Mundt
-Maple
------
+.. toctree::
+ :maxdepth: 2
-.. kernel-doc:: drivers/sh/maple/maple.c
- :export:
+ interface
+ new-machine
+ register-banks
diff --git a/Documentation/sh/interface.rst b/Documentation/sh/interface.rst
new file mode 100644
index 000000000000..bc8db7ba894a
--- /dev/null
+++ b/Documentation/sh/interface.rst
@@ -0,0 +1,59 @@
+=======================
+SuperH Interfaces Guide
+=======================
+
+:Author: Paul Mundt
+
+Memory Management
+=================
+
+SH-4
+----
+
+Store Queue API
+~~~~~~~~~~~~~~~
+
+.. kernel-doc:: arch/sh/kernel/cpu/sh4/sq.c
+ :export:
+
+SH-5
+----
+
+TLB Interfaces
+~~~~~~~~~~~~~~
+
+.. kernel-doc:: arch/sh/mm/tlb-sh5.c
+ :internal:
+
+.. kernel-doc:: arch/sh/include/asm/tlb_64.h
+ :internal:
+
+Machine Specific Interfaces
+===========================
+
+mach-dreamcast
+--------------
+
+.. kernel-doc:: arch/sh/boards/mach-dreamcast/rtc.c
+ :internal:
+
+mach-x3proto
+------------
+
+.. kernel-doc:: arch/sh/boards/mach-x3proto/ilsel.c
+ :export:
+
+Busses
+======
+
+SuperHyway
+----------
+
+.. kernel-doc:: drivers/sh/superhyway/superhyway.c
+ :export:
+
+Maple
+-----
+
+.. kernel-doc:: drivers/sh/maple/maple.c
+ :export:
diff --git a/Documentation/sh/new-machine.txt b/Documentation/sh/new-machine.rst
similarity index 79%
rename from Documentation/sh/new-machine.txt
rename to Documentation/sh/new-machine.rst
index e0961a66130b..b16c33342642 100644
--- a/Documentation/sh/new-machine.txt
+++ b/Documentation/sh/new-machine.rst
@@ -1,8 +1,8 @@
+================================
+Adding a new board to LinuxSH
+================================
- Adding a new board to LinuxSH
- ================================
-
- Paul Mundt <lethal@linux-sh.org>
+Paul Mundt <lethal@linux-sh.org>
This document attempts to outline what steps are necessary to add support
for new boards to the LinuxSH port under the new 2.5 and 2.6 kernels. This
@@ -19,65 +19,67 @@ include/asm-sh/. For the new kernel, things are broken out by board type,
companion chip type, and CPU type. Looking at a tree view of this directory
hierarchy looks like the following:
-Board-specific code:
-
-.
-|-- arch
-| `-- sh
-| `-- boards
-| |-- adx
-| | `-- board-specific files
-| |-- bigsur
-| | `-- board-specific files
-| |
-| ... more boards here ...
-|
-`-- include
- `-- asm-sh
- |-- adx
- | `-- board-specific headers
- |-- bigsur
- | `-- board-specific headers
- |
- .. more boards here ...
-
-Next, for companion chips:
-.
-`-- arch
- `-- sh
- `-- cchips
- `-- hd6446x
- `-- hd64461
- `-- cchip-specific files
+Board-specific code::
+
+ .
+ |-- arch
+ | `-- sh
+ | `-- boards
+ | |-- adx
+ | | `-- board-specific files
+ | |-- bigsur
+ | | `-- board-specific files
+ | |
+ | ... more boards here ...
+ |
+ `-- include
+ `-- asm-sh
+ |-- adx
+ | `-- board-specific headers
+ |-- bigsur
+ | `-- board-specific headers
+ |
+ .. more boards here ...
+
+Next, for companion chips::
+
+ .
+ `-- arch
+ `-- sh
+ `-- cchips
+ `-- hd6446x
+ `-- hd64461
+ `-- cchip-specific files
... and so on. Headers for the companion chips are treated the same way as
board-specific headers. Thus, include/asm-sh/hd64461 is home to all of the
hd64461-specific headers.
-Finally, CPU family support is also abstracted:
-.
-|-- arch
-| `-- sh
-| |-- kernel
-| | `-- cpu
-| | |-- sh2
-| | | `-- SH-2 generic files
-| | |-- sh3
-| | | `-- SH-3 generic files
-| | `-- sh4
-| | `-- SH-4 generic files
-| `-- mm
-| `-- This is also broken out per CPU family, so each family can
-| have their own set of cache/tlb functions.
-|
-`-- include
- `-- asm-sh
- |-- cpu-sh2
- | `-- SH-2 specific headers
- |-- cpu-sh3
- | `-- SH-3 specific headers
- `-- cpu-sh4
- `-- SH-4 specific headers
+Finally, CPU family support is also abstracted::
+
+ .
+ |-- arch
+ | `-- sh
+ | |-- kernel
+ | | `-- cpu
+ | | |-- sh2
+ | | | `-- SH-2 generic files
+ | | |-- sh3
+ | | | `-- SH-3 generic files
+ | | `-- sh4
+ | | `-- SH-4 generic files
+ | `-- mm
+ | `-- This is also broken out per CPU family, so each family can
+ | have their own set of cache/tlb functions.
+ |
+ `-- include
+ `-- asm-sh
+ |-- cpu-sh2
+ | `-- SH-2 specific headers
+ |-- cpu-sh3
+ | `-- SH-3 specific headers
+ `-- cpu-sh4
+ `-- SH-4 specific headers
It should be noted that CPU subtypes are _not_ abstracted. Thus, these still
need to be dealt with by the CPU family specific code.
@@ -112,18 +114,20 @@ setup code, we're required at the very least to provide definitions for
get_system_type() and platform_setup(). For our imaginary board, this
might look something like:
-/*
- * arch/sh/boards/vapor/setup.c - Setup code for imaginary board
- */
-#include <linux/init.h>
+.. code-block:: c
+
+ /*
+ * arch/sh/boards/vapor/setup.c - Setup code for imaginary board
+ */
+ #include <linux/init.h>
-const char *get_system_type(void)
-{
- return "FooTech Vaporboard";
-}
+ const char *get_system_type(void)
+ {
+ return "FooTech Vaporboard";
+ }
-int __init platform_setup(void)
-{
+ int __init platform_setup(void)
+ {
/*
* If our hardware actually existed, we would do real
* setup here. Though it's also sane to leave this empty
@@ -136,7 +140,8 @@ int __init platform_setup(void)
/* And whatever else ... */
return 0;
-}
+ }
+
Our new imaginary board will also have to tie into the machvec in order for it
to be of any use.
@@ -172,16 +177,17 @@ sufficient.
vector.
Note that these prototypes are generated automatically by setting
- __IO_PREFIX to something sensible. A typical example would be:
+ __IO_PREFIX to something sensible. A typical example would be::
#define __IO_PREFIX vapor
#include <asm/io_generic.h>
+
somewhere in the board-specific header. Any boards being ported that still
have a legacy io.h should remove it entirely and switch to the new model.
- Add machine vector definitions to the board's setup.c. At a bare minimum,
- this must be defined as something like:
+ this must be defined as something like::
struct sh_machine_vector mv_vapor __initmv = {
.mv_name = "vapor",
@@ -202,11 +208,11 @@ Large portions of the build system are now entirely dynamic, and merely
require the proper entry here and there in order to get things done.
The first thing to do is to add an entry to arch/sh/Kconfig, under the
-"System type" menu:
+"System type" menu::
-config SH_VAPOR
- bool "Vapor"
- help
+ config SH_VAPOR
+ bool "Vapor"
+ help
select Vapor if configuring for a FooTech Vaporboard.
next, this has to be added into arch/sh/Makefile. All boards require a
@@ -232,6 +238,8 @@ space restating it here. After this is done, you will be able to use
implicit checks for your board if you need this somewhere throughout the
common code, such as:
+::
+
/* Make sure we're on the FooTech Vaporboard */
if (!mach_is_vapor())
return -ENODEV;
@@ -253,12 +261,13 @@ build target, and it will be implicitly listed as such in the help text.
Looking at the 'make help' output, you should now see something like:
Architecture specific targets (sh):
- zImage - Compressed kernel image (arch/sh/boot/zImage)
- adx_defconfig - Build for adx
- cqreek_defconfig - Build for cqreek
- dreamcast_defconfig - Build for dreamcast
-...
- vapor_defconfig - Build for vapor
+
+ - zImage - Compressed kernel image (arch/sh/boot/zImage)
+ - adx_defconfig - Build for adx
+ - cqreek_defconfig - Build for cqreek
+ - dreamcast_defconfig - Build for dreamcast
+ - ...
+ - vapor_defconfig - Build for vapor
which then allows you to do:
diff --git a/Documentation/sh/register-banks.txt b/Documentation/sh/register-banks.rst
similarity index 90%
rename from Documentation/sh/register-banks.txt
rename to Documentation/sh/register-banks.rst
index a6719f2f6594..acccfaf80355 100644
--- a/Documentation/sh/register-banks.txt
+++ b/Documentation/sh/register-banks.rst
@@ -1,8 +1,9 @@
- Notes on register bank usage in the kernel
- ==========================================
+==========================================
+Notes on register bank usage in the kernel
+==========================================
Introduction
-------------
+============
The SH-3 and SH-4 CPU families traditionally include a single partial register
bank (selected by SR.RB, only r0 ... r7 are banked), whereas other families
@@ -30,4 +31,3 @@ Presently the kernel uses several of these registers.
- The SR.IMASK interrupt handler makes use of this to set the
interrupt priority level (used by local_irq_enable())
- r7_bank (current)
-
diff --git a/arch/sh/Kconfig.cpu b/arch/sh/Kconfig.cpu
index 4a4edc7e03d4..07ad7597cbe7 100644
--- a/arch/sh/Kconfig.cpu
+++ b/arch/sh/Kconfig.cpu
@@ -94,7 +94,7 @@ config CPU_HAS_SR_RB
that are lacking this bit must have another method in place for
accomplishing what is taken care of by the banked registers.
- See <file:Documentation/sh/register-banks.txt> for further
+ See <file:Documentation/sh/register-banks.rst> for further
information on SR.RB and register banking in the kernel in general.
config CPU_HAS_PTEAEX
--
2.17.1
^ permalink raw reply related
* Re: [PATCH v4] Documentation:sh:convert register-banks.txt and new-machine.txt to rst format.
From: Vandana BN @ 2019-06-29 16:19 UTC (permalink / raw)
To: Mauro Carvalho Chehab
Cc: Yoshinori Sato, Rich Felker, Jonathan Corbet, linux-sh, linux-doc,
linux-kernel, skhan, gregkh, linux-kernel-mentees
In-Reply-To: <20190629130242.413b4672@coco.lan>
On 29/06/19 9:32 PM, Mauro Carvalho Chehab wrote:
> Em Sat, 29 Jun 2019 21:26:29 +0530
> Vandana BN <bnvandana@gmail.com> escreveu:
>
>> On 29/06/19 8:20 PM, Mauro Carvalho Chehab wrote:
>>> Em Sat, 29 Jun 2019 20:02:45 +0530
>>> Vandana BN <bnvandana@gmail.com> escreveu:
>>>
>>>> This patch converts new-machine.txt and register-banks.txt
>>>> to ReST format, No content change.
>>>> Added interfaces.rst to contain kernel-doc markups from index.rst
>>>> Added interfaces.rst,new-machine.rst and register-banks.rst to sh/index.rst
>>>> Added SPDX tag in index.rst
>>>>
>>>> Signed-off-by: Vandana BN <bnvandana@gmail.com>
>>> Looks good to me. Just a final thing to do.
>>>
>>> Be sure to run:
>>>
>>> ./scripts/documentation-file-ref-check
>>>
>>> in order to check that you're not breaking any references to the file.
>>> If it breaks, please adjust the reference to reflect the file
>>> rename.
>>>
>>> After fixing the broken reference, feel free do add:
>>>
>>> Reviewed-by: Mauro Carvalho Chehab <mchehab@kernel.org>
>> Thanks Mauro,
>>
>> i don't not see any broken references.
> Then maybe the script is broken. A simple grep here (linux-next) shows
> one such reference:
>
> git grep Documentation/sh/
> MAINTAINERS:F: Documentation/sh/
> arch/sh/Kconfig.cpu: See <file:Documentation/sh/register-banks.txt> for further
>
Oh ok, yes i see it now..
Will fix and send a patch.
>>>> ---
>>>> Documentation/sh/index.rst | 65 +------
>>>> Documentation/sh/interface.rst | 59 ++++++
>>>> .../sh/{new-machine.txt => new-machine.rst} | 171 +++++++++---------
>>>> ...{register-banks.txt => register-banks.rst} | 8 +-
>>>> 4 files changed, 163 insertions(+), 140 deletions(-)
>>>> create mode 100644 Documentation/sh/interface.rst
>>>> rename Documentation/sh/{new-machine.txt => new-machine.rst} (79%)
>>>> rename Documentation/sh/{register-banks.txt => register-banks.rst} (90%)
>>>>
>>>> diff --git a/Documentation/sh/index.rst b/Documentation/sh/index.rst
>>>> index bc8db7ba894a..fec3c405b6b9 100644
>>>> --- a/Documentation/sh/index.rst
>>>> +++ b/Documentation/sh/index.rst
>>>> @@ -1,59 +1,14 @@
>>>> -=======================
>>>> -SuperH Interfaces Guide
>>>> -=======================
>>>> +.. SPDX-License-Identifier: GPL-2.0
>>>>
>>>> -:Author: Paul Mundt
>>>> -
>>>> -Memory Management
>>>> -=================
>>>> -
>>>> -SH-4
>>>> -----
>>>> -
>>>> -Store Queue API
>>>> -~~~~~~~~~~~~~~~
>>>> -
>>>> -.. kernel-doc:: arch/sh/kernel/cpu/sh4/sq.c
>>>> - :export:
>>>> -
>>>> -SH-5
>>>> -----
>>>> -
>>>> -TLB Interfaces
>>>> -~~~~~~~~~~~~~~
>>>> -
>>>> -.. kernel-doc:: arch/sh/mm/tlb-sh5.c
>>>> - :internal:
>>>> -
>>>> -.. kernel-doc:: arch/sh/include/asm/tlb_64.h
>>>> - :internal:
>>>> +====================
>>>> +SuperH Documentation
>>>> +====================
>>>>
>>>> -Machine Specific Interfaces
>>>> -===========================
>>>> -
>>>> -mach-dreamcast
>>>> ---------------
>>>> -
>>>> -.. kernel-doc:: arch/sh/boards/mach-dreamcast/rtc.c
>>>> - :internal:
>>>> -
>>>> -mach-x3proto
>>>> -------------
>>>> -
>>>> -.. kernel-doc:: arch/sh/boards/mach-x3proto/ilsel.c
>>>> - :export:
>>>> -
>>>> -Busses
>>>> -======
>>>> -
>>>> -SuperHyway
>>>> -----------
>>>> -
>>>> -.. kernel-doc:: drivers/sh/superhyway/superhyway.c
>>>> - :export:
>>>> +:Author: Paul Mundt
>>>>
>>>> -Maple
>>>> ------
>>>> +.. toctree::
>>>> + :maxdepth: 2
>>>>
>>>> -.. kernel-doc:: drivers/sh/maple/maple.c
>>>> - :export:
>>>> + interface
>>>> + new-machine
>>>> + register-banks
>>>> diff --git a/Documentation/sh/interface.rst b/Documentation/sh/interface.rst
>>>> new file mode 100644
>>>> index 000000000000..bc8db7ba894a
>>>> --- /dev/null
>>>> +++ b/Documentation/sh/interface.rst
>>>> @@ -0,0 +1,59 @@
>>>> +=======================
>>>> +SuperH Interfaces Guide
>>>> +=======================
>>>> +
>>>> +:Author: Paul Mundt
>>>> +
>>>> +Memory Management
>>>> +=================
>>>> +
>>>> +SH-4
>>>> +----
>>>> +
>>>> +Store Queue API
>>>> +~~~~~~~~~~~~~~~
>>>> +
>>>> +.. kernel-doc:: arch/sh/kernel/cpu/sh4/sq.c
>>>> + :export:
>>>> +
>>>> +SH-5
>>>> +----
>>>> +
>>>> +TLB Interfaces
>>>> +~~~~~~~~~~~~~~
>>>> +
>>>> +.. kernel-doc:: arch/sh/mm/tlb-sh5.c
>>>> + :internal:
>>>> +
>>>> +.. kernel-doc:: arch/sh/include/asm/tlb_64.h
>>>> + :internal:
>>>> +
>>>> +Machine Specific Interfaces
>>>> +===========================
>>>> +
>>>> +mach-dreamcast
>>>> +--------------
>>>> +
>>>> +.. kernel-doc:: arch/sh/boards/mach-dreamcast/rtc.c
>>>> + :internal:
>>>> +
>>>> +mach-x3proto
>>>> +------------
>>>> +
>>>> +.. kernel-doc:: arch/sh/boards/mach-x3proto/ilsel.c
>>>> + :export:
>>>> +
>>>> +Busses
>>>> +======
>>>> +
>>>> +SuperHyway
>>>> +----------
>>>> +
>>>> +.. kernel-doc:: drivers/sh/superhyway/superhyway.c
>>>> + :export:
>>>> +
>>>> +Maple
>>>> +-----
>>>> +
>>>> +.. kernel-doc:: drivers/sh/maple/maple.c
>>>> + :export:
>>>> diff --git a/Documentation/sh/new-machine.txt b/Documentation/sh/new-machine.rst
>>>> similarity index 79%
>>>> rename from Documentation/sh/new-machine.txt
>>>> rename to Documentation/sh/new-machine.rst
>>>> index e0961a66130b..b16c33342642 100644
>>>> --- a/Documentation/sh/new-machine.txt
>>>> +++ b/Documentation/sh/new-machine.rst
>>>> @@ -1,8 +1,8 @@
>>>> +================================
>>>> +Adding a new board to LinuxSH
>>>> +================================
>>>>
>>>> - Adding a new board to LinuxSH
>>>> - ================================
>>>> -
>>>> - Paul Mundt <lethal@linux-sh.org>
>>>> +Paul Mundt <lethal@linux-sh.org>
>>>>
>>>> This document attempts to outline what steps are necessary to add support
>>>> for new boards to the LinuxSH port under the new 2.5 and 2.6 kernels. This
>>>> @@ -19,65 +19,67 @@ include/asm-sh/. For the new kernel, things are broken out by board type,
>>>> companion chip type, and CPU type. Looking at a tree view of this directory
>>>> hierarchy looks like the following:
>>>>
>>>> -Board-specific code:
>>>> -
>>>> -.
>>>> -|-- arch
>>>> -| `-- sh
>>>> -| `-- boards
>>>> -| |-- adx
>>>> -| | `-- board-specific files
>>>> -| |-- bigsur
>>>> -| | `-- board-specific files
>>>> -| |
>>>> -| ... more boards here ...
>>>> -|
>>>> -`-- include
>>>> - `-- asm-sh
>>>> - |-- adx
>>>> - | `-- board-specific headers
>>>> - |-- bigsur
>>>> - | `-- board-specific headers
>>>> - |
>>>> - .. more boards here ...
>>>> -
>>>> -Next, for companion chips:
>>>> -.
>>>> -`-- arch
>>>> - `-- sh
>>>> - `-- cchips
>>>> - `-- hd6446x
>>>> - `-- hd64461
>>>> - `-- cchip-specific files
>>>> +Board-specific code::
>>>> +
>>>> + .
>>>> + |-- arch
>>>> + | `-- sh
>>>> + | `-- boards
>>>> + | |-- adx
>>>> + | | `-- board-specific files
>>>> + | |-- bigsur
>>>> + | | `-- board-specific files
>>>> + | |
>>>> + | ... more boards here ...
>>>> + |
>>>> + `-- include
>>>> + `-- asm-sh
>>>> + |-- adx
>>>> + | `-- board-specific headers
>>>> + |-- bigsur
>>>> + | `-- board-specific headers
>>>> + |
>>>> + .. more boards here ...
>>>> +
>>>> +Next, for companion chips::
>>>> +
>>>> + .
>>>> + `-- arch
>>>> + `-- sh
>>>> + `-- cchips
>>>> + `-- hd6446x
>>>> + `-- hd64461
>>>> + `-- cchip-specific files
>>>>
>>>> ... and so on. Headers for the companion chips are treated the same way as
>>>> board-specific headers. Thus, include/asm-sh/hd64461 is home to all of the
>>>> hd64461-specific headers.
>>>>
>>>> -Finally, CPU family support is also abstracted:
>>>> -.
>>>> -|-- arch
>>>> -| `-- sh
>>>> -| |-- kernel
>>>> -| | `-- cpu
>>>> -| | |-- sh2
>>>> -| | | `-- SH-2 generic files
>>>> -| | |-- sh3
>>>> -| | | `-- SH-3 generic files
>>>> -| | `-- sh4
>>>> -| | `-- SH-4 generic files
>>>> -| `-- mm
>>>> -| `-- This is also broken out per CPU family, so each family can
>>>> -| have their own set of cache/tlb functions.
>>>> -|
>>>> -`-- include
>>>> - `-- asm-sh
>>>> - |-- cpu-sh2
>>>> - | `-- SH-2 specific headers
>>>> - |-- cpu-sh3
>>>> - | `-- SH-3 specific headers
>>>> - `-- cpu-sh4
>>>> - `-- SH-4 specific headers
>>>> +Finally, CPU family support is also abstracted::
>>>> +
>>>> + .
>>>> + |-- arch
>>>> + | `-- sh
>>>> + | |-- kernel
>>>> + | | `-- cpu
>>>> + | | |-- sh2
>>>> + | | | `-- SH-2 generic files
>>>> + | | |-- sh3
>>>> + | | | `-- SH-3 generic files
>>>> + | | `-- sh4
>>>> + | | `-- SH-4 generic files
>>>> + | `-- mm
>>>> + | `-- This is also broken out per CPU family, so each family can
>>>> + | have their own set of cache/tlb functions.
>>>> + |
>>>> + `-- include
>>>> + `-- asm-sh
>>>> + |-- cpu-sh2
>>>> + | `-- SH-2 specific headers
>>>> + |-- cpu-sh3
>>>> + | `-- SH-3 specific headers
>>>> + `-- cpu-sh4
>>>> + `-- SH-4 specific headers
>>>>
>>>> It should be noted that CPU subtypes are _not_ abstracted. Thus, these still
>>>> need to be dealt with by the CPU family specific code.
>>>> @@ -112,18 +114,20 @@ setup code, we're required at the very least to provide definitions for
>>>> get_system_type() and platform_setup(). For our imaginary board, this
>>>> might look something like:
>>>>
>>>> -/*
>>>> - * arch/sh/boards/vapor/setup.c - Setup code for imaginary board
>>>> - */
>>>> -#include <linux/init.h>
>>>> +.. code-block:: c
>>>> +
>>>> + /*
>>>> + * arch/sh/boards/vapor/setup.c - Setup code for imaginary board
>>>> + */
>>>> + #include <linux/init.h>
>>>>
>>>> -const char *get_system_type(void)
>>>> -{
>>>> - return "FooTech Vaporboard";
>>>> -}
>>>> + const char *get_system_type(void)
>>>> + {
>>>> + return "FooTech Vaporboard";
>>>> + }
>>>>
>>>> -int __init platform_setup(void)
>>>> -{
>>>> + int __init platform_setup(void)
>>>> + {
>>>> /*
>>>> * If our hardware actually existed, we would do real
>>>> * setup here. Though it's also sane to leave this empty
>>>> @@ -136,7 +140,8 @@ int __init platform_setup(void)
>>>> /* And whatever else ... */
>>>>
>>>> return 0;
>>>> -}
>>>> + }
>>>> +
>>>>
>>>> Our new imaginary board will also have to tie into the machvec in order for it
>>>> to be of any use.
>>>> @@ -172,16 +177,17 @@ sufficient.
>>>> vector.
>>>>
>>>> Note that these prototypes are generated automatically by setting
>>>> - __IO_PREFIX to something sensible. A typical example would be:
>>>> + __IO_PREFIX to something sensible. A typical example would be::
>>>>
>>>> #define __IO_PREFIX vapor
>>>> #include <asm/io_generic.h>
>>>>
>>>> +
>>>> somewhere in the board-specific header. Any boards being ported that still
>>>> have a legacy io.h should remove it entirely and switch to the new model.
>>>>
>>>> - Add machine vector definitions to the board's setup.c. At a bare minimum,
>>>> - this must be defined as something like:
>>>> + this must be defined as something like::
>>>>
>>>> struct sh_machine_vector mv_vapor __initmv = {
>>>> .mv_name = "vapor",
>>>> @@ -202,11 +208,11 @@ Large portions of the build system are now entirely dynamic, and merely
>>>> require the proper entry here and there in order to get things done.
>>>>
>>>> The first thing to do is to add an entry to arch/sh/Kconfig, under the
>>>> -"System type" menu:
>>>> +"System type" menu::
>>>>
>>>> -config SH_VAPOR
>>>> - bool "Vapor"
>>>> - help
>>>> + config SH_VAPOR
>>>> + bool "Vapor"
>>>> + help
>>>> select Vapor if configuring for a FooTech Vaporboard.
>>>>
>>>> next, this has to be added into arch/sh/Makefile. All boards require a
>>>> @@ -232,6 +238,8 @@ space restating it here. After this is done, you will be able to use
>>>> implicit checks for your board if you need this somewhere throughout the
>>>> common code, such as:
>>>>
>>>> +::
>>>> +
>>>> /* Make sure we're on the FooTech Vaporboard */
>>>> if (!mach_is_vapor())
>>>> return -ENODEV;
>>>> @@ -253,12 +261,13 @@ build target, and it will be implicitly listed as such in the help text.
>>>> Looking at the 'make help' output, you should now see something like:
>>>>
>>>> Architecture specific targets (sh):
>>>> - zImage - Compressed kernel image (arch/sh/boot/zImage)
>>>> - adx_defconfig - Build for adx
>>>> - cqreek_defconfig - Build for cqreek
>>>> - dreamcast_defconfig - Build for dreamcast
>>>> -...
>>>> - vapor_defconfig - Build for vapor
>>>> +
>>>> + - zImage - Compressed kernel image (arch/sh/boot/zImage)
>>>> + - adx_defconfig - Build for adx
>>>> + - cqreek_defconfig - Build for cqreek
>>>> + - dreamcast_defconfig - Build for dreamcast
>>>> + - ...
>>>> + - vapor_defconfig - Build for vapor
>>>>
>>>> which then allows you to do:
>>>>
>>>> diff --git a/Documentation/sh/register-banks.txt b/Documentation/sh/register-banks.rst
>>>> similarity index 90%
>>>> rename from Documentation/sh/register-banks.txt
>>>> rename to Documentation/sh/register-banks.rst
>>>> index a6719f2f6594..acccfaf80355 100644
>>>> --- a/Documentation/sh/register-banks.txt
>>>> +++ b/Documentation/sh/register-banks.rst
>>>> @@ -1,8 +1,9 @@
>>>> - Notes on register bank usage in the kernel
>>>> - ==========================================
>>>> +==========================================
>>>> +Notes on register bank usage in the kernel
>>>> +==========================================
>>>>
>>>> Introduction
>>>> -------------
>>>> +============
>>>>
>>>> The SH-3 and SH-4 CPU families traditionally include a single partial register
>>>> bank (selected by SR.RB, only r0 ... r7 are banked), whereas other families
>>>> @@ -30,4 +31,3 @@ Presently the kernel uses several of these registers.
>>>> - The SR.IMASK interrupt handler makes use of this to set the
>>>> interrupt priority level (used by local_irq_enable())
>>>> - r7_bank (current)
>>>> -
>>>> --
>>>> 2.17.1
>>>>
>>>
>>> Thanks,
>>> Mauro
>> Regards,
>>
>> Vandana.
>>
>
>
> Thanks,
> Mauro
Thanks,
Vandana.
^ permalink raw reply
* Re: [PATCH 10/10] tools/power/x86: A tool to validate Intel Speed Select commands
From: Andy Shevchenko @ 2019-06-29 16:03 UTC (permalink / raw)
To: Srinivas Pandruvada
Cc: Darren Hart, Andy Shevchenko, Andriy Shevchenko, Jonathan Corbet,
Rafael J. Wysocki, Alan Cox, Len Brown, prarit, darcari,
Linux Documentation List, Linux Kernel Mailing List,
Platform Driver
In-Reply-To: <1c4238f7d18d316df82d3ba1618fecdcf014f98a.camel@linux.intel.com>
On Sat, Jun 29, 2019 at 5:53 PM Srinivas Pandruvada
<srinivas.pandruvada@linux.intel.com> wrote:
> On Sat, 2019-06-29 at 17:31 +0300, Andy Shevchenko wrote:
> > On Thu, Jun 27, 2019 at 1:39 AM Srinivas Pandruvada
> > <srinivas.pandruvada@linux.intel.com> wrote:
> > I need an Ack from tools/power maintainer(s) for this.
> > Also see below.
> MAINTAINER file doesn't call for any special name in this folder.
And this tells me perhaps this driver needs a MAINTAINER record?
> $./scripts/get_maintainer.pl 0010-tools-power-x86-A-tool-to-validate-
> Intel-Speed-Selec.patch
> Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
> (commit_signer:1/1=100%,authored:1/1=100%,added_lines:31/31=100%,added_
> lines:231/231=100%,added_lines:1607/1607=100%,added_lines:721/721=100%,
> added_lines:479/479=100%)
> linux-kernel@vger.kernel.org (open list)
>
> Len and Rafael can you ACK this tool patch?
--
With Best Regards,
Andy Shevchenko
^ permalink raw reply
* Re: [PATCH v4] Documentation:sh:convert register-banks.txt and new-machine.txt to rst format.
From: Mauro Carvalho Chehab @ 2019-06-29 16:02 UTC (permalink / raw)
To: Vandana BN
Cc: Yoshinori Sato, Rich Felker, Jonathan Corbet, linux-sh, linux-doc,
linux-kernel, skhan, gregkh, linux-kernel-mentees
In-Reply-To: <4549aead-e916-a889-6c18-f695086fb72c@gmail.com>
Em Sat, 29 Jun 2019 21:26:29 +0530
Vandana BN <bnvandana@gmail.com> escreveu:
> On 29/06/19 8:20 PM, Mauro Carvalho Chehab wrote:
> > Em Sat, 29 Jun 2019 20:02:45 +0530
> > Vandana BN <bnvandana@gmail.com> escreveu:
> >
> >> This patch converts new-machine.txt and register-banks.txt
> >> to ReST format, No content change.
> >> Added interfaces.rst to contain kernel-doc markups from index.rst
> >> Added interfaces.rst,new-machine.rst and register-banks.rst to sh/index.rst
> >> Added SPDX tag in index.rst
> >>
> >> Signed-off-by: Vandana BN <bnvandana@gmail.com>
> > Looks good to me. Just a final thing to do.
> >
> > Be sure to run:
> >
> > ./scripts/documentation-file-ref-check
> >
> > in order to check that you're not breaking any references to the file.
> > If it breaks, please adjust the reference to reflect the file
> > rename.
> >
> > After fixing the broken reference, feel free do add:
> >
> > Reviewed-by: Mauro Carvalho Chehab <mchehab@kernel.org>
>
> Thanks Mauro,
>
> i don't not see any broken references.
Then maybe the script is broken. A simple grep here (linux-next) shows
one such reference:
git grep Documentation/sh/
MAINTAINERS:F: Documentation/sh/
arch/sh/Kconfig.cpu: See <file:Documentation/sh/register-banks.txt> for further
>
> >> ---
> >> Documentation/sh/index.rst | 65 +------
> >> Documentation/sh/interface.rst | 59 ++++++
> >> .../sh/{new-machine.txt => new-machine.rst} | 171 +++++++++---------
> >> ...{register-banks.txt => register-banks.rst} | 8 +-
> >> 4 files changed, 163 insertions(+), 140 deletions(-)
> >> create mode 100644 Documentation/sh/interface.rst
> >> rename Documentation/sh/{new-machine.txt => new-machine.rst} (79%)
> >> rename Documentation/sh/{register-banks.txt => register-banks.rst} (90%)
> >>
> >> diff --git a/Documentation/sh/index.rst b/Documentation/sh/index.rst
> >> index bc8db7ba894a..fec3c405b6b9 100644
> >> --- a/Documentation/sh/index.rst
> >> +++ b/Documentation/sh/index.rst
> >> @@ -1,59 +1,14 @@
> >> -=======================
> >> -SuperH Interfaces Guide
> >> -=======================
> >> +.. SPDX-License-Identifier: GPL-2.0
> >>
> >> -:Author: Paul Mundt
> >> -
> >> -Memory Management
> >> -=================
> >> -
> >> -SH-4
> >> -----
> >> -
> >> -Store Queue API
> >> -~~~~~~~~~~~~~~~
> >> -
> >> -.. kernel-doc:: arch/sh/kernel/cpu/sh4/sq.c
> >> - :export:
> >> -
> >> -SH-5
> >> -----
> >> -
> >> -TLB Interfaces
> >> -~~~~~~~~~~~~~~
> >> -
> >> -.. kernel-doc:: arch/sh/mm/tlb-sh5.c
> >> - :internal:
> >> -
> >> -.. kernel-doc:: arch/sh/include/asm/tlb_64.h
> >> - :internal:
> >> +====================
> >> +SuperH Documentation
> >> +====================
> >>
> >> -Machine Specific Interfaces
> >> -===========================
> >> -
> >> -mach-dreamcast
> >> ---------------
> >> -
> >> -.. kernel-doc:: arch/sh/boards/mach-dreamcast/rtc.c
> >> - :internal:
> >> -
> >> -mach-x3proto
> >> -------------
> >> -
> >> -.. kernel-doc:: arch/sh/boards/mach-x3proto/ilsel.c
> >> - :export:
> >> -
> >> -Busses
> >> -======
> >> -
> >> -SuperHyway
> >> -----------
> >> -
> >> -.. kernel-doc:: drivers/sh/superhyway/superhyway.c
> >> - :export:
> >> +:Author: Paul Mundt
> >>
> >> -Maple
> >> ------
> >> +.. toctree::
> >> + :maxdepth: 2
> >>
> >> -.. kernel-doc:: drivers/sh/maple/maple.c
> >> - :export:
> >> + interface
> >> + new-machine
> >> + register-banks
> >> diff --git a/Documentation/sh/interface.rst b/Documentation/sh/interface.rst
> >> new file mode 100644
> >> index 000000000000..bc8db7ba894a
> >> --- /dev/null
> >> +++ b/Documentation/sh/interface.rst
> >> @@ -0,0 +1,59 @@
> >> +=======================
> >> +SuperH Interfaces Guide
> >> +=======================
> >> +
> >> +:Author: Paul Mundt
> >> +
> >> +Memory Management
> >> +=================
> >> +
> >> +SH-4
> >> +----
> >> +
> >> +Store Queue API
> >> +~~~~~~~~~~~~~~~
> >> +
> >> +.. kernel-doc:: arch/sh/kernel/cpu/sh4/sq.c
> >> + :export:
> >> +
> >> +SH-5
> >> +----
> >> +
> >> +TLB Interfaces
> >> +~~~~~~~~~~~~~~
> >> +
> >> +.. kernel-doc:: arch/sh/mm/tlb-sh5.c
> >> + :internal:
> >> +
> >> +.. kernel-doc:: arch/sh/include/asm/tlb_64.h
> >> + :internal:
> >> +
> >> +Machine Specific Interfaces
> >> +===========================
> >> +
> >> +mach-dreamcast
> >> +--------------
> >> +
> >> +.. kernel-doc:: arch/sh/boards/mach-dreamcast/rtc.c
> >> + :internal:
> >> +
> >> +mach-x3proto
> >> +------------
> >> +
> >> +.. kernel-doc:: arch/sh/boards/mach-x3proto/ilsel.c
> >> + :export:
> >> +
> >> +Busses
> >> +======
> >> +
> >> +SuperHyway
> >> +----------
> >> +
> >> +.. kernel-doc:: drivers/sh/superhyway/superhyway.c
> >> + :export:
> >> +
> >> +Maple
> >> +-----
> >> +
> >> +.. kernel-doc:: drivers/sh/maple/maple.c
> >> + :export:
> >> diff --git a/Documentation/sh/new-machine.txt b/Documentation/sh/new-machine.rst
> >> similarity index 79%
> >> rename from Documentation/sh/new-machine.txt
> >> rename to Documentation/sh/new-machine.rst
> >> index e0961a66130b..b16c33342642 100644
> >> --- a/Documentation/sh/new-machine.txt
> >> +++ b/Documentation/sh/new-machine.rst
> >> @@ -1,8 +1,8 @@
> >> +================================
> >> +Adding a new board to LinuxSH
> >> +================================
> >>
> >> - Adding a new board to LinuxSH
> >> - ================================
> >> -
> >> - Paul Mundt <lethal@linux-sh.org>
> >> +Paul Mundt <lethal@linux-sh.org>
> >>
> >> This document attempts to outline what steps are necessary to add support
> >> for new boards to the LinuxSH port under the new 2.5 and 2.6 kernels. This
> >> @@ -19,65 +19,67 @@ include/asm-sh/. For the new kernel, things are broken out by board type,
> >> companion chip type, and CPU type. Looking at a tree view of this directory
> >> hierarchy looks like the following:
> >>
> >> -Board-specific code:
> >> -
> >> -.
> >> -|-- arch
> >> -| `-- sh
> >> -| `-- boards
> >> -| |-- adx
> >> -| | `-- board-specific files
> >> -| |-- bigsur
> >> -| | `-- board-specific files
> >> -| |
> >> -| ... more boards here ...
> >> -|
> >> -`-- include
> >> - `-- asm-sh
> >> - |-- adx
> >> - | `-- board-specific headers
> >> - |-- bigsur
> >> - | `-- board-specific headers
> >> - |
> >> - .. more boards here ...
> >> -
> >> -Next, for companion chips:
> >> -.
> >> -`-- arch
> >> - `-- sh
> >> - `-- cchips
> >> - `-- hd6446x
> >> - `-- hd64461
> >> - `-- cchip-specific files
> >> +Board-specific code::
> >> +
> >> + .
> >> + |-- arch
> >> + | `-- sh
> >> + | `-- boards
> >> + | |-- adx
> >> + | | `-- board-specific files
> >> + | |-- bigsur
> >> + | | `-- board-specific files
> >> + | |
> >> + | ... more boards here ...
> >> + |
> >> + `-- include
> >> + `-- asm-sh
> >> + |-- adx
> >> + | `-- board-specific headers
> >> + |-- bigsur
> >> + | `-- board-specific headers
> >> + |
> >> + .. more boards here ...
> >> +
> >> +Next, for companion chips::
> >> +
> >> + .
> >> + `-- arch
> >> + `-- sh
> >> + `-- cchips
> >> + `-- hd6446x
> >> + `-- hd64461
> >> + `-- cchip-specific files
> >>
> >> ... and so on. Headers for the companion chips are treated the same way as
> >> board-specific headers. Thus, include/asm-sh/hd64461 is home to all of the
> >> hd64461-specific headers.
> >>
> >> -Finally, CPU family support is also abstracted:
> >> -.
> >> -|-- arch
> >> -| `-- sh
> >> -| |-- kernel
> >> -| | `-- cpu
> >> -| | |-- sh2
> >> -| | | `-- SH-2 generic files
> >> -| | |-- sh3
> >> -| | | `-- SH-3 generic files
> >> -| | `-- sh4
> >> -| | `-- SH-4 generic files
> >> -| `-- mm
> >> -| `-- This is also broken out per CPU family, so each family can
> >> -| have their own set of cache/tlb functions.
> >> -|
> >> -`-- include
> >> - `-- asm-sh
> >> - |-- cpu-sh2
> >> - | `-- SH-2 specific headers
> >> - |-- cpu-sh3
> >> - | `-- SH-3 specific headers
> >> - `-- cpu-sh4
> >> - `-- SH-4 specific headers
> >> +Finally, CPU family support is also abstracted::
> >> +
> >> + .
> >> + |-- arch
> >> + | `-- sh
> >> + | |-- kernel
> >> + | | `-- cpu
> >> + | | |-- sh2
> >> + | | | `-- SH-2 generic files
> >> + | | |-- sh3
> >> + | | | `-- SH-3 generic files
> >> + | | `-- sh4
> >> + | | `-- SH-4 generic files
> >> + | `-- mm
> >> + | `-- This is also broken out per CPU family, so each family can
> >> + | have their own set of cache/tlb functions.
> >> + |
> >> + `-- include
> >> + `-- asm-sh
> >> + |-- cpu-sh2
> >> + | `-- SH-2 specific headers
> >> + |-- cpu-sh3
> >> + | `-- SH-3 specific headers
> >> + `-- cpu-sh4
> >> + `-- SH-4 specific headers
> >>
> >> It should be noted that CPU subtypes are _not_ abstracted. Thus, these still
> >> need to be dealt with by the CPU family specific code.
> >> @@ -112,18 +114,20 @@ setup code, we're required at the very least to provide definitions for
> >> get_system_type() and platform_setup(). For our imaginary board, this
> >> might look something like:
> >>
> >> -/*
> >> - * arch/sh/boards/vapor/setup.c - Setup code for imaginary board
> >> - */
> >> -#include <linux/init.h>
> >> +.. code-block:: c
> >> +
> >> + /*
> >> + * arch/sh/boards/vapor/setup.c - Setup code for imaginary board
> >> + */
> >> + #include <linux/init.h>
> >>
> >> -const char *get_system_type(void)
> >> -{
> >> - return "FooTech Vaporboard";
> >> -}
> >> + const char *get_system_type(void)
> >> + {
> >> + return "FooTech Vaporboard";
> >> + }
> >>
> >> -int __init platform_setup(void)
> >> -{
> >> + int __init platform_setup(void)
> >> + {
> >> /*
> >> * If our hardware actually existed, we would do real
> >> * setup here. Though it's also sane to leave this empty
> >> @@ -136,7 +140,8 @@ int __init platform_setup(void)
> >> /* And whatever else ... */
> >>
> >> return 0;
> >> -}
> >> + }
> >> +
> >>
> >> Our new imaginary board will also have to tie into the machvec in order for it
> >> to be of any use.
> >> @@ -172,16 +177,17 @@ sufficient.
> >> vector.
> >>
> >> Note that these prototypes are generated automatically by setting
> >> - __IO_PREFIX to something sensible. A typical example would be:
> >> + __IO_PREFIX to something sensible. A typical example would be::
> >>
> >> #define __IO_PREFIX vapor
> >> #include <asm/io_generic.h>
> >>
> >> +
> >> somewhere in the board-specific header. Any boards being ported that still
> >> have a legacy io.h should remove it entirely and switch to the new model.
> >>
> >> - Add machine vector definitions to the board's setup.c. At a bare minimum,
> >> - this must be defined as something like:
> >> + this must be defined as something like::
> >>
> >> struct sh_machine_vector mv_vapor __initmv = {
> >> .mv_name = "vapor",
> >> @@ -202,11 +208,11 @@ Large portions of the build system are now entirely dynamic, and merely
> >> require the proper entry here and there in order to get things done.
> >>
> >> The first thing to do is to add an entry to arch/sh/Kconfig, under the
> >> -"System type" menu:
> >> +"System type" menu::
> >>
> >> -config SH_VAPOR
> >> - bool "Vapor"
> >> - help
> >> + config SH_VAPOR
> >> + bool "Vapor"
> >> + help
> >> select Vapor if configuring for a FooTech Vaporboard.
> >>
> >> next, this has to be added into arch/sh/Makefile. All boards require a
> >> @@ -232,6 +238,8 @@ space restating it here. After this is done, you will be able to use
> >> implicit checks for your board if you need this somewhere throughout the
> >> common code, such as:
> >>
> >> +::
> >> +
> >> /* Make sure we're on the FooTech Vaporboard */
> >> if (!mach_is_vapor())
> >> return -ENODEV;
> >> @@ -253,12 +261,13 @@ build target, and it will be implicitly listed as such in the help text.
> >> Looking at the 'make help' output, you should now see something like:
> >>
> >> Architecture specific targets (sh):
> >> - zImage - Compressed kernel image (arch/sh/boot/zImage)
> >> - adx_defconfig - Build for adx
> >> - cqreek_defconfig - Build for cqreek
> >> - dreamcast_defconfig - Build for dreamcast
> >> -...
> >> - vapor_defconfig - Build for vapor
> >> +
> >> + - zImage - Compressed kernel image (arch/sh/boot/zImage)
> >> + - adx_defconfig - Build for adx
> >> + - cqreek_defconfig - Build for cqreek
> >> + - dreamcast_defconfig - Build for dreamcast
> >> + - ...
> >> + - vapor_defconfig - Build for vapor
> >>
> >> which then allows you to do:
> >>
> >> diff --git a/Documentation/sh/register-banks.txt b/Documentation/sh/register-banks.rst
> >> similarity index 90%
> >> rename from Documentation/sh/register-banks.txt
> >> rename to Documentation/sh/register-banks.rst
> >> index a6719f2f6594..acccfaf80355 100644
> >> --- a/Documentation/sh/register-banks.txt
> >> +++ b/Documentation/sh/register-banks.rst
> >> @@ -1,8 +1,9 @@
> >> - Notes on register bank usage in the kernel
> >> - ==========================================
> >> +==========================================
> >> +Notes on register bank usage in the kernel
> >> +==========================================
> >>
> >> Introduction
> >> -------------
> >> +============
> >>
> >> The SH-3 and SH-4 CPU families traditionally include a single partial register
> >> bank (selected by SR.RB, only r0 ... r7 are banked), whereas other families
> >> @@ -30,4 +31,3 @@ Presently the kernel uses several of these registers.
> >> - The SR.IMASK interrupt handler makes use of this to set the
> >> interrupt priority level (used by local_irq_enable())
> >> - r7_bank (current)
> >> -
> >> --
> >> 2.17.1
> >>
> >
> >
> > Thanks,
> > Mauro
>
> Regards,
>
> Vandana.
>
Thanks,
Mauro
^ permalink raw reply
* Re: [linux-kernel-mentees] [PATCH v1] Doc : fs : convert xfs.txt to ReST
From: Sheriff Esseson @ 2019-06-29 16:02 UTC (permalink / raw)
To: skhan
Cc: linux-kernel-mentees, darrick.wong, linux-xfs, corbet, linux-doc,
linux-kernel
In-Reply-To: <20190629150155.GB10491@localhost>
Signed-off-by: Sheriff Esseson <sheriffesseson@gmail.com>
---
In v2:
Update MAINTAINERS. Fix indentation/long line issues. cc Darick and xfs mailist.
Documentation/filesystems/index.rst | 5 +-
Documentation/filesystems/xfs.rst | 467 +++++++++++++++++++++++++++
Documentation/filesystems/xfs.txt | 470 ----------------------------
MAINTAINERS | 2 +-
4 files changed, 471 insertions(+), 473 deletions(-)
create mode 100644 Documentation/filesystems/xfs.rst
delete mode 100644 Documentation/filesystems/xfs.txt
diff --git a/Documentation/filesystems/index.rst b/Documentation/filesystems/index.rst
index 1131c34d7..a4cf5fca4 100644
--- a/Documentation/filesystems/index.rst
+++ b/Documentation/filesystems/index.rst
@@ -16,7 +16,7 @@ algorithms work.
.. toctree::
:maxdepth: 2
- path-lookup.rst
+ path-lookup
api-summary
splice
@@ -40,4 +40,5 @@ Documentation for individual filesystem types can be found here.
.. toctree::
:maxdepth: 2
- binderfs.rst
+ binderfs
+ xfs
diff --git a/Documentation/filesystems/xfs.rst b/Documentation/filesystems/xfs.rst
new file mode 100644
index 000000000..f52046b96
--- /dev/null
+++ b/Documentation/filesystems/xfs.rst
@@ -0,0 +1,467 @@
+======================
+The SGI XFS Filesystem
+======================
+
+XFS is a high performance journaling filesystem which originated
+on the SGI IRIX platform. It is completely multi-threaded, can
+support large files and large filesystems, extended attributes,
+variable block sizes, is extent based, and makes extensive use of
+Btrees (directories, extents, free space) to aid both performance
+and scalability.
+
+Refer to the documentation at https://xfs.wiki.kernel.org/
+for further details. This implementation is on-disk compatible
+with the IRIX version of XFS.
+
+
+Mount Options
+=============
+
+When mounting an XFS filesystem, the following options are accepted. For
+boolean mount options, the names with the "(*)" prefix is the default behaviour.
+For example, take a behaviour enabled by default to be a one (1) or, a zero (0)
+otherwise, ``(*)[no]default`` would be 0 while ``[no](*)default`` , a 1.
+
+ allocsize=<size>
+ Sets the buffered I/O end-of-file preallocation size when doing delayed
+ allocation writeout (default size is 64KiB). Valid values for this
+ option are page size (typically 4KiB) through to 1GiB, inclusive, in
+ power-of-2 increments.
+
+ The default behaviour is for dynamic end-of-file preallocation size,
+ which uses a set of heuristics to optimise the preallocation size based
+ on the current allocation patterns within the file and the access
+ patterns to the file. Specifying a fixed allocsize value turns off the
+ dynamic behaviour.
+
+ [no]attr2
+ The options enable/disable an "opportunistic" improvement to be made in
+ the way inline extended attributes are stored on-disk. When the new
+ form is used for the first time when ``attr2`` is selected (either when
+ setting or removing extended attributes) the on-disk superblock feature
+ bit field will be updated to reflect this format being in use.
+
+ The default behaviour is determined by the on-disk feature bit
+ indicating that ``attr2`` behaviour is active. If either mount option is
+ set, then that becomes the new default used by the filesystem. However
+ on CRC enabled filesystems, the ``attr2`` format is always used , and so
+ will reject the ``noattr2`` mount option if it is set.
+
+ (*)[no]discard
+ Enable/disable the issuing of commands to let the block device reclaim
+ space freed by the filesystem. This is useful for SSD devices, thinly
+ provisioned LUNs and virtual machine images, but may have a performance
+ impact.
+
+ Note: It is currently recommended that you use the ``fstrim``
+ application to discard unused blocks rather than the ``discard`` mount
+ option because the performance impact of this option is quite severe.
+
+ grpid/bsdgroups
+ nogrpid/(*)sysvgroups
+ These options define what group ID a newly created file gets. When
+ ``grpid`` is set, it takes the group ID of the directory in which it is
+ created; otherwise it takes the ``fsgid`` of the current process, unless
+ the directory has the ``setgid`` bit set, in which case it takes the
+ ``gid`` from the parent directory, and also gets the ``setgid`` bit set
+ if it is a directory itself.
+
+ filestreams
+ Make the data allocator use the filestreams allocation mode across the
+ entire filesystem rather than just on directories configured to use it.
+
+ (*)[no]ikeep
+ When ``ikeep`` is specified, XFS does not delete empty inode clusters
+ and keeps them around on disk. When ``noikeep`` is specified, empty
+ inode clusters are returned to the free space pool.
+
+ inode32 | (*)inode64
+ When ``inode32`` is specified, it indicates that XFS limits inode
+ creation to locations which will not result in inode numbers with more
+ than 32 bits of significance.
+
+ When ``inode64`` is specified, it indicates that XFS is allowed to
+ create inodes at any location in the filesystem, including those which
+ will result in inode numbers occupying more than 32 bits of
+ significance.
+
+ ``inode32`` is provided for backwards compatibility with older systems
+ and applications, since 64 bits inode numbers might cause problems for
+ some applications that cannot handle large inode numbers. If
+ applications are in use which do not handle inode numbers bigger than 32
+ bits, the ``inode32`` option should be specified.
+
+
+ (*)[no]largeio
+ If ``nolargeio`` is specified, the optimal I/O reported in st_blksize by
+ **stat(2)** will be as small as possible to allow user applications to
+ avoid inefficient read/modify/write I/O. This is typically the page
+ size of the machine, as this is the granularity of the page cache.
+
+ If ``largeio`` is specified, a filesystem that was created with a
+ ``swidth`` specified will return the ``swidth`` value (in bytes) in
+ st_blksize. If the filesystem does not have a ``swidth`` specified but
+ does specify an ``allocsize`` then ``allocsize`` (in bytes) will be
+ returned instead. Otherwise the behaviour is the same as if
+ ``nolargeio`` was specified.
+
+ logbufs=<value>
+ Set the number of in-memory log buffers to ``value``. Valid numbers
+ range from 2-8 inclusive.
+
+ The default value is 8 buffers.
+
+ If the memory cost of 8 log buffers is too high on small systems, then
+ it may be reduced at some cost to performance on metadata intensive
+ workloads. The ``logbsize`` option below controls the size of each
+ buffer and so is also relevant to this case.
+
+ logbsize=<value>
+ Set the size of each in-memory log buffer to ``value``. The size may be
+ specified in bytes, or in kilobytes with a "k" suffix. Valid sizes for
+ version 1 and version 2 logs are 16384 (16k) and 32768 (32k). Valid
+ sizes for version 2 logs also include 65536 (64k), 131072 (128k) and
+ 262144 (256k). The ``logbsize`` must be an integer multiple of the
+ "log stripe unit" configured at mkfs time.
+
+ The default value for for version 1 logs is 32768, while the default
+ value for version 2 logs is ``MAX(32768, log_sunit)``.
+
+ logdev=<device>
+ Use ``device`` as an external log (metadata journal). In an XFS
+ filesystem, the log device can be separate from the data device or
+ contained within it.
+
+ rtdev=<device>
+ An XFS filesystem has up to three parts: a data section, a log section,
+ and a real-time section. The real-time section is optional. If
+ enabled, ``rtdev`` sets ``device`` to be used as an external real-time
+ section, similar to ``logdev`` above.
+
+ noalign
+ Data allocations will not be aligned at stripe unit boundaries. This is
+ only relevant to filesystems created with non-zero data alignment
+ parameters (sunit, swidth) by mkfs.
+
+ norecovery
+ The filesystem will be mounted without running log recovery. If the
+ filesystem was not cleanly unmounted, it is likely to be inconsistent
+ when mounted in ``norecovery`` mode. Some files or directories may not
+ be accessible because of this. Filesystems mounted ``norecovery`` must
+ be mounted read-only or the mount will fail.
+
+ nouuid
+ Don't check for double mounted file systems using the file system uuid.
+ This is useful to mount LVM snapshot volumes, and often used in
+ combination with ``norecovery`` for mounting read-only snapshots.
+
+ noquota
+ Forcibly turns off all quota accounting and enforcement
+ within the filesystem.
+
+ uquota/usrquota/uqnoenforce/quota
+ User disk quota accounting enabled, and limits (optionally) enforced.
+ Refer to **xfs_quota(8)** for further details.
+
+ gquota/grpquota/gqnoenforce
+ Group disk quota accounting enabled and limits (optionally) enforced.
+ Refer to **xfs_quota(8)** for further details.
+
+ pquota/prjquota/pqnoenforce
+ Project disk quota accounting enabled and limits (optionally) enforced.
+ Refer to **xfs_quota(8)** for further details.
+
+ sunit=<value>
+ Used to specify the stripe unit for a RAID device or (in conjunction
+ with ``swidth`` below) a stripe volume. ``value`` must be specified in
+ 512-byte block units. This option is only relevant to filesystems that
+ were created with non-zero data alignment parameters.
+
+ The ``sunit`` parameter specified must be compatible with the existing
+ filesystem alignment characteristics. In general, that means the only
+ valid changes to ``sunit`` are increasing it by a power-of-2 multiple.
+
+ Typically, this mount option is necessary only after an underlying RAID
+ device has had its geometry modified, such as adding a new disk to a
+ RAID5 lun and reshaping it.
+
+ swidth=<value>
+ Used to specify the stripe width for a RAID device or (in conjunction
+ with ``sunit`` above) a stripe volume. ``value`` must be specified in
+ 512-byte block units. This option, like ``sunit`` above, is only
+ relevant to filesystems that were created with non-zero data alignment
+ parameters.
+
+ The ``swidth`` parameter specified must be compatible with the existing
+ filesystem alignment characteristics. In general, that means the only
+ valid swidth values are any integer multiple of a valid ``sunit`` value.
+
+ Typically, this mount option is necessary only after an underlying RAID
+ device has had its geometry modified, such as adding a new disk to a
+ RAID5 lun and reshaping it.
+
+
+ swalloc
+ Data allocations will be rounded up to stripe width boundaries when the
+ current end of file is being extended and the file size is larger than
+ the stripe width size.
+
+ wsync
+ When specified, all filesystem namespace operations are executed
+ synchronously. This ensures that when the namespace operation (create,
+ unlink, etc) completes, the change to the namespace is on stable
+ storage. This is useful in HA setups where failover must not result in
+ clients seeing inconsistent namespace presentation during or after a
+ failover event.
+
+
+Deprecated Mount Options
+========================
+
+ Name Removal Schedule
+ ---- ----------------
+
+
+Removed Mount Options
+=====================
+
+ Name Removed
+ ---- -------
+ delaylog/nodelaylog v4.0
+ ihashsize v4.0
+ irixsgid v4.0
+ osyncisdsync/osyncisosync v4.0
+ barrier v4.19
+ nobarrier v4.19
+
+
+sysctls
+=======
+
+The following sysctls are available for the XFS filesystem:
+
+ fs.xfs.stats_clear (Min: 0 Default: 0 Max: 1)
+ Setting this to "1" clears accumulated XFS statistics
+ in /proc/fs/xfs/stat. It then immediately resets to "0".
+
+ fs.xfs.xfssyncd_centisecs (Min: 100 Default: 3000 Max: 720000)
+ The interval at which the filesystem flushes metadata
+ out to disk and runs internal cache cleanup routines.
+
+ fs.xfs.filestream_centisecs (Min: 1 Default: 3000 Max: 360000)
+ The interval at which the filesystem ages filestreams cache
+ references and returns timed-out AGs back to the free stream
+ pool.
+
+ fs.xfs.speculative_prealloc_lifetime
+ (Units: seconds Min: 1 Default: 300 Max: 86400)
+ The interval at which the background scanning for inodes
+ with unused speculative preallocation runs. The scan
+ removes unused preallocation from clean inodes and releases
+ the unused space back to the free pool.
+
+ fs.xfs.error_level (Min: 0 Default: 3 Max: 11)
+ A volume knob for error reporting when internal errors occur.
+ This will generate detailed messages & backtraces for filesystem
+ shutdowns, for example. Current threshold values are:
+
+ XFS_ERRLEVEL_OFF: 0
+ XFS_ERRLEVEL_LOW: 1
+ XFS_ERRLEVEL_HIGH: 5
+
+ fs.xfs.panic_mask (Min: 0 Default: 0 Max: 256)
+ Causes certain error conditions to call BUG(). Value is a bitmask;
+ OR together the tags which represent errors which should cause panics:
+
+ XFS_NO_PTAG 0
+ XFS_PTAG_IFLUSH 0x00000001
+ XFS_PTAG_LOGRES 0x00000002
+ XFS_PTAG_AILDELETE 0x00000004
+ XFS_PTAG_ERROR_REPORT 0x00000008
+ XFS_PTAG_SHUTDOWN_CORRUPT 0x00000010
+ XFS_PTAG_SHUTDOWN_IOERROR 0x00000020
+ XFS_PTAG_SHUTDOWN_LOGERROR 0x00000040
+ XFS_PTAG_FSBLOCK_ZERO 0x00000080
+ XFS_PTAG_VERIFIER_ERROR 0x00000100
+
+ This option is intended for debugging only.
+
+ fs.xfs.irix_symlink_mode (Min: 0 Default: 0 Max: 1)
+ Controls whether symlinks are created with mode 0777 (default)
+ or whether their mode is affected by the umask (irix mode).
+
+ fs.xfs.irix_sgid_inherit (Min: 0 Default: 0 Max: 1)
+ Controls files created in SGID directories.
+ If the group ID of the new file does not match the effective group
+ ID or one of the supplementary group IDs of the parent dir, the
+ ISGID bit is cleared if the irix_sgid_inherit compatibility sysctl
+ is set.
+
+ fs.xfs.inherit_sync (Min: 0 Default: 1 Max: 1)
+ Setting this to "1" will cause the "sync" flag set
+ by the **xfs_io(8)** chattr command on a directory to be
+ inherited by files in that directory.
+
+ fs.xfs.inherit_nodump (Min: 0 Default: 1 Max: 1)
+ Setting this to "1" will cause the "nodump" flag set
+ by the **xfs_io(8)** chattr command on a directory to be
+ inherited by files in that directory.
+
+ fs.xfs.inherit_noatime (Min: 0 Default: 1 Max: 1)
+ Setting this to "1" will cause the "noatime" flag set
+ by the **xfs_io(8)** chattr command on a directory to be
+ inherited by files in that directory.
+
+ fs.xfs.inherit_nosymlinks (Min: 0 Default: 1 Max: 1)
+ Setting this to "1" will cause the "nosymlinks" flag set
+ by the **xfs_io(8)** chattr command on a directory to be
+ inherited by files in that directory.
+
+ fs.xfs.inherit_nodefrag (Min: 0 Default: 1 Max: 1)
+ Setting this to "1" will cause the "nodefrag" flag set
+ by the **xfs_io(8)** chattr command on a directory to be
+ inherited by files in that directory.
+
+ fs.xfs.rotorstep (Min: 1 Default: 1 Max: 256)
+ In "inode32" allocation mode, this option determines how many
+ files the allocator attempts to allocate in the same allocation
+ group before moving to the next allocation group. The intent
+ is to control the rate at which the allocator moves between
+ allocation groups when allocating extents for new files.
+
+Deprecated Sysctls
+==================
+
+None at present.
+
+
+Removed Sysctls
+===============
+
+ Name Removed
+ ---- -------
+ fs.xfs.xfsbufd_centisec v4.0
+ fs.xfs.age_buffer_centisecs v4.0
+
+
+Error handling
+==============
+
+XFS can act differently according to the type of error found during its
+operation. The implementation introduces the following concepts to the error
+handler:
+
+ -failure speed:
+ Defines how fast XFS should propagate an error upwards when a specific
+ error is found during the filesystem operation. It can propagate
+ immediately, after a defined number of retries, after a set time period,
+ or simply retry forever.
+
+ -error classes:
+ Specifies the subsystem the error configuration will apply to, such as
+ metadata IO or memory allocation. Different subsystems will have
+ different error handlers for which behaviour can be configured.
+
+ -error handlers:
+ Defines the behavior for a specific error.
+
+The filesystem behavior during an error can be set via sysfs files. Each
+error handler works independently - the first condition met by an error handler
+for a specific class will cause the error to be propagated rather than reset and
+retried.
+
+The action taken by the filesystem when the error is propagated is context
+dependent - it may cause a shut down in the case of an unrecoverable error,
+it may be reported back to userspace, or it may even be ignored because
+there's nothing useful we can with the error or anyone we can report it to (e.g.
+during unmount).
+
+The configuration files are organized into the following hierarchy for each
+mounted filesystem:
+
+ /sys/fs/xfs/<dev>/error/<class>/<error>/
+
+Where:
+ <dev>
+ The short device name of the mounted filesystem. This is the same device
+ name that shows up in XFS kernel error messages as "XFS(<dev>): ..."
+
+ <class>
+ The subsystem the error configuration belongs to. As of 4.9, the defined
+ classes are:
+
+ - "metadata": applies metadata buffer write IO
+
+ <error>
+ The individual error handler configurations.
+
+
+Each filesystem has "global" error configuration options defined in their top
+level directory:
+
+ /sys/fs/xfs/<dev>/error/
+
+ fail_at_unmount (Min: 0 Default: 1 Max: 1)
+ Defines the filesystem error behavior at unmount time.
+
+ If set to a value of 1, XFS will override all other error configurations
+ during unmount and replace them with "immediate fail" characteristics.
+ i.e. no retries, no retry timeout. This will always allow unmount to
+ succeed when there are persistent errors present.
+
+ If set to 0, the configured retry behaviour will continue until all
+ retries and/or timeouts have been exhausted. This will delay unmount
+ completion when there are persistent errors, and it may prevent the
+ filesystem from ever unmounting fully in the case of "retry forever"
+ handler configurations.
+
+ Note: there is no guarantee that fail_at_unmount can be set while an
+ unmount is in progress. It is possible that the sysfs entries are
+ removed by the unmounting filesystem before a "retry forever" error
+ handler configuration causes unmount to hang, and hence the filesystem
+ must be configured appropriately before unmount begins to prevent
+ unmount hangs.
+
+Each filesystem has specific error class handlers that define the error
+propagation behaviour for specific errors. There is also a "default" error
+handler defined, which defines the behaviour for all errors that don't have
+specific handlers defined. Where multiple retry constraints are configuredi for
+a single error, the first retry configuration that expires will cause the error
+to be propagated. The handler configurations are found in the directory:
+
+ /sys/fs/xfs/<dev>/error/<class>/<error>/
+
+ max_retries (Min: -1 Default: Varies Max: INTMAX)
+ Defines the allowed number of retries of a specific error before
+ the filesystem will propagate the error. The retry count for a given
+ error context (e.g. a specific metadata buffer) is reset every time
+ there is a successful completion of the operation.
+
+ Setting the value to "-1" will cause XFS to retry forever for this
+ specific error.
+
+ Setting the value to "0" will cause XFS to fail immediately when the
+ specific error is reported.
+
+ Setting the value to "N" (where 0 < N < Max) will make XFS retry the
+ operation "N" times before propagating the error.
+
+ retry_timeout_seconds (Min: -1 Default: Varies Max: 1 day)
+ Define the amount of time (in seconds) that the filesystem is
+ allowed to retry its operations when the specific error is
+ found.
+
+ Setting the value to "-1" will allow XFS to retry forever for this
+ specific error.
+
+ Setting the value to "0" will cause XFS to fail immediately when the
+ specific error is reported.
+
+ Setting the value to "N" (where 0 < N < Max) will allow XFS to retry the
+ operation for up to "N" seconds before propagating the error.
+
+Note: The default behaviour for a specific error handler is dependent on both
+the class and error context. For example, the default values for
+"metadata/ENODEV" are "0" rather than "-1" so that this error handler defaults
+to "fail immediately" behaviour. This is done because ENODEV is a fatal,
+unrecoverable error no matter how many times the metadata IO is retried.
diff --git a/Documentation/filesystems/xfs.txt b/Documentation/filesystems/xfs.txt
deleted file mode 100644
index a5cbb5e0e..000000000
--- a/Documentation/filesystems/xfs.txt
+++ /dev/null
@@ -1,470 +0,0 @@
-
-The SGI XFS Filesystem
-======================
-
-XFS is a high performance journaling filesystem which originated
-on the SGI IRIX platform. It is completely multi-threaded, can
-support large files and large filesystems, extended attributes,
-variable block sizes, is extent based, and makes extensive use of
-Btrees (directories, extents, free space) to aid both performance
-and scalability.
-
-Refer to the documentation at https://xfs.wiki.kernel.org/
-for further details. This implementation is on-disk compatible
-with the IRIX version of XFS.
-
-
-Mount Options
-=============
-
-When mounting an XFS filesystem, the following options are accepted.
-For boolean mount options, the names with the (*) suffix is the
-default behaviour.
-
- allocsize=size
- Sets the buffered I/O end-of-file preallocation size when
- doing delayed allocation writeout (default size is 64KiB).
- Valid values for this option are page size (typically 4KiB)
- through to 1GiB, inclusive, in power-of-2 increments.
-
- The default behaviour is for dynamic end-of-file
- preallocation size, which uses a set of heuristics to
- optimise the preallocation size based on the current
- allocation patterns within the file and the access patterns
- to the file. Specifying a fixed allocsize value turns off
- the dynamic behaviour.
-
- attr2
- noattr2
- The options enable/disable an "opportunistic" improvement to
- be made in the way inline extended attributes are stored
- on-disk. When the new form is used for the first time when
- attr2 is selected (either when setting or removing extended
- attributes) the on-disk superblock feature bit field will be
- updated to reflect this format being in use.
-
- The default behaviour is determined by the on-disk feature
- bit indicating that attr2 behaviour is active. If either
- mount option it set, then that becomes the new default used
- by the filesystem.
-
- CRC enabled filesystems always use the attr2 format, and so
- will reject the noattr2 mount option if it is set.
-
- discard
- nodiscard (*)
- Enable/disable the issuing of commands to let the block
- device reclaim space freed by the filesystem. This is
- useful for SSD devices, thinly provisioned LUNs and virtual
- machine images, but may have a performance impact.
-
- Note: It is currently recommended that you use the fstrim
- application to discard unused blocks rather than the discard
- mount option because the performance impact of this option
- is quite severe.
-
- grpid/bsdgroups
- nogrpid/sysvgroups (*)
- These options define what group ID a newly created file
- gets. When grpid is set, it takes the group ID of the
- directory in which it is created; otherwise it takes the
- fsgid of the current process, unless the directory has the
- setgid bit set, in which case it takes the gid from the
- parent directory, and also gets the setgid bit set if it is
- a directory itself.
-
- filestreams
- Make the data allocator use the filestreams allocation mode
- across the entire filesystem rather than just on directories
- configured to use it.
-
- ikeep
- noikeep (*)
- When ikeep is specified, XFS does not delete empty inode
- clusters and keeps them around on disk. When noikeep is
- specified, empty inode clusters are returned to the free
- space pool.
-
- inode32
- inode64 (*)
- When inode32 is specified, it indicates that XFS limits
- inode creation to locations which will not result in inode
- numbers with more than 32 bits of significance.
-
- When inode64 is specified, it indicates that XFS is allowed
- to create inodes at any location in the filesystem,
- including those which will result in inode numbers occupying
- more than 32 bits of significance.
-
- inode32 is provided for backwards compatibility with older
- systems and applications, since 64 bits inode numbers might
- cause problems for some applications that cannot handle
- large inode numbers. If applications are in use which do
- not handle inode numbers bigger than 32 bits, the inode32
- option should be specified.
-
-
- largeio
- nolargeio (*)
- If "nolargeio" is specified, the optimal I/O reported in
- st_blksize by stat(2) will be as small as possible to allow
- user applications to avoid inefficient read/modify/write
- I/O. This is typically the page size of the machine, as
- this is the granularity of the page cache.
-
- If "largeio" specified, a filesystem that was created with a
- "swidth" specified will return the "swidth" value (in bytes)
- in st_blksize. If the filesystem does not have a "swidth"
- specified but does specify an "allocsize" then "allocsize"
- (in bytes) will be returned instead. Otherwise the behaviour
- is the same as if "nolargeio" was specified.
-
- logbufs=value
- Set the number of in-memory log buffers. Valid numbers
- range from 2-8 inclusive.
-
- The default value is 8 buffers.
-
- If the memory cost of 8 log buffers is too high on small
- systems, then it may be reduced at some cost to performance
- on metadata intensive workloads. The logbsize option below
- controls the size of each buffer and so is also relevant to
- this case.
-
- logbsize=value
- Set the size of each in-memory log buffer. The size may be
- specified in bytes, or in kilobytes with a "k" suffix.
- Valid sizes for version 1 and version 2 logs are 16384 (16k)
- and 32768 (32k). Valid sizes for version 2 logs also
- include 65536 (64k), 131072 (128k) and 262144 (256k). The
- logbsize must be an integer multiple of the log
- stripe unit configured at mkfs time.
-
- The default value for for version 1 logs is 32768, while the
- default value for version 2 logs is MAX(32768, log_sunit).
-
- logdev=device and rtdev=device
- Use an external log (metadata journal) and/or real-time device.
- An XFS filesystem has up to three parts: a data section, a log
- section, and a real-time section. The real-time section is
- optional, and the log section can be separate from the data
- section or contained within it.
-
- noalign
- Data allocations will not be aligned at stripe unit
- boundaries. This is only relevant to filesystems created
- with non-zero data alignment parameters (sunit, swidth) by
- mkfs.
-
- norecovery
- The filesystem will be mounted without running log recovery.
- If the filesystem was not cleanly unmounted, it is likely to
- be inconsistent when mounted in "norecovery" mode.
- Some files or directories may not be accessible because of this.
- Filesystems mounted "norecovery" must be mounted read-only or
- the mount will fail.
-
- nouuid
- Don't check for double mounted file systems using the file
- system uuid. This is useful to mount LVM snapshot volumes,
- and often used in combination with "norecovery" for mounting
- read-only snapshots.
-
- noquota
- Forcibly turns off all quota accounting and enforcement
- within the filesystem.
-
- uquota/usrquota/uqnoenforce/quota
- User disk quota accounting enabled, and limits (optionally)
- enforced. Refer to xfs_quota(8) for further details.
-
- gquota/grpquota/gqnoenforce
- Group disk quota accounting enabled and limits (optionally)
- enforced. Refer to xfs_quota(8) for further details.
-
- pquota/prjquota/pqnoenforce
- Project disk quota accounting enabled and limits (optionally)
- enforced. Refer to xfs_quota(8) for further details.
-
- sunit=value and swidth=value
- Used to specify the stripe unit and width for a RAID device
- or a stripe volume. "value" must be specified in 512-byte
- block units. These options are only relevant to filesystems
- that were created with non-zero data alignment parameters.
-
- The sunit and swidth parameters specified must be compatible
- with the existing filesystem alignment characteristics. In
- general, that means the only valid changes to sunit are
- increasing it by a power-of-2 multiple. Valid swidth values
- are any integer multiple of a valid sunit value.
-
- Typically the only time these mount options are necessary if
- after an underlying RAID device has had it's geometry
- modified, such as adding a new disk to a RAID5 lun and
- reshaping it.
-
- swalloc
- Data allocations will be rounded up to stripe width boundaries
- when the current end of file is being extended and the file
- size is larger than the stripe width size.
-
- wsync
- When specified, all filesystem namespace operations are
- executed synchronously. This ensures that when the namespace
- operation (create, unlink, etc) completes, the change to the
- namespace is on stable storage. This is useful in HA setups
- where failover must not result in clients seeing
- inconsistent namespace presentation during or after a
- failover event.
-
-
-Deprecated Mount Options
-========================
-
- Name Removal Schedule
- ---- ----------------
-
-
-Removed Mount Options
-=====================
-
- Name Removed
- ---- -------
- delaylog/nodelaylog v4.0
- ihashsize v4.0
- irixsgid v4.0
- osyncisdsync/osyncisosync v4.0
- barrier v4.19
- nobarrier v4.19
-
-
-sysctls
-=======
-
-The following sysctls are available for the XFS filesystem:
-
- fs.xfs.stats_clear (Min: 0 Default: 0 Max: 1)
- Setting this to "1" clears accumulated XFS statistics
- in /proc/fs/xfs/stat. It then immediately resets to "0".
-
- fs.xfs.xfssyncd_centisecs (Min: 100 Default: 3000 Max: 720000)
- The interval at which the filesystem flushes metadata
- out to disk and runs internal cache cleanup routines.
-
- fs.xfs.filestream_centisecs (Min: 1 Default: 3000 Max: 360000)
- The interval at which the filesystem ages filestreams cache
- references and returns timed-out AGs back to the free stream
- pool.
-
- fs.xfs.speculative_prealloc_lifetime
- (Units: seconds Min: 1 Default: 300 Max: 86400)
- The interval at which the background scanning for inodes
- with unused speculative preallocation runs. The scan
- removes unused preallocation from clean inodes and releases
- the unused space back to the free pool.
-
- fs.xfs.error_level (Min: 0 Default: 3 Max: 11)
- A volume knob for error reporting when internal errors occur.
- This will generate detailed messages & backtraces for filesystem
- shutdowns, for example. Current threshold values are:
-
- XFS_ERRLEVEL_OFF: 0
- XFS_ERRLEVEL_LOW: 1
- XFS_ERRLEVEL_HIGH: 5
-
- fs.xfs.panic_mask (Min: 0 Default: 0 Max: 256)
- Causes certain error conditions to call BUG(). Value is a bitmask;
- OR together the tags which represent errors which should cause panics:
-
- XFS_NO_PTAG 0
- XFS_PTAG_IFLUSH 0x00000001
- XFS_PTAG_LOGRES 0x00000002
- XFS_PTAG_AILDELETE 0x00000004
- XFS_PTAG_ERROR_REPORT 0x00000008
- XFS_PTAG_SHUTDOWN_CORRUPT 0x00000010
- XFS_PTAG_SHUTDOWN_IOERROR 0x00000020
- XFS_PTAG_SHUTDOWN_LOGERROR 0x00000040
- XFS_PTAG_FSBLOCK_ZERO 0x00000080
- XFS_PTAG_VERIFIER_ERROR 0x00000100
-
- This option is intended for debugging only.
-
- fs.xfs.irix_symlink_mode (Min: 0 Default: 0 Max: 1)
- Controls whether symlinks are created with mode 0777 (default)
- or whether their mode is affected by the umask (irix mode).
-
- fs.xfs.irix_sgid_inherit (Min: 0 Default: 0 Max: 1)
- Controls files created in SGID directories.
- If the group ID of the new file does not match the effective group
- ID or one of the supplementary group IDs of the parent dir, the
- ISGID bit is cleared if the irix_sgid_inherit compatibility sysctl
- is set.
-
- fs.xfs.inherit_sync (Min: 0 Default: 1 Max: 1)
- Setting this to "1" will cause the "sync" flag set
- by the xfs_io(8) chattr command on a directory to be
- inherited by files in that directory.
-
- fs.xfs.inherit_nodump (Min: 0 Default: 1 Max: 1)
- Setting this to "1" will cause the "nodump" flag set
- by the xfs_io(8) chattr command on a directory to be
- inherited by files in that directory.
-
- fs.xfs.inherit_noatime (Min: 0 Default: 1 Max: 1)
- Setting this to "1" will cause the "noatime" flag set
- by the xfs_io(8) chattr command on a directory to be
- inherited by files in that directory.
-
- fs.xfs.inherit_nosymlinks (Min: 0 Default: 1 Max: 1)
- Setting this to "1" will cause the "nosymlinks" flag set
- by the xfs_io(8) chattr command on a directory to be
- inherited by files in that directory.
-
- fs.xfs.inherit_nodefrag (Min: 0 Default: 1 Max: 1)
- Setting this to "1" will cause the "nodefrag" flag set
- by the xfs_io(8) chattr command on a directory to be
- inherited by files in that directory.
-
- fs.xfs.rotorstep (Min: 1 Default: 1 Max: 256)
- In "inode32" allocation mode, this option determines how many
- files the allocator attempts to allocate in the same allocation
- group before moving to the next allocation group. The intent
- is to control the rate at which the allocator moves between
- allocation groups when allocating extents for new files.
-
-Deprecated Sysctls
-==================
-
-None at present.
-
-
-Removed Sysctls
-===============
-
- Name Removed
- ---- -------
- fs.xfs.xfsbufd_centisec v4.0
- fs.xfs.age_buffer_centisecs v4.0
-
-
-Error handling
-==============
-
-XFS can act differently according to the type of error found during its
-operation. The implementation introduces the following concepts to the error
-handler:
-
- -failure speed:
- Defines how fast XFS should propagate an error upwards when a specific
- error is found during the filesystem operation. It can propagate
- immediately, after a defined number of retries, after a set time period,
- or simply retry forever.
-
- -error classes:
- Specifies the subsystem the error configuration will apply to, such as
- metadata IO or memory allocation. Different subsystems will have
- different error handlers for which behaviour can be configured.
-
- -error handlers:
- Defines the behavior for a specific error.
-
-The filesystem behavior during an error can be set via sysfs files. Each
-error handler works independently - the first condition met by an error handler
-for a specific class will cause the error to be propagated rather than reset and
-retried.
-
-The action taken by the filesystem when the error is propagated is context
-dependent - it may cause a shut down in the case of an unrecoverable error,
-it may be reported back to userspace, or it may even be ignored because
-there's nothing useful we can with the error or anyone we can report it to (e.g.
-during unmount).
-
-The configuration files are organized into the following hierarchy for each
-mounted filesystem:
-
- /sys/fs/xfs/<dev>/error/<class>/<error>/
-
-Where:
- <dev>
- The short device name of the mounted filesystem. This is the same device
- name that shows up in XFS kernel error messages as "XFS(<dev>): ..."
-
- <class>
- The subsystem the error configuration belongs to. As of 4.9, the defined
- classes are:
-
- - "metadata": applies metadata buffer write IO
-
- <error>
- The individual error handler configurations.
-
-
-Each filesystem has "global" error configuration options defined in their top
-level directory:
-
- /sys/fs/xfs/<dev>/error/
-
- fail_at_unmount (Min: 0 Default: 1 Max: 1)
- Defines the filesystem error behavior at unmount time.
-
- If set to a value of 1, XFS will override all other error configurations
- during unmount and replace them with "immediate fail" characteristics.
- i.e. no retries, no retry timeout. This will always allow unmount to
- succeed when there are persistent errors present.
-
- If set to 0, the configured retry behaviour will continue until all
- retries and/or timeouts have been exhausted. This will delay unmount
- completion when there are persistent errors, and it may prevent the
- filesystem from ever unmounting fully in the case of "retry forever"
- handler configurations.
-
- Note: there is no guarantee that fail_at_unmount can be set while an
- unmount is in progress. It is possible that the sysfs entries are
- removed by the unmounting filesystem before a "retry forever" error
- handler configuration causes unmount to hang, and hence the filesystem
- must be configured appropriately before unmount begins to prevent
- unmount hangs.
-
-Each filesystem has specific error class handlers that define the error
-propagation behaviour for specific errors. There is also a "default" error
-handler defined, which defines the behaviour for all errors that don't have
-specific handlers defined. Where multiple retry constraints are configuredi for
-a single error, the first retry configuration that expires will cause the error
-to be propagated. The handler configurations are found in the directory:
-
- /sys/fs/xfs/<dev>/error/<class>/<error>/
-
- max_retries (Min: -1 Default: Varies Max: INTMAX)
- Defines the allowed number of retries of a specific error before
- the filesystem will propagate the error. The retry count for a given
- error context (e.g. a specific metadata buffer) is reset every time
- there is a successful completion of the operation.
-
- Setting the value to "-1" will cause XFS to retry forever for this
- specific error.
-
- Setting the value to "0" will cause XFS to fail immediately when the
- specific error is reported.
-
- Setting the value to "N" (where 0 < N < Max) will make XFS retry the
- operation "N" times before propagating the error.
-
- retry_timeout_seconds (Min: -1 Default: Varies Max: 1 day)
- Define the amount of time (in seconds) that the filesystem is
- allowed to retry its operations when the specific error is
- found.
-
- Setting the value to "-1" will allow XFS to retry forever for this
- specific error.
-
- Setting the value to "0" will cause XFS to fail immediately when the
- specific error is reported.
-
- Setting the value to "N" (where 0 < N < Max) will allow XFS to retry the
- operation for up to "N" seconds before propagating the error.
-
-Note: The default behaviour for a specific error handler is dependent on both
-the class and error context. For example, the default values for
-"metadata/ENODEV" are "0" rather than "-1" so that this error handler defaults
-to "fail immediately" behaviour. This is done because ENODEV is a fatal,
-unrecoverable error no matter how many times the metadata IO is retried.
diff --git a/MAINTAINERS b/MAINTAINERS
index d0ed73599..66e972e9a 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -17364,7 +17364,7 @@ L: linux-xfs@vger.kernel.org
W: http://xfs.org/
T: git git://git.kernel.org/pub/scm/fs/xfs/xfs-linux.git
S: Supported
-F: Documentation/filesystems/xfs.txt
+F: Documentation/filesystems/xfs.rst
F: fs/xfs/
XILINX AXI ETHERNET DRIVER
--
2.22.0
^ permalink raw reply related
* Re: [PATCH 10/10] tools/power/x86: A tool to validate Intel Speed Select commands
From: Andy Shevchenko @ 2019-06-29 16:00 UTC (permalink / raw)
To: Srinivas Pandruvada
Cc: Darren Hart, Andy Shevchenko, Andriy Shevchenko, Jonathan Corbet,
Rafael J. Wysocki, Alan Cox, Len Brown, prarit, darcari,
Linux Documentation List, Linux Kernel Mailing List,
Platform Driver
In-Reply-To: <1c4238f7d18d316df82d3ba1618fecdcf014f98a.camel@linux.intel.com>
On Sat, Jun 29, 2019 at 5:53 PM Srinivas Pandruvada
<srinivas.pandruvada@linux.intel.com> wrote:
> On Sat, 2019-06-29 at 17:31 +0300, Andy Shevchenko wrote:
> > On Thu, Jun 27, 2019 at 1:39 AM Srinivas Pandruvada
> > <srinivas.pandruvada@linux.intel.com> wrote:
> > > +++ b/tools/power/x86/intel_speed_select/Makefile
> >
> > My experience with some tools are not good in order of their build
> > process.
> > Can this one use tools build infrastructure from the day 1?
> Can you give some pointers?
Sure.
At least simple ones are under tools/gpio, tools/iio, etc.
You may compare them to see what's different and what's common and
base Makefile here on that.
I dunno if there is any tool under tools/power to use that, it might
give an example of `descend` feature in Makefile.
> > > @@ -0,0 +1,31 @@
> > > +# SPDX-License-Identifier: GPL-2.0
> > > +CC = $(CROSS_COMPILE)gcc
> > > +BUILD_OUTPUT := $(CURDIR)
> > > +PREFIX ?= /usr
> > > +DESTDIR ?=
> > > +
> > > +override CFLAGS += -D__EXPORTED_HEADERS__ -Wall -D_GNU_SOURCE
> > > +override CFLAGS += -I$(CURDIR)/../../../../include/uapi/
> > > +override CFLAGS += -I$(CURDIR)/../../../../include/
> > > +
> > > +%: %.c
> > > + @mkdir -p $(BUILD_OUTPUT)
> > > + $(CC) $(CFLAGS) $< -o $(BUILD_OUTPUT)/$@ $(LDFLAGS)
> > > +
> > > +DEPS = isst.h
> > > +OBJ = isst_config.o isst_core.o isst_display.o
> > > +
> > > +%.o: %.c $(DEPS)
> > > + $(CC) -c -o $(BUILD_OUTPUT)/$@ $< $(CFLAGS)
> > > +
> > > +intel-speed-select: $(OBJ)
> > > + $(CC) -o $(BUILD_OUTPUT)/$@ $^ $(CFLAGS)
> > > +
> > > +.PHONY : clean
> > > +clean :
> > > + @rm -f $(BUILD_OUTPUT)/intel-speed-select
> > > + @rm -f $(BUILD_OUTPUT)/*.o
> > > +
> > > +install : intel-speed-select
> > > + install -d $(DESTDIR)$(PREFIX)/sbin
> > > + install $(BUILD_OUTPUT)/intel-speed-select
> > > $(DESTDIR)$(PREFIX)/sbin/intel-speed-select
--
With Best Regards,
Andy Shevchenko
^ permalink raw reply
* Re: [PATCH v4] Documentation:sh:convert register-banks.txt and new-machine.txt to rst format.
From: Vandana BN @ 2019-06-29 15:56 UTC (permalink / raw)
To: Mauro Carvalho Chehab
Cc: Yoshinori Sato, Rich Felker, Jonathan Corbet, linux-sh, linux-doc,
linux-kernel, skhan, gregkh, linux-kernel-mentees
In-Reply-To: <20190629115014.4aec058d@coco.lan>
On 29/06/19 8:20 PM, Mauro Carvalho Chehab wrote:
> Em Sat, 29 Jun 2019 20:02:45 +0530
> Vandana BN <bnvandana@gmail.com> escreveu:
>
>> This patch converts new-machine.txt and register-banks.txt
>> to ReST format, No content change.
>> Added interfaces.rst to contain kernel-doc markups from index.rst
>> Added interfaces.rst,new-machine.rst and register-banks.rst to sh/index.rst
>> Added SPDX tag in index.rst
>>
>> Signed-off-by: Vandana BN <bnvandana@gmail.com>
> Looks good to me. Just a final thing to do.
>
> Be sure to run:
>
> ./scripts/documentation-file-ref-check
>
> in order to check that you're not breaking any references to the file.
> If it breaks, please adjust the reference to reflect the file
> rename.
>
> After fixing the broken reference, feel free do add:
>
> Reviewed-by: Mauro Carvalho Chehab <mchehab@kernel.org>
Thanks Mauro,
i don't not see any broken references.
>> ---
>> Documentation/sh/index.rst | 65 +------
>> Documentation/sh/interface.rst | 59 ++++++
>> .../sh/{new-machine.txt => new-machine.rst} | 171 +++++++++---------
>> ...{register-banks.txt => register-banks.rst} | 8 +-
>> 4 files changed, 163 insertions(+), 140 deletions(-)
>> create mode 100644 Documentation/sh/interface.rst
>> rename Documentation/sh/{new-machine.txt => new-machine.rst} (79%)
>> rename Documentation/sh/{register-banks.txt => register-banks.rst} (90%)
>>
>> diff --git a/Documentation/sh/index.rst b/Documentation/sh/index.rst
>> index bc8db7ba894a..fec3c405b6b9 100644
>> --- a/Documentation/sh/index.rst
>> +++ b/Documentation/sh/index.rst
>> @@ -1,59 +1,14 @@
>> -=======================
>> -SuperH Interfaces Guide
>> -=======================
>> +.. SPDX-License-Identifier: GPL-2.0
>>
>> -:Author: Paul Mundt
>> -
>> -Memory Management
>> -=================
>> -
>> -SH-4
>> -----
>> -
>> -Store Queue API
>> -~~~~~~~~~~~~~~~
>> -
>> -.. kernel-doc:: arch/sh/kernel/cpu/sh4/sq.c
>> - :export:
>> -
>> -SH-5
>> -----
>> -
>> -TLB Interfaces
>> -~~~~~~~~~~~~~~
>> -
>> -.. kernel-doc:: arch/sh/mm/tlb-sh5.c
>> - :internal:
>> -
>> -.. kernel-doc:: arch/sh/include/asm/tlb_64.h
>> - :internal:
>> +====================
>> +SuperH Documentation
>> +====================
>>
>> -Machine Specific Interfaces
>> -===========================
>> -
>> -mach-dreamcast
>> ---------------
>> -
>> -.. kernel-doc:: arch/sh/boards/mach-dreamcast/rtc.c
>> - :internal:
>> -
>> -mach-x3proto
>> -------------
>> -
>> -.. kernel-doc:: arch/sh/boards/mach-x3proto/ilsel.c
>> - :export:
>> -
>> -Busses
>> -======
>> -
>> -SuperHyway
>> -----------
>> -
>> -.. kernel-doc:: drivers/sh/superhyway/superhyway.c
>> - :export:
>> +:Author: Paul Mundt
>>
>> -Maple
>> ------
>> +.. toctree::
>> + :maxdepth: 2
>>
>> -.. kernel-doc:: drivers/sh/maple/maple.c
>> - :export:
>> + interface
>> + new-machine
>> + register-banks
>> diff --git a/Documentation/sh/interface.rst b/Documentation/sh/interface.rst
>> new file mode 100644
>> index 000000000000..bc8db7ba894a
>> --- /dev/null
>> +++ b/Documentation/sh/interface.rst
>> @@ -0,0 +1,59 @@
>> +=======================
>> +SuperH Interfaces Guide
>> +=======================
>> +
>> +:Author: Paul Mundt
>> +
>> +Memory Management
>> +=================
>> +
>> +SH-4
>> +----
>> +
>> +Store Queue API
>> +~~~~~~~~~~~~~~~
>> +
>> +.. kernel-doc:: arch/sh/kernel/cpu/sh4/sq.c
>> + :export:
>> +
>> +SH-5
>> +----
>> +
>> +TLB Interfaces
>> +~~~~~~~~~~~~~~
>> +
>> +.. kernel-doc:: arch/sh/mm/tlb-sh5.c
>> + :internal:
>> +
>> +.. kernel-doc:: arch/sh/include/asm/tlb_64.h
>> + :internal:
>> +
>> +Machine Specific Interfaces
>> +===========================
>> +
>> +mach-dreamcast
>> +--------------
>> +
>> +.. kernel-doc:: arch/sh/boards/mach-dreamcast/rtc.c
>> + :internal:
>> +
>> +mach-x3proto
>> +------------
>> +
>> +.. kernel-doc:: arch/sh/boards/mach-x3proto/ilsel.c
>> + :export:
>> +
>> +Busses
>> +======
>> +
>> +SuperHyway
>> +----------
>> +
>> +.. kernel-doc:: drivers/sh/superhyway/superhyway.c
>> + :export:
>> +
>> +Maple
>> +-----
>> +
>> +.. kernel-doc:: drivers/sh/maple/maple.c
>> + :export:
>> diff --git a/Documentation/sh/new-machine.txt b/Documentation/sh/new-machine.rst
>> similarity index 79%
>> rename from Documentation/sh/new-machine.txt
>> rename to Documentation/sh/new-machine.rst
>> index e0961a66130b..b16c33342642 100644
>> --- a/Documentation/sh/new-machine.txt
>> +++ b/Documentation/sh/new-machine.rst
>> @@ -1,8 +1,8 @@
>> +================================
>> +Adding a new board to LinuxSH
>> +================================
>>
>> - Adding a new board to LinuxSH
>> - ================================
>> -
>> - Paul Mundt <lethal@linux-sh.org>
>> +Paul Mundt <lethal@linux-sh.org>
>>
>> This document attempts to outline what steps are necessary to add support
>> for new boards to the LinuxSH port under the new 2.5 and 2.6 kernels. This
>> @@ -19,65 +19,67 @@ include/asm-sh/. For the new kernel, things are broken out by board type,
>> companion chip type, and CPU type. Looking at a tree view of this directory
>> hierarchy looks like the following:
>>
>> -Board-specific code:
>> -
>> -.
>> -|-- arch
>> -| `-- sh
>> -| `-- boards
>> -| |-- adx
>> -| | `-- board-specific files
>> -| |-- bigsur
>> -| | `-- board-specific files
>> -| |
>> -| ... more boards here ...
>> -|
>> -`-- include
>> - `-- asm-sh
>> - |-- adx
>> - | `-- board-specific headers
>> - |-- bigsur
>> - | `-- board-specific headers
>> - |
>> - .. more boards here ...
>> -
>> -Next, for companion chips:
>> -.
>> -`-- arch
>> - `-- sh
>> - `-- cchips
>> - `-- hd6446x
>> - `-- hd64461
>> - `-- cchip-specific files
>> +Board-specific code::
>> +
>> + .
>> + |-- arch
>> + | `-- sh
>> + | `-- boards
>> + | |-- adx
>> + | | `-- board-specific files
>> + | |-- bigsur
>> + | | `-- board-specific files
>> + | |
>> + | ... more boards here ...
>> + |
>> + `-- include
>> + `-- asm-sh
>> + |-- adx
>> + | `-- board-specific headers
>> + |-- bigsur
>> + | `-- board-specific headers
>> + |
>> + .. more boards here ...
>> +
>> +Next, for companion chips::
>> +
>> + .
>> + `-- arch
>> + `-- sh
>> + `-- cchips
>> + `-- hd6446x
>> + `-- hd64461
>> + `-- cchip-specific files
>>
>> ... and so on. Headers for the companion chips are treated the same way as
>> board-specific headers. Thus, include/asm-sh/hd64461 is home to all of the
>> hd64461-specific headers.
>>
>> -Finally, CPU family support is also abstracted:
>> -.
>> -|-- arch
>> -| `-- sh
>> -| |-- kernel
>> -| | `-- cpu
>> -| | |-- sh2
>> -| | | `-- SH-2 generic files
>> -| | |-- sh3
>> -| | | `-- SH-3 generic files
>> -| | `-- sh4
>> -| | `-- SH-4 generic files
>> -| `-- mm
>> -| `-- This is also broken out per CPU family, so each family can
>> -| have their own set of cache/tlb functions.
>> -|
>> -`-- include
>> - `-- asm-sh
>> - |-- cpu-sh2
>> - | `-- SH-2 specific headers
>> - |-- cpu-sh3
>> - | `-- SH-3 specific headers
>> - `-- cpu-sh4
>> - `-- SH-4 specific headers
>> +Finally, CPU family support is also abstracted::
>> +
>> + .
>> + |-- arch
>> + | `-- sh
>> + | |-- kernel
>> + | | `-- cpu
>> + | | |-- sh2
>> + | | | `-- SH-2 generic files
>> + | | |-- sh3
>> + | | | `-- SH-3 generic files
>> + | | `-- sh4
>> + | | `-- SH-4 generic files
>> + | `-- mm
>> + | `-- This is also broken out per CPU family, so each family can
>> + | have their own set of cache/tlb functions.
>> + |
>> + `-- include
>> + `-- asm-sh
>> + |-- cpu-sh2
>> + | `-- SH-2 specific headers
>> + |-- cpu-sh3
>> + | `-- SH-3 specific headers
>> + `-- cpu-sh4
>> + `-- SH-4 specific headers
>>
>> It should be noted that CPU subtypes are _not_ abstracted. Thus, these still
>> need to be dealt with by the CPU family specific code.
>> @@ -112,18 +114,20 @@ setup code, we're required at the very least to provide definitions for
>> get_system_type() and platform_setup(). For our imaginary board, this
>> might look something like:
>>
>> -/*
>> - * arch/sh/boards/vapor/setup.c - Setup code for imaginary board
>> - */
>> -#include <linux/init.h>
>> +.. code-block:: c
>> +
>> + /*
>> + * arch/sh/boards/vapor/setup.c - Setup code for imaginary board
>> + */
>> + #include <linux/init.h>
>>
>> -const char *get_system_type(void)
>> -{
>> - return "FooTech Vaporboard";
>> -}
>> + const char *get_system_type(void)
>> + {
>> + return "FooTech Vaporboard";
>> + }
>>
>> -int __init platform_setup(void)
>> -{
>> + int __init platform_setup(void)
>> + {
>> /*
>> * If our hardware actually existed, we would do real
>> * setup here. Though it's also sane to leave this empty
>> @@ -136,7 +140,8 @@ int __init platform_setup(void)
>> /* And whatever else ... */
>>
>> return 0;
>> -}
>> + }
>> +
>>
>> Our new imaginary board will also have to tie into the machvec in order for it
>> to be of any use.
>> @@ -172,16 +177,17 @@ sufficient.
>> vector.
>>
>> Note that these prototypes are generated automatically by setting
>> - __IO_PREFIX to something sensible. A typical example would be:
>> + __IO_PREFIX to something sensible. A typical example would be::
>>
>> #define __IO_PREFIX vapor
>> #include <asm/io_generic.h>
>>
>> +
>> somewhere in the board-specific header. Any boards being ported that still
>> have a legacy io.h should remove it entirely and switch to the new model.
>>
>> - Add machine vector definitions to the board's setup.c. At a bare minimum,
>> - this must be defined as something like:
>> + this must be defined as something like::
>>
>> struct sh_machine_vector mv_vapor __initmv = {
>> .mv_name = "vapor",
>> @@ -202,11 +208,11 @@ Large portions of the build system are now entirely dynamic, and merely
>> require the proper entry here and there in order to get things done.
>>
>> The first thing to do is to add an entry to arch/sh/Kconfig, under the
>> -"System type" menu:
>> +"System type" menu::
>>
>> -config SH_VAPOR
>> - bool "Vapor"
>> - help
>> + config SH_VAPOR
>> + bool "Vapor"
>> + help
>> select Vapor if configuring for a FooTech Vaporboard.
>>
>> next, this has to be added into arch/sh/Makefile. All boards require a
>> @@ -232,6 +238,8 @@ space restating it here. After this is done, you will be able to use
>> implicit checks for your board if you need this somewhere throughout the
>> common code, such as:
>>
>> +::
>> +
>> /* Make sure we're on the FooTech Vaporboard */
>> if (!mach_is_vapor())
>> return -ENODEV;
>> @@ -253,12 +261,13 @@ build target, and it will be implicitly listed as such in the help text.
>> Looking at the 'make help' output, you should now see something like:
>>
>> Architecture specific targets (sh):
>> - zImage - Compressed kernel image (arch/sh/boot/zImage)
>> - adx_defconfig - Build for adx
>> - cqreek_defconfig - Build for cqreek
>> - dreamcast_defconfig - Build for dreamcast
>> -...
>> - vapor_defconfig - Build for vapor
>> +
>> + - zImage - Compressed kernel image (arch/sh/boot/zImage)
>> + - adx_defconfig - Build for adx
>> + - cqreek_defconfig - Build for cqreek
>> + - dreamcast_defconfig - Build for dreamcast
>> + - ...
>> + - vapor_defconfig - Build for vapor
>>
>> which then allows you to do:
>>
>> diff --git a/Documentation/sh/register-banks.txt b/Documentation/sh/register-banks.rst
>> similarity index 90%
>> rename from Documentation/sh/register-banks.txt
>> rename to Documentation/sh/register-banks.rst
>> index a6719f2f6594..acccfaf80355 100644
>> --- a/Documentation/sh/register-banks.txt
>> +++ b/Documentation/sh/register-banks.rst
>> @@ -1,8 +1,9 @@
>> - Notes on register bank usage in the kernel
>> - ==========================================
>> +==========================================
>> +Notes on register bank usage in the kernel
>> +==========================================
>>
>> Introduction
>> -------------
>> +============
>>
>> The SH-3 and SH-4 CPU families traditionally include a single partial register
>> bank (selected by SR.RB, only r0 ... r7 are banked), whereas other families
>> @@ -30,4 +31,3 @@ Presently the kernel uses several of these registers.
>> - The SR.IMASK interrupt handler makes use of this to set the
>> interrupt priority level (used by local_irq_enable())
>> - r7_bank (current)
>> -
>> --
>> 2.17.1
>>
>
>
> Thanks,
> Mauro
Regards,
Vandana.
^ permalink raw reply
* Re: [PATCH v1] Doc : fs : convert xfs.txt to ReST
From: Jonathan Corbet @ 2019-06-29 15:14 UTC (permalink / raw)
To: Sheriff Esseson
Cc: skhan, darrick.wong, linux-xfs, linux-doc, linux-kernel,
linux-kernel-mentees
In-Reply-To: <20190629150155.GB10491@localhost>
On Sat, 29 Jun 2019 16:01:55 +0100
Sheriff Esseson <sheriffesseson@gmail.com> wrote:
> Signed-off-by: Sheriff Esseson <sheriffesseson@gmail.com>
> ---
>
> In v2.1:
> cc mentees list.
Please do us a favor?
1) Post each patch standalone, without quoted text, ready to be applied.
2) Wait a little while between postings so that you can address more than
one comment at a time.
OK, two favors - off-by-one errors are my specialty...:)
Thanks,
jon
^ permalink raw reply
* Re: [PATCH v1] Doc : fs : convert xfs.txt to ReST
From: Sheriff Esseson @ 2019-06-29 15:01 UTC (permalink / raw)
To: skhan
Cc: darrick.wong, linux-xfs, corbet, linux-doc, linux-kernel,
linux-kernel-mentees
In-Reply-To: <20190629145433.GA10491@localhost>
On Sat, Jun 29, 2019 at 03:54:33PM +0100, Sheriff Esseson wrote:
> On Sat, Jun 29, 2019 at 02:25:08AM +0100, Sheriff Esseson wrote:
> > On Fri, Jun 28, 2019 at 10:43:24PM +0100, Sheriff Esseson wrote:
> > > Convert xfs.txt to ReST, markup and rename accordingly. Update
> > > Documentation/index.rst.
> > >
> > > While at it, make "value" in "option=value" form xfs options definable by
> > > the user, by embedding in angle "<>" brackets, rather than something
> > > predifined elsewhere. This is inline with the conventions in manuals.
> > >
> > > Also, make defaults of boolean options prefixed with "(*)". This is
> > > so that options can be compressed to "[no]option" and on a single line, which renders
> > > consistently and nicely in htmldocs.
> > > lastly, enforce a "one option, one definition" policy to keep things
> > > consistent and simple.
> > >
> > > Signed-off-by: Sheriff Esseson <sheriffesseson@gmail.com>
> > > ---
> > > --
> > > 2.22.0
> > >
> >
> > Rid Documentation/filesystems/index.rst of ".rst" in toc-tree references.
> >
> > CC xfs-list.
> >
> > Correct email indentation.
> >
> > Signed-off-by: Sheriff Esseson <sheriffesseson@gmail.com>
> > ---
> > --
> > 2.22.0
> >
>
> Signed-off-by: Sheriff Esseson <sheriffesseson@gmail.com>
> ---
>
> In v2:
> Update MAINTAINERS.
> fix indentation/long lines issues.
> cc Darick and xfs mailing list.
>
> --
> 2.22.0
>
Signed-off-by: Sheriff Esseson <sheriffesseson@gmail.com>
---
In v2.1:
cc mentees list.
Documentation/filesystems/index.rst | 5 +-
Documentation/filesystems/xfs.rst | 467 +++++++++++++++++++++++++++
Documentation/filesystems/xfs.txt | 470 ----------------------------
MAINTAINERS | 2 +-
4 files changed, 471 insertions(+), 473 deletions(-)
create mode 100644 Documentation/filesystems/xfs.rst
delete mode 100644 Documentation/filesystems/xfs.txt
diff --git a/Documentation/filesystems/index.rst b/Documentation/filesystems/index.rst
index 1131c34d7..a4cf5fca4 100644
--- a/Documentation/filesystems/index.rst
+++ b/Documentation/filesystems/index.rst
@@ -16,7 +16,7 @@ algorithms work.
.. toctree::
:maxdepth: 2
- path-lookup.rst
+ path-lookup
api-summary
splice
@@ -40,4 +40,5 @@ Documentation for individual filesystem types can be found here.
.. toctree::
:maxdepth: 2
- binderfs.rst
+ binderfs
+ xfs
diff --git a/Documentation/filesystems/xfs.rst b/Documentation/filesystems/xfs.rst
new file mode 100644
index 000000000..f52046b96
--- /dev/null
+++ b/Documentation/filesystems/xfs.rst
@@ -0,0 +1,467 @@
+======================
+The SGI XFS Filesystem
+======================
+
+XFS is a high performance journaling filesystem which originated
+on the SGI IRIX platform. It is completely multi-threaded, can
+support large files and large filesystems, extended attributes,
+variable block sizes, is extent based, and makes extensive use of
+Btrees (directories, extents, free space) to aid both performance
+and scalability.
+
+Refer to the documentation at https://xfs.wiki.kernel.org/
+for further details. This implementation is on-disk compatible
+with the IRIX version of XFS.
+
+
+Mount Options
+=============
+
+When mounting an XFS filesystem, the following options are accepted. For
+boolean mount options, the names with the "(*)" prefix is the default behaviour.
+For example, take a behaviour enabled by default to be a one (1) or, a zero (0)
+otherwise, ``(*)[no]default`` would be 0 while ``[no](*)default`` , a 1.
+
+ allocsize=<size>
+ Sets the buffered I/O end-of-file preallocation size when doing delayed
+ allocation writeout (default size is 64KiB). Valid values for this
+ option are page size (typically 4KiB) through to 1GiB, inclusive, in
+ power-of-2 increments.
+
+ The default behaviour is for dynamic end-of-file preallocation size,
+ which uses a set of heuristics to optimise the preallocation size based
+ on the current allocation patterns within the file and the access
+ patterns to the file. Specifying a fixed allocsize value turns off the
+ dynamic behaviour.
+
+ [no]attr2
+ The options enable/disable an "opportunistic" improvement to be made in
+ the way inline extended attributes are stored on-disk. When the new
+ form is used for the first time when ``attr2`` is selected (either when
+ setting or removing extended attributes) the on-disk superblock feature
+ bit field will be updated to reflect this format being in use.
+
+ The default behaviour is determined by the on-disk feature bit
+ indicating that ``attr2`` behaviour is active. If either mount option is
+ set, then that becomes the new default used by the filesystem. However
+ on CRC enabled filesystems, the ``attr2`` format is always used , and so
+ will reject the ``noattr2`` mount option if it is set.
+
+ (*)[no]discard
+ Enable/disable the issuing of commands to let the block device reclaim
+ space freed by the filesystem. This is useful for SSD devices, thinly
+ provisioned LUNs and virtual machine images, but may have a performance
+ impact.
+
+ Note: It is currently recommended that you use the ``fstrim``
+ application to discard unused blocks rather than the ``discard`` mount
+ option because the performance impact of this option is quite severe.
+
+ grpid/bsdgroups
+ nogrpid/(*)sysvgroups
+ These options define what group ID a newly created file gets. When
+ ``grpid`` is set, it takes the group ID of the directory in which it is
+ created; otherwise it takes the ``fsgid`` of the current process, unless
+ the directory has the ``setgid`` bit set, in which case it takes the
+ ``gid`` from the parent directory, and also gets the ``setgid`` bit set
+ if it is a directory itself.
+
+ filestreams
+ Make the data allocator use the filestreams allocation mode across the
+ entire filesystem rather than just on directories configured to use it.
+
+ (*)[no]ikeep
+ When ``ikeep`` is specified, XFS does not delete empty inode clusters
+ and keeps them around on disk. When ``noikeep`` is specified, empty
+ inode clusters are returned to the free space pool.
+
+ inode32 | (*)inode64
+ When ``inode32`` is specified, it indicates that XFS limits inode
+ creation to locations which will not result in inode numbers with more
+ than 32 bits of significance.
+
+ When ``inode64`` is specified, it indicates that XFS is allowed to
+ create inodes at any location in the filesystem, including those which
+ will result in inode numbers occupying more than 32 bits of
+ significance.
+
+ ``inode32`` is provided for backwards compatibility with older systems
+ and applications, since 64 bits inode numbers might cause problems for
+ some applications that cannot handle large inode numbers. If
+ applications are in use which do not handle inode numbers bigger than 32
+ bits, the ``inode32`` option should be specified.
+
+
+ (*)[no]largeio
+ If ``nolargeio`` is specified, the optimal I/O reported in st_blksize by
+ **stat(2)** will be as small as possible to allow user applications to
+ avoid inefficient read/modify/write I/O. This is typically the page
+ size of the machine, as this is the granularity of the page cache.
+
+ If ``largeio`` is specified, a filesystem that was created with a
+ ``swidth`` specified will return the ``swidth`` value (in bytes) in
+ st_blksize. If the filesystem does not have a ``swidth`` specified but
+ does specify an ``allocsize`` then ``allocsize`` (in bytes) will be
+ returned instead. Otherwise the behaviour is the same as if
+ ``nolargeio`` was specified.
+
+ logbufs=<value>
+ Set the number of in-memory log buffers to ``value``. Valid numbers
+ range from 2-8 inclusive.
+
+ The default value is 8 buffers.
+
+ If the memory cost of 8 log buffers is too high on small systems, then
+ it may be reduced at some cost to performance on metadata intensive
+ workloads. The ``logbsize`` option below controls the size of each
+ buffer and so is also relevant to this case.
+
+ logbsize=<value>
+ Set the size of each in-memory log buffer to ``value``. The size may be
+ specified in bytes, or in kilobytes with a "k" suffix. Valid sizes for
+ version 1 and version 2 logs are 16384 (16k) and 32768 (32k). Valid
+ sizes for version 2 logs also include 65536 (64k), 131072 (128k) and
+ 262144 (256k). The ``logbsize`` must be an integer multiple of the
+ "log stripe unit" configured at mkfs time.
+
+ The default value for for version 1 logs is 32768, while the default
+ value for version 2 logs is ``MAX(32768, log_sunit)``.
+
+ logdev=<device>
+ Use ``device`` as an external log (metadata journal). In an XFS
+ filesystem, the log device can be separate from the data device or
+ contained within it.
+
+ rtdev=<device>
+ An XFS filesystem has up to three parts: a data section, a log section,
+ and a real-time section. The real-time section is optional. If
+ enabled, ``rtdev`` sets ``device`` to be used as an external real-time
+ section, similar to ``logdev`` above.
+
+ noalign
+ Data allocations will not be aligned at stripe unit boundaries. This is
+ only relevant to filesystems created with non-zero data alignment
+ parameters (sunit, swidth) by mkfs.
+
+ norecovery
+ The filesystem will be mounted without running log recovery. If the
+ filesystem was not cleanly unmounted, it is likely to be inconsistent
+ when mounted in ``norecovery`` mode. Some files or directories may not
+ be accessible because of this. Filesystems mounted ``norecovery`` must
+ be mounted read-only or the mount will fail.
+
+ nouuid
+ Don't check for double mounted file systems using the file system uuid.
+ This is useful to mount LVM snapshot volumes, and often used in
+ combination with ``norecovery`` for mounting read-only snapshots.
+
+ noquota
+ Forcibly turns off all quota accounting and enforcement
+ within the filesystem.
+
+ uquota/usrquota/uqnoenforce/quota
+ User disk quota accounting enabled, and limits (optionally) enforced.
+ Refer to **xfs_quota(8)** for further details.
+
+ gquota/grpquota/gqnoenforce
+ Group disk quota accounting enabled and limits (optionally) enforced.
+ Refer to **xfs_quota(8)** for further details.
+
+ pquota/prjquota/pqnoenforce
+ Project disk quota accounting enabled and limits (optionally) enforced.
+ Refer to **xfs_quota(8)** for further details.
+
+ sunit=<value>
+ Used to specify the stripe unit for a RAID device or (in conjunction
+ with ``swidth`` below) a stripe volume. ``value`` must be specified in
+ 512-byte block units. This option is only relevant to filesystems that
+ were created with non-zero data alignment parameters.
+
+ The ``sunit`` parameter specified must be compatible with the existing
+ filesystem alignment characteristics. In general, that means the only
+ valid changes to ``sunit`` are increasing it by a power-of-2 multiple.
+
+ Typically, this mount option is necessary only after an underlying RAID
+ device has had its geometry modified, such as adding a new disk to a
+ RAID5 lun and reshaping it.
+
+ swidth=<value>
+ Used to specify the stripe width for a RAID device or (in conjunction
+ with ``sunit`` above) a stripe volume. ``value`` must be specified in
+ 512-byte block units. This option, like ``sunit`` above, is only
+ relevant to filesystems that were created with non-zero data alignment
+ parameters.
+
+ The ``swidth`` parameter specified must be compatible with the existing
+ filesystem alignment characteristics. In general, that means the only
+ valid swidth values are any integer multiple of a valid ``sunit`` value.
+
+ Typically, this mount option is necessary only after an underlying RAID
+ device has had its geometry modified, such as adding a new disk to a
+ RAID5 lun and reshaping it.
+
+
+ swalloc
+ Data allocations will be rounded up to stripe width boundaries when the
+ current end of file is being extended and the file size is larger than
+ the stripe width size.
+
+ wsync
+ When specified, all filesystem namespace operations are executed
+ synchronously. This ensures that when the namespace operation (create,
+ unlink, etc) completes, the change to the namespace is on stable
+ storage. This is useful in HA setups where failover must not result in
+ clients seeing inconsistent namespace presentation during or after a
+ failover event.
+
+
+Deprecated Mount Options
+========================
+
+ Name Removal Schedule
+ ---- ----------------
+
+
+Removed Mount Options
+=====================
+
+ Name Removed
+ ---- -------
+ delaylog/nodelaylog v4.0
+ ihashsize v4.0
+ irixsgid v4.0
+ osyncisdsync/osyncisosync v4.0
+ barrier v4.19
+ nobarrier v4.19
+
+
+sysctls
+=======
+
+The following sysctls are available for the XFS filesystem:
+
+ fs.xfs.stats_clear (Min: 0 Default: 0 Max: 1)
+ Setting this to "1" clears accumulated XFS statistics
+ in /proc/fs/xfs/stat. It then immediately resets to "0".
+
+ fs.xfs.xfssyncd_centisecs (Min: 100 Default: 3000 Max: 720000)
+ The interval at which the filesystem flushes metadata
+ out to disk and runs internal cache cleanup routines.
+
+ fs.xfs.filestream_centisecs (Min: 1 Default: 3000 Max: 360000)
+ The interval at which the filesystem ages filestreams cache
+ references and returns timed-out AGs back to the free stream
+ pool.
+
+ fs.xfs.speculative_prealloc_lifetime
+ (Units: seconds Min: 1 Default: 300 Max: 86400)
+ The interval at which the background scanning for inodes
+ with unused speculative preallocation runs. The scan
+ removes unused preallocation from clean inodes and releases
+ the unused space back to the free pool.
+
+ fs.xfs.error_level (Min: 0 Default: 3 Max: 11)
+ A volume knob for error reporting when internal errors occur.
+ This will generate detailed messages & backtraces for filesystem
+ shutdowns, for example. Current threshold values are:
+
+ XFS_ERRLEVEL_OFF: 0
+ XFS_ERRLEVEL_LOW: 1
+ XFS_ERRLEVEL_HIGH: 5
+
+ fs.xfs.panic_mask (Min: 0 Default: 0 Max: 256)
+ Causes certain error conditions to call BUG(). Value is a bitmask;
+ OR together the tags which represent errors which should cause panics:
+
+ XFS_NO_PTAG 0
+ XFS_PTAG_IFLUSH 0x00000001
+ XFS_PTAG_LOGRES 0x00000002
+ XFS_PTAG_AILDELETE 0x00000004
+ XFS_PTAG_ERROR_REPORT 0x00000008
+ XFS_PTAG_SHUTDOWN_CORRUPT 0x00000010
+ XFS_PTAG_SHUTDOWN_IOERROR 0x00000020
+ XFS_PTAG_SHUTDOWN_LOGERROR 0x00000040
+ XFS_PTAG_FSBLOCK_ZERO 0x00000080
+ XFS_PTAG_VERIFIER_ERROR 0x00000100
+
+ This option is intended for debugging only.
+
+ fs.xfs.irix_symlink_mode (Min: 0 Default: 0 Max: 1)
+ Controls whether symlinks are created with mode 0777 (default)
+ or whether their mode is affected by the umask (irix mode).
+
+ fs.xfs.irix_sgid_inherit (Min: 0 Default: 0 Max: 1)
+ Controls files created in SGID directories.
+ If the group ID of the new file does not match the effective group
+ ID or one of the supplementary group IDs of the parent dir, the
+ ISGID bit is cleared if the irix_sgid_inherit compatibility sysctl
+ is set.
+
+ fs.xfs.inherit_sync (Min: 0 Default: 1 Max: 1)
+ Setting this to "1" will cause the "sync" flag set
+ by the **xfs_io(8)** chattr command on a directory to be
+ inherited by files in that directory.
+
+ fs.xfs.inherit_nodump (Min: 0 Default: 1 Max: 1)
+ Setting this to "1" will cause the "nodump" flag set
+ by the **xfs_io(8)** chattr command on a directory to be
+ inherited by files in that directory.
+
+ fs.xfs.inherit_noatime (Min: 0 Default: 1 Max: 1)
+ Setting this to "1" will cause the "noatime" flag set
+ by the **xfs_io(8)** chattr command on a directory to be
+ inherited by files in that directory.
+
+ fs.xfs.inherit_nosymlinks (Min: 0 Default: 1 Max: 1)
+ Setting this to "1" will cause the "nosymlinks" flag set
+ by the **xfs_io(8)** chattr command on a directory to be
+ inherited by files in that directory.
+
+ fs.xfs.inherit_nodefrag (Min: 0 Default: 1 Max: 1)
+ Setting this to "1" will cause the "nodefrag" flag set
+ by the **xfs_io(8)** chattr command on a directory to be
+ inherited by files in that directory.
+
+ fs.xfs.rotorstep (Min: 1 Default: 1 Max: 256)
+ In "inode32" allocation mode, this option determines how many
+ files the allocator attempts to allocate in the same allocation
+ group before moving to the next allocation group. The intent
+ is to control the rate at which the allocator moves between
+ allocation groups when allocating extents for new files.
+
+Deprecated Sysctls
+==================
+
+None at present.
+
+
+Removed Sysctls
+===============
+
+ Name Removed
+ ---- -------
+ fs.xfs.xfsbufd_centisec v4.0
+ fs.xfs.age_buffer_centisecs v4.0
+
+
+Error handling
+==============
+
+XFS can act differently according to the type of error found during its
+operation. The implementation introduces the following concepts to the error
+handler:
+
+ -failure speed:
+ Defines how fast XFS should propagate an error upwards when a specific
+ error is found during the filesystem operation. It can propagate
+ immediately, after a defined number of retries, after a set time period,
+ or simply retry forever.
+
+ -error classes:
+ Specifies the subsystem the error configuration will apply to, such as
+ metadata IO or memory allocation. Different subsystems will have
+ different error handlers for which behaviour can be configured.
+
+ -error handlers:
+ Defines the behavior for a specific error.
+
+The filesystem behavior during an error can be set via sysfs files. Each
+error handler works independently - the first condition met by an error handler
+for a specific class will cause the error to be propagated rather than reset and
+retried.
+
+The action taken by the filesystem when the error is propagated is context
+dependent - it may cause a shut down in the case of an unrecoverable error,
+it may be reported back to userspace, or it may even be ignored because
+there's nothing useful we can with the error or anyone we can report it to (e.g.
+during unmount).
+
+The configuration files are organized into the following hierarchy for each
+mounted filesystem:
+
+ /sys/fs/xfs/<dev>/error/<class>/<error>/
+
+Where:
+ <dev>
+ The short device name of the mounted filesystem. This is the same device
+ name that shows up in XFS kernel error messages as "XFS(<dev>): ..."
+
+ <class>
+ The subsystem the error configuration belongs to. As of 4.9, the defined
+ classes are:
+
+ - "metadata": applies metadata buffer write IO
+
+ <error>
+ The individual error handler configurations.
+
+
+Each filesystem has "global" error configuration options defined in their top
+level directory:
+
+ /sys/fs/xfs/<dev>/error/
+
+ fail_at_unmount (Min: 0 Default: 1 Max: 1)
+ Defines the filesystem error behavior at unmount time.
+
+ If set to a value of 1, XFS will override all other error configurations
+ during unmount and replace them with "immediate fail" characteristics.
+ i.e. no retries, no retry timeout. This will always allow unmount to
+ succeed when there are persistent errors present.
+
+ If set to 0, the configured retry behaviour will continue until all
+ retries and/or timeouts have been exhausted. This will delay unmount
+ completion when there are persistent errors, and it may prevent the
+ filesystem from ever unmounting fully in the case of "retry forever"
+ handler configurations.
+
+ Note: there is no guarantee that fail_at_unmount can be set while an
+ unmount is in progress. It is possible that the sysfs entries are
+ removed by the unmounting filesystem before a "retry forever" error
+ handler configuration causes unmount to hang, and hence the filesystem
+ must be configured appropriately before unmount begins to prevent
+ unmount hangs.
+
+Each filesystem has specific error class handlers that define the error
+propagation behaviour for specific errors. There is also a "default" error
+handler defined, which defines the behaviour for all errors that don't have
+specific handlers defined. Where multiple retry constraints are configuredi for
+a single error, the first retry configuration that expires will cause the error
+to be propagated. The handler configurations are found in the directory:
+
+ /sys/fs/xfs/<dev>/error/<class>/<error>/
+
+ max_retries (Min: -1 Default: Varies Max: INTMAX)
+ Defines the allowed number of retries of a specific error before
+ the filesystem will propagate the error. The retry count for a given
+ error context (e.g. a specific metadata buffer) is reset every time
+ there is a successful completion of the operation.
+
+ Setting the value to "-1" will cause XFS to retry forever for this
+ specific error.
+
+ Setting the value to "0" will cause XFS to fail immediately when the
+ specific error is reported.
+
+ Setting the value to "N" (where 0 < N < Max) will make XFS retry the
+ operation "N" times before propagating the error.
+
+ retry_timeout_seconds (Min: -1 Default: Varies Max: 1 day)
+ Define the amount of time (in seconds) that the filesystem is
+ allowed to retry its operations when the specific error is
+ found.
+
+ Setting the value to "-1" will allow XFS to retry forever for this
+ specific error.
+
+ Setting the value to "0" will cause XFS to fail immediately when the
+ specific error is reported.
+
+ Setting the value to "N" (where 0 < N < Max) will allow XFS to retry the
+ operation for up to "N" seconds before propagating the error.
+
+Note: The default behaviour for a specific error handler is dependent on both
+the class and error context. For example, the default values for
+"metadata/ENODEV" are "0" rather than "-1" so that this error handler defaults
+to "fail immediately" behaviour. This is done because ENODEV is a fatal,
+unrecoverable error no matter how many times the metadata IO is retried.
diff --git a/Documentation/filesystems/xfs.txt b/Documentation/filesystems/xfs.txt
deleted file mode 100644
index a5cbb5e0e..000000000
--- a/Documentation/filesystems/xfs.txt
+++ /dev/null
@@ -1,470 +0,0 @@
-
-The SGI XFS Filesystem
-======================
-
-XFS is a high performance journaling filesystem which originated
-on the SGI IRIX platform. It is completely multi-threaded, can
-support large files and large filesystems, extended attributes,
-variable block sizes, is extent based, and makes extensive use of
-Btrees (directories, extents, free space) to aid both performance
-and scalability.
-
-Refer to the documentation at https://xfs.wiki.kernel.org/
-for further details. This implementation is on-disk compatible
-with the IRIX version of XFS.
-
-
-Mount Options
-=============
-
-When mounting an XFS filesystem, the following options are accepted.
-For boolean mount options, the names with the (*) suffix is the
-default behaviour.
-
- allocsize=size
- Sets the buffered I/O end-of-file preallocation size when
- doing delayed allocation writeout (default size is 64KiB).
- Valid values for this option are page size (typically 4KiB)
- through to 1GiB, inclusive, in power-of-2 increments.
-
- The default behaviour is for dynamic end-of-file
- preallocation size, which uses a set of heuristics to
- optimise the preallocation size based on the current
- allocation patterns within the file and the access patterns
- to the file. Specifying a fixed allocsize value turns off
- the dynamic behaviour.
-
- attr2
- noattr2
- The options enable/disable an "opportunistic" improvement to
- be made in the way inline extended attributes are stored
- on-disk. When the new form is used for the first time when
- attr2 is selected (either when setting or removing extended
- attributes) the on-disk superblock feature bit field will be
- updated to reflect this format being in use.
-
- The default behaviour is determined by the on-disk feature
- bit indicating that attr2 behaviour is active. If either
- mount option it set, then that becomes the new default used
- by the filesystem.
-
- CRC enabled filesystems always use the attr2 format, and so
- will reject the noattr2 mount option if it is set.
-
- discard
- nodiscard (*)
- Enable/disable the issuing of commands to let the block
- device reclaim space freed by the filesystem. This is
- useful for SSD devices, thinly provisioned LUNs and virtual
- machine images, but may have a performance impact.
-
- Note: It is currently recommended that you use the fstrim
- application to discard unused blocks rather than the discard
- mount option because the performance impact of this option
- is quite severe.
-
- grpid/bsdgroups
- nogrpid/sysvgroups (*)
- These options define what group ID a newly created file
- gets. When grpid is set, it takes the group ID of the
- directory in which it is created; otherwise it takes the
- fsgid of the current process, unless the directory has the
- setgid bit set, in which case it takes the gid from the
- parent directory, and also gets the setgid bit set if it is
- a directory itself.
-
- filestreams
- Make the data allocator use the filestreams allocation mode
- across the entire filesystem rather than just on directories
- configured to use it.
-
- ikeep
- noikeep (*)
- When ikeep is specified, XFS does not delete empty inode
- clusters and keeps them around on disk. When noikeep is
- specified, empty inode clusters are returned to the free
- space pool.
-
- inode32
- inode64 (*)
- When inode32 is specified, it indicates that XFS limits
- inode creation to locations which will not result in inode
- numbers with more than 32 bits of significance.
-
- When inode64 is specified, it indicates that XFS is allowed
- to create inodes at any location in the filesystem,
- including those which will result in inode numbers occupying
- more than 32 bits of significance.
-
- inode32 is provided for backwards compatibility with older
- systems and applications, since 64 bits inode numbers might
- cause problems for some applications that cannot handle
- large inode numbers. If applications are in use which do
- not handle inode numbers bigger than 32 bits, the inode32
- option should be specified.
-
-
- largeio
- nolargeio (*)
- If "nolargeio" is specified, the optimal I/O reported in
- st_blksize by stat(2) will be as small as possible to allow
- user applications to avoid inefficient read/modify/write
- I/O. This is typically the page size of the machine, as
- this is the granularity of the page cache.
-
- If "largeio" specified, a filesystem that was created with a
- "swidth" specified will return the "swidth" value (in bytes)
- in st_blksize. If the filesystem does not have a "swidth"
- specified but does specify an "allocsize" then "allocsize"
- (in bytes) will be returned instead. Otherwise the behaviour
- is the same as if "nolargeio" was specified.
-
- logbufs=value
- Set the number of in-memory log buffers. Valid numbers
- range from 2-8 inclusive.
-
- The default value is 8 buffers.
-
- If the memory cost of 8 log buffers is too high on small
- systems, then it may be reduced at some cost to performance
- on metadata intensive workloads. The logbsize option below
- controls the size of each buffer and so is also relevant to
- this case.
-
- logbsize=value
- Set the size of each in-memory log buffer. The size may be
- specified in bytes, or in kilobytes with a "k" suffix.
- Valid sizes for version 1 and version 2 logs are 16384 (16k)
- and 32768 (32k). Valid sizes for version 2 logs also
- include 65536 (64k), 131072 (128k) and 262144 (256k). The
- logbsize must be an integer multiple of the log
- stripe unit configured at mkfs time.
-
- The default value for for version 1 logs is 32768, while the
- default value for version 2 logs is MAX(32768, log_sunit).
-
- logdev=device and rtdev=device
- Use an external log (metadata journal) and/or real-time device.
- An XFS filesystem has up to three parts: a data section, a log
- section, and a real-time section. The real-time section is
- optional, and the log section can be separate from the data
- section or contained within it.
-
- noalign
- Data allocations will not be aligned at stripe unit
- boundaries. This is only relevant to filesystems created
- with non-zero data alignment parameters (sunit, swidth) by
- mkfs.
-
- norecovery
- The filesystem will be mounted without running log recovery.
- If the filesystem was not cleanly unmounted, it is likely to
- be inconsistent when mounted in "norecovery" mode.
- Some files or directories may not be accessible because of this.
- Filesystems mounted "norecovery" must be mounted read-only or
- the mount will fail.
-
- nouuid
- Don't check for double mounted file systems using the file
- system uuid. This is useful to mount LVM snapshot volumes,
- and often used in combination with "norecovery" for mounting
- read-only snapshots.
-
- noquota
- Forcibly turns off all quota accounting and enforcement
- within the filesystem.
-
- uquota/usrquota/uqnoenforce/quota
- User disk quota accounting enabled, and limits (optionally)
- enforced. Refer to xfs_quota(8) for further details.
-
- gquota/grpquota/gqnoenforce
- Group disk quota accounting enabled and limits (optionally)
- enforced. Refer to xfs_quota(8) for further details.
-
- pquota/prjquota/pqnoenforce
- Project disk quota accounting enabled and limits (optionally)
- enforced. Refer to xfs_quota(8) for further details.
-
- sunit=value and swidth=value
- Used to specify the stripe unit and width for a RAID device
- or a stripe volume. "value" must be specified in 512-byte
- block units. These options are only relevant to filesystems
- that were created with non-zero data alignment parameters.
-
- The sunit and swidth parameters specified must be compatible
- with the existing filesystem alignment characteristics. In
- general, that means the only valid changes to sunit are
- increasing it by a power-of-2 multiple. Valid swidth values
- are any integer multiple of a valid sunit value.
-
- Typically the only time these mount options are necessary if
- after an underlying RAID device has had it's geometry
- modified, such as adding a new disk to a RAID5 lun and
- reshaping it.
-
- swalloc
- Data allocations will be rounded up to stripe width boundaries
- when the current end of file is being extended and the file
- size is larger than the stripe width size.
-
- wsync
- When specified, all filesystem namespace operations are
- executed synchronously. This ensures that when the namespace
- operation (create, unlink, etc) completes, the change to the
- namespace is on stable storage. This is useful in HA setups
- where failover must not result in clients seeing
- inconsistent namespace presentation during or after a
- failover event.
-
-
-Deprecated Mount Options
-========================
-
- Name Removal Schedule
- ---- ----------------
-
-
-Removed Mount Options
-=====================
-
- Name Removed
- ---- -------
- delaylog/nodelaylog v4.0
- ihashsize v4.0
- irixsgid v4.0
- osyncisdsync/osyncisosync v4.0
- barrier v4.19
- nobarrier v4.19
-
-
-sysctls
-=======
-
-The following sysctls are available for the XFS filesystem:
-
- fs.xfs.stats_clear (Min: 0 Default: 0 Max: 1)
- Setting this to "1" clears accumulated XFS statistics
- in /proc/fs/xfs/stat. It then immediately resets to "0".
-
- fs.xfs.xfssyncd_centisecs (Min: 100 Default: 3000 Max: 720000)
- The interval at which the filesystem flushes metadata
- out to disk and runs internal cache cleanup routines.
-
- fs.xfs.filestream_centisecs (Min: 1 Default: 3000 Max: 360000)
- The interval at which the filesystem ages filestreams cache
- references and returns timed-out AGs back to the free stream
- pool.
-
- fs.xfs.speculative_prealloc_lifetime
- (Units: seconds Min: 1 Default: 300 Max: 86400)
- The interval at which the background scanning for inodes
- with unused speculative preallocation runs. The scan
- removes unused preallocation from clean inodes and releases
- the unused space back to the free pool.
-
- fs.xfs.error_level (Min: 0 Default: 3 Max: 11)
- A volume knob for error reporting when internal errors occur.
- This will generate detailed messages & backtraces for filesystem
- shutdowns, for example. Current threshold values are:
-
- XFS_ERRLEVEL_OFF: 0
- XFS_ERRLEVEL_LOW: 1
- XFS_ERRLEVEL_HIGH: 5
-
- fs.xfs.panic_mask (Min: 0 Default: 0 Max: 256)
- Causes certain error conditions to call BUG(). Value is a bitmask;
- OR together the tags which represent errors which should cause panics:
-
- XFS_NO_PTAG 0
- XFS_PTAG_IFLUSH 0x00000001
- XFS_PTAG_LOGRES 0x00000002
- XFS_PTAG_AILDELETE 0x00000004
- XFS_PTAG_ERROR_REPORT 0x00000008
- XFS_PTAG_SHUTDOWN_CORRUPT 0x00000010
- XFS_PTAG_SHUTDOWN_IOERROR 0x00000020
- XFS_PTAG_SHUTDOWN_LOGERROR 0x00000040
- XFS_PTAG_FSBLOCK_ZERO 0x00000080
- XFS_PTAG_VERIFIER_ERROR 0x00000100
-
- This option is intended for debugging only.
-
- fs.xfs.irix_symlink_mode (Min: 0 Default: 0 Max: 1)
- Controls whether symlinks are created with mode 0777 (default)
- or whether their mode is affected by the umask (irix mode).
-
- fs.xfs.irix_sgid_inherit (Min: 0 Default: 0 Max: 1)
- Controls files created in SGID directories.
- If the group ID of the new file does not match the effective group
- ID or one of the supplementary group IDs of the parent dir, the
- ISGID bit is cleared if the irix_sgid_inherit compatibility sysctl
- is set.
-
- fs.xfs.inherit_sync (Min: 0 Default: 1 Max: 1)
- Setting this to "1" will cause the "sync" flag set
- by the xfs_io(8) chattr command on a directory to be
- inherited by files in that directory.
-
- fs.xfs.inherit_nodump (Min: 0 Default: 1 Max: 1)
- Setting this to "1" will cause the "nodump" flag set
- by the xfs_io(8) chattr command on a directory to be
- inherited by files in that directory.
-
- fs.xfs.inherit_noatime (Min: 0 Default: 1 Max: 1)
- Setting this to "1" will cause the "noatime" flag set
- by the xfs_io(8) chattr command on a directory to be
- inherited by files in that directory.
-
- fs.xfs.inherit_nosymlinks (Min: 0 Default: 1 Max: 1)
- Setting this to "1" will cause the "nosymlinks" flag set
- by the xfs_io(8) chattr command on a directory to be
- inherited by files in that directory.
-
- fs.xfs.inherit_nodefrag (Min: 0 Default: 1 Max: 1)
- Setting this to "1" will cause the "nodefrag" flag set
- by the xfs_io(8) chattr command on a directory to be
- inherited by files in that directory.
-
- fs.xfs.rotorstep (Min: 1 Default: 1 Max: 256)
- In "inode32" allocation mode, this option determines how many
- files the allocator attempts to allocate in the same allocation
- group before moving to the next allocation group. The intent
- is to control the rate at which the allocator moves between
- allocation groups when allocating extents for new files.
-
-Deprecated Sysctls
-==================
-
-None at present.
-
-
-Removed Sysctls
-===============
-
- Name Removed
- ---- -------
- fs.xfs.xfsbufd_centisec v4.0
- fs.xfs.age_buffer_centisecs v4.0
-
-
-Error handling
-==============
-
-XFS can act differently according to the type of error found during its
-operation. The implementation introduces the following concepts to the error
-handler:
-
- -failure speed:
- Defines how fast XFS should propagate an error upwards when a specific
- error is found during the filesystem operation. It can propagate
- immediately, after a defined number of retries, after a set time period,
- or simply retry forever.
-
- -error classes:
- Specifies the subsystem the error configuration will apply to, such as
- metadata IO or memory allocation. Different subsystems will have
- different error handlers for which behaviour can be configured.
-
- -error handlers:
- Defines the behavior for a specific error.
-
-The filesystem behavior during an error can be set via sysfs files. Each
-error handler works independently - the first condition met by an error handler
-for a specific class will cause the error to be propagated rather than reset and
-retried.
-
-The action taken by the filesystem when the error is propagated is context
-dependent - it may cause a shut down in the case of an unrecoverable error,
-it may be reported back to userspace, or it may even be ignored because
-there's nothing useful we can with the error or anyone we can report it to (e.g.
-during unmount).
-
-The configuration files are organized into the following hierarchy for each
-mounted filesystem:
-
- /sys/fs/xfs/<dev>/error/<class>/<error>/
-
-Where:
- <dev>
- The short device name of the mounted filesystem. This is the same device
- name that shows up in XFS kernel error messages as "XFS(<dev>): ..."
-
- <class>
- The subsystem the error configuration belongs to. As of 4.9, the defined
- classes are:
-
- - "metadata": applies metadata buffer write IO
-
- <error>
- The individual error handler configurations.
-
-
-Each filesystem has "global" error configuration options defined in their top
-level directory:
-
- /sys/fs/xfs/<dev>/error/
-
- fail_at_unmount (Min: 0 Default: 1 Max: 1)
- Defines the filesystem error behavior at unmount time.
-
- If set to a value of 1, XFS will override all other error configurations
- during unmount and replace them with "immediate fail" characteristics.
- i.e. no retries, no retry timeout. This will always allow unmount to
- succeed when there are persistent errors present.
-
- If set to 0, the configured retry behaviour will continue until all
- retries and/or timeouts have been exhausted. This will delay unmount
- completion when there are persistent errors, and it may prevent the
- filesystem from ever unmounting fully in the case of "retry forever"
- handler configurations.
-
- Note: there is no guarantee that fail_at_unmount can be set while an
- unmount is in progress. It is possible that the sysfs entries are
- removed by the unmounting filesystem before a "retry forever" error
- handler configuration causes unmount to hang, and hence the filesystem
- must be configured appropriately before unmount begins to prevent
- unmount hangs.
-
-Each filesystem has specific error class handlers that define the error
-propagation behaviour for specific errors. There is also a "default" error
-handler defined, which defines the behaviour for all errors that don't have
-specific handlers defined. Where multiple retry constraints are configuredi for
-a single error, the first retry configuration that expires will cause the error
-to be propagated. The handler configurations are found in the directory:
-
- /sys/fs/xfs/<dev>/error/<class>/<error>/
-
- max_retries (Min: -1 Default: Varies Max: INTMAX)
- Defines the allowed number of retries of a specific error before
- the filesystem will propagate the error. The retry count for a given
- error context (e.g. a specific metadata buffer) is reset every time
- there is a successful completion of the operation.
-
- Setting the value to "-1" will cause XFS to retry forever for this
- specific error.
-
- Setting the value to "0" will cause XFS to fail immediately when the
- specific error is reported.
-
- Setting the value to "N" (where 0 < N < Max) will make XFS retry the
- operation "N" times before propagating the error.
-
- retry_timeout_seconds (Min: -1 Default: Varies Max: 1 day)
- Define the amount of time (in seconds) that the filesystem is
- allowed to retry its operations when the specific error is
- found.
-
- Setting the value to "-1" will allow XFS to retry forever for this
- specific error.
-
- Setting the value to "0" will cause XFS to fail immediately when the
- specific error is reported.
-
- Setting the value to "N" (where 0 < N < Max) will allow XFS to retry the
- operation for up to "N" seconds before propagating the error.
-
-Note: The default behaviour for a specific error handler is dependent on both
-the class and error context. For example, the default values for
-"metadata/ENODEV" are "0" rather than "-1" so that this error handler defaults
-to "fail immediately" behaviour. This is done because ENODEV is a fatal,
-unrecoverable error no matter how many times the metadata IO is retried.
diff --git a/MAINTAINERS b/MAINTAINERS
index d0ed73599..66e972e9a 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -17364,7 +17364,7 @@ L: linux-xfs@vger.kernel.org
W: http://xfs.org/
T: git git://git.kernel.org/pub/scm/fs/xfs/xfs-linux.git
S: Supported
-F: Documentation/filesystems/xfs.txt
+F: Documentation/filesystems/xfs.rst
F: fs/xfs/
XILINX AXI ETHERNET DRIVER
--
2.22.0
^ permalink raw reply related
page: next (older) | prev (newer) | latest
- recent:[subjects (threaded)|topics (new)|topics (active)]
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox