static int determine_cipher_type(struct fscrypt_info *ci, struct inode *inode, const char **cipher_str_ret, int *keysize_ret) { if (S_ISREG(inode->i_mode)) { if (ci->ci_data_mode == FS_ENCRYPTION_MODE_AES_256_XTS) { *cipher_str_ret = "xts(aes)"; *keysize_ret = FS_AES_256_XTS_KEY_SIZE; return 0; } pr_warn_once("fscrypto: unsupported contents encryption mode " "%d for inode %lu\n", ci->ci_data_mode, inode->i_ino); return -ENOKEY; } if (S_ISDIR(inode->i_mode) || S_ISLNK(inode->i_mode)) { if (ci->ci_filename_mode == FS_ENCRYPTION_MODE_AES_256_CTS) { *cipher_str_ret = "cts(cbc(aes))"; *keysize_ret = FS_AES_256_CTS_KEY_SIZE; return 0; } pr_warn_once("fscrypto: unsupported filenames encryption mode " "%d for inode %lu\n", ci->ci_filename_mode, inode->i_ino); return -ENOKEY; } pr_warn_once("fscrypto: unsupported file type %d for inode %lu\n", (inode->i_mode & S_IFMT), inode->i_ino); return -ENOKEY; }
/* * It works on following logic: * * For enabling clock, enable = 1 * set2dis = 1 -> clear bit -> set = 0 * set2dis = 0 -> set bit -> set = 1 * * For disabling clock, enable = 0 * set2dis = 1 -> set bit -> set = 1 * set2dis = 0 -> clear bit -> set = 0 * * So, result is always: enable xor set2dis. */ static void clk_gate_endisable(struct clk_hw *hw, int enable) { struct clk_gate *gate = to_clk_gate(hw); int set = gate->flags & CLK_GATE_SET_TO_DISABLE ? 1 : 0; u32 reg; int ret; set ^= enable; if (gate->flags & CLK_GATE_HIWORD_MASK) { reg = BIT(gate->bit_idx + 16); } else { ret = zynqmp_pm_mmio_read((u32)(ulong)gate->reg, ®); if (ret) pr_warn_once("Read fail gate address: %x\n", (u32)(ulong)gate->reg); if (!set) reg &= ~BIT(gate->bit_idx); } if (set) reg |= BIT(gate->bit_idx); ret = zynqmp_pm_mmio_writel(reg, gate->reg); if (ret) pr_warn_once("Write failed gate address:%x\n", (u32)(ulong)reg); }
int mpx_enable_management(void) { void __user *bd_base = MPX_INVALID_BOUNDS_DIR; struct mm_struct *mm = current->mm; int ret = 0; /* * runtime in the userspace will be responsible for allocation of * the bounds directory. Then, it will save the base of the bounds * directory into XSAVE/XRSTOR Save Area and enable MPX through * XRSTOR instruction. * * The copy_xregs_to_kernel() beneath get_xsave_field_ptr() is * expected to be relatively expensive. Storing the bounds * directory here means that we do not have to do xsave in the * unmap path; we can just use mm->context.bd_addr instead. */ bd_base = mpx_get_bounds_dir(); down_write(&mm->mmap_sem); /* MPX doesn't support addresses above 47 bits yet. */ if (find_vma(mm, DEFAULT_MAP_WINDOW)) { pr_warn_once("%s (%d): MPX cannot handle addresses " "above 47-bits. Disabling.", current->comm, current->pid); ret = -ENXIO; goto out; } mm->context.bd_addr = bd_base; if (mm->context.bd_addr == MPX_INVALID_BOUNDS_DIR) ret = -ENXIO; out: up_write(&mm->mmap_sem); return ret; }
/** * hw_breakpoint_slot_setup - Find and setup a perf slot according to * operations * * @slots: pointer to array of slots * @max_slots: max number of slots * @bp: perf_event to setup * @ops: operation to be carried out on the slot * * Return: * slot index on success * -ENOSPC if no slot is available/matches * -EINVAL on wrong operations parameter */ static int hw_breakpoint_slot_setup(struct perf_event **slots, int max_slots, struct perf_event *bp, enum hw_breakpoint_ops ops) { int i; struct perf_event **slot; for (i = 0; i < max_slots; ++i) { slot = &slots[i]; switch (ops) { case HW_BREAKPOINT_INSTALL: if (!*slot) { *slot = bp; return i; } break; case HW_BREAKPOINT_UNINSTALL: if (*slot == bp) { *slot = NULL; return i; } break; case HW_BREAKPOINT_RESTORE: if (*slot == bp) return i; break; default: pr_warn_once("Unhandled hw breakpoint ops %d\n", ops); return -EINVAL; } } return -ENOSPC; }
static unsigned int cpufreq_p4_get_frequency(struct cpuinfo_x86 *c) { if (c->x86 == 0x06) { if (cpu_has(c, X86_FEATURE_EST)) pr_warn_once("Warning: EST-capable CPU detected. The acpi-cpufreq module offers voltage scaling in addition to frequency scaling. You should use that instead of p4-clockmod, if possible.\n"); switch (c->x86_model) { case 0x0E: /* Core */ case 0x0F: /* Core Duo */ case 0x16: /* Celeron Core */ case 0x1C: /* Atom */ p4clockmod_driver.flags |= CPUFREQ_CONST_LOOPS; return speedstep_get_frequency(SPEEDSTEP_CPU_PCORE); case 0x0D: /* Pentium M (Dothan) */ p4clockmod_driver.flags |= CPUFREQ_CONST_LOOPS; /* fall through */ case 0x09: /* Pentium M (Banias) */ return speedstep_get_frequency(SPEEDSTEP_CPU_PM); } } if (c->x86 != 0xF) return 0; /* on P-4s, the TSC runs with constant frequency independent whether * throttling is active or not. */ p4clockmod_driver.flags |= CPUFREQ_CONST_LOOPS; if (speedstep_detect_processor() == SPEEDSTEP_CPU_P4M) { pr_warn("Warning: Pentium 4-M detected. The speedstep-ich or acpi cpufreq modules offer voltage scaling in addition of frequency scaling. You should use either one instead of p4-clockmod, if possible.\n"); return speedstep_get_frequency(SPEEDSTEP_CPU_P4M); } return speedstep_get_frequency(SPEEDSTEP_CPU_P4D); }
/** * topology_get_acpi_cpu_tag() - Find a unique topology value for a feature * @table: Pointer to the head of the PPTT table * @cpu: Kernel logical CPU number * @level: A level that terminates the search * @flag: A flag which terminates the search * * Get a unique value given a CPU, and a topology level, that can be * matched to determine which cpus share common topological features * at that level. * * Return: Unique value, or -ENOENT if unable to locate CPU */ static int topology_get_acpi_cpu_tag(struct acpi_table_header *table, unsigned int cpu, int level, int flag) { struct acpi_pptt_processor *cpu_node; u32 acpi_cpu_id = get_acpi_id_for_cpu(cpu); cpu_node = acpi_find_processor_node(table, acpi_cpu_id); if (cpu_node) { cpu_node = acpi_find_processor_package_id(table, cpu_node, level, flag); /* * As per specification if the processor structure represents * an actual processor, then ACPI processor ID must be valid. * For processor containers ACPI_PPTT_ACPI_PROCESSOR_ID_VALID * should be set if the UID is valid */ if (level == 0 || cpu_node->flags & ACPI_PPTT_ACPI_PROCESSOR_ID_VALID) return cpu_node->acpi_processor_id; return ACPI_PTR_DIFF(cpu_node, table); } pr_warn_once("PPTT table found, but unable to locate core %d (%d)\n", cpu, acpi_cpu_id); return -ENOENT; }
static int cpu_pmu_request_irq(struct arm_pmu *cpu_pmu, irq_handler_t handler) { int i, err, irq, irqs; struct platform_device *pmu_device = cpu_pmu->plat_device; struct pmu_hw_events __percpu *hw_events = cpu_pmu->hw_events; if (!pmu_device) return -ENODEV; irqs = min(pmu_device->num_resources, num_possible_cpus()); if (irqs < 1) { pr_warn_once("perf/ARM: No irqs for PMU defined, sampling events not supported\n"); return 0; } irq = platform_get_irq(pmu_device, 0); if (irq >= 0 && irq_is_percpu(irq)) { err = request_percpu_irq(irq, handler, "arm-pmu", &hw_events->percpu_pmu); if (err) { pr_err("unable to request IRQ%d for ARM PMU counters\n", irq); return err; } on_each_cpu(cpu_pmu_enable_percpu_irq, &irq, 1); } else { for (i = 0; i < irqs; ++i) { err = 0; irq = platform_get_irq(pmu_device, i); if (irq < 0) continue; /* * If we have a single PMU interrupt that we can't shift, * assume that we're running on a uniprocessor machine and * continue. Otherwise, continue without this interrupt. */ if (irq_set_affinity(irq, cpumask_of(i)) && irqs > 1) { pr_warn("unable to set irq affinity (irq=%d, cpu=%u)\n", irq, i); continue; } err = request_irq(irq, handler, IRQF_NOBALANCING | IRQF_NO_THREAD, "arm-pmu", per_cpu_ptr(&hw_events->percpu_pmu, i)); if (err) { pr_err("unable to request IRQ%d for ARM PMU counters\n", irq); return err; } cpumask_set_cpu(i, &cpu_pmu->active_irqs); } } return 0; }
/* * Handle an unaligned access * Returns 0 if successfully handled, 1 if some error happened */ int misaligned_fixup(unsigned long address, struct pt_regs *regs, struct callee_regs *cregs) { struct disasm_state state; char buf[TASK_COMM_LEN]; /* handle user mode only and only if enabled by sysadmin */ if (!user_mode(regs) || !unaligned_enabled) return 1; if (no_unaligned_warning) { pr_warn_once("%s(%d) made unaligned access which was emulated" " by kernel assist\n. This can degrade application" " performance significantly\n. To enable further" " logging of such instances, please \n" " echo 0 > /proc/sys/kernel/ignore-unaligned-usertrap\n", get_task_comm(buf, current), task_pid_nr(current)); } else { /* Add rate limiting if it gets down to it */ pr_warn("%s(%d): unaligned access to/from 0x%lx by PC: 0x%lx\n", get_task_comm(buf, current), task_pid_nr(current), address, regs->ret); } disasm_instr(regs->ret, &state, 1, regs, cregs); if (state.fault) goto fault; /* ldb/stb should not have unaligned exception */ if ((state.zz == 1) || (state.di)) goto fault; if (!state.write) fixup_load(&state, regs, cregs); else fixup_store(&state, regs, cregs); if (state.fault) goto fault; if (delay_mode(regs)) { regs->ret = regs->bta; regs->status32 &= ~STATUS_DE_MASK; } else { regs->ret += state.instr_len; } return 0; fault: pr_err("Alignment trap: fault in fix-up %08lx at [<%08lx>]\n", state.words[0], address); return 1; }
static int proc_sctp_do_alpha_beta(struct ctl_table *ctl, int write, void __user *buffer, size_t *lenp, loff_t *ppos) { pr_warn_once("Changing rto_alpha or rto_beta may lead to " "suboptimal rtt/srtt estimations!\n"); return proc_dointvec_minmax(ctl, write, buffer, lenp, ppos); }
/* Use following macros for conversions between pstate_id and index */ static inline int idx_to_pstate(unsigned int i) { if (unlikely(i >= powernv_pstate_info.nr_pstates)) { pr_warn_once("index %u is out of bound\n", i); return powernv_freqs[powernv_pstate_info.nominal].driver_data; } return powernv_freqs[i].driver_data; }
long ion_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) { int ret = 0; unsigned int dir; union ion_ioctl_arg data; dir = ion_ioctl_dir(cmd); if (_IOC_SIZE(cmd) > sizeof(data)) return -EINVAL; /* * The copy_from_user is unconditional here for both read and write * to do the validate. If there is no write for the ioctl, the * buffer is cleared */ if (copy_from_user(&data, (void __user *)arg, _IOC_SIZE(cmd))) return -EFAULT; ret = validate_ioctl_arg(cmd, &data); if (ret) { pr_warn_once("%s: ioctl validate failed\n", __func__); return ret; } if (!(dir & _IOC_WRITE)) memset(&data, 0, sizeof(data)); switch (cmd) { case ION_IOC_ALLOC: { int fd; fd = ion_alloc(data.allocation.len, data.allocation.heap_id_mask, data.allocation.flags); if (fd < 0) return fd; data.allocation.fd = fd; break; } case ION_IOC_HEAP_QUERY: ret = ion_query_heaps(&data.query); break; default: return -ENOTTY; } if (dir & _IOC_READ) { if (copy_to_user((void __user *)arg, &data, _IOC_SIZE(cmd))) return -EFAULT; } return ret; }
static void tick_device_setup_broadcast_func(struct clock_event_device *dev) { if (!dev->broadcast) dev->broadcast = tick_broadcast; if (!dev->broadcast) { pr_warn_once("%s depends on broadcast, but no broadcast function available\n", dev->name); dev->broadcast = err_broadcast; } }
/** * numa_set_distance - Set NUMA distance from one NUMA to another * @from: the 'from' node to set distance * @to: the 'to' node to set distance * @distance: NUMA distance * * Set the distance from node @from to @to to @distance. If distance table * doesn't exist, one which is large enough to accommodate all the currently * known nodes will be created. * * If such table cannot be allocated, a warning is printed and further * calls are ignored until the distance table is reset with * numa_reset_distance(). * * If @from or @to is higher than the highest known node or lower than zero * at the time of table creation or @distance doesn't make sense, the call * is ignored. * This is to allow simplification of specific NUMA config implementations. */ void __init numa_set_distance(int from, int to, int distance) { if (!numa_distance && numa_alloc_distance() < 0) return; if (from >= numa_distance_cnt || to >= numa_distance_cnt || from < 0 || to < 0) { pr_warn_once("NUMA: Warning: node ids are out of bound, from=%d to=%d distance=%d\n", from, to, distance); return; } if ((u8)distance != distance || (from == to && distance != LOCAL_DISTANCE)) { pr_warn_once("NUMA: Warning: invalid distance parameter, from=%d to=%d distance=%d\n", from, to, distance); return; } numa_distance[from * numa_distance_cnt + to] = distance; }
/** * zynqmp_pll_is_enabled - Check if a clock is enabled * @hw: Handle between common and hardware-specific interfaces * * Return: 1 if the clock is enabled, 0 otherwise */ static int zynqmp_pll_is_enabled(struct clk_hw *hw) { u32 reg; struct zynqmp_pll *clk = to_zynqmp_pll(hw); int ret; ret = zynqmp_pm_mmio_read((u32)(ulong)clk->pll_ctrl, ®); if (ret) pr_warn_once("Read fail pll address: %x\n", (u32)(ulong)clk->pll_ctrl); return !(reg & (PLLCTRL_RESET_MASK)); }
static void link_peers_report(struct usb_port *left, struct usb_port *right) { int rc; rc = link_peers(left, right); if (rc == 0) { dev_dbg(&left->dev, "peered to %s\n", dev_name(&right->dev)); } else { dev_warn(&left->dev, "failed to peer to %s (%d)\n", dev_name(&right->dev), rc); pr_warn_once("usb: port power management may be unreliable\n"); } }
static inline unsigned int pstate_to_idx(int pstate) { int min = powernv_freqs[powernv_pstate_info.min].driver_data; int max = powernv_freqs[powernv_pstate_info.max].driver_data; if (min > 0) { if (unlikely((pstate < max) || (pstate > min))) { pr_warn_once("pstate %d is out of bound\n", pstate); return powernv_pstate_info.nominal; } } else { if (unlikely((pstate > max) || (pstate < min))) { pr_warn_once("pstate %d is out of bound\n", pstate); return powernv_pstate_info.nominal; } } /* * abs() is deliberately used so that is works with * both monotonically increasing and decreasing * pstate values */ return abs(pstate - idx_to_pstate(powernv_pstate_info.max)); }
static inline enum pll_mode pll_frac_get_mode(struct clk_hw *hw) { struct zynqmp_pll *clk = to_zynqmp_pll(hw); u32 reg; int ret; ret = zynqmp_pm_mmio_read((u32)(ulong)(clk->pll_ctrl + FRAC_OFFSET), ®); if (ret) pr_warn_once("Read fail pll address: %x\n", (u32)(ulong)(clk->pll_ctrl + FRAC_OFFSET)); reg = reg & PLLFCFG_FRAC_EN; return reg ? PLL_MODE_FRAC : PLL_MODE_INT; }
static int add_active_thread(struct quadd_cpu_context *cpu_ctx, pid_t pid, pid_t tgid) { struct quadd_thread_data *t_data = &cpu_ctx->active_thread; if (t_data->pid > 0 || atomic_read(&cpu_ctx->nr_active) > 0) { pr_warn_once("Warning for thread: %d\n", (int)pid); return 0; } t_data->pid = pid; t_data->tgid = tgid; return 1; }
/** * pll_frac_set_mode - Set the fractional mode * @hw: Handle between common and hardware-specific interfaces * @on: Flag to determine the mode */ static inline void pll_frac_set_mode(struct clk_hw *hw, bool on) { struct zynqmp_pll *clk = to_zynqmp_pll(hw); u32 reg = 0; int ret; if (on) reg = PLLFCFG_FRAC_EN; ret = zynqmp_pm_mmio_write((u32)(ulong)(clk->pll_ctrl + FRAC_OFFSET), PLLFCFG_FRAC_EN, reg); if (ret) pr_warn_once("Write fail pll address: %x\n", (u32)(ulong)(clk->pll_ctrl + FRAC_OFFSET)); }
static int remove_active_thread(struct quadd_cpu_context *cpu_ctx, pid_t pid) { struct quadd_thread_data *t_data = &cpu_ctx->active_thread; if (t_data->pid < 0) return 0; if (t_data->pid == pid) { t_data->pid = -1; t_data->tgid = -1; return 1; } pr_warn_once("Warning for thread: %d\n", (int)pid); return 0; }
static bool valid_xsave_frame(CoreEntry *core) { struct xsave_struct *x = NULL; if (core->thread_info->fpregs->n_st_space < ARRAY_SIZE(x->i387.st_space)) { pr_err("Corruption in FPU st_space area " "(got %li but %li expected)\n", (long)core->thread_info->fpregs->n_st_space, (long)ARRAY_SIZE(x->i387.st_space)); return false; } if (core->thread_info->fpregs->n_xmm_space < ARRAY_SIZE(x->i387.xmm_space)) { pr_err("Corruption in FPU xmm_space area " "(got %li but %li expected)\n", (long)core->thread_info->fpregs->n_st_space, (long)ARRAY_SIZE(x->i387.xmm_space)); return false; } if (cpu_has_feature(X86_FEATURE_XSAVE)) { if (core->thread_info->fpregs->xsave && core->thread_info->fpregs->xsave->n_ymmh_space < ARRAY_SIZE(x->ymmh.ymmh_space)) { pr_err("Corruption in FPU ymmh_space area " "(got %li but %li expected)\n", (long)core->thread_info->fpregs->xsave->n_ymmh_space, (long)ARRAY_SIZE(x->ymmh.ymmh_space)); return false; } } else { /* * If the image has xsave area present then CPU we're restoring * on must have X86_FEATURE_XSAVE feature until explicitly * stated in options. */ if (core->thread_info->fpregs->xsave) { if (opts.cpu_cap & CPU_CAP_FPU) { pr_err("FPU xsave area present, " "but host cpu doesn't support it\n"); return false; } else pr_warn_once("FPU is about to restore ignoring ymm state!\n"); } } return true; }
/* * zynqmp_clk_gate_disable - Disable clock * @hw: handle between common and hardware-specific interfaces */ static void zynqmp_clk_gate_disable(struct clk_hw *hw) { struct zynqmp_clk_gate *gate = to_zynqmp_clk_gate(hw); const char *clk_name = clk_hw_get_name(hw); u32 clk_id = gate->clk_id; int ret = 0; const struct zynqmp_eemi_ops *eemi_ops = zynqmp_pm_get_eemi_ops(); if (!eemi_ops || !eemi_ops->clock_disable) return; ret = eemi_ops->clock_disable(clk_id); if (ret) pr_warn_once("%s() clock disable failed for %s, ret = %d\n", __func__, clk_name, ret); }
void select_idle_routine(const struct cpuinfo_x86 *c) { #ifdef CONFIG_SMP if (boot_option_idle_override == IDLE_POLL && smp_num_siblings > 1) pr_warn_once("WARNING: polling idle and HT enabled, performance may degrade\n"); #endif if (x86_idle || boot_option_idle_override == IDLE_POLL) return; if (boot_cpu_has_bug(X86_BUG_AMD_E400)) { pr_info("using AMD E400 aware idle routine\n"); x86_idle = amd_e400_idle; } else if (prefer_mwait_c1_over_halt(c)) { pr_info("using mwait in idle threads\n"); x86_idle = mwait_idle; } else x86_idle = default_idle; }
/** * zynqmp_clk_gate_is_enable - Check clock state * @hw: handle between common and hardware-specific interfaces * * Return: 1 if enabled, 0 if disabled */ static int zynqmp_clk_gate_is_enabled(struct clk_hw *hw) { struct zynqmp_clk_gate *gate = to_zynqmp_clk_gate(hw); const char *clk_name = clk_hw_get_name(hw); u32 clk_id = gate->clk_id; int state, ret; const struct zynqmp_eemi_ops *eemi_ops = zynqmp_pm_get_eemi_ops(); if (!eemi_ops || !eemi_ops->clock_getstate) return 0; ret = eemi_ops->clock_getstate(clk_id, &state); if (ret) pr_warn_once("%s() clock get state failed for %s, ret = %d\n", __func__, clk_name, ret); return state ? 1 : 0; }
static int zynqmp_clk_gate_is_enabled(struct clk_hw *hw) { u32 reg; int ret; struct clk_gate *gate = to_clk_gate(hw); ret = zynqmp_pm_mmio_read((u32)(ulong)gate->reg, ®); if (ret) pr_warn_once("Read failed gate address: %x\n", (u32)(ulong)gate->reg); /* if a set bit disables this clk, flip it before masking */ if (gate->flags & CLK_GATE_SET_TO_DISABLE) reg ^= BIT(gate->bit_idx); reg &= BIT(gate->bit_idx); return reg ? 1 : 0; }
int pdflush_proc_obsolete(struct ctl_table *table, int write, void __user *buffer, size_t *lenp, loff_t *ppos) { char kbuf[] = "0\n"; if (*ppos || *lenp < sizeof(kbuf)) { *lenp = 0; return 0; } if (copy_to_user(buffer, kbuf, sizeof(kbuf))) return -EFAULT; pr_warn_once("%s exported in /proc is scheduled for removal\n", table->procname); *lenp = 2; *ppos += *lenp; return 2; }
/* * programmable_fetch_get_num_lines: * Number of fetch lines in vertical front porch * @timing: Pointer to the intf timing information for the requested mode * * Returns the number of fetch lines in vertical front porch at which mdp * can start fetching the next frame. * * Number of needed prefetch lines is anything that cannot be absorbed in the * start of frame time (back porch + vsync pulse width). * * Some panels have very large VFP, however we only need a total number of * lines based on the chip worst case latencies. */ static u32 programmable_fetch_get_num_lines( struct dpu_encoder_phys_vid *vid_enc, const struct intf_timing_params *timing) { u32 worst_case_needed_lines = vid_enc->hw_intf->cap->prog_fetch_lines_worst_case; u32 start_of_frame_lines = timing->v_back_porch + timing->vsync_pulse_width; u32 needed_vfp_lines = worst_case_needed_lines - start_of_frame_lines; u32 actual_vfp_lines = 0; /* Fetch must be outside active lines, otherwise undefined. */ if (start_of_frame_lines >= worst_case_needed_lines) { DPU_DEBUG_VIDENC(vid_enc, "prog fetch is not needed, large vbp+vsw\n"); actual_vfp_lines = 0; } else if (timing->v_front_porch < needed_vfp_lines) { /* Warn fetch needed, but not enough porch in panel config */ pr_warn_once ("low vbp+vfp may lead to perf issues in some cases\n"); DPU_DEBUG_VIDENC(vid_enc, "less vfp than fetch req, using entire vfp\n"); actual_vfp_lines = timing->v_front_porch; } else { DPU_DEBUG_VIDENC(vid_enc, "room in vfp for needed prefetch\n"); actual_vfp_lines = needed_vfp_lines; } DPU_DEBUG_VIDENC(vid_enc, "v_front_porch %u v_back_porch %u vsync_pulse_width %u\n", timing->v_front_porch, timing->v_back_porch, timing->vsync_pulse_width); DPU_DEBUG_VIDENC(vid_enc, "wc_lines %u needed_vfp_lines %u actual_vfp_lines %u\n", worst_case_needed_lines, needed_vfp_lines, actual_vfp_lines); return actual_vfp_lines; }
static void * __meminit altmap_alloc_block_buf(unsigned long size, struct vmem_altmap *altmap) { unsigned long pfn, nr_pfns; void *ptr; if (size & ~PAGE_MASK) { pr_warn_once("%s: allocations must be multiple of PAGE_SIZE (%ld)\n", __func__, size); return NULL; } nr_pfns = size >> PAGE_SHIFT; pfn = vmem_altmap_alloc(altmap, nr_pfns); if (pfn < ULONG_MAX) ptr = __va(__pfn_to_phys(pfn)); else ptr = NULL; pr_debug("%s: pfn: %#lx alloc: %ld align: %ld nr: %#lx\n", __func__, pfn, altmap->alloc, altmap->align, nr_pfns); return ptr; }
static void intel_epb_restore(void) { u64 val = this_cpu_read(saved_epb); u64 epb; rdmsrl(MSR_IA32_ENERGY_PERF_BIAS, epb); if (val) { val &= EPB_MASK; } else { /* * Because intel_epb_save() has not run for the current CPU yet, * it is going online for the first time, so if its EPB value is * 0 ('performance') at this point, assume that it has not been * initialized by the platform firmware and set it to 6 * ('normal'). */ val = epb & EPB_MASK; if (val == ENERGY_PERF_BIAS_PERFORMANCE) { val = ENERGY_PERF_BIAS_NORMAL; pr_warn_once("ENERGY_PERF_BIAS: Set to 'normal', was 'performance'\n"); } } wrmsrl(MSR_IA32_ENERGY_PERF_BIAS, (epb & ~EPB_MASK) | val); }
static void acpi_pptt_warn_missing(void) { pr_warn_once("No PPTT table found, CPU and cache topology may be inaccurate\n"); }