···1818/ {1919 #address-cells = <1>;2020 #size-cells = <1>;2121+ /*2222+ * The decompressor and also some bootloaders rely on a2323+ * pre-existing /chosen node to be available to insert the2424+ * command line and merge other ATAGS info.2525+ * Also for U-Boot there must be a pre-existing /memory node.2626+ */2727+ chosen {};2828+ memory { device_type = "memory"; reg = <0 0>; };21292230 aliases {2331 gpio0 = &gpio1;
+8
arch/arm/boot/dts/imx23.dtsi
···1616 #size-cells = <1>;17171818 interrupt-parent = <&icoll>;1919+ /*2020+ * The decompressor and also some bootloaders rely on a2121+ * pre-existing /chosen node to be available to insert the2222+ * command line and merge other ATAGS info.2323+ * Also for U-Boot there must be a pre-existing /memory node.2424+ */2525+ chosen {};2626+ memory { device_type = "memory"; reg = <0 0>; };19272028 aliases {2129 gpio0 = &gpio0;
+8
arch/arm/boot/dts/imx25.dtsi
···1414/ {1515 #address-cells = <1>;1616 #size-cells = <1>;1717+ /*1818+ * The decompressor and also some bootloaders rely on a1919+ * pre-existing /chosen node to be available to insert the2020+ * command line and merge other ATAGS info.2121+ * Also for U-Boot there must be a pre-existing /memory node.2222+ */2323+ chosen {};2424+ memory { device_type = "memory"; reg = <0 0>; };17251826 aliases {1927 ethernet0 = &fec;
+8
arch/arm/boot/dts/imx27.dtsi
···1919/ {2020 #address-cells = <1>;2121 #size-cells = <1>;2222+ /*2323+ * The decompressor and also some bootloaders rely on a2424+ * pre-existing /chosen node to be available to insert the2525+ * command line and merge other ATAGS info.2626+ * Also for U-Boot there must be a pre-existing /memory node.2727+ */2828+ chosen {};2929+ memory { device_type = "memory"; reg = <0 0>; };22302331 aliases {2432 ethernet0 = &fec;
+8
arch/arm/boot/dts/imx28.dtsi
···1717 #size-cells = <1>;18181919 interrupt-parent = <&icoll>;2020+ /*2121+ * The decompressor and also some bootloaders rely on a2222+ * pre-existing /chosen node to be available to insert the2323+ * command line and merge other ATAGS info.2424+ * Also for U-Boot there must be a pre-existing /memory node.2525+ */2626+ chosen {};2727+ memory { device_type = "memory"; reg = <0 0>; };20282129 aliases {2230 ethernet0 = &mac0;
+8
arch/arm/boot/dts/imx31.dtsi
···1212/ {1313 #address-cells = <1>;1414 #size-cells = <1>;1515+ /*1616+ * The decompressor and also some bootloaders rely on a1717+ * pre-existing /chosen node to be available to insert the1818+ * command line and merge other ATAGS info.1919+ * Also for U-Boot there must be a pre-existing /memory node.2020+ */2121+ chosen {};2222+ memory { device_type = "memory"; reg = <0 0>; };15231624 aliases {1725 serial0 = &uart1;
+8
arch/arm/boot/dts/imx35.dtsi
···1313/ {1414 #address-cells = <1>;1515 #size-cells = <1>;1616+ /*1717+ * The decompressor and also some bootloaders rely on a1818+ * pre-existing /chosen node to be available to insert the1919+ * command line and merge other ATAGS info.2020+ * Also for U-Boot there must be a pre-existing /memory node.2121+ */2222+ chosen {};2323+ memory { device_type = "memory"; reg = <0 0>; };16241725 aliases {1826 ethernet0 = &fec;
+8
arch/arm/boot/dts/imx50.dtsi
···1717/ {1818 #address-cells = <1>;1919 #size-cells = <1>;2020+ /*2121+ * The decompressor and also some bootloaders rely on a2222+ * pre-existing /chosen node to be available to insert the2323+ * command line and merge other ATAGS info.2424+ * Also for U-Boot there must be a pre-existing /memory node.2525+ */2626+ chosen {};2727+ memory { device_type = "memory"; reg = <0 0>; };20282129 aliases {2230 ethernet0 = &fec;
+8
arch/arm/boot/dts/imx51.dtsi
···1919/ {2020 #address-cells = <1>;2121 #size-cells = <1>;2222+ /*2323+ * The decompressor and also some bootloaders rely on a2424+ * pre-existing /chosen node to be available to insert the2525+ * command line and merge other ATAGS info.2626+ * Also for U-Boot there must be a pre-existing /memory node.2727+ */2828+ chosen {};2929+ memory { device_type = "memory"; reg = <0 0>; };22302331 aliases {2432 ethernet0 = &fec;
+8
arch/arm/boot/dts/imx53.dtsi
···1919/ {2020 #address-cells = <1>;2121 #size-cells = <1>;2222+ /*2323+ * The decompressor and also some bootloaders rely on a2424+ * pre-existing /chosen node to be available to insert the2525+ * command line and merge other ATAGS info.2626+ * Also for U-Boot there must be a pre-existing /memory node.2727+ */2828+ chosen {};2929+ memory { device_type = "memory"; reg = <0 0>; };22302331 aliases {2432 ethernet0 = &fec;
···1616/ {1717 #address-cells = <1>;1818 #size-cells = <1>;1919+ /*2020+ * The decompressor and also some bootloaders rely on a2121+ * pre-existing /chosen node to be available to insert the2222+ * command line and merge other ATAGS info.2323+ * Also for U-Boot there must be a pre-existing /memory node.2424+ */2525+ chosen {};2626+ memory { device_type = "memory"; reg = <0 0>; };19272028 aliases {2129 ethernet0 = &fec;
+8
arch/arm/boot/dts/imx6sl.dtsi
···1414/ {1515 #address-cells = <1>;1616 #size-cells = <1>;1717+ /*1818+ * The decompressor and also some bootloaders rely on a1919+ * pre-existing /chosen node to be available to insert the2020+ * command line and merge other ATAGS info.2121+ * Also for U-Boot there must be a pre-existing /memory node.2222+ */2323+ chosen {};2424+ memory { device_type = "memory"; reg = <0 0>; };17251826 aliases {1927 ethernet0 = &fec;
+8
arch/arm/boot/dts/imx6sx.dtsi
···1515/ {1616 #address-cells = <1>;1717 #size-cells = <1>;1818+ /*1919+ * The decompressor and also some bootloaders rely on a2020+ * pre-existing /chosen node to be available to insert the2121+ * command line and merge other ATAGS info.2222+ * Also for U-Boot there must be a pre-existing /memory node.2323+ */2424+ chosen {};2525+ memory { device_type = "memory"; reg = <0 0>; };18261927 aliases {2028 can0 = &flexcan1;
+8
arch/arm/boot/dts/imx6ul.dtsi
···1515/ {1616 #address-cells = <1>;1717 #size-cells = <1>;1818+ /*1919+ * The decompressor and also some bootloaders rely on a2020+ * pre-existing /chosen node to be available to insert the2121+ * command line and merge other ATAGS info.2222+ * Also for U-Boot there must be a pre-existing /memory node.2323+ */2424+ chosen {};2525+ memory { device_type = "memory"; reg = <0 0>; };18261927 aliases {2028 ethernet0 = &fec1;
+8
arch/arm/boot/dts/imx7s.dtsi
···5050/ {5151 #address-cells = <1>;5252 #size-cells = <1>;5353+ /*5454+ * The decompressor and also some bootloaders rely on a5555+ * pre-existing /chosen node to be available to insert the5656+ * command line and merge other ATAGS info.5757+ * Also for U-Boot there must be a pre-existing /memory node.5858+ */5959+ chosen {};6060+ memory { device_type = "memory"; reg = <0 0>; };53615462 aliases {5563 gpio0 = &gpio1;
···22 * Device Tree file for Buffalo Linkstation LS-CHLv333 *44 * Copyright (C) 2016 Ash Hughes <ashley.hughes@blueyonder.co.uk>55- * Copyright (C) 2015, 201655+ * Copyright (C) 2015-201766 * Roger Shimizu <rogershimizu@gmail.com>77 *88 * This file is dual-licensed: you can use it either under the terms···5252#include <dt-bindings/gpio/gpio.h>53535454/ {5555- model = "Buffalo Linkstation Live v3 (LS-CHL)";5555+ model = "Buffalo Linkstation LiveV3 (LS-CHL)";5656 compatible = "buffalo,lschl", "marvell,orion5x-88f5182", "marvell,orion5x";57575858 memory { /* 128 MB */
···649649#define SRR1_ISI_N_OR_G 0x10000000 /* ISI: Access is no-exec or G */650650#define SRR1_ISI_PROT 0x08000000 /* ISI: Other protection fault */651651#define SRR1_WAKEMASK 0x00380000 /* reason for wakeup */652652-#define SRR1_WAKEMASK_P8 0x003c0000 /* reason for wakeup on POWER8 */652652+#define SRR1_WAKEMASK_P8 0x003c0000 /* reason for wakeup on POWER8 and 9 */653653#define SRR1_WAKESYSERR 0x00300000 /* System error */654654#define SRR1_WAKEEE 0x00200000 /* External interrupt */655655+#define SRR1_WAKEHVI 0x00240000 /* Hypervisor Virtualization Interrupt (P9) */655656#define SRR1_WAKEMT 0x00280000 /* mtctrl */656657#define SRR1_WAKEHMI 0x00280000 /* Hypervisor maintenance */657658#define SRR1_WAKEDEC 0x00180000 /* Decrementer interrupt */
+1
arch/powerpc/include/asm/xics.h
···44444545#ifdef CONFIG_PPC_POWERNV4646extern int icp_opal_init(void);4747+extern void icp_opal_flush_interrupt(void);4748#else4849static inline int icp_opal_init(void) { return -ENODEV; }4950#endif
+5-16
arch/powerpc/mm/fault.c
···253253 if (unlikely(debugger_fault_handler(regs)))254254 goto bail;255255256256- /* On a kernel SLB miss we can only check for a valid exception entry */257257- if (!user_mode(regs) && (address >= TASK_SIZE)) {256256+ /*257257+ * The kernel should never take an execute fault nor should it258258+ * take a page fault to a kernel address.259259+ */260260+ if (!user_mode(regs) && (is_exec || (address >= TASK_SIZE))) {258261 rc = SIGSEGV;259262 goto bail;260263 }···393390#endif /* CONFIG_8xx */394391395392 if (is_exec) {396396- /*397397- * An execution fault + no execute ?398398- *399399- * On CPUs that don't have CPU_FTR_COHERENT_ICACHE we400400- * deliberately create NX mappings, and use the fault to do the401401- * cache flush. This is usually handled in hash_page_do_lazy_icache()402402- * but we could end up here if that races with a concurrent PTE403403- * update. In that case we need to fall through here to the VMA404404- * check below.405405- */406406- if (cpu_has_feature(CPU_FTR_COHERENT_ICACHE) &&407407- (regs->msr & SRR1_ISI_N_OR_G))408408- goto bad_area;409409-410393 /*411394 * Allow execution from readable areas if the MMU does not412395 * provide separate controls over reading and executing.
+1-5
arch/powerpc/mm/tlb-radix.c
···5050 for (set = 0; set < POWER9_TLB_SETS_RADIX ; set++) {5151 __tlbiel_pid(pid, set, ric);5252 }5353- if (cpu_has_feature(CPU_FTR_POWER9_DD1))5454- asm volatile(PPC_INVALIDATE_ERAT : : :"memory");5555- return;5353+ asm volatile(PPC_INVALIDATE_ERAT "; isync" : : :"memory");5654}57555856static inline void _tlbie_pid(unsigned long pid, unsigned long ric)···8385 asm volatile(PPC_TLBIEL(%0, %4, %3, %2, %1)8486 : : "r"(rb), "i"(r), "i"(prs), "i"(ric), "r"(rs) : "memory");8587 asm volatile("ptesync": : :"memory");8686- if (cpu_has_feature(CPU_FTR_POWER9_DD1))8787- asm volatile(PPC_INVALIDATE_ERAT : : :"memory");8888}89899090static inline void _tlbie_va(unsigned long va, unsigned long pid,
+10-2
arch/powerpc/platforms/powernv/smp.c
···155155 wmask = SRR1_WAKEMASK_P8;156156157157 idle_states = pnv_get_supported_cpuidle_states();158158+158159 /* We don't want to take decrementer interrupts while we are offline,159159- * so clear LPCR:PECE1. We keep PECE2 enabled.160160+ * so clear LPCR:PECE1. We keep PECE2 (and LPCR_PECE_HVEE on P9)161161+ * enabled as to let IPIs in.160162 */161163 mtspr(SPRN_LPCR, mfspr(SPRN_LPCR) & ~(u64)LPCR_PECE1);162164···208206 * contains 0.209207 */210208 if (((srr1 & wmask) == SRR1_WAKEEE) ||209209+ ((srr1 & wmask) == SRR1_WAKEHVI) ||211210 (local_paca->irq_happened & PACA_IRQ_EE)) {212212- icp_native_flush_interrupt();211211+ if (cpu_has_feature(CPU_FTR_ARCH_300))212212+ icp_opal_flush_interrupt();213213+ else214214+ icp_native_flush_interrupt();213215 } else if ((srr1 & wmask) == SRR1_WAKEHDBELL) {214216 unsigned long msg = PPC_DBELL_TYPE(PPC_DBELL_SERVER);215217 asm volatile(PPC_MSGCLR(%0) : : "r" (msg));···227221 if (srr1 && !generic_check_cpu_restart(cpu))228222 DBG("CPU%d Unexpected exit while offline !\n", cpu);229223 }224224+225225+ /* Re-enable decrementer interrupts */230226 mtspr(SPRN_LPCR, mfspr(SPRN_LPCR) | LPCR_PECE1);231227 DBG("CPU%d coming online...\n", cpu);232228}
+33-2
arch/powerpc/sysdev/xics/icp-opal.c
···120120{121121 int hw_cpu = get_hard_smp_processor_id(cpu);122122123123+ kvmppc_set_host_ipi(cpu, 1);123124 opal_int_set_mfrr(hw_cpu, IPI_PRIORITY);124125}125126126127static irqreturn_t icp_opal_ipi_action(int irq, void *dev_id)127128{128128- int hw_cpu = hard_smp_processor_id();129129+ int cpu = smp_processor_id();129130130130- opal_int_set_mfrr(hw_cpu, 0xff);131131+ kvmppc_set_host_ipi(cpu, 0);132132+ opal_int_set_mfrr(get_hard_smp_processor_id(cpu), 0xff);131133132134 return smp_ipi_demux();135135+}136136+137137+/*138138+ * Called when an interrupt is received on an off-line CPU to139139+ * clear the interrupt, so that the CPU can go back to nap mode.140140+ */141141+void icp_opal_flush_interrupt(void)142142+{143143+ unsigned int xirr;144144+ unsigned int vec;145145+146146+ do {147147+ xirr = icp_opal_get_xirr();148148+ vec = xirr & 0x00ffffff;149149+ if (vec == XICS_IRQ_SPURIOUS)150150+ break;151151+ if (vec == XICS_IPI) {152152+ /* Clear pending IPI */153153+ int cpu = smp_processor_id();154154+ kvmppc_set_host_ipi(cpu, 0);155155+ opal_int_set_mfrr(get_hard_smp_processor_id(cpu), 0xff);156156+ } else {157157+ pr_err("XICS: hw interrupt 0x%x to offline cpu, "158158+ "disabling\n", vec);159159+ xics_mask_unknown_vec(vec);160160+ }161161+162162+ /* EOI the interrupt */163163+ } while (opal_int_eoi(xirr) > 0);133164}134165135166#endif /* CONFIG_SMP */
···213213 } else if (id == INTEL_PCH_KBP_DEVICE_ID_TYPE) {214214 dev_priv->pch_type = PCH_KBP;215215 DRM_DEBUG_KMS("Found KabyPoint PCH\n");216216- WARN_ON(!IS_KABYLAKE(dev_priv));216216+ WARN_ON(!IS_SKYLAKE(dev_priv) &&217217+ !IS_KABYLAKE(dev_priv));217218 } else if ((id == INTEL_PCH_P2X_DEVICE_ID_TYPE) ||218219 (id == INTEL_PCH_P3X_DEVICE_ID_TYPE) ||219220 ((id == INTEL_PCH_QEMU_DEVICE_ID_TYPE) &&···24282427 * we can do is to hope that things will still work (and disable RPM).24292428 */24302429 i915_gem_init_swizzling(dev_priv);24302430+ i915_gem_restore_fences(dev_priv);2431243124322432 intel_runtime_pm_enable_interrupts(dev_priv);24332433
+11-3
drivers/gpu/drm/i915/i915_gem.c
···20102010 for (i = 0; i < dev_priv->num_fence_regs; i++) {20112011 struct drm_i915_fence_reg *reg = &dev_priv->fence_regs[i];2012201220132013- if (WARN_ON(reg->pin_count))20142014- continue;20132013+ /* Ideally we want to assert that the fence register is not20142014+ * live at this point (i.e. that no piece of code will be20152015+ * trying to write through fence + GTT, as that both violates20162016+ * our tracking of activity and associated locking/barriers,20172017+ * but also is illegal given that the hw is powered down).20182018+ *20192019+ * Previously we used reg->pin_count as a "liveness" indicator.20202020+ * That is not sufficient, and we need a more fine-grained20212021+ * tool if we want to have a sanity check here.20222022+ */2015202320162024 if (!reg->vma)20172025 continue;···34863478 vma->display_alignment = max_t(u64, vma->display_alignment, alignment);3487347934883480 /* Treat this as an end-of-frame, like intel_user_framebuffer_dirty() */34893489- if (obj->cache_dirty) {34813481+ if (obj->cache_dirty || obj->base.write_domain == I915_GEM_DOMAIN_CPU) {34903482 i915_gem_clflush_object(obj, true);34913483 intel_fb_obj_flush(obj, false, ORIGIN_DIRTYFB);34923484 }
+6-6
drivers/gpu/drm/i915/i915_gem_execbuffer.c
···11811181 if (exec[i].offset !=11821182 gen8_canonical_addr(exec[i].offset & PAGE_MASK))11831183 return -EINVAL;11841184-11851185- /* From drm_mm perspective address space is continuous,11861186- * so from this point we're always using non-canonical11871187- * form internally.11881188- */11891189- exec[i].offset = gen8_noncanonical_addr(exec[i].offset);11901184 }11851185+11861186+ /* From drm_mm perspective address space is continuous,11871187+ * so from this point we're always using non-canonical11881188+ * form internally.11891189+ */11901190+ exec[i].offset = gen8_noncanonical_addr(exec[i].offset);1191119111921192 if (exec[i].alignment && !is_power_of_2(exec[i].alignment))11931193 return -EINVAL;
+10-2
drivers/gpu/drm/i915/i915_gem_internal.c
···66666767 max_order = MAX_ORDER;6868#ifdef CONFIG_SWIOTLB6969- if (swiotlb_nr_tbl()) /* minimum max swiotlb size is IO_TLB_SEGSIZE */7070- max_order = min(max_order, ilog2(IO_TLB_SEGPAGES));6969+ if (swiotlb_nr_tbl()) {7070+ unsigned int max_segment;7171+7272+ max_segment = swiotlb_max_segment();7373+ if (max_segment) {7474+ max_segment = max_t(unsigned int, max_segment,7575+ PAGE_SIZE) >> PAGE_SHIFT;7676+ max_order = min(max_order, ilog2(max_segment));7777+ }7878+ }7179#endif72807381 gfp = GFP_KERNEL | __GFP_HIGHMEM | __GFP_RECLAIMABLE;
···263263 return -EINVAL;264264 }265265266266- if (test_bit(ABS_MT_SLOT, dev->absbit)) {267267- nslot = input_abs_get_max(dev, ABS_MT_SLOT) + 1;268268- error = input_mt_init_slots(dev, nslot, 0);269269- if (error)266266+ if (test_bit(EV_ABS, dev->evbit)) {267267+ input_alloc_absinfo(dev);268268+ if (!dev->absinfo) {269269+ error = -EINVAL;270270 goto fail1;271271- } else if (test_bit(ABS_MT_POSITION_X, dev->absbit)) {272272- input_set_events_per_packet(dev, 60);271271+ }272272+273273+ if (test_bit(ABS_MT_SLOT, dev->absbit)) {274274+ nslot = input_abs_get_max(dev, ABS_MT_SLOT) + 1;275275+ error = input_mt_init_slots(dev, nslot, 0);276276+ if (error)277277+ goto fail1;278278+ } else if (test_bit(ABS_MT_POSITION_X, dev->absbit)) {279279+ input_set_events_per_packet(dev, 60);280280+ }273281 }274282275283 if (test_bit(EV_FF, dev->evbit) && !udev->ff_effects_max) {
+7-1
drivers/input/rmi4/Kconfig
···4242config RMI4_F034343 bool "RMI4 Function 03 (PS2 Guest)"4444 depends on RMI4_CORE4545- depends on SERIO=y || RMI4_CORE=SERIO4645 help4746 Say Y here if you want to add support for RMI4 function 03.48474948 Function 03 provides PS2 guest support for RMI4 devices. This5049 includes support for TrackPoints on TouchPads.5050+5151+config RMI4_F03_SERIO5252+ tristate5353+ depends on RMI4_CORE5454+ depends on RMI4_F035555+ default RMI4_CORE5656+ select SERIO51575258config RMI4_2D_SENSOR5359 bool
+25-7
drivers/mmc/host/mmci.c
···10231023 if (!host->busy_status && busy_resp &&10241024 !(status & (MCI_CMDCRCFAIL|MCI_CMDTIMEOUT)) &&10251025 (readl(base + MMCISTATUS) & host->variant->busy_detect_flag)) {10261026- /* Unmask the busy IRQ */10261026+10271027+ /* Clear the busy start IRQ */10281028+ writel(host->variant->busy_detect_mask,10291029+ host->base + MMCICLEAR);10301030+10311031+ /* Unmask the busy end IRQ */10271032 writel(readl(base + MMCIMASK0) |10281033 host->variant->busy_detect_mask,10291034 base + MMCIMASK0);···1043103810441039 /*10451040 * At this point we are not busy with a command, we have10461046- * not received a new busy request, mask the busy IRQ and10471047- * fall through to process the IRQ.10411041+ * not received a new busy request, clear and mask the busy10421042+ * end IRQ and fall through to process the IRQ.10481043 */10491044 if (host->busy_status) {10451045+10461046+ writel(host->variant->busy_detect_mask,10471047+ host->base + MMCICLEAR);10481048+10501049 writel(readl(base + MMCIMASK0) &10511050 ~host->variant->busy_detect_mask,10521051 base + MMCIMASK0);···12921283 }1293128412941285 /*12951295- * We intentionally clear the MCI_ST_CARDBUSY IRQ here (if it's12961296- * enabled) since the HW seems to be triggering the IRQ on both12971297- * edges while monitoring DAT0 for busy completion.12861286+ * We intentionally clear the MCI_ST_CARDBUSY IRQ (if it's12871287+ * enabled) in mmci_cmd_irq() function where ST Micro busy12881288+ * detection variant is handled. Considering the HW seems to be12891289+ * triggering the IRQ on both edges while monitoring DAT0 for12901290+ * busy completion and that same status bit is used to monitor12911291+ * start and end of busy detection, special care must be taken12921292+ * to make sure that both start and end interrupts are always12931293+ * cleared one after the other.12981294 */12991295 status &= readl(host->base + MMCIMASK0);13001300- writel(status, host->base + MMCICLEAR);12961296+ if (host->variant->busy_detect)12971297+ writel(status & ~host->variant->busy_detect_mask,12981298+ host->base + MMCICLEAR);12991299+ else13001300+ writel(status, host->base + MMCICLEAR);1301130113021302 dev_dbg(mmc_dev(host->mmc), "irq0 (data+cmd) %08x\n", status);13031303
+96-12
drivers/net/ethernet/cavium/thunder/thunder_bgx.c
···3131 u8 lmac_type;3232 u8 lane_to_sds;3333 bool use_training;3434+ bool autoneg;3435 bool link_up;3536 int lmacid; /* ID within BGX */3637 int lmacid_bd; /* ID on board */···462461 /* power down, reset autoneg, autoneg enable */463462 cfg = bgx_reg_read(bgx, lmacid, BGX_GMP_PCS_MRX_CTL);464463 cfg &= ~PCS_MRX_CTL_PWR_DN;465465- cfg |= (PCS_MRX_CTL_RST_AN | PCS_MRX_CTL_AN_EN);464464+ cfg |= PCS_MRX_CTL_RST_AN;465465+ if (lmac->phydev) {466466+ cfg |= PCS_MRX_CTL_AN_EN;467467+ } else {468468+ /* In scenarios where PHY driver is not present or it's a469469+ * non-standard PHY, FW sets AN_EN to inform Linux driver470470+ * to do auto-neg and link polling or not.471471+ */472472+ if (cfg & PCS_MRX_CTL_AN_EN)473473+ lmac->autoneg = true;474474+ }466475 bgx_reg_write(bgx, lmacid, BGX_GMP_PCS_MRX_CTL, cfg);467476468477 if (lmac->lmac_type == BGX_MODE_QSGMII) {···483472 return 0;484473 }485474486486- if (lmac->lmac_type == BGX_MODE_SGMII) {475475+ if ((lmac->lmac_type == BGX_MODE_SGMII) && lmac->phydev) {487476 if (bgx_poll_reg(bgx, lmacid, BGX_GMP_PCS_MRX_STATUS,488477 PCS_MRX_STATUS_AN_CPT, false)) {489478 dev_err(&bgx->pdev->dev, "BGX AN_CPT not completed\n");···689678 return -1;690679}691680681681+static void bgx_poll_for_sgmii_link(struct lmac *lmac)682682+{683683+ u64 pcs_link, an_result;684684+ u8 speed;685685+686686+ pcs_link = bgx_reg_read(lmac->bgx, lmac->lmacid,687687+ BGX_GMP_PCS_MRX_STATUS);688688+689689+ /*Link state bit is sticky, read it again*/690690+ if (!(pcs_link & PCS_MRX_STATUS_LINK))691691+ pcs_link = bgx_reg_read(lmac->bgx, lmac->lmacid,692692+ BGX_GMP_PCS_MRX_STATUS);693693+694694+ if (bgx_poll_reg(lmac->bgx, lmac->lmacid, BGX_GMP_PCS_MRX_STATUS,695695+ PCS_MRX_STATUS_AN_CPT, false)) {696696+ lmac->link_up = false;697697+ lmac->last_speed = SPEED_UNKNOWN;698698+ lmac->last_duplex = DUPLEX_UNKNOWN;699699+ goto next_poll;700700+ }701701+702702+ lmac->link_up = ((pcs_link & PCS_MRX_STATUS_LINK) != 0) ? true : false;703703+ an_result = bgx_reg_read(lmac->bgx, lmac->lmacid,704704+ BGX_GMP_PCS_ANX_AN_RESULTS);705705+706706+ speed = (an_result >> 3) & 0x3;707707+ lmac->last_duplex = (an_result >> 1) & 0x1;708708+ switch (speed) {709709+ case 0:710710+ lmac->last_speed = 10;711711+ break;712712+ case 1:713713+ lmac->last_speed = 100;714714+ break;715715+ case 2:716716+ lmac->last_speed = 1000;717717+ break;718718+ default:719719+ lmac->link_up = false;720720+ lmac->last_speed = SPEED_UNKNOWN;721721+ lmac->last_duplex = DUPLEX_UNKNOWN;722722+ break;723723+ }724724+725725+next_poll:726726+727727+ if (lmac->last_link != lmac->link_up) {728728+ if (lmac->link_up)729729+ bgx_sgmii_change_link_state(lmac);730730+ lmac->last_link = lmac->link_up;731731+ }732732+733733+ queue_delayed_work(lmac->check_link, &lmac->dwork, HZ * 3);734734+}735735+692736static void bgx_poll_for_link(struct work_struct *work)693737{694738 struct lmac *lmac;695739 u64 spu_link, smu_link;696740697741 lmac = container_of(work, struct lmac, dwork.work);742742+ if (lmac->is_sgmii) {743743+ bgx_poll_for_sgmii_link(lmac);744744+ return;745745+ }698746699747 /* Receive link is latching low. Force it high and verify it */700748 bgx_reg_modify(lmac->bgx, lmac->lmacid,···845775 (lmac->lmac_type != BGX_MODE_XLAUI) &&846776 (lmac->lmac_type != BGX_MODE_40G_KR) &&847777 (lmac->lmac_type != BGX_MODE_10G_KR)) {848848- if (!lmac->phydev)849849- return -ENODEV;850850-778778+ if (!lmac->phydev) {779779+ if (lmac->autoneg) {780780+ bgx_reg_write(bgx, lmacid,781781+ BGX_GMP_PCS_LINKX_TIMER,782782+ PCS_LINKX_TIMER_COUNT);783783+ goto poll;784784+ } else {785785+ /* Default to below link speed and duplex */786786+ lmac->link_up = true;787787+ lmac->last_speed = 1000;788788+ lmac->last_duplex = 1;789789+ bgx_sgmii_change_link_state(lmac);790790+ return 0;791791+ }792792+ }851793 lmac->phydev->dev_flags = 0;852794853795 if (phy_connect_direct(&lmac->netdev, lmac->phydev,···868786 return -ENODEV;869787870788 phy_start_aneg(lmac->phydev);871871- } else {872872- lmac->check_link = alloc_workqueue("check_link", WQ_UNBOUND |873873- WQ_MEM_RECLAIM, 1);874874- if (!lmac->check_link)875875- return -ENOMEM;876876- INIT_DELAYED_WORK(&lmac->dwork, bgx_poll_for_link);877877- queue_delayed_work(lmac->check_link, &lmac->dwork, 0);789789+ return 0;878790 }791791+792792+poll:793793+ lmac->check_link = alloc_workqueue("check_link", WQ_UNBOUND |794794+ WQ_MEM_RECLAIM, 1);795795+ if (!lmac->check_link)796796+ return -ENOMEM;797797+ INIT_DELAYED_WORK(&lmac->dwork, bgx_poll_for_link);798798+ queue_delayed_work(lmac->check_link, &lmac->dwork, 0);879799880800 return 0;881801}
···908908 struct module *ndev_owner = dev->dev.parent->driver->owner;909909 struct mii_bus *bus = phydev->mdio.bus;910910 struct device *d = &phydev->mdio.dev;911911+ bool using_genphy = false;911912 int err;912913913914 /* For Ethernet device drivers that register their own MDIO bus, we···918917 */919918 if (ndev_owner != bus->owner && !try_module_get(bus->owner)) {920919 dev_err(&dev->dev, "failed to get the bus module\n");921921- return -EIO;922922- }923923-924924- if (!try_module_get(d->driver->owner)) {925925- dev_err(&dev->dev, "failed to get the device driver module\n");926920 return -EIO;927921 }928922···934938 d->driver =935939 &genphy_driver[GENPHY_DRV_1G].mdiodrv.driver;936940941941+ using_genphy = true;942942+ }943943+944944+ if (!try_module_get(d->driver->owner)) {945945+ dev_err(&dev->dev, "failed to get the device driver module\n");946946+ err = -EIO;947947+ goto error_put_device;948948+ }949949+950950+ if (using_genphy) {937951 err = d->driver->probe(d);938952 if (err >= 0)939953 err = device_bind_driver(d);940954941955 if (err)942942- goto error;956956+ goto error_module_put;943957 }944958945959 if (phydev->attached_dev) {···986980 return err;987981988982error:983983+ /* phy_detach() does all of the cleanup below */989984 phy_detach(phydev);990990- put_device(d);985985+ return err;986986+987987+error_module_put:991988 module_put(d->driver->owner);989989+error_put_device:990990+ put_device(d);992991 if (ndev_owner != bus->owner)993992 module_put(bus->owner);994993 return err;···1056104510571046 phy_led_triggers_unregister(phydev);1058104710481048+ module_put(phydev->mdio.dev.driver->owner);10491049+10591050 /* If the device had no specific driver before (i.e. - it10601051 * was using the generic driver), we unbind the device10611052 * from the generic driver so that there's a chance a···10781065 bus = phydev->mdio.bus;1079106610801067 put_device(&phydev->mdio.dev);10811081- module_put(phydev->mdio.dev.driver->owner);10821068 if (ndev_owner != bus->owner)10831069 module_put(bus->owner);10841070}
+80-49
drivers/net/usb/sierra_net.c
···7373/* Private data structure */7474struct sierra_net_data {75757676- u8 ethr_hdr_tmpl[ETH_HLEN]; /* ethernet header template for rx'd pkts */7777-7876 u16 link_up; /* air link up or down */7977 u8 tx_hdr_template[4]; /* part of HIP hdr for tx'd packets */8078···120122121123/* LSI Protocol types */122124#define SIERRA_NET_PROTOCOL_UMTS 0x01125125+#define SIERRA_NET_PROTOCOL_UMTS_DS 0x04123126/* LSI Coverage */124127#define SIERRA_NET_COVERAGE_NONE 0x00125128#define SIERRA_NET_COVERAGE_NOPACKET 0x01···128129/* LSI Session */129130#define SIERRA_NET_SESSION_IDLE 0x00130131/* LSI Link types */131131-#define SIERRA_NET_AS_LINK_TYPE_IPv4 0x00132132+#define SIERRA_NET_AS_LINK_TYPE_IPV4 0x00133133+#define SIERRA_NET_AS_LINK_TYPE_IPV6 0x02132134133135struct lsi_umts {134136 u8 protocol;···137137 __be16 length;138138 /* eventually use a union for the rest - assume umts for now */139139 u8 coverage;140140- u8 unused2[41];140140+ u8 network_len; /* network name len */141141+ u8 network[40]; /* network name (UCS2, bigendian) */141142 u8 session_state;142143 u8 unused3[33];144144+} __packed;145145+146146+struct lsi_umts_single {147147+ struct lsi_umts lsi;143148 u8 link_type;144149 u8 pdp_addr_len; /* NW-supplied PDP address len */145150 u8 pdp_addr[16]; /* NW-supplied PDP address (bigendian)) */···163158 u8 reserved[8];164159} __packed;165160161161+struct lsi_umts_dual {162162+ struct lsi_umts lsi;163163+ u8 pdp_addr4_len; /* NW-supplied PDP IPv4 address len */164164+ u8 pdp_addr4[4]; /* NW-supplied PDP IPv4 address (bigendian)) */165165+ u8 pdp_addr6_len; /* NW-supplied PDP IPv6 address len */166166+ u8 pdp_addr6[16]; /* NW-supplied PDP IPv6 address (bigendian)) */167167+ u8 unused4[23];168168+ u8 dns1_addr4_len; /* NW-supplied 1st DNS v4 address len (bigendian) */169169+ u8 dns1_addr4[4]; /* NW-supplied 1st DNS v4 address */170170+ u8 dns1_addr6_len; /* NW-supplied 1st DNS v6 address len */171171+ u8 dns1_addr6[16]; /* NW-supplied 1st DNS v6 address (bigendian)*/172172+ u8 dns2_addr4_len; /* NW-supplied 2nd DNS v4 address len (bigendian) */173173+ u8 dns2_addr4[4]; /* NW-supplied 2nd DNS v4 address */174174+ u8 dns2_addr6_len; /* NW-supplied 2nd DNS v6 address len */175175+ u8 dns2_addr6[16]; /* NW-supplied 2nd DNS v6 address (bigendian)*/176176+ u8 unused5[68];177177+} __packed;178178+166179#define SIERRA_NET_LSI_COMMON_LEN 4167167-#define SIERRA_NET_LSI_UMTS_LEN (sizeof(struct lsi_umts))180180+#define SIERRA_NET_LSI_UMTS_LEN (sizeof(struct lsi_umts_single))168181#define SIERRA_NET_LSI_UMTS_STATUS_LEN \169182 (SIERRA_NET_LSI_UMTS_LEN - SIERRA_NET_LSI_COMMON_LEN)183183+#define SIERRA_NET_LSI_UMTS_DS_LEN (sizeof(struct lsi_umts_dual))184184+#define SIERRA_NET_LSI_UMTS_DS_STATUS_LEN \185185+ (SIERRA_NET_LSI_UMTS_DS_LEN - SIERRA_NET_LSI_COMMON_LEN)170186171187/* Forward definitions */172188static void sierra_sync_timer(unsigned long syncdata);···216190 dev->data[0] = (unsigned long)priv;217191}218192219219-/* is packet IPv4 */193193+/* is packet IPv4/IPv6 */220194static inline int is_ip(struct sk_buff *skb)221195{222222- return skb->protocol == cpu_to_be16(ETH_P_IP);196196+ return skb->protocol == cpu_to_be16(ETH_P_IP) ||197197+ skb->protocol == cpu_to_be16(ETH_P_IPV6);223198}224199225200/*···376349static int sierra_net_parse_lsi(struct usbnet *dev, char *data, int datalen)377350{378351 struct lsi_umts *lsi = (struct lsi_umts *)data;352352+ u32 expected_length;379353380380- if (datalen < sizeof(struct lsi_umts)) {381381- netdev_err(dev->net, "%s: Data length %d, exp %Zu\n",382382- __func__, datalen,383383- sizeof(struct lsi_umts));354354+ if (datalen < sizeof(struct lsi_umts_single)) {355355+ netdev_err(dev->net, "%s: Data length %d, exp >= %Zu\n",356356+ __func__, datalen, sizeof(struct lsi_umts_single));384357 return -1;385385- }386386-387387- if (lsi->length != cpu_to_be16(SIERRA_NET_LSI_UMTS_STATUS_LEN)) {388388- netdev_err(dev->net, "%s: LSI_UMTS_STATUS_LEN %d, exp %u\n",389389- __func__, be16_to_cpu(lsi->length),390390- (u32)SIERRA_NET_LSI_UMTS_STATUS_LEN);391391- return -1;392392- }393393-394394- /* Validate the protocol - only support UMTS for now */395395- if (lsi->protocol != SIERRA_NET_PROTOCOL_UMTS) {396396- netdev_err(dev->net, "Protocol unsupported, 0x%02x\n",397397- lsi->protocol);398398- return -1;399399- }400400-401401- /* Validate the link type */402402- if (lsi->link_type != SIERRA_NET_AS_LINK_TYPE_IPv4) {403403- netdev_err(dev->net, "Link type unsupported: 0x%02x\n",404404- lsi->link_type);405405- return -1;406406- }407407-408408- /* Validate the coverage */409409- if (lsi->coverage == SIERRA_NET_COVERAGE_NONE410410- || lsi->coverage == SIERRA_NET_COVERAGE_NOPACKET) {411411- netdev_err(dev->net, "No coverage, 0x%02x\n", lsi->coverage);412412- return 0;413358 }414359415360 /* Validate the session state */416361 if (lsi->session_state == SIERRA_NET_SESSION_IDLE) {417362 netdev_err(dev->net, "Session idle, 0x%02x\n",418418- lsi->session_state);363363+ lsi->session_state);364364+ return 0;365365+ }366366+367367+ /* Validate the protocol - only support UMTS for now */368368+ if (lsi->protocol == SIERRA_NET_PROTOCOL_UMTS) {369369+ struct lsi_umts_single *single = (struct lsi_umts_single *)lsi;370370+371371+ /* Validate the link type */372372+ if (single->link_type != SIERRA_NET_AS_LINK_TYPE_IPV4 &&373373+ single->link_type != SIERRA_NET_AS_LINK_TYPE_IPV6) {374374+ netdev_err(dev->net, "Link type unsupported: 0x%02x\n",375375+ single->link_type);376376+ return -1;377377+ }378378+ expected_length = SIERRA_NET_LSI_UMTS_STATUS_LEN;379379+ } else if (lsi->protocol == SIERRA_NET_PROTOCOL_UMTS_DS) {380380+ expected_length = SIERRA_NET_LSI_UMTS_DS_STATUS_LEN;381381+ } else {382382+ netdev_err(dev->net, "Protocol unsupported, 0x%02x\n",383383+ lsi->protocol);384384+ return -1;385385+ }386386+387387+ if (be16_to_cpu(lsi->length) != expected_length) {388388+ netdev_err(dev->net, "%s: LSI_UMTS_STATUS_LEN %d, exp %u\n",389389+ __func__, be16_to_cpu(lsi->length), expected_length);390390+ return -1;391391+ }392392+393393+ /* Validate the coverage */394394+ if (lsi->coverage == SIERRA_NET_COVERAGE_NONE ||395395+ lsi->coverage == SIERRA_NET_COVERAGE_NOPACKET) {396396+ netdev_err(dev->net, "No coverage, 0x%02x\n", lsi->coverage);419397 return 0;420398 }421399···684652 u8 numendpoints;685653 u16 fwattr = 0;686654 int status;687687- struct ethhdr *eth;688655 struct sierra_net_data *priv;689656 static const u8 sync_tmplate[sizeof(priv->sync_msg)] = {690657 0x00, 0x00, SIERRA_NET_HIP_MSYNC_ID, 0x00};···720689 /* change MAC addr to include, ifacenum, and to be unique */721690 dev->net->dev_addr[ETH_ALEN-2] = atomic_inc_return(&iface_counter);722691 dev->net->dev_addr[ETH_ALEN-1] = ifacenum;723723-724724- /* we will have to manufacture ethernet headers, prepare template */725725- eth = (struct ethhdr *)priv->ethr_hdr_tmpl;726726- memcpy(ð->h_dest, dev->net->dev_addr, ETH_ALEN);727727- eth->h_proto = cpu_to_be16(ETH_P_IP);728692729693 /* prepare shutdown message template */730694 memcpy(priv->shdwn_msg, shdwn_tmplate, sizeof(priv->shdwn_msg));···850824851825 skb_pull(skb, hh.hdrlen);852826853853- /* We are going to accept this packet, prepare it */854854- memcpy(skb->data, sierra_net_get_private(dev)->ethr_hdr_tmpl,855855- ETH_HLEN);827827+ /* We are going to accept this packet, prepare it.828828+ * In case protocol is IPv6, keep it, otherwise force IPv4.829829+ */830830+ skb_reset_mac_header(skb);831831+ if (eth_hdr(skb)->h_proto != cpu_to_be16(ETH_P_IPV6))832832+ eth_hdr(skb)->h_proto = cpu_to_be16(ETH_P_IP);833833+ eth_zero_addr(eth_hdr(skb)->h_source);834834+ memcpy(eth_hdr(skb)->h_dest, dev->net->dev_addr, ETH_ALEN);856835857836 /* Last packet in batch handled by usbnet */858837 if (hh.payload_len.word == skb->len)
+24-22
drivers/net/xen-netfront.c
···281281{282282 RING_IDX req_prod = queue->rx.req_prod_pvt;283283 int notify;284284+ int err = 0;284285285286 if (unlikely(!netif_carrier_ok(queue->info->netdev)))286287 return;···296295 struct xen_netif_rx_request *req;297296298297 skb = xennet_alloc_one_rx_buffer(queue);299299- if (!skb)298298+ if (!skb) {299299+ err = -ENOMEM;300300 break;301301+ }301302302303 id = xennet_rxidx(req_prod);303304···323320324321 queue->rx.req_prod_pvt = req_prod;325322326326- /* Not enough requests? Try again later. */327327- if (req_prod - queue->rx.sring->req_prod < NET_RX_SLOTS_MIN) {323323+ /* Try again later if there are not enough requests or skb allocation324324+ * failed.325325+ * Enough requests is quantified as the sum of newly created slots and326326+ * the unconsumed slots at the backend.327327+ */328328+ if (req_prod - queue->rx.rsp_cons < NET_RX_SLOTS_MIN ||329329+ unlikely(err)) {328330 mod_timer(&queue->rx_refill_timer, jiffies + (HZ/10));329331 return;330332 }···13851377 for (i = 0; i < num_queues && info->queues; ++i) {13861378 struct netfront_queue *queue = &info->queues[i];1387137913801380+ del_timer_sync(&queue->rx_refill_timer);13811381+13881382 if (queue->tx_irq && (queue->tx_irq == queue->rx_irq))13891383 unbind_from_irqhandler(queue->tx_irq, queue);13901384 if (queue->tx_irq && (queue->tx_irq != queue->rx_irq)) {···1741173117421732 if (netif_running(info->netdev))17431733 napi_disable(&queue->napi);17441744- del_timer_sync(&queue->rx_refill_timer);17451734 netif_napi_del(&queue->napi);17461735 }17471736···18291820 xennet_destroy_queues(info);1830182118311822 err = xennet_create_queues(info, &num_queues);18321832- if (err < 0)18331833- goto destroy_ring;18231823+ if (err < 0) {18241824+ xenbus_dev_fatal(dev, err, "creating queues");18251825+ kfree(info->queues);18261826+ info->queues = NULL;18271827+ goto out;18281828+ }1834182918351830 /* Create shared ring, alloc event channel -- for each queue */18361831 for (i = 0; i < num_queues; ++i) {18371832 queue = &info->queues[i];18381833 err = setup_netfront(dev, queue, feature_split_evtchn);18391839- if (err) {18401840- /* setup_netfront() will tidy up the current18411841- * queue on error, but we need to clean up18421842- * those already allocated.18431843- */18441844- if (i > 0) {18451845- rtnl_lock();18461846- netif_set_real_num_tx_queues(info->netdev, i);18471847- rtnl_unlock();18481848- goto destroy_ring;18491849- } else {18501850- goto out;18511851- }18521852- }18341834+ if (err)18351835+ goto destroy_ring;18531836 }1854183718551838again:···19311930 xenbus_transaction_end(xbt, 1);19321931 destroy_ring:19331932 xennet_disconnect_backend(info);19341934- kfree(info->queues);19351935- info->queues = NULL;19331933+ xennet_destroy_queues(info);19361934 out:19351935+ unregister_netdev(info->netdev);19361936+ xennet_free_netdev(info->netdev);19371937 return err;19381938}19391939
-6
drivers/pci/hotplug/pciehp_ctrl.c
···3131#include <linux/kernel.h>3232#include <linux/types.h>3333#include <linux/slab.h>3434-#include <linux/pm_runtime.h>3534#include <linux/pci.h>3635#include "../pci.h"3736#include "pciehp.h"···9899 pciehp_green_led_blink(p_slot);99100100101 /* Check link training status */101101- pm_runtime_get_sync(&ctrl->pcie->port->dev);102102 retval = pciehp_check_link_status(ctrl);103103 if (retval) {104104 ctrl_err(ctrl, "Failed to check link status\n");···118120 if (retval != -EEXIST)119121 goto err_exit;120122 }121121- pm_runtime_put(&ctrl->pcie->port->dev);122123123124 pciehp_green_led_on(p_slot);124125 pciehp_set_attention_status(p_slot, 0);125126 return 0;126127127128err_exit:128128- pm_runtime_put(&ctrl->pcie->port->dev);129129 set_slot_off(ctrl, p_slot);130130 return retval;131131}···137141 int retval;138142 struct controller *ctrl = p_slot->ctrl;139143140140- pm_runtime_get_sync(&ctrl->pcie->port->dev);141144 retval = pciehp_unconfigure_device(p_slot);142142- pm_runtime_put(&ctrl->pcie->port->dev);143145 if (retval)144146 return retval;145147
+10
drivers/pci/msi.c
···12061206 if (flags & PCI_IRQ_AFFINITY) {12071207 if (!affd)12081208 affd = &msi_default_affd;12091209+12101210+ if (affd->pre_vectors + affd->post_vectors > min_vecs)12111211+ return -EINVAL;12121212+12131213+ /*12141214+ * If there aren't any vectors left after applying the pre/post12151215+ * vectors don't bother with assigning affinity.12161216+ */12171217+ if (affd->pre_vectors + affd->post_vectors == min_vecs)12181218+ affd = NULL;12091219 } else {12101220 if (WARN_ON(affd))12111221 affd = NULL;
+6-6
drivers/pci/pci.c
···22412241 return false;2242224222432243 /*22442244- * Hotplug ports handled by firmware in System Management Mode22442244+ * Hotplug interrupts cannot be delivered if the link is down,22452245+ * so parents of a hotplug port must stay awake. In addition,22462246+ * hotplug ports handled by firmware in System Management Mode22452247 * may not be put into D3 by the OS (Thunderbolt on non-Macs).22482248+ * For simplicity, disallow in general for now.22462249 */22472247- if (bridge->is_hotplug_bridge && !pciehp_is_native(bridge))22502250+ if (bridge->is_hotplug_bridge)22482251 return false;2249225222502253 if (pci_bridge_d3_force)···22792276 !pci_pme_capable(dev, PCI_D3cold)) ||2280227722812278 /* If it is a bridge it must be allowed to go to D3. */22822282- !pci_power_manageable(dev) ||22832283-22842284- /* Hotplug interrupts cannot be delivered if the link is down. */22852285- dev->is_hotplug_bridge)22792279+ !pci_power_manageable(dev))2286228022872281 *d3cold_ok = false;22882282
···390390 result = VM_FAULT_LOCKED;391391 break;392392 case -ENODATA:393393+ case -EAGAIN:393394 case -EFAULT:394395 result = VM_FAULT_NOPAGE;395396 break;396397 case -ENOMEM:397398 result = VM_FAULT_OOM;398398- break;399399- case -EAGAIN:400400- result = VM_FAULT_RETRY;401399 break;402400 default:403401 result = VM_FAULT_SIGBUS;
···451451 int *post_ret)452452{453453 struct se_device *dev = cmd->se_dev;454454+ sense_reason_t ret = TCM_NO_SENSE;454455455456 /*456457 * Only set SCF_COMPARE_AND_WRITE_POST to force a response fall-through···459458 * sent to the backend driver.460459 */461460 spin_lock_irq(&cmd->t_state_lock);462462- if ((cmd->transport_state & CMD_T_SENT) && !cmd->scsi_status) {461461+ if (cmd->transport_state & CMD_T_SENT) {463462 cmd->se_cmd_flags |= SCF_COMPARE_AND_WRITE_POST;464463 *post_ret = 1;464464+465465+ if (cmd->scsi_status == SAM_STAT_CHECK_CONDITION)466466+ ret = TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE;465467 }466468 spin_unlock_irq(&cmd->t_state_lock);467469···474470 */475471 up(&dev->caw_sem);476472477477- return TCM_NO_SENSE;473473+ return ret;478474}479475480476static sense_reason_t compare_and_write_callback(struct se_cmd *cmd, bool success,
+58-28
drivers/target/target_core_transport.c
···457457{458458 struct se_node_acl *nacl = container_of(kref,459459 struct se_node_acl, acl_kref);460460+ struct se_portal_group *se_tpg = nacl->se_tpg;460461461461- complete(&nacl->acl_free_comp);462462+ if (!nacl->dynamic_stop) {463463+ complete(&nacl->acl_free_comp);464464+ return;465465+ }466466+467467+ mutex_lock(&se_tpg->acl_node_mutex);468468+ list_del(&nacl->acl_list);469469+ mutex_unlock(&se_tpg->acl_node_mutex);470470+471471+ core_tpg_wait_for_nacl_pr_ref(nacl);472472+ core_free_device_list_for_node(nacl, se_tpg);473473+ kfree(nacl);462474}463475464476void target_put_nacl(struct se_node_acl *nacl)···511499void transport_free_session(struct se_session *se_sess)512500{513501 struct se_node_acl *se_nacl = se_sess->se_node_acl;502502+514503 /*515504 * Drop the se_node_acl->nacl_kref obtained from within516505 * core_tpg_get_initiator_node_acl().517506 */518507 if (se_nacl) {508508+ struct se_portal_group *se_tpg = se_nacl->se_tpg;509509+ const struct target_core_fabric_ops *se_tfo = se_tpg->se_tpg_tfo;510510+ unsigned long flags;511511+519512 se_sess->se_node_acl = NULL;513513+514514+ /*515515+ * Also determine if we need to drop the extra ->cmd_kref if516516+ * it had been previously dynamically generated, and517517+ * the endpoint is not caching dynamic ACLs.518518+ */519519+ mutex_lock(&se_tpg->acl_node_mutex);520520+ if (se_nacl->dynamic_node_acl &&521521+ !se_tfo->tpg_check_demo_mode_cache(se_tpg)) {522522+ spin_lock_irqsave(&se_nacl->nacl_sess_lock, flags);523523+ if (list_empty(&se_nacl->acl_sess_list))524524+ se_nacl->dynamic_stop = true;525525+ spin_unlock_irqrestore(&se_nacl->nacl_sess_lock, flags);526526+527527+ if (se_nacl->dynamic_stop)528528+ list_del(&se_nacl->acl_list);529529+ }530530+ mutex_unlock(&se_tpg->acl_node_mutex);531531+532532+ if (se_nacl->dynamic_stop)533533+ target_put_nacl(se_nacl);534534+520535 target_put_nacl(se_nacl);521536 }522537 if (se_sess->sess_cmd_map) {···557518void transport_deregister_session(struct se_session *se_sess)558519{559520 struct se_portal_group *se_tpg = se_sess->se_tpg;560560- const struct target_core_fabric_ops *se_tfo;561561- struct se_node_acl *se_nacl;562521 unsigned long flags;563563- bool drop_nacl = false;564522565523 if (!se_tpg) {566524 transport_free_session(se_sess);567525 return;568526 }569569- se_tfo = se_tpg->se_tpg_tfo;570527571528 spin_lock_irqsave(&se_tpg->session_lock, flags);572529 list_del(&se_sess->sess_list);···570535 se_sess->fabric_sess_ptr = NULL;571536 spin_unlock_irqrestore(&se_tpg->session_lock, flags);572537573573- /*574574- * Determine if we need to do extra work for this initiator node's575575- * struct se_node_acl if it had been previously dynamically generated.576576- */577577- se_nacl = se_sess->se_node_acl;578578-579579- mutex_lock(&se_tpg->acl_node_mutex);580580- if (se_nacl && se_nacl->dynamic_node_acl) {581581- if (!se_tfo->tpg_check_demo_mode_cache(se_tpg)) {582582- list_del(&se_nacl->acl_list);583583- drop_nacl = true;584584- }585585- }586586- mutex_unlock(&se_tpg->acl_node_mutex);587587-588588- if (drop_nacl) {589589- core_tpg_wait_for_nacl_pr_ref(se_nacl);590590- core_free_device_list_for_node(se_nacl, se_tpg);591591- se_sess->se_node_acl = NULL;592592- kfree(se_nacl);593593- }594538 pr_debug("TARGET_CORE[%s]: Deregistered fabric_sess\n",595539 se_tpg->se_tpg_tfo->get_fabric_name());596540 /*597541 * If last kref is dropping now for an explicit NodeACL, awake sleeping598542 * ->acl_free_comp caller to wakeup configfs se_node_acl->acl_group599543 * removal context from within transport_free_session() code.544544+ *545545+ * For dynamic ACL, target_put_nacl() uses target_complete_nacl()546546+ * to release all remaining generate_node_acl=1 created ACL resources.600547 */601548602549 transport_free_session(se_sess);···31273110 spin_unlock_irqrestore(&cmd->t_state_lock, flags);31283111 goto check_stop;31293112 }31303130- cmd->t_state = TRANSPORT_ISTATE_PROCESSING;31313113 spin_unlock_irqrestore(&cmd->t_state_lock, flags);3132311431333115 cmd->se_tfo->queue_tm_rsp(cmd);···31393123 struct se_cmd *cmd)31403124{31413125 unsigned long flags;31263126+ bool aborted = false;3142312731433128 spin_lock_irqsave(&cmd->t_state_lock, flags);31443144- cmd->transport_state |= CMD_T_ACTIVE;31293129+ if (cmd->transport_state & CMD_T_ABORTED) {31303130+ aborted = true;31313131+ } else {31323132+ cmd->t_state = TRANSPORT_ISTATE_PROCESSING;31333133+ cmd->transport_state |= CMD_T_ACTIVE;31343134+ }31453135 spin_unlock_irqrestore(&cmd->t_state_lock, flags);31363136+31373137+ if (aborted) {31383138+ pr_warn_ratelimited("handle_tmr caught CMD_T_ABORTED TMR %d"31393139+ "ref_tag: %llu tag: %llu\n", cmd->se_tmr_req->function,31403140+ cmd->se_tmr_req->ref_task_tag, cmd->tag);31413141+ transport_cmd_check_stop_to_fabric(cmd);31423142+ return 0;31433143+ }3146314431473145 INIT_WORK(&cmd->work, target_tmr_work);31483146 queue_work(cmd->se_dev->tmr_wq, &cmd->work);
···12451245static long tce_iommu_take_ownership_ddw(struct tce_container *container,12461246 struct iommu_table_group *table_group)12471247{12481248+ long i, ret = 0;12491249+12481250 if (!table_group->ops->create_table || !table_group->ops->set_window ||12491251 !table_group->ops->release_ownership) {12501252 WARN_ON_ONCE(1);···1255125312561254 table_group->ops->take_ownership(table_group);1257125512561256+ /* Set all windows to the new group */12571257+ for (i = 0; i < IOMMU_TABLE_GROUP_MAX_TABLES; ++i) {12581258+ struct iommu_table *tbl = container->tables[i];12591259+12601260+ if (!tbl)12611261+ continue;12621262+12631263+ ret = table_group->ops->set_window(table_group, i, tbl);12641264+ if (ret)12651265+ goto release_exit;12661266+ }12671267+12581268 return 0;12691269+12701270+release_exit:12711271+ for (i = 0; i < IOMMU_TABLE_GROUP_MAX_TABLES; ++i)12721272+ table_group->ops->unset_window(table_group, i);12731273+12741274+ table_group->ops->release_ownership(table_group);12751275+12761276+ return ret;12591277}1260127812611279static int tce_iommu_attach_group(void *iommu_data,
+60-37
fs/nfsd/vfs.c
···332332 }333333}334334335335+static __be32336336+nfsd_get_write_access(struct svc_rqst *rqstp, struct svc_fh *fhp,337337+ struct iattr *iap)338338+{339339+ struct inode *inode = d_inode(fhp->fh_dentry);340340+ int host_err;341341+342342+ if (iap->ia_size < inode->i_size) {343343+ __be32 err;344344+345345+ err = nfsd_permission(rqstp, fhp->fh_export, fhp->fh_dentry,346346+ NFSD_MAY_TRUNC | NFSD_MAY_OWNER_OVERRIDE);347347+ if (err)348348+ return err;349349+ }350350+351351+ host_err = get_write_access(inode);352352+ if (host_err)353353+ goto out_nfserrno;354354+355355+ host_err = locks_verify_truncate(inode, NULL, iap->ia_size);356356+ if (host_err)357357+ goto out_put_write_access;358358+ return 0;359359+360360+out_put_write_access:361361+ put_write_access(inode);362362+out_nfserrno:363363+ return nfserrno(host_err);364364+}365365+335366/*336367 * Set various file attributes. After this call fhp needs an fh_put.337368 */···377346 __be32 err;378347 int host_err;379348 bool get_write_count;349349+ int size_change = 0;380350381351 if (iap->ia_valid & (ATTR_ATIME | ATTR_MTIME | ATTR_SIZE))382352 accmode |= NFSD_MAY_WRITE|NFSD_MAY_OWNER_OVERRIDE;···390358 /* Get inode */391359 err = fh_verify(rqstp, fhp, ftype, accmode);392360 if (err)393393- return err;361361+ goto out;394362 if (get_write_count) {395363 host_err = fh_want_write(fhp);396364 if (host_err)397397- goto out_host_err;365365+ return nfserrno(host_err);398366 }399367400368 dentry = fhp->fh_dentry;···405373 iap->ia_valid &= ~ATTR_MODE;406374407375 if (!iap->ia_valid)408408- return 0;376376+ goto out;409377410378 nfsd_sanitize_attrs(inode, iap);411379412412- if (check_guard && guardtime != inode->i_ctime.tv_sec)413413- return nfserr_notsync;414414-415380 /*416381 * The size case is special, it changes the file in addition to the417417- * attributes, and file systems don't expect it to be mixed with418418- * "random" attribute changes. We thus split out the size change419419- * into a separate call for vfs_truncate, and do the rest as a420420- * a separate setattr call.382382+ * attributes.421383 */422384 if (iap->ia_valid & ATTR_SIZE) {423423- struct path path = {424424- .mnt = fhp->fh_export->ex_path.mnt,425425- .dentry = dentry,426426- };427427- bool implicit_mtime = false;385385+ err = nfsd_get_write_access(rqstp, fhp, iap);386386+ if (err)387387+ goto out;388388+ size_change = 1;428389429390 /*430430- * vfs_truncate implicity updates the mtime IFF the file size431431- * actually changes. Avoid the additional seattr call below if432432- * the only other attribute that the client sends is the mtime.391391+ * RFC5661, Section 18.30.4:392392+ * Changing the size of a file with SETATTR indirectly393393+ * changes the time_modify and change attributes.394394+ *395395+ * (and similar for the older RFCs)433396 */434434- if (iap->ia_size != i_size_read(inode) &&435435- ((iap->ia_valid & ~(ATTR_SIZE | ATTR_MTIME)) == 0))436436- implicit_mtime = true;437437-438438- host_err = vfs_truncate(&path, iap->ia_size);439439- if (host_err)440440- goto out_host_err;441441-442442- iap->ia_valid &= ~ATTR_SIZE;443443- if (implicit_mtime)444444- iap->ia_valid &= ~ATTR_MTIME;445445- if (!iap->ia_valid)446446- goto done;397397+ if (iap->ia_size != i_size_read(inode))398398+ iap->ia_valid |= ATTR_MTIME;447399 }448400449401 iap->ia_valid |= ATTR_CTIME;450402403403+ if (check_guard && guardtime != inode->i_ctime.tv_sec) {404404+ err = nfserr_notsync;405405+ goto out_put_write_access;406406+ }407407+451408 fh_lock(fhp);452409 host_err = notify_change(dentry, iap, NULL);453410 fh_unlock(fhp);454454- if (host_err)455455- goto out_host_err;411411+ err = nfserrno(host_err);456412457457-done:458458- host_err = commit_metadata(fhp);459459-out_host_err:460460- return nfserrno(host_err);413413+out_put_write_access:414414+ if (size_change)415415+ put_write_access(inode);416416+ if (!err)417417+ err = nfserrno(commit_metadata(fhp));418418+out:419419+ return err;461420}462421463422#if defined(CONFIG_NFSD_V4)
+1-1
fs/pstore/ram.c
···280280 1, id, type, PSTORE_TYPE_PMSG, 0);281281282282 /* ftrace is last since it may want to dynamically allocate memory. */283283- if (!prz_ok(prz)) {283283+ if (!prz_ok(prz) && cxt->fprzs) {284284 if (!(cxt->flags & RAMOOPS_FLAG_FTRACE_PER_CPU)) {285285 prz = ramoops_get_next_prz(cxt->fprzs,286286 &cxt->ftrace_read_cnt, 1, id, type,
+1-3
include/linux/buffer_head.h
···243243{244244 if (err == 0)245245 return VM_FAULT_LOCKED;246246- if (err == -EFAULT)246246+ if (err == -EFAULT || err == -EAGAIN)247247 return VM_FAULT_NOPAGE;248248 if (err == -ENOMEM)249249 return VM_FAULT_OOM;250250- if (err == -EAGAIN)251251- return VM_FAULT_RETRY;252250 /* -ENOSPC, -EDQUOT, -EIO ... */253251 return VM_FAULT_SIGBUS;254252}
···15081508 * @max_mtu: Interface Maximum MTU value15091509 * @type: Interface hardware type15101510 * @hard_header_len: Maximum hardware header length.15111511+ * @min_header_len: Minimum hardware header length15111512 *15121513 * @needed_headroom: Extra headroom the hardware may need, but not in all15131514 * cases can this be guaranteed···17251724 unsigned int max_mtu;17261725 unsigned short type;17271726 unsigned short hard_header_len;17271727+ unsigned short min_header_len;1728172817291729 unsigned short needed_headroom;17301730 unsigned short needed_tailroom;···26902688{26912689 if (likely(len >= dev->hard_header_len))26922690 return true;26912691+ if (len < dev->min_header_len)26922692+ return false;2693269326942694 if (capable(CAP_SYS_RAWIO)) {26952695 memset(ll_header + len, 0, dev->hard_header_len - len);
+4-1
include/net/lwtunnel.h
···178178}179179static inline int lwtunnel_valid_encap_type_attr(struct nlattr *attr, int len)180180{181181- return -EOPNOTSUPP;181181+ /* return 0 since we are not walking attr looking for182182+ * RTA_ENCAP_TYPE attribute on nexthops.183183+ */184184+ return 0;182185}183186184187static inline int lwtunnel_build_state(u16 encap_type,
+1
include/target/target_core_base.h
···538538 char initiatorname[TRANSPORT_IQN_LEN];539539 /* Used to signal demo mode created ACL, disabled by default */540540 bool dynamic_node_acl;541541+ bool dynamic_stop;541542 u32 queue_depth;542543 u32 acl_index;543544 enum target_prot_type saved_prot_type;
+8-3
include/uapi/rdma/ib_user_verbs.h
···3737#define IB_USER_VERBS_H38383939#include <linux/types.h>4040-#include <rdma/ib_verbs.h>41404241/*4342 * Increment this value if any changes that break userspace ABI···547548};548549549550enum {550550- IB_USER_LEGACY_LAST_QP_ATTR_MASK = IB_QP_DEST_QPN551551+ /*552552+ * This value is equal to IB_QP_DEST_QPN.553553+ */554554+ IB_USER_LEGACY_LAST_QP_ATTR_MASK = 1ULL << 20,551555};552556553557enum {554554- IB_USER_LAST_QP_ATTR_MASK = IB_QP_RATE_LIMIT558558+ /*559559+ * This value is equal to IB_QP_RATE_LIMIT.560560+ */561561+ IB_USER_LAST_QP_ATTR_MASK = 1ULL << 25,555562};556563557564struct ib_uverbs_ex_create_qp {
···14221422 int err;14231423 unsigned long i, count = oo_objects(s->oo);1424142414251425+ /* Bailout if already initialised */14261426+ if (s->random_seq)14271427+ return 0;14281428+14251429 err = cache_random_seq_create(s, count, GFP_KERNEL);14261430 if (err) {14271431 pr_err("SLUB: Unable to initialize free list for %s\n",
+1
net/dsa/dsa2.c
···271271 if (err) {272272 dev_warn(ds->dev, "Failed to create slave %d: %d\n",273273 index, err);274274+ ds->ports[index].netdev = NULL;274275 return err;275276 }276277
···4022402240234023 if (bump_id)40244024 rt_genid_bump_ipv6(dev_net(dev));40254025+40264026+ /* Make sure that a new temporary address will be created40274027+ * before this temporary address becomes deprecated.40284028+ */40294029+ if (ifp->flags & IFA_F_TEMPORARY)40304030+ addrconf_verify_rtnl();40254031}4026403240274033static void addrconf_dad_run(struct inet6_dev *idev)
···58885888 return error;5889588958905890 /* Obtain a SID for the context, if one was specified. */58915891- if (size && str[1] && str[1] != '\n') {58915891+ if (size && str[0] && str[0] != '\n') {58925892 if (str[size-1] == '\n') {58935893 str[size-1] = 0;58945894 size--;
+1-8
sound/core/seq/seq_memory.c
···419419{420420 unsigned long flags;421421 struct snd_seq_event_cell *ptr;422422- int max_count = 5 * HZ;423422424423 if (snd_BUG_ON(!pool))425424 return -EINVAL;···431432 if (waitqueue_active(&pool->output_sleep))432433 wake_up(&pool->output_sleep);433434434434- while (atomic_read(&pool->counter) > 0) {435435- if (max_count == 0) {436436- pr_warn("ALSA: snd_seq_pool_done timeout: %d cells remain\n", atomic_read(&pool->counter));437437- break;438438- }435435+ while (atomic_read(&pool->counter) > 0)439436 schedule_timeout_uninterruptible(1);440440- max_count--;441441- }442437443438 /* release all resources */444439 spin_lock_irqsave(&pool->lock, flags);
+20-13
sound/core/seq/seq_queue.c
···181181 }182182}183183184184+static void queue_use(struct snd_seq_queue *queue, int client, int use);185185+184186/* allocate a new queue -185187 * return queue index value or negative value for error186188 */···194192 if (q == NULL)195193 return -ENOMEM;196194 q->info_flags = info_flags;195195+ queue_use(q, client, 1);197196 if (queue_list_add(q) < 0) {198197 queue_delete(q);199198 return -ENOMEM;200199 }201201- snd_seq_queue_use(q->queue, client, 1); /* use this queue */202200 return q->queue;203201}204202···504502 return result;505503}506504507507-508508-/* use or unuse this queue -509509- * if it is the first client, starts the timer.510510- * if it is not longer used by any clients, stop the timer.511511- */512512-int snd_seq_queue_use(int queueid, int client, int use)505505+/* use or unuse this queue */506506+static void queue_use(struct snd_seq_queue *queue, int client, int use)513507{514514- struct snd_seq_queue *queue;515515-516516- queue = queueptr(queueid);517517- if (queue == NULL)518518- return -EINVAL;519519- mutex_lock(&queue->timer_mutex);520508 if (use) {521509 if (!test_and_set_bit(client, queue->clients_bitmap))522510 queue->clients++;···521529 } else {522530 snd_seq_timer_close(queue);523531 }532532+}533533+534534+/* use or unuse this queue -535535+ * if it is the first client, starts the timer.536536+ * if it is not longer used by any clients, stop the timer.537537+ */538538+int snd_seq_queue_use(int queueid, int client, int use)539539+{540540+ struct snd_seq_queue *queue;541541+542542+ queue = queueptr(queueid);543543+ if (queue == NULL)544544+ return -EINVAL;545545+ mutex_lock(&queue->timer_mutex);546546+ queue_use(queue, client, use);524547 mutex_unlock(&queue->timer_mutex);525548 queuefree(queue);526549 return 0;