Merge branch 'perf/urgent' into perf/core, to pick up fixes
Signed-off-by: Ingo Molnar <mingo@kernel.org>
This commit is contained in:
@@ -56,6 +56,8 @@ static inline acpi_handle acpi_device_handle(struct acpi_device *adev)
|
||||
#define ACPI_COMPANION_SET(dev, adev) set_primary_fwnode(dev, (adev) ? \
|
||||
acpi_fwnode_handle(adev) : NULL)
|
||||
#define ACPI_HANDLE(dev) acpi_device_handle(ACPI_COMPANION(dev))
|
||||
#define ACPI_HANDLE_FWNODE(fwnode) \
|
||||
acpi_device_handle(to_acpi_device_node(fwnode))
|
||||
|
||||
static inline struct fwnode_handle *acpi_alloc_fwnode_static(void)
|
||||
{
|
||||
@@ -585,6 +587,7 @@ extern int acpi_nvs_for_each_region(int (*func)(__u64, __u64, void *),
|
||||
const struct acpi_device_id *acpi_match_device(const struct acpi_device_id *ids,
|
||||
const struct device *dev);
|
||||
|
||||
void *acpi_get_match_data(const struct device *dev);
|
||||
extern bool acpi_driver_match_device(struct device *dev,
|
||||
const struct device_driver *drv);
|
||||
int acpi_device_uevent_modalias(struct device *, struct kobj_uevent_env *);
|
||||
@@ -627,6 +630,7 @@ int acpi_arch_timer_mem_init(struct arch_timer_mem *timer_mem, int *timer_count)
|
||||
#define ACPI_COMPANION(dev) (NULL)
|
||||
#define ACPI_COMPANION_SET(dev, adev) do { } while (0)
|
||||
#define ACPI_HANDLE(dev) (NULL)
|
||||
#define ACPI_HANDLE_FWNODE(fwnode) (NULL)
|
||||
#define ACPI_DEVICE_CLASS(_cls, _msk) .cls = (0), .cls_msk = (0),
|
||||
|
||||
struct fwnode_handle;
|
||||
@@ -762,6 +766,11 @@ static inline const struct acpi_device_id *acpi_match_device(
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static inline void *acpi_get_match_data(const struct device *dev)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static inline bool acpi_driver_match_device(struct device *dev,
|
||||
const struct device_driver *drv)
|
||||
{
|
||||
@@ -985,6 +994,11 @@ struct acpi_gpio_mapping {
|
||||
const char *name;
|
||||
const struct acpi_gpio_params *data;
|
||||
unsigned int size;
|
||||
|
||||
/* Ignore IoRestriction field */
|
||||
#define ACPI_GPIO_QUIRK_NO_IO_RESTRICTION BIT(0)
|
||||
|
||||
unsigned int quirks;
|
||||
};
|
||||
|
||||
#if defined(CONFIG_ACPI) && defined(CONFIG_GPIOLIB)
|
||||
@@ -1249,9 +1263,12 @@ static inline bool acpi_has_watchdog(void) { return false; }
|
||||
|
||||
#ifdef CONFIG_ACPI_SPCR_TABLE
|
||||
extern bool qdf2400_e44_present;
|
||||
int parse_spcr(bool earlycon);
|
||||
int acpi_parse_spcr(bool enable_earlycon, bool enable_console);
|
||||
#else
|
||||
static inline int parse_spcr(bool earlycon) { return 0; }
|
||||
static inline int acpi_parse_spcr(bool enable_earlycon, bool enable_console)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if IS_ENABLED(CONFIG_ACPI_GENERIC_GSI)
|
||||
|
@@ -14,14 +14,16 @@
|
||||
#ifndef __LINUX_ARM_SMCCC_H
|
||||
#define __LINUX_ARM_SMCCC_H
|
||||
|
||||
#include <uapi/linux/const.h>
|
||||
|
||||
/*
|
||||
* This file provides common defines for ARM SMC Calling Convention as
|
||||
* specified in
|
||||
* http://infocenter.arm.com/help/topic/com.arm.doc.den0028a/index.html
|
||||
*/
|
||||
|
||||
#define ARM_SMCCC_STD_CALL 0
|
||||
#define ARM_SMCCC_FAST_CALL 1
|
||||
#define ARM_SMCCC_STD_CALL _AC(0,U)
|
||||
#define ARM_SMCCC_FAST_CALL _AC(1,U)
|
||||
#define ARM_SMCCC_TYPE_SHIFT 31
|
||||
|
||||
#define ARM_SMCCC_SMC_32 0
|
||||
@@ -60,6 +62,24 @@
|
||||
#define ARM_SMCCC_QUIRK_NONE 0
|
||||
#define ARM_SMCCC_QUIRK_QCOM_A6 1 /* Save/restore register a6 */
|
||||
|
||||
#define ARM_SMCCC_VERSION_1_0 0x10000
|
||||
#define ARM_SMCCC_VERSION_1_1 0x10001
|
||||
|
||||
#define ARM_SMCCC_VERSION_FUNC_ID \
|
||||
ARM_SMCCC_CALL_VAL(ARM_SMCCC_FAST_CALL, \
|
||||
ARM_SMCCC_SMC_32, \
|
||||
0, 0)
|
||||
|
||||
#define ARM_SMCCC_ARCH_FEATURES_FUNC_ID \
|
||||
ARM_SMCCC_CALL_VAL(ARM_SMCCC_FAST_CALL, \
|
||||
ARM_SMCCC_SMC_32, \
|
||||
0, 1)
|
||||
|
||||
#define ARM_SMCCC_ARCH_WORKAROUND_1 \
|
||||
ARM_SMCCC_CALL_VAL(ARM_SMCCC_FAST_CALL, \
|
||||
ARM_SMCCC_SMC_32, \
|
||||
0, 0x8000)
|
||||
|
||||
#ifndef __ASSEMBLY__
|
||||
|
||||
#include <linux/linkage.h>
|
||||
@@ -130,5 +150,146 @@ asmlinkage void __arm_smccc_hvc(unsigned long a0, unsigned long a1,
|
||||
|
||||
#define arm_smccc_hvc_quirk(...) __arm_smccc_hvc(__VA_ARGS__)
|
||||
|
||||
/* SMCCC v1.1 implementation madness follows */
|
||||
#ifdef CONFIG_ARM64
|
||||
|
||||
#define SMCCC_SMC_INST "smc #0"
|
||||
#define SMCCC_HVC_INST "hvc #0"
|
||||
|
||||
#elif defined(CONFIG_ARM)
|
||||
#include <asm/opcodes-sec.h>
|
||||
#include <asm/opcodes-virt.h>
|
||||
|
||||
#define SMCCC_SMC_INST __SMC(0)
|
||||
#define SMCCC_HVC_INST __HVC(0)
|
||||
|
||||
#endif
|
||||
|
||||
#define ___count_args(_0, _1, _2, _3, _4, _5, _6, _7, _8, x, ...) x
|
||||
|
||||
#define __count_args(...) \
|
||||
___count_args(__VA_ARGS__, 7, 6, 5, 4, 3, 2, 1, 0)
|
||||
|
||||
#define __constraint_write_0 \
|
||||
"+r" (r0), "=&r" (r1), "=&r" (r2), "=&r" (r3)
|
||||
#define __constraint_write_1 \
|
||||
"+r" (r0), "+r" (r1), "=&r" (r2), "=&r" (r3)
|
||||
#define __constraint_write_2 \
|
||||
"+r" (r0), "+r" (r1), "+r" (r2), "=&r" (r3)
|
||||
#define __constraint_write_3 \
|
||||
"+r" (r0), "+r" (r1), "+r" (r2), "+r" (r3)
|
||||
#define __constraint_write_4 __constraint_write_3
|
||||
#define __constraint_write_5 __constraint_write_4
|
||||
#define __constraint_write_6 __constraint_write_5
|
||||
#define __constraint_write_7 __constraint_write_6
|
||||
|
||||
#define __constraint_read_0
|
||||
#define __constraint_read_1
|
||||
#define __constraint_read_2
|
||||
#define __constraint_read_3
|
||||
#define __constraint_read_4 "r" (r4)
|
||||
#define __constraint_read_5 __constraint_read_4, "r" (r5)
|
||||
#define __constraint_read_6 __constraint_read_5, "r" (r6)
|
||||
#define __constraint_read_7 __constraint_read_6, "r" (r7)
|
||||
|
||||
#define __declare_arg_0(a0, res) \
|
||||
struct arm_smccc_res *___res = res; \
|
||||
register u32 r0 asm("r0") = a0; \
|
||||
register unsigned long r1 asm("r1"); \
|
||||
register unsigned long r2 asm("r2"); \
|
||||
register unsigned long r3 asm("r3")
|
||||
|
||||
#define __declare_arg_1(a0, a1, res) \
|
||||
struct arm_smccc_res *___res = res; \
|
||||
register u32 r0 asm("r0") = a0; \
|
||||
register typeof(a1) r1 asm("r1") = a1; \
|
||||
register unsigned long r2 asm("r2"); \
|
||||
register unsigned long r3 asm("r3")
|
||||
|
||||
#define __declare_arg_2(a0, a1, a2, res) \
|
||||
struct arm_smccc_res *___res = res; \
|
||||
register u32 r0 asm("r0") = a0; \
|
||||
register typeof(a1) r1 asm("r1") = a1; \
|
||||
register typeof(a2) r2 asm("r2") = a2; \
|
||||
register unsigned long r3 asm("r3")
|
||||
|
||||
#define __declare_arg_3(a0, a1, a2, a3, res) \
|
||||
struct arm_smccc_res *___res = res; \
|
||||
register u32 r0 asm("r0") = a0; \
|
||||
register typeof(a1) r1 asm("r1") = a1; \
|
||||
register typeof(a2) r2 asm("r2") = a2; \
|
||||
register typeof(a3) r3 asm("r3") = a3
|
||||
|
||||
#define __declare_arg_4(a0, a1, a2, a3, a4, res) \
|
||||
__declare_arg_3(a0, a1, a2, a3, res); \
|
||||
register typeof(a4) r4 asm("r4") = a4
|
||||
|
||||
#define __declare_arg_5(a0, a1, a2, a3, a4, a5, res) \
|
||||
__declare_arg_4(a0, a1, a2, a3, a4, res); \
|
||||
register typeof(a5) r5 asm("r5") = a5
|
||||
|
||||
#define __declare_arg_6(a0, a1, a2, a3, a4, a5, a6, res) \
|
||||
__declare_arg_5(a0, a1, a2, a3, a4, a5, res); \
|
||||
register typeof(a6) r6 asm("r6") = a6
|
||||
|
||||
#define __declare_arg_7(a0, a1, a2, a3, a4, a5, a6, a7, res) \
|
||||
__declare_arg_6(a0, a1, a2, a3, a4, a5, a6, res); \
|
||||
register typeof(a7) r7 asm("r7") = a7
|
||||
|
||||
#define ___declare_args(count, ...) __declare_arg_ ## count(__VA_ARGS__)
|
||||
#define __declare_args(count, ...) ___declare_args(count, __VA_ARGS__)
|
||||
|
||||
#define ___constraints(count) \
|
||||
: __constraint_write_ ## count \
|
||||
: __constraint_read_ ## count \
|
||||
: "memory"
|
||||
#define __constraints(count) ___constraints(count)
|
||||
|
||||
/*
|
||||
* We have an output list that is not necessarily used, and GCC feels
|
||||
* entitled to optimise the whole sequence away. "volatile" is what
|
||||
* makes it stick.
|
||||
*/
|
||||
#define __arm_smccc_1_1(inst, ...) \
|
||||
do { \
|
||||
__declare_args(__count_args(__VA_ARGS__), __VA_ARGS__); \
|
||||
asm volatile(inst "\n" \
|
||||
__constraints(__count_args(__VA_ARGS__))); \
|
||||
if (___res) \
|
||||
*___res = (typeof(*___res)){r0, r1, r2, r3}; \
|
||||
} while (0)
|
||||
|
||||
/*
|
||||
* arm_smccc_1_1_smc() - make an SMCCC v1.1 compliant SMC call
|
||||
*
|
||||
* This is a variadic macro taking one to eight source arguments, and
|
||||
* an optional return structure.
|
||||
*
|
||||
* @a0-a7: arguments passed in registers 0 to 7
|
||||
* @res: result values from registers 0 to 3
|
||||
*
|
||||
* This macro is used to make SMC calls following SMC Calling Convention v1.1.
|
||||
* The content of the supplied param are copied to registers 0 to 7 prior
|
||||
* to the SMC instruction. The return values are updated with the content
|
||||
* from register 0 to 3 on return from the SMC instruction if not NULL.
|
||||
*/
|
||||
#define arm_smccc_1_1_smc(...) __arm_smccc_1_1(SMCCC_SMC_INST, __VA_ARGS__)
|
||||
|
||||
/*
|
||||
* arm_smccc_1_1_hvc() - make an SMCCC v1.1 compliant HVC call
|
||||
*
|
||||
* This is a variadic macro taking one to eight source arguments, and
|
||||
* an optional return structure.
|
||||
*
|
||||
* @a0-a7: arguments passed in registers 0 to 7
|
||||
* @res: result values from registers 0 to 3
|
||||
*
|
||||
* This macro is used to make HVC calls following SMC Calling Convention v1.1.
|
||||
* The content of the supplied param are copied to registers 0 to 7 prior
|
||||
* to the HVC instruction. The return values are updated with the content
|
||||
* from register 0 to 3 on return from the HVC instruction if not NULL.
|
||||
*/
|
||||
#define arm_smccc_1_1_hvc(...) __arm_smccc_1_1(SMCCC_HVC_INST, __VA_ARGS__)
|
||||
|
||||
#endif /*__ASSEMBLY__*/
|
||||
#endif /*__LINUX_ARM_SMCCC_H*/
|
||||
|
79
include/linux/arm_sdei.h
Normal file
79
include/linux/arm_sdei.h
Normal file
@@ -0,0 +1,79 @@
|
||||
// SPDX-License-Identifier: GPL-2.0
|
||||
// Copyright (C) 2017 Arm Ltd.
|
||||
#ifndef __LINUX_ARM_SDEI_H
|
||||
#define __LINUX_ARM_SDEI_H
|
||||
|
||||
#include <uapi/linux/arm_sdei.h>
|
||||
|
||||
enum sdei_conduit_types {
|
||||
CONDUIT_INVALID = 0,
|
||||
CONDUIT_SMC,
|
||||
CONDUIT_HVC,
|
||||
};
|
||||
|
||||
#include <asm/sdei.h>
|
||||
|
||||
/* Arch code should override this to set the entry point from firmware... */
|
||||
#ifndef sdei_arch_get_entry_point
|
||||
#define sdei_arch_get_entry_point(conduit) (0)
|
||||
#endif
|
||||
|
||||
/*
|
||||
* When an event occurs sdei_event_handler() will call a user-provided callback
|
||||
* like this in NMI context on the CPU that received the event.
|
||||
*/
|
||||
typedef int (sdei_event_callback)(u32 event, struct pt_regs *regs, void *arg);
|
||||
|
||||
/*
|
||||
* Register your callback to claim an event. The event must be described
|
||||
* by firmware.
|
||||
*/
|
||||
int sdei_event_register(u32 event_num, sdei_event_callback *cb, void *arg);
|
||||
|
||||
/*
|
||||
* Calls to sdei_event_unregister() may return EINPROGRESS. Keep calling
|
||||
* it until it succeeds.
|
||||
*/
|
||||
int sdei_event_unregister(u32 event_num);
|
||||
|
||||
int sdei_event_enable(u32 event_num);
|
||||
int sdei_event_disable(u32 event_num);
|
||||
|
||||
#ifdef CONFIG_ARM_SDE_INTERFACE
|
||||
/* For use by arch code when CPU hotplug notifiers are not appropriate. */
|
||||
int sdei_mask_local_cpu(void);
|
||||
int sdei_unmask_local_cpu(void);
|
||||
#else
|
||||
static inline int sdei_mask_local_cpu(void) { return 0; }
|
||||
static inline int sdei_unmask_local_cpu(void) { return 0; }
|
||||
#endif /* CONFIG_ARM_SDE_INTERFACE */
|
||||
|
||||
|
||||
/*
|
||||
* This struct represents an event that has been registered. The driver
|
||||
* maintains a list of all events, and which ones are registered. (Private
|
||||
* events have one entry in the list, but are registered on each CPU).
|
||||
* A pointer to this struct is passed to firmware, and back to the event
|
||||
* handler. The event handler can then use this to invoke the registered
|
||||
* callback, without having to walk the list.
|
||||
*
|
||||
* For CPU private events, this structure is per-cpu.
|
||||
*/
|
||||
struct sdei_registered_event {
|
||||
/* For use by arch code: */
|
||||
struct pt_regs interrupted_regs;
|
||||
|
||||
sdei_event_callback *callback;
|
||||
void *callback_arg;
|
||||
u32 event_num;
|
||||
u8 priority;
|
||||
};
|
||||
|
||||
/* The arch code entry point should then call this when an event arrives. */
|
||||
int notrace sdei_event_handler(struct pt_regs *regs,
|
||||
struct sdei_registered_event *arg);
|
||||
|
||||
/* arch code may use this to retrieve the extra registers. */
|
||||
int sdei_api_event_context(u32 query, u64 *result);
|
||||
|
||||
#endif /* __LINUX_ARM_SDEI_H */
|
@@ -448,6 +448,8 @@ enum {
|
||||
ATA_SET_MAX_LOCK = 0x02,
|
||||
ATA_SET_MAX_UNLOCK = 0x03,
|
||||
ATA_SET_MAX_FREEZE_LOCK = 0x04,
|
||||
ATA_SET_MAX_PASSWD_DMA = 0x05,
|
||||
ATA_SET_MAX_UNLOCK_DMA = 0x06,
|
||||
|
||||
/* feature values for DEVICE CONFIGURATION OVERLAY */
|
||||
ATA_DCO_RESTORE = 0xC0,
|
||||
|
@@ -16,6 +16,7 @@
|
||||
#define _LINUX_BITFIELD_H
|
||||
|
||||
#include <linux/build_bug.h>
|
||||
#include <asm/byteorder.h>
|
||||
|
||||
/*
|
||||
* Bitfield access macros
|
||||
@@ -103,4 +104,49 @@
|
||||
(typeof(_mask))(((_reg) & (_mask)) >> __bf_shf(_mask)); \
|
||||
})
|
||||
|
||||
extern void __compiletime_warning("value doesn't fit into mask")
|
||||
__field_overflow(void);
|
||||
extern void __compiletime_error("bad bitfield mask")
|
||||
__bad_mask(void);
|
||||
static __always_inline u64 field_multiplier(u64 field)
|
||||
{
|
||||
if ((field | (field - 1)) & ((field | (field - 1)) + 1))
|
||||
__bad_mask();
|
||||
return field & -field;
|
||||
}
|
||||
static __always_inline u64 field_mask(u64 field)
|
||||
{
|
||||
return field / field_multiplier(field);
|
||||
}
|
||||
#define ____MAKE_OP(type,base,to,from) \
|
||||
static __always_inline __##type type##_encode_bits(base v, base field) \
|
||||
{ \
|
||||
if (__builtin_constant_p(v) && (v & ~field_multiplier(field))) \
|
||||
__field_overflow(); \
|
||||
return to((v & field_mask(field)) * field_multiplier(field)); \
|
||||
} \
|
||||
static __always_inline __##type type##_replace_bits(__##type old, \
|
||||
base val, base field) \
|
||||
{ \
|
||||
return (old & ~to(field)) | type##_encode_bits(val, field); \
|
||||
} \
|
||||
static __always_inline void type##p_replace_bits(__##type *p, \
|
||||
base val, base field) \
|
||||
{ \
|
||||
*p = (*p & ~to(field)) | type##_encode_bits(val, field); \
|
||||
} \
|
||||
static __always_inline base type##_get_bits(__##type v, base field) \
|
||||
{ \
|
||||
return (from(v) & field)/field_multiplier(field); \
|
||||
}
|
||||
#define __MAKE_OP(size) \
|
||||
____MAKE_OP(le##size,u##size,cpu_to_le##size,le##size##_to_cpu) \
|
||||
____MAKE_OP(be##size,u##size,cpu_to_be##size,be##size##_to_cpu) \
|
||||
____MAKE_OP(u##size,u##size,,)
|
||||
__MAKE_OP(16)
|
||||
__MAKE_OP(32)
|
||||
__MAKE_OP(64)
|
||||
#undef __MAKE_OP
|
||||
#undef ____MAKE_OP
|
||||
|
||||
#endif
|
||||
|
@@ -64,9 +64,14 @@
|
||||
* bitmap_find_free_region(bitmap, bits, order) Find and allocate bit region
|
||||
* bitmap_release_region(bitmap, pos, order) Free specified bit region
|
||||
* bitmap_allocate_region(bitmap, pos, order) Allocate specified bit region
|
||||
* bitmap_from_u32array(dst, nbits, buf, nwords) *dst = *buf (nwords 32b words)
|
||||
* bitmap_to_u32array(buf, nwords, src, nbits) *buf = *dst (nwords 32b words)
|
||||
* bitmap_from_arr32(dst, buf, nbits) Copy nbits from u32[] buf to dst
|
||||
* bitmap_to_arr32(buf, src, nbits) Copy nbits from buf to u32[] dst
|
||||
*
|
||||
* Note, bitmap_zero() and bitmap_fill() operate over the region of
|
||||
* unsigned longs, that is, bits behind bitmap till the unsigned long
|
||||
* boundary will be zeroed or filled as well. Consider to use
|
||||
* bitmap_clear() or bitmap_set() to make explicit zeroing or filling
|
||||
* respectively.
|
||||
*/
|
||||
|
||||
/**
|
||||
@@ -83,8 +88,12 @@
|
||||
* test_and_change_bit(bit, addr) Change bit and return old value
|
||||
* find_first_zero_bit(addr, nbits) Position first zero bit in *addr
|
||||
* find_first_bit(addr, nbits) Position first set bit in *addr
|
||||
* find_next_zero_bit(addr, nbits, bit) Position next zero bit in *addr >= bit
|
||||
* find_next_zero_bit(addr, nbits, bit)
|
||||
* Position next zero bit in *addr >= bit
|
||||
* find_next_bit(addr, nbits, bit) Position next set bit in *addr >= bit
|
||||
* find_next_and_bit(addr1, addr2, nbits, bit)
|
||||
* Same as find_next_bit, but in
|
||||
* (*addr1 & *addr2)
|
||||
*
|
||||
*/
|
||||
|
||||
@@ -174,14 +183,7 @@ extern void bitmap_fold(unsigned long *dst, const unsigned long *orig,
|
||||
extern int bitmap_find_free_region(unsigned long *bitmap, unsigned int bits, int order);
|
||||
extern void bitmap_release_region(unsigned long *bitmap, unsigned int pos, int order);
|
||||
extern int bitmap_allocate_region(unsigned long *bitmap, unsigned int pos, int order);
|
||||
extern unsigned int bitmap_from_u32array(unsigned long *bitmap,
|
||||
unsigned int nbits,
|
||||
const u32 *buf,
|
||||
unsigned int nwords);
|
||||
extern unsigned int bitmap_to_u32array(u32 *buf,
|
||||
unsigned int nwords,
|
||||
const unsigned long *bitmap,
|
||||
unsigned int nbits);
|
||||
|
||||
#ifdef __BIG_ENDIAN
|
||||
extern void bitmap_copy_le(unsigned long *dst, const unsigned long *src, unsigned int nbits);
|
||||
#else
|
||||
@@ -209,12 +211,12 @@ static inline void bitmap_zero(unsigned long *dst, unsigned int nbits)
|
||||
|
||||
static inline void bitmap_fill(unsigned long *dst, unsigned int nbits)
|
||||
{
|
||||
unsigned int nlongs = BITS_TO_LONGS(nbits);
|
||||
if (!small_const_nbits(nbits)) {
|
||||
unsigned int len = (nlongs - 1) * sizeof(unsigned long);
|
||||
memset(dst, 0xff, len);
|
||||
if (small_const_nbits(nbits))
|
||||
*dst = ~0UL;
|
||||
else {
|
||||
unsigned int len = BITS_TO_LONGS(nbits) * sizeof(unsigned long);
|
||||
memset(dst, 0xff, len);
|
||||
}
|
||||
dst[nlongs - 1] = BITMAP_LAST_WORD_MASK(nbits);
|
||||
}
|
||||
|
||||
static inline void bitmap_copy(unsigned long *dst, const unsigned long *src,
|
||||
@@ -228,6 +230,35 @@ static inline void bitmap_copy(unsigned long *dst, const unsigned long *src,
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Copy bitmap and clear tail bits in last word.
|
||||
*/
|
||||
static inline void bitmap_copy_clear_tail(unsigned long *dst,
|
||||
const unsigned long *src, unsigned int nbits)
|
||||
{
|
||||
bitmap_copy(dst, src, nbits);
|
||||
if (nbits % BITS_PER_LONG)
|
||||
dst[nbits / BITS_PER_LONG] &= BITMAP_LAST_WORD_MASK(nbits);
|
||||
}
|
||||
|
||||
/*
|
||||
* On 32-bit systems bitmaps are represented as u32 arrays internally, and
|
||||
* therefore conversion is not needed when copying data from/to arrays of u32.
|
||||
*/
|
||||
#if BITS_PER_LONG == 64
|
||||
extern void bitmap_from_arr32(unsigned long *bitmap, const u32 *buf,
|
||||
unsigned int nbits);
|
||||
extern void bitmap_to_arr32(u32 *buf, const unsigned long *bitmap,
|
||||
unsigned int nbits);
|
||||
#else
|
||||
#define bitmap_from_arr32(bitmap, buf, nbits) \
|
||||
bitmap_copy_clear_tail((unsigned long *) (bitmap), \
|
||||
(const unsigned long *) (buf), (nbits))
|
||||
#define bitmap_to_arr32(buf, bitmap, nbits) \
|
||||
bitmap_copy_clear_tail((unsigned long *) (buf), \
|
||||
(const unsigned long *) (bitmap), (nbits))
|
||||
#endif
|
||||
|
||||
static inline int bitmap_and(unsigned long *dst, const unsigned long *src1,
|
||||
const unsigned long *src2, unsigned int nbits)
|
||||
{
|
||||
|
@@ -39,6 +39,24 @@ typedef u8 __bitwise blk_status_t;
|
||||
|
||||
#define BLK_STS_AGAIN ((__force blk_status_t)12)
|
||||
|
||||
/*
|
||||
* BLK_STS_DEV_RESOURCE is returned from the driver to the block layer if
|
||||
* device related resources are unavailable, but the driver can guarantee
|
||||
* that the queue will be rerun in the future once resources become
|
||||
* available again. This is typically the case for device specific
|
||||
* resources that are consumed for IO. If the driver fails allocating these
|
||||
* resources, we know that inflight (or pending) IO will free these
|
||||
* resource upon completion.
|
||||
*
|
||||
* This is different from BLK_STS_RESOURCE in that it explicitly references
|
||||
* a device specific resource. For resources of wider scope, allocation
|
||||
* failure can happen without having pending IO. This means that we can't
|
||||
* rely on request completions freeing these resources, as IO may not be in
|
||||
* flight. Examples of that are kernel memory allocations, DMA mappings, or
|
||||
* any other system wide resources.
|
||||
*/
|
||||
#define BLK_STS_DEV_RESOURCE ((__force blk_status_t)13)
|
||||
|
||||
/**
|
||||
* blk_path_error - returns true if error may be path related
|
||||
* @error: status the request was completed with
|
||||
|
@@ -17,6 +17,7 @@
|
||||
#include <linux/numa.h>
|
||||
#include <linux/wait.h>
|
||||
|
||||
struct bpf_verifier_env;
|
||||
struct perf_event;
|
||||
struct bpf_prog;
|
||||
struct bpf_map;
|
||||
@@ -24,6 +25,7 @@ struct bpf_map;
|
||||
/* map is generic key/value storage optionally accesible by eBPF programs */
|
||||
struct bpf_map_ops {
|
||||
/* funcs callable from userspace (via syscall) */
|
||||
int (*map_alloc_check)(union bpf_attr *attr);
|
||||
struct bpf_map *(*map_alloc)(union bpf_attr *attr);
|
||||
void (*map_release)(struct bpf_map *map, struct file *map_file);
|
||||
void (*map_free)(struct bpf_map *map);
|
||||
@@ -72,6 +74,33 @@ struct bpf_map {
|
||||
char name[BPF_OBJ_NAME_LEN];
|
||||
};
|
||||
|
||||
struct bpf_offloaded_map;
|
||||
|
||||
struct bpf_map_dev_ops {
|
||||
int (*map_get_next_key)(struct bpf_offloaded_map *map,
|
||||
void *key, void *next_key);
|
||||
int (*map_lookup_elem)(struct bpf_offloaded_map *map,
|
||||
void *key, void *value);
|
||||
int (*map_update_elem)(struct bpf_offloaded_map *map,
|
||||
void *key, void *value, u64 flags);
|
||||
int (*map_delete_elem)(struct bpf_offloaded_map *map, void *key);
|
||||
};
|
||||
|
||||
struct bpf_offloaded_map {
|
||||
struct bpf_map map;
|
||||
struct net_device *netdev;
|
||||
const struct bpf_map_dev_ops *dev_ops;
|
||||
void *dev_priv;
|
||||
struct list_head offloads;
|
||||
};
|
||||
|
||||
static inline struct bpf_offloaded_map *map_to_offmap(struct bpf_map *map)
|
||||
{
|
||||
return container_of(map, struct bpf_offloaded_map, map);
|
||||
}
|
||||
|
||||
extern const struct bpf_map_ops bpf_map_offload_ops;
|
||||
|
||||
/* function argument constraints */
|
||||
enum bpf_arg_type {
|
||||
ARG_DONTCARE = 0, /* unused argument in helper function */
|
||||
@@ -193,14 +222,20 @@ struct bpf_verifier_ops {
|
||||
struct bpf_prog *prog, u32 *target_size);
|
||||
};
|
||||
|
||||
struct bpf_dev_offload {
|
||||
struct bpf_prog_offload_ops {
|
||||
int (*insn_hook)(struct bpf_verifier_env *env,
|
||||
int insn_idx, int prev_insn_idx);
|
||||
};
|
||||
|
||||
struct bpf_prog_offload {
|
||||
struct bpf_prog *prog;
|
||||
struct net_device *netdev;
|
||||
void *dev_priv;
|
||||
struct list_head offloads;
|
||||
bool dev_state;
|
||||
bool verifier_running;
|
||||
wait_queue_head_t verifier_done;
|
||||
const struct bpf_prog_offload_ops *dev_ops;
|
||||
void *jited_image;
|
||||
u32 jited_len;
|
||||
};
|
||||
|
||||
struct bpf_prog_aux {
|
||||
@@ -209,6 +244,10 @@ struct bpf_prog_aux {
|
||||
u32 max_ctx_offset;
|
||||
u32 stack_depth;
|
||||
u32 id;
|
||||
u32 func_cnt;
|
||||
bool offload_requested;
|
||||
struct bpf_prog **func;
|
||||
void *jit_data; /* JIT specific data. arch dependent */
|
||||
struct latch_tree_node ksym_tnode;
|
||||
struct list_head ksym_lnode;
|
||||
const struct bpf_prog_ops *ops;
|
||||
@@ -220,7 +259,7 @@ struct bpf_prog_aux {
|
||||
#ifdef CONFIG_SECURITY
|
||||
void *security;
|
||||
#endif
|
||||
struct bpf_dev_offload *offload;
|
||||
struct bpf_prog_offload *offload;
|
||||
union {
|
||||
struct work_struct work;
|
||||
struct rcu_head rcu;
|
||||
@@ -295,6 +334,9 @@ int bpf_prog_array_copy_to_user(struct bpf_prog_array __rcu *progs,
|
||||
|
||||
void bpf_prog_array_delete_safe(struct bpf_prog_array __rcu *progs,
|
||||
struct bpf_prog *old_prog);
|
||||
int bpf_prog_array_copy_info(struct bpf_prog_array __rcu *array,
|
||||
__u32 __user *prog_ids, u32 request_cnt,
|
||||
__u32 __user *prog_cnt);
|
||||
int bpf_prog_array_copy(struct bpf_prog_array __rcu *old_array,
|
||||
struct bpf_prog *exclude_prog,
|
||||
struct bpf_prog *include_prog,
|
||||
@@ -355,6 +397,9 @@ void bpf_prog_put(struct bpf_prog *prog);
|
||||
int __bpf_prog_charge(struct user_struct *user, u32 pages);
|
||||
void __bpf_prog_uncharge(struct user_struct *user, u32 pages);
|
||||
|
||||
void bpf_prog_free_id(struct bpf_prog *prog, bool do_idr_lock);
|
||||
void bpf_map_free_id(struct bpf_map *map, bool do_idr_lock);
|
||||
|
||||
struct bpf_map *bpf_map_get_with_uref(u32 ufd);
|
||||
struct bpf_map *__bpf_map_get(struct fd f);
|
||||
struct bpf_map * __must_check bpf_map_inc(struct bpf_map *map, bool uref);
|
||||
@@ -363,6 +408,7 @@ void bpf_map_put(struct bpf_map *map);
|
||||
int bpf_map_precharge_memlock(u32 pages);
|
||||
void *bpf_map_area_alloc(size_t size, int numa_node);
|
||||
void bpf_map_area_free(void *base);
|
||||
void bpf_map_init_from_attr(struct bpf_map *map, union bpf_attr *attr);
|
||||
|
||||
extern int sysctl_unprivileged_bpf_disabled;
|
||||
|
||||
@@ -409,6 +455,7 @@ static inline void bpf_long_memcpy(void *dst, const void *src, u32 size)
|
||||
|
||||
/* verify correctness of eBPF program */
|
||||
int bpf_check(struct bpf_prog **fp, union bpf_attr *attr);
|
||||
void bpf_patch_call_args(struct bpf_insn *insn, u32 stack_depth);
|
||||
|
||||
/* Map specifics */
|
||||
struct net_device *__dev_map_lookup_elem(struct bpf_map *map, u32 key);
|
||||
@@ -536,14 +583,35 @@ bool bpf_prog_get_ok(struct bpf_prog *, enum bpf_prog_type *, bool);
|
||||
|
||||
int bpf_prog_offload_compile(struct bpf_prog *prog);
|
||||
void bpf_prog_offload_destroy(struct bpf_prog *prog);
|
||||
int bpf_prog_offload_info_fill(struct bpf_prog_info *info,
|
||||
struct bpf_prog *prog);
|
||||
|
||||
int bpf_map_offload_info_fill(struct bpf_map_info *info, struct bpf_map *map);
|
||||
|
||||
int bpf_map_offload_lookup_elem(struct bpf_map *map, void *key, void *value);
|
||||
int bpf_map_offload_update_elem(struct bpf_map *map,
|
||||
void *key, void *value, u64 flags);
|
||||
int bpf_map_offload_delete_elem(struct bpf_map *map, void *key);
|
||||
int bpf_map_offload_get_next_key(struct bpf_map *map,
|
||||
void *key, void *next_key);
|
||||
|
||||
bool bpf_offload_dev_match(struct bpf_prog *prog, struct bpf_map *map);
|
||||
|
||||
#if defined(CONFIG_NET) && defined(CONFIG_BPF_SYSCALL)
|
||||
int bpf_prog_offload_init(struct bpf_prog *prog, union bpf_attr *attr);
|
||||
|
||||
static inline bool bpf_prog_is_dev_bound(struct bpf_prog_aux *aux)
|
||||
{
|
||||
return aux->offload;
|
||||
return aux->offload_requested;
|
||||
}
|
||||
|
||||
static inline bool bpf_map_is_dev_bound(struct bpf_map *map)
|
||||
{
|
||||
return unlikely(map->ops == &bpf_map_offload_ops);
|
||||
}
|
||||
|
||||
struct bpf_map *bpf_map_offload_map_alloc(union bpf_attr *attr);
|
||||
void bpf_map_offload_map_free(struct bpf_map *map);
|
||||
#else
|
||||
static inline int bpf_prog_offload_init(struct bpf_prog *prog,
|
||||
union bpf_attr *attr)
|
||||
@@ -555,9 +623,23 @@ static inline bool bpf_prog_is_dev_bound(struct bpf_prog_aux *aux)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
static inline bool bpf_map_is_dev_bound(struct bpf_map *map)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
static inline struct bpf_map *bpf_map_offload_map_alloc(union bpf_attr *attr)
|
||||
{
|
||||
return ERR_PTR(-EOPNOTSUPP);
|
||||
}
|
||||
|
||||
static inline void bpf_map_offload_map_free(struct bpf_map *map)
|
||||
{
|
||||
}
|
||||
#endif /* CONFIG_NET && CONFIG_BPF_SYSCALL */
|
||||
|
||||
#if defined(CONFIG_STREAM_PARSER) && defined(CONFIG_BPF_SYSCALL)
|
||||
#if defined(CONFIG_STREAM_PARSER) && defined(CONFIG_BPF_SYSCALL) && defined(CONFIG_INET)
|
||||
struct sock *__sock_map_lookup_elem(struct bpf_map *map, u32 key);
|
||||
int sock_map_prog(struct bpf_map *map, struct bpf_prog *prog, u32 type);
|
||||
#else
|
||||
|
@@ -42,7 +42,7 @@ BPF_MAP_TYPE(BPF_MAP_TYPE_ARRAY_OF_MAPS, array_of_maps_map_ops)
|
||||
BPF_MAP_TYPE(BPF_MAP_TYPE_HASH_OF_MAPS, htab_of_maps_map_ops)
|
||||
#ifdef CONFIG_NET
|
||||
BPF_MAP_TYPE(BPF_MAP_TYPE_DEVMAP, dev_map_ops)
|
||||
#ifdef CONFIG_STREAM_PARSER
|
||||
#if defined(CONFIG_STREAM_PARSER) && defined(CONFIG_INET)
|
||||
BPF_MAP_TYPE(BPF_MAP_TYPE_SOCKMAP, sock_map_ops)
|
||||
#endif
|
||||
BPF_MAP_TYPE(BPF_MAP_TYPE_CPUMAP, cpu_map_ops)
|
||||
|
@@ -76,6 +76,14 @@ struct bpf_reg_state {
|
||||
s64 smax_value; /* maximum possible (s64)value */
|
||||
u64 umin_value; /* minimum possible (u64)value */
|
||||
u64 umax_value; /* maximum possible (u64)value */
|
||||
/* Inside the callee two registers can be both PTR_TO_STACK like
|
||||
* R1=fp-8 and R2=fp-8, but one of them points to this function stack
|
||||
* while another to the caller's stack. To differentiate them 'frameno'
|
||||
* is used which is an index in bpf_verifier_state->frame[] array
|
||||
* pointing to bpf_func_state.
|
||||
* This field must be second to last, for states_equal() reasons.
|
||||
*/
|
||||
u32 frameno;
|
||||
/* This field must be last, for states_equal() reasons. */
|
||||
enum bpf_reg_liveness live;
|
||||
};
|
||||
@@ -83,7 +91,8 @@ struct bpf_reg_state {
|
||||
enum bpf_stack_slot_type {
|
||||
STACK_INVALID, /* nothing was stored in this stack slot */
|
||||
STACK_SPILL, /* register spilled into stack */
|
||||
STACK_MISC /* BPF program wrote some data into this slot */
|
||||
STACK_MISC, /* BPF program wrote some data into this slot */
|
||||
STACK_ZERO, /* BPF program wrote constant zero */
|
||||
};
|
||||
|
||||
#define BPF_REG_SIZE 8 /* size of eBPF register in bytes */
|
||||
@@ -96,13 +105,34 @@ struct bpf_stack_state {
|
||||
/* state of the program:
|
||||
* type of all registers and stack info
|
||||
*/
|
||||
struct bpf_verifier_state {
|
||||
struct bpf_func_state {
|
||||
struct bpf_reg_state regs[MAX_BPF_REG];
|
||||
struct bpf_verifier_state *parent;
|
||||
/* index of call instruction that called into this func */
|
||||
int callsite;
|
||||
/* stack frame number of this function state from pov of
|
||||
* enclosing bpf_verifier_state.
|
||||
* 0 = main function, 1 = first callee.
|
||||
*/
|
||||
u32 frameno;
|
||||
/* subprog number == index within subprog_stack_depth
|
||||
* zero == main subprog
|
||||
*/
|
||||
u32 subprogno;
|
||||
|
||||
/* should be second to last. See copy_func_state() */
|
||||
int allocated_stack;
|
||||
struct bpf_stack_state *stack;
|
||||
};
|
||||
|
||||
#define MAX_CALL_FRAMES 8
|
||||
struct bpf_verifier_state {
|
||||
/* call stack tracking */
|
||||
struct bpf_func_state *frame[MAX_CALL_FRAMES];
|
||||
struct bpf_verifier_state *parent;
|
||||
u32 curframe;
|
||||
};
|
||||
|
||||
/* linked list of verifier states used to prune search */
|
||||
struct bpf_verifier_state_list {
|
||||
struct bpf_verifier_state state;
|
||||
@@ -113,6 +143,7 @@ struct bpf_insn_aux_data {
|
||||
union {
|
||||
enum bpf_reg_type ptr_type; /* pointer type for load/store insns */
|
||||
struct bpf_map *map_ptr; /* pointer for call insn into lookup_elem */
|
||||
s32 call_imm; /* saved imm field of call insn */
|
||||
};
|
||||
int ctx_field_size; /* the ctx field size for load insn, maybe 0 */
|
||||
bool seen; /* this insn was processed by the verifier */
|
||||
@@ -135,11 +166,7 @@ static inline bool bpf_verifier_log_full(const struct bpf_verifer_log *log)
|
||||
return log->len_used >= log->len_total - 1;
|
||||
}
|
||||
|
||||
struct bpf_verifier_env;
|
||||
struct bpf_ext_analyzer_ops {
|
||||
int (*insn_hook)(struct bpf_verifier_env *env,
|
||||
int insn_idx, int prev_insn_idx);
|
||||
};
|
||||
#define BPF_MAX_SUBPROGS 256
|
||||
|
||||
/* single container for all structs
|
||||
* one verifier_env per bpf_check() call
|
||||
@@ -152,29 +179,31 @@ struct bpf_verifier_env {
|
||||
bool strict_alignment; /* perform strict pointer alignment checks */
|
||||
struct bpf_verifier_state *cur_state; /* current verifier state */
|
||||
struct bpf_verifier_state_list **explored_states; /* search pruning optimization */
|
||||
const struct bpf_ext_analyzer_ops *dev_ops; /* device analyzer ops */
|
||||
struct bpf_map *used_maps[MAX_USED_MAPS]; /* array of map's used by eBPF program */
|
||||
u32 used_map_cnt; /* number of used maps */
|
||||
u32 id_gen; /* used to generate unique reg IDs */
|
||||
bool allow_ptr_leaks;
|
||||
bool seen_direct_write;
|
||||
struct bpf_insn_aux_data *insn_aux_data; /* array of per-insn state */
|
||||
|
||||
struct bpf_verifer_log log;
|
||||
u32 subprog_starts[BPF_MAX_SUBPROGS];
|
||||
/* computes the stack depth of each bpf function */
|
||||
u16 subprog_stack_depth[BPF_MAX_SUBPROGS + 1];
|
||||
u32 subprog_cnt;
|
||||
};
|
||||
|
||||
__printf(2, 3) void bpf_verifier_log_write(struct bpf_verifier_env *env,
|
||||
const char *fmt, ...);
|
||||
|
||||
static inline struct bpf_reg_state *cur_regs(struct bpf_verifier_env *env)
|
||||
{
|
||||
return env->cur_state->regs;
|
||||
struct bpf_verifier_state *cur = env->cur_state;
|
||||
|
||||
return cur->frame[cur->curframe]->regs;
|
||||
}
|
||||
|
||||
#if defined(CONFIG_NET) && defined(CONFIG_BPF_SYSCALL)
|
||||
int bpf_prog_offload_verifier_prep(struct bpf_verifier_env *env);
|
||||
#else
|
||||
static inline int bpf_prog_offload_verifier_prep(struct bpf_verifier_env *env)
|
||||
{
|
||||
return -EOPNOTSUPP;
|
||||
}
|
||||
#endif
|
||||
int bpf_prog_offload_verify_insn(struct bpf_verifier_env *env,
|
||||
int insn_idx, int prev_insn_idx);
|
||||
|
||||
#endif /* _LINUX_BPF_VERIFIER_H */
|
||||
|
@@ -14,6 +14,7 @@
|
||||
#define PHY_ID_BCM5241 0x0143bc30
|
||||
#define PHY_ID_BCMAC131 0x0143bc70
|
||||
#define PHY_ID_BCM5481 0x0143bca0
|
||||
#define PHY_ID_BCM5395 0x0143bcf0
|
||||
#define PHY_ID_BCM54810 0x03625d00
|
||||
#define PHY_ID_BCM5482 0x0143bcb0
|
||||
#define PHY_ID_BCM5411 0x00206070
|
||||
|
@@ -81,11 +81,14 @@ struct buffer_head {
|
||||
/*
|
||||
* macro tricks to expand the set_buffer_foo(), clear_buffer_foo()
|
||||
* and buffer_foo() functions.
|
||||
* To avoid reset buffer flags that are already set, because that causes
|
||||
* a costly cache line transition, check the flag first.
|
||||
*/
|
||||
#define BUFFER_FNS(bit, name) \
|
||||
static __always_inline void set_buffer_##name(struct buffer_head *bh) \
|
||||
{ \
|
||||
set_bit(BH_##bit, &(bh)->b_state); \
|
||||
if (!test_bit(BH_##bit, &(bh)->b_state)) \
|
||||
set_bit(BH_##bit, &(bh)->b_state); \
|
||||
} \
|
||||
static __always_inline void clear_buffer_##name(struct buffer_head *bh) \
|
||||
{ \
|
||||
@@ -151,7 +154,6 @@ void buffer_check_dirty_writeback(struct page *page,
|
||||
|
||||
void mark_buffer_dirty(struct buffer_head *bh);
|
||||
void mark_buffer_write_io_error(struct buffer_head *bh);
|
||||
void init_buffer(struct buffer_head *, bh_end_io_t *, void *);
|
||||
void touch_buffer(struct buffer_head *bh);
|
||||
void set_bh_page(struct buffer_head *bh,
|
||||
struct page *page, unsigned long offset);
|
||||
|
@@ -8,7 +8,6 @@
|
||||
#define __BUILD_BUG_ON_NOT_POWER_OF_2(n) (0)
|
||||
#define BUILD_BUG_ON_NOT_POWER_OF_2(n) (0)
|
||||
#define BUILD_BUG_ON_ZERO(e) (0)
|
||||
#define BUILD_BUG_ON_NULL(e) ((void *)0)
|
||||
#define BUILD_BUG_ON_INVALID(e) (0)
|
||||
#define BUILD_BUG_ON_MSG(cond, msg) (0)
|
||||
#define BUILD_BUG_ON(condition) (0)
|
||||
@@ -28,7 +27,6 @@
|
||||
* aren't permitted).
|
||||
*/
|
||||
#define BUILD_BUG_ON_ZERO(e) (sizeof(struct { int:(-!!(e)); }))
|
||||
#define BUILD_BUG_ON_NULL(e) ((void *)sizeof(struct { int:(-!!(e)); }))
|
||||
|
||||
/*
|
||||
* BUILD_BUG_ON_INVALID() permits the compiler to check the validity of the
|
||||
|
@@ -46,6 +46,7 @@ struct can_priv {
|
||||
unsigned int bitrate_const_cnt;
|
||||
const u32 *data_bitrate_const;
|
||||
unsigned int data_bitrate_const_cnt;
|
||||
u32 bitrate_max;
|
||||
struct can_clock clock;
|
||||
|
||||
enum can_state state;
|
||||
@@ -166,6 +167,12 @@ void can_put_echo_skb(struct sk_buff *skb, struct net_device *dev,
|
||||
unsigned int can_get_echo_skb(struct net_device *dev, unsigned int idx);
|
||||
void can_free_echo_skb(struct net_device *dev, unsigned int idx);
|
||||
|
||||
#ifdef CONFIG_OF
|
||||
void of_can_transceiver(struct net_device *dev);
|
||||
#else
|
||||
static inline void of_can_transceiver(struct net_device *dev) { }
|
||||
#endif
|
||||
|
||||
struct sk_buff *alloc_can_skb(struct net_device *dev, struct can_frame **cf);
|
||||
struct sk_buff *alloc_canfd_skb(struct net_device *dev,
|
||||
struct canfd_frame **cfd);
|
||||
|
@@ -561,7 +561,7 @@ struct cftype {
|
||||
|
||||
/*
|
||||
* Control Group subsystem type.
|
||||
* See Documentation/cgroups/cgroups.txt for details
|
||||
* See Documentation/cgroup-v1/cgroups.txt for details
|
||||
*/
|
||||
struct cgroup_subsys {
|
||||
struct cgroup_subsys_state *(*css_alloc)(struct cgroup_subsys_state *parent_css);
|
||||
|
@@ -20,6 +20,8 @@
|
||||
* flags used across common struct clk. these flags should only affect the
|
||||
* top-level framework. custom flags for dealing with hardware specifics
|
||||
* belong in struct clk_foo
|
||||
*
|
||||
* Please update clk_flags[] in drivers/clk/clk.c when making changes here!
|
||||
*/
|
||||
#define CLK_SET_RATE_GATE BIT(0) /* must be gated across rate change */
|
||||
#define CLK_SET_PARENT_GATE BIT(1) /* must be gated across re-parent */
|
||||
@@ -412,7 +414,7 @@ extern const struct clk_ops clk_divider_ro_ops;
|
||||
|
||||
unsigned long divider_recalc_rate(struct clk_hw *hw, unsigned long parent_rate,
|
||||
unsigned int val, const struct clk_div_table *table,
|
||||
unsigned long flags);
|
||||
unsigned long flags, unsigned long width);
|
||||
long divider_round_rate_parent(struct clk_hw *hw, struct clk_hw *parent,
|
||||
unsigned long rate, unsigned long *prate,
|
||||
const struct clk_div_table *table,
|
||||
@@ -744,6 +746,7 @@ unsigned long clk_hw_get_rate(const struct clk_hw *hw);
|
||||
unsigned long __clk_get_flags(struct clk *clk);
|
||||
unsigned long clk_hw_get_flags(const struct clk_hw *hw);
|
||||
bool clk_hw_is_prepared(const struct clk_hw *hw);
|
||||
bool clk_hw_rate_is_protected(const struct clk_hw *hw);
|
||||
bool clk_hw_is_enabled(const struct clk_hw *hw);
|
||||
bool __clk_is_enabled(struct clk *clk);
|
||||
struct clk *__clk_lookup(const char *name);
|
||||
@@ -806,6 +809,44 @@ extern struct of_device_id __clk_of_table;
|
||||
} \
|
||||
OF_DECLARE_1(clk, name, compat, name##_of_clk_init_driver)
|
||||
|
||||
#define CLK_HW_INIT(_name, _parent, _ops, _flags) \
|
||||
(&(struct clk_init_data) { \
|
||||
.flags = _flags, \
|
||||
.name = _name, \
|
||||
.parent_names = (const char *[]) { _parent }, \
|
||||
.num_parents = 1, \
|
||||
.ops = _ops, \
|
||||
})
|
||||
|
||||
#define CLK_HW_INIT_PARENTS(_name, _parents, _ops, _flags) \
|
||||
(&(struct clk_init_data) { \
|
||||
.flags = _flags, \
|
||||
.name = _name, \
|
||||
.parent_names = _parents, \
|
||||
.num_parents = ARRAY_SIZE(_parents), \
|
||||
.ops = _ops, \
|
||||
})
|
||||
|
||||
#define CLK_HW_INIT_NO_PARENT(_name, _ops, _flags) \
|
||||
(&(struct clk_init_data) { \
|
||||
.flags = _flags, \
|
||||
.name = _name, \
|
||||
.parent_names = NULL, \
|
||||
.num_parents = 0, \
|
||||
.ops = _ops, \
|
||||
})
|
||||
|
||||
#define CLK_FIXED_FACTOR(_struct, _name, _parent, \
|
||||
_div, _mult, _flags) \
|
||||
struct clk_fixed_factor _struct = { \
|
||||
.div = _div, \
|
||||
.mult = _mult, \
|
||||
.hw.init = CLK_HW_INIT(_name, \
|
||||
_parent, \
|
||||
&clk_fixed_factor_ops, \
|
||||
_flags), \
|
||||
}
|
||||
|
||||
#ifdef CONFIG_OF
|
||||
int of_clk_add_provider(struct device_node *np,
|
||||
struct clk *(*clk_src_get)(struct of_phandle_args *args,
|
||||
|
@@ -331,6 +331,38 @@ struct clk *devm_clk_get(struct device *dev, const char *id);
|
||||
*/
|
||||
struct clk *devm_get_clk_from_child(struct device *dev,
|
||||
struct device_node *np, const char *con_id);
|
||||
/**
|
||||
* clk_rate_exclusive_get - get exclusivity over the rate control of a
|
||||
* producer
|
||||
* @clk: clock source
|
||||
*
|
||||
* This function allows drivers to get exclusive control over the rate of a
|
||||
* provider. It prevents any other consumer to execute, even indirectly,
|
||||
* opereation which could alter the rate of the provider or cause glitches
|
||||
*
|
||||
* If exlusivity is claimed more than once on clock, even by the same driver,
|
||||
* the rate effectively gets locked as exclusivity can't be preempted.
|
||||
*
|
||||
* Must not be called from within atomic context.
|
||||
*
|
||||
* Returns success (0) or negative errno.
|
||||
*/
|
||||
int clk_rate_exclusive_get(struct clk *clk);
|
||||
|
||||
/**
|
||||
* clk_rate_exclusive_put - release exclusivity over the rate control of a
|
||||
* producer
|
||||
* @clk: clock source
|
||||
*
|
||||
* This function allows drivers to release the exclusivity it previously got
|
||||
* from clk_rate_exclusive_get()
|
||||
*
|
||||
* The caller must balance the number of clk_rate_exclusive_get() and
|
||||
* clk_rate_exclusive_put() calls.
|
||||
*
|
||||
* Must not be called from within atomic context.
|
||||
*/
|
||||
void clk_rate_exclusive_put(struct clk *clk);
|
||||
|
||||
/**
|
||||
* clk_enable - inform the system when the clock source should be running.
|
||||
@@ -472,6 +504,23 @@ long clk_round_rate(struct clk *clk, unsigned long rate);
|
||||
*/
|
||||
int clk_set_rate(struct clk *clk, unsigned long rate);
|
||||
|
||||
/**
|
||||
* clk_set_rate_exclusive- set the clock rate and claim exclusivity over
|
||||
* clock source
|
||||
* @clk: clock source
|
||||
* @rate: desired clock rate in Hz
|
||||
*
|
||||
* This helper function allows drivers to atomically set the rate of a producer
|
||||
* and claim exclusivity over the rate control of the producer.
|
||||
*
|
||||
* It is essentially a combination of clk_set_rate() and
|
||||
* clk_rate_exclusite_get(). Caller must balance this call with a call to
|
||||
* clk_rate_exclusive_put()
|
||||
*
|
||||
* Returns success (0) or negative errno.
|
||||
*/
|
||||
int clk_set_rate_exclusive(struct clk *clk, unsigned long rate);
|
||||
|
||||
/**
|
||||
* clk_has_parent - check if a clock is a possible parent for another
|
||||
* @clk: clock source
|
||||
@@ -583,6 +632,14 @@ static inline void clk_bulk_put(int num_clks, struct clk_bulk_data *clks) {}
|
||||
|
||||
static inline void devm_clk_put(struct device *dev, struct clk *clk) {}
|
||||
|
||||
|
||||
static inline int clk_rate_exclusive_get(struct clk *clk)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
static inline void clk_rate_exclusive_put(struct clk *clk) {}
|
||||
|
||||
static inline int clk_enable(struct clk *clk)
|
||||
{
|
||||
return 0;
|
||||
@@ -609,6 +666,11 @@ static inline int clk_set_rate(struct clk *clk, unsigned long rate)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static inline int clk_set_rate_exclusive(struct clk *clk, unsigned long rate)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
static inline long clk_round_rate(struct clk *clk, unsigned long rate)
|
||||
{
|
||||
return 0;
|
||||
|
@@ -12,7 +12,7 @@
|
||||
#ifndef __CLKDEV_H
|
||||
#define __CLKDEV_H
|
||||
|
||||
#include <asm/clkdev.h>
|
||||
#include <linux/slab.h>
|
||||
|
||||
struct clk;
|
||||
struct clk_hw;
|
||||
@@ -52,9 +52,4 @@ int clk_add_alias(const char *, const char *, const char *, struct device *);
|
||||
int clk_register_clkdev(struct clk *, const char *, const char *);
|
||||
int clk_hw_register_clkdev(struct clk_hw *, const char *, const char *);
|
||||
|
||||
#ifdef CONFIG_COMMON_CLK
|
||||
int __clk_get(struct clk *clk);
|
||||
void __clk_put(struct clk *clk);
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
@@ -157,6 +157,104 @@ struct compat_sigaction {
|
||||
compat_sigset_t sa_mask __packed;
|
||||
};
|
||||
|
||||
typedef union compat_sigval {
|
||||
compat_int_t sival_int;
|
||||
compat_uptr_t sival_ptr;
|
||||
} compat_sigval_t;
|
||||
|
||||
typedef struct compat_siginfo {
|
||||
int si_signo;
|
||||
#ifndef __ARCH_HAS_SWAPPED_SIGINFO
|
||||
int si_errno;
|
||||
int si_code;
|
||||
#else
|
||||
int si_code;
|
||||
int si_errno;
|
||||
#endif
|
||||
|
||||
union {
|
||||
int _pad[128/sizeof(int) - 3];
|
||||
|
||||
/* kill() */
|
||||
struct {
|
||||
compat_pid_t _pid; /* sender's pid */
|
||||
__compat_uid32_t _uid; /* sender's uid */
|
||||
} _kill;
|
||||
|
||||
/* POSIX.1b timers */
|
||||
struct {
|
||||
compat_timer_t _tid; /* timer id */
|
||||
int _overrun; /* overrun count */
|
||||
compat_sigval_t _sigval; /* same as below */
|
||||
} _timer;
|
||||
|
||||
/* POSIX.1b signals */
|
||||
struct {
|
||||
compat_pid_t _pid; /* sender's pid */
|
||||
__compat_uid32_t _uid; /* sender's uid */
|
||||
compat_sigval_t _sigval;
|
||||
} _rt;
|
||||
|
||||
/* SIGCHLD */
|
||||
struct {
|
||||
compat_pid_t _pid; /* which child */
|
||||
__compat_uid32_t _uid; /* sender's uid */
|
||||
int _status; /* exit code */
|
||||
compat_clock_t _utime;
|
||||
compat_clock_t _stime;
|
||||
} _sigchld;
|
||||
|
||||
#ifdef CONFIG_X86_X32_ABI
|
||||
/* SIGCHLD (x32 version) */
|
||||
struct {
|
||||
compat_pid_t _pid; /* which child */
|
||||
__compat_uid32_t _uid; /* sender's uid */
|
||||
int _status; /* exit code */
|
||||
compat_s64 _utime;
|
||||
compat_s64 _stime;
|
||||
} _sigchld_x32;
|
||||
#endif
|
||||
|
||||
/* SIGILL, SIGFPE, SIGSEGV, SIGBUS, SIGTRAP, SIGEMT */
|
||||
struct {
|
||||
compat_uptr_t _addr; /* faulting insn/memory ref. */
|
||||
#ifdef __ARCH_SI_TRAPNO
|
||||
int _trapno; /* TRAP # which caused the signal */
|
||||
#endif
|
||||
union {
|
||||
/*
|
||||
* used when si_code=BUS_MCEERR_AR or
|
||||
* used when si_code=BUS_MCEERR_AO
|
||||
*/
|
||||
short int _addr_lsb; /* Valid LSB of the reported address. */
|
||||
/* used when si_code=SEGV_BNDERR */
|
||||
struct {
|
||||
short _dummy_bnd;
|
||||
compat_uptr_t _lower;
|
||||
compat_uptr_t _upper;
|
||||
} _addr_bnd;
|
||||
/* used when si_code=SEGV_PKUERR */
|
||||
struct {
|
||||
short _dummy_pkey;
|
||||
u32 _pkey;
|
||||
} _addr_pkey;
|
||||
};
|
||||
} _sigfault;
|
||||
|
||||
/* SIGPOLL */
|
||||
struct {
|
||||
compat_long_t _band; /* POLL_IN, POLL_OUT, POLL_MSG */
|
||||
int _fd;
|
||||
} _sigpoll;
|
||||
|
||||
struct {
|
||||
compat_uptr_t _call_addr; /* calling user insn */
|
||||
int _syscall; /* triggering system call number */
|
||||
unsigned int _arch; /* AUDIT_ARCH_* of syscall */
|
||||
} _sigsys;
|
||||
} _sifields;
|
||||
} compat_siginfo_t;
|
||||
|
||||
/*
|
||||
* These functions operate on 32- or 64-bit specs depending on
|
||||
* COMPAT_USE_64BIT_TIME, hence the void user pointer arguments.
|
||||
@@ -412,7 +510,7 @@ long compat_get_bitmap(unsigned long *mask, const compat_ulong_t __user *umask,
|
||||
unsigned long bitmap_size);
|
||||
long compat_put_bitmap(compat_ulong_t __user *umask, unsigned long *mask,
|
||||
unsigned long bitmap_size);
|
||||
int copy_siginfo_from_user32(siginfo_t *to, struct compat_siginfo __user *from);
|
||||
int copy_siginfo_from_user32(siginfo_t *to, const struct compat_siginfo __user *from);
|
||||
int copy_siginfo_to_user32(struct compat_siginfo __user *to, const siginfo_t *from);
|
||||
int get_compat_sigevent(struct sigevent *event,
|
||||
const struct compat_sigevent __user *u_event);
|
||||
|
@@ -19,3 +19,11 @@
|
||||
|
||||
#define randomized_struct_fields_start struct {
|
||||
#define randomized_struct_fields_end };
|
||||
|
||||
/* all clang versions usable with the kernel support KASAN ABI version 5 */
|
||||
#define KASAN_ABI_VERSION 5
|
||||
|
||||
/* emulate gcc's __SANITIZE_ADDRESS__ flag */
|
||||
#if __has_feature(address_sanitizer)
|
||||
#define __SANITIZE_ADDRESS__
|
||||
#endif
|
||||
|
@@ -167,8 +167,6 @@
|
||||
|
||||
#if GCC_VERSION >= 40100
|
||||
# define __compiletime_object_size(obj) __builtin_object_size(obj, 0)
|
||||
|
||||
#define __nostackprotector __attribute__((__optimize__("no-stack-protector")))
|
||||
#endif
|
||||
|
||||
#if GCC_VERSION >= 40300
|
||||
@@ -196,6 +194,11 @@
|
||||
#endif /* __CHECKER__ */
|
||||
#endif /* GCC_VERSION >= 40300 */
|
||||
|
||||
#if GCC_VERSION >= 40400
|
||||
#define __optimize(level) __attribute__((__optimize__(level)))
|
||||
#define __nostackprotector __optimize("no-stack-protector")
|
||||
#endif /* GCC_VERSION >= 40400 */
|
||||
|
||||
#if GCC_VERSION >= 40500
|
||||
|
||||
#ifndef __CHECKER__
|
||||
|
@@ -185,23 +185,21 @@ void __read_once_size(const volatile void *p, void *res, int size)
|
||||
|
||||
#ifdef CONFIG_KASAN
|
||||
/*
|
||||
* This function is not 'inline' because __no_sanitize_address confilcts
|
||||
* We can't declare function 'inline' because __no_sanitize_address confilcts
|
||||
* with inlining. Attempt to inline it may cause a build failure.
|
||||
* https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67368
|
||||
* '__maybe_unused' allows us to avoid defined-but-not-used warnings.
|
||||
*/
|
||||
static __no_sanitize_address __maybe_unused
|
||||
void __read_once_size_nocheck(const volatile void *p, void *res, int size)
|
||||
{
|
||||
__READ_ONCE_SIZE;
|
||||
}
|
||||
# define __no_kasan_or_inline __no_sanitize_address __maybe_unused
|
||||
#else
|
||||
static __always_inline
|
||||
# define __no_kasan_or_inline __always_inline
|
||||
#endif
|
||||
|
||||
static __no_kasan_or_inline
|
||||
void __read_once_size_nocheck(const volatile void *p, void *res, int size)
|
||||
{
|
||||
__READ_ONCE_SIZE;
|
||||
}
|
||||
#endif
|
||||
|
||||
static __always_inline void __write_once_size(volatile void *p, void *res, int size)
|
||||
{
|
||||
@@ -240,6 +238,7 @@ static __always_inline void __write_once_size(volatile void *p, void *res, int s
|
||||
* required ordering.
|
||||
*/
|
||||
#include <asm/barrier.h>
|
||||
#include <linux/kasan-checks.h>
|
||||
|
||||
#define __READ_ONCE(x, check) \
|
||||
({ \
|
||||
@@ -259,6 +258,13 @@ static __always_inline void __write_once_size(volatile void *p, void *res, int s
|
||||
*/
|
||||
#define READ_ONCE_NOCHECK(x) __READ_ONCE(x, 0)
|
||||
|
||||
static __no_kasan_or_inline
|
||||
unsigned long read_word_at_a_time(const void *addr)
|
||||
{
|
||||
kasan_check_read(addr, 1);
|
||||
return *(unsigned long *)addr;
|
||||
}
|
||||
|
||||
#define WRITE_ONCE(x, val) \
|
||||
({ \
|
||||
union { typeof(x) __val; char __c[1]; } __u = \
|
||||
@@ -271,6 +277,10 @@ static __always_inline void __write_once_size(volatile void *p, void *res, int s
|
||||
|
||||
#endif /* __ASSEMBLY__ */
|
||||
|
||||
#ifndef __optimize
|
||||
# define __optimize(level)
|
||||
#endif
|
||||
|
||||
/* Compile time object size, -1 for unknown */
|
||||
#ifndef __compiletime_object_size
|
||||
# define __compiletime_object_size(obj) -1
|
||||
|
@@ -628,6 +628,18 @@ static inline void dev_pm_opp_free_cpufreq_table(struct device *dev,
|
||||
#define cpufreq_for_each_entry(pos, table) \
|
||||
for (pos = table; pos->frequency != CPUFREQ_TABLE_END; pos++)
|
||||
|
||||
/*
|
||||
* cpufreq_for_each_entry_idx - iterate over a cpufreq_frequency_table
|
||||
* with index
|
||||
* @pos: the cpufreq_frequency_table * to use as a loop cursor.
|
||||
* @table: the cpufreq_frequency_table * to iterate over.
|
||||
* @idx: the table entry currently being processed
|
||||
*/
|
||||
|
||||
#define cpufreq_for_each_entry_idx(pos, table, idx) \
|
||||
for (pos = table, idx = 0; pos->frequency != CPUFREQ_TABLE_END; \
|
||||
pos++, idx++)
|
||||
|
||||
/*
|
||||
* cpufreq_for_each_valid_entry - iterate over a cpufreq_frequency_table
|
||||
* excluding CPUFREQ_ENTRY_INVALID frequencies.
|
||||
@@ -641,6 +653,21 @@ static inline void dev_pm_opp_free_cpufreq_table(struct device *dev,
|
||||
continue; \
|
||||
else
|
||||
|
||||
/*
|
||||
* cpufreq_for_each_valid_entry_idx - iterate with index over a cpufreq
|
||||
* frequency_table excluding CPUFREQ_ENTRY_INVALID frequencies.
|
||||
* @pos: the cpufreq_frequency_table * to use as a loop cursor.
|
||||
* @table: the cpufreq_frequency_table * to iterate over.
|
||||
* @idx: the table entry currently being processed
|
||||
*/
|
||||
|
||||
#define cpufreq_for_each_valid_entry_idx(pos, table, idx) \
|
||||
cpufreq_for_each_entry_idx(pos, table, idx) \
|
||||
if (pos->frequency == CPUFREQ_ENTRY_INVALID) \
|
||||
continue; \
|
||||
else
|
||||
|
||||
|
||||
int cpufreq_frequency_table_cpuinfo(struct cpufreq_policy *policy,
|
||||
struct cpufreq_frequency_table *table);
|
||||
|
||||
@@ -667,19 +694,20 @@ static inline int cpufreq_table_find_index_al(struct cpufreq_policy *policy,
|
||||
unsigned int target_freq)
|
||||
{
|
||||
struct cpufreq_frequency_table *table = policy->freq_table;
|
||||
struct cpufreq_frequency_table *pos, *best = table - 1;
|
||||
struct cpufreq_frequency_table *pos;
|
||||
unsigned int freq;
|
||||
int idx, best = -1;
|
||||
|
||||
cpufreq_for_each_valid_entry(pos, table) {
|
||||
cpufreq_for_each_valid_entry_idx(pos, table, idx) {
|
||||
freq = pos->frequency;
|
||||
|
||||
if (freq >= target_freq)
|
||||
return pos - table;
|
||||
return idx;
|
||||
|
||||
best = pos;
|
||||
best = idx;
|
||||
}
|
||||
|
||||
return best - table;
|
||||
return best;
|
||||
}
|
||||
|
||||
/* Find lowest freq at or above target in a table in descending order */
|
||||
@@ -687,28 +715,29 @@ static inline int cpufreq_table_find_index_dl(struct cpufreq_policy *policy,
|
||||
unsigned int target_freq)
|
||||
{
|
||||
struct cpufreq_frequency_table *table = policy->freq_table;
|
||||
struct cpufreq_frequency_table *pos, *best = table - 1;
|
||||
struct cpufreq_frequency_table *pos;
|
||||
unsigned int freq;
|
||||
int idx, best = -1;
|
||||
|
||||
cpufreq_for_each_valid_entry(pos, table) {
|
||||
cpufreq_for_each_valid_entry_idx(pos, table, idx) {
|
||||
freq = pos->frequency;
|
||||
|
||||
if (freq == target_freq)
|
||||
return pos - table;
|
||||
return idx;
|
||||
|
||||
if (freq > target_freq) {
|
||||
best = pos;
|
||||
best = idx;
|
||||
continue;
|
||||
}
|
||||
|
||||
/* No freq found above target_freq */
|
||||
if (best == table - 1)
|
||||
return pos - table;
|
||||
if (best == -1)
|
||||
return idx;
|
||||
|
||||
return best - table;
|
||||
return best;
|
||||
}
|
||||
|
||||
return best - table;
|
||||
return best;
|
||||
}
|
||||
|
||||
/* Works only on sorted freq-tables */
|
||||
@@ -728,28 +757,29 @@ static inline int cpufreq_table_find_index_ah(struct cpufreq_policy *policy,
|
||||
unsigned int target_freq)
|
||||
{
|
||||
struct cpufreq_frequency_table *table = policy->freq_table;
|
||||
struct cpufreq_frequency_table *pos, *best = table - 1;
|
||||
struct cpufreq_frequency_table *pos;
|
||||
unsigned int freq;
|
||||
int idx, best = -1;
|
||||
|
||||
cpufreq_for_each_valid_entry(pos, table) {
|
||||
cpufreq_for_each_valid_entry_idx(pos, table, idx) {
|
||||
freq = pos->frequency;
|
||||
|
||||
if (freq == target_freq)
|
||||
return pos - table;
|
||||
return idx;
|
||||
|
||||
if (freq < target_freq) {
|
||||
best = pos;
|
||||
best = idx;
|
||||
continue;
|
||||
}
|
||||
|
||||
/* No freq found below target_freq */
|
||||
if (best == table - 1)
|
||||
return pos - table;
|
||||
if (best == -1)
|
||||
return idx;
|
||||
|
||||
return best - table;
|
||||
return best;
|
||||
}
|
||||
|
||||
return best - table;
|
||||
return best;
|
||||
}
|
||||
|
||||
/* Find highest freq at or below target in a table in descending order */
|
||||
@@ -757,19 +787,20 @@ static inline int cpufreq_table_find_index_dh(struct cpufreq_policy *policy,
|
||||
unsigned int target_freq)
|
||||
{
|
||||
struct cpufreq_frequency_table *table = policy->freq_table;
|
||||
struct cpufreq_frequency_table *pos, *best = table - 1;
|
||||
struct cpufreq_frequency_table *pos;
|
||||
unsigned int freq;
|
||||
int idx, best = -1;
|
||||
|
||||
cpufreq_for_each_valid_entry(pos, table) {
|
||||
cpufreq_for_each_valid_entry_idx(pos, table, idx) {
|
||||
freq = pos->frequency;
|
||||
|
||||
if (freq <= target_freq)
|
||||
return pos - table;
|
||||
return idx;
|
||||
|
||||
best = pos;
|
||||
best = idx;
|
||||
}
|
||||
|
||||
return best - table;
|
||||
return best;
|
||||
}
|
||||
|
||||
/* Works only on sorted freq-tables */
|
||||
@@ -789,32 +820,33 @@ static inline int cpufreq_table_find_index_ac(struct cpufreq_policy *policy,
|
||||
unsigned int target_freq)
|
||||
{
|
||||
struct cpufreq_frequency_table *table = policy->freq_table;
|
||||
struct cpufreq_frequency_table *pos, *best = table - 1;
|
||||
struct cpufreq_frequency_table *pos;
|
||||
unsigned int freq;
|
||||
int idx, best = -1;
|
||||
|
||||
cpufreq_for_each_valid_entry(pos, table) {
|
||||
cpufreq_for_each_valid_entry_idx(pos, table, idx) {
|
||||
freq = pos->frequency;
|
||||
|
||||
if (freq == target_freq)
|
||||
return pos - table;
|
||||
return idx;
|
||||
|
||||
if (freq < target_freq) {
|
||||
best = pos;
|
||||
best = idx;
|
||||
continue;
|
||||
}
|
||||
|
||||
/* No freq found below target_freq */
|
||||
if (best == table - 1)
|
||||
return pos - table;
|
||||
if (best == -1)
|
||||
return idx;
|
||||
|
||||
/* Choose the closest freq */
|
||||
if (target_freq - best->frequency > freq - target_freq)
|
||||
return pos - table;
|
||||
if (target_freq - table[best].frequency > freq - target_freq)
|
||||
return idx;
|
||||
|
||||
return best - table;
|
||||
return best;
|
||||
}
|
||||
|
||||
return best - table;
|
||||
return best;
|
||||
}
|
||||
|
||||
/* Find closest freq to target in a table in descending order */
|
||||
@@ -822,32 +854,33 @@ static inline int cpufreq_table_find_index_dc(struct cpufreq_policy *policy,
|
||||
unsigned int target_freq)
|
||||
{
|
||||
struct cpufreq_frequency_table *table = policy->freq_table;
|
||||
struct cpufreq_frequency_table *pos, *best = table - 1;
|
||||
struct cpufreq_frequency_table *pos;
|
||||
unsigned int freq;
|
||||
int idx, best = -1;
|
||||
|
||||
cpufreq_for_each_valid_entry(pos, table) {
|
||||
cpufreq_for_each_valid_entry_idx(pos, table, idx) {
|
||||
freq = pos->frequency;
|
||||
|
||||
if (freq == target_freq)
|
||||
return pos - table;
|
||||
return idx;
|
||||
|
||||
if (freq > target_freq) {
|
||||
best = pos;
|
||||
best = idx;
|
||||
continue;
|
||||
}
|
||||
|
||||
/* No freq found above target_freq */
|
||||
if (best == table - 1)
|
||||
return pos - table;
|
||||
if (best == -1)
|
||||
return idx;
|
||||
|
||||
/* Choose the closest freq */
|
||||
if (best->frequency - target_freq > target_freq - freq)
|
||||
return pos - table;
|
||||
if (table[best].frequency - target_freq > target_freq - freq)
|
||||
return idx;
|
||||
|
||||
return best - table;
|
||||
return best;
|
||||
}
|
||||
|
||||
return best - table;
|
||||
return best;
|
||||
}
|
||||
|
||||
/* Works only on sorted freq-tables */
|
||||
|
@@ -59,6 +59,7 @@ enum cpuhp_state {
|
||||
CPUHP_PCI_XGENE_DEAD,
|
||||
CPUHP_IOMMU_INTEL_DEAD,
|
||||
CPUHP_LUSTRE_CFS_DEAD,
|
||||
CPUHP_AP_ARM_CACHE_B15_RAC_DEAD,
|
||||
CPUHP_WORKQUEUE_PREP,
|
||||
CPUHP_POWER_NUMA_PREPARE,
|
||||
CPUHP_HRTIMERS_PREPARE,
|
||||
@@ -109,6 +110,7 @@ enum cpuhp_state {
|
||||
CPUHP_AP_PERF_XTENSA_STARTING,
|
||||
CPUHP_AP_PERF_METAG_STARTING,
|
||||
CPUHP_AP_MIPS_OP_LOONGSON3_STARTING,
|
||||
CPUHP_AP_ARM_SDEI_STARTING,
|
||||
CPUHP_AP_ARM_VFP_STARTING,
|
||||
CPUHP_AP_ARM64_DEBUG_MONITORS_STARTING,
|
||||
CPUHP_AP_PERF_ARM_HW_BREAKPOINT_STARTING,
|
||||
@@ -137,6 +139,7 @@ enum cpuhp_state {
|
||||
CPUHP_AP_ARM64_ISNDEP_STARTING,
|
||||
CPUHP_AP_SMPCFD_DYING,
|
||||
CPUHP_AP_X86_TBOOT_DYING,
|
||||
CPUHP_AP_ARM_CACHE_B15_RAC_DYING,
|
||||
CPUHP_AP_ONLINE,
|
||||
CPUHP_TEARDOWN_CPU,
|
||||
CPUHP_AP_ONLINE_IDLE,
|
||||
|
@@ -257,22 +257,30 @@ static inline int cpuidle_register_governor(struct cpuidle_governor *gov)
|
||||
{return 0;}
|
||||
#endif
|
||||
|
||||
#define CPU_PM_CPU_IDLE_ENTER(low_level_idle_enter, idx) \
|
||||
({ \
|
||||
int __ret; \
|
||||
\
|
||||
if (!idx) { \
|
||||
cpu_do_idle(); \
|
||||
return idx; \
|
||||
} \
|
||||
\
|
||||
__ret = cpu_pm_enter(); \
|
||||
if (!__ret) { \
|
||||
__ret = low_level_idle_enter(idx); \
|
||||
cpu_pm_exit(); \
|
||||
} \
|
||||
\
|
||||
__ret ? -1 : idx; \
|
||||
#define __CPU_PM_CPU_IDLE_ENTER(low_level_idle_enter, idx, is_retention) \
|
||||
({ \
|
||||
int __ret = 0; \
|
||||
\
|
||||
if (!idx) { \
|
||||
cpu_do_idle(); \
|
||||
return idx; \
|
||||
} \
|
||||
\
|
||||
if (!is_retention) \
|
||||
__ret = cpu_pm_enter(); \
|
||||
if (!__ret) { \
|
||||
__ret = low_level_idle_enter(idx); \
|
||||
if (!is_retention) \
|
||||
cpu_pm_exit(); \
|
||||
} \
|
||||
\
|
||||
__ret ? -1 : idx; \
|
||||
})
|
||||
|
||||
#define CPU_PM_CPU_IDLE_ENTER(low_level_idle_enter, idx) \
|
||||
__CPU_PM_CPU_IDLE_ENTER(low_level_idle_enter, idx, 0)
|
||||
|
||||
#define CPU_PM_CPU_IDLE_ENTER_RETENTION(low_level_idle_enter, idx) \
|
||||
__CPU_PM_CPU_IDLE_ENTER(low_level_idle_enter, idx, 1)
|
||||
|
||||
#endif /* _LINUX_CPUIDLE_H */
|
||||
|
@@ -640,7 +640,7 @@ static inline int cpulist_parse(const char *buf, struct cpumask *dstp)
|
||||
/**
|
||||
* cpumask_size - size to allocate for a 'struct cpumask' in bytes
|
||||
*/
|
||||
static inline size_t cpumask_size(void)
|
||||
static inline unsigned int cpumask_size(void)
|
||||
{
|
||||
return BITS_TO_LONGS(nr_cpumask_bits) * sizeof(long);
|
||||
}
|
||||
|
@@ -112,7 +112,7 @@ static inline int cpuset_do_slab_mem_spread(void)
|
||||
return task_spread_slab(current);
|
||||
}
|
||||
|
||||
extern int current_cpuset_is_being_rebound(void);
|
||||
extern bool current_cpuset_is_being_rebound(void);
|
||||
|
||||
extern void rebuild_sched_domains(void);
|
||||
|
||||
@@ -247,9 +247,9 @@ static inline int cpuset_do_slab_mem_spread(void)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static inline int current_cpuset_is_being_rebound(void)
|
||||
static inline bool current_cpuset_is_being_rebound(void)
|
||||
{
|
||||
return 0;
|
||||
return false;
|
||||
}
|
||||
|
||||
static inline void rebuild_sched_domains(void)
|
||||
|
@@ -2,13 +2,13 @@
|
||||
#ifndef LINUX_CRASH_DUMP_H
|
||||
#define LINUX_CRASH_DUMP_H
|
||||
|
||||
#ifdef CONFIG_CRASH_DUMP
|
||||
#include <linux/kexec.h>
|
||||
#include <linux/proc_fs.h>
|
||||
#include <linux/elf.h>
|
||||
|
||||
#include <asm/pgtable.h> /* for pgprot_t */
|
||||
|
||||
#ifdef CONFIG_CRASH_DUMP
|
||||
#define ELFCORE_ADDR_MAX (-1ULL)
|
||||
#define ELFCORE_ADDR_ERR (-2ULL)
|
||||
|
||||
@@ -52,13 +52,13 @@ void vmcore_cleanup(void);
|
||||
* has passed the elf core header address on command line.
|
||||
*
|
||||
* This is not just a test if CONFIG_CRASH_DUMP is enabled or not. It will
|
||||
* return 1 if CONFIG_CRASH_DUMP=y and if kernel is booting after a panic of
|
||||
* previous kernel.
|
||||
* return true if CONFIG_CRASH_DUMP=y and if kernel is booting after a panic
|
||||
* of previous kernel.
|
||||
*/
|
||||
|
||||
static inline int is_kdump_kernel(void)
|
||||
static inline bool is_kdump_kernel(void)
|
||||
{
|
||||
return (elfcorehdr_addr != ELFCORE_ADDR_MAX) ? 1 : 0;
|
||||
return elfcorehdr_addr != ELFCORE_ADDR_MAX;
|
||||
}
|
||||
|
||||
/* is_vmcore_usable() checks if the kernel is booting after a panic and
|
||||
@@ -89,7 +89,7 @@ extern int register_oldmem_pfn_is_ram(int (*fn)(unsigned long pfn));
|
||||
extern void unregister_oldmem_pfn_is_ram(void);
|
||||
|
||||
#else /* !CONFIG_CRASH_DUMP */
|
||||
static inline int is_kdump_kernel(void) { return 0; }
|
||||
static inline bool is_kdump_kernel(void) { return 0; }
|
||||
#endif /* CONFIG_CRASH_DUMP */
|
||||
|
||||
extern unsigned long saved_max_pfn;
|
||||
|
@@ -106,9 +106,17 @@
|
||||
*/
|
||||
#define CRYPTO_ALG_INTERNAL 0x00002000
|
||||
|
||||
/*
|
||||
* Set if the algorithm has a ->setkey() method but can be used without
|
||||
* calling it first, i.e. there is a default key.
|
||||
*/
|
||||
#define CRYPTO_ALG_OPTIONAL_KEY 0x00004000
|
||||
|
||||
/*
|
||||
* Transform masks and values (for crt_flags).
|
||||
*/
|
||||
#define CRYPTO_TFM_NEED_KEY 0x00000001
|
||||
|
||||
#define CRYPTO_TFM_REQ_MASK 0x000fff00
|
||||
#define CRYPTO_TFM_RES_MASK 0xfff00000
|
||||
|
||||
@@ -447,7 +455,7 @@ struct crypto_alg {
|
||||
unsigned int cra_alignmask;
|
||||
|
||||
int cra_priority;
|
||||
atomic_t cra_refcnt;
|
||||
refcount_t cra_refcnt;
|
||||
|
||||
char cra_name[CRYPTO_MAX_ALG_NAME];
|
||||
char cra_driver_name[CRYPTO_MAX_ALG_NAME];
|
||||
|
@@ -96,7 +96,7 @@ bool dax_write_cache_enabled(struct dax_device *dax_dev);
|
||||
ssize_t dax_iomap_rw(struct kiocb *iocb, struct iov_iter *iter,
|
||||
const struct iomap_ops *ops);
|
||||
int dax_iomap_fault(struct vm_fault *vmf, enum page_entry_size pe_size,
|
||||
pfn_t *pfnp, const struct iomap_ops *ops);
|
||||
pfn_t *pfnp, int *errp, const struct iomap_ops *ops);
|
||||
int dax_finish_sync_fault(struct vm_fault *vmf, enum page_entry_size pe_size,
|
||||
pfn_t pfn);
|
||||
int dax_delete_mapping_entry(struct address_space *mapping, pgoff_t index);
|
||||
|
@@ -227,6 +227,7 @@ extern seqlock_t rename_lock;
|
||||
*/
|
||||
extern void d_instantiate(struct dentry *, struct inode *);
|
||||
extern struct dentry * d_instantiate_unique(struct dentry *, struct inode *);
|
||||
extern struct dentry * d_instantiate_anon(struct dentry *, struct inode *);
|
||||
extern int d_instantiate_no_diralias(struct dentry *, struct inode *);
|
||||
extern void __d_drop(struct dentry *dentry);
|
||||
extern void d_drop(struct dentry *dentry);
|
||||
@@ -235,6 +236,7 @@ extern void d_set_d_op(struct dentry *dentry, const struct dentry_operations *op
|
||||
|
||||
/* allocate/de-allocate */
|
||||
extern struct dentry * d_alloc(struct dentry *, const struct qstr *);
|
||||
extern struct dentry * d_alloc_anon(struct super_block *);
|
||||
extern struct dentry * d_alloc_pseudo(struct super_block *, const struct qstr *);
|
||||
extern struct dentry * d_alloc_parallel(struct dentry *, const struct qstr *,
|
||||
wait_queue_head_t *);
|
||||
|
@@ -28,6 +28,7 @@ enum dm_queue_mode {
|
||||
DM_TYPE_REQUEST_BASED = 2,
|
||||
DM_TYPE_MQ_REQUEST_BASED = 3,
|
||||
DM_TYPE_DAX_BIO_BASED = 4,
|
||||
DM_TYPE_NVME_BIO_BASED = 5,
|
||||
};
|
||||
|
||||
typedef enum { STATUSTYPE_INFO, STATUSTYPE_TABLE } status_type_t;
|
||||
@@ -220,14 +221,6 @@ struct target_type {
|
||||
#define DM_TARGET_WILDCARD 0x00000008
|
||||
#define dm_target_is_wildcard(type) ((type)->features & DM_TARGET_WILDCARD)
|
||||
|
||||
/*
|
||||
* Some targets need to be sent the same WRITE bio severals times so
|
||||
* that they can send copies of it to different devices. This function
|
||||
* examines any supplied bio and returns the number of copies of it the
|
||||
* target requires.
|
||||
*/
|
||||
typedef unsigned (*dm_num_write_bios_fn) (struct dm_target *ti, struct bio *bio);
|
||||
|
||||
/*
|
||||
* A target implements own bio data integrity.
|
||||
*/
|
||||
@@ -291,13 +284,6 @@ struct dm_target {
|
||||
*/
|
||||
unsigned per_io_data_size;
|
||||
|
||||
/*
|
||||
* If defined, this function is called to find out how many
|
||||
* duplicate bios should be sent to the target when writing
|
||||
* data.
|
||||
*/
|
||||
dm_num_write_bios_fn num_write_bios;
|
||||
|
||||
/* target specific data */
|
||||
void *private;
|
||||
|
||||
@@ -329,35 +315,9 @@ struct dm_target_callbacks {
|
||||
int (*congested_fn) (struct dm_target_callbacks *, int);
|
||||
};
|
||||
|
||||
/*
|
||||
* For bio-based dm.
|
||||
* One of these is allocated for each bio.
|
||||
* This structure shouldn't be touched directly by target drivers.
|
||||
* It is here so that we can inline dm_per_bio_data and
|
||||
* dm_bio_from_per_bio_data
|
||||
*/
|
||||
struct dm_target_io {
|
||||
struct dm_io *io;
|
||||
struct dm_target *ti;
|
||||
unsigned target_bio_nr;
|
||||
unsigned *len_ptr;
|
||||
struct bio clone;
|
||||
};
|
||||
|
||||
static inline void *dm_per_bio_data(struct bio *bio, size_t data_size)
|
||||
{
|
||||
return (char *)bio - offsetof(struct dm_target_io, clone) - data_size;
|
||||
}
|
||||
|
||||
static inline struct bio *dm_bio_from_per_bio_data(void *data, size_t data_size)
|
||||
{
|
||||
return (struct bio *)((char *)data + data_size + offsetof(struct dm_target_io, clone));
|
||||
}
|
||||
|
||||
static inline unsigned dm_bio_get_target_bio_nr(const struct bio *bio)
|
||||
{
|
||||
return container_of(bio, struct dm_target_io, clone)->target_bio_nr;
|
||||
}
|
||||
void *dm_per_bio_data(struct bio *bio, size_t data_size);
|
||||
struct bio *dm_bio_from_per_bio_data(void *data, size_t data_size);
|
||||
unsigned dm_bio_get_target_bio_nr(const struct bio *bio);
|
||||
|
||||
int dm_register_target(struct target_type *t);
|
||||
void dm_unregister_target(struct target_type *t);
|
||||
@@ -499,6 +459,11 @@ void dm_table_set_type(struct dm_table *t, enum dm_queue_mode type);
|
||||
*/
|
||||
int dm_table_complete(struct dm_table *t);
|
||||
|
||||
/*
|
||||
* Destroy the table when finished.
|
||||
*/
|
||||
void dm_table_destroy(struct dm_table *t);
|
||||
|
||||
/*
|
||||
* Target may require that it is never sent I/O larger than len.
|
||||
*/
|
||||
@@ -585,6 +550,7 @@ do { \
|
||||
#define DM_ENDIO_DONE 0
|
||||
#define DM_ENDIO_INCOMPLETE 1
|
||||
#define DM_ENDIO_REQUEUE 2
|
||||
#define DM_ENDIO_DELAY_REQUEUE 3
|
||||
|
||||
/*
|
||||
* Definitions of return values from target map function.
|
||||
@@ -592,7 +558,7 @@ do { \
|
||||
#define DM_MAPIO_SUBMITTED 0
|
||||
#define DM_MAPIO_REMAPPED 1
|
||||
#define DM_MAPIO_REQUEUE DM_ENDIO_REQUEUE
|
||||
#define DM_MAPIO_DELAY_REQUEUE 3
|
||||
#define DM_MAPIO_DELAY_REQUEUE DM_ENDIO_DELAY_REQUEUE
|
||||
#define DM_MAPIO_KILL 4
|
||||
|
||||
#define dm_sector_div64(x, y)( \
|
||||
|
@@ -1,3 +1,4 @@
|
||||
// SPDX-License-Identifier: GPL-2.0
|
||||
/*
|
||||
* device.h - generic, centralized driver model
|
||||
*
|
||||
@@ -5,8 +6,6 @@
|
||||
* Copyright (c) 2004-2009 Greg Kroah-Hartman <gregkh@suse.de>
|
||||
* Copyright (c) 2008-2009 Novell Inc.
|
||||
*
|
||||
* This file is released under the GPLv2
|
||||
*
|
||||
* See Documentation/driver-model/ for more information.
|
||||
*/
|
||||
|
||||
@@ -21,7 +20,6 @@
|
||||
#include <linux/compiler.h>
|
||||
#include <linux/types.h>
|
||||
#include <linux/mutex.h>
|
||||
#include <linux/pinctrl/devinfo.h>
|
||||
#include <linux/pm.h>
|
||||
#include <linux/atomic.h>
|
||||
#include <linux/ratelimit.h>
|
||||
@@ -42,6 +40,7 @@ struct fwnode_handle;
|
||||
struct iommu_ops;
|
||||
struct iommu_group;
|
||||
struct iommu_fwspec;
|
||||
struct dev_pin_info;
|
||||
|
||||
struct bus_attribute {
|
||||
struct attribute attr;
|
||||
@@ -288,6 +287,7 @@ struct device_driver {
|
||||
const struct attribute_group **groups;
|
||||
|
||||
const struct dev_pm_ops *pm;
|
||||
int (*coredump) (struct device *dev);
|
||||
|
||||
struct driver_private *p;
|
||||
};
|
||||
@@ -301,7 +301,6 @@ extern struct device_driver *driver_find(const char *name,
|
||||
extern int driver_probe_done(void);
|
||||
extern void wait_for_device_probe(void);
|
||||
|
||||
|
||||
/* sysfs interface for exporting driver attributes */
|
||||
|
||||
struct driver_attribute {
|
||||
@@ -575,6 +574,9 @@ ssize_t device_store_bool(struct device *dev, struct device_attribute *attr,
|
||||
|
||||
#define DEVICE_ATTR(_name, _mode, _show, _store) \
|
||||
struct device_attribute dev_attr_##_name = __ATTR(_name, _mode, _show, _store)
|
||||
#define DEVICE_ATTR_PREALLOC(_name, _mode, _show, _store) \
|
||||
struct device_attribute dev_attr_##_name = \
|
||||
__ATTR_PREALLOC(_name, _mode, _show, _store)
|
||||
#define DEVICE_ATTR_RW(_name) \
|
||||
struct device_attribute dev_attr_##_name = __ATTR_RW(_name)
|
||||
#define DEVICE_ATTR_RO(_name) \
|
||||
|
@@ -301,7 +301,7 @@ struct dma_buf {
|
||||
struct dma_fence_cb cb;
|
||||
wait_queue_head_t *poll;
|
||||
|
||||
unsigned long active;
|
||||
__poll_t active;
|
||||
} cb_excl, cb_shared;
|
||||
};
|
||||
|
||||
|
47
include/linux/dma-direct.h
Normal file
47
include/linux/dma-direct.h
Normal file
@@ -0,0 +1,47 @@
|
||||
/* SPDX-License-Identifier: GPL-2.0 */
|
||||
#ifndef _LINUX_DMA_DIRECT_H
|
||||
#define _LINUX_DMA_DIRECT_H 1
|
||||
|
||||
#include <linux/dma-mapping.h>
|
||||
|
||||
#ifdef CONFIG_ARCH_HAS_PHYS_TO_DMA
|
||||
#include <asm/dma-direct.h>
|
||||
#else
|
||||
static inline dma_addr_t phys_to_dma(struct device *dev, phys_addr_t paddr)
|
||||
{
|
||||
dma_addr_t dev_addr = (dma_addr_t)paddr;
|
||||
|
||||
return dev_addr - ((dma_addr_t)dev->dma_pfn_offset << PAGE_SHIFT);
|
||||
}
|
||||
|
||||
static inline phys_addr_t dma_to_phys(struct device *dev, dma_addr_t dev_addr)
|
||||
{
|
||||
phys_addr_t paddr = (phys_addr_t)dev_addr;
|
||||
|
||||
return paddr + ((phys_addr_t)dev->dma_pfn_offset << PAGE_SHIFT);
|
||||
}
|
||||
|
||||
static inline bool dma_capable(struct device *dev, dma_addr_t addr, size_t size)
|
||||
{
|
||||
if (!dev->dma_mask)
|
||||
return false;
|
||||
|
||||
return addr + size - 1 <= *dev->dma_mask;
|
||||
}
|
||||
#endif /* !CONFIG_ARCH_HAS_PHYS_TO_DMA */
|
||||
|
||||
#ifdef CONFIG_ARCH_HAS_DMA_MARK_CLEAN
|
||||
void dma_mark_clean(void *addr, size_t size);
|
||||
#else
|
||||
static inline void dma_mark_clean(void *addr, size_t size)
|
||||
{
|
||||
}
|
||||
#endif /* CONFIG_ARCH_HAS_DMA_MARK_CLEAN */
|
||||
|
||||
void *dma_direct_alloc(struct device *dev, size_t size, dma_addr_t *dma_handle,
|
||||
gfp_t gfp, unsigned long attrs);
|
||||
void dma_direct_free(struct device *dev, size_t size, void *cpu_addr,
|
||||
dma_addr_t dma_addr, unsigned long attrs);
|
||||
int dma_direct_supported(struct device *dev, u64 mask);
|
||||
|
||||
#endif /* _LINUX_DMA_DIRECT_H */
|
@@ -21,6 +21,7 @@
|
||||
#define __LINUX_DMA_FENCE_ARRAY_H
|
||||
|
||||
#include <linux/dma-fence.h>
|
||||
#include <linux/irq_work.h>
|
||||
|
||||
/**
|
||||
* struct dma_fence_array_cb - callback helper for fence array
|
||||
@@ -47,6 +48,8 @@ struct dma_fence_array {
|
||||
unsigned num_fences;
|
||||
atomic_t num_pending;
|
||||
struct dma_fence **fences;
|
||||
|
||||
struct irq_work work;
|
||||
};
|
||||
|
||||
extern const struct dma_fence_ops dma_fence_array_ops;
|
||||
|
@@ -242,7 +242,7 @@ static inline struct dma_fence *dma_fence_get_rcu(struct dma_fence *fence)
|
||||
* The caller is required to hold the RCU read lock.
|
||||
*/
|
||||
static inline struct dma_fence *
|
||||
dma_fence_get_rcu_safe(struct dma_fence * __rcu *fencep)
|
||||
dma_fence_get_rcu_safe(struct dma_fence __rcu **fencep)
|
||||
{
|
||||
do {
|
||||
struct dma_fence *fence;
|
||||
|
@@ -136,7 +136,7 @@ struct dma_map_ops {
|
||||
int is_phys;
|
||||
};
|
||||
|
||||
extern const struct dma_map_ops dma_noop_ops;
|
||||
extern const struct dma_map_ops dma_direct_ops;
|
||||
extern const struct dma_map_ops dma_virt_ops;
|
||||
|
||||
#define DMA_BIT_MASK(n) (((n) == 64) ? ~0ULL : ((1ULL<<(n))-1))
|
||||
@@ -513,10 +513,18 @@ static inline void *dma_alloc_attrs(struct device *dev, size_t size,
|
||||
void *cpu_addr;
|
||||
|
||||
BUG_ON(!ops);
|
||||
WARN_ON_ONCE(dev && !dev->coherent_dma_mask);
|
||||
|
||||
if (dma_alloc_from_dev_coherent(dev, size, dma_handle, &cpu_addr))
|
||||
return cpu_addr;
|
||||
|
||||
/*
|
||||
* Let the implementation decide on the zone to allocate from, and
|
||||
* decide on the way of zeroing the memory given that the memory
|
||||
* returned should always be zeroed.
|
||||
*/
|
||||
flag &= ~(__GFP_DMA | __GFP_DMA32 | __GFP_HIGHMEM | __GFP_ZERO);
|
||||
|
||||
if (!arch_dma_alloc_attrs(&dev, &flag))
|
||||
return NULL;
|
||||
if (!ops->alloc)
|
||||
@@ -568,6 +576,14 @@ static inline int dma_mapping_error(struct device *dev, dma_addr_t dma_addr)
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* This is a hack for the legacy x86 forbid_dac and iommu_sac_force. Please
|
||||
* don't use this is new code.
|
||||
*/
|
||||
#ifndef arch_dma_supported
|
||||
#define arch_dma_supported(dev, mask) (1)
|
||||
#endif
|
||||
|
||||
static inline void dma_check_mask(struct device *dev, u64 mask)
|
||||
{
|
||||
if (sme_active() && (mask < (((u64)sme_get_me_mask() << 1) - 1)))
|
||||
@@ -580,6 +596,9 @@ static inline int dma_supported(struct device *dev, u64 mask)
|
||||
|
||||
if (!ops)
|
||||
return 0;
|
||||
if (!arch_dma_supported(dev, mask))
|
||||
return 0;
|
||||
|
||||
if (!ops->dma_supported)
|
||||
return 1;
|
||||
return ops->dma_supported(dev, mask);
|
||||
@@ -692,7 +711,7 @@ static inline int dma_set_seg_boundary(struct device *dev, unsigned long mask)
|
||||
#ifndef dma_max_pfn
|
||||
static inline unsigned long dma_max_pfn(struct device *dev)
|
||||
{
|
||||
return *dev->dma_mask >> PAGE_SHIFT;
|
||||
return (*dev->dma_mask >> PAGE_SHIFT) + dev->dma_pfn_offset;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@@ -23,9 +23,10 @@ struct lan9303 {
|
||||
struct regmap_irq_chip_data *irq_data;
|
||||
struct gpio_desc *reset_gpio;
|
||||
u32 reset_duration; /* in [ms] */
|
||||
bool phy_addr_sel_strap;
|
||||
int phy_addr_base;
|
||||
struct dsa_switch *ds;
|
||||
struct mutex indirect_mutex; /* protect indexed register access */
|
||||
struct mutex alr_mutex; /* protect ALR access */
|
||||
const struct lan9303_phy_ops *ops;
|
||||
bool is_bridged; /* true if port 1 and 2 are bridged */
|
||||
|
||||
|
@@ -475,6 +475,39 @@ typedef struct {
|
||||
u64 get_all;
|
||||
} apple_properties_protocol_64_t;
|
||||
|
||||
typedef struct {
|
||||
u32 get_capability;
|
||||
u32 get_event_log;
|
||||
u32 hash_log_extend_event;
|
||||
u32 submit_command;
|
||||
u32 get_active_pcr_banks;
|
||||
u32 set_active_pcr_banks;
|
||||
u32 get_result_of_set_active_pcr_banks;
|
||||
} efi_tcg2_protocol_32_t;
|
||||
|
||||
typedef struct {
|
||||
u64 get_capability;
|
||||
u64 get_event_log;
|
||||
u64 hash_log_extend_event;
|
||||
u64 submit_command;
|
||||
u64 get_active_pcr_banks;
|
||||
u64 set_active_pcr_banks;
|
||||
u64 get_result_of_set_active_pcr_banks;
|
||||
} efi_tcg2_protocol_64_t;
|
||||
|
||||
typedef u32 efi_tcg2_event_log_format;
|
||||
|
||||
typedef struct {
|
||||
void *get_capability;
|
||||
efi_status_t (*get_event_log)(efi_handle_t, efi_tcg2_event_log_format,
|
||||
efi_physical_addr_t *, efi_physical_addr_t *, efi_bool_t *);
|
||||
void *hash_log_extend_event;
|
||||
void *submit_command;
|
||||
void *get_active_pcr_banks;
|
||||
void *set_active_pcr_banks;
|
||||
void *get_result_of_set_active_pcr_banks;
|
||||
} efi_tcg2_protocol_t;
|
||||
|
||||
/*
|
||||
* Types and defines for EFI ResetSystem
|
||||
*/
|
||||
@@ -625,6 +658,7 @@ void efi_native_runtime_setup(void);
|
||||
#define EFI_MEMORY_ATTRIBUTES_TABLE_GUID EFI_GUID(0xdcfa911d, 0x26eb, 0x469f, 0xa2, 0x20, 0x38, 0xb7, 0xdc, 0x46, 0x12, 0x20)
|
||||
#define EFI_CONSOLE_OUT_DEVICE_GUID EFI_GUID(0xd3b36f2c, 0xd551, 0x11d4, 0x9a, 0x46, 0x00, 0x90, 0x27, 0x3f, 0xc1, 0x4d)
|
||||
#define APPLE_PROPERTIES_PROTOCOL_GUID EFI_GUID(0x91bd12fe, 0xf6c3, 0x44fb, 0xa5, 0xb7, 0x51, 0x22, 0xab, 0x30, 0x3a, 0xe0)
|
||||
#define EFI_TCG2_PROTOCOL_GUID EFI_GUID(0x607f766c, 0x7455, 0x42be, 0x93, 0x0b, 0xe4, 0xd7, 0x6d, 0xb2, 0x72, 0x0f)
|
||||
|
||||
#define EFI_IMAGE_SECURITY_DATABASE_GUID EFI_GUID(0xd719b2cb, 0x3d3a, 0x4596, 0xa3, 0xbc, 0xda, 0xd0, 0x0e, 0x67, 0x65, 0x6f)
|
||||
#define EFI_SHIM_LOCK_GUID EFI_GUID(0x605dab50, 0xe046, 0x4300, 0xab, 0xb6, 0x3d, 0xd8, 0x10, 0xdd, 0x8b, 0x23)
|
||||
@@ -637,6 +671,7 @@ void efi_native_runtime_setup(void);
|
||||
#define LINUX_EFI_ARM_SCREEN_INFO_TABLE_GUID EFI_GUID(0xe03fc20a, 0x85dc, 0x406e, 0xb9, 0x0e, 0x4a, 0xb5, 0x02, 0x37, 0x1d, 0x95)
|
||||
#define LINUX_EFI_LOADER_ENTRY_GUID EFI_GUID(0x4a67b082, 0x0a4c, 0x41cf, 0xb6, 0xc7, 0x44, 0x0b, 0x29, 0xbb, 0x8c, 0x4f)
|
||||
#define LINUX_EFI_RANDOM_SEED_TABLE_GUID EFI_GUID(0x1ce1e5bc, 0x7ceb, 0x42f2, 0x81, 0xe5, 0x8a, 0xad, 0xf1, 0x80, 0xf5, 0x7b)
|
||||
#define LINUX_EFI_TPM_EVENT_LOG_GUID EFI_GUID(0xb7799cb0, 0xeca2, 0x4943, 0x96, 0x67, 0x1f, 0xae, 0x07, 0xb7, 0x47, 0xfa)
|
||||
|
||||
typedef struct {
|
||||
efi_guid_t guid;
|
||||
@@ -911,6 +946,7 @@ extern struct efi {
|
||||
unsigned long properties_table; /* properties table */
|
||||
unsigned long mem_attr_table; /* memory attributes table */
|
||||
unsigned long rng_seed; /* UEFI firmware random seed */
|
||||
unsigned long tpm_log; /* TPM2 Event Log table */
|
||||
efi_get_time_t *get_time;
|
||||
efi_set_time_t *set_time;
|
||||
efi_get_wakeup_time_t *get_wakeup_time;
|
||||
@@ -1536,6 +1572,8 @@ static inline void
|
||||
efi_enable_reset_attack_mitigation(efi_system_table_t *sys_table_arg) { }
|
||||
#endif
|
||||
|
||||
void efi_retrieve_tpm2_eventlog(efi_system_table_t *sys_table);
|
||||
|
||||
/*
|
||||
* Arch code can implement the following three template macros, avoiding
|
||||
* reptition for the void/non-void return cases of {__,}efi_call_virt():
|
||||
@@ -1603,4 +1641,12 @@ struct linux_efi_random_seed {
|
||||
u8 bits[];
|
||||
};
|
||||
|
||||
struct linux_efi_tpm_eventlog {
|
||||
u32 size;
|
||||
u8 version;
|
||||
u8 log[];
|
||||
};
|
||||
|
||||
extern int efi_tpm_eventlog_init(void);
|
||||
|
||||
#endif /* _LINUX_EFI_H */
|
||||
|
27
include/linux/error-injection.h
Normal file
27
include/linux/error-injection.h
Normal file
@@ -0,0 +1,27 @@
|
||||
/* SPDX-License-Identifier: GPL-2.0 */
|
||||
#ifndef _LINUX_ERROR_INJECTION_H
|
||||
#define _LINUX_ERROR_INJECTION_H
|
||||
|
||||
#ifdef CONFIG_FUNCTION_ERROR_INJECTION
|
||||
|
||||
#include <asm/error-injection.h>
|
||||
|
||||
extern bool within_error_injection_list(unsigned long addr);
|
||||
extern int get_injectable_error_type(unsigned long addr);
|
||||
|
||||
#else /* !CONFIG_FUNCTION_ERROR_INJECTION */
|
||||
|
||||
#include <asm-generic/error-injection.h>
|
||||
static inline bool within_error_injection_list(unsigned long addr)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
static inline int get_injectable_error_type(unsigned long addr)
|
||||
{
|
||||
return EI_ETYPE_NONE;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#endif /* _LINUX_ERROR_INJECTION_H */
|
@@ -1,6 +1,6 @@
|
||||
/* SPDX-License-Identifier: GPL-2.0 */
|
||||
/*
|
||||
* See Documentation/errseq.rst and lib/errseq.c
|
||||
* See Documentation/core-api/errseq.rst and lib/errseq.c
|
||||
*/
|
||||
#ifndef _LINUX_ERRSEQ_H
|
||||
#define _LINUX_ERRSEQ_H
|
||||
|
@@ -31,7 +31,7 @@
|
||||
#ifdef __KERNEL__
|
||||
struct device;
|
||||
int eth_platform_get_mac_address(struct device *dev, u8 *mac_addr);
|
||||
unsigned char *arch_get_platform_get_mac_address(void);
|
||||
unsigned char *arch_get_platform_mac_address(void);
|
||||
u32 eth_get_headlen(void *data, unsigned int max_len);
|
||||
__be16 eth_type_trans(struct sk_buff *skb, struct net_device *dev);
|
||||
extern const struct header_ops eth_header_ops;
|
||||
|
@@ -26,18 +26,16 @@
|
||||
#define EFD_SHARED_FCNTL_FLAGS (O_CLOEXEC | O_NONBLOCK)
|
||||
#define EFD_FLAGS_SET (EFD_SHARED_FCNTL_FLAGS | EFD_SEMAPHORE)
|
||||
|
||||
struct eventfd_ctx;
|
||||
struct file;
|
||||
|
||||
#ifdef CONFIG_EVENTFD
|
||||
|
||||
struct file *eventfd_file_create(unsigned int count, int flags);
|
||||
struct eventfd_ctx *eventfd_ctx_get(struct eventfd_ctx *ctx);
|
||||
void eventfd_ctx_put(struct eventfd_ctx *ctx);
|
||||
struct file *eventfd_fget(int fd);
|
||||
struct eventfd_ctx *eventfd_ctx_fdget(int fd);
|
||||
struct eventfd_ctx *eventfd_ctx_fileget(struct file *file);
|
||||
__u64 eventfd_signal(struct eventfd_ctx *ctx, __u64 n);
|
||||
ssize_t eventfd_ctx_read(struct eventfd_ctx *ctx, int no_wait, __u64 *cnt);
|
||||
int eventfd_ctx_remove_wait_queue(struct eventfd_ctx *ctx, wait_queue_entry_t *wait,
|
||||
__u64 *cnt);
|
||||
|
||||
@@ -47,10 +45,6 @@ int eventfd_ctx_remove_wait_queue(struct eventfd_ctx *ctx, wait_queue_entry_t *w
|
||||
* Ugly ugly ugly error layer to support modules that uses eventfd but
|
||||
* pretend to work in !CONFIG_EVENTFD configurations. Namely, AIO.
|
||||
*/
|
||||
static inline struct file *eventfd_file_create(unsigned int count, int flags)
|
||||
{
|
||||
return ERR_PTR(-ENOSYS);
|
||||
}
|
||||
|
||||
static inline struct eventfd_ctx *eventfd_ctx_fdget(int fd)
|
||||
{
|
||||
@@ -67,12 +61,6 @@ static inline void eventfd_ctx_put(struct eventfd_ctx *ctx)
|
||||
|
||||
}
|
||||
|
||||
static inline ssize_t eventfd_ctx_read(struct eventfd_ctx *ctx, int no_wait,
|
||||
__u64 *cnt)
|
||||
{
|
||||
return -ENOSYS;
|
||||
}
|
||||
|
||||
static inline int eventfd_ctx_remove_wait_queue(struct eventfd_ctx *ctx,
|
||||
wait_queue_entry_t *wait, __u64 *cnt)
|
||||
{
|
||||
|
@@ -117,6 +117,7 @@ struct f2fs_super_block {
|
||||
/*
|
||||
* For checkpoint
|
||||
*/
|
||||
#define CP_NOCRC_RECOVERY_FLAG 0x00000200
|
||||
#define CP_TRIMMED_FLAG 0x00000100
|
||||
#define CP_NAT_BITS_FLAG 0x00000080
|
||||
#define CP_CRC_RECOVERY_FLAG 0x00000040
|
||||
@@ -212,6 +213,7 @@ struct f2fs_extent {
|
||||
#define F2FS_DATA_EXIST 0x08 /* file inline data exist flag */
|
||||
#define F2FS_INLINE_DOTS 0x10 /* file having implicit dot dentries */
|
||||
#define F2FS_EXTRA_ATTR 0x20 /* file having extra attribute */
|
||||
#define F2FS_PIN_FILE 0x40 /* file should not be gced */
|
||||
|
||||
struct f2fs_inode {
|
||||
__le16 i_mode; /* file mode */
|
||||
@@ -229,7 +231,13 @@ struct f2fs_inode {
|
||||
__le32 i_ctime_nsec; /* change time in nano scale */
|
||||
__le32 i_mtime_nsec; /* modification time in nano scale */
|
||||
__le32 i_generation; /* file version (for NFS) */
|
||||
__le32 i_current_depth; /* only for directory depth */
|
||||
union {
|
||||
__le32 i_current_depth; /* only for directory depth */
|
||||
__le16 i_gc_failures; /*
|
||||
* # of gc failures on pinned file.
|
||||
* only for regular files.
|
||||
*/
|
||||
};
|
||||
__le32 i_xattr_nid; /* nid to save xattr */
|
||||
__le32 i_flags; /* file attributes */
|
||||
__le32 i_pino; /* parent inode number */
|
||||
@@ -245,8 +253,10 @@ struct f2fs_inode {
|
||||
__le16 i_inline_xattr_size; /* inline xattr size, unit: 4 bytes */
|
||||
__le32 i_projid; /* project id */
|
||||
__le32 i_inode_checksum;/* inode meta checksum */
|
||||
__le64 i_crtime; /* creation time */
|
||||
__le32 i_crtime_nsec; /* creation time in nano scale */
|
||||
__le32 i_extra_end[0]; /* for attribute size calculation */
|
||||
};
|
||||
} __packed;
|
||||
__le32 i_addr[DEF_ADDRS_PER_INODE]; /* Pointers to data blocks */
|
||||
};
|
||||
__le32 i_nid[DEF_NIDS_PER_INODE]; /* direct(2), indirect(2),
|
||||
|
@@ -465,6 +465,11 @@ struct fb_info {
|
||||
atomic_t count;
|
||||
int node;
|
||||
int flags;
|
||||
/*
|
||||
* -1 by default, set to a FB_ROTATE_* value by the driver, if it knows
|
||||
* a lcd is not mounted upright and fbcon should rotate to compensate.
|
||||
*/
|
||||
int fbcon_rotate_hint;
|
||||
struct mutex lock; /* Lock for open/release/ioctl funcs */
|
||||
struct mutex mm_lock; /* Lock for fb_mmap and smem_* fields */
|
||||
struct fb_var_screeninfo var; /* Current var */
|
||||
@@ -564,7 +569,10 @@ static inline struct apertures_struct *alloc_apertures(unsigned int max_num) {
|
||||
#define fb_memcpy_fromfb sbus_memcpy_fromio
|
||||
#define fb_memcpy_tofb sbus_memcpy_toio
|
||||
|
||||
#elif defined(__i386__) || defined(__alpha__) || defined(__x86_64__) || defined(__hppa__) || defined(__sh__) || defined(__powerpc__) || defined(__avr32__) || defined(__bfin__) || defined(__arm__)
|
||||
#elif defined(__i386__) || defined(__alpha__) || defined(__x86_64__) || \
|
||||
defined(__hppa__) || defined(__sh__) || defined(__powerpc__) || \
|
||||
defined(__avr32__) || defined(__bfin__) || defined(__arm__) || \
|
||||
defined(__aarch64__)
|
||||
|
||||
#define fb_readb __raw_readb
|
||||
#define fb_readw __raw_readw
|
||||
|
@@ -10,6 +10,7 @@
|
||||
#include <linux/compiler.h>
|
||||
#include <linux/spinlock.h>
|
||||
#include <linux/rcupdate.h>
|
||||
#include <linux/nospec.h>
|
||||
#include <linux/types.h>
|
||||
#include <linux/init.h>
|
||||
#include <linux/fs.h>
|
||||
@@ -82,8 +83,10 @@ static inline struct file *__fcheck_files(struct files_struct *files, unsigned i
|
||||
{
|
||||
struct fdtable *fdt = rcu_dereference_raw(files->fdt);
|
||||
|
||||
if (fd < fdt->max_fds)
|
||||
if (fd < fdt->max_fds) {
|
||||
fd = array_index_nospec(fd, fdt->max_fds);
|
||||
return rcu_dereference_raw(fdt->fd[fd]);
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
@@ -18,7 +18,9 @@
|
||||
#include <linux/capability.h>
|
||||
#include <linux/cryptohash.h>
|
||||
#include <linux/set_memory.h>
|
||||
#include <linux/kallsyms.h>
|
||||
|
||||
#include <net/xdp.h>
|
||||
#include <net/sch_generic.h>
|
||||
|
||||
#include <uapi/linux/filter.h>
|
||||
@@ -58,6 +60,9 @@ struct bpf_prog_aux;
|
||||
/* unused opcode to mark special call to bpf_tail_call() helper */
|
||||
#define BPF_TAIL_CALL 0xf0
|
||||
|
||||
/* unused opcode to mark call to interpreter with arguments */
|
||||
#define BPF_CALL_ARGS 0xe0
|
||||
|
||||
/* As per nm, we expose JITed images as text (code) section for
|
||||
* kallsyms. That way, tools like perf can find it to match
|
||||
* addresses.
|
||||
@@ -455,10 +460,14 @@ struct bpf_binary_header {
|
||||
struct bpf_prog {
|
||||
u16 pages; /* Number of allocated pages */
|
||||
u16 jited:1, /* Is our filter JIT'ed? */
|
||||
jit_requested:1,/* archs need to JIT the prog */
|
||||
locked:1, /* Program image locked? */
|
||||
gpl_compatible:1, /* Is filter GPL compatible? */
|
||||
cb_access:1, /* Is control block accessed? */
|
||||
dst_needed:1; /* Do we need dst entry? */
|
||||
dst_needed:1, /* Do we need dst entry? */
|
||||
blinded:1, /* Was blinded */
|
||||
is_func:1, /* program is a bpf function */
|
||||
kprobe_override:1; /* Do we override a kprobe? */
|
||||
enum bpf_prog_type type; /* Type of BPF program */
|
||||
u32 len; /* Number of filter blocks */
|
||||
u32 jited_len; /* Size of jited insns in bytes */
|
||||
@@ -495,6 +504,7 @@ struct xdp_buff {
|
||||
void *data_end;
|
||||
void *data_meta;
|
||||
void *data_hard_start;
|
||||
struct xdp_rxq_info *rxq;
|
||||
};
|
||||
|
||||
/* Compute the linear packet data range [data, data_end) which
|
||||
@@ -678,6 +688,8 @@ static inline int sk_filter(struct sock *sk, struct sk_buff *skb)
|
||||
struct bpf_prog *bpf_prog_select_runtime(struct bpf_prog *fp, int *err);
|
||||
void bpf_prog_free(struct bpf_prog *fp);
|
||||
|
||||
bool bpf_opcode_in_insntable(u8 code);
|
||||
|
||||
struct bpf_prog *bpf_prog_alloc(unsigned int size, gfp_t gfp_extra_flags);
|
||||
struct bpf_prog *bpf_prog_realloc(struct bpf_prog *fp_old, unsigned int size,
|
||||
gfp_t gfp_extra_flags);
|
||||
@@ -709,11 +721,22 @@ bool sk_filter_charge(struct sock *sk, struct sk_filter *fp);
|
||||
void sk_filter_uncharge(struct sock *sk, struct sk_filter *fp);
|
||||
|
||||
u64 __bpf_call_base(u64 r1, u64 r2, u64 r3, u64 r4, u64 r5);
|
||||
#define __bpf_call_base_args \
|
||||
((u64 (*)(u64, u64, u64, u64, u64, const struct bpf_insn *)) \
|
||||
__bpf_call_base)
|
||||
|
||||
struct bpf_prog *bpf_int_jit_compile(struct bpf_prog *prog);
|
||||
void bpf_jit_compile(struct bpf_prog *prog);
|
||||
bool bpf_helper_changes_pkt_data(void *func);
|
||||
|
||||
static inline bool bpf_dump_raw_ok(void)
|
||||
{
|
||||
/* Reconstruction of call-sites is dependent on kallsyms,
|
||||
* thus make dump the same restriction.
|
||||
*/
|
||||
return kallsyms_show_value() == 1;
|
||||
}
|
||||
|
||||
struct bpf_prog *bpf_patch_insn_single(struct bpf_prog *prog, u32 off,
|
||||
const struct bpf_insn *patch, u32 len);
|
||||
|
||||
@@ -797,7 +820,7 @@ static inline bool bpf_prog_ebpf_jited(const struct bpf_prog *fp)
|
||||
return fp->jited && bpf_jit_is_ebpf();
|
||||
}
|
||||
|
||||
static inline bool bpf_jit_blinding_enabled(void)
|
||||
static inline bool bpf_jit_blinding_enabled(struct bpf_prog *prog)
|
||||
{
|
||||
/* These are the prerequisites, should someone ever have the
|
||||
* idea to call blinding outside of them, we make sure to
|
||||
@@ -805,7 +828,7 @@ static inline bool bpf_jit_blinding_enabled(void)
|
||||
*/
|
||||
if (!bpf_jit_is_ebpf())
|
||||
return false;
|
||||
if (!bpf_jit_enable)
|
||||
if (!prog->jit_requested)
|
||||
return false;
|
||||
if (!bpf_jit_harden)
|
||||
return false;
|
||||
@@ -982,9 +1005,20 @@ struct bpf_sock_ops_kern {
|
||||
struct sock *sk;
|
||||
u32 op;
|
||||
union {
|
||||
u32 args[4];
|
||||
u32 reply;
|
||||
u32 replylong[4];
|
||||
};
|
||||
u32 is_fullsock;
|
||||
u64 temp; /* temp and everything after is not
|
||||
* initialized to 0 before calling
|
||||
* the BPF program. New fields that
|
||||
* should be initialized to 0 should
|
||||
* be inserted before temp.
|
||||
* temp is scratch storage used by
|
||||
* sock_ops_convert_ctx_access
|
||||
* as temporary storage of a register.
|
||||
*/
|
||||
};
|
||||
|
||||
#endif /* __LINUX_FILTER_H__ */
|
||||
|
@@ -1,10 +1,11 @@
|
||||
/* SPDX-License-Identifier: GPL-2.0 */
|
||||
#include <linux/device.h>
|
||||
#include <linux/fpga/fpga-mgr.h>
|
||||
|
||||
#ifndef _LINUX_FPGA_BRIDGE_H
|
||||
#define _LINUX_FPGA_BRIDGE_H
|
||||
|
||||
#include <linux/device.h>
|
||||
#include <linux/fpga/fpga-mgr.h>
|
||||
|
||||
struct fpga_bridge;
|
||||
|
||||
/**
|
||||
@@ -12,11 +13,13 @@ struct fpga_bridge;
|
||||
* @enable_show: returns the FPGA bridge's status
|
||||
* @enable_set: set a FPGA bridge as enabled or disabled
|
||||
* @fpga_bridge_remove: set FPGA into a specific state during driver remove
|
||||
* @groups: optional attribute groups.
|
||||
*/
|
||||
struct fpga_bridge_ops {
|
||||
int (*enable_show)(struct fpga_bridge *bridge);
|
||||
int (*enable_set)(struct fpga_bridge *bridge, bool enable);
|
||||
void (*fpga_bridge_remove)(struct fpga_bridge *bridge);
|
||||
const struct attribute_group **groups;
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -43,6 +46,8 @@ struct fpga_bridge {
|
||||
|
||||
struct fpga_bridge *of_fpga_bridge_get(struct device_node *node,
|
||||
struct fpga_image_info *info);
|
||||
struct fpga_bridge *fpga_bridge_get(struct device *dev,
|
||||
struct fpga_image_info *info);
|
||||
void fpga_bridge_put(struct fpga_bridge *bridge);
|
||||
int fpga_bridge_enable(struct fpga_bridge *bridge);
|
||||
int fpga_bridge_disable(struct fpga_bridge *bridge);
|
||||
@@ -50,9 +55,12 @@ int fpga_bridge_disable(struct fpga_bridge *bridge);
|
||||
int fpga_bridges_enable(struct list_head *bridge_list);
|
||||
int fpga_bridges_disable(struct list_head *bridge_list);
|
||||
void fpga_bridges_put(struct list_head *bridge_list);
|
||||
int fpga_bridge_get_to_list(struct device_node *np,
|
||||
int fpga_bridge_get_to_list(struct device *dev,
|
||||
struct fpga_image_info *info,
|
||||
struct list_head *bridge_list);
|
||||
int of_fpga_bridge_get_to_list(struct device_node *np,
|
||||
struct fpga_image_info *info,
|
||||
struct list_head *bridge_list);
|
||||
|
||||
int fpga_bridge_register(struct device *dev, const char *name,
|
||||
const struct fpga_bridge_ops *br_ops, void *priv);
|
||||
|
@@ -1,7 +1,8 @@
|
||||
/*
|
||||
* FPGA Framework
|
||||
*
|
||||
* Copyright (C) 2013-2015 Altera Corporation
|
||||
* Copyright (C) 2013-2016 Altera Corporation
|
||||
* Copyright (C) 2017 Intel Corporation
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms and conditions of the GNU General Public License,
|
||||
@@ -15,12 +16,12 @@
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#include <linux/mutex.h>
|
||||
#include <linux/platform_device.h>
|
||||
|
||||
#ifndef _LINUX_FPGA_MGR_H
|
||||
#define _LINUX_FPGA_MGR_H
|
||||
|
||||
#include <linux/mutex.h>
|
||||
#include <linux/platform_device.h>
|
||||
|
||||
struct fpga_manager;
|
||||
struct sg_table;
|
||||
|
||||
@@ -83,12 +84,26 @@ enum fpga_mgr_states {
|
||||
* @disable_timeout_us: maximum time to disable traffic through bridge (uSec)
|
||||
* @config_complete_timeout_us: maximum time for FPGA to switch to operating
|
||||
* status in the write_complete op.
|
||||
* @firmware_name: name of FPGA image firmware file
|
||||
* @sgt: scatter/gather table containing FPGA image
|
||||
* @buf: contiguous buffer containing FPGA image
|
||||
* @count: size of buf
|
||||
* @dev: device that owns this
|
||||
* @overlay: Device Tree overlay
|
||||
*/
|
||||
struct fpga_image_info {
|
||||
u32 flags;
|
||||
u32 enable_timeout_us;
|
||||
u32 disable_timeout_us;
|
||||
u32 config_complete_timeout_us;
|
||||
char *firmware_name;
|
||||
struct sg_table *sgt;
|
||||
const char *buf;
|
||||
size_t count;
|
||||
struct device *dev;
|
||||
#ifdef CONFIG_OF
|
||||
struct device_node *overlay;
|
||||
#endif
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -100,6 +115,7 @@ struct fpga_image_info {
|
||||
* @write_sg: write the scatter list of configuration data to the FPGA
|
||||
* @write_complete: set FPGA to operating state after writing is done
|
||||
* @fpga_remove: optional: Set FPGA into a specific state during driver remove
|
||||
* @groups: optional attribute groups.
|
||||
*
|
||||
* fpga_manager_ops are the low level functions implemented by a specific
|
||||
* fpga manager driver. The optional ones are tested for NULL before being
|
||||
@@ -116,6 +132,7 @@ struct fpga_manager_ops {
|
||||
int (*write_complete)(struct fpga_manager *mgr,
|
||||
struct fpga_image_info *info);
|
||||
void (*fpga_remove)(struct fpga_manager *mgr);
|
||||
const struct attribute_group **groups;
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -138,14 +155,14 @@ struct fpga_manager {
|
||||
|
||||
#define to_fpga_manager(d) container_of(d, struct fpga_manager, dev)
|
||||
|
||||
int fpga_mgr_buf_load(struct fpga_manager *mgr, struct fpga_image_info *info,
|
||||
const char *buf, size_t count);
|
||||
int fpga_mgr_buf_load_sg(struct fpga_manager *mgr, struct fpga_image_info *info,
|
||||
struct sg_table *sgt);
|
||||
struct fpga_image_info *fpga_image_info_alloc(struct device *dev);
|
||||
|
||||
int fpga_mgr_firmware_load(struct fpga_manager *mgr,
|
||||
struct fpga_image_info *info,
|
||||
const char *image_name);
|
||||
void fpga_image_info_free(struct fpga_image_info *info);
|
||||
|
||||
int fpga_mgr_load(struct fpga_manager *mgr, struct fpga_image_info *info);
|
||||
|
||||
int fpga_mgr_lock(struct fpga_manager *mgr);
|
||||
void fpga_mgr_unlock(struct fpga_manager *mgr);
|
||||
|
||||
struct fpga_manager *of_fpga_mgr_get(struct device_node *node);
|
||||
|
||||
|
40
include/linux/fpga/fpga-region.h
Normal file
40
include/linux/fpga/fpga-region.h
Normal file
@@ -0,0 +1,40 @@
|
||||
#ifndef _FPGA_REGION_H
|
||||
#define _FPGA_REGION_H
|
||||
|
||||
#include <linux/device.h>
|
||||
#include <linux/fpga/fpga-mgr.h>
|
||||
#include <linux/fpga/fpga-bridge.h>
|
||||
|
||||
/**
|
||||
* struct fpga_region - FPGA Region structure
|
||||
* @dev: FPGA Region device
|
||||
* @mutex: enforces exclusive reference to region
|
||||
* @bridge_list: list of FPGA bridges specified in region
|
||||
* @mgr: FPGA manager
|
||||
* @info: FPGA image info
|
||||
* @priv: private data
|
||||
* @get_bridges: optional function to get bridges to a list
|
||||
* @groups: optional attribute groups.
|
||||
*/
|
||||
struct fpga_region {
|
||||
struct device dev;
|
||||
struct mutex mutex; /* for exclusive reference to region */
|
||||
struct list_head bridge_list;
|
||||
struct fpga_manager *mgr;
|
||||
struct fpga_image_info *info;
|
||||
void *priv;
|
||||
int (*get_bridges)(struct fpga_region *region);
|
||||
const struct attribute_group **groups;
|
||||
};
|
||||
|
||||
#define to_fpga_region(d) container_of(d, struct fpga_region, dev)
|
||||
|
||||
struct fpga_region *fpga_region_class_find(
|
||||
struct device *start, const void *data,
|
||||
int (*match)(struct device *, const void *));
|
||||
|
||||
int fpga_region_program_fpga(struct fpga_region *region);
|
||||
int fpga_region_register(struct device *dev, struct fpga_region *region);
|
||||
int fpga_region_unregister(struct fpga_region *region);
|
||||
|
||||
#endif /* _FPGA_REGION_H */
|
@@ -748,6 +748,11 @@ static inline void inode_lock_nested(struct inode *inode, unsigned subclass)
|
||||
down_write_nested(&inode->i_rwsem, subclass);
|
||||
}
|
||||
|
||||
static inline void inode_lock_shared_nested(struct inode *inode, unsigned subclass)
|
||||
{
|
||||
down_read_nested(&inode->i_rwsem, subclass);
|
||||
}
|
||||
|
||||
void lock_two_nondirectories(struct inode *, struct inode*);
|
||||
void unlock_two_nondirectories(struct inode *, struct inode*);
|
||||
|
||||
@@ -1359,7 +1364,7 @@ struct super_block {
|
||||
|
||||
const struct fscrypt_operations *s_cop;
|
||||
|
||||
struct hlist_bl_head s_anon; /* anonymous dentries for (nfs) exporting */
|
||||
struct hlist_bl_head s_roots; /* alternate root dentries for NFS */
|
||||
struct list_head s_mounts; /* list of mounts; _not_ for fs use */
|
||||
struct block_device *s_bdev;
|
||||
struct backing_dev_info *s_bdi;
|
||||
@@ -1608,6 +1613,10 @@ extern int vfs_whiteout(struct inode *, struct dentry *);
|
||||
extern struct dentry *vfs_tmpfile(struct dentry *dentry, umode_t mode,
|
||||
int open_flag);
|
||||
|
||||
int vfs_mkobj(struct dentry *, umode_t,
|
||||
int (*f)(struct dentry *, umode_t, void *),
|
||||
void *);
|
||||
|
||||
/*
|
||||
* VFS file helper functions.
|
||||
*/
|
||||
@@ -1698,7 +1707,7 @@ struct file_operations {
|
||||
ssize_t (*write_iter) (struct kiocb *, struct iov_iter *);
|
||||
int (*iterate) (struct file *, struct dir_context *);
|
||||
int (*iterate_shared) (struct file *, struct dir_context *);
|
||||
unsigned int (*poll) (struct file *, struct poll_table_struct *);
|
||||
__poll_t (*poll) (struct file *, struct poll_table_struct *);
|
||||
long (*unlocked_ioctl) (struct file *, unsigned int, unsigned long);
|
||||
long (*compat_ioctl) (struct file *, unsigned int, unsigned long);
|
||||
int (*mmap) (struct file *, struct vm_area_struct *);
|
||||
@@ -2684,7 +2693,6 @@ extern sector_t bmap(struct inode *, sector_t);
|
||||
#endif
|
||||
extern int notify_change(struct dentry *, struct iattr *, struct inode **);
|
||||
extern int inode_permission(struct inode *, int);
|
||||
extern int __inode_permission(struct inode *, int);
|
||||
extern int generic_permission(struct inode *, int);
|
||||
extern int __check_sticky(struct inode *dir, struct inode *inode);
|
||||
|
||||
@@ -2977,6 +2985,7 @@ enum {
|
||||
};
|
||||
|
||||
void dio_end_io(struct bio *bio);
|
||||
void dio_warn_stale_pagecache(struct file *filp);
|
||||
|
||||
ssize_t __blockdev_direct_IO(struct kiocb *iocb, struct inode *inode,
|
||||
struct block_device *bdev, struct iov_iter *iter,
|
||||
@@ -3224,6 +3233,8 @@ static inline int kiocb_set_rw_flags(struct kiocb *ki, rwf_t flags)
|
||||
ki->ki_flags |= IOCB_DSYNC;
|
||||
if (flags & RWF_SYNC)
|
||||
ki->ki_flags |= (IOCB_DSYNC | IOCB_SYNC);
|
||||
if (flags & RWF_APPEND)
|
||||
ki->ki_flags |= IOCB_APPEND;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@@ -14,42 +14,13 @@
|
||||
#ifndef _LINUX_FSCRYPT_H
|
||||
#define _LINUX_FSCRYPT_H
|
||||
|
||||
#include <linux/key.h>
|
||||
#include <linux/fs.h>
|
||||
#include <linux/mm.h>
|
||||
#include <linux/bio.h>
|
||||
#include <linux/dcache.h>
|
||||
#include <crypto/skcipher.h>
|
||||
#include <uapi/linux/fs.h>
|
||||
|
||||
#define FS_CRYPTO_BLOCK_SIZE 16
|
||||
|
||||
struct fscrypt_ctx;
|
||||
struct fscrypt_info;
|
||||
|
||||
struct fscrypt_ctx {
|
||||
union {
|
||||
struct {
|
||||
struct page *bounce_page; /* Ciphertext page */
|
||||
struct page *control_page; /* Original page */
|
||||
} w;
|
||||
struct {
|
||||
struct bio *bio;
|
||||
struct work_struct work;
|
||||
} r;
|
||||
struct list_head free_list; /* Free list */
|
||||
};
|
||||
u8 flags; /* Flags */
|
||||
};
|
||||
|
||||
/**
|
||||
* For encrypted symlinks, the ciphertext length is stored at the beginning
|
||||
* of the string in little-endian format.
|
||||
*/
|
||||
struct fscrypt_symlink_data {
|
||||
__le16 len;
|
||||
char encrypted_path[1];
|
||||
} __packed;
|
||||
|
||||
struct fscrypt_str {
|
||||
unsigned char *name;
|
||||
u32 len;
|
||||
@@ -68,89 +39,14 @@ struct fscrypt_name {
|
||||
#define fname_name(p) ((p)->disk_name.name)
|
||||
#define fname_len(p) ((p)->disk_name.len)
|
||||
|
||||
/*
|
||||
* fscrypt superblock flags
|
||||
*/
|
||||
#define FS_CFLG_OWN_PAGES (1U << 1)
|
||||
|
||||
/*
|
||||
* crypto opertions for filesystems
|
||||
*/
|
||||
struct fscrypt_operations {
|
||||
unsigned int flags;
|
||||
const char *key_prefix;
|
||||
int (*get_context)(struct inode *, void *, size_t);
|
||||
int (*set_context)(struct inode *, const void *, size_t, void *);
|
||||
bool (*dummy_context)(struct inode *);
|
||||
bool (*empty_dir)(struct inode *);
|
||||
unsigned (*max_namelen)(struct inode *);
|
||||
};
|
||||
|
||||
/* Maximum value for the third parameter of fscrypt_operations.set_context(). */
|
||||
#define FSCRYPT_SET_CONTEXT_MAX_SIZE 28
|
||||
|
||||
static inline bool fscrypt_dummy_context_enabled(struct inode *inode)
|
||||
{
|
||||
if (inode->i_sb->s_cop->dummy_context &&
|
||||
inode->i_sb->s_cop->dummy_context(inode))
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
static inline bool fscrypt_valid_enc_modes(u32 contents_mode,
|
||||
u32 filenames_mode)
|
||||
{
|
||||
if (contents_mode == FS_ENCRYPTION_MODE_AES_128_CBC &&
|
||||
filenames_mode == FS_ENCRYPTION_MODE_AES_128_CTS)
|
||||
return true;
|
||||
|
||||
if (contents_mode == FS_ENCRYPTION_MODE_AES_256_XTS &&
|
||||
filenames_mode == FS_ENCRYPTION_MODE_AES_256_CTS)
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
static inline bool fscrypt_is_dot_dotdot(const struct qstr *str)
|
||||
{
|
||||
if (str->len == 1 && str->name[0] == '.')
|
||||
return true;
|
||||
|
||||
if (str->len == 2 && str->name[0] == '.' && str->name[1] == '.')
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
#if __FS_HAS_ENCRYPTION
|
||||
|
||||
static inline struct page *fscrypt_control_page(struct page *page)
|
||||
{
|
||||
return ((struct fscrypt_ctx *)page_private(page))->w.control_page;
|
||||
}
|
||||
|
||||
static inline bool fscrypt_has_encryption_key(const struct inode *inode)
|
||||
{
|
||||
return (inode->i_crypt_info != NULL);
|
||||
}
|
||||
|
||||
#include <linux/fscrypt_supp.h>
|
||||
|
||||
#else /* !__FS_HAS_ENCRYPTION */
|
||||
|
||||
static inline struct page *fscrypt_control_page(struct page *page)
|
||||
{
|
||||
WARN_ON_ONCE(1);
|
||||
return ERR_PTR(-EINVAL);
|
||||
}
|
||||
|
||||
static inline bool fscrypt_has_encryption_key(const struct inode *inode)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
#else
|
||||
#include <linux/fscrypt_notsupp.h>
|
||||
#endif /* __FS_HAS_ENCRYPTION */
|
||||
#endif
|
||||
|
||||
/**
|
||||
* fscrypt_require_key - require an inode's encryption key
|
||||
@@ -291,4 +187,68 @@ static inline int fscrypt_prepare_setattr(struct dentry *dentry,
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* fscrypt_prepare_symlink - prepare to create a possibly-encrypted symlink
|
||||
* @dir: directory in which the symlink is being created
|
||||
* @target: plaintext symlink target
|
||||
* @len: length of @target excluding null terminator
|
||||
* @max_len: space the filesystem has available to store the symlink target
|
||||
* @disk_link: (out) the on-disk symlink target being prepared
|
||||
*
|
||||
* This function computes the size the symlink target will require on-disk,
|
||||
* stores it in @disk_link->len, and validates it against @max_len. An
|
||||
* encrypted symlink may be longer than the original.
|
||||
*
|
||||
* Additionally, @disk_link->name is set to @target if the symlink will be
|
||||
* unencrypted, but left NULL if the symlink will be encrypted. For encrypted
|
||||
* symlinks, the filesystem must call fscrypt_encrypt_symlink() to create the
|
||||
* on-disk target later. (The reason for the two-step process is that some
|
||||
* filesystems need to know the size of the symlink target before creating the
|
||||
* inode, e.g. to determine whether it will be a "fast" or "slow" symlink.)
|
||||
*
|
||||
* Return: 0 on success, -ENAMETOOLONG if the symlink target is too long,
|
||||
* -ENOKEY if the encryption key is missing, or another -errno code if a problem
|
||||
* occurred while setting up the encryption key.
|
||||
*/
|
||||
static inline int fscrypt_prepare_symlink(struct inode *dir,
|
||||
const char *target,
|
||||
unsigned int len,
|
||||
unsigned int max_len,
|
||||
struct fscrypt_str *disk_link)
|
||||
{
|
||||
if (IS_ENCRYPTED(dir) || fscrypt_dummy_context_enabled(dir))
|
||||
return __fscrypt_prepare_symlink(dir, len, max_len, disk_link);
|
||||
|
||||
disk_link->name = (unsigned char *)target;
|
||||
disk_link->len = len + 1;
|
||||
if (disk_link->len > max_len)
|
||||
return -ENAMETOOLONG;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* fscrypt_encrypt_symlink - encrypt the symlink target if needed
|
||||
* @inode: symlink inode
|
||||
* @target: plaintext symlink target
|
||||
* @len: length of @target excluding null terminator
|
||||
* @disk_link: (in/out) the on-disk symlink target being prepared
|
||||
*
|
||||
* If the symlink target needs to be encrypted, then this function encrypts it
|
||||
* into @disk_link->name. fscrypt_prepare_symlink() must have been called
|
||||
* previously to compute @disk_link->len. If the filesystem did not allocate a
|
||||
* buffer for @disk_link->name after calling fscrypt_prepare_link(), then one
|
||||
* will be kmalloc()'ed and the filesystem will be responsible for freeing it.
|
||||
*
|
||||
* Return: 0 on success, -errno on failure
|
||||
*/
|
||||
static inline int fscrypt_encrypt_symlink(struct inode *inode,
|
||||
const char *target,
|
||||
unsigned int len,
|
||||
struct fscrypt_str *disk_link)
|
||||
{
|
||||
if (IS_ENCRYPTED(inode))
|
||||
return __fscrypt_encrypt_symlink(inode, target, len, disk_link);
|
||||
return 0;
|
||||
}
|
||||
|
||||
#endif /* _LINUX_FSCRYPT_H */
|
||||
|
@@ -14,6 +14,16 @@
|
||||
#ifndef _LINUX_FSCRYPT_NOTSUPP_H
|
||||
#define _LINUX_FSCRYPT_NOTSUPP_H
|
||||
|
||||
static inline bool fscrypt_has_encryption_key(const struct inode *inode)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
static inline bool fscrypt_dummy_context_enabled(struct inode *inode)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
/* crypto.c */
|
||||
static inline struct fscrypt_ctx *fscrypt_get_ctx(const struct inode *inode,
|
||||
gfp_t gfp_flags)
|
||||
@@ -43,6 +53,11 @@ static inline int fscrypt_decrypt_page(const struct inode *inode,
|
||||
return -EOPNOTSUPP;
|
||||
}
|
||||
|
||||
static inline struct page *fscrypt_control_page(struct page *page)
|
||||
{
|
||||
WARN_ON_ONCE(1);
|
||||
return ERR_PTR(-EINVAL);
|
||||
}
|
||||
|
||||
static inline void fscrypt_restore_control_page(struct page *page)
|
||||
{
|
||||
@@ -90,8 +105,7 @@ static inline int fscrypt_get_encryption_info(struct inode *inode)
|
||||
return -EOPNOTSUPP;
|
||||
}
|
||||
|
||||
static inline void fscrypt_put_encryption_info(struct inode *inode,
|
||||
struct fscrypt_info *ci)
|
||||
static inline void fscrypt_put_encryption_info(struct inode *inode)
|
||||
{
|
||||
return;
|
||||
}
|
||||
@@ -116,16 +130,8 @@ static inline void fscrypt_free_filename(struct fscrypt_name *fname)
|
||||
return;
|
||||
}
|
||||
|
||||
static inline u32 fscrypt_fname_encrypted_size(const struct inode *inode,
|
||||
u32 ilen)
|
||||
{
|
||||
/* never happens */
|
||||
WARN_ON(1);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static inline int fscrypt_fname_alloc_buffer(const struct inode *inode,
|
||||
u32 ilen,
|
||||
u32 max_encrypted_len,
|
||||
struct fscrypt_str *crypto_str)
|
||||
{
|
||||
return -EOPNOTSUPP;
|
||||
@@ -144,13 +150,6 @@ static inline int fscrypt_fname_disk_to_usr(struct inode *inode,
|
||||
return -EOPNOTSUPP;
|
||||
}
|
||||
|
||||
static inline int fscrypt_fname_usr_to_disk(struct inode *inode,
|
||||
const struct qstr *iname,
|
||||
struct fscrypt_str *oname)
|
||||
{
|
||||
return -EOPNOTSUPP;
|
||||
}
|
||||
|
||||
static inline bool fscrypt_match_name(const struct fscrypt_name *fname,
|
||||
const u8 *de_name, u32 de_name_len)
|
||||
{
|
||||
@@ -208,4 +207,28 @@ static inline int __fscrypt_prepare_lookup(struct inode *dir,
|
||||
return -EOPNOTSUPP;
|
||||
}
|
||||
|
||||
static inline int __fscrypt_prepare_symlink(struct inode *dir,
|
||||
unsigned int len,
|
||||
unsigned int max_len,
|
||||
struct fscrypt_str *disk_link)
|
||||
{
|
||||
return -EOPNOTSUPP;
|
||||
}
|
||||
|
||||
static inline int __fscrypt_encrypt_symlink(struct inode *inode,
|
||||
const char *target,
|
||||
unsigned int len,
|
||||
struct fscrypt_str *disk_link)
|
||||
{
|
||||
return -EOPNOTSUPP;
|
||||
}
|
||||
|
||||
static inline const char *fscrypt_get_symlink(struct inode *inode,
|
||||
const void *caddr,
|
||||
unsigned int max_size,
|
||||
struct delayed_call *done)
|
||||
{
|
||||
return ERR_PTR(-EOPNOTSUPP);
|
||||
}
|
||||
|
||||
#endif /* _LINUX_FSCRYPT_NOTSUPP_H */
|
||||
|
@@ -11,8 +11,54 @@
|
||||
#ifndef _LINUX_FSCRYPT_SUPP_H
|
||||
#define _LINUX_FSCRYPT_SUPP_H
|
||||
|
||||
#include <linux/mm.h>
|
||||
#include <linux/slab.h>
|
||||
|
||||
/*
|
||||
* fscrypt superblock flags
|
||||
*/
|
||||
#define FS_CFLG_OWN_PAGES (1U << 1)
|
||||
|
||||
/*
|
||||
* crypto operations for filesystems
|
||||
*/
|
||||
struct fscrypt_operations {
|
||||
unsigned int flags;
|
||||
const char *key_prefix;
|
||||
int (*get_context)(struct inode *, void *, size_t);
|
||||
int (*set_context)(struct inode *, const void *, size_t, void *);
|
||||
bool (*dummy_context)(struct inode *);
|
||||
bool (*empty_dir)(struct inode *);
|
||||
unsigned (*max_namelen)(struct inode *);
|
||||
};
|
||||
|
||||
struct fscrypt_ctx {
|
||||
union {
|
||||
struct {
|
||||
struct page *bounce_page; /* Ciphertext page */
|
||||
struct page *control_page; /* Original page */
|
||||
} w;
|
||||
struct {
|
||||
struct bio *bio;
|
||||
struct work_struct work;
|
||||
} r;
|
||||
struct list_head free_list; /* Free list */
|
||||
};
|
||||
u8 flags; /* Flags */
|
||||
};
|
||||
|
||||
static inline bool fscrypt_has_encryption_key(const struct inode *inode)
|
||||
{
|
||||
return (inode->i_crypt_info != NULL);
|
||||
}
|
||||
|
||||
static inline bool fscrypt_dummy_context_enabled(struct inode *inode)
|
||||
{
|
||||
return inode->i_sb->s_cop->dummy_context &&
|
||||
inode->i_sb->s_cop->dummy_context(inode);
|
||||
}
|
||||
|
||||
/* crypto.c */
|
||||
extern struct kmem_cache *fscrypt_info_cachep;
|
||||
extern struct fscrypt_ctx *fscrypt_get_ctx(const struct inode *, gfp_t);
|
||||
extern void fscrypt_release_ctx(struct fscrypt_ctx *);
|
||||
extern struct page *fscrypt_encrypt_page(const struct inode *, struct page *,
|
||||
@@ -20,6 +66,12 @@ extern struct page *fscrypt_encrypt_page(const struct inode *, struct page *,
|
||||
u64, gfp_t);
|
||||
extern int fscrypt_decrypt_page(const struct inode *, struct page *, unsigned int,
|
||||
unsigned int, u64);
|
||||
|
||||
static inline struct page *fscrypt_control_page(struct page *page)
|
||||
{
|
||||
return ((struct fscrypt_ctx *)page_private(page))->w.control_page;
|
||||
}
|
||||
|
||||
extern void fscrypt_restore_control_page(struct page *);
|
||||
|
||||
extern const struct dentry_operations fscrypt_d_ops;
|
||||
@@ -44,7 +96,7 @@ extern int fscrypt_inherit_context(struct inode *, struct inode *,
|
||||
void *, bool);
|
||||
/* keyinfo.c */
|
||||
extern int fscrypt_get_encryption_info(struct inode *);
|
||||
extern void fscrypt_put_encryption_info(struct inode *, struct fscrypt_info *);
|
||||
extern void fscrypt_put_encryption_info(struct inode *);
|
||||
|
||||
/* fname.c */
|
||||
extern int fscrypt_setup_filename(struct inode *, const struct qstr *,
|
||||
@@ -55,14 +107,11 @@ static inline void fscrypt_free_filename(struct fscrypt_name *fname)
|
||||
kfree(fname->crypto_buf.name);
|
||||
}
|
||||
|
||||
extern u32 fscrypt_fname_encrypted_size(const struct inode *, u32);
|
||||
extern int fscrypt_fname_alloc_buffer(const struct inode *, u32,
|
||||
struct fscrypt_str *);
|
||||
extern void fscrypt_fname_free_buffer(struct fscrypt_str *);
|
||||
extern int fscrypt_fname_disk_to_usr(struct inode *, u32, u32,
|
||||
const struct fscrypt_str *, struct fscrypt_str *);
|
||||
extern int fscrypt_fname_usr_to_disk(struct inode *, const struct qstr *,
|
||||
struct fscrypt_str *);
|
||||
|
||||
#define FSCRYPT_FNAME_MAX_UNDIGESTED_SIZE 32
|
||||
|
||||
@@ -153,5 +202,14 @@ extern int __fscrypt_prepare_rename(struct inode *old_dir,
|
||||
struct dentry *new_dentry,
|
||||
unsigned int flags);
|
||||
extern int __fscrypt_prepare_lookup(struct inode *dir, struct dentry *dentry);
|
||||
extern int __fscrypt_prepare_symlink(struct inode *dir, unsigned int len,
|
||||
unsigned int max_len,
|
||||
struct fscrypt_str *disk_link);
|
||||
extern int __fscrypt_encrypt_symlink(struct inode *inode, const char *target,
|
||||
unsigned int len,
|
||||
struct fscrypt_str *disk_link);
|
||||
extern const char *fscrypt_get_symlink(struct inode *inode, const void *caddr,
|
||||
unsigned int max_size,
|
||||
struct delayed_call *done);
|
||||
|
||||
#endif /* _LINUX_FSCRYPT_SUPP_H */
|
||||
|
@@ -15,6 +15,7 @@
|
||||
#include <linux/types.h>
|
||||
|
||||
struct fwnode_operations;
|
||||
struct device;
|
||||
|
||||
struct fwnode_handle {
|
||||
struct fwnode_handle *secondary;
|
||||
@@ -51,6 +52,7 @@ struct fwnode_reference_args {
|
||||
* struct fwnode_operations - Operations for fwnode interface
|
||||
* @get: Get a reference to an fwnode.
|
||||
* @put: Put a reference to an fwnode.
|
||||
* @device_get_match_data: Return the device driver match data.
|
||||
* @property_present: Return true if a property is present.
|
||||
* @property_read_integer_array: Read an array of integer properties. Return
|
||||
* zero on success, a negative error code
|
||||
@@ -71,6 +73,8 @@ struct fwnode_operations {
|
||||
struct fwnode_handle *(*get)(struct fwnode_handle *fwnode);
|
||||
void (*put)(struct fwnode_handle *fwnode);
|
||||
bool (*device_is_available)(const struct fwnode_handle *fwnode);
|
||||
void *(*device_get_match_data)(const struct fwnode_handle *fwnode,
|
||||
const struct device *dev);
|
||||
bool (*property_present)(const struct fwnode_handle *fwnode,
|
||||
const char *propname);
|
||||
int (*property_read_int_array)(const struct fwnode_handle *fwnode,
|
||||
|
@@ -2,6 +2,7 @@
|
||||
#ifndef GENL_MAGIC_FUNC_H
|
||||
#define GENL_MAGIC_FUNC_H
|
||||
|
||||
#include <linux/build_bug.h>
|
||||
#include <linux/genl_magic_struct.h>
|
||||
|
||||
/*
|
||||
@@ -132,17 +133,6 @@ static void dprint_array(const char *dir, int nla_type,
|
||||
* use one static buffer for parsing of nested attributes */
|
||||
static struct nlattr *nested_attr_tb[128];
|
||||
|
||||
#ifndef BUILD_BUG_ON
|
||||
/* Force a compilation error if condition is true */
|
||||
#define BUILD_BUG_ON(condition) ((void)BUILD_BUG_ON_ZERO(condition))
|
||||
/* Force a compilation error if condition is true, but also produce a
|
||||
result (of value 0 and type size_t), so the expression can be used
|
||||
e.g. in a structure initializer (or where-ever else comma expressions
|
||||
aren't permitted). */
|
||||
#define BUILD_BUG_ON_ZERO(e) (sizeof(struct { int:-!!(e); }))
|
||||
#define BUILD_BUG_ON_NULL(e) ((void *)sizeof(struct { int:-!!(e); }))
|
||||
#endif
|
||||
|
||||
#undef GENL_struct
|
||||
#define GENL_struct(tag_name, tag_number, s_name, s_fields) \
|
||||
/* *_from_attrs functions are static, but potentially unused */ \
|
||||
|
@@ -1,4 +1,14 @@
|
||||
/* SPDX-License-Identifier: GPL-2.0 */
|
||||
/*
|
||||
* <linux/gpio.h>
|
||||
*
|
||||
* This is the LEGACY GPIO bulk include file, including legacy APIs. It is
|
||||
* used for GPIO drivers still referencing the global GPIO numberspace,
|
||||
* and should not be included in new code.
|
||||
*
|
||||
* If you're implementing a GPIO driver, only include <linux/gpio/driver.h>
|
||||
* If you're implementing a GPIO consumer, only include <linux/gpio/consumer.h>
|
||||
*/
|
||||
#ifndef __LINUX_GPIO_H
|
||||
#define __LINUX_GPIO_H
|
||||
|
||||
|
@@ -139,6 +139,7 @@ void gpiod_set_raw_array_value_cansleep(unsigned int array_size,
|
||||
int *value_array);
|
||||
|
||||
int gpiod_set_debounce(struct gpio_desc *desc, unsigned debounce);
|
||||
int gpiod_set_transitory(struct gpio_desc *desc, bool transitory);
|
||||
|
||||
int gpiod_is_active_low(const struct gpio_desc *desc);
|
||||
int gpiod_cansleep(const struct gpio_desc *desc);
|
||||
@@ -150,8 +151,14 @@ struct gpio_desc *gpio_to_desc(unsigned gpio);
|
||||
int desc_to_gpio(const struct gpio_desc *desc);
|
||||
|
||||
/* Child properties interface */
|
||||
struct device_node;
|
||||
struct fwnode_handle;
|
||||
|
||||
struct gpio_desc *devm_gpiod_get_from_of_node(struct device *dev,
|
||||
struct device_node *node,
|
||||
const char *propname, int index,
|
||||
enum gpiod_flags dflags,
|
||||
const char *label);
|
||||
struct gpio_desc *fwnode_get_named_gpiod(struct fwnode_handle *fwnode,
|
||||
const char *propname, int index,
|
||||
enum gpiod_flags dflags,
|
||||
@@ -431,6 +438,13 @@ static inline int gpiod_set_debounce(struct gpio_desc *desc, unsigned debounce)
|
||||
return -ENOSYS;
|
||||
}
|
||||
|
||||
static inline int gpiod_set_transitory(struct gpio_desc *desc, bool transitory)
|
||||
{
|
||||
/* GPIO can never have been requested */
|
||||
WARN_ON(1);
|
||||
return -ENOSYS;
|
||||
}
|
||||
|
||||
static inline int gpiod_is_active_low(const struct gpio_desc *desc)
|
||||
{
|
||||
/* GPIO can never have been requested */
|
||||
@@ -464,8 +478,19 @@ static inline int desc_to_gpio(const struct gpio_desc *desc)
|
||||
}
|
||||
|
||||
/* Child properties interface */
|
||||
struct device_node;
|
||||
struct fwnode_handle;
|
||||
|
||||
static inline
|
||||
struct gpio_desc *devm_gpiod_get_from_of_node(struct device *dev,
|
||||
struct device_node *node,
|
||||
const char *propname, int index,
|
||||
enum gpiod_flags dflags,
|
||||
const char *label)
|
||||
{
|
||||
return ERR_PTR(-ENOSYS);
|
||||
}
|
||||
|
||||
static inline
|
||||
struct gpio_desc *fwnode_get_named_gpiod(struct fwnode_handle *fwnode,
|
||||
const char *propname, int index,
|
||||
|
@@ -436,6 +436,9 @@ int gpiochip_irqchip_add_key(struct gpio_chip *gpiochip,
|
||||
struct lock_class_key *lock_key,
|
||||
struct lock_class_key *request_key);
|
||||
|
||||
bool gpiochip_irqchip_irq_valid(const struct gpio_chip *gpiochip,
|
||||
unsigned int offset);
|
||||
|
||||
#ifdef CONFIG_LOCKDEP
|
||||
|
||||
/*
|
||||
|
@@ -10,8 +10,8 @@ enum gpio_lookup_flags {
|
||||
GPIO_ACTIVE_LOW = (1 << 0),
|
||||
GPIO_OPEN_DRAIN = (1 << 1),
|
||||
GPIO_OPEN_SOURCE = (1 << 2),
|
||||
GPIO_SLEEP_MAINTAIN_VALUE = (0 << 3),
|
||||
GPIO_SLEEP_MAY_LOSE_VALUE = (1 << 3),
|
||||
GPIO_PERSISTENT = (0 << 3),
|
||||
GPIO_TRANSITORY = (1 << 3),
|
||||
};
|
||||
|
||||
/**
|
||||
|
@@ -281,6 +281,7 @@ struct hid_item {
|
||||
|
||||
#define HID_DG_DEVICECONFIG 0x000d000e
|
||||
#define HID_DG_DEVICESETTINGS 0x000d0023
|
||||
#define HID_DG_AZIMUTH 0x000d003f
|
||||
#define HID_DG_CONFIDENCE 0x000d0047
|
||||
#define HID_DG_WIDTH 0x000d0048
|
||||
#define HID_DG_HEIGHT 0x000d0049
|
||||
@@ -342,6 +343,7 @@ struct hid_item {
|
||||
#define HID_QUIRK_SKIP_OUTPUT_REPORTS 0x00010000
|
||||
#define HID_QUIRK_SKIP_OUTPUT_REPORT_ID 0x00020000
|
||||
#define HID_QUIRK_NO_OUTPUT_REPORTS_ON_INTR_EP 0x00040000
|
||||
#define HID_QUIRK_HAVE_SPECIAL_DRIVER 0x00080000
|
||||
#define HID_QUIRK_FULLSPEED_INTERVAL 0x10000000
|
||||
#define HID_QUIRK_NO_INIT_REPORTS 0x20000000
|
||||
#define HID_QUIRK_NO_IGNORE 0x40000000
|
||||
@@ -671,6 +673,7 @@ struct hid_usage_id {
|
||||
* to be called)
|
||||
* @dyn_list: list of dynamically added device ids
|
||||
* @dyn_lock: lock protecting @dyn_list
|
||||
* @match: check if the given device is handled by this driver
|
||||
* @probe: new device inserted
|
||||
* @remove: device removed (NULL if not a hot-plug capable driver)
|
||||
* @report_table: on which reports to call raw_event (NULL means all)
|
||||
@@ -683,6 +686,8 @@ struct hid_usage_id {
|
||||
* @input_mapped: invoked on input registering after mapping an usage
|
||||
* @input_configured: invoked just before the device is registered
|
||||
* @feature_mapping: invoked on feature registering
|
||||
* @bus_add_driver: invoked when a HID driver is about to be added
|
||||
* @bus_removed_driver: invoked when a HID driver has been removed
|
||||
* @suspend: invoked on suspend (NULL means nop)
|
||||
* @resume: invoked on resume if device was not reset (NULL means nop)
|
||||
* @reset_resume: invoked on resume if device was reset (NULL means nop)
|
||||
@@ -711,6 +716,7 @@ struct hid_driver {
|
||||
struct list_head dyn_list;
|
||||
spinlock_t dyn_lock;
|
||||
|
||||
bool (*match)(struct hid_device *dev, bool ignore_special_driver);
|
||||
int (*probe)(struct hid_device *dev, const struct hid_device_id *id);
|
||||
void (*remove)(struct hid_device *dev);
|
||||
|
||||
@@ -736,6 +742,8 @@ struct hid_driver {
|
||||
void (*feature_mapping)(struct hid_device *hdev,
|
||||
struct hid_field *field,
|
||||
struct hid_usage *usage);
|
||||
void (*bus_add_driver)(struct hid_driver *driver);
|
||||
void (*bus_removed_driver)(struct hid_driver *driver);
|
||||
#ifdef CONFIG_PM
|
||||
int (*suspend)(struct hid_device *hdev, pm_message_t message);
|
||||
int (*resume)(struct hid_device *hdev);
|
||||
@@ -814,6 +822,8 @@ extern bool hid_ignore(struct hid_device *);
|
||||
extern int hid_add_device(struct hid_device *);
|
||||
extern void hid_destroy_device(struct hid_device *);
|
||||
|
||||
extern struct bus_type hid_bus_type;
|
||||
|
||||
extern int __must_check __hid_register_driver(struct hid_driver *,
|
||||
struct module *, const char *mod_name);
|
||||
|
||||
@@ -860,8 +870,12 @@ int hid_open_report(struct hid_device *device);
|
||||
int hid_check_keys_pressed(struct hid_device *hid);
|
||||
int hid_connect(struct hid_device *hid, unsigned int connect_mask);
|
||||
void hid_disconnect(struct hid_device *hid);
|
||||
const struct hid_device_id *hid_match_id(struct hid_device *hdev,
|
||||
bool hid_match_one_id(const struct hid_device *hdev,
|
||||
const struct hid_device_id *id);
|
||||
const struct hid_device_id *hid_match_id(const struct hid_device *hdev,
|
||||
const struct hid_device_id *id);
|
||||
const struct hid_device_id *hid_match_device(struct hid_device *hdev,
|
||||
struct hid_driver *hdrv);
|
||||
s32 hid_snto32(__u32 value, unsigned n);
|
||||
__u32 hid_field_extract(const struct hid_device *hid, __u8 *report,
|
||||
unsigned offset, unsigned n);
|
||||
@@ -1098,9 +1112,9 @@ int hid_report_raw_event(struct hid_device *hid, int type, u8 *data, int size,
|
||||
int interrupt);
|
||||
|
||||
/* HID quirks API */
|
||||
u32 usbhid_lookup_quirk(const u16 idVendor, const u16 idProduct);
|
||||
int usbhid_quirks_init(char **quirks_param);
|
||||
void usbhid_quirks_exit(void);
|
||||
unsigned long hid_lookup_quirk(const struct hid_device *hdev);
|
||||
int hid_quirks_init(char **quirks_param, __u16 bus, int count);
|
||||
void hid_quirks_exit(__u16 bus);
|
||||
|
||||
#ifdef CONFIG_HID_PID
|
||||
int hid_pidff_init(struct hid_device *hid);
|
||||
|
@@ -144,12 +144,12 @@ struct hil_mlc {
|
||||
hil_packet ipacket[16];
|
||||
hil_packet imatch;
|
||||
int icount;
|
||||
struct timeval instart;
|
||||
suseconds_t intimeout;
|
||||
unsigned long instart;
|
||||
unsigned long intimeout;
|
||||
|
||||
int ddi; /* Last operational device id */
|
||||
int lcv; /* LCV to throttle loops */
|
||||
struct timeval lcv_tv; /* Time loop was started */
|
||||
time64_t lcv_time; /* Time loop was started */
|
||||
|
||||
int di_map[7]; /* Maps below items to live devs */
|
||||
struct hil_mlc_devinfo di[HIL_MLC_DEVMEM];
|
||||
|
@@ -281,7 +281,7 @@ typedef struct {
|
||||
hp_sdc_transaction *tq[HP_SDC_QUEUE_LEN]; /* All pending read/writes */
|
||||
|
||||
int rcurr, rqty; /* Current read transact in process */
|
||||
struct timeval rtv; /* Time when current read started */
|
||||
ktime_t rtime; /* Time when current read started */
|
||||
int wcurr; /* Current write transact in process */
|
||||
|
||||
int dev_err; /* carries status from registration */
|
||||
|
@@ -119,6 +119,7 @@ long hugetlb_unreserve_pages(struct inode *inode, long start, long end,
|
||||
long freed);
|
||||
bool isolate_huge_page(struct page *page, struct list_head *list);
|
||||
void putback_active_hugepage(struct page *page);
|
||||
void move_hugetlb_state(struct page *oldpage, struct page *newpage, int reason);
|
||||
void free_huge_page(struct page *page);
|
||||
void hugetlb_fix_reserve_counts(struct inode *inode);
|
||||
extern struct mutex *hugetlb_fault_mutex_table;
|
||||
@@ -129,7 +130,6 @@ u32 hugetlb_fault_mutex_hash(struct hstate *h, struct mm_struct *mm,
|
||||
|
||||
pte_t *huge_pmd_share(struct mm_struct *mm, unsigned long addr, pud_t *pud);
|
||||
|
||||
extern int hugepages_treat_as_movable;
|
||||
extern int sysctl_hugetlb_shm_group;
|
||||
extern struct list_head huge_boot_pages;
|
||||
|
||||
@@ -158,6 +158,7 @@ unsigned long hugetlb_change_protection(struct vm_area_struct *vma,
|
||||
unsigned long address, unsigned long end, pgprot_t newprot);
|
||||
|
||||
bool is_hugetlb_entry_migration(pte_t pte);
|
||||
|
||||
#else /* !CONFIG_HUGETLB_PAGE */
|
||||
|
||||
static inline void reset_vma_resv_huge_pages(struct vm_area_struct *vma)
|
||||
@@ -198,6 +199,7 @@ static inline bool isolate_huge_page(struct page *page, struct list_head *list)
|
||||
return false;
|
||||
}
|
||||
#define putback_active_hugepage(p) do {} while (0)
|
||||
#define move_hugetlb_state(old, new, reason) do {} while (0)
|
||||
|
||||
static inline unsigned long hugetlb_change_protection(struct vm_area_struct *vma,
|
||||
unsigned long address, unsigned long end, pgprot_t newprot)
|
||||
@@ -271,6 +273,17 @@ static inline struct hugetlbfs_sb_info *HUGETLBFS_SB(struct super_block *sb)
|
||||
return sb->s_fs_info;
|
||||
}
|
||||
|
||||
struct hugetlbfs_inode_info {
|
||||
struct shared_policy policy;
|
||||
struct inode vfs_inode;
|
||||
unsigned int seals;
|
||||
};
|
||||
|
||||
static inline struct hugetlbfs_inode_info *HUGETLBFS_I(struct inode *inode)
|
||||
{
|
||||
return container_of(inode, struct hugetlbfs_inode_info, vfs_inode);
|
||||
}
|
||||
|
||||
extern const struct file_operations hugetlbfs_file_operations;
|
||||
extern const struct vm_operations_struct hugetlb_vm_ops;
|
||||
struct file *hugetlb_file_setup(const char *name, size_t size, vm_flags_t acct,
|
||||
@@ -343,10 +356,10 @@ struct huge_bootmem_page {
|
||||
struct page *alloc_huge_page(struct vm_area_struct *vma,
|
||||
unsigned long addr, int avoid_reserve);
|
||||
struct page *alloc_huge_page_node(struct hstate *h, int nid);
|
||||
struct page *alloc_huge_page_noerr(struct vm_area_struct *vma,
|
||||
unsigned long addr, int avoid_reserve);
|
||||
struct page *alloc_huge_page_nodemask(struct hstate *h, int preferred_nid,
|
||||
nodemask_t *nmask);
|
||||
struct page *alloc_huge_page_vma(struct hstate *h, struct vm_area_struct *vma,
|
||||
unsigned long address);
|
||||
int huge_add_to_page_cache(struct page *page, struct address_space *mapping,
|
||||
pgoff_t idx);
|
||||
|
||||
@@ -524,7 +537,7 @@ struct hstate {};
|
||||
#define alloc_huge_page(v, a, r) NULL
|
||||
#define alloc_huge_page_node(h, nid) NULL
|
||||
#define alloc_huge_page_nodemask(h, preferred_nid, nmask) NULL
|
||||
#define alloc_huge_page_noerr(v, a, r) NULL
|
||||
#define alloc_huge_page_vma(h, vma, address) NULL
|
||||
#define alloc_bootmem_huge_page(h) NULL
|
||||
#define hstate_file(f) NULL
|
||||
#define hstate_sizelog(s) NULL
|
||||
|
@@ -127,28 +127,6 @@ struct hv_ring_buffer_info {
|
||||
u32 priv_read_index;
|
||||
};
|
||||
|
||||
/*
|
||||
*
|
||||
* hv_get_ringbuffer_availbytes()
|
||||
*
|
||||
* Get number of bytes available to read and to write to
|
||||
* for the specified ring buffer
|
||||
*/
|
||||
static inline void
|
||||
hv_get_ringbuffer_availbytes(const struct hv_ring_buffer_info *rbi,
|
||||
u32 *read, u32 *write)
|
||||
{
|
||||
u32 read_loc, write_loc, dsize;
|
||||
|
||||
/* Capture the read/write indices before they changed */
|
||||
read_loc = rbi->ring_buffer->read_index;
|
||||
write_loc = rbi->ring_buffer->write_index;
|
||||
dsize = rbi->ring_datasize;
|
||||
|
||||
*write = write_loc >= read_loc ? dsize - (write_loc - read_loc) :
|
||||
read_loc - write_loc;
|
||||
*read = dsize - *write;
|
||||
}
|
||||
|
||||
static inline u32 hv_get_bytes_to_read(const struct hv_ring_buffer_info *rbi)
|
||||
{
|
||||
|
@@ -55,7 +55,7 @@ typedef int (*i2c_slave_cb_t)(struct i2c_client *, enum i2c_slave_event, u8 *);
|
||||
struct module;
|
||||
struct property_entry;
|
||||
|
||||
#if defined(CONFIG_I2C) || defined(CONFIG_I2C_MODULE)
|
||||
#if IS_ENABLED(CONFIG_I2C)
|
||||
/*
|
||||
* The master routines are the ones normally used to transmit data to devices
|
||||
* on a bus (or read from them). Apart from two basic transfer functions to
|
||||
@@ -63,10 +63,68 @@ struct property_entry;
|
||||
* transmit an arbitrary number of messages without interruption.
|
||||
* @count must be be less than 64k since msg.len is u16.
|
||||
*/
|
||||
extern int i2c_master_send(const struct i2c_client *client, const char *buf,
|
||||
int count);
|
||||
extern int i2c_master_recv(const struct i2c_client *client, char *buf,
|
||||
int count);
|
||||
extern int i2c_transfer_buffer_flags(const struct i2c_client *client,
|
||||
char *buf, int count, u16 flags);
|
||||
|
||||
/**
|
||||
* i2c_master_recv - issue a single I2C message in master receive mode
|
||||
* @client: Handle to slave device
|
||||
* @buf: Where to store data read from slave
|
||||
* @count: How many bytes to read, must be less than 64k since msg.len is u16
|
||||
*
|
||||
* Returns negative errno, or else the number of bytes read.
|
||||
*/
|
||||
static inline int i2c_master_recv(const struct i2c_client *client,
|
||||
char *buf, int count)
|
||||
{
|
||||
return i2c_transfer_buffer_flags(client, buf, count, I2C_M_RD);
|
||||
};
|
||||
|
||||
/**
|
||||
* i2c_master_recv_dmasafe - issue a single I2C message in master receive mode
|
||||
* using a DMA safe buffer
|
||||
* @client: Handle to slave device
|
||||
* @buf: Where to store data read from slave, must be safe to use with DMA
|
||||
* @count: How many bytes to read, must be less than 64k since msg.len is u16
|
||||
*
|
||||
* Returns negative errno, or else the number of bytes read.
|
||||
*/
|
||||
static inline int i2c_master_recv_dmasafe(const struct i2c_client *client,
|
||||
char *buf, int count)
|
||||
{
|
||||
return i2c_transfer_buffer_flags(client, buf, count,
|
||||
I2C_M_RD | I2C_M_DMA_SAFE);
|
||||
};
|
||||
|
||||
/**
|
||||
* i2c_master_send - issue a single I2C message in master transmit mode
|
||||
* @client: Handle to slave device
|
||||
* @buf: Data that will be written to the slave
|
||||
* @count: How many bytes to write, must be less than 64k since msg.len is u16
|
||||
*
|
||||
* Returns negative errno, or else the number of bytes written.
|
||||
*/
|
||||
static inline int i2c_master_send(const struct i2c_client *client,
|
||||
const char *buf, int count)
|
||||
{
|
||||
return i2c_transfer_buffer_flags(client, (char *)buf, count, 0);
|
||||
};
|
||||
|
||||
/**
|
||||
* i2c_master_send_dmasafe - issue a single I2C message in master transmit mode
|
||||
* using a DMA safe buffer
|
||||
* @client: Handle to slave device
|
||||
* @buf: Data that will be written to the slave, must be safe to use with DMA
|
||||
* @count: How many bytes to write, must be less than 64k since msg.len is u16
|
||||
*
|
||||
* Returns negative errno, or else the number of bytes written.
|
||||
*/
|
||||
static inline int i2c_master_send_dmasafe(const struct i2c_client *client,
|
||||
const char *buf, int count)
|
||||
{
|
||||
return i2c_transfer_buffer_flags(client, (char *)buf, count,
|
||||
I2C_M_DMA_SAFE);
|
||||
};
|
||||
|
||||
/* Transfer num messages.
|
||||
*/
|
||||
@@ -354,7 +412,7 @@ struct i2c_board_info {
|
||||
.type = dev_type, .addr = (dev_addr)
|
||||
|
||||
|
||||
#if defined(CONFIG_I2C) || defined(CONFIG_I2C_MODULE)
|
||||
#if IS_ENABLED(CONFIG_I2C)
|
||||
/* Add-on boards should register/unregister their devices; e.g. a board
|
||||
* with integrated I2C, a config eeprom, sensors, and a codec that's
|
||||
* used in conjunction with the primary hardware.
|
||||
@@ -485,40 +543,43 @@ struct i2c_timings {
|
||||
/**
|
||||
* struct i2c_bus_recovery_info - I2C bus recovery information
|
||||
* @recover_bus: Recover routine. Either pass driver's recover_bus() routine, or
|
||||
* i2c_generic_scl_recovery() or i2c_generic_gpio_recovery().
|
||||
* i2c_generic_scl_recovery().
|
||||
* @get_scl: This gets current value of SCL line. Mandatory for generic SCL
|
||||
* recovery. Used internally for generic GPIO recovery.
|
||||
* @set_scl: This sets/clears SCL line. Mandatory for generic SCL recovery. Used
|
||||
* internally for generic GPIO recovery.
|
||||
* recovery. Populated internally for generic GPIO recovery.
|
||||
* @set_scl: This sets/clears the SCL line. Mandatory for generic SCL recovery.
|
||||
* Populated internally for generic GPIO recovery.
|
||||
* @get_sda: This gets current value of SDA line. Optional for generic SCL
|
||||
* recovery. Used internally, if sda_gpio is a valid GPIO, for generic GPIO
|
||||
* recovery.
|
||||
* recovery. Populated internally, if sda_gpio is a valid GPIO, for generic
|
||||
* GPIO recovery.
|
||||
* @set_sda: This sets/clears the SDA line. Optional for generic SCL recovery.
|
||||
* Populated internally, if sda_gpio is a valid GPIO, for generic GPIO
|
||||
* recovery.
|
||||
* @prepare_recovery: This will be called before starting recovery. Platform may
|
||||
* configure padmux here for SDA/SCL line or something else they want.
|
||||
* @unprepare_recovery: This will be called after completing recovery. Platform
|
||||
* may configure padmux here for SDA/SCL line or something else they want.
|
||||
* @scl_gpio: gpio number of the SCL line. Only required for GPIO recovery.
|
||||
* @sda_gpio: gpio number of the SDA line. Only required for GPIO recovery.
|
||||
* @scl_gpiod: gpiod of the SCL line. Only required for GPIO recovery.
|
||||
* @sda_gpiod: gpiod of the SDA line. Only required for GPIO recovery.
|
||||
*/
|
||||
struct i2c_bus_recovery_info {
|
||||
int (*recover_bus)(struct i2c_adapter *);
|
||||
int (*recover_bus)(struct i2c_adapter *adap);
|
||||
|
||||
int (*get_scl)(struct i2c_adapter *);
|
||||
void (*set_scl)(struct i2c_adapter *, int val);
|
||||
int (*get_sda)(struct i2c_adapter *);
|
||||
int (*get_scl)(struct i2c_adapter *adap);
|
||||
void (*set_scl)(struct i2c_adapter *adap, int val);
|
||||
int (*get_sda)(struct i2c_adapter *adap);
|
||||
void (*set_sda)(struct i2c_adapter *adap, int val);
|
||||
|
||||
void (*prepare_recovery)(struct i2c_adapter *);
|
||||
void (*unprepare_recovery)(struct i2c_adapter *);
|
||||
void (*prepare_recovery)(struct i2c_adapter *adap);
|
||||
void (*unprepare_recovery)(struct i2c_adapter *adap);
|
||||
|
||||
/* gpio recovery */
|
||||
int scl_gpio;
|
||||
int sda_gpio;
|
||||
struct gpio_desc *scl_gpiod;
|
||||
struct gpio_desc *sda_gpiod;
|
||||
};
|
||||
|
||||
int i2c_recover_bus(struct i2c_adapter *adap);
|
||||
|
||||
/* Generic recovery routines */
|
||||
int i2c_generic_gpio_recovery(struct i2c_adapter *adap);
|
||||
int i2c_generic_scl_recovery(struct i2c_adapter *adap);
|
||||
|
||||
/**
|
||||
@@ -706,7 +767,7 @@ i2c_unlock_adapter(struct i2c_adapter *adapter)
|
||||
|
||||
/* administration...
|
||||
*/
|
||||
#if defined(CONFIG_I2C) || defined(CONFIG_I2C_MODULE)
|
||||
#if IS_ENABLED(CONFIG_I2C)
|
||||
extern int i2c_add_adapter(struct i2c_adapter *);
|
||||
extern void i2c_del_adapter(struct i2c_adapter *);
|
||||
extern int i2c_add_numbered_adapter(struct i2c_adapter *);
|
||||
@@ -769,6 +830,9 @@ static inline u8 i2c_8bit_addr_from_msg(const struct i2c_msg *msg)
|
||||
return (msg->addr << 1) | (msg->flags & I2C_M_RD ? 1 : 0);
|
||||
}
|
||||
|
||||
u8 *i2c_get_dma_safe_msg_buf(struct i2c_msg *msg, unsigned int threshold);
|
||||
void i2c_release_dma_safe_msg_buf(struct i2c_msg *msg, u8 *buf);
|
||||
|
||||
int i2c_handle_smbus_host_notify(struct i2c_adapter *adap, unsigned short addr);
|
||||
/**
|
||||
* module_i2c_driver() - Helper macro for registering a modular I2C driver
|
||||
|
@@ -1,84 +0,0 @@
|
||||
/* SPDX-License-Identifier: GPL-2.0 */
|
||||
|
||||
#ifndef I7300_IDLE_H
|
||||
#define I7300_IDLE_H
|
||||
|
||||
#include <linux/pci.h>
|
||||
|
||||
/*
|
||||
* I/O AT controls (PCI bus 0 device 8 function 0)
|
||||
* DIMM controls (PCI bus 0 device 16 function 1)
|
||||
*/
|
||||
#define IOAT_BUS 0
|
||||
#define IOAT_DEVFN PCI_DEVFN(8, 0)
|
||||
#define MEMCTL_BUS 0
|
||||
#define MEMCTL_DEVFN PCI_DEVFN(16, 1)
|
||||
|
||||
struct fbd_ioat {
|
||||
unsigned int vendor;
|
||||
unsigned int ioat_dev;
|
||||
unsigned int enabled;
|
||||
};
|
||||
|
||||
/*
|
||||
* The i5000 chip-set has the same hooks as the i7300
|
||||
* but it is not enabled by default and must be manually
|
||||
* manually enabled with "forceload=1" because it is
|
||||
* only lightly validated.
|
||||
*/
|
||||
|
||||
static const struct fbd_ioat fbd_ioat_list[] = {
|
||||
{PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_IOAT_CNB, 1},
|
||||
{PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_IOAT, 0},
|
||||
{0, 0}
|
||||
};
|
||||
|
||||
/* table of devices that work with this driver */
|
||||
static const struct pci_device_id pci_tbl[] = {
|
||||
{ PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_FBD_CNB) },
|
||||
{ PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_5000_ERR) },
|
||||
{ } /* Terminating entry */
|
||||
};
|
||||
|
||||
/* Check for known platforms with I/O-AT */
|
||||
static inline int i7300_idle_platform_probe(struct pci_dev **fbd_dev,
|
||||
struct pci_dev **ioat_dev,
|
||||
int enable_all)
|
||||
{
|
||||
int i;
|
||||
struct pci_dev *memdev, *dmadev;
|
||||
|
||||
memdev = pci_get_bus_and_slot(MEMCTL_BUS, MEMCTL_DEVFN);
|
||||
if (!memdev)
|
||||
return -ENODEV;
|
||||
|
||||
for (i = 0; pci_tbl[i].vendor != 0; i++) {
|
||||
if (memdev->vendor == pci_tbl[i].vendor &&
|
||||
memdev->device == pci_tbl[i].device) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (pci_tbl[i].vendor == 0)
|
||||
return -ENODEV;
|
||||
|
||||
dmadev = pci_get_bus_and_slot(IOAT_BUS, IOAT_DEVFN);
|
||||
if (!dmadev)
|
||||
return -ENODEV;
|
||||
|
||||
for (i = 0; fbd_ioat_list[i].vendor != 0; i++) {
|
||||
if (dmadev->vendor == fbd_ioat_list[i].vendor &&
|
||||
dmadev->device == fbd_ioat_list[i].ioat_dev) {
|
||||
if (!(fbd_ioat_list[i].enabled || enable_all))
|
||||
continue;
|
||||
if (fbd_dev)
|
||||
*fbd_dev = memdev;
|
||||
if (ioat_dev)
|
||||
*ioat_dev = dmadev;
|
||||
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
return -ENODEV;
|
||||
}
|
||||
|
||||
#endif
|
@@ -15,10 +15,10 @@
|
||||
#include <linux/radix-tree.h>
|
||||
#include <linux/gfp.h>
|
||||
#include <linux/percpu.h>
|
||||
#include <linux/bug.h>
|
||||
|
||||
struct idr {
|
||||
struct radix_tree_root idr_rt;
|
||||
unsigned int idr_base;
|
||||
unsigned int idr_next;
|
||||
};
|
||||
|
||||
@@ -31,10 +31,26 @@ struct idr {
|
||||
/* Set the IDR flag and the IDR_FREE tag */
|
||||
#define IDR_RT_MARKER ((__force gfp_t)(3 << __GFP_BITS_SHIFT))
|
||||
|
||||
#define IDR_INIT \
|
||||
{ \
|
||||
.idr_rt = RADIX_TREE_INIT(IDR_RT_MARKER) \
|
||||
#define IDR_INIT_BASE(base) { \
|
||||
.idr_rt = RADIX_TREE_INIT(IDR_RT_MARKER), \
|
||||
.idr_base = (base), \
|
||||
.idr_next = 0, \
|
||||
}
|
||||
|
||||
/**
|
||||
* IDR_INIT() - Initialise an IDR.
|
||||
*
|
||||
* A freshly-initialised IDR contains no IDs.
|
||||
*/
|
||||
#define IDR_INIT IDR_INIT_BASE(0)
|
||||
|
||||
/**
|
||||
* DEFINE_IDR() - Define a statically-allocated IDR
|
||||
* @name: Name of IDR
|
||||
*
|
||||
* An IDR defined using this macro is ready for use with no additional
|
||||
* initialisation required. It contains no IDs.
|
||||
*/
|
||||
#define DEFINE_IDR(name) struct idr name = IDR_INIT
|
||||
|
||||
/**
|
||||
@@ -82,80 +98,52 @@ static inline void idr_set_cursor(struct idr *idr, unsigned int val)
|
||||
|
||||
void idr_preload(gfp_t gfp_mask);
|
||||
|
||||
int idr_alloc_cmn(struct idr *idr, void *ptr, unsigned long *index,
|
||||
unsigned long start, unsigned long end, gfp_t gfp,
|
||||
bool ext);
|
||||
|
||||
/**
|
||||
* idr_alloc - allocate an id
|
||||
* @idr: idr handle
|
||||
* @ptr: pointer to be associated with the new id
|
||||
* @start: the minimum id (inclusive)
|
||||
* @end: the maximum id (exclusive)
|
||||
* @gfp: memory allocation flags
|
||||
*
|
||||
* Allocates an unused ID in the range [start, end). Returns -ENOSPC
|
||||
* if there are no unused IDs in that range.
|
||||
*
|
||||
* Note that @end is treated as max when <= 0. This is to always allow
|
||||
* using @start + N as @end as long as N is inside integer range.
|
||||
*
|
||||
* Simultaneous modifications to the @idr are not allowed and should be
|
||||
* prevented by the user, usually with a lock. idr_alloc() may be called
|
||||
* concurrently with read-only accesses to the @idr, such as idr_find() and
|
||||
* idr_for_each_entry().
|
||||
*/
|
||||
static inline int idr_alloc(struct idr *idr, void *ptr,
|
||||
int start, int end, gfp_t gfp)
|
||||
{
|
||||
unsigned long id;
|
||||
int ret;
|
||||
|
||||
if (WARN_ON_ONCE(start < 0))
|
||||
return -EINVAL;
|
||||
|
||||
ret = idr_alloc_cmn(idr, ptr, &id, start, end, gfp, false);
|
||||
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
return id;
|
||||
}
|
||||
|
||||
static inline int idr_alloc_ext(struct idr *idr, void *ptr,
|
||||
unsigned long *index,
|
||||
unsigned long start,
|
||||
unsigned long end,
|
||||
gfp_t gfp)
|
||||
{
|
||||
return idr_alloc_cmn(idr, ptr, index, start, end, gfp, true);
|
||||
}
|
||||
|
||||
int idr_alloc_cyclic(struct idr *, void *entry, int start, int end, gfp_t);
|
||||
int idr_alloc(struct idr *, void *ptr, int start, int end, gfp_t);
|
||||
int __must_check idr_alloc_u32(struct idr *, void *ptr, u32 *id,
|
||||
unsigned long max, gfp_t);
|
||||
int idr_alloc_cyclic(struct idr *, void *ptr, int start, int end, gfp_t);
|
||||
void *idr_remove(struct idr *, unsigned long id);
|
||||
void *idr_find(const struct idr *, unsigned long id);
|
||||
int idr_for_each(const struct idr *,
|
||||
int (*fn)(int id, void *p, void *data), void *data);
|
||||
void *idr_get_next(struct idr *, int *nextid);
|
||||
void *idr_get_next_ext(struct idr *idr, unsigned long *nextid);
|
||||
void *idr_replace(struct idr *, void *, int id);
|
||||
void *idr_replace_ext(struct idr *idr, void *ptr, unsigned long id);
|
||||
void *idr_get_next_ul(struct idr *, unsigned long *nextid);
|
||||
void *idr_replace(struct idr *, void *, unsigned long id);
|
||||
void idr_destroy(struct idr *);
|
||||
|
||||
static inline void *idr_remove_ext(struct idr *idr, unsigned long id)
|
||||
{
|
||||
return radix_tree_delete_item(&idr->idr_rt, id, NULL);
|
||||
}
|
||||
|
||||
static inline void *idr_remove(struct idr *idr, int id)
|
||||
{
|
||||
return idr_remove_ext(idr, id);
|
||||
}
|
||||
|
||||
static inline void idr_init(struct idr *idr)
|
||||
/**
|
||||
* idr_init_base() - Initialise an IDR.
|
||||
* @idr: IDR handle.
|
||||
* @base: The base value for the IDR.
|
||||
*
|
||||
* This variation of idr_init() creates an IDR which will allocate IDs
|
||||
* starting at %base.
|
||||
*/
|
||||
static inline void idr_init_base(struct idr *idr, int base)
|
||||
{
|
||||
INIT_RADIX_TREE(&idr->idr_rt, IDR_RT_MARKER);
|
||||
idr->idr_base = base;
|
||||
idr->idr_next = 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* idr_init() - Initialise an IDR.
|
||||
* @idr: IDR handle.
|
||||
*
|
||||
* Initialise a dynamically allocated IDR. To initialise a
|
||||
* statically allocated IDR, use DEFINE_IDR().
|
||||
*/
|
||||
static inline void idr_init(struct idr *idr)
|
||||
{
|
||||
idr_init_base(idr, 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* idr_is_empty() - Are there any IDs allocated?
|
||||
* @idr: IDR handle.
|
||||
*
|
||||
* Return: %true if any IDs have been allocated from this IDR.
|
||||
*/
|
||||
static inline bool idr_is_empty(const struct idr *idr)
|
||||
{
|
||||
return radix_tree_empty(&idr->idr_rt) &&
|
||||
@@ -174,50 +162,38 @@ static inline void idr_preload_end(void)
|
||||
}
|
||||
|
||||
/**
|
||||
* idr_find - return pointer for given id
|
||||
* @idr: idr handle
|
||||
* @id: lookup key
|
||||
*
|
||||
* Return the pointer given the id it has been registered with. A %NULL
|
||||
* return indicates that @id is not valid or you passed %NULL in
|
||||
* idr_get_new().
|
||||
*
|
||||
* This function can be called under rcu_read_lock(), given that the leaf
|
||||
* pointers lifetimes are correctly managed.
|
||||
*/
|
||||
static inline void *idr_find_ext(const struct idr *idr, unsigned long id)
|
||||
{
|
||||
return radix_tree_lookup(&idr->idr_rt, id);
|
||||
}
|
||||
|
||||
static inline void *idr_find(const struct idr *idr, int id)
|
||||
{
|
||||
return idr_find_ext(idr, id);
|
||||
}
|
||||
|
||||
/**
|
||||
* idr_for_each_entry - iterate over an idr's elements of a given type
|
||||
* @idr: idr handle
|
||||
* @entry: the type * to use as cursor
|
||||
* @id: id entry's key
|
||||
* idr_for_each_entry() - Iterate over an IDR's elements of a given type.
|
||||
* @idr: IDR handle.
|
||||
* @entry: The type * to use as cursor
|
||||
* @id: Entry ID.
|
||||
*
|
||||
* @entry and @id do not need to be initialized before the loop, and
|
||||
* after normal terminatinon @entry is left with the value NULL. This
|
||||
* after normal termination @entry is left with the value NULL. This
|
||||
* is convenient for a "not found" value.
|
||||
*/
|
||||
#define idr_for_each_entry(idr, entry, id) \
|
||||
for (id = 0; ((entry) = idr_get_next(idr, &(id))) != NULL; ++id)
|
||||
#define idr_for_each_entry_ext(idr, entry, id) \
|
||||
for (id = 0; ((entry) = idr_get_next_ext(idr, &(id))) != NULL; ++id)
|
||||
|
||||
/**
|
||||
* idr_for_each_entry_continue - continue iteration over an idr's elements of a given type
|
||||
* @idr: idr handle
|
||||
* @entry: the type * to use as cursor
|
||||
* @id: id entry's key
|
||||
* idr_for_each_entry_ul() - Iterate over an IDR's elements of a given type.
|
||||
* @idr: IDR handle.
|
||||
* @entry: The type * to use as cursor.
|
||||
* @id: Entry ID.
|
||||
*
|
||||
* Continue to iterate over list of given type, continuing after
|
||||
* the current position.
|
||||
* @entry and @id do not need to be initialized before the loop, and
|
||||
* after normal termination @entry is left with the value NULL. This
|
||||
* is convenient for a "not found" value.
|
||||
*/
|
||||
#define idr_for_each_entry_ul(idr, entry, id) \
|
||||
for (id = 0; ((entry) = idr_get_next_ul(idr, &(id))) != NULL; ++id)
|
||||
|
||||
/**
|
||||
* idr_for_each_entry_continue() - Continue iteration over an IDR's elements of a given type
|
||||
* @idr: IDR handle.
|
||||
* @entry: The type * to use as a cursor.
|
||||
* @id: Entry ID.
|
||||
*
|
||||
* Continue to iterate over entries, continuing after the current position.
|
||||
*/
|
||||
#define idr_for_each_entry_continue(idr, entry, id) \
|
||||
for ((entry) = idr_get_next((idr), &(id)); \
|
||||
|
@@ -13,6 +13,8 @@ struct ifla_vf_stats {
|
||||
__u64 tx_bytes;
|
||||
__u64 broadcast;
|
||||
__u64 multicast;
|
||||
__u64 rx_dropped;
|
||||
__u64 tx_dropped;
|
||||
};
|
||||
|
||||
struct ifla_vf_info {
|
||||
|
@@ -30,10 +30,10 @@ struct macvlan_dev {
|
||||
enum macvlan_mode mode;
|
||||
u16 flags;
|
||||
int nest_level;
|
||||
unsigned int macaddr_count;
|
||||
#ifdef CONFIG_NET_POLL_CONTROLLER
|
||||
struct netpoll *netpoll;
|
||||
#endif
|
||||
unsigned int macaddr_count;
|
||||
};
|
||||
|
||||
static inline void macvlan_count_rx(const struct macvlan_dev *vlan,
|
||||
|
@@ -4,7 +4,7 @@
|
||||
|
||||
#if IS_ENABLED(CONFIG_TAP)
|
||||
struct socket *tap_get_socket(struct file *);
|
||||
struct skb_array *tap_get_skb_array(struct file *file);
|
||||
struct ptr_ring *tap_get_ptr_ring(struct file *file);
|
||||
#else
|
||||
#include <linux/err.h>
|
||||
#include <linux/errno.h>
|
||||
@@ -14,7 +14,7 @@ static inline struct socket *tap_get_socket(struct file *f)
|
||||
{
|
||||
return ERR_PTR(-EINVAL);
|
||||
}
|
||||
static inline struct skb_array *tap_get_skb_array(struct file *f)
|
||||
static inline struct ptr_ring *tap_get_ptr_ring(struct file *f)
|
||||
{
|
||||
return ERR_PTR(-EINVAL);
|
||||
}
|
||||
@@ -70,7 +70,7 @@ struct tap_queue {
|
||||
u16 queue_index;
|
||||
bool enabled;
|
||||
struct list_head next;
|
||||
struct skb_array skb_array;
|
||||
struct ptr_ring ring;
|
||||
};
|
||||
|
||||
rx_handler_result_t tap_handle_frame(struct sk_buff **pskb);
|
||||
|
@@ -17,9 +17,14 @@
|
||||
|
||||
#include <uapi/linux/if_tun.h>
|
||||
|
||||
#define TUN_XDP_FLAG 0x1UL
|
||||
|
||||
#if defined(CONFIG_TUN) || defined(CONFIG_TUN_MODULE)
|
||||
struct socket *tun_get_socket(struct file *);
|
||||
struct skb_array *tun_get_skb_array(struct file *file);
|
||||
struct ptr_ring *tun_get_tx_ring(struct file *file);
|
||||
bool tun_is_xdp_buff(void *ptr);
|
||||
void *tun_xdp_to_ptr(void *ptr);
|
||||
void *tun_ptr_to_xdp(void *ptr);
|
||||
#else
|
||||
#include <linux/err.h>
|
||||
#include <linux/errno.h>
|
||||
@@ -29,9 +34,21 @@ static inline struct socket *tun_get_socket(struct file *f)
|
||||
{
|
||||
return ERR_PTR(-EINVAL);
|
||||
}
|
||||
static inline struct skb_array *tun_get_skb_array(struct file *f)
|
||||
static inline struct ptr_ring *tun_get_tx_ring(struct file *f)
|
||||
{
|
||||
return ERR_PTR(-EINVAL);
|
||||
}
|
||||
static inline bool tun_is_xdp_buff(void *ptr)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
static inline void *tun_xdp_to_ptr(void *ptr)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
static inline void *tun_ptr_to_xdp(void *ptr)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
#endif /* CONFIG_TUN */
|
||||
#endif /* __IF_TUN_H */
|
||||
|
@@ -578,8 +578,8 @@ const struct iio_chan_spec
|
||||
* iio_device_register() - register a device with the IIO subsystem
|
||||
* @indio_dev: Device structure filled by the device driver
|
||||
**/
|
||||
#define iio_device_register(iio_dev) \
|
||||
__iio_device_register((iio_dev), THIS_MODULE)
|
||||
#define iio_device_register(indio_dev) \
|
||||
__iio_device_register((indio_dev), THIS_MODULE)
|
||||
int __iio_device_register(struct iio_dev *indio_dev, struct module *this_mod);
|
||||
void iio_device_unregister(struct iio_dev *indio_dev);
|
||||
/**
|
||||
|
@@ -28,4 +28,11 @@ struct iio_map {
|
||||
void *consumer_data;
|
||||
};
|
||||
|
||||
#define IIO_MAP(_provider_channel, _consumer_dev_name, _consumer_channel) \
|
||||
{ \
|
||||
.adc_channel_label = _provider_channel, \
|
||||
.consumer_dev_name = _consumer_dev_name, \
|
||||
.consumer_channel = _consumer_channel, \
|
||||
}
|
||||
|
||||
#endif
|
||||
|
@@ -43,12 +43,13 @@ struct iio_trigger_ops {
|
||||
/**
|
||||
* struct iio_trigger - industrial I/O trigger device
|
||||
* @ops: [DRIVER] operations structure
|
||||
* @owner: [INTERN] owner of this driver module
|
||||
* @id: [INTERN] unique id number
|
||||
* @name: [DRIVER] unique name
|
||||
* @dev: [DRIVER] associated device (if relevant)
|
||||
* @list: [INTERN] used in maintenance of global trigger list
|
||||
* @alloc_list: [DRIVER] used for driver specific trigger list
|
||||
* @use_count: use count for the trigger
|
||||
* @use_count: [INTERN] use count for the trigger.
|
||||
* @subirq_chip: [INTERN] associate 'virtual' irq chip.
|
||||
* @subirq_base: [INTERN] base number for irqs provided by trigger.
|
||||
* @subirqs: [INTERN] information about the 'child' irqs.
|
||||
|
@@ -173,7 +173,7 @@ static inline struct net_device *ip_dev_find(struct net *net, __be32 addr)
|
||||
}
|
||||
|
||||
int inet_addr_onlink(struct in_device *in_dev, __be32 a, __be32 b);
|
||||
int devinet_ioctl(struct net *net, unsigned int cmd, void __user *);
|
||||
int devinet_ioctl(struct net *net, unsigned int cmd, struct ifreq *);
|
||||
void devinet_init(void);
|
||||
struct in_device *inetdev_by_index(struct net *, int);
|
||||
__be32 inet_select_addr(const struct net_device *dev, __be32 dst, int scope);
|
||||
|
@@ -5,6 +5,13 @@
|
||||
#include <linux/compiler.h>
|
||||
#include <linux/types.h>
|
||||
|
||||
/* Built-in __init functions needn't be compiled with retpoline */
|
||||
#if defined(RETPOLINE) && !defined(MODULE)
|
||||
#define __noretpoline __attribute__((indirect_branch("keep")))
|
||||
#else
|
||||
#define __noretpoline
|
||||
#endif
|
||||
|
||||
/* These macros are used to mark some functions or
|
||||
* initialized data (doesn't apply to uninitialized data)
|
||||
* as `initialization' functions. The kernel can take this
|
||||
@@ -40,7 +47,7 @@
|
||||
|
||||
/* These are for everybody (although not all archs will actually
|
||||
discard it in modules) */
|
||||
#define __init __section(.init.text) __cold __latent_entropy
|
||||
#define __init __section(.init.text) __cold __latent_entropy __noretpoline
|
||||
#define __initdata __section(.init.data)
|
||||
#define __initconst __section(.init.rodata)
|
||||
#define __exitdata __section(.exit.data)
|
||||
|
@@ -1,74 +0,0 @@
|
||||
/* SPDX-License-Identifier: GPL-2.0 */
|
||||
#ifndef _INPUT_GPIO_TILT_H
|
||||
#define _INPUT_GPIO_TILT_H
|
||||
|
||||
/**
|
||||
* struct gpio_tilt_axis - Axis used by the tilt switch
|
||||
* @axis: Constant describing the axis, e.g. ABS_X
|
||||
* @min: minimum value for abs_param
|
||||
* @max: maximum value for abs_param
|
||||
* @fuzz: fuzz value for abs_param
|
||||
* @flat: flat value for abs_param
|
||||
*/
|
||||
struct gpio_tilt_axis {
|
||||
int axis;
|
||||
int min;
|
||||
int max;
|
||||
int fuzz;
|
||||
int flat;
|
||||
};
|
||||
|
||||
/**
|
||||
* struct gpio_tilt_state - state description
|
||||
* @gpios: bitfield of gpio target-states for the value
|
||||
* @axes: array containing the axes settings for the gpio state
|
||||
* The array indizes must correspond to the axes defined
|
||||
* in platform_data
|
||||
*
|
||||
* This structure describes a supported axis settings
|
||||
* and the necessary gpio-state which represent it.
|
||||
*
|
||||
* The n-th bit in the bitfield describes the state of the n-th GPIO
|
||||
* from the gpios-array defined in gpio_regulator_config below.
|
||||
*/
|
||||
struct gpio_tilt_state {
|
||||
int gpios;
|
||||
int *axes;
|
||||
};
|
||||
|
||||
/**
|
||||
* struct gpio_tilt_platform_data
|
||||
* @gpios: Array containing the gpios determining the tilt state
|
||||
* @nr_gpios: Number of gpios
|
||||
* @axes: Array of gpio_tilt_axis descriptions
|
||||
* @nr_axes: Number of axes
|
||||
* @states: Array of gpio_tilt_state entries describing
|
||||
* the gpio state for specific tilts
|
||||
* @nr_states: Number of states available
|
||||
* @debounce_interval: debounce ticks interval in msecs
|
||||
* @poll_interval: polling interval in msecs - for polling driver only
|
||||
* @enable: callback to enable the tilt switch
|
||||
* @disable: callback to disable the tilt switch
|
||||
*
|
||||
* This structure contains gpio-tilt-switch configuration
|
||||
* information that must be passed by platform code to the
|
||||
* gpio-tilt input driver.
|
||||
*/
|
||||
struct gpio_tilt_platform_data {
|
||||
struct gpio *gpios;
|
||||
int nr_gpios;
|
||||
|
||||
struct gpio_tilt_axis *axes;
|
||||
int nr_axes;
|
||||
|
||||
struct gpio_tilt_state *states;
|
||||
int nr_states;
|
||||
|
||||
int debounce_interval;
|
||||
|
||||
unsigned int poll_interval;
|
||||
int (*enable)(struct device *dev);
|
||||
void (*disable)(struct device *dev);
|
||||
};
|
||||
|
||||
#endif
|
@@ -14,6 +14,7 @@
|
||||
|
||||
enum integrity_status {
|
||||
INTEGRITY_PASS = 0,
|
||||
INTEGRITY_PASS_IMMUTABLE,
|
||||
INTEGRITY_FAIL,
|
||||
INTEGRITY_NOLABEL,
|
||||
INTEGRITY_NOXATTRS,
|
||||
|
@@ -83,7 +83,9 @@
|
||||
/*
|
||||
* Decoding Capability Register
|
||||
*/
|
||||
#define cap_5lp_support(c) (((c) >> 60) & 1)
|
||||
#define cap_pi_support(c) (((c) >> 59) & 1)
|
||||
#define cap_fl1gp_support(c) (((c) >> 56) & 1)
|
||||
#define cap_read_drain(c) (((c) >> 55) & 1)
|
||||
#define cap_write_drain(c) (((c) >> 54) & 1)
|
||||
#define cap_max_amask_val(c) (((c) >> 48) & 0x3f)
|
||||
|
@@ -265,7 +265,7 @@ extern struct resource * __devm_request_region(struct device *dev,
|
||||
extern void __devm_release_region(struct device *dev, struct resource *parent,
|
||||
resource_size_t start, resource_size_t n);
|
||||
extern int iomem_map_sanity_check(resource_size_t addr, unsigned long size);
|
||||
extern int iomem_is_exclusive(u64 addr);
|
||||
extern bool iomem_is_exclusive(u64 addr);
|
||||
|
||||
extern int
|
||||
walk_system_ram_range(unsigned long start_pfn, unsigned long nr_pages,
|
||||
|
@@ -45,7 +45,7 @@
|
||||
*
|
||||
* With this implementation, the value should always appear to observers to
|
||||
* increase over time if the file has changed. It's recommended to use
|
||||
* inode_cmp_iversion() helper to compare values.
|
||||
* inode_eq_iversion() helper to compare values.
|
||||
*
|
||||
* Note that some filesystems (e.g. NFS and AFS) just use the field to store
|
||||
* a server-provided value (for the most part). For that reason, those
|
||||
@@ -305,37 +305,33 @@ inode_query_iversion(struct inode *inode)
|
||||
}
|
||||
|
||||
/**
|
||||
* inode_cmp_iversion_raw - check whether the raw i_version counter has changed
|
||||
* inode_eq_iversion_raw - check whether the raw i_version counter has changed
|
||||
* @inode: inode to check
|
||||
* @old: old value to check against its i_version
|
||||
*
|
||||
* Compare the current raw i_version counter with a previous one. Returns 0 if
|
||||
* they are the same or non-zero if they are different.
|
||||
* Compare the current raw i_version counter with a previous one. Returns true
|
||||
* if they are the same or false if they are different.
|
||||
*/
|
||||
static inline s64
|
||||
inode_cmp_iversion_raw(const struct inode *inode, u64 old)
|
||||
static inline bool
|
||||
inode_eq_iversion_raw(const struct inode *inode, u64 old)
|
||||
{
|
||||
return (s64)inode_peek_iversion_raw(inode) - (s64)old;
|
||||
return inode_peek_iversion_raw(inode) == old;
|
||||
}
|
||||
|
||||
/**
|
||||
* inode_cmp_iversion - check whether the i_version counter has changed
|
||||
* inode_eq_iversion - check whether the i_version counter has changed
|
||||
* @inode: inode to check
|
||||
* @old: old value to check against its i_version
|
||||
*
|
||||
* Compare an i_version counter with a previous one. Returns 0 if they are
|
||||
* the same, a positive value if the one in the inode appears newer than @old,
|
||||
* and a negative value if @old appears to be newer than the one in the
|
||||
* inode.
|
||||
* Compare an i_version counter with a previous one. Returns true if they are
|
||||
* the same, and false if they are different.
|
||||
*
|
||||
* Note that we don't need to set the QUERIED flag in this case, as the value
|
||||
* in the inode is not being recorded for later use.
|
||||
*/
|
||||
|
||||
static inline s64
|
||||
inode_cmp_iversion(const struct inode *inode, u64 old)
|
||||
static inline bool
|
||||
inode_eq_iversion(const struct inode *inode, u64 old)
|
||||
{
|
||||
return (s64)(inode_peek_iversion_raw(inode) & ~I_VERSION_QUERIED) -
|
||||
(s64)(old << I_VERSION_QUERIED_SHIFT);
|
||||
return inode_peek_iversion(inode) == old;
|
||||
}
|
||||
#endif
|
||||
|
@@ -418,26 +418,41 @@ static inline void jbd_unlock_bh_journal_head(struct buffer_head *bh)
|
||||
#define JI_WAIT_DATA (1 << __JI_WAIT_DATA)
|
||||
|
||||
/**
|
||||
* struct jbd_inode is the structure linking inodes in ordered mode
|
||||
* present in a transaction so that we can sync them during commit.
|
||||
* struct jbd_inode - The jbd_inode type is the structure linking inodes in
|
||||
* ordered mode present in a transaction so that we can sync them during commit.
|
||||
*/
|
||||
struct jbd2_inode {
|
||||
/* Which transaction does this inode belong to? Either the running
|
||||
* transaction or the committing one. [j_list_lock] */
|
||||
/**
|
||||
* @i_transaction:
|
||||
*
|
||||
* Which transaction does this inode belong to? Either the running
|
||||
* transaction or the committing one. [j_list_lock]
|
||||
*/
|
||||
transaction_t *i_transaction;
|
||||
|
||||
/* Pointer to the running transaction modifying inode's data in case
|
||||
* there is already a committing transaction touching it. [j_list_lock] */
|
||||
/**
|
||||
* @i_next_transaction:
|
||||
*
|
||||
* Pointer to the running transaction modifying inode's data in case
|
||||
* there is already a committing transaction touching it. [j_list_lock]
|
||||
*/
|
||||
transaction_t *i_next_transaction;
|
||||
|
||||
/* List of inodes in the i_transaction [j_list_lock] */
|
||||
/**
|
||||
* @i_list: List of inodes in the i_transaction [j_list_lock]
|
||||
*/
|
||||
struct list_head i_list;
|
||||
|
||||
/* VFS inode this inode belongs to [constant during the lifetime
|
||||
* of the structure] */
|
||||
/**
|
||||
* @i_vfs_inode:
|
||||
*
|
||||
* VFS inode this inode belongs to [constant for lifetime of structure]
|
||||
*/
|
||||
struct inode *i_vfs_inode;
|
||||
|
||||
/* Flags of inode [j_list_lock] */
|
||||
/**
|
||||
* @i_flags: Flags of inode [j_list_lock]
|
||||
*/
|
||||
unsigned long i_flags;
|
||||
};
|
||||
|
||||
@@ -447,12 +462,20 @@ struct jbd2_revoke_table_s;
|
||||
* struct handle_s - The handle_s type is the concrete type associated with
|
||||
* handle_t.
|
||||
* @h_transaction: Which compound transaction is this update a part of?
|
||||
* @h_journal: Which journal handle belongs to - used iff h_reserved set.
|
||||
* @h_rsv_handle: Handle reserved for finishing the logical operation.
|
||||
* @h_buffer_credits: Number of remaining buffers we are allowed to dirty.
|
||||
* @h_ref: Reference count on this handle
|
||||
* @h_err: Field for caller's use to track errors through large fs operations
|
||||
* @h_sync: flag for sync-on-close
|
||||
* @h_jdata: flag to force data journaling
|
||||
* @h_aborted: flag indicating fatal error on handle
|
||||
* @h_ref: Reference count on this handle.
|
||||
* @h_err: Field for caller's use to track errors through large fs operations.
|
||||
* @h_sync: Flag for sync-on-close.
|
||||
* @h_jdata: Flag to force data journaling.
|
||||
* @h_reserved: Flag for handle for reserved credits.
|
||||
* @h_aborted: Flag indicating fatal error on handle.
|
||||
* @h_type: For handle statistics.
|
||||
* @h_line_no: For handle statistics.
|
||||
* @h_start_jiffies: Handle Start time.
|
||||
* @h_requested_credits: Holds @h_buffer_credits after handle is started.
|
||||
* @saved_alloc_context: Saved context while transaction is open.
|
||||
**/
|
||||
|
||||
/* Docbook can't yet cope with the bit fields, but will leave the documentation
|
||||
@@ -462,32 +485,23 @@ struct jbd2_revoke_table_s;
|
||||
struct jbd2_journal_handle
|
||||
{
|
||||
union {
|
||||
/* Which compound transaction is this update a part of? */
|
||||
transaction_t *h_transaction;
|
||||
/* Which journal handle belongs to - used iff h_reserved set */
|
||||
journal_t *h_journal;
|
||||
};
|
||||
|
||||
/* Handle reserved for finishing the logical operation */
|
||||
handle_t *h_rsv_handle;
|
||||
|
||||
/* Number of remaining buffers we are allowed to dirty: */
|
||||
int h_buffer_credits;
|
||||
|
||||
/* Reference count on this handle */
|
||||
int h_ref;
|
||||
|
||||
/* Field for caller's use to track errors through large fs */
|
||||
/* operations */
|
||||
int h_err;
|
||||
|
||||
/* Flags [no locking] */
|
||||
unsigned int h_sync: 1; /* sync-on-close */
|
||||
unsigned int h_jdata: 1; /* force data journaling */
|
||||
unsigned int h_reserved: 1; /* handle with reserved credits */
|
||||
unsigned int h_aborted: 1; /* fatal error on handle */
|
||||
unsigned int h_type: 8; /* for handle statistics */
|
||||
unsigned int h_line_no: 16; /* for handle statistics */
|
||||
unsigned int h_sync: 1;
|
||||
unsigned int h_jdata: 1;
|
||||
unsigned int h_reserved: 1;
|
||||
unsigned int h_aborted: 1;
|
||||
unsigned int h_type: 8;
|
||||
unsigned int h_line_no: 16;
|
||||
|
||||
unsigned long h_start_jiffies;
|
||||
unsigned int h_requested_credits;
|
||||
@@ -729,228 +743,253 @@ jbd2_time_diff(unsigned long start, unsigned long end)
|
||||
/**
|
||||
* struct journal_s - The journal_s type is the concrete type associated with
|
||||
* journal_t.
|
||||
* @j_flags: General journaling state flags
|
||||
* @j_errno: Is there an outstanding uncleared error on the journal (from a
|
||||
* prior abort)?
|
||||
* @j_sb_buffer: First part of superblock buffer
|
||||
* @j_superblock: Second part of superblock buffer
|
||||
* @j_format_version: Version of the superblock format
|
||||
* @j_state_lock: Protect the various scalars in the journal
|
||||
* @j_barrier_count: Number of processes waiting to create a barrier lock
|
||||
* @j_barrier: The barrier lock itself
|
||||
* @j_running_transaction: The current running transaction..
|
||||
* @j_committing_transaction: the transaction we are pushing to disk
|
||||
* @j_checkpoint_transactions: a linked circular list of all transactions
|
||||
* waiting for checkpointing
|
||||
* @j_wait_transaction_locked: Wait queue for waiting for a locked transaction
|
||||
* to start committing, or for a barrier lock to be released
|
||||
* @j_wait_done_commit: Wait queue for waiting for commit to complete
|
||||
* @j_wait_commit: Wait queue to trigger commit
|
||||
* @j_wait_updates: Wait queue to wait for updates to complete
|
||||
* @j_wait_reserved: Wait queue to wait for reserved buffer credits to drop
|
||||
* @j_checkpoint_mutex: Mutex for locking against concurrent checkpoints
|
||||
* @j_head: Journal head - identifies the first unused block in the journal
|
||||
* @j_tail: Journal tail - identifies the oldest still-used block in the
|
||||
* journal.
|
||||
* @j_free: Journal free - how many free blocks are there in the journal?
|
||||
* @j_first: The block number of the first usable block
|
||||
* @j_last: The block number one beyond the last usable block
|
||||
* @j_dev: Device where we store the journal
|
||||
* @j_blocksize: blocksize for the location where we store the journal.
|
||||
* @j_blk_offset: starting block offset for into the device where we store the
|
||||
* journal
|
||||
* @j_fs_dev: Device which holds the client fs. For internal journal this will
|
||||
* be equal to j_dev
|
||||
* @j_reserved_credits: Number of buffers reserved from the running transaction
|
||||
* @j_maxlen: Total maximum capacity of the journal region on disk.
|
||||
* @j_list_lock: Protects the buffer lists and internal buffer state.
|
||||
* @j_inode: Optional inode where we store the journal. If present, all journal
|
||||
* block numbers are mapped into this inode via bmap().
|
||||
* @j_tail_sequence: Sequence number of the oldest transaction in the log
|
||||
* @j_transaction_sequence: Sequence number of the next transaction to grant
|
||||
* @j_commit_sequence: Sequence number of the most recently committed
|
||||
* transaction
|
||||
* @j_commit_request: Sequence number of the most recent transaction wanting
|
||||
* commit
|
||||
* @j_uuid: Uuid of client object.
|
||||
* @j_task: Pointer to the current commit thread for this journal
|
||||
* @j_max_transaction_buffers: Maximum number of metadata buffers to allow in a
|
||||
* single compound commit transaction
|
||||
* @j_commit_interval: What is the maximum transaction lifetime before we begin
|
||||
* a commit?
|
||||
* @j_commit_timer: The timer used to wakeup the commit thread
|
||||
* @j_revoke_lock: Protect the revoke table
|
||||
* @j_revoke: The revoke table - maintains the list of revoked blocks in the
|
||||
* current transaction.
|
||||
* @j_revoke_table: alternate revoke tables for j_revoke
|
||||
* @j_wbuf: array of buffer_heads for jbd2_journal_commit_transaction
|
||||
* @j_wbufsize: maximum number of buffer_heads allowed in j_wbuf, the
|
||||
* number that will fit in j_blocksize
|
||||
* @j_last_sync_writer: most recent pid which did a synchronous write
|
||||
* @j_history_lock: Protect the transactions statistics history
|
||||
* @j_proc_entry: procfs entry for the jbd statistics directory
|
||||
* @j_stats: Overall statistics
|
||||
* @j_private: An opaque pointer to fs-private information.
|
||||
* @j_trans_commit_map: Lockdep entity to track transaction commit dependencies
|
||||
*/
|
||||
|
||||
struct journal_s
|
||||
{
|
||||
/* General journaling state flags [j_state_lock] */
|
||||
/**
|
||||
* @j_flags: General journaling state flags [j_state_lock]
|
||||
*/
|
||||
unsigned long j_flags;
|
||||
|
||||
/*
|
||||
/**
|
||||
* @j_errno:
|
||||
*
|
||||
* Is there an outstanding uncleared error on the journal (from a prior
|
||||
* abort)? [j_state_lock]
|
||||
*/
|
||||
int j_errno;
|
||||
|
||||
/* The superblock buffer */
|
||||
/**
|
||||
* @j_sb_buffer: The first part of the superblock buffer.
|
||||
*/
|
||||
struct buffer_head *j_sb_buffer;
|
||||
|
||||
/**
|
||||
* @j_superblock: The second part of the superblock buffer.
|
||||
*/
|
||||
journal_superblock_t *j_superblock;
|
||||
|
||||
/* Version of the superblock format */
|
||||
/**
|
||||
* @j_format_version: Version of the superblock format.
|
||||
*/
|
||||
int j_format_version;
|
||||
|
||||
/*
|
||||
* Protect the various scalars in the journal
|
||||
/**
|
||||
* @j_state_lock: Protect the various scalars in the journal.
|
||||
*/
|
||||
rwlock_t j_state_lock;
|
||||
|
||||
/*
|
||||
/**
|
||||
* @j_barrier_count:
|
||||
*
|
||||
* Number of processes waiting to create a barrier lock [j_state_lock]
|
||||
*/
|
||||
int j_barrier_count;
|
||||
|
||||
/* The barrier lock itself */
|
||||
/**
|
||||
* @j_barrier: The barrier lock itself.
|
||||
*/
|
||||
struct mutex j_barrier;
|
||||
|
||||
/*
|
||||
/**
|
||||
* @j_running_transaction:
|
||||
*
|
||||
* Transactions: The current running transaction...
|
||||
* [j_state_lock] [caller holding open handle]
|
||||
*/
|
||||
transaction_t *j_running_transaction;
|
||||
|
||||
/*
|
||||
/**
|
||||
* @j_committing_transaction:
|
||||
*
|
||||
* the transaction we are pushing to disk
|
||||
* [j_state_lock] [caller holding open handle]
|
||||
*/
|
||||
transaction_t *j_committing_transaction;
|
||||
|
||||
/*
|
||||
/**
|
||||
* @j_checkpoint_transactions:
|
||||
*
|
||||
* ... and a linked circular list of all transactions waiting for
|
||||
* checkpointing. [j_list_lock]
|
||||
*/
|
||||
transaction_t *j_checkpoint_transactions;
|
||||
|
||||
/*
|
||||
/**
|
||||
* @j_wait_transaction_locked:
|
||||
*
|
||||
* Wait queue for waiting for a locked transaction to start committing,
|
||||
* or for a barrier lock to be released
|
||||
* or for a barrier lock to be released.
|
||||
*/
|
||||
wait_queue_head_t j_wait_transaction_locked;
|
||||
|
||||
/* Wait queue for waiting for commit to complete */
|
||||
/**
|
||||
* @j_wait_done_commit: Wait queue for waiting for commit to complete.
|
||||
*/
|
||||
wait_queue_head_t j_wait_done_commit;
|
||||
|
||||
/* Wait queue to trigger commit */
|
||||
/**
|
||||
* @j_wait_commit: Wait queue to trigger commit.
|
||||
*/
|
||||
wait_queue_head_t j_wait_commit;
|
||||
|
||||
/* Wait queue to wait for updates to complete */
|
||||
/**
|
||||
* @j_wait_updates: Wait queue to wait for updates to complete.
|
||||
*/
|
||||
wait_queue_head_t j_wait_updates;
|
||||
|
||||
/* Wait queue to wait for reserved buffer credits to drop */
|
||||
/**
|
||||
* @j_wait_reserved:
|
||||
*
|
||||
* Wait queue to wait for reserved buffer credits to drop.
|
||||
*/
|
||||
wait_queue_head_t j_wait_reserved;
|
||||
|
||||
/* Semaphore for locking against concurrent checkpoints */
|
||||
/**
|
||||
* @j_checkpoint_mutex:
|
||||
*
|
||||
* Semaphore for locking against concurrent checkpoints.
|
||||
*/
|
||||
struct mutex j_checkpoint_mutex;
|
||||
|
||||
/*
|
||||
/**
|
||||
* @j_chkpt_bhs:
|
||||
*
|
||||
* List of buffer heads used by the checkpoint routine. This
|
||||
* was moved from jbd2_log_do_checkpoint() to reduce stack
|
||||
* usage. Access to this array is controlled by the
|
||||
* j_checkpoint_mutex. [j_checkpoint_mutex]
|
||||
* @j_checkpoint_mutex. [j_checkpoint_mutex]
|
||||
*/
|
||||
struct buffer_head *j_chkpt_bhs[JBD2_NR_BATCH];
|
||||
|
||||
/*
|
||||
|
||||
/**
|
||||
* @j_head:
|
||||
*
|
||||
* Journal head: identifies the first unused block in the journal.
|
||||
* [j_state_lock]
|
||||
*/
|
||||
unsigned long j_head;
|
||||
|
||||
/*
|
||||
/**
|
||||
* @j_tail:
|
||||
*
|
||||
* Journal tail: identifies the oldest still-used block in the journal.
|
||||
* [j_state_lock]
|
||||
*/
|
||||
unsigned long j_tail;
|
||||
|
||||
/*
|
||||
/**
|
||||
* @j_free:
|
||||
*
|
||||
* Journal free: how many free blocks are there in the journal?
|
||||
* [j_state_lock]
|
||||
*/
|
||||
unsigned long j_free;
|
||||
|
||||
/*
|
||||
* Journal start and end: the block numbers of the first usable block
|
||||
* and one beyond the last usable block in the journal. [j_state_lock]
|
||||
/**
|
||||
* @j_first:
|
||||
*
|
||||
* The block number of the first usable block in the journal
|
||||
* [j_state_lock].
|
||||
*/
|
||||
unsigned long j_first;
|
||||
|
||||
/**
|
||||
* @j_last:
|
||||
*
|
||||
* The block number one beyond the last usable block in the journal
|
||||
* [j_state_lock].
|
||||
*/
|
||||
unsigned long j_last;
|
||||
|
||||
/*
|
||||
* Device, blocksize and starting block offset for the location where we
|
||||
* store the journal.
|
||||
/**
|
||||
* @j_dev: Device where we store the journal.
|
||||
*/
|
||||
struct block_device *j_dev;
|
||||
|
||||
/**
|
||||
* @j_blocksize: Block size for the location where we store the journal.
|
||||
*/
|
||||
int j_blocksize;
|
||||
|
||||
/**
|
||||
* @j_blk_offset:
|
||||
*
|
||||
* Starting block offset into the device where we store the journal.
|
||||
*/
|
||||
unsigned long long j_blk_offset;
|
||||
|
||||
/**
|
||||
* @j_devname: Journal device name.
|
||||
*/
|
||||
char j_devname[BDEVNAME_SIZE+24];
|
||||
|
||||
/*
|
||||
/**
|
||||
* @j_fs_dev:
|
||||
*
|
||||
* Device which holds the client fs. For internal journal this will be
|
||||
* equal to j_dev.
|
||||
*/
|
||||
struct block_device *j_fs_dev;
|
||||
|
||||
/* Total maximum capacity of the journal region on disk. */
|
||||
/**
|
||||
* @j_maxlen: Total maximum capacity of the journal region on disk.
|
||||
*/
|
||||
unsigned int j_maxlen;
|
||||
|
||||
/* Number of buffers reserved from the running transaction */
|
||||
/**
|
||||
* @j_reserved_credits:
|
||||
*
|
||||
* Number of buffers reserved from the running transaction.
|
||||
*/
|
||||
atomic_t j_reserved_credits;
|
||||
|
||||
/*
|
||||
* Protects the buffer lists and internal buffer state.
|
||||
/**
|
||||
* @j_list_lock: Protects the buffer lists and internal buffer state.
|
||||
*/
|
||||
spinlock_t j_list_lock;
|
||||
|
||||
/* Optional inode where we store the journal. If present, all */
|
||||
/* journal block numbers are mapped into this inode via */
|
||||
/* bmap(). */
|
||||
/**
|
||||
* @j_inode:
|
||||
*
|
||||
* Optional inode where we store the journal. If present, all
|
||||
* journal block numbers are mapped into this inode via bmap().
|
||||
*/
|
||||
struct inode *j_inode;
|
||||
|
||||
/*
|
||||
/**
|
||||
* @j_tail_sequence:
|
||||
*
|
||||
* Sequence number of the oldest transaction in the log [j_state_lock]
|
||||
*/
|
||||
tid_t j_tail_sequence;
|
||||
|
||||
/*
|
||||
/**
|
||||
* @j_transaction_sequence:
|
||||
*
|
||||
* Sequence number of the next transaction to grant [j_state_lock]
|
||||
*/
|
||||
tid_t j_transaction_sequence;
|
||||
|
||||
/*
|
||||
/**
|
||||
* @j_commit_sequence:
|
||||
*
|
||||
* Sequence number of the most recently committed transaction
|
||||
* [j_state_lock].
|
||||
*/
|
||||
tid_t j_commit_sequence;
|
||||
|
||||
/*
|
||||
/**
|
||||
* @j_commit_request:
|
||||
*
|
||||
* Sequence number of the most recent transaction wanting commit
|
||||
* [j_state_lock]
|
||||
*/
|
||||
tid_t j_commit_request;
|
||||
|
||||
/*
|
||||
/**
|
||||
* @j_uuid:
|
||||
*
|
||||
* Journal uuid: identifies the object (filesystem, LVM volume etc)
|
||||
* backed by this journal. This will eventually be replaced by an array
|
||||
* of uuids, allowing us to index multiple devices within a single
|
||||
@@ -958,85 +997,151 @@ struct journal_s
|
||||
*/
|
||||
__u8 j_uuid[16];
|
||||
|
||||
/* Pointer to the current commit thread for this journal */
|
||||
/**
|
||||
* @j_task: Pointer to the current commit thread for this journal.
|
||||
*/
|
||||
struct task_struct *j_task;
|
||||
|
||||
/*
|
||||
/**
|
||||
* @j_max_transaction_buffers:
|
||||
*
|
||||
* Maximum number of metadata buffers to allow in a single compound
|
||||
* commit transaction
|
||||
* commit transaction.
|
||||
*/
|
||||
int j_max_transaction_buffers;
|
||||
|
||||
/*
|
||||
/**
|
||||
* @j_commit_interval:
|
||||
*
|
||||
* What is the maximum transaction lifetime before we begin a commit?
|
||||
*/
|
||||
unsigned long j_commit_interval;
|
||||
|
||||
/* The timer used to wakeup the commit thread: */
|
||||
/**
|
||||
* @j_commit_timer: The timer used to wakeup the commit thread.
|
||||
*/
|
||||
struct timer_list j_commit_timer;
|
||||
|
||||
/*
|
||||
* The revoke table: maintains the list of revoked blocks in the
|
||||
* current transaction. [j_revoke_lock]
|
||||
/**
|
||||
* @j_revoke_lock: Protect the revoke table.
|
||||
*/
|
||||
spinlock_t j_revoke_lock;
|
||||
|
||||
/**
|
||||
* @j_revoke:
|
||||
*
|
||||
* The revoke table - maintains the list of revoked blocks in the
|
||||
* current transaction.
|
||||
*/
|
||||
struct jbd2_revoke_table_s *j_revoke;
|
||||
|
||||
/**
|
||||
* @j_revoke_table: Alternate revoke tables for j_revoke.
|
||||
*/
|
||||
struct jbd2_revoke_table_s *j_revoke_table[2];
|
||||
|
||||
/*
|
||||
* array of bhs for jbd2_journal_commit_transaction
|
||||
/**
|
||||
* @j_wbuf: Array of bhs for jbd2_journal_commit_transaction.
|
||||
*/
|
||||
struct buffer_head **j_wbuf;
|
||||
|
||||
/**
|
||||
* @j_wbufsize:
|
||||
*
|
||||
* Size of @j_wbuf array.
|
||||
*/
|
||||
int j_wbufsize;
|
||||
|
||||
/*
|
||||
* this is the pid of hte last person to run a synchronous operation
|
||||
* through the journal
|
||||
/**
|
||||
* @j_last_sync_writer:
|
||||
*
|
||||
* The pid of the last person to run a synchronous operation
|
||||
* through the journal.
|
||||
*/
|
||||
pid_t j_last_sync_writer;
|
||||
|
||||
/*
|
||||
* the average amount of time in nanoseconds it takes to commit a
|
||||
/**
|
||||
* @j_average_commit_time:
|
||||
*
|
||||
* The average amount of time in nanoseconds it takes to commit a
|
||||
* transaction to disk. [j_state_lock]
|
||||
*/
|
||||
u64 j_average_commit_time;
|
||||
|
||||
/*
|
||||
* minimum and maximum times that we should wait for
|
||||
* additional filesystem operations to get batched into a
|
||||
* synchronous handle in microseconds
|
||||
/**
|
||||
* @j_min_batch_time:
|
||||
*
|
||||
* Minimum time that we should wait for additional filesystem operations
|
||||
* to get batched into a synchronous handle in microseconds.
|
||||
*/
|
||||
u32 j_min_batch_time;
|
||||
|
||||
/**
|
||||
* @j_max_batch_time:
|
||||
*
|
||||
* Maximum time that we should wait for additional filesystem operations
|
||||
* to get batched into a synchronous handle in microseconds.
|
||||
*/
|
||||
u32 j_max_batch_time;
|
||||
|
||||
/* This function is called when a transaction is closed */
|
||||
/**
|
||||
* @j_commit_callback:
|
||||
*
|
||||
* This function is called when a transaction is closed.
|
||||
*/
|
||||
void (*j_commit_callback)(journal_t *,
|
||||
transaction_t *);
|
||||
|
||||
/*
|
||||
* Journal statistics
|
||||
*/
|
||||
|
||||
/**
|
||||
* @j_history_lock: Protect the transactions statistics history.
|
||||
*/
|
||||
spinlock_t j_history_lock;
|
||||
|
||||
/**
|
||||
* @j_proc_entry: procfs entry for the jbd statistics directory.
|
||||
*/
|
||||
struct proc_dir_entry *j_proc_entry;
|
||||
|
||||
/**
|
||||
* @j_stats: Overall statistics.
|
||||
*/
|
||||
struct transaction_stats_s j_stats;
|
||||
|
||||
/* Failed journal commit ID */
|
||||
/**
|
||||
* @j_failed_commit: Failed journal commit ID.
|
||||
*/
|
||||
unsigned int j_failed_commit;
|
||||
|
||||
/*
|
||||
/**
|
||||
* @j_private:
|
||||
*
|
||||
* An opaque pointer to fs-private information. ext3 puts its
|
||||
* superblock pointer here
|
||||
* superblock pointer here.
|
||||
*/
|
||||
void *j_private;
|
||||
|
||||
/* Reference to checksum algorithm driver via cryptoapi */
|
||||
/**
|
||||
* @j_chksum_driver:
|
||||
*
|
||||
* Reference to checksum algorithm driver via cryptoapi.
|
||||
*/
|
||||
struct crypto_shash *j_chksum_driver;
|
||||
|
||||
/* Precomputed journal UUID checksum for seeding other checksums */
|
||||
/**
|
||||
* @j_csum_seed:
|
||||
*
|
||||
* Precomputed journal UUID checksum for seeding other checksums.
|
||||
*/
|
||||
__u32 j_csum_seed;
|
||||
|
||||
#ifdef CONFIG_DEBUG_LOCK_ALLOC
|
||||
/*
|
||||
/**
|
||||
* @j_trans_commit_map:
|
||||
*
|
||||
* Lockdep entity to track transaction commit dependencies. Handles
|
||||
* hold this "lock" for read, when we wait for commit, we acquire the
|
||||
* "lock" for writing. This matches the properties of jbd2 journalling
|
||||
|
@@ -393,7 +393,7 @@ extern bool ____wrong_branch_error(void);
|
||||
branch = !arch_static_branch_jump(&(x)->key, true); \
|
||||
else \
|
||||
branch = ____wrong_branch_error(); \
|
||||
branch; \
|
||||
likely(branch); \
|
||||
})
|
||||
|
||||
#define static_branch_unlikely(x) \
|
||||
@@ -405,7 +405,7 @@ extern bool ____wrong_branch_error(void);
|
||||
branch = arch_static_branch(&(x)->key, false); \
|
||||
else \
|
||||
branch = ____wrong_branch_error(); \
|
||||
branch; \
|
||||
unlikely(branch); \
|
||||
})
|
||||
|
||||
#else /* !HAVE_JUMP_LABEL */
|
||||
|
@@ -9,6 +9,10 @@
|
||||
#include <linux/errno.h>
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/stddef.h>
|
||||
#include <linux/mm.h>
|
||||
#include <linux/module.h>
|
||||
|
||||
#include <asm/sections.h>
|
||||
|
||||
#define KSYM_NAME_LEN 128
|
||||
#define KSYM_SYMBOL_LEN (sizeof("%s+%#lx/%#lx [%s]") + (KSYM_NAME_LEN - 1) + \
|
||||
@@ -16,6 +20,56 @@
|
||||
|
||||
struct module;
|
||||
|
||||
static inline int is_kernel_inittext(unsigned long addr)
|
||||
{
|
||||
if (addr >= (unsigned long)_sinittext
|
||||
&& addr <= (unsigned long)_einittext)
|
||||
return 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static inline int is_kernel_text(unsigned long addr)
|
||||
{
|
||||
if ((addr >= (unsigned long)_stext && addr <= (unsigned long)_etext) ||
|
||||
arch_is_kernel_text(addr))
|
||||
return 1;
|
||||
return in_gate_area_no_mm(addr);
|
||||
}
|
||||
|
||||
static inline int is_kernel(unsigned long addr)
|
||||
{
|
||||
if (addr >= (unsigned long)_stext && addr <= (unsigned long)_end)
|
||||
return 1;
|
||||
return in_gate_area_no_mm(addr);
|
||||
}
|
||||
|
||||
static inline int is_ksym_addr(unsigned long addr)
|
||||
{
|
||||
if (IS_ENABLED(CONFIG_KALLSYMS_ALL))
|
||||
return is_kernel(addr);
|
||||
|
||||
return is_kernel_text(addr) || is_kernel_inittext(addr);
|
||||
}
|
||||
|
||||
static inline void *dereference_symbol_descriptor(void *ptr)
|
||||
{
|
||||
#ifdef HAVE_DEREFERENCE_FUNCTION_DESCRIPTOR
|
||||
struct module *mod;
|
||||
|
||||
ptr = dereference_kernel_function_descriptor(ptr);
|
||||
if (is_ksym_addr((unsigned long)ptr))
|
||||
return ptr;
|
||||
|
||||
preempt_disable();
|
||||
mod = __module_address((unsigned long)ptr);
|
||||
preempt_enable();
|
||||
|
||||
if (mod)
|
||||
ptr = dereference_module_function_descriptor(mod, ptr);
|
||||
#endif
|
||||
return ptr;
|
||||
}
|
||||
|
||||
#ifdef CONFIG_KALLSYMS
|
||||
/* Lookup the address for a symbol. Returns 0 if not found. */
|
||||
unsigned long kallsyms_lookup_name(const char *name);
|
||||
@@ -40,9 +94,6 @@ extern int sprint_symbol(char *buffer, unsigned long address);
|
||||
extern int sprint_symbol_no_offset(char *buffer, unsigned long address);
|
||||
extern int sprint_backtrace(char *buffer, unsigned long address);
|
||||
|
||||
/* Look up a kernel symbol and print it to the kernel messages. */
|
||||
extern void __print_symbol(const char *fmt, unsigned long address);
|
||||
|
||||
int lookup_symbol_name(unsigned long addr, char *symname);
|
||||
int lookup_symbol_attrs(unsigned long addr, unsigned long *size, unsigned long *offset, char *modname, char *name);
|
||||
|
||||
@@ -112,26 +163,11 @@ static inline int kallsyms_show_value(void)
|
||||
return false;
|
||||
}
|
||||
|
||||
/* Stupid that this does nothing, but I didn't create this mess. */
|
||||
#define __print_symbol(fmt, addr)
|
||||
#endif /*CONFIG_KALLSYMS*/
|
||||
|
||||
/* This macro allows us to keep printk typechecking */
|
||||
static __printf(1, 2)
|
||||
void __check_printsym_format(const char *fmt, ...)
|
||||
{
|
||||
}
|
||||
|
||||
static inline void print_symbol(const char *fmt, unsigned long addr)
|
||||
{
|
||||
__check_printsym_format(fmt, "");
|
||||
__print_symbol(fmt, (unsigned long)
|
||||
__builtin_extract_return_addr((void *)addr));
|
||||
}
|
||||
|
||||
static inline void print_ip_sym(unsigned long ip)
|
||||
{
|
||||
printk("[<%p>] %pS\n", (void *) ip, (void *) ip);
|
||||
printk("[<%px>] %pS\n", (void *) ip, (void *) ip);
|
||||
}
|
||||
|
||||
#endif /*_LINUX_KALLSYMS_H*/
|
||||
|
@@ -11,8 +11,6 @@ struct task_struct;
|
||||
|
||||
#ifdef CONFIG_KASAN
|
||||
|
||||
#define KASAN_SHADOW_SCALE_SHIFT 3
|
||||
|
||||
#include <asm/kasan.h>
|
||||
#include <asm/pgtable.h>
|
||||
|
||||
@@ -56,14 +54,14 @@ void kasan_poison_object_data(struct kmem_cache *cache, void *object);
|
||||
void kasan_init_slab_obj(struct kmem_cache *cache, const void *object);
|
||||
|
||||
void kasan_kmalloc_large(const void *ptr, size_t size, gfp_t flags);
|
||||
void kasan_kfree_large(const void *ptr);
|
||||
void kasan_poison_kfree(void *ptr);
|
||||
void kasan_kfree_large(void *ptr, unsigned long ip);
|
||||
void kasan_poison_kfree(void *ptr, unsigned long ip);
|
||||
void kasan_kmalloc(struct kmem_cache *s, const void *object, size_t size,
|
||||
gfp_t flags);
|
||||
void kasan_krealloc(const void *object, size_t new_size, gfp_t flags);
|
||||
|
||||
void kasan_slab_alloc(struct kmem_cache *s, void *object, gfp_t flags);
|
||||
bool kasan_slab_free(struct kmem_cache *s, void *object);
|
||||
bool kasan_slab_free(struct kmem_cache *s, void *object, unsigned long ip);
|
||||
|
||||
struct kasan_cache {
|
||||
int alloc_meta_offset;
|
||||
@@ -108,8 +106,8 @@ static inline void kasan_init_slab_obj(struct kmem_cache *cache,
|
||||
const void *object) {}
|
||||
|
||||
static inline void kasan_kmalloc_large(void *ptr, size_t size, gfp_t flags) {}
|
||||
static inline void kasan_kfree_large(const void *ptr) {}
|
||||
static inline void kasan_poison_kfree(void *ptr) {}
|
||||
static inline void kasan_kfree_large(void *ptr, unsigned long ip) {}
|
||||
static inline void kasan_poison_kfree(void *ptr, unsigned long ip) {}
|
||||
static inline void kasan_kmalloc(struct kmem_cache *s, const void *object,
|
||||
size_t size, gfp_t flags) {}
|
||||
static inline void kasan_krealloc(const void *object, size_t new_size,
|
||||
@@ -117,7 +115,8 @@ static inline void kasan_krealloc(const void *object, size_t new_size,
|
||||
|
||||
static inline void kasan_slab_alloc(struct kmem_cache *s, void *object,
|
||||
gfp_t flags) {}
|
||||
static inline bool kasan_slab_free(struct kmem_cache *s, void *object)
|
||||
static inline bool kasan_slab_free(struct kmem_cache *s, void *object,
|
||||
unsigned long ip)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
@@ -10,6 +10,7 @@ enum kcore_type {
|
||||
KCORE_VMALLOC,
|
||||
KCORE_RAM,
|
||||
KCORE_VMEMMAP,
|
||||
KCORE_USER,
|
||||
KCORE_OTHER,
|
||||
};
|
||||
|
||||
|
@@ -113,7 +113,8 @@ struct kfifo_rec_ptr_2 __STRUCT_KFIFO_PTR(unsigned char, 2, void);
|
||||
* array is a part of the structure and the fifo type where the array is
|
||||
* outside of the fifo structure.
|
||||
*/
|
||||
#define __is_kfifo_ptr(fifo) (sizeof(*fifo) == sizeof(struct __kfifo))
|
||||
#define __is_kfifo_ptr(fifo) \
|
||||
(sizeof(*fifo) == sizeof(STRUCT_KFIFO_PTR(typeof(*(fifo)->type))))
|
||||
|
||||
/**
|
||||
* DECLARE_KFIFO_PTR - macro to declare a fifo pointer object
|
||||
|
@@ -1,3 +1,4 @@
|
||||
// SPDX-License-Identifier: GPL-2.0
|
||||
/*
|
||||
* kobject.h - generic kernel object infrastructure.
|
||||
*
|
||||
@@ -6,8 +7,6 @@
|
||||
* Copyright (c) 2006-2008 Greg Kroah-Hartman <greg@kroah.com>
|
||||
* Copyright (c) 2006-2008 Novell Inc.
|
||||
*
|
||||
* This file is released under the GPLv2.
|
||||
*
|
||||
* Please read Documentation/kobject.txt before using the kobject
|
||||
* interface, ESPECIALLY the parts about reference counts and object
|
||||
* destructors.
|
||||
|
@@ -1,3 +1,4 @@
|
||||
// SPDX-License-Identifier: GPL-2.0
|
||||
/* Kernel object name space definitions
|
||||
*
|
||||
* Copyright (c) 2002-2003 Patrick Mochel
|
||||
@@ -7,8 +8,6 @@
|
||||
*
|
||||
* Split from kobject.h by David Howells (dhowells@redhat.com)
|
||||
*
|
||||
* This file is released under the GPLv2.
|
||||
*
|
||||
* Please read Documentation/kobject.txt before using the kobject
|
||||
* interface, ESPECIALLY the parts about reference counts and object
|
||||
* destructors.
|
||||
|
@@ -533,7 +533,7 @@ static inline int kvm_vcpu_get_idx(struct kvm_vcpu *vcpu)
|
||||
int kvm_vcpu_init(struct kvm_vcpu *vcpu, struct kvm *kvm, unsigned id);
|
||||
void kvm_vcpu_uninit(struct kvm_vcpu *vcpu);
|
||||
|
||||
int __must_check vcpu_load(struct kvm_vcpu *vcpu);
|
||||
void vcpu_load(struct kvm_vcpu *vcpu);
|
||||
void vcpu_put(struct kvm_vcpu *vcpu);
|
||||
|
||||
#ifdef __KVM_HAVE_IOAPIC
|
||||
@@ -1260,4 +1260,16 @@ static inline bool vcpu_valid_wakeup(struct kvm_vcpu *vcpu)
|
||||
}
|
||||
#endif /* CONFIG_HAVE_KVM_INVALID_WAKEUPS */
|
||||
|
||||
#ifdef CONFIG_HAVE_KVM_VCPU_ASYNC_IOCTL
|
||||
long kvm_arch_vcpu_async_ioctl(struct file *filp,
|
||||
unsigned int ioctl, unsigned long arg);
|
||||
#else
|
||||
static inline long kvm_arch_vcpu_async_ioctl(struct file *filp,
|
||||
unsigned int ioctl,
|
||||
unsigned long arg)
|
||||
{
|
||||
return -ENOIOCTLCMD;
|
||||
}
|
||||
#endif /* CONFIG_HAVE_KVM_VCPU_ASYNC_IOCTL */
|
||||
|
||||
#endif
|
||||
|
@@ -121,6 +121,8 @@ extern void led_classdev_flash_unregister(struct led_classdev_flash *fled_cdev);
|
||||
static inline int led_set_flash_strobe(struct led_classdev_flash *fled_cdev,
|
||||
bool state)
|
||||
{
|
||||
if (!fled_cdev)
|
||||
return -EINVAL;
|
||||
return fled_cdev->ops->strobe_set(fled_cdev, state);
|
||||
}
|
||||
|
||||
@@ -136,6 +138,8 @@ static inline int led_set_flash_strobe(struct led_classdev_flash *fled_cdev,
|
||||
static inline int led_get_flash_strobe(struct led_classdev_flash *fled_cdev,
|
||||
bool *state)
|
||||
{
|
||||
if (!fled_cdev)
|
||||
return -EINVAL;
|
||||
if (fled_cdev->ops->strobe_get)
|
||||
return fled_cdev->ops->strobe_get(fled_cdev, state);
|
||||
|
||||
|
@@ -3,7 +3,6 @@
|
||||
#define _INCLUDE_LIBFDT_H_
|
||||
|
||||
#include <linux/libfdt_env.h>
|
||||
#include "../../scripts/dtc/libfdt/fdt.h"
|
||||
#include "../../scripts/dtc/libfdt/libfdt.h"
|
||||
|
||||
#endif /* _INCLUDE_LIBFDT_H_ */
|
||||
|
@@ -47,6 +47,17 @@ enum {
|
||||
|
||||
/* region flag indicating to direct-map persistent memory by default */
|
||||
ND_REGION_PAGEMAP = 0,
|
||||
/*
|
||||
* Platform ensures entire CPU store data path is flushed to pmem on
|
||||
* system power loss.
|
||||
*/
|
||||
ND_REGION_PERSIST_CACHE = 1,
|
||||
/*
|
||||
* Platform provides mechanisms to automatically flush outstanding
|
||||
* write data from memory controler to pmem on system power loss.
|
||||
* (ADR)
|
||||
*/
|
||||
ND_REGION_PERSIST_MEMCTRL = 2,
|
||||
|
||||
/* mark newly adjusted resources as requiring a label update */
|
||||
DPA_RESOURCE_ADJUSTED = 1 << 0,
|
||||
|
@@ -40,7 +40,6 @@
|
||||
* @new_func: pointer to the patched function code
|
||||
* @old_sympos: a hint indicating which symbol position the old function
|
||||
* can be found (optional)
|
||||
* @immediate: patch the func immediately, bypassing safety mechanisms
|
||||
* @old_addr: the address of the function being patched
|
||||
* @kobj: kobject for sysfs resources
|
||||
* @stack_node: list node for klp_ops func_stack list
|
||||
@@ -76,7 +75,6 @@ struct klp_func {
|
||||
* in kallsyms for the given object is used.
|
||||
*/
|
||||
unsigned long old_sympos;
|
||||
bool immediate;
|
||||
|
||||
/* internal */
|
||||
unsigned long old_addr;
|
||||
@@ -137,7 +135,6 @@ struct klp_object {
|
||||
* struct klp_patch - patch structure for live patching
|
||||
* @mod: reference to the live patch module
|
||||
* @objs: object entries for kernel objects to be patched
|
||||
* @immediate: patch all funcs immediately, bypassing safety mechanisms
|
||||
* @list: list node for global list of registered patches
|
||||
* @kobj: kobject for sysfs resources
|
||||
* @enabled: the patch is enabled (but operation may be incomplete)
|
||||
@@ -147,7 +144,6 @@ struct klp_patch {
|
||||
/* external */
|
||||
struct module *mod;
|
||||
struct klp_object *objs;
|
||||
bool immediate;
|
||||
|
||||
/* internal */
|
||||
struct list_head list;
|
||||
|
@@ -17,6 +17,7 @@
|
||||
#include <net/ipv6.h>
|
||||
#include <linux/fs.h>
|
||||
#include <linux/kref.h>
|
||||
#include <linux/refcount.h>
|
||||
#include <linux/utsname.h>
|
||||
#include <linux/lockd/bind.h>
|
||||
#include <linux/lockd/xdr.h>
|
||||
@@ -58,7 +59,7 @@ struct nlm_host {
|
||||
u32 h_state; /* pseudo-state counter */
|
||||
u32 h_nsmstate; /* true remote NSM state */
|
||||
u32 h_pidcount; /* Pseudopids */
|
||||
atomic_t h_count; /* reference count */
|
||||
refcount_t h_count; /* reference count */
|
||||
struct mutex h_mutex; /* mutex for pmap binding */
|
||||
unsigned long h_nextrebind; /* next portmap call */
|
||||
unsigned long h_expires; /* eligible for GC */
|
||||
@@ -83,7 +84,7 @@ struct nlm_host {
|
||||
|
||||
struct nsm_handle {
|
||||
struct list_head sm_link;
|
||||
atomic_t sm_count;
|
||||
refcount_t sm_count;
|
||||
char *sm_mon_name;
|
||||
char *sm_name;
|
||||
struct sockaddr_storage sm_addr;
|
||||
@@ -122,7 +123,7 @@ static inline struct sockaddr *nlm_srcaddr(const struct nlm_host *host)
|
||||
*/
|
||||
struct nlm_lockowner {
|
||||
struct list_head list;
|
||||
atomic_t count;
|
||||
refcount_t count;
|
||||
|
||||
struct nlm_host *host;
|
||||
fl_owner_t owner;
|
||||
@@ -136,7 +137,7 @@ struct nlm_wait;
|
||||
*/
|
||||
#define NLMCLNT_OHSIZE ((__NEW_UTS_LEN) + 10u)
|
||||
struct nlm_rqst {
|
||||
atomic_t a_count;
|
||||
refcount_t a_count;
|
||||
unsigned int a_flags; /* initial RPC task flags */
|
||||
struct nlm_host * a_host; /* host handle */
|
||||
struct nlm_args a_args; /* arguments */
|
||||
|
@@ -44,7 +44,7 @@ extern void lockref_mark_dead(struct lockref *);
|
||||
extern int lockref_get_not_dead(struct lockref *);
|
||||
|
||||
/* Must be called under spinlock for reliable results */
|
||||
static inline int __lockref_is_dead(const struct lockref *l)
|
||||
static inline bool __lockref_is_dead(const struct lockref *l)
|
||||
{
|
||||
return ((int)l->count < 0);
|
||||
}
|
||||
|
@@ -12,6 +12,7 @@
|
||||
#include <uapi/linux/mdio.h>
|
||||
#include <linux/mod_devicetable.h>
|
||||
|
||||
struct gpio_desc;
|
||||
struct mii_bus;
|
||||
|
||||
/* Multiple levels of nesting are possible. However typically this is
|
||||
@@ -39,6 +40,9 @@ struct mdio_device {
|
||||
/* Bus address of the MDIO device (0-31) */
|
||||
int addr;
|
||||
int flags;
|
||||
struct gpio_desc *reset;
|
||||
unsigned int reset_assert_delay;
|
||||
unsigned int reset_deassert_delay;
|
||||
};
|
||||
#define to_mdio_device(d) container_of(d, struct mdio_device, dev)
|
||||
|
||||
@@ -71,6 +75,7 @@ void mdio_device_free(struct mdio_device *mdiodev);
|
||||
struct mdio_device *mdio_device_create(struct mii_bus *bus, int addr);
|
||||
int mdio_device_register(struct mdio_device *mdiodev);
|
||||
void mdio_device_remove(struct mdio_device *mdiodev);
|
||||
void mdio_device_reset(struct mdio_device *mdiodev, int value);
|
||||
int mdio_driver_register(struct mdio_driver *drv);
|
||||
void mdio_driver_unregister(struct mdio_driver *drv);
|
||||
int mdio_device_bus_match(struct device *dev, struct device_driver *drv);
|
||||
@@ -257,6 +262,9 @@ static inline u16 ethtool_adv_to_mmd_eee_adv_t(u32 adv)
|
||||
return reg;
|
||||
}
|
||||
|
||||
int __mdiobus_read(struct mii_bus *bus, int addr, u32 regnum);
|
||||
int __mdiobus_write(struct mii_bus *bus, int addr, u32 regnum, u16 val);
|
||||
|
||||
int mdiobus_read(struct mii_bus *bus, int addr, u32 regnum);
|
||||
int mdiobus_read_nested(struct mii_bus *bus, int addr, u32 regnum);
|
||||
int mdiobus_write(struct mii_bus *bus, int addr, u32 regnum, u16 val);
|
||||
|
@@ -332,8 +332,8 @@ void memblock_enforce_memory_limit(phys_addr_t memory_limit);
|
||||
void memblock_cap_memory_range(phys_addr_t base, phys_addr_t size);
|
||||
void memblock_mem_limit_remove_map(phys_addr_t limit);
|
||||
bool memblock_is_memory(phys_addr_t addr);
|
||||
int memblock_is_map_memory(phys_addr_t addr);
|
||||
int memblock_is_region_memory(phys_addr_t base, phys_addr_t size);
|
||||
bool memblock_is_map_memory(phys_addr_t addr);
|
||||
bool memblock_is_region_memory(phys_addr_t base, phys_addr_t size);
|
||||
bool memblock_is_reserved(phys_addr_t addr);
|
||||
bool memblock_is_region_reserved(phys_addr_t base, phys_addr_t size);
|
||||
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user