···99Required properties:1010- compatible: Should be "mediatek,mt7623-eth"1111- reg: Address and length of the register set for the device1212-- interrupts: Should contain the frame engines interrupt1212+- interrupts: Should contain the three frame engines interrupts in numeric1313+ order. These are fe_int0, fe_int1 and fe_int2.1314- clocks: the clock used by the core1415- clock-names: the names of the clock listed in the clocks property. These are1516 "ethif", "esw", "gp2", "gp1"···4342 <ðsys CLK_ETHSYS_GP2>,4443 <ðsys CLK_ETHSYS_GP1>;4544 clock-names = "ethif", "esw", "gp2", "gp1";4646- interrupts = <GIC_SPI 200 IRQ_TYPE_LEVEL_LOW>;4545+ interrupts = <GIC_SPI 200 IRQ_TYPE_LEVEL_LOW4646+ GIC_SPI 199 IRQ_TYPE_LEVEL_LOW4747+ GIC_SPI 198 IRQ_TYPE_LEVEL_LOW>;4748 power-domains = <&scpsys MT2701_POWER_DOMAIN_ETH>;4849 resets = <ðsys MT2701_ETHSYS_ETH_RST>;4950 reset-names = "eth";
···1515 is the rtc tick interrupt. The number of cells representing a interrupt1616 depends on the parent interrupt controller.1717- clocks: Must contain a list of phandle and clock specifier for the rtc1818- and source clocks.1919-- clock-names: Must contain "rtc" and "rtc_src" entries sorted in the2020- same order as the clocks property.1818+ clock and in the case of a s3c6410 compatible controller, also1919+ a source clock.2020+- clock-names: Must contain "rtc" and for a s3c6410 compatible controller,2121+ a "rtc_src" sorted in the same order as the clocks property.21222223Example:2324
+4
Documentation/input/event-codes.txt
···173173 proximity of the device and while the value of the BTN_TOUCH code is 0. If174174 the input device may be used freely in three dimensions, consider ABS_Z175175 instead.176176+ - BTN_TOOL_<name> should be set to 1 when the tool comes into detectable177177+ proximity and set to 0 when the tool leaves detectable proximity.178178+ BTN_TOOL_<name> signals the type of tool that is currently detected by the179179+ hardware and is otherwise independent of ABS_DISTANCE and/or BTN_TOUCH.176180177181* ABS_MT_<name>:178182 - Used to describe multitouch input events. Please see
+3-3
Documentation/x86/x86_64/mm.txt
···1919ffffffef00000000 - ffffffff00000000 (=64 GB) EFI region mapping space2020... unused hole ...2121ffffffff80000000 - ffffffffa0000000 (=512 MB) kernel text mapping, from phys 02222-ffffffffa0000000 - ffffffffff5fffff (=1525 MB) module mapping space2222+ffffffffa0000000 - ffffffffff5fffff (=1526 MB) module mapping space2323ffffffffff600000 - ffffffffffdfffff (=8 MB) vsyscalls2424ffffffffffe00000 - ffffffffffffffff (=2 MB) unused hole2525···3131the processes using the page fault handler, with init_level4_pgt as3232reference.33333434-Current X86-64 implementations only support 40 bits of address space,3535-but we support up to 46 bits. This expands into MBZ space in the page tables.3434+Current X86-64 implementations support up to 46 bits of address space (64 TB),3535+which is our current limit. This expands into MBZ space in the page tables.36363737We map EFI runtime services in the 'efi_pgd' PGD in a 64Gb large virtual3838memory window (this size is arbitrary, it can be raised later if needed).
···588588 msr vpidr_el2, x0589589 msr vmpidr_el2, x1590590591591+ /*592592+ * When VHE is not in use, early init of EL2 and EL1 needs to be593593+ * done here.594594+ * When VHE _is_ in use, EL1 will not be used in the host and595595+ * requires no configuration, and all non-hyp-specific EL2 setup596596+ * will be done via the _EL1 system register aliases in __cpu_setup.597597+ */598598+ cbnz x2, 1f599599+591600 /* sctlr_el1 */592601 mov x0, #0x0800 // Set/clear RES{1,0} bits593602CPU_BE( movk x0, #0x33d0, lsl #16 ) // Set EE and E0E on BE systems···606597 /* Coprocessor traps. */607598 mov x0, #0x33ff608599 msr cptr_el2, x0 // Disable copro. traps to EL2600600+1:609601610602#ifdef CONFIG_COMPAT611603 msr hstr_el2, xzr // Disable CP15 traps to EL2···744734745735 .macro update_early_cpu_boot_status status, tmp1, tmp2746736 mov \tmp2, #\status747747- str_l \tmp2, __early_cpu_boot_status, \tmp1737737+ adr_l \tmp1, __early_cpu_boot_status738738+ str \tmp2, [\tmp1]748739 dmb sy749740 dc ivac, \tmp1 // Invalidate potentially stale cache line750741 .endm
+6-5
arch/arm64/kernel/smp_spin_table.c
···5252static int smp_spin_table_cpu_init(unsigned int cpu)5353{5454 struct device_node *dn;5555+ int ret;55565657 dn = of_get_cpu_node(cpu, NULL);5758 if (!dn)···6160 /*6261 * Determine the address from which the CPU is polling.6362 */6464- if (of_property_read_u64(dn, "cpu-release-addr",6565- &cpu_release_addr[cpu])) {6363+ ret = of_property_read_u64(dn, "cpu-release-addr",6464+ &cpu_release_addr[cpu]);6565+ if (ret)6666 pr_err("CPU %d: missing or invalid cpu-release-addr property\n",6767 cpu);68686969- return -1;7070- }6969+ of_node_put(dn);71707272- return 0;7171+ return ret;7372}74737574static int smp_spin_table_cpu_prepare(unsigned int cpu)
+1
arch/powerpc/include/uapi/asm/cputable.h
···3131#define PPC_FEATURE_PSERIES_PERFMON_COMPAT \3232 0x0000004033333434+/* Reserved - do not use 0x00000004 */3435#define PPC_FEATURE_TRUE_LE 0x000000023536#define PPC_FEATURE_PPC_LE 0x000000013637
+15-11
arch/powerpc/kernel/prom.c
···148148 unsigned long cpu_features; /* CPU_FTR_xxx bit */149149 unsigned long mmu_features; /* MMU_FTR_xxx bit */150150 unsigned int cpu_user_ftrs; /* PPC_FEATURE_xxx bit */151151+ unsigned int cpu_user_ftrs2; /* PPC_FEATURE2_xxx bit */151152 unsigned char pabyte; /* byte number in ibm,pa-features */152153 unsigned char pabit; /* bit number (big-endian) */153154 unsigned char invert; /* if 1, pa bit set => clear feature */154155} ibm_pa_features[] __initdata = {155155- {0, 0, PPC_FEATURE_HAS_MMU, 0, 0, 0},156156- {0, 0, PPC_FEATURE_HAS_FPU, 0, 1, 0},157157- {CPU_FTR_CTRL, 0, 0, 0, 3, 0},158158- {CPU_FTR_NOEXECUTE, 0, 0, 0, 6, 0},159159- {CPU_FTR_NODSISRALIGN, 0, 0, 1, 1, 1},160160- {0, MMU_FTR_CI_LARGE_PAGE, 0, 1, 2, 0},161161- {CPU_FTR_REAL_LE, PPC_FEATURE_TRUE_LE, 5, 0, 0},156156+ {0, 0, PPC_FEATURE_HAS_MMU, 0, 0, 0, 0},157157+ {0, 0, PPC_FEATURE_HAS_FPU, 0, 0, 1, 0},158158+ {CPU_FTR_CTRL, 0, 0, 0, 0, 3, 0},159159+ {CPU_FTR_NOEXECUTE, 0, 0, 0, 0, 6, 0},160160+ {CPU_FTR_NODSISRALIGN, 0, 0, 0, 1, 1, 1},161161+ {0, MMU_FTR_CI_LARGE_PAGE, 0, 0, 1, 2, 0},162162+ {CPU_FTR_REAL_LE, 0, PPC_FEATURE_TRUE_LE, 0, 5, 0, 0},162163 /*163163- * If the kernel doesn't support TM (ie. CONFIG_PPC_TRANSACTIONAL_MEM=n),164164- * we don't want to turn on CPU_FTR_TM here, so we use CPU_FTR_TM_COMP165165- * which is 0 if the kernel doesn't support TM.164164+ * If the kernel doesn't support TM (ie CONFIG_PPC_TRANSACTIONAL_MEM=n),165165+ * we don't want to turn on TM here, so we use the *_COMP versions166166+ * which are 0 if the kernel doesn't support TM.166167 */167167- {CPU_FTR_TM_COMP, 0, 0, 22, 0, 0},168168+ {CPU_FTR_TM_COMP, 0, 0,169169+ PPC_FEATURE2_HTM_COMP|PPC_FEATURE2_HTM_NOSC_COMP, 22, 0, 0},168170};169171170172static void __init scan_features(unsigned long node, const unsigned char *ftrs,···197195 if (bit ^ fp->invert) {198196 cur_cpu_spec->cpu_features |= fp->cpu_features;199197 cur_cpu_spec->cpu_user_features |= fp->cpu_user_ftrs;198198+ cur_cpu_spec->cpu_user_features2 |= fp->cpu_user_ftrs2;200199 cur_cpu_spec->mmu_features |= fp->mmu_features;201200 } else {202201 cur_cpu_spec->cpu_features &= ~fp->cpu_features;203202 cur_cpu_spec->cpu_user_features &= ~fp->cpu_user_ftrs;203203+ cur_cpu_spec->cpu_user_features2 &= ~fp->cpu_user_ftrs2;204204 cur_cpu_spec->mmu_features &= ~fp->mmu_features;205205 }206206 }
···105105 if (_raw_compare_and_swap(&lp->lock, 0, cpu))106106 return;107107 local_irq_restore(flags);108108+ continue;108109 }109110 /* Check if the lock owner is running. */110111 if (first_diag && cpu_is_preempted(~owner)) {
···425425 struct acp_pm_domain *apd;426426 struct amdgpu_device *adev = (struct amdgpu_device *)handle;427427428428+ /* return early if no ACP */429429+ if (!adev->acp.acp_genpd)430430+ return 0;431431+428432 /* SMU block will power on ACP irrespective of ACP runtime status.429433 * Power off explicitly based on genpd ACP runtime status so that ACP430434 * hw and ACP-genpd status are in sync.
+1-1
drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c
···303303 fw_info.feature = adev->vce.fb_version;304304 break;305305 case AMDGPU_INFO_FW_UVD:306306- fw_info.ver = 0;306306+ fw_info.ver = adev->uvd.fw_version;307307 fw_info.feature = 0;308308 break;309309 case AMDGPU_INFO_FW_GMC:
···234234 if (i == AMDGPU_MAX_VCE_HANDLES)235235 return 0;236236237237+ cancel_delayed_work_sync(&adev->vce.idle_work);237238 /* TODO: suspending running encoding sessions isn't supported */238239 return -EINVAL;239240}
+8-1
drivers/gpu/drm/drm_dp_mst_topology.c
···16721672 u8 sinks[DRM_DP_MAX_SDP_STREAMS];16731673 int i;1674167416751675+ port = drm_dp_get_validated_port_ref(mgr, port);16761676+ if (!port)16771677+ return -EINVAL;16781678+16751679 port_num = port->port_num;16761680 mstb = drm_dp_get_validated_mstb_ref(mgr, port->parent);16771681 if (!mstb) {16781682 mstb = drm_dp_get_last_connected_port_and_mstb(mgr, port->parent, &port_num);1679168316801680- if (!mstb)16841684+ if (!mstb) {16851685+ drm_dp_put_port(port);16811686 return -EINVAL;16871687+ }16821688 }1683168916841690 txmsg = kzalloc(sizeof(*txmsg), GFP_KERNEL);···17131707 kfree(txmsg);17141708fail_put:17151709 drm_dp_put_mst_branch_device(mstb);17101710+ drm_dp_put_port(port);17161711 return ret;17171712}17181713
+3-2
drivers/gpu/drm/i915/i915_drv.h
···2634263426352635/* WaRsDisableCoarsePowerGating:skl,bxt */26362636#define NEEDS_WaRsDisableCoarsePowerGating(dev) (IS_BXT_REVID(dev, 0, BXT_REVID_A1) || \26372637- ((IS_SKL_GT3(dev) || IS_SKL_GT4(dev)) && \26382638- IS_SKL_REVID(dev, 0, SKL_REVID_F0)))26372637+ IS_SKL_GT3(dev) || \26382638+ IS_SKL_GT4(dev))26392639+26392640/*26402641 * dp aux and gmbus irq on gen4 seems to be able to generate legacy interrupts26412642 * even when in MSI mode. This results in spurious interrupt warnings if the
+16-11
drivers/gpu/drm/i915/i915_gem_userptr.c
···501501 if (pvec != NULL) {502502 struct mm_struct *mm = obj->userptr.mm->mm;503503504504- down_read(&mm->mmap_sem);505505- while (pinned < npages) {506506- ret = get_user_pages_remote(work->task, mm,507507- obj->userptr.ptr + pinned * PAGE_SIZE,508508- npages - pinned,509509- !obj->userptr.read_only, 0,510510- pvec + pinned, NULL);511511- if (ret < 0)512512- break;504504+ ret = -EFAULT;505505+ if (atomic_inc_not_zero(&mm->mm_users)) {506506+ down_read(&mm->mmap_sem);507507+ while (pinned < npages) {508508+ ret = get_user_pages_remote509509+ (work->task, mm,510510+ obj->userptr.ptr + pinned * PAGE_SIZE,511511+ npages - pinned,512512+ !obj->userptr.read_only, 0,513513+ pvec + pinned, NULL);514514+ if (ret < 0)515515+ break;513516514514- pinned += ret;517517+ pinned += ret;518518+ }519519+ up_read(&mm->mmap_sem);520520+ mmput(mm);515521 }516516- up_read(&mm->mmap_sem);517522 }518523519524 mutex_lock(&dev->struct_mutex);
+11-5
drivers/gpu/drm/i915/intel_lrc.c
···841841 if (unlikely(total_bytes > remain_usable)) {842842 /*843843 * The base request will fit but the reserved space844844- * falls off the end. So only need to to wait for the845845- * reserved size after flushing out the remainder.844844+ * falls off the end. So don't need an immediate wrap845845+ * and only need to effectively wait for the reserved846846+ * size space from the start of ringbuffer.846847 */847848 wait_bytes = remain_actual + ringbuf->reserved_size;848848- need_wrap = true;849849 } else if (total_bytes > ringbuf->space) {850850 /* No wrapping required, just waiting. */851851 wait_bytes = total_bytes;···19131913 struct intel_ringbuffer *ringbuf = request->ringbuf;19141914 int ret;1915191519161916- ret = intel_logical_ring_begin(request, 6 + WA_TAIL_DWORDS);19161916+ ret = intel_logical_ring_begin(request, 8 + WA_TAIL_DWORDS);19171917 if (ret)19181918 return ret;19191919+19201920+ /* We're using qword write, seqno should be aligned to 8 bytes. */19211921+ BUILD_BUG_ON(I915_GEM_HWS_INDEX & 1);1919192219201923 /* w/a for post sync ops following a GPGPU operation we19211924 * need a prior CS_STALL, which is emitted by the flush19221925 * following the batch.19231926 */19241924- intel_logical_ring_emit(ringbuf, GFX_OP_PIPE_CONTROL(5));19271927+ intel_logical_ring_emit(ringbuf, GFX_OP_PIPE_CONTROL(6));19251928 intel_logical_ring_emit(ringbuf,19261929 (PIPE_CONTROL_GLOBAL_GTT_IVB |19271930 PIPE_CONTROL_CS_STALL |···19321929 intel_logical_ring_emit(ringbuf, hws_seqno_address(request->ring));19331930 intel_logical_ring_emit(ringbuf, 0);19341931 intel_logical_ring_emit(ringbuf, i915_gem_request_get_seqno(request));19321932+ /* We're thrashing one dword of HWS. */19331933+ intel_logical_ring_emit(ringbuf, 0);19351934 intel_logical_ring_emit(ringbuf, MI_USER_INTERRUPT);19351935+ intel_logical_ring_emit(ringbuf, MI_NOOP);19361936 return intel_logical_ring_advance_and_submit(request);19371937}19381938
···968968969969 /* WaForceContextSaveRestoreNonCoherent:skl,bxt */970970 tmp = HDC_FORCE_CONTEXT_SAVE_RESTORE_NON_COHERENT;971971- if (IS_SKL_REVID(dev, SKL_REVID_F0, SKL_REVID_F0) ||971971+ if (IS_SKL_REVID(dev, SKL_REVID_F0, REVID_FOREVER) ||972972 IS_BXT_REVID(dev, BXT_REVID_B0, REVID_FOREVER))973973 tmp |= HDC_FORCE_CSR_NON_COHERENT_OVR_DISABLE;974974 WA_SET_BIT_MASKED(HDC_CHICKEN0, tmp);···10851085 WA_SET_BIT_MASKED(HIZ_CHICKEN,10861086 BDW_HIZ_POWER_COMPILER_CLOCK_GATING_DISABLE);1087108710881088- if (IS_SKL_REVID(dev, 0, SKL_REVID_F0)) {10881088+ /* This is tied to WaForceContextSaveRestoreNonCoherent */10891089+ if (IS_SKL_REVID(dev, 0, REVID_FOREVER)) {10891090 /*10901091 *Use Force Non-Coherent whenever executing a 3D context. This10911092 * is a workaround for a possible hang in the unlikely event···20912090{20922091 struct drm_i915_private *dev_priv = to_i915(dev);20932092 struct drm_i915_gem_object *obj = ringbuf->obj;20932093+ /* Ring wraparound at offset 0 sometimes hangs. No idea why. */20942094+ unsigned flags = PIN_OFFSET_BIAS | 4096;20942095 int ret;2095209620962097 if (HAS_LLC(dev_priv) && !obj->stolen) {20972097- ret = i915_gem_obj_ggtt_pin(obj, PAGE_SIZE, 0);20982098+ ret = i915_gem_obj_ggtt_pin(obj, PAGE_SIZE, flags);20982099 if (ret)20992100 return ret;21002101···21122109 return -ENOMEM;21132110 }21142111 } else {21152115- ret = i915_gem_obj_ggtt_pin(obj, PAGE_SIZE, PIN_MAPPABLE);21122112+ ret = i915_gem_obj_ggtt_pin(obj, PAGE_SIZE,21132113+ flags | PIN_MAPPABLE);21162114 if (ret)21172115 return ret;21182116···24582454 if (unlikely(total_bytes > remain_usable)) {24592455 /*24602456 * The base request will fit but the reserved space24612461- * falls off the end. So only need to to wait for the24622462- * reserved size after flushing out the remainder.24572457+ * falls off the end. So don't need an immediate wrap24582458+ * and only need to effectively wait for the reserved24592459+ * size space from the start of ringbuffer.24632460 */24642461 wait_bytes = remain_actual + ringbuf->reserved_size;24652465- need_wrap = true;24662462 } else if (total_bytes > ringbuf->space) {24672463 /* No wrapping required, just waiting. */24682464 wait_bytes = total_bytes;
···1832183218331833 gf100_gr_mmio(gr, gr->func->mmio);1834183418351835+ nvkm_mask(device, TPC_UNIT(0, 0, 0x05c), 0x00000001, 0x00000001);18361836+18351837 memcpy(tpcnr, gr->tpc_nr, sizeof(gr->tpc_nr));18361838 for (i = 0, gpc = -1; i < gr->tpc_total; i++) {18371839 do {
+7-4
drivers/gpu/drm/radeon/radeon_atpx_handler.c
···6262 return radeon_atpx_priv.atpx_detected;6363}64646565-bool radeon_has_atpx_dgpu_power_cntl(void) {6666- return radeon_atpx_priv.atpx.functions.power_cntl;6767-}6868-6965/**7066 * radeon_atpx_call - call an ATPX method7167 *···141145 */142146static int radeon_atpx_validate(struct radeon_atpx *atpx)143147{148148+ /* make sure required functions are enabled */149149+ /* dGPU power control is required */150150+ if (atpx->functions.power_cntl == false) {151151+ printk("ATPX dGPU power cntl not present, forcing\n");152152+ atpx->functions.power_cntl = true;153153+ }154154+144155 if (atpx->functions.px_params) {145156 union acpi_object *info;146157 struct atpx_px_params output;
+6-1
drivers/gpu/drm/radeon/radeon_connectors.c
···20022002 rdev->mode_info.dither_property,20032003 RADEON_FMT_DITHER_DISABLE);2004200420052005- if (radeon_audio != 0)20052005+ if (radeon_audio != 0) {20062006 drm_object_attach_property(&radeon_connector->base.base,20072007 rdev->mode_info.audio_property,20082008 RADEON_AUDIO_AUTO);20092009+ radeon_connector->audio = RADEON_AUDIO_AUTO;20102010+ }20092011 if (ASIC_IS_DCE5(rdev))20102012 drm_object_attach_property(&radeon_connector->base.base,20112013 rdev->mode_info.output_csc_property,···21322130 drm_object_attach_property(&radeon_connector->base.base,21332131 rdev->mode_info.audio_property,21342132 RADEON_AUDIO_AUTO);21332133+ radeon_connector->audio = RADEON_AUDIO_AUTO;21352134 }21362135 if (connector_type == DRM_MODE_CONNECTOR_DVII) {21372136 radeon_connector->dac_load_detect = true;···21882185 drm_object_attach_property(&radeon_connector->base.base,21892186 rdev->mode_info.audio_property,21902187 RADEON_AUDIO_AUTO);21882188+ radeon_connector->audio = RADEON_AUDIO_AUTO;21912189 }21922190 if (ASIC_IS_DCE5(rdev))21932191 drm_object_attach_property(&radeon_connector->base.base,···22412237 drm_object_attach_property(&radeon_connector->base.base,22422238 rdev->mode_info.audio_property,22432239 RADEON_AUDIO_AUTO);22402240+ radeon_connector->audio = RADEON_AUDIO_AUTO;22442241 }22452242 if (ASIC_IS_DCE5(rdev))22462243 drm_object_attach_property(&radeon_connector->base.base,
+4-10
drivers/gpu/drm/radeon/radeon_device.c
···103103 "LAST",104104};105105106106-#if defined(CONFIG_VGA_SWITCHEROO)107107-bool radeon_has_atpx_dgpu_power_cntl(void);108108-#else109109-static inline bool radeon_has_atpx_dgpu_power_cntl(void) { return false; }110110-#endif111111-112106#define RADEON_PX_QUIRK_DISABLE_PX (1 << 0)113107#define RADEON_PX_QUIRK_LONG_WAKEUP (1 << 1)114108···12991305 }13001306 rdev->fence_context = fence_context_alloc(RADEON_NUM_RINGS);1301130713021302- DRM_INFO("initializing kernel modesetting (%s 0x%04X:0x%04X 0x%04X:0x%04X).\n",13031303- radeon_family_name[rdev->family], pdev->vendor, pdev->device,13041304- pdev->subsystem_vendor, pdev->subsystem_device);13081308+ DRM_INFO("initializing kernel modesetting (%s 0x%04X:0x%04X 0x%04X:0x%04X 0x%02X).\n",13091309+ radeon_family_name[rdev->family], pdev->vendor, pdev->device,13101310+ pdev->subsystem_vendor, pdev->subsystem_device, pdev->revision);1305131113061312 /* mutex initialization are all done here so we13071313 * can recall function without having locking issues */···14331439 * ignore it */14341440 vga_client_register(rdev->pdev, rdev, NULL, radeon_vga_set_decode);1435144114361436- if ((rdev->flags & RADEON_IS_PX) && radeon_has_atpx_dgpu_power_cntl())14421442+ if (rdev->flags & RADEON_IS_PX)14371443 runtime = true;14381444 vga_switcheroo_register_client(rdev->pdev, &radeon_switcheroo_ops, runtime);14391445 if (runtime)
···858858 goto err_free_buf;859859 }860860861861+ /* Sanity check that a device has an endpoint */862862+ if (usbinterface->altsetting[0].desc.bNumEndpoints < 1) {863863+ dev_err(&usbinterface->dev,864864+ "Invalid number of endpoints\n");865865+ error = -EINVAL;866866+ goto err_free_urb;867867+ }868868+861869 /*862870 * The endpoint is always altsetting 0, we know this since we know863871 * this device only has one interrupt endpoint···887879 * HID report descriptor888880 */889881 if (usb_get_extra_descriptor(usbinterface->cur_altsetting,890890- HID_DEVICE_TYPE, &hid_desc) != 0){882882+ HID_DEVICE_TYPE, &hid_desc) != 0) {891883 dev_err(&usbinterface->dev,892884 "Can't retrieve exta USB descriptor to get hid report descriptor length\n");893885 error = -EIO;
+76-11
drivers/iommu/amd_iommu.c
···9292 struct list_head dev_data_list; /* For global dev_data_list */9393 struct protection_domain *domain; /* Domain the device is bound to */9494 u16 devid; /* PCI Device ID */9595+ u16 alias; /* Alias Device ID */9596 bool iommu_v2; /* Device can make use of IOMMUv2 */9697 bool passthrough; /* Device is identity mapped */9798 struct {···167166 return container_of(dom, struct protection_domain, domain);168167}169168169169+static inline u16 get_device_id(struct device *dev)170170+{171171+ struct pci_dev *pdev = to_pci_dev(dev);172172+173173+ return PCI_DEVID(pdev->bus->number, pdev->devfn);174174+}175175+170176static struct iommu_dev_data *alloc_dev_data(u16 devid)171177{172178 struct iommu_dev_data *dev_data;···211203 return dev_data;212204}213205206206+static int __last_alias(struct pci_dev *pdev, u16 alias, void *data)207207+{208208+ *(u16 *)data = alias;209209+ return 0;210210+}211211+212212+static u16 get_alias(struct device *dev)213213+{214214+ struct pci_dev *pdev = to_pci_dev(dev);215215+ u16 devid, ivrs_alias, pci_alias;216216+217217+ devid = get_device_id(dev);218218+ ivrs_alias = amd_iommu_alias_table[devid];219219+ pci_for_each_dma_alias(pdev, __last_alias, &pci_alias);220220+221221+ if (ivrs_alias == pci_alias)222222+ return ivrs_alias;223223+224224+ /*225225+ * DMA alias showdown226226+ *227227+ * The IVRS is fairly reliable in telling us about aliases, but it228228+ * can't know about every screwy device. If we don't have an IVRS229229+ * reported alias, use the PCI reported alias. In that case we may230230+ * still need to initialize the rlookup and dev_table entries if the231231+ * alias is to a non-existent device.232232+ */233233+ if (ivrs_alias == devid) {234234+ if (!amd_iommu_rlookup_table[pci_alias]) {235235+ amd_iommu_rlookup_table[pci_alias] =236236+ amd_iommu_rlookup_table[devid];237237+ memcpy(amd_iommu_dev_table[pci_alias].data,238238+ amd_iommu_dev_table[devid].data,239239+ sizeof(amd_iommu_dev_table[pci_alias].data));240240+ }241241+242242+ return pci_alias;243243+ }244244+245245+ pr_info("AMD-Vi: Using IVRS reported alias %02x:%02x.%d "246246+ "for device %s[%04x:%04x], kernel reported alias "247247+ "%02x:%02x.%d\n", PCI_BUS_NUM(ivrs_alias), PCI_SLOT(ivrs_alias),248248+ PCI_FUNC(ivrs_alias), dev_name(dev), pdev->vendor, pdev->device,249249+ PCI_BUS_NUM(pci_alias), PCI_SLOT(pci_alias),250250+ PCI_FUNC(pci_alias));251251+252252+ /*253253+ * If we don't have a PCI DMA alias and the IVRS alias is on the same254254+ * bus, then the IVRS table may know about a quirk that we don't.255255+ */256256+ if (pci_alias == devid &&257257+ PCI_BUS_NUM(ivrs_alias) == pdev->bus->number) {258258+ pdev->dev_flags |= PCI_DEV_FLAGS_DMA_ALIAS_DEVFN;259259+ pdev->dma_alias_devfn = ivrs_alias & 0xff;260260+ pr_info("AMD-Vi: Added PCI DMA alias %02x.%d for %s\n",261261+ PCI_SLOT(ivrs_alias), PCI_FUNC(ivrs_alias),262262+ dev_name(dev));263263+ }264264+265265+ return ivrs_alias;266266+}267267+214268static struct iommu_dev_data *find_dev_data(u16 devid)215269{216270 struct iommu_dev_data *dev_data;···283213 dev_data = alloc_dev_data(devid);284214285215 return dev_data;286286-}287287-288288-static inline u16 get_device_id(struct device *dev)289289-{290290- struct pci_dev *pdev = to_pci_dev(dev);291291-292292- return PCI_DEVID(pdev->bus->number, pdev->devfn);293216}294217295218static struct iommu_dev_data *get_dev_data(struct device *dev)···412349 if (!dev_data)413350 return -ENOMEM;414351352352+ dev_data->alias = get_alias(dev);353353+415354 if (pci_iommuv2_capable(pdev)) {416355 struct amd_iommu *iommu;417356···434369 u16 devid, alias;435370436371 devid = get_device_id(dev);437437- alias = amd_iommu_alias_table[devid];372372+ alias = get_alias(dev);438373439374 memset(&amd_iommu_dev_table[devid], 0, sizeof(struct dev_table_entry));440375 memset(&amd_iommu_dev_table[alias], 0, sizeof(struct dev_table_entry));···11261061 int ret;1127106211281063 iommu = amd_iommu_rlookup_table[dev_data->devid];11291129- alias = amd_iommu_alias_table[dev_data->devid];10641064+ alias = dev_data->alias;1130106511311066 ret = iommu_flush_dte(iommu, dev_data->devid);11321067 if (!ret && alias != dev_data->devid)···21042039 bool ats;2105204021062041 iommu = amd_iommu_rlookup_table[dev_data->devid];21072107- alias = amd_iommu_alias_table[dev_data->devid];20422042+ alias = dev_data->alias;21082043 ats = dev_data->ats.enabled;2109204421102045 /* Update data structures */···21382073 return;2139207421402075 iommu = amd_iommu_rlookup_table[dev_data->devid];21412141- alias = amd_iommu_alias_table[dev_data->devid];20762076+ alias = dev_data->alias;2142207721432078 /* decrease reference counters */21442079 dev_data->domain->dev_iommu[iommu->index] -= 1;
+16-8
drivers/iommu/arm-smmu.c
···826826 if (smmu_domain->smmu)827827 goto out_unlock;828828829829+ /* We're bypassing these SIDs, so don't allocate an actual context */830830+ if (domain->type == IOMMU_DOMAIN_DMA) {831831+ smmu_domain->smmu = smmu;832832+ goto out_unlock;833833+ }834834+829835 /*830836 * Mapping the requested stage onto what we support is surprisingly831837 * complicated, mainly because the spec allows S1+S2 SMMUs without···954948 void __iomem *cb_base;955949 int irq;956950957957- if (!smmu)951951+ if (!smmu || domain->type == IOMMU_DOMAIN_DMA)958952 return;959953960954 /*···10951089 struct arm_smmu_device *smmu = smmu_domain->smmu;10961090 void __iomem *gr0_base = ARM_SMMU_GR0(smmu);1097109110921092+ /*10931093+ * FIXME: This won't be needed once we have IOMMU-backed DMA ops10941094+ * for all devices behind the SMMU. Note that we need to take10951095+ * care configuring SMRs for devices both a platform_device and10961096+ * and a PCI device (i.e. a PCI host controller)10971097+ */10981098+ if (smmu_domain->domain.type == IOMMU_DOMAIN_DMA)10991099+ return 0;11001100+10981101 /* Devices in an IOMMU group may already be configured */10991102 ret = arm_smmu_master_configure_smrs(smmu, cfg);11001103 if (ret)11011104 return ret == -EEXIST ? 0 : ret;11021102-11031103- /*11041104- * FIXME: This won't be needed once we have IOMMU-backed DMA ops11051105- * for all devices behind the SMMU.11061106- */11071107- if (smmu_domain->domain.type == IOMMU_DOMAIN_DMA)11081108- return 0;1109110511101106 for (i = 0; i < cfg->num_streamids; ++i) {11111107 u32 idx, s2cr;
+2-2
drivers/irqchip/irq-mips-gic.c
···467467 gic_map_to_vpe(irq, mips_cm_vp_id(cpumask_first(&tmp)));468468469469 /* Update the pcpu_masks */470470- for (i = 0; i < gic_vpes; i++)470470+ for (i = 0; i < min(gic_vpes, NR_CPUS); i++)471471 clear_bit(irq, pcpu_masks[i].pcpu_mask);472472 set_bit(irq, pcpu_masks[cpumask_first(&tmp)].pcpu_mask);473473···707707 spin_lock_irqsave(&gic_lock, flags);708708 gic_map_to_pin(intr, gic_cpu_pin);709709 gic_map_to_vpe(intr, vpe);710710- for (i = 0; i < gic_vpes; i++)710710+ for (i = 0; i < min(gic_vpes, NR_CPUS); i++)711711 clear_bit(intr, pcpu_masks[i].pcpu_mask);712712 set_bit(intr, pcpu_masks[vpe].pcpu_mask);713713 spin_unlock_irqrestore(&gic_lock, flags);
+3
drivers/isdn/mISDN/socket.c
···715715 if (!maddr || maddr->family != AF_ISDN)716716 return -EINVAL;717717718718+ if (addr_len < sizeof(struct sockaddr_mISDN))719719+ return -EINVAL;720720+718721 lock_sock(sk);719722720723 if (_pms(sk)->dev) {
···21812181 struct net_device *bridge)21822182{21832183 struct mv88e6xxx_priv_state *ps = ds_to_priv(ds);21842184- u16 fid;21852184 int i, err;2186218521872186 mutex_lock(&ps->smi_mutex);21882188-21892189- /* Get or create the bridge FID and assign it to the port */21902190- for (i = 0; i < ps->num_ports; ++i)21912191- if (ps->ports[i].bridge_dev == bridge)21922192- break;21932193-21942194- if (i < ps->num_ports)21952195- err = _mv88e6xxx_port_fid_get(ds, i, &fid);21962196- else21972197- err = _mv88e6xxx_fid_new(ds, &fid);21982198- if (err)21992199- goto unlock;22002200-22012201- err = _mv88e6xxx_port_fid_set(ds, port, fid);22022202- if (err)22032203- goto unlock;2204218722052188 /* Assign the bridge and remap each port's VLANTable */22062189 ps->ports[port].bridge_dev = bridge;···21962213 }21972214 }2198221521992199-unlock:22002216 mutex_unlock(&ps->smi_mutex);2201221722022218 return err;···22052223{22062224 struct mv88e6xxx_priv_state *ps = ds_to_priv(ds);22072225 struct net_device *bridge = ps->ports[port].bridge_dev;22082208- u16 fid;22092226 int i;2210222722112228 mutex_lock(&ps->smi_mutex);22122212-22132213- /* Give the port a fresh Filtering Information Database */22142214- if (_mv88e6xxx_fid_new(ds, &fid) ||22152215- _mv88e6xxx_port_fid_set(ds, port, fid))22162216- netdev_warn(ds->ports[port], "failed to assign a new FID\n");2217222922182230 /* Unassign the bridge and remap each port's VLANTable */22192231 ps->ports[port].bridge_dev = NULL;···24522476 * the other bits clear.24532477 */24542478 reg = 1 << port;24552455- /* Disable learning for DSA and CPU ports */24562456- if (dsa_is_cpu_port(ds, port) || dsa_is_dsa_port(ds, port))24572457- reg = PORT_ASSOC_VECTOR_LOCKED_PORT;24792479+ /* Disable learning for CPU port */24802480+ if (dsa_is_cpu_port(ds, port))24812481+ reg = 0;2458248224592483 ret = _mv88e6xxx_reg_write(ds, REG_PORT(port), PORT_ASSOC_VECTOR, reg);24602484 if (ret)···25342558 if (ret)25352559 goto abort;2536256025372537- /* Port based VLAN map: give each port its own address25612561+ /* Port based VLAN map: give each port the same default address25382562 * database, and allow bidirectional communication between the25392563 * CPU and DSA port(s), and the other ports.25402564 */25412541- ret = _mv88e6xxx_port_fid_set(ds, port, port + 1);25652565+ ret = _mv88e6xxx_port_fid_set(ds, port, 0);25422566 if (ret)25432567 goto abort;25442568
+1-1
drivers/net/ethernet/atheros/atlx/atl2.c
···1412141214131413 err = -EIO;1414141414151415- netdev->hw_features = NETIF_F_SG | NETIF_F_HW_VLAN_CTAG_RX;14151415+ netdev->hw_features = NETIF_F_HW_VLAN_CTAG_RX;14161416 netdev->features |= (NETIF_F_HW_VLAN_CTAG_TX | NETIF_F_HW_VLAN_CTAG_RX);1417141714181418 /* Init PHY as early as possible due to power saving issue */
+5
drivers/net/ethernet/broadcom/bgmac.c
···15721572 dev_warn(&core->dev, "Using random MAC: %pM\n", mac);15731573 }1574157415751575+ /* This (reset &) enable is not preset in specs or reference driver but15761576+ * Broadcom does it in arch PCI code when enabling fake PCI device.15771577+ */15781578+ bcma_core_enable(core, 0);15791579+15751580 /* Allocation and references */15761581 net_dev = alloc_etherdev(sizeof(*bgmac));15771582 if (!net_dev)
+3-3
drivers/net/ethernet/broadcom/bgmac.h
···199199#define BGMAC_CMDCFG_TAI 0x00000200200200#define BGMAC_CMDCFG_HD 0x00000400 /* Set if in half duplex mode */201201#define BGMAC_CMDCFG_HD_SHIFT 10202202-#define BGMAC_CMDCFG_SR_REV0 0x00000800 /* Set to reset mode, for other revs */203203-#define BGMAC_CMDCFG_SR_REV4 0x00002000 /* Set to reset mode, only for core rev 4 */204204-#define BGMAC_CMDCFG_SR(rev) ((rev == 4) ? BGMAC_CMDCFG_SR_REV4 : BGMAC_CMDCFG_SR_REV0)202202+#define BGMAC_CMDCFG_SR_REV0 0x00000800 /* Set to reset mode, for core rev 0-3 */203203+#define BGMAC_CMDCFG_SR_REV4 0x00002000 /* Set to reset mode, for core rev >= 4 */204204+#define BGMAC_CMDCFG_SR(rev) ((rev >= 4) ? BGMAC_CMDCFG_SR_REV4 : BGMAC_CMDCFG_SR_REV0)205205#define BGMAC_CMDCFG_ML 0x00008000 /* Set to activate mac loopback mode */206206#define BGMAC_CMDCFG_AE 0x00400000207207#define BGMAC_CMDCFG_CFE 0x00800000
+5-1
drivers/net/ethernet/broadcom/genet/bcmgenet.c
···878878 else879879 p = (char *)priv;880880 p += s->stat_offset;881881- data[i] = *(u32 *)p;881881+ if (sizeof(unsigned long) != sizeof(u32) &&882882+ s->stat_sizeof == sizeof(unsigned long))883883+ data[i] = *(unsigned long *)p;884884+ else885885+ data[i] = *(u32 *)p;882886 }883887}884888
···14511451 unsigned int mmd, unsigned int reg, u16 *valp);14521452int t4_mdio_wr(struct adapter *adap, unsigned int mbox, unsigned int phy_addr,14531453 unsigned int mmd, unsigned int reg, u16 val);14541454+int t4_iq_stop(struct adapter *adap, unsigned int mbox, unsigned int pf,14551455+ unsigned int vf, unsigned int iqtype, unsigned int iqid,14561456+ unsigned int fl0id, unsigned int fl1id);14541457int t4_iq_free(struct adapter *adap, unsigned int mbox, unsigned int pf,14551458 unsigned int vf, unsigned int iqtype, unsigned int iqid,14561459 unsigned int fl0id, unsigned int fl1id);
+17-3
drivers/net/ethernet/chelsio/cxgb4/sge.c
···29812981void t4_free_sge_resources(struct adapter *adap)29822982{29832983 int i;29842984- struct sge_eth_rxq *eq = adap->sge.ethrxq;29852985- struct sge_eth_txq *etq = adap->sge.ethtxq;29842984+ struct sge_eth_rxq *eq;29852985+ struct sge_eth_txq *etq;29862986+29872987+ /* stop all Rx queues in order to start them draining */29882988+ for (i = 0; i < adap->sge.ethqsets; i++) {29892989+ eq = &adap->sge.ethrxq[i];29902990+ if (eq->rspq.desc)29912991+ t4_iq_stop(adap, adap->mbox, adap->pf, 0,29922992+ FW_IQ_TYPE_FL_INT_CAP,29932993+ eq->rspq.cntxt_id,29942994+ eq->fl.size ? eq->fl.cntxt_id : 0xffff,29952995+ 0xffff);29962996+ }2986299729872998 /* clean up Ethernet Tx/Rx queues */29882988- for (i = 0; i < adap->sge.ethqsets; i++, eq++, etq++) {29992999+ for (i = 0; i < adap->sge.ethqsets; i++) {30003000+ eq = &adap->sge.ethrxq[i];29893001 if (eq->rspq.desc)29903002 free_rspq_fl(adap, &eq->rspq,29913003 eq->fl.size ? &eq->fl : NULL);30043004+30053005+ etq = &adap->sge.ethtxq[i];29923006 if (etq->q.desc) {29933007 t4_eth_eq_free(adap, adap->mbox, adap->pf, 0,29943008 etq->q.cntxt_id);
+43
drivers/net/ethernet/chelsio/cxgb4/t4_hw.c
···25572557}2558255825592559#define EEPROM_STAT_ADDR 0x7bfc25602560+#define VPD_SIZE 0x80025602561#define VPD_BASE 0x40025612562#define VPD_BASE_OLD 025622563#define VPD_LEN 1024···25942593 vpd = vmalloc(VPD_LEN);25952594 if (!vpd)25962595 return -ENOMEM;25962596+25972597+ /* We have two VPD data structures stored in the adapter VPD area.25982598+ * By default, Linux calculates the size of the VPD area by traversing25992599+ * the first VPD area at offset 0x0, so we need to tell the OS what26002600+ * our real VPD size is.26012601+ */26022602+ ret = pci_set_vpd_size(adapter->pdev, VPD_SIZE);26032603+ if (ret < 0)26042604+ goto out;2597260525982606 /* Card information normally starts at VPD_BASE but early cards had25992607 * it at 0.···69466936 FW_VI_ENABLE_CMD_VIID_V(viid));69476937 c.ien_to_len16 = cpu_to_be32(FW_VI_ENABLE_CMD_LED_F | FW_LEN16(c));69486938 c.blinkdur = cpu_to_be16(nblinks);69396939+ return t4_wr_mbox(adap, mbox, &c, sizeof(c), NULL);69406940+}69416941+69426942+/**69436943+ * t4_iq_stop - stop an ingress queue and its FLs69446944+ * @adap: the adapter69456945+ * @mbox: mailbox to use for the FW command69466946+ * @pf: the PF owning the queues69476947+ * @vf: the VF owning the queues69486948+ * @iqtype: the ingress queue type (FW_IQ_TYPE_FL_INT_CAP, etc.)69496949+ * @iqid: ingress queue id69506950+ * @fl0id: FL0 queue id or 0xffff if no attached FL069516951+ * @fl1id: FL1 queue id or 0xffff if no attached FL169526952+ *69536953+ * Stops an ingress queue and its associated FLs, if any. This causes69546954+ * any current or future data/messages destined for these queues to be69556955+ * tossed.69566956+ */69576957+int t4_iq_stop(struct adapter *adap, unsigned int mbox, unsigned int pf,69586958+ unsigned int vf, unsigned int iqtype, unsigned int iqid,69596959+ unsigned int fl0id, unsigned int fl1id)69606960+{69616961+ struct fw_iq_cmd c;69626962+69636963+ memset(&c, 0, sizeof(c));69646964+ c.op_to_vfn = cpu_to_be32(FW_CMD_OP_V(FW_IQ_CMD) | FW_CMD_REQUEST_F |69656965+ FW_CMD_EXEC_F | FW_IQ_CMD_PFN_V(pf) |69666966+ FW_IQ_CMD_VFN_V(vf));69676967+ c.alloc_to_len16 = cpu_to_be32(FW_IQ_CMD_IQSTOP_F | FW_LEN16(c));69686968+ c.type_to_iqandstindex = cpu_to_be32(FW_IQ_CMD_TYPE_V(iqtype));69696969+ c.iqid = cpu_to_be16(iqid);69706970+ c.fl0id = cpu_to_be16(fl0id);69716971+ c.fl1id = cpu_to_be16(fl1id);69496972 return t4_wr_mbox(adap, mbox, &c, sizeof(c), NULL);69506973}69516974
+22-8
drivers/net/ethernet/intel/fm10k/fm10k_pf.c
···12231223 if (err)12241224 return err;1225122512261226- /* verify upper 16 bits are zero */12271227- if (vid >> 16)12281228- return FM10K_ERR_PARAM;12291229-12301226 set = !(vid & FM10K_VLAN_CLEAR);12311227 vid &= ~FM10K_VLAN_CLEAR;1232122812331233- err = fm10k_iov_select_vid(vf_info, (u16)vid);12341234- if (err < 0)12351235- return err;12291229+ /* if the length field has been set, this is a multi-bit12301230+ * update request. For multi-bit requests, simply disallow12311231+ * them when the pf_vid has been set. In this case, the PF12321232+ * should have already cleared the VLAN_TABLE, and if we12331233+ * allowed them, it could allow a rogue VF to receive traffic12341234+ * on a VLAN it was not assigned. In the single-bit case, we12351235+ * need to modify requests for VLAN 0 to use the default PF or12361236+ * SW vid when assigned.12371237+ */1236123812371237- vid = err;12391239+ if (vid >> 16) {12401240+ /* prevent multi-bit requests when PF has12411241+ * administratively set the VLAN for this VF12421242+ */12431243+ if (vf_info->pf_vid)12441244+ return FM10K_ERR_PARAM;12451245+ } else {12461246+ err = fm10k_iov_select_vid(vf_info, (u16)vid);12471247+ if (err < 0)12481248+ return err;12491249+12501250+ vid = err;12511251+ }1238125212391253 /* update VSI info for VF in regards to VLAN table */12401254 err = hw->mac.ops.update_vlan(hw, vid, vf_info->vsi, set);
+24-25
drivers/net/ethernet/intel/i40e/i40e_txrx.c
···25942594}2595259525962596/**25972597- * __i40e_chk_linearize - Check if there are more than 8 fragments per packet25972597+ * __i40e_chk_linearize - Check if there are more than 8 buffers per packet25982598 * @skb: send buffer25992599 *26002600- * Note: Our HW can't scatter-gather more than 8 fragments to build26012601- * a packet on the wire and so we need to figure out the cases where we26022602- * need to linearize the skb.26002600+ * Note: Our HW can't DMA more than 8 buffers to build a packet on the wire26012601+ * and so we need to figure out the cases where we need to linearize the skb.26022602+ *26032603+ * For TSO we need to count the TSO header and segment payload separately.26042604+ * As such we need to check cases where we have 7 fragments or more as we26052605+ * can potentially require 9 DMA transactions, 1 for the TSO header, 1 for26062606+ * the segment payload in the first descriptor, and another 7 for the26072607+ * fragments.26032608 **/26042609bool __i40e_chk_linearize(struct sk_buff *skb)26052610{26062611 const struct skb_frag_struct *frag, *stale;26072607- int gso_size, nr_frags, sum;26122612+ int nr_frags, sum;2608261326092609- /* check to see if TSO is enabled, if so we may get a repreive */26102610- gso_size = skb_shinfo(skb)->gso_size;26112611- if (unlikely(!gso_size))26122612- return true;26132613-26142614- /* no need to check if number of frags is less than 8 */26142614+ /* no need to check if number of frags is less than 7 */26152615 nr_frags = skb_shinfo(skb)->nr_frags;26162616- if (nr_frags < I40E_MAX_BUFFER_TXD)26162616+ if (nr_frags < (I40E_MAX_BUFFER_TXD - 1))26172617 return false;2618261826192619 /* We need to walk through the list and validate that each group26202620 * of 6 fragments totals at least gso_size. However we don't need26212621- * to perform such validation on the first or last 6 since the first26222622- * 6 cannot inherit any data from a descriptor before them, and the26232623- * last 6 cannot inherit any data from a descriptor after them.26212621+ * to perform such validation on the last 6 since the last 6 cannot26222622+ * inherit any data from a descriptor after them.26242623 */26252625- nr_frags -= I40E_MAX_BUFFER_TXD - 1;26242624+ nr_frags -= I40E_MAX_BUFFER_TXD - 2;26262625 frag = &skb_shinfo(skb)->frags[0];2627262626282627 /* Initialize size to the negative value of gso_size minus 1. We···26302631 * descriptors for a single transmit as the header and previous26312632 * fragment are already consuming 2 descriptors.26322633 */26332633- sum = 1 - gso_size;26342634+ sum = 1 - skb_shinfo(skb)->gso_size;2634263526352635- /* Add size of frags 1 through 5 to create our initial sum */26362636- sum += skb_frag_size(++frag);26372637- sum += skb_frag_size(++frag);26382638- sum += skb_frag_size(++frag);26392639- sum += skb_frag_size(++frag);26402640- sum += skb_frag_size(++frag);26362636+ /* Add size of frags 0 through 4 to create our initial sum */26372637+ sum += skb_frag_size(frag++);26382638+ sum += skb_frag_size(frag++);26392639+ sum += skb_frag_size(frag++);26402640+ sum += skb_frag_size(frag++);26412641+ sum += skb_frag_size(frag++);2641264226422643 /* Walk through fragments adding latest fragment, testing it, and26432644 * then removing stale fragments from the sum.26442645 */26452646 stale = &skb_shinfo(skb)->frags[0];26462647 for (;;) {26472647- sum += skb_frag_size(++frag);26482648+ sum += skb_frag_size(frag++);2648264926492650 /* if sum is negative we failed to make sufficient progress */26502651 if (sum < 0)···26542655 if (!--nr_frags)26552656 break;2656265726572657- sum -= skb_frag_size(++stale);26582658+ sum -= skb_frag_size(stale++);26582659 }2659266026602661 return false;
+7-3
drivers/net/ethernet/intel/i40e/i40e_txrx.h
···413413 **/414414static inline bool i40e_chk_linearize(struct sk_buff *skb, int count)415415{416416- /* we can only support up to 8 data buffers for a single send */417417- if (likely(count <= I40E_MAX_BUFFER_TXD))416416+ /* Both TSO and single send will work if count is less than 8 */417417+ if (likely(count < I40E_MAX_BUFFER_TXD))418418 return false;419419420420- return __i40e_chk_linearize(skb);420420+ if (skb_is_gso(skb))421421+ return __i40e_chk_linearize(skb);422422+423423+ /* we can support up to 8 data buffers for a single send */424424+ return count != I40E_MAX_BUFFER_TXD;421425}422426#endif /* _I40E_TXRX_H_ */
+24-25
drivers/net/ethernet/intel/i40evf/i40e_txrx.c
···17961796}1797179717981798/**17991799- * __i40evf_chk_linearize - Check if there are more than 8 fragments per packet17991799+ * __i40evf_chk_linearize - Check if there are more than 8 buffers per packet18001800 * @skb: send buffer18011801 *18021802- * Note: Our HW can't scatter-gather more than 8 fragments to build18031803- * a packet on the wire and so we need to figure out the cases where we18041804- * need to linearize the skb.18021802+ * Note: Our HW can't DMA more than 8 buffers to build a packet on the wire18031803+ * and so we need to figure out the cases where we need to linearize the skb.18041804+ *18051805+ * For TSO we need to count the TSO header and segment payload separately.18061806+ * As such we need to check cases where we have 7 fragments or more as we18071807+ * can potentially require 9 DMA transactions, 1 for the TSO header, 1 for18081808+ * the segment payload in the first descriptor, and another 7 for the18091809+ * fragments.18051810 **/18061811bool __i40evf_chk_linearize(struct sk_buff *skb)18071812{18081813 const struct skb_frag_struct *frag, *stale;18091809- int gso_size, nr_frags, sum;18141814+ int nr_frags, sum;1810181518111811- /* check to see if TSO is enabled, if so we may get a repreive */18121812- gso_size = skb_shinfo(skb)->gso_size;18131813- if (unlikely(!gso_size))18141814- return true;18151815-18161816- /* no need to check if number of frags is less than 8 */18161816+ /* no need to check if number of frags is less than 7 */18171817 nr_frags = skb_shinfo(skb)->nr_frags;18181818- if (nr_frags < I40E_MAX_BUFFER_TXD)18181818+ if (nr_frags < (I40E_MAX_BUFFER_TXD - 1))18191819 return false;1820182018211821 /* We need to walk through the list and validate that each group18221822 * of 6 fragments totals at least gso_size. However we don't need18231823- * to perform such validation on the first or last 6 since the first18241824- * 6 cannot inherit any data from a descriptor before them, and the18251825- * last 6 cannot inherit any data from a descriptor after them.18231823+ * to perform such validation on the last 6 since the last 6 cannot18241824+ * inherit any data from a descriptor after them.18261825 */18271827- nr_frags -= I40E_MAX_BUFFER_TXD - 1;18261826+ nr_frags -= I40E_MAX_BUFFER_TXD - 2;18281827 frag = &skb_shinfo(skb)->frags[0];1829182818301829 /* Initialize size to the negative value of gso_size minus 1. We···18321833 * descriptors for a single transmit as the header and previous18331834 * fragment are already consuming 2 descriptors.18341835 */18351835- sum = 1 - gso_size;18361836+ sum = 1 - skb_shinfo(skb)->gso_size;1836183718371837- /* Add size of frags 1 through 5 to create our initial sum */18381838- sum += skb_frag_size(++frag);18391839- sum += skb_frag_size(++frag);18401840- sum += skb_frag_size(++frag);18411841- sum += skb_frag_size(++frag);18421842- sum += skb_frag_size(++frag);18381838+ /* Add size of frags 0 through 4 to create our initial sum */18391839+ sum += skb_frag_size(frag++);18401840+ sum += skb_frag_size(frag++);18411841+ sum += skb_frag_size(frag++);18421842+ sum += skb_frag_size(frag++);18431843+ sum += skb_frag_size(frag++);1843184418441845 /* Walk through fragments adding latest fragment, testing it, and18451846 * then removing stale fragments from the sum.18461847 */18471848 stale = &skb_shinfo(skb)->frags[0];18481849 for (;;) {18491849- sum += skb_frag_size(++frag);18501850+ sum += skb_frag_size(frag++);1850185118511852 /* if sum is negative we failed to make sufficient progress */18521853 if (sum < 0)···18561857 if (!--nr_frags)18571858 break;1858185918591859- sum -= skb_frag_size(++stale);18601860+ sum -= skb_frag_size(stale++);18601861 }1861186218621863 return false;
+7-3
drivers/net/ethernet/intel/i40evf/i40e_txrx.h
···395395 **/396396static inline bool i40e_chk_linearize(struct sk_buff *skb, int count)397397{398398- /* we can only support up to 8 data buffers for a single send */399399- if (likely(count <= I40E_MAX_BUFFER_TXD))398398+ /* Both TSO and single send will work if count is less than 8 */399399+ if (likely(count < I40E_MAX_BUFFER_TXD))400400 return false;401401402402- return __i40evf_chk_linearize(skb);402402+ if (skb_is_gso(skb))403403+ return __i40evf_chk_linearize(skb);404404+405405+ /* we can support up to 8 data buffers for a single send */406406+ return count != I40E_MAX_BUFFER_TXD;403407}404408#endif /* _I40E_TXRX_H_ */
···323323 unsigned long csum_ok;324324 unsigned long csum_none;325325 unsigned long csum_complete;326326+ unsigned long dropped;326327 int hwtstamp_rx_filter;327328 cpumask_var_t affinity_mask;328329};
+13
drivers/net/ethernet/mellanox/mlx4/port.c
···13171317 }1318131813191319 gen_context->mtu = cpu_to_be16(master->max_mtu[port]);13201320+ /* Slave cannot change Global Pause configuration */13211321+ if (slave != mlx4_master_func_num(dev) &&13221322+ ((gen_context->pptx != master->pptx) ||13231323+ (gen_context->pprx != master->pprx))) {13241324+ gen_context->pptx = master->pptx;13251325+ gen_context->pprx = master->pprx;13261326+ mlx4_warn(dev,13271327+ "denying Global Pause change for slave:%d\n",13281328+ slave);13291329+ } else {13301330+ master->pptx = gen_context->pptx;13311331+ master->pprx = gen_context->pprx;13321332+ }13201333 break;13211334 case MLX4_SET_PORT_GID_TABLE:13221335 /* change to MULTIPLE entries: number of guest's gids
+101-58
drivers/net/ethernet/qlogic/qede/qede_main.c
···750750 return false;751751}752752753753+static inline void qede_rx_bd_ring_consume(struct qede_rx_queue *rxq)754754+{755755+ qed_chain_consume(&rxq->rx_bd_ring);756756+ rxq->sw_rx_cons++;757757+}758758+753759/* This function reuses the buffer(from an offset) from754760 * consumer index to producer index in the bd ring755761 */···779773 curr_cons->data = NULL;780774}781775776776+/* In case of allocation failures reuse buffers777777+ * from consumer index to produce buffers for firmware778778+ */779779+static void qede_recycle_rx_bd_ring(struct qede_rx_queue *rxq,780780+ struct qede_dev *edev, u8 count)781781+{782782+ struct sw_rx_data *curr_cons;783783+784784+ for (; count > 0; count--) {785785+ curr_cons = &rxq->sw_rx_ring[rxq->sw_rx_cons & NUM_RX_BDS_MAX];786786+ qede_reuse_page(edev, rxq, curr_cons);787787+ qede_rx_bd_ring_consume(rxq);788788+ }789789+}790790+782791static inline int qede_realloc_rx_buffer(struct qede_dev *edev,783792 struct qede_rx_queue *rxq,784793 struct sw_rx_data *curr_cons)···802781 curr_cons->page_offset += rxq->rx_buf_seg_size;803782804783 if (curr_cons->page_offset == PAGE_SIZE) {805805- if (unlikely(qede_alloc_rx_buffer(edev, rxq)))784784+ if (unlikely(qede_alloc_rx_buffer(edev, rxq))) {785785+ /* Since we failed to allocate new buffer786786+ * current buffer can be used again.787787+ */788788+ curr_cons->page_offset -= rxq->rx_buf_seg_size;789789+806790 return -ENOMEM;791791+ }807792808793 dma_unmap_page(&edev->pdev->dev, curr_cons->mapping,809794 PAGE_SIZE, DMA_FROM_DEVICE);···928901 len_on_bd);929902930903 if (unlikely(qede_realloc_rx_buffer(edev, rxq, current_bd))) {931931- tpa_info->agg_state = QEDE_AGG_STATE_ERROR;904904+ /* Incr page ref count to reuse on allocation failure905905+ * so that it doesn't get freed while freeing SKB.906906+ */907907+ atomic_inc(¤t_bd->data->_count);932908 goto out;933909 }934910···945915 return 0;946916947917out:918918+ tpa_info->agg_state = QEDE_AGG_STATE_ERROR;919919+ qede_recycle_rx_bd_ring(rxq, edev, 1);948920 return -ENOMEM;949921}950922···998966 tpa_info->skb = netdev_alloc_skb(edev->ndev,999967 le16_to_cpu(cqe->len_on_first_bd));1000968 if (unlikely(!tpa_info->skb)) {969969+ DP_NOTICE(edev, "Failed to allocate SKB for gro\n");1001970 tpa_info->agg_state = QEDE_AGG_STATE_ERROR;10021002- return;971971+ goto cons_buf;1003972 }10049731005974 skb_put(tpa_info->skb, le16_to_cpu(cqe->len_on_first_bd));···1023990 /* This is needed in order to enable forwarding support */1024991 qede_set_gro_params(edev, tpa_info->skb, cqe);1025992993993+cons_buf: /* We still need to handle bd_len_list to consume buffers */1026994 if (likely(cqe->ext_bd_len_list[0]))1027995 qede_fill_frag_skb(edev, rxq, cqe->tpa_agg_index,1028996 le16_to_cpu(cqe->ext_bd_len_list[0]));···10411007 const struct iphdr *iph = ip_hdr(skb);10421008 struct tcphdr *th;1043100910441044- skb_set_network_header(skb, 0);10451010 skb_set_transport_header(skb, sizeof(struct iphdr));10461011 th = tcp_hdr(skb);10471012···10551022 struct ipv6hdr *iph = ipv6_hdr(skb);10561023 struct tcphdr *th;1057102410581058- skb_set_network_header(skb, 0);10591025 skb_set_transport_header(skb, sizeof(struct ipv6hdr));10601026 th = tcp_hdr(skb);10611027···10691037 struct sk_buff *skb,10701038 u16 vlan_tag)10711039{10401040+ /* FW can send a single MTU sized packet from gro flow10411041+ * due to aggregation timeout/last segment etc. which10421042+ * is not expected to be a gro packet. If a skb has zero10431043+ * frags then simply push it in the stack as non gso skb.10441044+ */10451045+ if (unlikely(!skb->data_len)) {10461046+ skb_shinfo(skb)->gso_type = 0;10471047+ skb_shinfo(skb)->gso_size = 0;10481048+ goto send_skb;10491049+ }10501050+10721051#ifdef CONFIG_INET10731052 if (skb_shinfo(skb)->gso_size) {10531053+ skb_set_network_header(skb, 0);10541054+10741055 switch (skb->protocol) {10751056 case htons(ETH_P_IP):10761057 qede_gro_ip_csum(skb);···10981053 }10991054 }11001055#endif10561056+10571057+send_skb:11011058 skb_record_rx_queue(skb, fp->rss_id);11021059 qede_skb_receive(edev, fp, skb, vlan_tag);11031060}···12911244 "CQE in CONS = %u has error, flags = %x, dropping incoming packet\n",12921245 sw_comp_cons, parse_flag);12931246 rxq->rx_hw_errors++;12941294- qede_reuse_page(edev, rxq, sw_rx_data);12951295- goto next_rx;12471247+ qede_recycle_rx_bd_ring(rxq, edev, fp_cqe->bd_num);12481248+ goto next_cqe;12961249 }1297125012981251 skb = netdev_alloc_skb(edev->ndev, QEDE_RX_HDR_SIZE);12991252 if (unlikely(!skb)) {13001253 DP_NOTICE(edev,13011254 "Build_skb failed, dropping incoming packet\n");13021302- qede_reuse_page(edev, rxq, sw_rx_data);12551255+ qede_recycle_rx_bd_ring(rxq, edev, fp_cqe->bd_num);13031256 rxq->rx_alloc_errors++;13041304- goto next_rx;12571257+ goto next_cqe;13051258 }1306125913071260 /* Copy data into SKB */···13351288 if (unlikely(qede_realloc_rx_buffer(edev, rxq,13361289 sw_rx_data))) {13371290 DP_ERR(edev, "Failed to allocate rx buffer\n");12911291+ /* Incr page ref count to reuse on allocation12921292+ * failure so that it doesn't get freed while12931293+ * freeing SKB.12941294+ */12951295+12961296+ atomic_inc(&sw_rx_data->data->_count);13381297 rxq->rx_alloc_errors++;12981298+ qede_recycle_rx_bd_ring(rxq, edev,12991299+ fp_cqe->bd_num);13001300+ dev_kfree_skb_any(skb);13391301 goto next_cqe;13401302 }13411303 }13041304+13051305+ qede_rx_bd_ring_consume(rxq);1342130613431307 if (fp_cqe->bd_num != 1) {13441308 u16 pkt_len = le16_to_cpu(fp_cqe->pkt_len);···13611303 num_frags--) {13621304 u16 cur_size = pkt_len > rxq->rx_buf_size ?13631305 rxq->rx_buf_size : pkt_len;13641364-13651365- WARN_ONCE(!cur_size,13661366- "Still got %d BDs for mapping jumbo, but length became 0\n",13671367- num_frags);13681368-13691369- if (unlikely(qede_alloc_rx_buffer(edev, rxq)))13061306+ if (unlikely(!cur_size)) {13071307+ DP_ERR(edev,13081308+ "Still got %d BDs for mapping jumbo, but length became 0\n",13091309+ num_frags);13101310+ qede_recycle_rx_bd_ring(rxq, edev,13111311+ num_frags);13121312+ dev_kfree_skb_any(skb);13701313 goto next_cqe;13141314+ }1371131513721372- rxq->sw_rx_cons++;13161316+ if (unlikely(qede_alloc_rx_buffer(edev, rxq))) {13171317+ qede_recycle_rx_bd_ring(rxq, edev,13181318+ num_frags);13191319+ dev_kfree_skb_any(skb);13201320+ goto next_cqe;13211321+ }13221322+13731323 sw_rx_index = rxq->sw_rx_cons & NUM_RX_BDS_MAX;13741324 sw_rx_data = &rxq->sw_rx_ring[sw_rx_index];13751375- qed_chain_consume(&rxq->rx_bd_ring);13251325+ qede_rx_bd_ring_consume(rxq);13261326+13761327 dma_unmap_page(&edev->pdev->dev,13771328 sw_rx_data->mapping,13781329 PAGE_SIZE, DMA_FROM_DEVICE);···13971330 pkt_len -= cur_size;13981331 }1399133214001400- if (pkt_len)13331333+ if (unlikely(pkt_len))14011334 DP_ERR(edev,14021335 "Mapped all BDs of jumbo, but still have %d bytes\n",14031336 pkt_len);···14161349 skb_record_rx_queue(skb, fp->rss_id);1417135014181351 qede_skb_receive(edev, fp, skb, le16_to_cpu(fp_cqe->vlan_tag));14191419-14201420- qed_chain_consume(&rxq->rx_bd_ring);14211421-next_rx:14221422- rxq->sw_rx_cons++;14231352next_rx_only:14241353 rx_pkt++;14251354···23202257 struct qede_agg_info *tpa_info = &rxq->tpa_info[i];23212258 struct sw_rx_data *replace_buf = &tpa_info->replace_buf;2322225923232323- if (replace_buf) {22602260+ if (replace_buf->data) {23242261 dma_unmap_page(&edev->pdev->dev,23252262 dma_unmap_addr(replace_buf, mapping),23262263 PAGE_SIZE, DMA_FROM_DEVICE);···24402377static int qede_alloc_mem_rxq(struct qede_dev *edev,24412378 struct qede_rx_queue *rxq)24422379{24432443- int i, rc, size, num_allocated;23802380+ int i, rc, size;2444238124452382 rxq->num_rx_buffers = edev->q_num_rx_buffers;24462383···24572394 rxq->sw_rx_ring = kzalloc(size, GFP_KERNEL);24582395 if (!rxq->sw_rx_ring) {24592396 DP_ERR(edev, "Rx buffers ring allocation failed\n");23972397+ rc = -ENOMEM;24602398 goto err;24612399 }24622400···24852421 /* Allocate buffers for the Rx ring */24862422 for (i = 0; i < rxq->num_rx_buffers; i++) {24872423 rc = qede_alloc_rx_buffer(edev, rxq);24882488- if (rc)24892489- break;24902490- }24912491- num_allocated = i;24922492- if (!num_allocated) {24932493- DP_ERR(edev, "Rx buffers allocation failed\n");24942494- goto err;24952495- } else if (num_allocated < rxq->num_rx_buffers) {24962496- DP_NOTICE(edev,24972497- "Allocated less buffers than desired (%d allocated)\n",24982498- num_allocated);24242424+ if (rc) {24252425+ DP_ERR(edev,24262426+ "Rx buffers allocation failed at index %d\n", i);24272427+ goto err;24282428+ }24992429 }2500243025012501- qede_alloc_sge_mem(edev, rxq);25022502-25032503- return 0;25042504-24312431+ rc = qede_alloc_sge_mem(edev, rxq);25052432err:25062506- qede_free_mem_rxq(edev, rxq);25072507- return -ENOMEM;24332433+ return rc;25082434}2509243525102436static void qede_free_mem_txq(struct qede_dev *edev,···25772523 }2578252425792525 return 0;25802580-25812526err:25822582- qede_free_mem_fp(edev, fp);25832583- return -ENOMEM;25272527+ return rc;25842528}2585252925862530static void qede_free_mem_load(struct qede_dev *edev)···26012549 struct qede_fastpath *fp = &edev->fp_array[rss_id];2602255026032551 rc = qede_alloc_mem_fp(edev, fp);26042604- if (rc)26052605- break;26062606- }26072607-26082608- if (rss_id != QEDE_RSS_CNT(edev)) {26092609- /* Failed allocating memory for all the queues */26102610- if (!rss_id) {25522552+ if (rc) {26112553 DP_ERR(edev,26122612- "Failed to allocate memory for the leading queue\n");26132613- rc = -ENOMEM;26142614- } else {26152615- DP_NOTICE(edev,26162616- "Failed to allocate memory for all of RSS queues\n Desired: %d queues, allocated: %d queues\n",26172617- QEDE_RSS_CNT(edev), rss_id);25542554+ "Failed to allocate memory for fastpath - rss id = %d\n",25552555+ rss_id);25562556+ qede_free_mem_load(edev);25572557+ return rc;26182558 }26192619- edev->num_rss = rss_id;26202559 }2621256026222561 return 0;
···617617 { USB_VENDOR_AND_INTERFACE_INFO(0x0bdb, USB_CLASS_COMM, USB_CDC_SUBCLASS_MBIM, USB_CDC_PROTO_NONE),618618 .driver_info = (unsigned long)&cdc_mbim_info,619619 },620620- /* Huawei E3372 fails unless NDP comes after the IP packets */621621- { USB_DEVICE_AND_INTERFACE_INFO(0x12d1, 0x157d, USB_CLASS_COMM, USB_CDC_SUBCLASS_MBIM, USB_CDC_PROTO_NONE),620620+621621+ /* Some Huawei devices, ME906s-158 (12d1:15c1) and E3372622622+ * (12d1:157d), are known to fail unless the NDP is placed623623+ * after the IP packets. Applying the quirk to all Huawei624624+ * devices is broader than necessary, but harmless.625625+ */626626+ { USB_VENDOR_AND_INTERFACE_INFO(0x12d1, USB_CLASS_COMM, USB_CDC_SUBCLASS_MBIM, USB_CDC_PROTO_NONE),622627 .driver_info = (unsigned long)&cdc_mbim_info_ndp_to_end,623628 },624629 /* default entry */
+8-4
drivers/net/vmxnet3/vmxnet3_drv.c
···11521152 union Vmxnet3_GenericDesc *gdesc)11531153{11541154 if (!gdesc->rcd.cnc && adapter->netdev->features & NETIF_F_RXCSUM) {11551155- /* typical case: TCP/UDP over IP and both csums are correct */11561156- if ((le32_to_cpu(gdesc->dword[3]) & VMXNET3_RCD_CSUM_OK) ==11571157- VMXNET3_RCD_CSUM_OK) {11551155+ if (gdesc->rcd.v4 &&11561156+ (le32_to_cpu(gdesc->dword[3]) &11571157+ VMXNET3_RCD_CSUM_OK) == VMXNET3_RCD_CSUM_OK) {11581158 skb->ip_summed = CHECKSUM_UNNECESSARY;11591159 BUG_ON(!(gdesc->rcd.tcp || gdesc->rcd.udp));11601160- BUG_ON(!(gdesc->rcd.v4 || gdesc->rcd.v6));11601160+ BUG_ON(gdesc->rcd.frg);11611161+ } else if (gdesc->rcd.v6 && (le32_to_cpu(gdesc->dword[3]) &11621162+ (1 << VMXNET3_RCD_TUC_SHIFT))) {11631163+ skb->ip_summed = CHECKSUM_UNNECESSARY;11641164+ BUG_ON(!(gdesc->rcd.tcp || gdesc->rcd.udp));11611165 BUG_ON(gdesc->rcd.frg);11621166 } else {11631167 if (gdesc->rcd.csum) {
+2-2
drivers/net/vmxnet3/vmxnet3_int.h
···6969/*7070 * Version numbers7171 */7272-#define VMXNET3_DRIVER_VERSION_STRING "1.4.6.0-k"7272+#define VMXNET3_DRIVER_VERSION_STRING "1.4.7.0-k"73737474/* a 32-bit int, each byte encode a verion number in VMXNET3_DRIVER_VERSION */7575-#define VMXNET3_DRIVER_VERSION_NUM 0x010406007575+#define VMXNET3_DRIVER_VERSION_NUM 0x0104070076767777#if defined(CONFIG_PCI_MSI)7878 /* RSS only makes sense if MSI-X is supported. */
···11471147 /* the fw is stopped, the aux sta is dead: clean up driver state */11481148 iwl_mvm_del_aux_sta(mvm);1149114911501150+ iwl_free_fw_paging(mvm);11511151+11501152 /*11511153 * Clear IN_HW_RESTART flag when stopping the hw (as restart_complete()11521154 * won't be called in this case).
-2
drivers/net/wireless/intel/iwlwifi/mvm/ops.c
···761761 for (i = 0; i < NVM_MAX_NUM_SECTIONS; i++)762762 kfree(mvm->nvm_sections[i].data);763763764764- iwl_free_fw_paging(mvm);765765-766764 iwl_mvm_tof_clean(mvm);767765768766 ieee80211_free_hw(mvm->hw);
+2-2
drivers/net/wireless/intel/iwlwifi/pcie/trans.c
···732732 */733733 val = iwl_read_prph(trans, PREG_AUX_BUS_WPROT_0);734734 if (val & (BIT(1) | BIT(17))) {735735- IWL_INFO(trans,736736- "can't access the RSA semaphore it is write protected\n");735735+ IWL_DEBUG_INFO(trans,736736+ "can't access the RSA semaphore it is write protected\n");737737 return 0;738738 }739739
···737737 break;738738 case CPU_PM_EXIT:739739 case CPU_PM_ENTER_FAILED:740740- /* Restore and enable the counter */741741- armpmu_start(event, PERF_EF_RELOAD);740740+ /*741741+ * Restore and enable the counter.742742+ * armpmu_start() indirectly calls743743+ *744744+ * perf_event_update_userpage()745745+ *746746+ * that requires RCU read locking to be functional,747747+ * wrap the call within RCU_NONIDLE to make the748748+ * RCU subsystem aware this cpu is not idle from749749+ * an RCU perspective for the armpmu_start() call750750+ * duration.751751+ */752752+ RCU_NONIDLE(armpmu_start(event, PERF_EF_RELOAD));742753 break;743754 default:744755 break;
+5-2
drivers/phy/phy-rockchip-dp.c
···8686 if (!np)8787 return -ENODEV;88888989+ if (!dev->parent || !dev->parent->of_node)9090+ return -ENODEV;9191+8992 dp = devm_kzalloc(dev, sizeof(*dp), GFP_KERNEL);9093 if (IS_ERR(dp))9194 return -ENOMEM;···107104 return ret;108105 }109106110110- dp->grf = syscon_regmap_lookup_by_phandle(np, "rockchip,grf");107107+ dp->grf = syscon_node_to_regmap(dev->parent->of_node);111108 if (IS_ERR(dp->grf)) {112112- dev_err(dev, "rk3288-dp needs rockchip,grf property\n");109109+ dev_err(dev, "rk3288-dp needs the General Register Files syscon\n");113110 return PTR_ERR(dp->grf);114111 }115112
+4-1
drivers/phy/phy-rockchip-emmc.c
···176176 struct regmap *grf;177177 unsigned int reg_offset;178178179179- grf = syscon_regmap_lookup_by_phandle(dev->of_node, "rockchip,grf");179179+ if (!dev->parent || !dev->parent->of_node)180180+ return -ENODEV;181181+182182+ grf = syscon_node_to_regmap(dev->parent->of_node);180183 if (IS_ERR(grf)) {181184 dev_err(dev, "Missing rockchip,grf property\n");182185 return PTR_ERR(grf);
···687687 ipcdev.acpi_io_size = size;688688 dev_info(&pdev->dev, "io res: %pR\n", res);689689690690- /* This is index 0 to cover BIOS data register */691690 punit_res = punit_res_array;691691+ /* This is index 0 to cover BIOS data register */692692 res = platform_get_resource(pdev, IORESOURCE_MEM,693693 PLAT_RESOURCE_BIOS_DATA_INDEX);694694 if (!res) {···698698 *punit_res = *res;699699 dev_info(&pdev->dev, "punit BIOS data res: %pR\n", res);700700701701+ /* This is index 1 to cover BIOS interface register */701702 res = platform_get_resource(pdev, IORESOURCE_MEM,702703 PLAT_RESOURCE_BIOS_IFACE_INDEX);703704 if (!res) {704705 dev_err(&pdev->dev, "Failed to get res of punit BIOS iface\n");705706 return -ENXIO;706707 }707707- /* This is index 1 to cover BIOS interface register */708708 *++punit_res = *res;709709 dev_info(&pdev->dev, "punit BIOS interface res: %pR\n", res);710710711711+ /* This is index 2 to cover ISP data register, optional */711712 res = platform_get_resource(pdev, IORESOURCE_MEM,712713 PLAT_RESOURCE_ISP_DATA_INDEX);713713- if (!res) {714714- dev_err(&pdev->dev, "Failed to get res of punit ISP data\n");715715- return -ENXIO;714714+ ++punit_res;715715+ if (res) {716716+ *punit_res = *res;717717+ dev_info(&pdev->dev, "punit ISP data res: %pR\n", res);716718 }717717- /* This is index 2 to cover ISP data register */718718- *++punit_res = *res;719719- dev_info(&pdev->dev, "punit ISP data res: %pR\n", res);720719720720+ /* This is index 3 to cover ISP interface register, optional */721721 res = platform_get_resource(pdev, IORESOURCE_MEM,722722 PLAT_RESOURCE_ISP_IFACE_INDEX);723723- if (!res) {724724- dev_err(&pdev->dev, "Failed to get res of punit ISP iface\n");725725- return -ENXIO;723723+ ++punit_res;724724+ if (res) {725725+ *punit_res = *res;726726+ dev_info(&pdev->dev, "punit ISP interface res: %pR\n", res);726727 }727727- /* This is index 3 to cover ISP interface register */728728- *++punit_res = *res;729729- dev_info(&pdev->dev, "punit ISP interface res: %pR\n", res);730728729729+ /* This is index 4 to cover GTD data register, optional */731730 res = platform_get_resource(pdev, IORESOURCE_MEM,732731 PLAT_RESOURCE_GTD_DATA_INDEX);733733- if (!res) {734734- dev_err(&pdev->dev, "Failed to get res of punit GTD data\n");735735- return -ENXIO;732732+ ++punit_res;733733+ if (res) {734734+ *punit_res = *res;735735+ dev_info(&pdev->dev, "punit GTD data res: %pR\n", res);736736 }737737- /* This is index 4 to cover GTD data register */738738- *++punit_res = *res;739739- dev_info(&pdev->dev, "punit GTD data res: %pR\n", res);740737738738+ /* This is index 5 to cover GTD interface register, optional */741739 res = platform_get_resource(pdev, IORESOURCE_MEM,742740 PLAT_RESOURCE_GTD_IFACE_INDEX);743743- if (!res) {744744- dev_err(&pdev->dev, "Failed to get res of punit GTD iface\n");745745- return -ENXIO;741741+ ++punit_res;742742+ if (res) {743743+ *punit_res = *res;744744+ dev_info(&pdev->dev, "punit GTD interface res: %pR\n", res);746745 }747747- /* This is index 5 to cover GTD interface register */748748- *++punit_res = *res;749749- dev_info(&pdev->dev, "punit GTD interface res: %pR\n", res);750746751747 res = platform_get_resource(pdev, IORESOURCE_MEM,752748 PLAT_RESOURCE_IPC_INDEX);
+32-16
drivers/platform/x86/intel_punit_ipc.c
···227227 struct resource *res;228228 void __iomem *addr;229229230230+ /*231231+ * The following resources are required232232+ * - BIOS_IPC BASE_DATA233233+ * - BIOS_IPC BASE_IFACE234234+ */230235 res = platform_get_resource(pdev, IORESOURCE_MEM, 0);231236 addr = devm_ioremap_resource(&pdev->dev, res);232237 if (IS_ERR(addr))···244239 return PTR_ERR(addr);245240 punit_ipcdev->base[BIOS_IPC][BASE_IFACE] = addr;246241242242+ /*243243+ * The following resources are optional244244+ * - ISPDRIVER_IPC BASE_DATA245245+ * - ISPDRIVER_IPC BASE_IFACE246246+ * - GTDRIVER_IPC BASE_DATA247247+ * - GTDRIVER_IPC BASE_IFACE248248+ */247249 res = platform_get_resource(pdev, IORESOURCE_MEM, 2);248248- addr = devm_ioremap_resource(&pdev->dev, res);249249- if (IS_ERR(addr))250250- return PTR_ERR(addr);251251- punit_ipcdev->base[ISPDRIVER_IPC][BASE_DATA] = addr;250250+ if (res) {251251+ addr = devm_ioremap_resource(&pdev->dev, res);252252+ if (!IS_ERR(addr))253253+ punit_ipcdev->base[ISPDRIVER_IPC][BASE_DATA] = addr;254254+ }252255253256 res = platform_get_resource(pdev, IORESOURCE_MEM, 3);254254- addr = devm_ioremap_resource(&pdev->dev, res);255255- if (IS_ERR(addr))256256- return PTR_ERR(addr);257257- punit_ipcdev->base[ISPDRIVER_IPC][BASE_IFACE] = addr;257257+ if (res) {258258+ addr = devm_ioremap_resource(&pdev->dev, res);259259+ if (!IS_ERR(addr))260260+ punit_ipcdev->base[ISPDRIVER_IPC][BASE_IFACE] = addr;261261+ }258262259263 res = platform_get_resource(pdev, IORESOURCE_MEM, 4);260260- addr = devm_ioremap_resource(&pdev->dev, res);261261- if (IS_ERR(addr))262262- return PTR_ERR(addr);263263- punit_ipcdev->base[GTDRIVER_IPC][BASE_DATA] = addr;264264+ if (res) {265265+ addr = devm_ioremap_resource(&pdev->dev, res);266266+ if (!IS_ERR(addr))267267+ punit_ipcdev->base[GTDRIVER_IPC][BASE_DATA] = addr;268268+ }264269265270 res = platform_get_resource(pdev, IORESOURCE_MEM, 5);266266- addr = devm_ioremap_resource(&pdev->dev, res);267267- if (IS_ERR(addr))268268- return PTR_ERR(addr);269269- punit_ipcdev->base[GTDRIVER_IPC][BASE_IFACE] = addr;271271+ if (res) {272272+ addr = devm_ioremap_resource(&pdev->dev, res);273273+ if (!IS_ERR(addr))274274+ punit_ipcdev->base[GTDRIVER_IPC][BASE_IFACE] = addr;275275+ }270276271277 return 0;272278}
+1-1
drivers/platform/x86/intel_telemetry_pltdrv.c
···659659static int telemetry_plt_set_sampling_period(u8 pss_period, u8 ioss_period)660660{661661 u32 telem_ctrl = 0;662662- int ret;662662+ int ret = 0;663663664664 mutex_lock(&(telm_conf->telem_lock));665665 if (ioss_period) {
···863863 * A user-initiated temperature conversion is not started by this function,864864 * so the temperature is updated once every 64 seconds.865865 */866866-static int ds3231_hwmon_read_temp(struct device *dev, s16 *mC)866866+static int ds3231_hwmon_read_temp(struct device *dev, s32 *mC)867867{868868 struct ds1307 *ds1307 = dev_get_drvdata(dev);869869 u8 temp_buf[2];···892892 struct device_attribute *attr, char *buf)893893{894894 int ret;895895- s16 temp;895895+ s32 temp;896896897897 ret = ds3231_hwmon_read_temp(dev, &temp);898898 if (ret)···15311531 return PTR_ERR(ds1307->rtc);15321532 }1533153315341534- if (ds1307_can_wakeup_device) {15341534+ if (ds1307_can_wakeup_device && ds1307->client->irq <= 0) {15351535 /* Disable request for an IRQ */15361536 want_irq = false;15371537 dev_info(&client->dev, "'wakeup-source' is set, request for an IRQ is disabled!\n");
···303303 if (req->cmd_type != REQ_TYPE_FS) {304304 blk_start_request(req);305305 blk_dump_rq_flags(req, KMSG_COMPONENT " bad request");306306- blk_end_request_all(req, -EIO);306306+ __blk_end_request_all(req, -EIO);307307 continue;308308 }309309
+2
drivers/thermal/Kconfig
···376376 tristate "Temperature sensor driver for mediatek SoCs"377377 depends on ARCH_MEDIATEK || COMPILE_TEST378378 depends on HAS_IOMEM379379+ depends on NVMEM || NVMEM=n380380+ depends on RESET_CONTROLLER379381 default y380382 help381383 Enable this option if you want to have support for thermal management
···688688{689689 struct thermal_zone_device *tz = to_thermal_zone(dev);690690 int trip, ret;691691- unsigned long temperature;691691+ int temperature;692692693693 if (!tz->ops->set_trip_temp)694694 return -EPERM;···696696 if (!sscanf(attr->attr.name, "trip_point_%d_temp", &trip))697697 return -EINVAL;698698699699- if (kstrtoul(buf, 10, &temperature))699699+ if (kstrtoint(buf, 10, &temperature))700700 return -EINVAL;701701702702 ret = tz->ops->set_trip_temp(tz, trip, temperature);···899899{900900 struct thermal_zone_device *tz = to_thermal_zone(dev);901901 int ret = 0;902902- unsigned long temperature;902902+ int temperature;903903904904- if (kstrtoul(buf, 10, &temperature))904904+ if (kstrtoint(buf, 10, &temperature))905905 return -EINVAL;906906907907 if (!tz->ops->set_emul_temp) {
+30-33
drivers/tty/pty.c
···663663/* this is called once with whichever end is closed last */664664static void pty_unix98_remove(struct tty_driver *driver, struct tty_struct *tty)665665{666666- struct inode *ptmx_inode;666666+ struct pts_fs_info *fsi;667667668668 if (tty->driver->subtype == PTY_TYPE_MASTER)669669- ptmx_inode = tty->driver_data;669669+ fsi = tty->driver_data;670670 else671671- ptmx_inode = tty->link->driver_data;672672- devpts_kill_index(ptmx_inode, tty->index);673673- devpts_del_ref(ptmx_inode);671671+ fsi = tty->link->driver_data;672672+ devpts_kill_index(fsi, tty->index);673673+ devpts_put_ref(fsi);674674}675675676676static const struct tty_operations ptm_unix98_ops = {···720720721721static int ptmx_open(struct inode *inode, struct file *filp)722722{723723+ struct pts_fs_info *fsi;723724 struct tty_struct *tty;724725 struct inode *slave_inode;725726 int retval;···735734 if (retval)736735 return retval;737736737737+ fsi = devpts_get_ref(inode, filp);738738+ retval = -ENODEV;739739+ if (!fsi)740740+ goto out_free_file;741741+738742 /* find a device that is not in use. */739743 mutex_lock(&devpts_mutex);740740- index = devpts_new_index(inode);741741- if (index < 0) {742742- retval = index;743743- mutex_unlock(&devpts_mutex);744744- goto err_file;745745- }746746-744744+ index = devpts_new_index(fsi);747745 mutex_unlock(&devpts_mutex);746746+747747+ retval = index;748748+ if (index < 0)749749+ goto out_put_ref;750750+748751749752 mutex_lock(&tty_mutex);750753 tty = tty_init_dev(ptm_driver, index);751751-752752- if (IS_ERR(tty)) {753753- retval = PTR_ERR(tty);754754- goto out;755755- }756756-757754 /* The tty returned here is locked so we can safely758755 drop the mutex */759756 mutex_unlock(&tty_mutex);760757761761- set_bit(TTY_PTY_LOCK, &tty->flags); /* LOCK THE SLAVE */762762- tty->driver_data = inode;758758+ retval = PTR_ERR(tty);759759+ if (IS_ERR(tty))760760+ goto out;763761764762 /*765765- * In the case where all references to ptmx inode are dropped and we766766- * still have /dev/tty opened pointing to the master/slave pair (ptmx767767- * is closed/released before /dev/tty), we must make sure that the inode768768- * is still valid when we call the final pty_unix98_shutdown, thus we769769- * hold an additional reference to the ptmx inode. For the same /dev/tty770770- * last close case, we also need to make sure the super_block isn't771771- * destroyed (devpts instance unmounted), before /dev/tty is closed and772772- * on its release devpts_kill_index is called.763763+ * From here on out, the tty is "live", and the index and764764+ * fsi will be killed/put by the tty_release()773765 */774774- devpts_add_ref(inode);766766+ set_bit(TTY_PTY_LOCK, &tty->flags); /* LOCK THE SLAVE */767767+ tty->driver_data = fsi;775768776769 tty_add_file(tty, filp);777770778778- slave_inode = devpts_pty_new(inode,771771+ slave_inode = devpts_pty_new(fsi,779772 MKDEV(UNIX98_PTY_SLAVE_MAJOR, index), index,780773 tty->link);781774 if (IS_ERR(slave_inode)) {···788793 return 0;789794err_release:790795 tty_unlock(tty);796796+ // This will also put-ref the fsi791797 tty_release(inode, filp);792798 return retval;793799out:794794- mutex_unlock(&tty_mutex);795795- devpts_kill_index(inode, index);796796-err_file:800800+ devpts_kill_index(fsi, index);801801+out_put_ref:802802+ devpts_put_ref(fsi);803803+out_free_file:797804 tty_free_file(filp);798805 return retval;799806}
+10-1
drivers/tty/serial/8250/8250_port.c
···14031403 /*14041404 * Empty the RX FIFO, we are not interested in anything14051405 * received during the half-duplex transmission.14061406+ * Enable previously disabled RX interrupts.14061407 */14071407- if (!(p->port.rs485.flags & SER_RS485_RX_DURING_TX))14081408+ if (!(p->port.rs485.flags & SER_RS485_RX_DURING_TX)) {14081409 serial8250_clear_fifos(p);14101410+14111411+ serial8250_rpm_get(p);14121412+14131413+ p->ier |= UART_IER_RLSI | UART_IER_RDI;14141414+ serial_port_out(&p->port, UART_IER, p->ier);14151415+14161416+ serial8250_rpm_put(p);14171417+ }14091418}1410141914111420static void serial8250_em485_handle_stop_tx(unsigned long arg)
-1
drivers/tty/serial/8250/Kconfig
···324324config SERIAL_8250_RT288X325325 bool "Ralink RT288x/RT305x/RT3662/RT3883 serial port support"326326 depends on SERIAL_8250327327- depends on MIPS || COMPILE_TEST328327 default y if MIPS_ALCHEMY || SOC_RT288X || SOC_RT305X || SOC_RT3883 || SOC_MT7620329328 help330329 Selecting this option will add support for the alternate register
···9898 if (!is_a_nulls(first))9999 first->pprev = &n->next;100100}101101+102102+/**103103+ * hlist_nulls_add_tail_rcu104104+ * @n: the element to add to the hash list.105105+ * @h: the list to add to.106106+ *107107+ * Description:108108+ * Adds the specified element to the end of the specified hlist_nulls,109109+ * while permitting racing traversals. NOTE: tail insertion requires110110+ * list traversal.111111+ *112112+ * The caller must take whatever precautions are necessary113113+ * (such as holding appropriate locks) to avoid racing114114+ * with another list-mutation primitive, such as hlist_nulls_add_head_rcu()115115+ * or hlist_nulls_del_rcu(), running on this same list.116116+ * However, it is perfectly legal to run concurrently with117117+ * the _rcu list-traversal primitives, such as118118+ * hlist_nulls_for_each_entry_rcu(), used to prevent memory-consistency119119+ * problems on Alpha CPUs. Regardless of the type of CPU, the120120+ * list-traversal primitive must be guarded by rcu_read_lock().121121+ */122122+static inline void hlist_nulls_add_tail_rcu(struct hlist_nulls_node *n,123123+ struct hlist_nulls_head *h)124124+{125125+ struct hlist_nulls_node *i, *last = NULL;126126+127127+ for (i = hlist_nulls_first_rcu(h); !is_a_nulls(i);128128+ i = hlist_nulls_next_rcu(i))129129+ last = i;130130+131131+ if (last) {132132+ n->next = last->next;133133+ n->pprev = &last->next;134134+ rcu_assign_pointer(hlist_nulls_next_rcu(last), n);135135+ } else {136136+ hlist_nulls_add_head_rcu(n, h);137137+ }138138+}139139+101140/**102141 * hlist_nulls_for_each_entry_rcu - iterate over rcu list of given type103142 * @tpos: the type * to use as a loop cursor.
+2-2
include/linux/thermal.h
···352352353353struct thermal_trip {354354 struct device_node *np;355355- unsigned long int temperature;356356- unsigned long int hysteresis;355355+ int temperature;356356+ int hysteresis;357357 enum thermal_trip_type type;358358};359359
+5-2
include/net/cls_cgroup.h
···1717#include <linux/hardirq.h>1818#include <linux/rcupdate.h>1919#include <net/sock.h>2020+#include <net/inet_sock.h>20212122#ifdef CONFIG_CGROUP_NET_CLASSID2223struct cgroup_cls_state {···6463 * softirqs always disables bh.6564 */6665 if (in_serving_softirq()) {6666+ struct sock *sk = skb_to_full_sk(skb);6767+6768 /* If there is an sock_cgroup_classid we'll use that. */6868- if (!skb->sk)6969+ if (!sk || !sk_fullsock(sk))6970 return 0;70717171- classid = sock_cgroup_classid(&skb->sk->sk_cgrp_data);7272+ classid = sock_cgroup_classid(&sk->sk_cgrp_data);7273 }73747475 return classid;
+3
include/net/ip6_route.h
···101101struct rt6_info *addrconf_dst_alloc(struct inet6_dev *idev,102102 const struct in6_addr *addr, bool anycast);103103104104+struct rt6_info *ip6_dst_alloc(struct net *net, struct net_device *dev,105105+ int flags);106106+104107/*105108 * support functions for ND106109 *
+2
include/net/ipv6.h
···959959int ip6_datagram_connect(struct sock *sk, struct sockaddr *addr, int addr_len);960960int ip6_datagram_connect_v6_only(struct sock *sk, struct sockaddr *addr,961961 int addr_len);962962+int ip6_datagram_dst_update(struct sock *sk, bool fix_sk_saddr);963963+void ip6_datagram_release_cb(struct sock *sk);962964963965int ipv6_recv_error(struct sock *sk, struct msghdr *msg, int len,964966 int *addr_len);
···847847 */848848 ktime_t last_time_heard;849849850850+ /* When was the last time that we sent a chunk using this851851+ * transport? We use this to check for idle transports852852+ */853853+ unsigned long last_time_sent;854854+850855 /* Last time(in jiffies) when cwnd is reduced due to the congestion851856 * indication based on ECNE chunk.852857 */···957952 struct sctp_sock *);958953void sctp_transport_pmtu(struct sctp_transport *, struct sock *sk);959954void sctp_transport_free(struct sctp_transport *);960960-void sctp_transport_reset_timers(struct sctp_transport *);955955+void sctp_transport_reset_t3_rtx(struct sctp_transport *);956956+void sctp_transport_reset_hb_timer(struct sctp_transport *);961957int sctp_transport_hold(struct sctp_transport *);962958void sctp_transport_put(struct sctp_transport *);963959void sctp_transport_update_rto(struct sctp_transport *, __u32);
···1717 unsigned int verb);1818int snd_hdac_regmap_read_raw(struct hdac_device *codec, unsigned int reg,1919 unsigned int *val);2020+int snd_hdac_regmap_read_raw_uncached(struct hdac_device *codec,2121+ unsigned int reg, unsigned int *val);2022int snd_hdac_regmap_write_raw(struct hdac_device *codec, unsigned int reg,2123 unsigned int val);2224int snd_hdac_regmap_update_raw(struct hdac_device *codec, unsigned int reg,
+5-1
include/uapi/asm-generic/unistd.h
···717717__SYSCALL(__NR_mlock2, sys_mlock2)718718#define __NR_copy_file_range 285719719__SYSCALL(__NR_copy_file_range, sys_copy_file_range)720720+#define __NR_preadv2 286721721+__SYSCALL(__NR_preadv2, sys_preadv2)722722+#define __NR_pwritev2 287723723+__SYSCALL(__NR_pwritev2, sys_pwritev2)720724721725#undef __NR_syscalls722722-#define __NR_syscalls 286726726+#define __NR_syscalls 288723727724728/*725729 * All syscalls below here should go away really,
···3636 * @target: The target state3737 * @thread: Pointer to the hotplug thread3838 * @should_run: Thread should execute3939+ * @rollback: Perform a rollback3940 * @cb_stat: The state for a single callback (install/uninstall)4041 * @cb: Single callback function (install/uninstall)4142 * @result: Result of the operation···4847#ifdef CONFIG_SMP4948 struct task_struct *thread;5049 bool should_run;5050+ bool rollback;5151 enum cpuhp_state cb_state;5252 int (*cb)(unsigned int cpu);5353 int result;···303301 return __cpu_notify(val, cpu, -1, NULL);304302}305303304304+static void cpu_notify_nofail(unsigned long val, unsigned int cpu)305305+{306306+ BUG_ON(cpu_notify(val, cpu));307307+}308308+306309/* Notifier wrappers for transitioning to state machine */307310static int notify_prepare(unsigned int cpu)308311{···484477 } else {485478 ret = cpuhp_invoke_callback(cpu, st->cb_state, st->cb);486479 }480480+ } else if (st->rollback) {481481+ BUG_ON(st->state < CPUHP_AP_ONLINE_IDLE);482482+483483+ undo_cpu_down(cpu, st, cpuhp_ap_states);484484+ /*485485+ * This is a momentary workaround to keep the notifier users486486+ * happy. Will go away once we got rid of the notifiers.487487+ */488488+ cpu_notify_nofail(CPU_DOWN_FAILED, cpu);489489+ st->rollback = false;487490 } else {488491 /* Cannot happen .... */489492 BUG_ON(st->state < CPUHP_AP_ONLINE_IDLE);···653636 read_unlock(&tasklist_lock);654637}655638656656-static void cpu_notify_nofail(unsigned long val, unsigned int cpu)657657-{658658- BUG_ON(cpu_notify(val, cpu));659659-}660660-661639static int notify_down_prepare(unsigned int cpu)662640{663641 int err, nr_calls = 0;···733721 */734722 err = stop_machine(take_cpu_down, NULL, cpumask_of(cpu));735723 if (err) {736736- /* CPU didn't die: tell everyone. Can't complain. */737737- cpu_notify_nofail(CPU_DOWN_FAILED, cpu);724724+ /* CPU refused to die */738725 irq_unlock_sparse();726726+ /* Unpark the hotplug thread so we can rollback there */727727+ kthread_unpark(per_cpu_ptr(&cpuhp_state, cpu)->thread);739728 return err;740729 }741730 BUG_ON(cpu_online(cpu));···845832 * to do the further cleanups.846833 */847834 ret = cpuhp_down_callbacks(cpu, st, cpuhp_bp_states, target);835835+ if (ret && st->state > CPUHP_TEARDOWN_CPU && st->state < prev_state) {836836+ st->target = prev_state;837837+ st->rollback = true;838838+ cpuhp_kick_ap_work(cpu);839839+ }848840849841 hasdied = prev_state != st->state && st->state == CPUHP_OFFLINE;850842out:···12671249 .name = "notify:online",12681250 .startup = notify_online,12691251 .teardown = notify_down_prepare,12521252+ .skip_onerr = true,12701253 },12711254#endif12721255 /*
+23-4
kernel/futex.c
···12951295 if (unlikely(should_fail_futex(true)))12961296 ret = -EFAULT;1297129712981298- if (cmpxchg_futex_value_locked(&curval, uaddr, uval, newval))12981298+ if (cmpxchg_futex_value_locked(&curval, uaddr, uval, newval)) {12991299 ret = -EFAULT;13001300- else if (curval != uval)13011301- ret = -EINVAL;13001300+ } else if (curval != uval) {13011301+ /*13021302+ * If a unconditional UNLOCK_PI operation (user space did not13031303+ * try the TID->0 transition) raced with a waiter setting the13041304+ * FUTEX_WAITERS flag between get_user() and locking the hash13051305+ * bucket lock, retry the operation.13061306+ */13071307+ if ((FUTEX_TID_MASK & curval) == uval)13081308+ ret = -EAGAIN;13091309+ else13101310+ ret = -EINVAL;13111311+ }13021312 if (ret) {13031313 raw_spin_unlock_irq(&pi_state->pi_mutex.wait_lock);13041314 return ret;···15351525 if (likely(&hb1->chain != &hb2->chain)) {15361526 plist_del(&q->list, &hb1->chain);15371527 hb_waiters_dec(hb1);15381538- plist_add(&q->list, &hb2->chain);15391528 hb_waiters_inc(hb2);15291529+ plist_add(&q->list, &hb2->chain);15401530 q->lock_ptr = &hb2->lock;15411531 }15421532 get_futex_key_refs(key2);···26322622 */26332623 if (ret == -EFAULT)26342624 goto pi_faulted;26252625+ /*26262626+ * A unconditional UNLOCK_PI op raced against a waiter26272627+ * setting the FUTEX_WAITERS bit. Try again.26282628+ */26292629+ if (ret == -EAGAIN) {26302630+ spin_unlock(&hb->lock);26312631+ put_futex_key(&key);26322632+ goto retry;26332633+ }26352634 /*26362635 * wake_futex_pi has detected invalid state. Tell user26372636 * space.
+1
kernel/irq/ipi.c
···9494 data = irq_get_irq_data(virq + i);9595 cpumask_copy(data->common->affinity, dest);9696 data->common->ipi_offset = offset;9797+ irq_set_status_flags(virq + i, IRQ_NO_BALANCING);9798 }9899 return virq;99100
···596596 return false;597597598598 /*599599- * FIFO realtime policy runs the highest priority task (after DEADLINE).600600- * Other runnable tasks are of a lower priority. The scheduler tick601601- * isn't needed.602602- */603603- fifo_nr_running = rq->rt.rt_nr_running - rq->rt.rr_nr_running;604604- if (fifo_nr_running)605605- return true;606606-607607- /*608608- * Round-robin realtime tasks time slice with other tasks at the same609609- * realtime priority.599599+ * If there are more than one RR tasks, we need the tick to effect the600600+ * actual RR behaviour.610601 */611602 if (rq->rt.rr_nr_running) {612603 if (rq->rt.rr_nr_running == 1)···606615 return false;607616 }608617609609- /* Normal multitasking need periodic preemption checks */610610- if (rq->cfs.nr_running > 1)618618+ /*619619+ * If there's no RR tasks, but FIFO tasks, we can skip the tick, no620620+ * forced preemption between FIFO tasks.621621+ */622622+ fifo_nr_running = rq->rt.rt_nr_running - rq->rt.rr_nr_running;623623+ if (fifo_nr_running)624624+ return true;625625+626626+ /*627627+ * If there are no DL,RR/FIFO tasks, there must only be CFS tasks left;628628+ * if there's more than one we need the tick for involuntary629629+ * preemption.630630+ */631631+ if (rq->nr_running > 1)611632 return false;612633613634 return true;
+5-1
net/bridge/netfilter/ebtables.c
···370370 left - sizeof(struct ebt_entry_match) < m->match_size)371371 return -EINVAL;372372373373- match = xt_request_find_match(NFPROTO_BRIDGE, m->u.name, 0);373373+ match = xt_find_match(NFPROTO_BRIDGE, m->u.name, 0);374374+ if (IS_ERR(match) || match->family != NFPROTO_BRIDGE) {375375+ request_module("ebt_%s", m->u.name);376376+ match = xt_find_match(NFPROTO_BRIDGE, m->u.name, 0);377377+ }374378 if (IS_ERR(match))375379 return PTR_ERR(match);376380 m->u.match = match;
···10341034 if (!fld.daddr) {10351035 fld.daddr = fld.saddr;1036103610371037- err = -EADDRNOTAVAIL;10381037 if (dev_out)10391038 dev_put(dev_out);10391039+ err = -EINVAL;10401040 dev_out = init_net.loopback_dev;10411041+ if (!dev_out->dn_ptr)10421042+ goto out;10431043+ err = -EADDRNOTAVAIL;10411044 dev_hold(dev_out);10421045 if (!fld.daddr) {10431046 fld.daddr =···11131110 if (dev_out == NULL)11141111 goto out;11151112 dn_db = rcu_dereference_raw(dev_out->dn_ptr);11131113+ if (!dn_db)11141114+ goto e_inval;11161115 /* Possible improvement - check all devices for local addr */11171116 if (dn_dev_islocal(dev_out, fld.daddr)) {11181117 dev_put(dev_out);···11561151 dev_put(dev_out);11571152 dev_out = init_net.loopback_dev;11581153 dev_hold(dev_out);11541154+ if (!dev_out->dn_ptr)11551155+ goto e_inval;11591156 fld.flowidn_oif = dev_out->ifindex;11601157 if (res.fi)11611158 dn_fib_info_put(res.fi);
+6
net/ipv4/netfilter/arptable_filter.c
···8181 return ret;8282 }83838484+ ret = arptable_filter_table_init(&init_net);8585+ if (ret) {8686+ unregister_pernet_subsys(&arptable_filter_net_ops);8787+ kfree(arpfilter_ops);8888+ }8989+8490 return ret;8591}8692
+16-3
net/ipv4/route.c
···14381438#endif14391439}1440144014411441-static struct rtable *rt_dst_alloc(struct net_device *dev,14421442- unsigned int flags, u16 type,14431443- bool nopolicy, bool noxfrm, bool will_cache)14411441+struct rtable *rt_dst_alloc(struct net_device *dev,14421442+ unsigned int flags, u16 type,14431443+ bool nopolicy, bool noxfrm, bool will_cache)14441444{14451445 struct rtable *rt;14461446···1468146814691469 return rt;14701470}14711471+EXPORT_SYMBOL(rt_dst_alloc);1471147214721473/* called in rcu_read_lock() section */14731474static int ip_route_input_mc(struct sk_buff *skb, __be32 daddr, __be32 saddr,···20462045 */20472046 if (fi && res->prefixlen < 4)20482047 fi = NULL;20482048+ } else if ((type == RTN_LOCAL) && (orig_oif != 0) &&20492049+ (orig_oif != dev_out->ifindex)) {20502050+ /* For local routes that require a particular output interface20512051+ * we do not want to cache the result. Caching the result20522052+ * causes incorrect behaviour when there are multiple source20532053+ * addresses on the interface, the end result being that if the20542054+ * intended recipient is waiting on that interface for the20552055+ * packet he won't receive it because it will be delivered on20562056+ * the loopback interface and the IP_PKTINFO ipi_ifindex will20572057+ * be set to the loopback interface as well.20582058+ */20592059+ fi = NULL;20492060 }2050206120512062 fnhe = NULL;
···159159 if (validate)160160 skb = validate_xmit_skb_list(skb, dev);161161162162- if (skb) {162162+ if (likely(skb)) {163163 HARD_TX_LOCK(dev, txq, smp_processor_id());164164 if (!netif_xmit_frozen_or_stopped(txq))165165 skb = dev_hard_start_xmit(skb, dev, txq, &ret);166166167167 HARD_TX_UNLOCK(dev, txq);168168+ } else {169169+ spin_lock(root_lock);170170+ return qdisc_qlen(q);168171 }169172 spin_lock(root_lock);170173
+10-5
net/sctp/outqueue.c
···866866 * sender MUST assure that at least one T3-rtx867867 * timer is running.868868 */869869- if (chunk->chunk_hdr->type == SCTP_CID_FWD_TSN)870870- sctp_transport_reset_timers(transport);869869+ if (chunk->chunk_hdr->type == SCTP_CID_FWD_TSN) {870870+ sctp_transport_reset_t3_rtx(transport);871871+ transport->last_time_sent = jiffies;872872+ }871873 }872874 break;873875···926924 error = sctp_outq_flush_rtx(q, packet,927925 rtx_timeout, &start_timer);928926929929- if (start_timer)930930- sctp_transport_reset_timers(transport);927927+ if (start_timer) {928928+ sctp_transport_reset_t3_rtx(transport);929929+ transport->last_time_sent = jiffies;930930+ }931931932932 /* This can happen on COOKIE-ECHO resend. Only933933 * one chunk can get bundled with a COOKIE-ECHO.···10661062 list_add_tail(&chunk->transmitted_list,10671063 &transport->transmitted);1068106410691069- sctp_transport_reset_timers(transport);10651065+ sctp_transport_reset_t3_rtx(transport);10661066+ transport->last_time_sent = jiffies;1070106710711068 /* Only let one DATA chunk get bundled with a10721069 * COOKIE-ECHO chunk.
+1-2
net/sctp/sm_make_chunk.c
···30803080 return SCTP_ERROR_RSRC_LOW;3081308130823082 /* Start the heartbeat timer. */30833083- if (!mod_timer(&peer->hb_timer, sctp_transport_timeout(peer)))30843084- sctp_transport_hold(peer);30833083+ sctp_transport_reset_hb_timer(peer);30853084 asoc->new_transport = peer;30863085 break;30873086 case SCTP_PARAM_DEL_IP:
+16-20
net/sctp/sm_sideeffect.c
···6969 sctp_cmd_seq_t *commands,7070 gfp_t gfp);71717272-static void sctp_cmd_hb_timer_update(sctp_cmd_seq_t *cmds,7373- struct sctp_transport *t);7472/********************************************************************7573 * Helper functions7674 ********************************************************************/···365367 struct sctp_association *asoc = transport->asoc;366368 struct sock *sk = asoc->base.sk;367369 struct net *net = sock_net(sk);370370+ u32 elapsed, timeout;368371369372 bh_lock_sock(sk);370373 if (sock_owned_by_user(sk)) {···373374374375 /* Try again later. */375376 if (!mod_timer(&transport->hb_timer, jiffies + (HZ/20)))377377+ sctp_transport_hold(transport);378378+ goto out_unlock;379379+ }380380+381381+ /* Check if we should still send the heartbeat or reschedule */382382+ elapsed = jiffies - transport->last_time_sent;383383+ timeout = sctp_transport_timeout(transport);384384+ if (elapsed < timeout) {385385+ elapsed = timeout - elapsed;386386+ if (!mod_timer(&transport->hb_timer, jiffies + elapsed))376387 sctp_transport_hold(transport);377388 goto out_unlock;378389 }···516507 0);517508518509 /* Update the hb timer to resend a heartbeat every rto */519519- sctp_cmd_hb_timer_update(commands, transport);510510+ sctp_transport_reset_hb_timer(transport);520511 }521512522513 if (transport->state != SCTP_INACTIVE &&···643634 * hold a reference on the transport to make sure none of644635 * the needed data structures go away.645636 */646646- list_for_each_entry(t, &asoc->peer.transport_addr_list, transports) {647647-648648- if (!mod_timer(&t->hb_timer, sctp_transport_timeout(t)))649649- sctp_transport_hold(t);650650- }637637+ list_for_each_entry(t, &asoc->peer.transport_addr_list, transports)638638+ sctp_transport_reset_hb_timer(t);651639}652640653641static void sctp_cmd_hb_timers_stop(sctp_cmd_seq_t *cmds,···674668 }675669}676670677677-678678-/* Helper function to update the heartbeat timer. */679679-static void sctp_cmd_hb_timer_update(sctp_cmd_seq_t *cmds,680680- struct sctp_transport *t)681681-{682682- /* Update the heartbeat timer. */683683- if (!mod_timer(&t->hb_timer, sctp_transport_timeout(t)))684684- sctp_transport_hold(t);685685-}686671687672/* Helper function to handle the reception of an HEARTBEAT ACK. */688673static void sctp_cmd_transport_on(sctp_cmd_seq_t *cmds,···739742 sctp_transport_update_rto(t, (jiffies - hbinfo->sent_at));740743741744 /* Update the heartbeat timer. */742742- if (!mod_timer(&t->hb_timer, sctp_transport_timeout(t)))743743- sctp_transport_hold(t);745745+ sctp_transport_reset_hb_timer(t);744746745747 if (was_unconfirmed && asoc->peer.transport_count == 1)746748 sctp_transport_immediate_rtx(t);···1610161416111615 case SCTP_CMD_HB_TIMER_UPDATE:16121616 t = cmd->obj.transport;16131613- sctp_cmd_hb_timer_update(commands, t);16171617+ sctp_transport_reset_hb_timer(t);16141618 break;1615161916161620 case SCTP_CMD_HB_TIMERS_STOP:
+13-6
net/sctp/transport.c
···183183/* Start T3_rtx timer if it is not already running and update the heartbeat184184 * timer. This routine is called every time a DATA chunk is sent.185185 */186186-void sctp_transport_reset_timers(struct sctp_transport *transport)186186+void sctp_transport_reset_t3_rtx(struct sctp_transport *transport)187187{188188 /* RFC 2960 6.3.2 Retransmission Timer Rules189189 *···197197 if (!mod_timer(&transport->T3_rtx_timer,198198 jiffies + transport->rto))199199 sctp_transport_hold(transport);200200+}201201+202202+void sctp_transport_reset_hb_timer(struct sctp_transport *transport)203203+{204204+ unsigned long expires;200205201206 /* When a data chunk is sent, reset the heartbeat interval. */202202- if (!mod_timer(&transport->hb_timer,203203- sctp_transport_timeout(transport)))204204- sctp_transport_hold(transport);207207+ expires = jiffies + sctp_transport_timeout(transport);208208+ if (time_before(transport->hb_timer.expires, expires) &&209209+ !mod_timer(&transport->hb_timer,210210+ expires + prandom_u32_max(transport->rto)))211211+ sctp_transport_hold(transport);205212}206213207214/* This transport has been assigned to an association.···602595unsigned long sctp_transport_timeout(struct sctp_transport *trans)603596{604597 /* RTO + timer slack +/- 50% of RTO */605605- unsigned long timeout = (trans->rto >> 1) + prandom_u32_max(trans->rto);598598+ unsigned long timeout = trans->rto >> 1;606599607600 if (trans->state != SCTP_UNCONFIRMED &&608601 trans->state != SCTP_PF)609602 timeout += trans->hbinterval;610603611611- return timeout + jiffies;604604+ return timeout;612605}613606614607/* Reset transport variables to their initial values */
+1
net/tipc/core.c
···6969 if (err)7070 goto out_nametbl;71717272+ INIT_LIST_HEAD(&tn->dist_queue);7273 err = tipc_topsrv_start(net);7374 if (err)7475 goto out_subscr;
···40404141int sysctl_tipc_named_timeout __read_mostly = 2000;42424343-/**4444- * struct tipc_dist_queue - queue holding deferred name table updates4545- */4646-static struct list_head tipc_dist_queue = LIST_HEAD_INIT(tipc_dist_queue);4747-4843struct distr_queue_item {4944 struct distr_item i;5045 u32 dtype;···224229 kfree_rcu(p, rcu);225230}226231232232+/**233233+ * tipc_dist_queue_purge - remove deferred updates from a node that went down234234+ */235235+static void tipc_dist_queue_purge(struct net *net, u32 addr)236236+{237237+ struct tipc_net *tn = net_generic(net, tipc_net_id);238238+ struct distr_queue_item *e, *tmp;239239+240240+ spin_lock_bh(&tn->nametbl_lock);241241+ list_for_each_entry_safe(e, tmp, &tn->dist_queue, next) {242242+ if (e->node != addr)243243+ continue;244244+ list_del(&e->next);245245+ kfree(e);246246+ }247247+ spin_unlock_bh(&tn->nametbl_lock);248248+}249249+227250void tipc_publ_notify(struct net *net, struct list_head *nsub_list, u32 addr)228251{229252 struct publication *publ, *tmp;230253231254 list_for_each_entry_safe(publ, tmp, nsub_list, nodesub_list)232255 tipc_publ_purge(net, publ, addr);256256+ tipc_dist_queue_purge(net, addr);233257}234258235259/**···293279 * tipc_named_add_backlog - add a failed name table update to the backlog294280 *295281 */296296-static void tipc_named_add_backlog(struct distr_item *i, u32 type, u32 node)282282+static void tipc_named_add_backlog(struct net *net, struct distr_item *i,283283+ u32 type, u32 node)297284{298285 struct distr_queue_item *e;286286+ struct tipc_net *tn = net_generic(net, tipc_net_id);299287 unsigned long now = get_jiffies_64();300288301289 e = kzalloc(sizeof(*e), GFP_ATOMIC);···307291 e->node = node;308292 e->expires = now + msecs_to_jiffies(sysctl_tipc_named_timeout);309293 memcpy(e, i, sizeof(*i));310310- list_add_tail(&e->next, &tipc_dist_queue);294294+ list_add_tail(&e->next, &tn->dist_queue);311295}312296313297/**···317301void tipc_named_process_backlog(struct net *net)318302{319303 struct distr_queue_item *e, *tmp;304304+ struct tipc_net *tn = net_generic(net, tipc_net_id);320305 char addr[16];321306 unsigned long now = get_jiffies_64();322307323323- list_for_each_entry_safe(e, tmp, &tipc_dist_queue, next) {308308+ list_for_each_entry_safe(e, tmp, &tn->dist_queue, next) {324309 if (time_after(e->expires, now)) {325310 if (!tipc_update_nametbl(net, &e->i, e->node, e->dtype))326311 continue;···361344 node = msg_orignode(msg);362345 while (count--) {363346 if (!tipc_update_nametbl(net, item, node, mtype))364364- tipc_named_add_backlog(item, mtype, node);347347+ tipc_named_add_backlog(net, item, mtype, node);365348 item++;366349 }367350 kfree_skb(skb);
+2-5
net/vmw_vsock/vmci_transport.c
···17351735 /* Retrieve the head sk_buff from the socket's receive queue. */17361736 err = 0;17371737 skb = skb_recv_datagram(&vsk->sk, flags, noblock, &err);17381738- if (err)17391739- return err;17401740-17411738 if (!skb)17421742- return -EAGAIN;17391739+ return err;1743174017441741 dg = (struct vmci_datagram *)skb->data;17451742 if (!dg)···2151215421522155MODULE_AUTHOR("VMware, Inc.");21532156MODULE_DESCRIPTION("VMCI transport for Virtual Sockets");21542154-MODULE_VERSION("1.0.3.0-k");21572157+MODULE_VERSION("1.0.4.0-k");21552158MODULE_LICENSE("GPL v2");21562159MODULE_ALIAS("vmware_vsock");21572160MODULE_ALIAS_NETPROTO(PF_VSOCK);
···299299int snd_hdac_read_parm_uncached(struct hdac_device *codec, hda_nid_t nid,300300 int parm)301301{302302- int val;302302+ unsigned int cmd, val;303303304304- if (codec->regmap)305305- regcache_cache_bypass(codec->regmap, true);306306- val = snd_hdac_read_parm(codec, nid, parm);307307- if (codec->regmap)308308- regcache_cache_bypass(codec->regmap, false);304304+ cmd = snd_hdac_regmap_encode_verb(nid, AC_VERB_PARAMETERS) | parm;305305+ if (snd_hdac_regmap_read_raw_uncached(codec, cmd, &val) < 0)306306+ return -1;309307 return val;310308}311309EXPORT_SYMBOL_GPL(snd_hdac_read_parm_uncached);
+28-12
sound/hda/hdac_regmap.c
···453453EXPORT_SYMBOL_GPL(snd_hdac_regmap_write_raw);454454455455static int reg_raw_read(struct hdac_device *codec, unsigned int reg,456456- unsigned int *val)456456+ unsigned int *val, bool uncached)457457{458458- if (!codec->regmap)458458+ if (uncached || !codec->regmap)459459 return hda_reg_read(codec, reg, val);460460 else461461 return regmap_read(codec->regmap, reg, val);462462+}463463+464464+static int __snd_hdac_regmap_read_raw(struct hdac_device *codec,465465+ unsigned int reg, unsigned int *val,466466+ bool uncached)467467+{468468+ int err;469469+470470+ err = reg_raw_read(codec, reg, val, uncached);471471+ if (err == -EAGAIN) {472472+ err = snd_hdac_power_up_pm(codec);473473+ if (!err)474474+ err = reg_raw_read(codec, reg, val, uncached);475475+ snd_hdac_power_down_pm(codec);476476+ }477477+ return err;462478}463479464480/**···488472int snd_hdac_regmap_read_raw(struct hdac_device *codec, unsigned int reg,489473 unsigned int *val)490474{491491- int err;492492-493493- err = reg_raw_read(codec, reg, val);494494- if (err == -EAGAIN) {495495- err = snd_hdac_power_up_pm(codec);496496- if (!err)497497- err = reg_raw_read(codec, reg, val);498498- snd_hdac_power_down_pm(codec);499499- }500500- return err;475475+ return __snd_hdac_regmap_read_raw(codec, reg, val, false);501476}502477EXPORT_SYMBOL_GPL(snd_hdac_regmap_read_raw);478478+479479+/* Works like snd_hdac_regmap_read_raw(), but this doesn't read from the480480+ * cache but always via hda verbs.481481+ */482482+int snd_hdac_regmap_read_raw_uncached(struct hdac_device *codec,483483+ unsigned int reg, unsigned int *val)484484+{485485+ return __snd_hdac_regmap_read_raw(codec, reg, val, true);486486+}503487504488/**505489 * snd_hdac_regmap_update_raw - update a pseudo register with power mgmt
+4-2
sound/pci/hda/hda_generic.c
···826826 bool allow_powerdown)827827{828828 hda_nid_t nid, changed = 0;829829- int i, state;829829+ int i, state, power;830830831831 for (i = 0; i < path->depth; i++) {832832 nid = path->path[i];···838838 state = AC_PWRST_D0;839839 else840840 state = AC_PWRST_D3;841841- if (!snd_hda_check_power_state(codec, nid, state)) {841841+ power = snd_hda_codec_read(codec, nid, 0,842842+ AC_VERB_GET_POWER_STATE, 0);843843+ if (power != (state | (state << 4))) {842844 snd_hda_codec_write(codec, nid, 0,843845 AC_VERB_SET_POWER_STATE, state);844846 changed = nid;
···299299Errors in .c files300300------------------301301302302-If you're getting an objtool error in a compiled .c file, chances are303303-the file uses an asm() statement which has a "call" instruction. An304304-asm() statement with a call instruction must declare the use of the305305-stack pointer in its output operand. For example, on x86_64:302302+1. c_file.o: warning: objtool: funcA() falls through to next function funcB()306303307307- register void *__sp asm("rsp");308308- asm volatile("call func" : "+r" (__sp));304304+ This means that funcA() doesn't end with a return instruction or an305305+ unconditional jump, and that objtool has determined that the function306306+ can fall through into the next function. There could be different307307+ reasons for this:309308310310-Otherwise the stack frame may not get created before the call.309309+ 1) funcA()'s last instruction is a call to a "noreturn" function like310310+ panic(). In this case the noreturn function needs to be added to311311+ objtool's hard-coded global_noreturns array. Feel free to bug the312312+ objtool maintainer, or you can submit a patch.311313312312-Another possible cause for errors in C code is if the Makefile removes313313--fno-omit-frame-pointer or adds -fomit-frame-pointer to the gcc options.314314+ 2) funcA() uses the unreachable() annotation in a section of code315315+ that is actually reachable.316316+317317+ 3) If funcA() calls an inline function, the object code for funcA()318318+ might be corrupt due to a gcc bug. For more details, see:319319+ https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70646320320+321321+2. If you're getting any other objtool error in a compiled .c file, it322322+ may be because the file uses an asm() statement which has a "call"323323+ instruction. An asm() statement with a call instruction must declare324324+ the use of the stack pointer in its output operand. For example, on325325+ x86_64:326326+327327+ register void *__sp asm("rsp");328328+ asm volatile("call func" : "+r" (__sp));329329+330330+ Otherwise the stack frame may not get created before the call.331331+332332+3. Another possible cause for errors in C code is if the Makefile removes333333+ -fno-omit-frame-pointer or adds -fomit-frame-pointer to the gcc options.314334315335Also see the above section for .S file errors for more information what316336the individual error messages mean.
+72-25
tools/objtool/builtin-check.c
···5454 struct symbol *call_dest;5555 struct instruction *jump_dest;5656 struct list_head alts;5757+ struct symbol *func;5758};58595960struct alternative {···6766 struct list_head insn_list;6867 DECLARE_HASHTABLE(insn_hash, 16);6968 struct section *rodata, *whitelist;6969+ bool ignore_unreachables, c_file;7070};71717272const char *objname;···230228 }231229 }232230233233- if (insn->type == INSN_JUMP_DYNAMIC)231231+ if (insn->type == INSN_JUMP_DYNAMIC && list_empty(&insn->alts))234232 /* sibling call */235233 return 0;236234 }···250248static int decode_instructions(struct objtool_file *file)251249{252250 struct section *sec;251251+ struct symbol *func;253252 unsigned long offset;254253 struct instruction *insn;255254 int ret;···283280284281 hash_add(file->insn_hash, &insn->hash, insn->offset);285282 list_add_tail(&insn->list, &file->insn_list);283283+ }284284+285285+ list_for_each_entry(func, &sec->symbol_list, list) {286286+ if (func->type != STT_FUNC)287287+ continue;288288+289289+ if (!find_insn(file, sec, func->offset)) {290290+ WARN("%s(): can't find starting instruction",291291+ func->name);292292+ return -1;293293+ }294294+295295+ func_for_each_insn(file, func, insn)296296+ if (!insn->func)297297+ insn->func = func;286298 }287299 }288300···682664 text_rela->addend);683665684666 /*685685- * TODO: Document where this is needed, or get rid of it.686686- *687667 * rare case: jmpq *[addr](%rip)668668+ *669669+ * This check is for a rare gcc quirk, currently only seen in670670+ * three driver functions in the kernel, only with certain671671+ * obscure non-distro configs.672672+ *673673+ * As part of an optimization, gcc makes a copy of an existing674674+ * switch jump table, modifies it, and then hard-codes the jump675675+ * (albeit with an indirect jump) to use a single entry in the676676+ * table. The rest of the jump table and some of its jump677677+ * targets remain as dead code.678678+ *679679+ * In such a case we can just crudely ignore all unreachable680680+ * instruction warnings for the entire object file. Ideally we681681+ * would just ignore them for the function, but that would682682+ * require redesigning the code quite a bit. And honestly683683+ * that's just not worth doing: unreachable instruction684684+ * warnings are of questionable value anyway, and this is such685685+ * a rare issue.686686+ *687687+ * kbuild reports:688688+ * - https://lkml.kernel.org/r/201603231906.LWcVUpxm%25fengguang.wu@intel.com689689+ * - https://lkml.kernel.org/r/201603271114.K9i45biy%25fengguang.wu@intel.com690690+ * - https://lkml.kernel.org/r/201603291058.zuJ6ben1%25fengguang.wu@intel.com691691+ *692692+ * gcc bug:693693+ * - https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70604688694 */689689- if (!rodata_rela)695695+ if (!rodata_rela) {690696 rodata_rela = find_rela_by_dest(file->rodata,691697 text_rela->addend + 4);698698+ if (rodata_rela)699699+ file->ignore_unreachables = true;700700+ }692701693702 if (!rodata_rela)694703 continue;···776731static int decode_sections(struct objtool_file *file)777732{778733 int ret;779779-780780- file->whitelist = find_section_by_name(file->elf, "__func_stack_frame_non_standard");781781- file->rodata = find_section_by_name(file->elf, ".rodata");782734783735 ret = decode_instructions(file);784736 if (ret)···841799 struct alternative *alt;842800 struct instruction *insn;843801 struct section *sec;802802+ struct symbol *func = NULL;844803 unsigned char state;845804 int ret;846805···856813 }857814858815 while (1) {816816+ if (file->c_file && insn->func) {817817+ if (func && func != insn->func) {818818+ WARN("%s() falls through to next function %s()",819819+ func->name, insn->func->name);820820+ return 1;821821+ }822822+823823+ func = insn->func;824824+ }825825+859826 if (insn->visited) {860827 if (frame_state(insn->state) != frame_state(state)) {861828 WARN_FUNC("frame pointer state mismatch",···875822876823 return 0;877824 }878878-879879- /*880880- * Catch a rare case where a noreturn function falls through to881881- * the next function.882882- */883883- if (is_fentry_call(insn) && (state & STATE_FENTRY))884884- return 0;885825886826 insn->visited = true;887827 insn->state = state;···10811035 continue;1082103610831037 insn = find_insn(file, sec, func->offset);10841084- if (!insn) {10851085- WARN("%s(): can't find starting instruction",10861086- func->name);10871087- warnings++;10381038+ if (!insn)10881039 continue;10891089- }1090104010911041 ret = validate_branch(file, insn, 0);10921042 warnings += ret;···10981056 if (insn->visited)10991057 continue;1100105811011101- if (!ignore_unreachable_insn(func, insn) &&11021102- !warnings) {11031103- WARN_FUNC("function has unreachable instruction", insn->sec, insn->offset);11041104- warnings++;11051105- }11061106-11071059 insn->visited = true;10601060+10611061+ if (file->ignore_unreachables || warnings ||10621062+ ignore_unreachable_insn(func, insn))10631063+ continue;10641064+10651065+ WARN_FUNC("function has unreachable instruction", insn->sec, insn->offset);10661066+ warnings++;11081067 }11091068 }11101069 }···1176113311771134 INIT_LIST_HEAD(&file.insn_list);11781135 hash_init(file.insn_hash);11361136+ file.whitelist = find_section_by_name(file.elf, "__func_stack_frame_non_standard");11371137+ file.rodata = find_section_by_name(file.elf, ".rodata");11381138+ file.ignore_unreachables = false;11391139+ file.c_file = find_section_by_name(file.elf, ".comment");1179114011801141 ret = decode_sections(&file);11811142 if (ret < 0)
+1-1
tools/perf/util/intel-pt.c
···11301130 pr_err("Intel Processor Trace: failed to deliver transaction event, error %d\n",11311131 ret);1132113211331133- if (pt->synth_opts.callchain)11331133+ if (pt->synth_opts.last_branch)11341134 intel_pt_reset_last_branch_rb(ptq);1135113511361136 return ret;