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
Showing the changes to include/linux (7 of 298 files). Show all
Unified · Split
| @@ -4,6 +4,13 @@ · 3 unmodified lines | |||
| 4 | #include <asm/types.h> | 4 | #include <asm/types.h> |
| 5 | #include <linux/bits.h> | 5 | #include <linux/bits.h> |
| 6 | 6 | ||
| 7 | /* Set bits in the first 'n' bytes when loaded from memory */ | ||
| 8 | #ifdef __LITTLE_ENDIAN | ||
| 9 | # define aligned_byte_mask(n) ((1UL << 8*(n))-1) | ||
| 10 | #else | ||
| 11 | # define aligned_byte_mask(n) (~0xffUL << (BITS_PER_LONG - 8 - 8*(n))) | ||
| 12 | #endif | ||
| 13 | |||
| 7 | #define BITS_PER_TYPE(type) (sizeof(type) * BITS_PER_BYTE) | 14 | #define BITS_PER_TYPE(type) (sizeof(type) * BITS_PER_BYTE) |
| 8 | #define BITS_TO_LONGS(nr) DIV_ROUND_UP(nr, BITS_PER_TYPE(long)) | 15 | #define BITS_TO_LONGS(nr) DIV_ROUND_UP(nr, BITS_PER_TYPE(long)) |
| 9 | 16 | ||
| @@ -31,6 +31,8 @@ · 30 unmodified lines | |||
| 31 | #define SJA1105_META_SMAC 0x222222222222ull | 31 | #define SJA1105_META_SMAC 0x222222222222ull |
| 32 | #define SJA1105_META_DMAC 0x0180C200000Eull | 32 | #define SJA1105_META_DMAC 0x0180C200000Eull |
| 33 | 33 | ||
| 34 | #define SJA1105_HWTS_RX_EN 0 | ||
| 35 | |||
| 34 | /* Global tagger data: each struct sja1105_port has a reference to | 36 | /* Global tagger data: each struct sja1105_port has a reference to |
| 35 | * the structure defined in struct sja1105_private. | 37 | * the structure defined in struct sja1105_private. |
| 36 | */ | 38 | */ |
| @@ -42,7 +44,7 @@ struct sja1105_tagger_data { · 5 unmodified lines | |||
| 42 | * from taggers running on multiple ports on SMP systems | 44 | * from taggers running on multiple ports on SMP systems |
| 43 | */ | 45 | */ |
| 44 | spinlock_t meta_lock; | 46 | spinlock_t meta_lock; |
| 45 | bool hwts_rx_en; | 47 | unsigned long state; |
| 46 | }; | 48 | }; |
| 47 | 49 | ||
| 48 | struct sja1105_skb_cb { | 50 | struct sja1105_skb_cb { |
| @@ -1090,6 +1090,7 @@ enum kvm_stat_kind { · 1089 unmodified lines | |||
| 1090 | 1090 | ||
| 1091 | struct kvm_stat_data { | 1091 | struct kvm_stat_data { |
| 1092 | int offset; | 1092 | int offset; |
| 1093 | int mode; | ||
| 1093 | struct kvm *kvm; | 1094 | struct kvm *kvm; |
| 1094 | }; | 1095 | }; |
| 1095 | 1096 | ||
| @@ -1097,6 +1098,7 @@ struct kvm_stats_debugfs_item { · 1 unmodified line | |||
| 1097 | const char *name; | 1098 | const char *name; |
| 1098 | int offset; | 1099 | int offset; |
| 1099 | enum kvm_stat_kind kind; | 1100 | enum kvm_stat_kind kind; |
| 1101 | int mode; | ||
| 1100 | }; | 1102 | }; |
| 1101 | extern struct kvm_stats_debugfs_item debugfs_entries[]; | 1103 | extern struct kvm_stats_debugfs_item debugfs_entries[]; |
| 1102 | extern struct dentry *kvm_debugfs_dir; | 1104 | extern struct dentry *kvm_debugfs_dir; |
| @@ -455,6 +455,15 @@ static inline void mii_lpa_mod_linkmode_lpa_t(unsigned long *lp_advertising, · 454 unmodified lines | |||
| 455 | lp_advertising, lpa & LPA_LPACK); | 455 | lp_advertising, lpa & LPA_LPACK); |
| 456 | } | 456 | } |
| 457 | 457 | ||
| 458 | static inline void mii_ctrl1000_mod_linkmode_adv_t(unsigned long *advertising, | ||
| 459 | u32 ctrl1000) | ||
| 460 | { | ||
| 461 | linkmode_mod_bit(ETHTOOL_LINK_MODE_1000baseT_Half_BIT, advertising, | ||
| 462 | ctrl1000 & ADVERTISE_1000HALF); | ||
| 463 | linkmode_mod_bit(ETHTOOL_LINK_MODE_1000baseT_Full_BIT, advertising, | ||
| 464 | ctrl1000 & ADVERTISE_1000FULL); | ||
| 465 | } | ||
| 466 | |||
| 458 | /** | 467 | /** |
| 459 | * linkmode_adv_to_lcl_adv_t | 468 | * linkmode_adv_to_lcl_adv_t |
| 460 | * @advertising:pointer to linkmode advertising | 469 | * @advertising:pointer to linkmode advertising |
| @@ -678,6 +678,7 @@ static inline bool phy_is_started(struct phy_device *phydev) · 677 unmodified lines | |||
| 678 | return phydev->state >= PHY_UP; | 678 | return phydev->state >= PHY_UP; |
| 679 | } | 679 | } |
| 680 | 680 | ||
| 681 | void phy_resolve_aneg_pause(struct phy_device *phydev); | ||
| 681 | void phy_resolve_aneg_linkmode(struct phy_device *phydev); | 682 | void phy_resolve_aneg_linkmode(struct phy_device *phydev); |
| 682 | 683 | ||
| 683 | /** | 684 | /** |
| @@ -1076,6 +1077,7 @@ int genphy_config_eee_advert(struct phy_device *phydev); · 392 unmodified lines | |||
| 1076 | int __genphy_config_aneg(struct phy_device *phydev, bool changed); | 1077 | int __genphy_config_aneg(struct phy_device *phydev, bool changed); |
| 1077 | int genphy_aneg_done(struct phy_device *phydev); | 1078 | int genphy_aneg_done(struct phy_device *phydev); |
| 1078 | int genphy_update_link(struct phy_device *phydev); | 1079 | int genphy_update_link(struct phy_device *phydev); |
| 1080 | int genphy_read_lpa(struct phy_device *phydev); | ||
| 1079 | int genphy_read_status(struct phy_device *phydev); | 1081 | int genphy_read_status(struct phy_device *phydev); |
| 1080 | int genphy_suspend(struct phy_device *phydev); | 1082 | int genphy_suspend(struct phy_device *phydev); |
| 1081 | int genphy_resume(struct phy_device *phydev); | 1083 | 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) {} · 4159 unmodified lines | |||
| 4160 | static inline void skb_ext_copy(struct sk_buff *dst, const struct sk_buff *s) {} | 4160 | static inline void skb_ext_copy(struct sk_buff *dst, const struct sk_buff *s) {} |
| 4161 | #endif /* CONFIG_SKB_EXTENSIONS */ | 4161 | #endif /* CONFIG_SKB_EXTENSIONS */ |
| 4162 | 4162 | ||
| 4163 | static inline void nf_reset(struct sk_buff *skb) | 4163 | static inline void nf_reset_ct(struct sk_buff *skb) |
| 4164 | { | 4164 | { |
| 4165 | #if defined(CONFIG_NF_CONNTRACK) || defined(CONFIG_NF_CONNTRACK_MODULE) | 4165 | #if defined(CONFIG_NF_CONNTRACK) || defined(CONFIG_NF_CONNTRACK_MODULE) |
| 4166 | nf_conntrack_put(skb_nfct(skb)); | 4166 | nf_conntrack_put(skb_nfct(skb)); |
| 4167 | skb->_nfct = 0; | 4167 | skb->_nfct = 0; |
| 4168 | #endif | 4168 | #endif |
| 4169 | #if IS_ENABLED(CONFIG_BRIDGE_NETFILTER) | ||
| 4170 | skb_ext_del(skb, SKB_EXT_BRIDGE_NF); | ||
| 4171 | #endif | ||
| 4172 | } | 4169 | } |
| 4173 | 4170 | ||
| 4174 | static inline void nf_reset_trace(struct sk_buff *skb) | 4171 | 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, · 230 unmodified lines | |||
| 231 | 231 | ||
| 232 | #endif /* ARCH_HAS_NOCACHE_UACCESS */ | 232 | #endif /* ARCH_HAS_NOCACHE_UACCESS */ |
| 233 | 233 | ||
| 234 | extern __must_check int check_zeroed_user(const void __user *from, size_t size); | ||
| 235 | |||
| 236 | /** | ||
| 237 | * copy_struct_from_user: copy a struct from userspace | ||
| 238 | * @dst: Destination address, in kernel space. This buffer must be @ksize | ||
| 239 | * bytes long. | ||
| 240 | * @ksize: Size of @dst struct. | ||
| 241 | * @src: Source address, in userspace. | ||
| 242 | * @usize: (Alleged) size of @src struct. | ||
| 243 | * | ||
| 244 | * Copies a struct from userspace to kernel space, in a way that guarantees | ||
| 245 | * backwards-compatibility for struct syscall arguments (as long as future | ||
| 246 | * struct extensions are made such that all new fields are *appended* to the | ||
| 247 | * old struct, and zeroed-out new fields have the same meaning as the old | ||
| 248 | * struct). | ||
| 249 | * | ||
| 250 | * @ksize is just sizeof(*dst), and @usize should've been passed by userspace. | ||
| 251 | * The recommended usage is something like the following: | ||
| 252 | * | ||
| 253 | * SYSCALL_DEFINE2(foobar, const struct foo __user *, uarg, size_t, usize) | ||
| 254 | * { | ||
| 255 | * int err; | ||
| 256 | * struct foo karg = {}; | ||
| 257 | * | ||
| 258 | * if (usize > PAGE_SIZE) | ||
| 259 | * return -E2BIG; | ||
| 260 | * if (usize < FOO_SIZE_VER0) | ||
| 261 | * return -EINVAL; | ||
| 262 | * | ||
| 263 | * err = copy_struct_from_user(&karg, sizeof(karg), uarg, usize); | ||
| 264 | * if (err) | ||
| 265 | * return err; | ||
| 266 | * | ||
| 267 | * // ... | ||
| 268 | * } | ||
| 269 | * | ||
| 270 | * There are three cases to consider: | ||
| 271 | * * If @usize == @ksize, then it's copied verbatim. | ||
| 272 | * * If @usize < @ksize, then the userspace has passed an old struct to a | ||
| 273 | * newer kernel. The rest of the trailing bytes in @dst (@ksize - @usize) | ||
| 274 | * are to be zero-filled. | ||
| 275 | * * If @usize > @ksize, then the userspace has passed a new struct to an | ||
| 276 | * older kernel. The trailing bytes unknown to the kernel (@usize - @ksize) | ||
| 277 | * are checked to ensure they are zeroed, otherwise -E2BIG is returned. | ||
| 278 | * | ||
| 279 | * Returns (in all cases, some data may have been copied): | ||
| 280 | * * -E2BIG: (@usize > @ksize) and there are non-zero trailing bytes in @src. | ||
| 281 | * * -EFAULT: access to userspace failed. | ||
| 282 | */ | ||
| 283 | static __always_inline __must_check int | ||
| 284 | copy_struct_from_user(void *dst, size_t ksize, const void __user *src, | ||
| 285 | size_t usize) | ||
| 286 | { | ||
| 287 | size_t size = min(ksize, usize); | ||
| 288 | size_t rest = max(ksize, usize) - size; | ||
| 289 | |||
| 290 | /* Deal with trailing bytes. */ | ||
| 291 | if (usize < ksize) { | ||
| 292 | memset(dst + size, 0, rest); | ||
| 293 | } else if (usize > ksize) { | ||
| 294 | int ret = check_zeroed_user(src + size, rest); | ||
| 295 | if (ret <= 0) | ||
| 296 | return ret ?: -E2BIG; | ||
| 297 | } | ||
| 298 | /* Copy the interoperable parts of the struct. */ | ||
| 299 | if (copy_from_user(dst, src, size)) | ||
| 300 | return -EFAULT; | ||
| 301 | return 0; | ||
| 302 | } | ||
| 303 | |||
| 234 | /* | 304 | /* |
| 235 | * probe_kernel_read(): safely attempt to read from a location | 305 | * probe_kernel_read(): safely attempt to read from a location |
| 236 | * @dst: pointer to the buffer that shall take the data | 306 | * @dst: pointer to the buffer that shall take the data |