mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-02-19 08:58:32 -05:00
Merge branch 'errata/tx2-219' into for-next/fixes
Workaround for Cavium/Marvell ThunderX2 erratum #219. * errata/tx2-219: arm64: Allow CAVIUM_TX2_ERRATUM_219 to be selected arm64: Avoid Cavium TX2 erratum 219 when switching TTBR arm64: Enable workaround for Cavium TX2 erratum 219 when running SMT arm64: KVM: Trap VM ops when ARM64_WORKAROUND_CAVIUM_TX2_219_TVM is set
This commit is contained in:
@@ -4,6 +4,13 @@
|
||||
#include <asm/types.h>
|
||||
#include <linux/bits.h>
|
||||
|
||||
/* Set bits in the first 'n' bytes when loaded from memory */
|
||||
#ifdef __LITTLE_ENDIAN
|
||||
# define aligned_byte_mask(n) ((1UL << 8*(n))-1)
|
||||
#else
|
||||
# define aligned_byte_mask(n) (~0xffUL << (BITS_PER_LONG - 8 - 8*(n)))
|
||||
#endif
|
||||
|
||||
#define BITS_PER_TYPE(type) (sizeof(type) * BITS_PER_BYTE)
|
||||
#define BITS_TO_LONGS(nr) DIV_ROUND_UP(nr, BITS_PER_TYPE(long))
|
||||
|
||||
|
||||
@@ -31,6 +31,8 @@
|
||||
#define SJA1105_META_SMAC 0x222222222222ull
|
||||
#define SJA1105_META_DMAC 0x0180C200000Eull
|
||||
|
||||
#define SJA1105_HWTS_RX_EN 0
|
||||
|
||||
/* Global tagger data: each struct sja1105_port has a reference to
|
||||
* the structure defined in struct sja1105_private.
|
||||
*/
|
||||
@@ -42,7 +44,7 @@ struct sja1105_tagger_data {
|
||||
* from taggers running on multiple ports on SMP systems
|
||||
*/
|
||||
spinlock_t meta_lock;
|
||||
bool hwts_rx_en;
|
||||
unsigned long state;
|
||||
};
|
||||
|
||||
struct sja1105_skb_cb {
|
||||
|
||||
@@ -1090,6 +1090,7 @@ enum kvm_stat_kind {
|
||||
|
||||
struct kvm_stat_data {
|
||||
int offset;
|
||||
int mode;
|
||||
struct kvm *kvm;
|
||||
};
|
||||
|
||||
@@ -1097,6 +1098,7 @@ struct kvm_stats_debugfs_item {
|
||||
const char *name;
|
||||
int offset;
|
||||
enum kvm_stat_kind kind;
|
||||
int mode;
|
||||
};
|
||||
extern struct kvm_stats_debugfs_item debugfs_entries[];
|
||||
extern struct dentry *kvm_debugfs_dir;
|
||||
|
||||
@@ -455,6 +455,15 @@ static inline void mii_lpa_mod_linkmode_lpa_t(unsigned long *lp_advertising,
|
||||
lp_advertising, lpa & LPA_LPACK);
|
||||
}
|
||||
|
||||
static inline void mii_ctrl1000_mod_linkmode_adv_t(unsigned long *advertising,
|
||||
u32 ctrl1000)
|
||||
{
|
||||
linkmode_mod_bit(ETHTOOL_LINK_MODE_1000baseT_Half_BIT, advertising,
|
||||
ctrl1000 & ADVERTISE_1000HALF);
|
||||
linkmode_mod_bit(ETHTOOL_LINK_MODE_1000baseT_Full_BIT, advertising,
|
||||
ctrl1000 & ADVERTISE_1000FULL);
|
||||
}
|
||||
|
||||
/**
|
||||
* linkmode_adv_to_lcl_adv_t
|
||||
* @advertising:pointer to linkmode advertising
|
||||
|
||||
@@ -678,6 +678,7 @@ static inline bool phy_is_started(struct phy_device *phydev)
|
||||
return phydev->state >= PHY_UP;
|
||||
}
|
||||
|
||||
void phy_resolve_aneg_pause(struct phy_device *phydev);
|
||||
void phy_resolve_aneg_linkmode(struct phy_device *phydev);
|
||||
|
||||
/**
|
||||
@@ -1076,6 +1077,7 @@ int genphy_config_eee_advert(struct phy_device *phydev);
|
||||
int __genphy_config_aneg(struct phy_device *phydev, bool changed);
|
||||
int genphy_aneg_done(struct phy_device *phydev);
|
||||
int genphy_update_link(struct phy_device *phydev);
|
||||
int genphy_read_lpa(struct phy_device *phydev);
|
||||
int genphy_read_status(struct phy_device *phydev);
|
||||
int genphy_suspend(struct phy_device *phydev);
|
||||
int genphy_resume(struct phy_device *phydev);
|
||||
|
||||
@@ -4160,15 +4160,12 @@ static inline void __skb_ext_copy(struct sk_buff *d, const struct sk_buff *s) {}
|
||||
static inline void skb_ext_copy(struct sk_buff *dst, const struct sk_buff *s) {}
|
||||
#endif /* CONFIG_SKB_EXTENSIONS */
|
||||
|
||||
static inline void nf_reset(struct sk_buff *skb)
|
||||
static inline void nf_reset_ct(struct sk_buff *skb)
|
||||
{
|
||||
#if defined(CONFIG_NF_CONNTRACK) || defined(CONFIG_NF_CONNTRACK_MODULE)
|
||||
nf_conntrack_put(skb_nfct(skb));
|
||||
skb->_nfct = 0;
|
||||
#endif
|
||||
#if IS_ENABLED(CONFIG_BRIDGE_NETFILTER)
|
||||
skb_ext_del(skb, SKB_EXT_BRIDGE_NF);
|
||||
#endif
|
||||
}
|
||||
|
||||
static inline void nf_reset_trace(struct sk_buff *skb)
|
||||
|
||||
@@ -231,6 +231,76 @@ __copy_from_user_inatomic_nocache(void *to, const void __user *from,
|
||||
|
||||
#endif /* ARCH_HAS_NOCACHE_UACCESS */
|
||||
|
||||
extern __must_check int check_zeroed_user(const void __user *from, size_t size);
|
||||
|
||||
/**
|
||||
* copy_struct_from_user: copy a struct from userspace
|
||||
* @dst: Destination address, in kernel space. This buffer must be @ksize
|
||||
* bytes long.
|
||||
* @ksize: Size of @dst struct.
|
||||
* @src: Source address, in userspace.
|
||||
* @usize: (Alleged) size of @src struct.
|
||||
*
|
||||
* Copies a struct from userspace to kernel space, in a way that guarantees
|
||||
* backwards-compatibility for struct syscall arguments (as long as future
|
||||
* struct extensions are made such that all new fields are *appended* to the
|
||||
* old struct, and zeroed-out new fields have the same meaning as the old
|
||||
* struct).
|
||||
*
|
||||
* @ksize is just sizeof(*dst), and @usize should've been passed by userspace.
|
||||
* The recommended usage is something like the following:
|
||||
*
|
||||
* SYSCALL_DEFINE2(foobar, const struct foo __user *, uarg, size_t, usize)
|
||||
* {
|
||||
* int err;
|
||||
* struct foo karg = {};
|
||||
*
|
||||
* if (usize > PAGE_SIZE)
|
||||
* return -E2BIG;
|
||||
* if (usize < FOO_SIZE_VER0)
|
||||
* return -EINVAL;
|
||||
*
|
||||
* err = copy_struct_from_user(&karg, sizeof(karg), uarg, usize);
|
||||
* if (err)
|
||||
* return err;
|
||||
*
|
||||
* // ...
|
||||
* }
|
||||
*
|
||||
* There are three cases to consider:
|
||||
* * If @usize == @ksize, then it's copied verbatim.
|
||||
* * If @usize < @ksize, then the userspace has passed an old struct to a
|
||||
* newer kernel. The rest of the trailing bytes in @dst (@ksize - @usize)
|
||||
* are to be zero-filled.
|
||||
* * If @usize > @ksize, then the userspace has passed a new struct to an
|
||||
* older kernel. The trailing bytes unknown to the kernel (@usize - @ksize)
|
||||
* are checked to ensure they are zeroed, otherwise -E2BIG is returned.
|
||||
*
|
||||
* Returns (in all cases, some data may have been copied):
|
||||
* * -E2BIG: (@usize > @ksize) and there are non-zero trailing bytes in @src.
|
||||
* * -EFAULT: access to userspace failed.
|
||||
*/
|
||||
static __always_inline __must_check int
|
||||
copy_struct_from_user(void *dst, size_t ksize, const void __user *src,
|
||||
size_t usize)
|
||||
{
|
||||
size_t size = min(ksize, usize);
|
||||
size_t rest = max(ksize, usize) - size;
|
||||
|
||||
/* Deal with trailing bytes. */
|
||||
if (usize < ksize) {
|
||||
memset(dst + size, 0, rest);
|
||||
} else if (usize > ksize) {
|
||||
int ret = check_zeroed_user(src + size, rest);
|
||||
if (ret <= 0)
|
||||
return ret ?: -E2BIG;
|
||||
}
|
||||
/* Copy the interoperable parts of the struct. */
|
||||
if (copy_from_user(dst, src, size))
|
||||
return -EFAULT;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* probe_kernel_read(): safely attempt to read from a location
|
||||
* @dst: pointer to the buffer that shall take the data
|
||||
|
||||
Reference in New Issue
Block a user