···35353636 NOTE: this only applies to the SMMU itself, not3737 masters connected upstream of the SMMU.3838+3939+- hisilicon,broken-prefetch-cmd4040+ : Avoid sending CMD_PREFETCH_* commands to the SMMU.
···1717 "fsl,imx6sx-usdhc"18181919Optional properties:2020-- fsl,cd-controller : Indicate to use controller internal card detection2120- fsl,wp-controller : Indicate to use controller internal write protection2221- fsl,delay-line : Specify the number of delay cells for override mode.2322 This is used to set the clock delay for DLL(Delay Line) on override mode···3435 compatible = "fsl,imx51-esdhc";3536 reg = <0x70004000 0x4000>;3637 interrupts = <1>;3737- fsl,cd-controller;3838 fsl,wp-controller;3939};4040
+15-1
MAINTAINERS
···58995899F: Documentation/s390/kvm.txt59005900F: arch/s390/include/asm/kvm*59015901F: arch/s390/kvm/59025902-F: drivers/s390/kvm/5903590259045903KERNEL VIRTUAL MACHINE (KVM) FOR ARM59055904M: Christoffer Dall <christoffer.dall@linaro.org>···68376838T: git git://linuxtv.org/anttip/media_tree.git68386839S: Maintained68396840F: drivers/media/usb/msi2500/68416841+68426842+MSYSTEMS DISKONCHIP G3 MTD DRIVER68436843+M: Robert Jarzmik <robert.jarzmik@free.fr>68446844+L: linux-mtd@lists.infradead.org68456845+S: Maintained68466846+F: drivers/mtd/devices/docg3*6840684768416848MT9M032 APTINA SENSOR DRIVER68426849M: Laurent Pinchart <laurent.pinchart@ideasonboard.com>···1090010895F: drivers/block/virtio_blk.c1090110896F: include/linux/virtio_*.h1090210897F: include/uapi/linux/virtio_*.h1089810898+1089910899+VIRTIO DRIVERS FOR S3901090010900+M: Christian Borntraeger <borntraeger@de.ibm.com>1090110901+M: Cornelia Huck <cornelia.huck@de.ibm.com>1090210902+L: linux-s390@vger.kernel.org1090310903+L: virtualization@lists.linux-foundation.org1090410904+L: kvm@vger.kernel.org1090510905+S: Supported1090610906+F: drivers/s390/virtio/10903109071090410908VIRTIO GPU DRIVER1090510909M: David Airlie <airlied@linux.ie>
···178178 */179179ENTRY(__switch_to)180180 stmg %r6,%r15,__SF_GPRS(%r15) # store gprs of prev task181181- stg %r15,__THREAD_ksp(%r2) # store kernel stack of prev182182- lg %r4,__THREAD_info(%r2) # get thread_info of prev183183- lg %r5,__THREAD_info(%r3) # get thread_info of next181181+ lgr %r1,%r2182182+ aghi %r1,__TASK_thread # thread_struct of prev task183183+ lg %r4,__TASK_thread_info(%r2) # get thread_info of prev184184+ lg %r5,__TASK_thread_info(%r3) # get thread_info of next185185+ stg %r15,__THREAD_ksp(%r1) # store kernel stack of prev186186+ lgr %r1,%r3187187+ aghi %r1,__TASK_thread # thread_struct of next task184188 lgr %r15,%r5185189 aghi %r15,STACK_INIT # end of kernel stack of next186190 stg %r3,__LC_CURRENT # store task struct of next187191 stg %r5,__LC_THREAD_INFO # store thread info of next188192 stg %r15,__LC_KERNEL_STACK # store end of kernel stack193193+ lg %r15,__THREAD_ksp(%r1) # load kernel stack of next189194 lctl %c4,%c4,__TASK_pid(%r3) # load pid to control reg. 4190195 mvc __LC_CURRENT_PID+4(4,%r0),__TASK_pid(%r3) # store pid of next191191- lg %r15,__THREAD_ksp(%r3) # load kernel stack of next192196 lmg %r6,%r15,__SF_GPRS(%r15) # load gprs of next task193197 br %r14194198···421417 LAST_BREAK %r14422418 lg %r15,__LC_KERNEL_STACK423419 lg %r14,__TI_task(%r12)420420+ aghi %r14,__TASK_thread # pointer to thread_struct424421 lghi %r13,__LC_PGM_TDB425422 tm __LC_PGM_ILC+2,0x02 # check for transaction abort426423 jz 2f
···1139113911401140void __init free_initrd_mem(unsigned long begin, unsigned long end)11411141{11421142- free_bootmem(__pa(begin), end - begin);11421142+ free_bootmem_late(__pa(begin), end - begin);11431143}1144114411451145static int __init setup_initrd(char *str)
···952952 return 0;953953954954 /*955955+ * Getting up-to-date values requires an SMP IPI which is not956956+ * possible if we're being called in interrupt context. Return957957+ * the cached values instead.958958+ */959959+ if (unlikely(in_interrupt()))960960+ goto out;961961+962962+ /*955963 * Notice that we don't perform the reading of an RMID956964 * atomically, because we can't hold a spin lock across the957965 * IPIs.
···15951595 for (i = 0; i < APIC_LVT_NUM; i++)15961596 apic_set_reg(apic, APIC_LVTT + 0x10 * i, APIC_LVT_MASKED);15971597 apic_update_lvtt(apic);15981598- if (!(vcpu->kvm->arch.disabled_quirks & KVM_QUIRK_LINT0_REENABLED))15981598+ if (kvm_check_has_quirk(vcpu->kvm, KVM_X86_QUIRK_LINT0_REENABLED))15991599 apic_set_reg(apic, APIC_LVT0,16001600 SET_APIC_DELIVERY_MODE(0, APIC_MODE_EXTINT));16011601 apic_manage_nmi_watchdog(apic, kvm_apic_get_reg(apic, APIC_LVT0));
+30-10
arch/x86/kvm/mtrr.c
···120120 return mtrr_state->deftype & IA32_MTRR_DEF_TYPE_TYPE_MASK;121121}122122123123+static u8 mtrr_disabled_type(void)124124+{125125+ /*126126+ * Intel SDM 11.11.2.2: all MTRRs are disabled when127127+ * IA32_MTRR_DEF_TYPE.E bit is cleared, and the UC128128+ * memory type is applied to all of physical memory.129129+ */130130+ return MTRR_TYPE_UNCACHABLE;131131+}132132+123133/*124134* Three terms are used in the following code:125135* - segment, it indicates the address segments covered by fixed MTRRs.···444434445435 /* output fields. */446436 int mem_type;437437+ /* mtrr is completely disabled? */438438+ bool mtrr_disabled;447439 /* [start, end) is not fully covered in MTRRs? */448440 bool partial_map;449441···561549static void mtrr_lookup_start(struct mtrr_iter *iter)562550{563551 if (!mtrr_is_enabled(iter->mtrr_state)) {564564- iter->partial_map = true;552552+ iter->mtrr_disabled = true;565553 return;566554 }567555···575563 iter->mtrr_state = mtrr_state;576564 iter->start = start;577565 iter->end = end;566566+ iter->mtrr_disabled = false;578567 iter->partial_map = false;579568 iter->fixed = false;580569 iter->range = NULL;···669656 return MTRR_TYPE_WRBACK;670657 }671658672672- /* It is not covered by MTRRs. */673673- if (iter.partial_map) {674674- /*675675- * We just check one page, partially covered by MTRRs is676676- * impossible.677677- */678678- WARN_ON(type != -1);679679- type = mtrr_default_type(mtrr_state);680680- }659659+ if (iter.mtrr_disabled)660660+ return mtrr_disabled_type();661661+662662+ /*663663+ * We just check one page, partially covered by MTRRs is664664+ * impossible.665665+ */666666+ WARN_ON(iter.partial_map);667667+668668+ /* not contained in any MTRRs. */669669+ if (type == -1)670670+ return mtrr_default_type(mtrr_state);671671+681672 return type;682673}683674EXPORT_SYMBOL_GPL(kvm_mtrr_get_guest_memory_type);···705688 if (type != iter.mem_type)706689 return false;707690 }691691+692692+ if (iter.mtrr_disabled)693693+ return true;708694709695 if (!iter.partial_map)710696 return true;
+1-1
arch/x86/kvm/svm.c
···16721672 * does not do it - this results in some delay at16731673 * reboot16741674 */16751675- if (!(vcpu->kvm->arch.disabled_quirks & KVM_QUIRK_CD_NW_CLEARED))16751675+ if (kvm_check_has_quirk(vcpu->kvm, KVM_X86_QUIRK_CD_NW_CLEARED))16761676 cr0 &= ~(X86_CR0_CD | X86_CR0_NW);16771677 svm->vmcb->save.cr0 = cr0;16781678 mark_dirty(svm->vmcb, VMCB_CR);
···2020#define CREATE_TRACE_POINTS2121#include <asm/trace/mpx.h>22222323-static const char *mpx_mapping_name(struct vm_area_struct *vma)2424-{2525- return "[mpx]";2626-}2727-2828-static struct vm_operations_struct mpx_vma_ops = {2929- .name = mpx_mapping_name,3030-};3131-3232-static int is_mpx_vma(struct vm_area_struct *vma)3333-{3434- return (vma->vm_ops == &mpx_vma_ops);3535-}3636-3723static inline unsigned long mpx_bd_size_bytes(struct mm_struct *mm)3824{3925 if (is_64bit_mm(mm))···3953/*4054 * This is really a simplified "vm_mmap". it only handles MPX4155 * bounds tables (the bounds directory is user-allocated).4242- *4343- * Later on, we use the vma->vm_ops to uniquely identify these4444- * VMAs.4556 */4657static unsigned long mpx_mmap(unsigned long len)4758{···84101 ret = -ENOMEM;85102 goto out;86103 }8787- vma->vm_ops = &mpx_vma_ops;8810489105 if (vm_flags & VM_LOCKED) {90106 up_write(&mm->mmap_sem);···794812 * so stop immediately and return an error. This795813 * probably results in a SIGSEGV.796814 */797797- if (!is_mpx_vma(vma))815815+ if (!(vma->vm_flags & VM_MPX))798816 return -EINVAL;799817800818 len = min(vma->vm_end, end) - addr;···927945 * lots of tables even though we have no actual table928946 * entries in use.929947 */930930- while (next && is_mpx_vma(next))948948+ while (next && (next->vm_flags & VM_MPX))931949 next = next->vm_next;932932- while (prev && is_mpx_vma(prev))950950+ while (prev && (prev->vm_flags & VM_MPX))933951 prev = prev->vm_prev;934952 /*935953 * We know 'start' and 'end' lie within an area controlled
+1-1
arch/x86/mm/tlb.c
···117117 } else {118118 unsigned long addr;119119 unsigned long nr_pages =120120- f->flush_end - f->flush_start / PAGE_SIZE;120120+ (f->flush_end - f->flush_start) / PAGE_SIZE;121121 addr = f->flush_start;122122 while (addr < f->flush_end) {123123 __flush_tlb_single(addr);
+14-3
block/bio.c
···18311831 * Allocates and returns a new bio which represents @sectors from the start of18321832 * @bio, and updates @bio to represent the remaining sectors.18331833 *18341834- * The newly allocated bio will point to @bio's bi_io_vec; it is the caller's18351835- * responsibility to ensure that @bio is not freed before the split.18341834+ * Unless this is a discard request the newly allocated bio will point18351835+ * to @bio's bi_io_vec; it is the caller's responsibility to ensure that18361836+ * @bio is not freed before the split.18361837 */18371838struct bio *bio_split(struct bio *bio, int sectors,18381839 gfp_t gfp, struct bio_set *bs)···18431842 BUG_ON(sectors <= 0);18441843 BUG_ON(sectors >= bio_sectors(bio));1845184418461846- split = bio_clone_fast(bio, gfp, bs);18451845+ /*18461846+ * Discards need a mutable bio_vec to accommodate the payload18471847+ * required by the DSM TRIM and UNMAP commands.18481848+ */18491849+ if (bio->bi_rw & REQ_DISCARD)18501850+ split = bio_clone_bioset(bio, gfp, bs);18511851+ else18521852+ split = bio_clone_fast(bio, gfp, bs);18531853+18471854 if (!split)18481855 return NULL;18491856···20182009 bio->bi_css = blkcg_css;20192010 return 0;20202011}20122012+EXPORT_SYMBOL_GPL(bio_associate_blkcg);2021201320222014/**20232015 * bio_associate_current - associate a bio with %current···20492039 bio->bi_css = task_get_css(current, blkio_cgrp_id);20502040 return 0;20512041}20422042+EXPORT_SYMBOL_GPL(bio_associate_current);2052204320532044/**20542045 * bio_disassociate_task - undo bio_associate_current()
+5-1
block/blk-cgroup.c
···718718 return -EINVAL;719719720720 disk = get_gendisk(MKDEV(major, minor), &part);721721- if (!disk || part)721721+ if (!disk)722722 return -EINVAL;723723+ if (part) {724724+ put_disk(disk);725725+ return -EINVAL;726726+ }723727724728 rcu_read_lock();725729 spin_lock_irq(disk->queue->queue_lock);
+18-3
drivers/ata/libata-core.c
···24782478 dev->max_sectors = min_t(unsigned int, ATA_MAX_SECTORS_128,24792479 dev->max_sectors);2480248024812481+ if (dev->horkage & ATA_HORKAGE_MAX_SEC_1024)24822482+ dev->max_sectors = min_t(unsigned int, ATA_MAX_SECTORS_1024,24832483+ dev->max_sectors);24842484+24812485 if (dev->horkage & ATA_HORKAGE_MAX_SEC_LBA48)24822486 dev->max_sectors = ATA_MAX_SECTORS_LBA48;24832487···41504146 { "Slimtype DVD A DS8A8SH", NULL, ATA_HORKAGE_MAX_SEC_LBA48 },41514147 { "Slimtype DVD A DS8A9SH", NULL, ATA_HORKAGE_MAX_SEC_LBA48 },4152414841494149+ /*41504150+ * Causes silent data corruption with higher max sects.41514151+ * http://lkml.kernel.org/g/x49wpy40ysk.fsf@segfault.boston.devel.redhat.com41524152+ */41534153+ { "ST380013AS", "3.20", ATA_HORKAGE_MAX_SEC_1024 },41544154+41534155 /* Devices we expect to fail diagnostics */4154415641554157 /* Devices where NCQ should be avoided */···41844174 { "ST3320[68]13AS", "SD1[5-9]", ATA_HORKAGE_NONCQ |41854175 ATA_HORKAGE_FIRMWARE_WARN },4186417641874187- /* Seagate Momentus SpinPoint M8 seem to have FPMDA_AA issues */41774177+ /* drives which fail FPDMA_AA activation (some may freeze afterwards) */41884178 { "ST1000LM024 HN-M101MBB", "2AR10001", ATA_HORKAGE_BROKEN_FPDMA_AA },41894179 { "ST1000LM024 HN-M101MBB", "2BA30001", ATA_HORKAGE_BROKEN_FPDMA_AA },41804180+ { "VB0250EAVER", "HPG7", ATA_HORKAGE_BROKEN_FPDMA_AA },4190418141914182 /* Blacklist entries taken from Silicon Image 3124/313241924183 Windows driver .inf file - also several Linux problem reports */···42404229 ATA_HORKAGE_ZERO_AFTER_TRIM, },42414230 { "Crucial_CT*M500*", NULL, ATA_HORKAGE_NO_NCQ_TRIM |42424231 ATA_HORKAGE_ZERO_AFTER_TRIM, },42434243- { "Micron_M5[15]0*", "MU01", ATA_HORKAGE_NO_NCQ_TRIM |42324232+ { "Micron_M5[15]0_*", "MU01", ATA_HORKAGE_NO_NCQ_TRIM |42444233 ATA_HORKAGE_ZERO_AFTER_TRIM, },42454234 { "Crucial_CT*M550*", "MU01", ATA_HORKAGE_NO_NCQ_TRIM |42464235 ATA_HORKAGE_ZERO_AFTER_TRIM, },···42484237 ATA_HORKAGE_ZERO_AFTER_TRIM, },42494238 { "Samsung SSD 8*", NULL, ATA_HORKAGE_NO_NCQ_TRIM |42504239 ATA_HORKAGE_ZERO_AFTER_TRIM, },42404240+42414241+ /* devices that don't properly handle TRIM commands */42424242+ { "SuperSSpeed S238*", NULL, ATA_HORKAGE_NOTRIM, },4251424342524244 /*42534245 * As defined, the DRAT (Deterministic Read After Trim) and RZAT···45154501 else /* In the ancient relic department - skip all of this */45164502 return 0;4517450345184518- err_mask = ata_exec_internal(dev, &tf, NULL, DMA_NONE, NULL, 0, 0);45044504+ /* On some disks, this command causes spin-up, so we need longer timeout */45054505+ err_mask = ata_exec_internal(dev, &tf, NULL, DMA_NONE, NULL, 0, 15000);4519450645204507 DPRINTK("EXIT, err_mask=%x\n", err_mask);45214508 return err_mask;
+7
drivers/ata/libata-pmp.c
···460460 ATA_LFLAG_NO_SRST |461461 ATA_LFLAG_ASSUME_ATA;462462 }463463+ } else if (vendor == 0x11ab && devid == 0x4140) {464464+ /* Marvell 4140 quirks */465465+ ata_for_each_link(link, ap, EDGE) {466466+ /* port 4 is for SEMB device and it doesn't like SRST */467467+ if (link->pmp == 4)468468+ link->flags |= ATA_LFLAG_DISABLED;469469+ }463470 }464471}465472
+2-1
drivers/ata/libata-scsi.c
···25682568 rbuf[14] = (lowest_aligned >> 8) & 0x3f;25692569 rbuf[15] = lowest_aligned;2570257025712571- if (ata_id_has_trim(args->id)) {25712571+ if (ata_id_has_trim(args->id) &&25722572+ !(dev->horkage & ATA_HORKAGE_NOTRIM)) {25722573 rbuf[14] |= 0x80; /* LBPME */2573257425742575 if (ata_id_has_zero_after_trim(args->id) &&
+2
drivers/ata/libata-transport.c
···569569570570 if (!ata_id_has_trim(ata_dev->id))571571 mode = "unsupported";572572+ else if (ata_dev->horkage & ATA_HORKAGE_NOTRIM)573573+ mode = "forced_unsupported";572574 else if (ata_dev->horkage & ATA_HORKAGE_NO_NCQ_TRIM)573575 mode = "forced_unqueued";574576 else if (ata_fpdma_dsm_supported(ata_dev))
+9-9
drivers/block/null_blk.c
···240240 while ((entry = llist_del_all(&cq->list)) != NULL) {241241 entry = llist_reverse_order(entry);242242 do {243243+ struct request_queue *q = NULL;244244+243245 cmd = container_of(entry, struct nullb_cmd, ll_list);244246 entry = entry->next;247247+ if (cmd->rq)248248+ q = cmd->rq->q;245249 end_cmd(cmd);246250247247- if (cmd->rq) {248248- struct request_queue *q = cmd->rq->q;249249-250250- if (!q->mq_ops && blk_queue_stopped(q)) {251251- spin_lock(q->queue_lock);252252- if (blk_queue_stopped(q))253253- blk_start_queue(q);254254- spin_unlock(q->queue_lock);255255- }251251+ if (q && !q->mq_ops && blk_queue_stopped(q)) {252252+ spin_lock(q->queue_lock);253253+ if (blk_queue_stopped(q))254254+ blk_start_queue(q);255255+ spin_unlock(q->queue_lock);256256 }257257 } while (entry);258258 }
+5-6
drivers/bluetooth/btbcm.c
···472472473473 /* Read Verbose Config Version Info */474474 skb = btbcm_read_verbose_config(hdev);475475- if (IS_ERR(skb))476476- return PTR_ERR(skb);477477-478478- BT_INFO("%s: BCM: chip id %u build %4.4u", hdev->name, skb->data[1],479479- get_unaligned_le16(skb->data + 5));480480- kfree_skb(skb);475475+ if (!IS_ERR(skb)) {476476+ BT_INFO("%s: BCM: chip id %u build %4.4u", hdev->name, skb->data[1],477477+ get_unaligned_le16(skb->data + 5));478478+ kfree_skb(skb);479479+ }481480482481 set_bit(HCI_QUIRK_STRICT_DUPLICATE_FILTER, &hdev->quirks);483482
+12-3
drivers/firmware/efi/cper.c
···305305 return ret;306306}307307308308-static void cper_print_mem(const char *pfx, const struct cper_sec_mem_err *mem)308308+static void cper_print_mem(const char *pfx, const struct cper_sec_mem_err *mem,309309+ int len)309310{310311 struct cper_mem_err_compact cmem;311312313313+ /* Don't trust UEFI 2.1/2.2 structure with bad validation bits */314314+ if (len == sizeof(struct cper_sec_mem_err_old) &&315315+ (mem->validation_bits & ~(CPER_MEM_VALID_RANK_NUMBER - 1))) {316316+ pr_err(FW_WARN "valid bits set for fields beyond structure\n");317317+ return;318318+ }312319 if (mem->validation_bits & CPER_MEM_VALID_ERROR_STATUS)313320 printk("%s""error_status: 0x%016llx\n", pfx, mem->error_status);314321 if (mem->validation_bits & CPER_MEM_VALID_PA)···412405 } else if (!uuid_le_cmp(*sec_type, CPER_SEC_PLATFORM_MEM)) {413406 struct cper_sec_mem_err *mem_err = (void *)(gdata + 1);414407 printk("%s""section_type: memory error\n", newpfx);415415- if (gdata->error_data_length >= sizeof(*mem_err))416416- cper_print_mem(newpfx, mem_err);408408+ if (gdata->error_data_length >=409409+ sizeof(struct cper_sec_mem_err_old))410410+ cper_print_mem(newpfx, mem_err,411411+ gdata->error_data_length);417412 else418413 goto err_section_too_small;419414 } else if (!uuid_le_cmp(*sec_type, CPER_SEC_PCIE)) {
···356356 struct cp2112_force_read_report report;357357 int ret;358358359359+ if (size > sizeof(dev->read_data))360360+ size = sizeof(dev->read_data);359361 report.report = CP2112_DATA_READ_FORCE_SEND;360362 report.length = cpu_to_be16(size);361363
+7
drivers/hid/hid-multitouch.c
···778778 /*779779 * some egalax touchscreens have "application == HID_DG_TOUCHSCREEN"780780 * for the stylus.781781+ * The check for mt_report_id ensures we don't process782782+ * HID_DG_CONTACTCOUNT from the pen report as it is outside the physical783783+ * collection, but within the report ID.781784 */782785 if (field->physical == HID_DG_STYLUS)786786+ return 0;787787+ else if ((field->physical == 0) &&788788+ (field->report->id != td->mt_report_id) &&789789+ (td->mt_report_id != -1))783790 return 0;784791785792 if (field->application == HID_DG_TOUCHSCREEN ||
···1830183018311831static void domain_exit(struct dmar_domain *domain)18321832{18331833+ struct dmar_drhd_unit *drhd;18341834+ struct intel_iommu *iommu;18331835 struct page *freelist = NULL;18341834- int i;1835183618361837 /* Domain 0 is reserved, so dont process it */18371838 if (!domain)···1852185118531852 /* clear attached or cached domains */18541853 rcu_read_lock();18551855- for_each_set_bit(i, domain->iommu_bmp, g_num_of_iommus)18561856- iommu_detach_domain(domain, g_iommus[i]);18541854+ for_each_active_iommu(iommu, drhd)18551855+ if (domain_type_is_vm(domain) ||18561856+ test_bit(iommu->seq_id, domain->iommu_bmp))18571857+ iommu_detach_domain(domain, iommu);18571858 rcu_read_unlock();1858185918591860 dma_free_pagelist(freelist);
+10-25
drivers/isdn/gigaset/ser-gigaset.c
···524524 cs->hw.ser->tty = tty;525525 atomic_set(&cs->hw.ser->refcnt, 1);526526 init_completion(&cs->hw.ser->dead_cmp);527527-528527 tty->disc_data = cs;528528+529529+ /* Set the amount of data we're willing to receive per call530530+ * from the hardware driver to half of the input buffer size531531+ * to leave some reserve.532532+ * Note: We don't do flow control towards the hardware driver.533533+ * If more data is received than will fit into the input buffer,534534+ * it will be dropped and an error will be logged. This should535535+ * never happen as the device is slow and the buffer size ample.536536+ */537537+ tty->receive_room = RBUFSIZE/2;529538530539 /* OK.. Initialization of the datastructures and the HW is done.. Now531540 * startup system and notify the LL that we are ready to run···604595{605596 gigaset_tty_close(tty);606597 return 0;607607-}608608-609609-/*610610- * Read on the tty.611611- * Unused, received data goes only to the Gigaset driver.612612- */613613-static ssize_t614614-gigaset_tty_read(struct tty_struct *tty, struct file *file,615615- unsigned char __user *buf, size_t count)616616-{617617- return -EAGAIN;618618-}619619-620620-/*621621- * Write on the tty.622622- * Unused, transmit data comes only from the Gigaset driver.623623- */624624-static ssize_t625625-gigaset_tty_write(struct tty_struct *tty, struct file *file,626626- const unsigned char *buf, size_t count)627627-{628628- return -EAGAIN;629598}630599631600/*···739752 .open = gigaset_tty_open,740753 .close = gigaset_tty_close,741754 .hangup = gigaset_tty_hangup,742742- .read = gigaset_tty_read,743743- .write = gigaset_tty_write,744755 .ioctl = gigaset_tty_ioctl,745756 .receive_buf = gigaset_tty_receive,746757 .write_wakeup = gigaset_tty_wakeup,
+17-11
drivers/md/bitmap.c
···494494 bitmap_super_t *sb;495495 unsigned long chunksize, daemon_sleep, write_behind;496496497497- bitmap->storage.sb_page = alloc_page(GFP_KERNEL);497497+ bitmap->storage.sb_page = alloc_page(GFP_KERNEL | __GFP_ZERO);498498 if (bitmap->storage.sb_page == NULL)499499 return -ENOMEM;500500 bitmap->storage.sb_page->index = 0;···541541 sb->state = cpu_to_le32(bitmap->flags);542542 bitmap->events_cleared = bitmap->mddev->events;543543 sb->events_cleared = cpu_to_le64(bitmap->mddev->events);544544+ bitmap->mddev->bitmap_info.nodes = 0;544545545546 kunmap_atomic(sb);546547···559558 unsigned long sectors_reserved = 0;560559 int err = -EINVAL;561560 struct page *sb_page;561561+ loff_t offset = bitmap->mddev->bitmap_info.offset;562562563563 if (!bitmap->storage.file && !bitmap->mddev->bitmap_info.offset) {564564 chunksize = 128 * 1024 * 1024;···586584 bm_blocks = ((bm_blocks+7) >> 3) + sizeof(bitmap_super_t);587585 /* to 4k blocks */588586 bm_blocks = DIV_ROUND_UP_SECTOR_T(bm_blocks, 4096);589589- bitmap->mddev->bitmap_info.offset += bitmap->cluster_slot * (bm_blocks << 3);587587+ offset = bitmap->mddev->bitmap_info.offset + (bitmap->cluster_slot * (bm_blocks << 3));590588 pr_info("%s:%d bm slot: %d offset: %llu\n", __func__, __LINE__,591591- bitmap->cluster_slot, (unsigned long long)bitmap->mddev->bitmap_info.offset);589589+ bitmap->cluster_slot, offset);592590 }593591594592 if (bitmap->storage.file) {···599597 bitmap, bytes, sb_page);600598 } else {601599 err = read_sb_page(bitmap->mddev,602602- bitmap->mddev->bitmap_info.offset,600600+ offset,603601 sb_page,604602 0, sizeof(bitmap_super_t));605603 }···613611 daemon_sleep = le32_to_cpu(sb->daemon_sleep) * HZ;614612 write_behind = le32_to_cpu(sb->write_behind);615613 sectors_reserved = le32_to_cpu(sb->sectors_reserved);616616- nodes = le32_to_cpu(sb->nodes);617617- strlcpy(bitmap->mddev->bitmap_info.cluster_name, sb->cluster_name, 64);614614+ /* XXX: This is a hack to ensure that we don't use clustering615615+ * in case:616616+ * - dm-raid is in use and617617+ * - the nodes written in bitmap_sb is erroneous.618618+ */619619+ if (!bitmap->mddev->sync_super) {620620+ nodes = le32_to_cpu(sb->nodes);621621+ strlcpy(bitmap->mddev->bitmap_info.cluster_name,622622+ sb->cluster_name, 64);623623+ }618624619625 /* verify that the bitmap-specific fields are valid */620626 if (sb->magic != cpu_to_le32(BITMAP_MAGIC))···681671 kunmap_atomic(sb);682672 /* Assiging chunksize is required for "re_read" */683673 bitmap->mddev->bitmap_info.chunksize = chunksize;684684- if (nodes && (bitmap->cluster_slot < 0)) {674674+ if (err == 0 && nodes && (bitmap->cluster_slot < 0)) {685675 err = md_setup_cluster(bitmap->mddev, nodes);686676 if (err) {687677 pr_err("%s: Could not setup cluster service (%d)\n",···1875186518761866 if (IS_ERR(bitmap))18771867 return PTR_ERR(bitmap);18781878-18791879- rv = bitmap_read_sb(bitmap);18801880- if (rv)18811881- goto err;1882186818831869 rv = bitmap_init_from_disk(bitmap, 0);18841870 if (rv)
···21622162 if (!sc)21632163 return -ENOMEM;2164216421652165+ /* Need to ensure auto-resizing doesn't interfere */21662166+ mutex_lock(&conf->cache_size_mutex);21672167+21652168 for (i = conf->max_nr_stripes; i; i--) {21662169 nsh = alloc_stripe(sc, GFP_KERNEL);21672170 if (!nsh)···21812178 kmem_cache_free(sc, nsh);21822179 }21832180 kmem_cache_destroy(sc);21812181+ mutex_unlock(&conf->cache_size_mutex);21842182 return -ENOMEM;21852183 }21862184 /* Step 2 - Must use GFP_NOIO now.···22282224 } else22292225 err = -ENOMEM;2230222622272227+ mutex_unlock(&conf->cache_size_mutex);22312228 /* Step 4, return new stripes to service */22322229 while(!list_empty(&newstripes)) {22332230 nsh = list_entry(newstripes.next, struct stripe_head, lru);···40664061 &first_bad, &bad_sectors))40674062 set_bit(R5_ReadRepl, &dev->flags);40684063 else {40694069- if (rdev)40644064+ if (rdev && !test_bit(Faulty, &rdev->flags))40704065 set_bit(R5_NeedReplace, &dev->flags);40664066+ else40674067+ clear_bit(R5_NeedReplace, &dev->flags);40714068 rdev = rcu_dereference(conf->disks[i].rdev);40724069 clear_bit(R5_ReadRepl, &dev->flags);40734070 }···58645857 pr_debug("%d stripes handled\n", handled);5865585858665859 spin_unlock_irq(&conf->device_lock);58675867- if (test_and_clear_bit(R5_ALLOC_MORE, &conf->cache_state)) {58605860+ if (test_and_clear_bit(R5_ALLOC_MORE, &conf->cache_state) &&58615861+ mutex_trylock(&conf->cache_size_mutex)) {58685862 grow_one_stripe(conf, __GFP_NOWARN);58695863 /* Set flag even if allocation failed. This helps58705864 * slow down allocation requests when mem is short58715865 */58725866 set_bit(R5_DID_ALLOC, &conf->cache_state);58675867+ mutex_unlock(&conf->cache_size_mutex);58735868 }5874586958755870 async_tx_issue_pending_all();···59035894 return -EINVAL;5904589559055896 conf->min_nr_stripes = size;58975897+ mutex_lock(&conf->cache_size_mutex);59065898 while (size < conf->max_nr_stripes &&59075899 drop_one_stripe(conf))59085900 ;59015901+ mutex_unlock(&conf->cache_size_mutex);590959025910590359115904 err = md_allow_write(mddev);59125905 if (err)59135906 return err;5914590759085908+ mutex_lock(&conf->cache_size_mutex);59155909 while (size > conf->max_nr_stripes)59165910 if (!grow_one_stripe(conf, GFP_KERNEL))59175911 break;59125912+ mutex_unlock(&conf->cache_size_mutex);5918591359195914 return 0;59205915}···63846371 struct shrink_control *sc)63856372{63866373 struct r5conf *conf = container_of(shrink, struct r5conf, shrinker);63876387- int ret = 0;63886388- while (ret < sc->nr_to_scan) {63896389- if (drop_one_stripe(conf) == 0)63906390- return SHRINK_STOP;63916391- ret++;63746374+ unsigned long ret = SHRINK_STOP;63756375+63766376+ if (mutex_trylock(&conf->cache_size_mutex)) {63776377+ ret= 0;63786378+ while (ret < sc->nr_to_scan) {63796379+ if (drop_one_stripe(conf) == 0) {63806380+ ret = SHRINK_STOP;63816381+ break;63826382+ }63836383+ ret++;63846384+ }63856385+ mutex_unlock(&conf->cache_size_mutex);63926386 }63936387 return ret;63946388}···64646444 goto abort;64656445 spin_lock_init(&conf->device_lock);64666446 seqcount_init(&conf->gen_lock);64476447+ mutex_init(&conf->cache_size_mutex);64676448 init_waitqueue_head(&conf->wait_for_quiescent);64686449 for (i = 0; i < NR_STRIPE_HASH_LOCKS; i++) {64696450 init_waitqueue_head(&conf->wait_for_stripe[i]);
+2-1
drivers/md/raid5.h
···482482 */483483 int active_name;484484 char cache_name[2][32];485485- struct kmem_cache *slab_cache; /* for allocating stripes */485485+ struct kmem_cache *slab_cache; /* for allocating stripes */486486+ struct mutex cache_size_mutex; /* Protect changes to cache size */486487487488 int seq_flush, seq_write;488489 int quiesce;
+9-6
drivers/media/pci/ivtv/ivtvfb.c
···3838 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA3939 */40404141+#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt4242+4143#include <linux/module.h>4244#include <linux/kernel.h>4345#include <linux/fb.h>···11731171{11741172 int rc;1175117311741174+#ifdef CONFIG_X86_6411751175+ if (pat_enabled()) {11761176+ pr_warn("ivtvfb needs PAT disabled, boot with nopat kernel parameter\n");11771177+ return -ENODEV;11781178+ }11791179+#endif11801180+11761181 if (itv->osd_info) {11771182 IVTVFB_ERR("Card %d already initialised\n", ivtvfb_card_id);11781183 return -EBUSY;···12741265 int registered = 0;12751266 int err;1276126712771277-#ifdef CONFIG_X86_6412781278- if (WARN(pat_enabled(),12791279- "ivtvfb needs PAT disabled, boot with nopat kernel parameter\n")) {12801280- return -ENODEV;12811281- }12821282-#endif1283126812841269 if (ivtvfb_card_id < -1 || ivtvfb_card_id >= IVTV_MAX_CARDS) {12851270 printk(KERN_ERR "ivtvfb: ivtvfb_card_id parameter is out of range (valid range: -1 - %d)\n",
+1-1
drivers/misc/mei/main.c
···682682 /* Fill in the data structures */683683 devno = MKDEV(MAJOR(mei_devt), dev->minor);684684 cdev_init(&dev->cdev, &mei_fops);685685- dev->cdev.owner = mei_fops.owner;685685+ dev->cdev.owner = parent->driver->owner;686686687687 /* Add the device */688688 ret = cdev_add(&dev->cdev, devno, 1);
+5-10
drivers/misc/mic/scif/scif_nodeqp.c
···357357}358358359359static struct scatterlist *360360-scif_p2p_setsg(void __iomem *va, int page_size, int page_cnt)360360+scif_p2p_setsg(phys_addr_t pa, int page_size, int page_cnt)361361{362362 struct scatterlist *sg;363363 struct page *page;···368368 return NULL;369369 sg_init_table(sg, page_cnt);370370 for (i = 0; i < page_cnt; i++) {371371- page = vmalloc_to_page((void __force *)va);372372- if (!page)373373- goto p2p_sg_err;371371+ page = pfn_to_page(pa >> PAGE_SHIFT);374372 sg_set_page(&sg[i], page, page_size, 0);375375- va += page_size;373373+ pa += page_size;376374 }377375 return sg;378378-p2p_sg_err:379379- kfree(sg);380380- return NULL;381376}382377383378/* Init p2p mappings required to access peerdev from scifdev */···390395 p2p = kzalloc(sizeof(*p2p), GFP_KERNEL);391396 if (!p2p)392397 return NULL;393393- p2p->ppi_sg[SCIF_PPI_MMIO] = scif_p2p_setsg(psdev->mmio->va,398398+ p2p->ppi_sg[SCIF_PPI_MMIO] = scif_p2p_setsg(psdev->mmio->pa,394399 PAGE_SIZE, num_mmio_pages);395400 if (!p2p->ppi_sg[SCIF_PPI_MMIO])396401 goto free_p2p;397402 p2p->sg_nentries[SCIF_PPI_MMIO] = num_mmio_pages;398403 sg_page_shift = get_order(min(psdev->aper->len, (u64)(1 << 30)));399404 num_aper_chunks = num_aper_pages >> (sg_page_shift - PAGE_SHIFT);400400- p2p->ppi_sg[SCIF_PPI_APER] = scif_p2p_setsg(psdev->aper->va,405405+ p2p->ppi_sg[SCIF_PPI_APER] = scif_p2p_setsg(psdev->aper->pa,401406 1 << sg_page_shift,402407 num_aper_chunks);403408 p2p->sg_nentries[SCIF_PPI_APER] = num_aper_chunks;
···779779780780config MMC_MTK781781 tristate "MediaTek SD/MMC Card Interface support"782782+ depends on HAS_DMA782783 help783784 This selects the MediaTek(R) Secure digital and Multimedia card Interface.784785 If you have a machine with a integrated SD/MMC card reader, say Y or M here.
···696696 }697697698698 /* Include the pseudo-PHY address and the broadcast PHY address to699699- * divert reads towards our workaround699699+ * divert reads towards our workaround. This is only required for700700+ * 7445D0, since 7445E0 disconnects the internal switch pseudo-PHY such701701+ * that we can use the regular SWITCH_MDIO master controller instead.702702+ *703703+ * By default, DSA initializes ds->phys_mii_mask to ds->phys_port_mask704704+ * to have a 1:1 mapping between Port address and PHY address in order705705+ * to utilize the slave_mii_bus instance to read from Port PHYs. This is706706+ * not what we want here, so we initialize phys_mii_mask 0 to always707707+ * utilize the "master" MDIO bus backed by the "mdio-unimac" driver.700708 */701701- ds->phys_mii_mask |= ((1 << BRCM_PSEUDO_PHY_ADDR) | (1 << 0));709709+ if (of_machine_is_compatible("brcm,bcm7445d0"))710710+ ds->phys_mii_mask |= ((1 << BRCM_PSEUDO_PHY_ADDR) | (1 << 0));711711+ else712712+ ds->phys_mii_mask = 0;702713703714 rev = reg_readl(priv, REG_SWITCH_REVISION);704715 priv->hw_params.top_rev = (rev >> SWITCH_TOP_REV_SHIFT) &
···540540 hw_addr = (const u8 *)(mac_override +541541 MAC_ADDRESS_OVERRIDE_FAMILY_8000);542542543543- /* The byte order is little endian 16 bit, meaning 214365 */544544- data->hw_addr[0] = hw_addr[1];545545- data->hw_addr[1] = hw_addr[0];546546- data->hw_addr[2] = hw_addr[3];547547- data->hw_addr[3] = hw_addr[2];548548- data->hw_addr[4] = hw_addr[5];549549- data->hw_addr[5] = hw_addr[4];543543+ /*544544+ * Store the MAC address from MAO section.545545+ * No byte swapping is required in MAO section546546+ */547547+ memcpy(data->hw_addr, hw_addr, ETH_ALEN);550548551549 /*552550 * Force the use of the OTP MAC address in case of reserved MAC
+2-1
drivers/net/wireless/iwlwifi/mvm/fw-api-scan.h
···660660 * iwl_umac_scan_flags661661 *@IWL_UMAC_SCAN_FLAG_PREEMPTIVE: scan process triggered by this scan request662662 * can be preempted by other scan requests with higher priority.663663- * The low priority scan is aborted.663663+ * The low priority scan will be resumed when the higher proirity scan is664664+ * completed.664665 *@IWL_UMAC_SCAN_FLAG_START_NOTIF: notification will be sent to the driver665666 * when scan starts.666667 */
···8686{8787 lockdep_assert_held(&mvm->time_event_lock);88888989- if (te_data->id == TE_MAX)8989+ if (!te_data->vif)9090 return;91919292 list_del(&te_data->list);
···4444#include "iwl-io.h"4545#include "iwl-op-mode.h"46464747-/*4848- * RX related structures and functions4949- */5050-#define RX_NUM_QUEUES 15151-#define RX_POST_REQ_ALLOC 25252-#define RX_CLAIM_REQ_ALLOC 85353-#define RX_POOL_SIZE ((RX_CLAIM_REQ_ALLOC - RX_POST_REQ_ALLOC) * RX_NUM_QUEUES)5454-#define RX_LOW_WATERMARK 85555-5647struct iwl_host_cmd;57485849/*This file includes the declaration that are internal to the···7786 * struct iwl_rxq - Rx queue7887 * @bd: driver's pointer to buffer of receive buffer descriptors (rbd)7988 * @bd_dma: bus address of buffer of receive buffer descriptors (rbd)8989+ * @pool:9090+ * @queue:8091 * @read: Shared index to newest available Rx buffer8192 * @write: Shared index to oldest written Rx packet8293 * @free_count: Number of pre-allocated buffers in rx_free8383- * @used_count: Number of RBDs handled to allocator to use for allocation8494 * @write_actual:8585- * @rx_free: list of RBDs with allocated RB ready for use8686- * @rx_used: list of RBDs with no RB attached9595+ * @rx_free: list of free SKBs for use9696+ * @rx_used: List of Rx buffers with no SKB8797 * @need_update: flag to indicate we need to update read/write index8898 * @rb_stts: driver's pointer to receive buffer status8999 * @rb_stts_dma: bus address of receive buffer status90100 * @lock:9191- * @pool: initial pool of iwl_rx_mem_buffer for the queue9292- * @queue: actual rx queue93101 *94102 * NOTE: rx_free and rx_used are used as a FIFO for iwl_rx_mem_buffers95103 */96104struct iwl_rxq {97105 __le32 *bd;98106 dma_addr_t bd_dma;107107+ struct iwl_rx_mem_buffer pool[RX_QUEUE_SIZE + RX_FREE_BUFFERS];108108+ struct iwl_rx_mem_buffer *queue[RX_QUEUE_SIZE];99109 u32 read;100110 u32 write;101111 u32 free_count;102102- u32 used_count;103112 u32 write_actual;104113 struct list_head rx_free;105114 struct list_head rx_used;···107116 struct iwl_rb_status *rb_stts;108117 dma_addr_t rb_stts_dma;109118 spinlock_t lock;110110- struct iwl_rx_mem_buffer pool[RX_QUEUE_SIZE];111111- struct iwl_rx_mem_buffer *queue[RX_QUEUE_SIZE];112112-};113113-114114-/**115115- * struct iwl_rb_allocator - Rx allocator116116- * @pool: initial pool of allocator117117- * @req_pending: number of requests the allcator had not processed yet118118- * @req_ready: number of requests honored and ready for claiming119119- * @rbd_allocated: RBDs with pages allocated and ready to be handled to120120- * the queue. This is a list of &struct iwl_rx_mem_buffer121121- * @rbd_empty: RBDs with no page attached for allocator use. This is a list122122- * of &struct iwl_rx_mem_buffer123123- * @lock: protects the rbd_allocated and rbd_empty lists124124- * @alloc_wq: work queue for background calls125125- * @rx_alloc: work struct for background calls126126- */127127-struct iwl_rb_allocator {128128- struct iwl_rx_mem_buffer pool[RX_POOL_SIZE];129129- atomic_t req_pending;130130- atomic_t req_ready;131131- struct list_head rbd_allocated;132132- struct list_head rbd_empty;133133- spinlock_t lock;134134- struct workqueue_struct *alloc_wq;135135- struct work_struct rx_alloc;136119};137120138121struct iwl_dma_ptr {···250285/**251286 * struct iwl_trans_pcie - PCIe transport specific data252287 * @rxq: all the RX queue data253253- * @rba: allocator for RX replenishing288288+ * @rx_replenish: work that will be called when buffers need to be allocated254289 * @drv - pointer to iwl_drv255290 * @trans: pointer to the generic transport area256291 * @scd_base_addr: scheduler sram base address in SRAM···273308 */274309struct iwl_trans_pcie {275310 struct iwl_rxq rxq;276276- struct iwl_rb_allocator rba;311311+ struct work_struct rx_replenish;277312 struct iwl_trans *trans;278313 struct iwl_drv *drv;279314
+83-331
drivers/net/wireless/iwlwifi/pcie/rx.c
···11/******************************************************************************22 *33 * Copyright(c) 2003 - 2014 Intel Corporation. All rights reserved.44- * Copyright(c) 2013 - 2015 Intel Mobile Communications GmbH44+ * Copyright(c) 2013 - 2014 Intel Mobile Communications GmbH55 *66 * Portions of this file are derived from the ipw3945 project, as well77 * as portions of the ieee80211 subsystem header files.···7474 * resets the Rx queue buffers with new memory.7575 *7676 * The management in the driver is as follows:7777- * + A list of pre-allocated RBDs is stored in iwl->rxq->rx_free.7878- * When the interrupt handler is called, the request is processed.7979- * The page is either stolen - transferred to the upper layer8080- * or reused - added immediately to the iwl->rxq->rx_free list.8181- * + When the page is stolen - the driver updates the matching queue's used8282- * count, detaches the RBD and transfers it to the queue used list.8383- * When there are two used RBDs - they are transferred to the allocator empty8484- * list. Work is then scheduled for the allocator to start allocating8585- * eight buffers.8686- * When there are another 6 used RBDs - they are transferred to the allocator8787- * empty list and the driver tries to claim the pre-allocated buffers and8888- * add them to iwl->rxq->rx_free. If it fails - it continues to claim them8989- * until ready.9090- * When there are 8+ buffers in the free list - either from allocation or from9191- * 8 reused unstolen pages - restock is called to update the FW and indexes.9292- * + In order to make sure the allocator always has RBDs to use for allocation9393- * the allocator has initial pool in the size of num_queues*(8-2) - the9494- * maximum missing RBDs per allocation request (request posted with 29595- * empty RBDs, there is no guarantee when the other 6 RBDs are supplied).9696- * The queues supplies the recycle of the rest of the RBDs.7777+ * + A list of pre-allocated SKBs is stored in iwl->rxq->rx_free. When7878+ * iwl->rxq->free_count drops to or below RX_LOW_WATERMARK, work is scheduled7979+ * to replenish the iwl->rxq->rx_free.8080+ * + In iwl_pcie_rx_replenish (scheduled) if 'processed' != 'read' then the8181+ * iwl->rxq is replenished and the READ INDEX is updated (updating the8282+ * 'processed' and 'read' driver indexes as well)9783 * + A received packet is processed and handed to the kernel network stack,9884 * detached from the iwl->rxq. The driver 'processed' index is updated.9999- * + If there are no allocated buffers in iwl->rxq->rx_free,8585+ * + The Host/Firmware iwl->rxq is replenished at irq thread time from the8686+ * rx_free list. If there are no allocated buffers in iwl->rxq->rx_free,10087 * the READ INDEX is not incremented and iwl->status(RX_STALLED) is set.10188 * If there were enough free buffers and RX_STALLED is set it is cleared.10289 *···92105 *93106 * iwl_rxq_alloc() Allocates rx_free94107 * iwl_pcie_rx_replenish() Replenishes rx_free list from rx_used, and calls9595- * iwl_pcie_rxq_restock.9696- * Used only during initialization.108108+ * iwl_pcie_rxq_restock97109 * iwl_pcie_rxq_restock() Moves available buffers from rx_free into Rx98110 * queue, updates firmware pointers, and updates9999- * the WRITE index.100100- * iwl_pcie_rx_allocator() Background work for allocating pages.111111+ * the WRITE index. If insufficient rx_free buffers112112+ * are available, schedules iwl_pcie_rx_replenish101113 *102114 * -- enable interrupts --103115 * ISR - iwl_rx() Detach iwl_rx_mem_buffers from pool up to the104116 * READ INDEX, detaching the SKB from the pool.105117 * Moves the packet buffer from queue to rx_used.106106- * Posts and claims requests to the allocator.107118 * Calls iwl_pcie_rxq_restock to refill any empty108119 * slots.109109- *110110- * RBD life-cycle:111111- *112112- * Init:113113- * rxq.pool -> rxq.rx_used -> rxq.rx_free -> rxq.queue114114- *115115- * Regular Receive interrupt:116116- * Page Stolen:117117- * rxq.queue -> rxq.rx_used -> allocator.rbd_empty ->118118- * allocator.rbd_allocated -> rxq.rx_free -> rxq.queue119119- * Page not Stolen:120120- * rxq.queue -> rxq.rx_free -> rxq.queue121120 * ...122121 *123122 */···240267 rxq->free_count--;241268 }242269 spin_unlock(&rxq->lock);270270+ /* If the pre-allocated buffer pool is dropping low, schedule to271271+ * refill it */272272+ if (rxq->free_count <= RX_LOW_WATERMARK)273273+ schedule_work(&trans_pcie->rx_replenish);243274244275 /* If we've added more space for the firmware to place data, tell it.245276 * Increment device's write pointer in multiples of 8. */···255278}256279257280/*258258- * iwl_pcie_rx_alloc_page - allocates and returns a page.259259- *260260- */261261-static struct page *iwl_pcie_rx_alloc_page(struct iwl_trans *trans)262262-{263263- struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans);264264- struct iwl_rxq *rxq = &trans_pcie->rxq;265265- struct page *page;266266- gfp_t gfp_mask = GFP_KERNEL;267267-268268- if (rxq->free_count > RX_LOW_WATERMARK)269269- gfp_mask |= __GFP_NOWARN;270270-271271- if (trans_pcie->rx_page_order > 0)272272- gfp_mask |= __GFP_COMP;273273-274274- /* Alloc a new receive buffer */275275- page = alloc_pages(gfp_mask, trans_pcie->rx_page_order);276276- if (!page) {277277- if (net_ratelimit())278278- IWL_DEBUG_INFO(trans, "alloc_pages failed, order: %d\n",279279- trans_pcie->rx_page_order);280280- /* Issue an error if the hardware has consumed more than half281281- * of its free buffer list and we don't have enough282282- * pre-allocated buffers.283283-` */284284- if (rxq->free_count <= RX_LOW_WATERMARK &&285285- iwl_rxq_space(rxq) > (RX_QUEUE_SIZE / 2) &&286286- net_ratelimit())287287- IWL_CRIT(trans,288288- "Failed to alloc_pages with GFP_KERNEL. Only %u free buffers remaining.\n",289289- rxq->free_count);290290- return NULL;291291- }292292- return page;293293-}294294-295295-/*296281 * iwl_pcie_rxq_alloc_rbs - allocate a page for each used RBD297282 *298283 * A used RBD is an Rx buffer that has been given to the stack. To use it again···263324 * iwl_pcie_rxq_restock. The latter function will update the HW to use the newly264325 * allocated buffers.265326 */266266-static void iwl_pcie_rxq_alloc_rbs(struct iwl_trans *trans)327327+static void iwl_pcie_rxq_alloc_rbs(struct iwl_trans *trans, gfp_t priority)267328{268329 struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans);269330 struct iwl_rxq *rxq = &trans_pcie->rxq;270331 struct iwl_rx_mem_buffer *rxb;271332 struct page *page;333333+ gfp_t gfp_mask = priority;272334273335 while (1) {274336 spin_lock(&rxq->lock);···279339 }280340 spin_unlock(&rxq->lock);281341342342+ if (rxq->free_count > RX_LOW_WATERMARK)343343+ gfp_mask |= __GFP_NOWARN;344344+345345+ if (trans_pcie->rx_page_order > 0)346346+ gfp_mask |= __GFP_COMP;347347+282348 /* Alloc a new receive buffer */283283- page = iwl_pcie_rx_alloc_page(trans);284284- if (!page)349349+ page = alloc_pages(gfp_mask, trans_pcie->rx_page_order);350350+ if (!page) {351351+ if (net_ratelimit())352352+ IWL_DEBUG_INFO(trans, "alloc_pages failed, "353353+ "order: %d\n",354354+ trans_pcie->rx_page_order);355355+356356+ if ((rxq->free_count <= RX_LOW_WATERMARK) &&357357+ net_ratelimit())358358+ IWL_CRIT(trans, "Failed to alloc_pages with %s."359359+ "Only %u free buffers remaining.\n",360360+ priority == GFP_ATOMIC ?361361+ "GFP_ATOMIC" : "GFP_KERNEL",362362+ rxq->free_count);363363+ /* We don't reschedule replenish work here -- we will364364+ * call the restock method and if it still needs365365+ * more buffers it will schedule replenish */285366 return;367367+ }286368287369 spin_lock(&rxq->lock);288370···355393356394 lockdep_assert_held(&rxq->lock);357395358358- for (i = 0; i < RX_QUEUE_SIZE; i++) {396396+ for (i = 0; i < RX_FREE_BUFFERS + RX_QUEUE_SIZE; i++) {359397 if (!rxq->pool[i].page)360398 continue;361399 dma_unmap_page(trans->dev, rxq->pool[i].page_dma,···372410 * When moving to rx_free an page is allocated for the slot.373411 *374412 * Also restock the Rx queue via iwl_pcie_rxq_restock.375375- * This is called only during initialization413413+ * This is called as a scheduled work item (except for during initialization)376414 */377377-static void iwl_pcie_rx_replenish(struct iwl_trans *trans)415415+static void iwl_pcie_rx_replenish(struct iwl_trans *trans, gfp_t gfp)378416{379379- iwl_pcie_rxq_alloc_rbs(trans);417417+ iwl_pcie_rxq_alloc_rbs(trans, gfp);380418381419 iwl_pcie_rxq_restock(trans);382420}383421384384-/*385385- * iwl_pcie_rx_allocator - Allocates pages in the background for RX queues386386- *387387- * Allocates for each received request 8 pages388388- * Called as a scheduled work item.389389- */390390-static void iwl_pcie_rx_allocator(struct iwl_trans *trans)422422+static void iwl_pcie_rx_replenish_work(struct work_struct *data)391423{392392- struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans);393393- struct iwl_rb_allocator *rba = &trans_pcie->rba;394394-395395- while (atomic_read(&rba->req_pending)) {396396- int i;397397- struct list_head local_empty;398398- struct list_head local_allocated;399399-400400- INIT_LIST_HEAD(&local_allocated);401401- spin_lock(&rba->lock);402402- /* swap out the entire rba->rbd_empty to a local list */403403- list_replace_init(&rba->rbd_empty, &local_empty);404404- spin_unlock(&rba->lock);405405-406406- for (i = 0; i < RX_CLAIM_REQ_ALLOC;) {407407- struct iwl_rx_mem_buffer *rxb;408408- struct page *page;409409-410410- /* List should never be empty - each reused RBD is411411- * returned to the list, and initial pool covers any412412- * possible gap between the time the page is allocated413413- * to the time the RBD is added.414414- */415415- BUG_ON(list_empty(&local_empty));416416- /* Get the first rxb from the rbd list */417417- rxb = list_first_entry(&local_empty,418418- struct iwl_rx_mem_buffer, list);419419- BUG_ON(rxb->page);420420-421421- /* Alloc a new receive buffer */422422- page = iwl_pcie_rx_alloc_page(trans);423423- if (!page)424424- continue;425425- rxb->page = page;426426-427427- /* Get physical address of the RB */428428- rxb->page_dma = dma_map_page(trans->dev, page, 0,429429- PAGE_SIZE << trans_pcie->rx_page_order,430430- DMA_FROM_DEVICE);431431- if (dma_mapping_error(trans->dev, rxb->page_dma)) {432432- rxb->page = NULL;433433- __free_pages(page, trans_pcie->rx_page_order);434434- continue;435435- }436436- /* dma address must be no more than 36 bits */437437- BUG_ON(rxb->page_dma & ~DMA_BIT_MASK(36));438438- /* and also 256 byte aligned! */439439- BUG_ON(rxb->page_dma & DMA_BIT_MASK(8));440440-441441- /* move the allocated entry to the out list */442442- list_move(&rxb->list, &local_allocated);443443- i++;444444- }445445-446446- spin_lock(&rba->lock);447447- /* add the allocated rbds to the allocator allocated list */448448- list_splice_tail(&local_allocated, &rba->rbd_allocated);449449- /* add the unused rbds back to the allocator empty list */450450- list_splice_tail(&local_empty, &rba->rbd_empty);451451- spin_unlock(&rba->lock);452452-453453- atomic_dec(&rba->req_pending);454454- atomic_inc(&rba->req_ready);455455- }456456-}457457-458458-/*459459- * iwl_pcie_rx_allocator_get - Returns the pre-allocated pages460460-.*461461-.* Called by queue when the queue posted allocation request and462462- * has freed 8 RBDs in order to restock itself.463463- */464464-static int iwl_pcie_rx_allocator_get(struct iwl_trans *trans,465465- struct iwl_rx_mem_buffer466466- *out[RX_CLAIM_REQ_ALLOC])467467-{468468- struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans);469469- struct iwl_rb_allocator *rba = &trans_pcie->rba;470470- int i;471471-472472- if (atomic_dec_return(&rba->req_ready) < 0) {473473- atomic_inc(&rba->req_ready);474474- IWL_DEBUG_RX(trans,475475- "Allocation request not ready, pending requests = %d\n",476476- atomic_read(&rba->req_pending));477477- return -ENOMEM;478478- }479479-480480- spin_lock(&rba->lock);481481- for (i = 0; i < RX_CLAIM_REQ_ALLOC; i++) {482482- /* Get next free Rx buffer, remove it from free list */483483- out[i] = list_first_entry(&rba->rbd_allocated,484484- struct iwl_rx_mem_buffer, list);485485- list_del(&out[i]->list);486486- }487487- spin_unlock(&rba->lock);488488-489489- return 0;490490-}491491-492492-static void iwl_pcie_rx_allocator_work(struct work_struct *data)493493-{494494- struct iwl_rb_allocator *rba_p =495495- container_of(data, struct iwl_rb_allocator, rx_alloc);496424 struct iwl_trans_pcie *trans_pcie =497497- container_of(rba_p, struct iwl_trans_pcie, rba);425425+ container_of(data, struct iwl_trans_pcie, rx_replenish);498426499499- iwl_pcie_rx_allocator(trans_pcie->trans);427427+ iwl_pcie_rx_replenish(trans_pcie->trans, GFP_KERNEL);500428}501429502430static int iwl_pcie_rx_alloc(struct iwl_trans *trans)503431{504432 struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans);505433 struct iwl_rxq *rxq = &trans_pcie->rxq;506506- struct iwl_rb_allocator *rba = &trans_pcie->rba;507434 struct device *dev = trans->dev;508435509436 memset(&trans_pcie->rxq, 0, sizeof(trans_pcie->rxq));510437511438 spin_lock_init(&rxq->lock);512512- spin_lock_init(&rba->lock);513439514440 if (WARN_ON(rxq->bd || rxq->rb_stts))515441 return -EINVAL;···487637 INIT_LIST_HEAD(&rxq->rx_free);488638 INIT_LIST_HEAD(&rxq->rx_used);489639 rxq->free_count = 0;490490- rxq->used_count = 0;491640492492- for (i = 0; i < RX_QUEUE_SIZE; i++)641641+ for (i = 0; i < RX_FREE_BUFFERS + RX_QUEUE_SIZE; i++)493642 list_add(&rxq->pool[i].list, &rxq->rx_used);494494-}495495-496496-static void iwl_pcie_rx_init_rba(struct iwl_rb_allocator *rba)497497-{498498- int i;499499-500500- lockdep_assert_held(&rba->lock);501501-502502- INIT_LIST_HEAD(&rba->rbd_allocated);503503- INIT_LIST_HEAD(&rba->rbd_empty);504504-505505- for (i = 0; i < RX_POOL_SIZE; i++)506506- list_add(&rba->pool[i].list, &rba->rbd_empty);507507-}508508-509509-static void iwl_pcie_rx_free_rba(struct iwl_trans *trans)510510-{511511- struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans);512512- struct iwl_rb_allocator *rba = &trans_pcie->rba;513513- int i;514514-515515- lockdep_assert_held(&rba->lock);516516-517517- for (i = 0; i < RX_POOL_SIZE; i++) {518518- if (!rba->pool[i].page)519519- continue;520520- dma_unmap_page(trans->dev, rba->pool[i].page_dma,521521- PAGE_SIZE << trans_pcie->rx_page_order,522522- DMA_FROM_DEVICE);523523- __free_pages(rba->pool[i].page, trans_pcie->rx_page_order);524524- rba->pool[i].page = NULL;525525- }526643}527644528645int iwl_pcie_rx_init(struct iwl_trans *trans)529646{530647 struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans);531648 struct iwl_rxq *rxq = &trans_pcie->rxq;532532- struct iwl_rb_allocator *rba = &trans_pcie->rba;533649 int i, err;534650535651 if (!rxq->bd) {···503687 if (err)504688 return err;505689 }506506- if (!rba->alloc_wq)507507- rba->alloc_wq = alloc_workqueue("rb_allocator",508508- WQ_HIGHPRI | WQ_UNBOUND, 1);509509- INIT_WORK(&rba->rx_alloc, iwl_pcie_rx_allocator_work);510510-511511- spin_lock(&rba->lock);512512- atomic_set(&rba->req_pending, 0);513513- atomic_set(&rba->req_ready, 0);514514- /* free all first - we might be reconfigured for a different size */515515- iwl_pcie_rx_free_rba(trans);516516- iwl_pcie_rx_init_rba(rba);517517- spin_unlock(&rba->lock);518690519691 spin_lock(&rxq->lock);692692+693693+ INIT_WORK(&trans_pcie->rx_replenish, iwl_pcie_rx_replenish_work);520694521695 /* free all first - we might be reconfigured for a different size */522696 iwl_pcie_rxq_free_rbs(trans);···522716 memset(rxq->rb_stts, 0, sizeof(*rxq->rb_stts));523717 spin_unlock(&rxq->lock);524718525525- iwl_pcie_rx_replenish(trans);719719+ iwl_pcie_rx_replenish(trans, GFP_KERNEL);526720527721 iwl_pcie_rx_hw_init(trans, rxq);528722···537731{538732 struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans);539733 struct iwl_rxq *rxq = &trans_pcie->rxq;540540- struct iwl_rb_allocator *rba = &trans_pcie->rba;541734542735 /*if rxq->bd is NULL, it means that nothing has been allocated,543736 * exit now */···545740 return;546741 }547742548548- cancel_work_sync(&rba->rx_alloc);549549- if (rba->alloc_wq) {550550- destroy_workqueue(rba->alloc_wq);551551- rba->alloc_wq = NULL;552552- }553553-554554- spin_lock(&rba->lock);555555- iwl_pcie_rx_free_rba(trans);556556- spin_unlock(&rba->lock);743743+ cancel_work_sync(&trans_pcie->rx_replenish);557744558745 spin_lock(&rxq->lock);559746 iwl_pcie_rxq_free_rbs(trans);···564767 IWL_DEBUG_INFO(trans, "Free rxq->rb_stts which is NULL\n");565768 rxq->rb_stts_dma = 0;566769 rxq->rb_stts = NULL;567567-}568568-569569-/*570570- * iwl_pcie_rx_reuse_rbd - Recycle used RBDs571571- *572572- * Called when a RBD can be reused. The RBD is transferred to the allocator.573573- * When there are 2 empty RBDs - a request for allocation is posted574574- */575575-static void iwl_pcie_rx_reuse_rbd(struct iwl_trans *trans,576576- struct iwl_rx_mem_buffer *rxb,577577- struct iwl_rxq *rxq)578578-{579579- struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans);580580- struct iwl_rb_allocator *rba = &trans_pcie->rba;581581-582582- /* Count the used RBDs */583583- rxq->used_count++;584584-585585- /* Move the RBD to the used list, will be moved to allocator in batches586586- * before claiming or posting a request*/587587- list_add_tail(&rxb->list, &rxq->rx_used);588588-589589- /* If we have RX_POST_REQ_ALLOC new released rx buffers -590590- * issue a request for allocator. Modulo RX_CLAIM_REQ_ALLOC is591591- * used for the case we failed to claim RX_CLAIM_REQ_ALLOC,592592- * after but we still need to post another request.593593- */594594- if ((rxq->used_count % RX_CLAIM_REQ_ALLOC) == RX_POST_REQ_ALLOC) {595595- /* Move the 2 RBDs to the allocator ownership.596596- Allocator has another 6 from pool for the request completion*/597597- spin_lock(&rba->lock);598598- list_splice_tail_init(&rxq->rx_used, &rba->rbd_empty);599599- spin_unlock(&rba->lock);600600-601601- atomic_inc(&rba->req_pending);602602- queue_work(rba->alloc_wq, &rba->rx_alloc);603603- }604770}605771606772static void iwl_pcie_rx_handle_rb(struct iwl_trans *trans,···688928 */689929 __free_pages(rxb->page, trans_pcie->rx_page_order);690930 rxb->page = NULL;691691- iwl_pcie_rx_reuse_rbd(trans, rxb, rxq);931931+ list_add_tail(&rxb->list, &rxq->rx_used);692932 } else {693933 list_add_tail(&rxb->list, &rxq->rx_free);694934 rxq->free_count++;695935 }696936 } else697697- iwl_pcie_rx_reuse_rbd(trans, rxb, rxq);937937+ list_add_tail(&rxb->list, &rxq->rx_used);698938}699939700940/*···704944{705945 struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans);706946 struct iwl_rxq *rxq = &trans_pcie->rxq;707707- u32 r, i, j;947947+ u32 r, i;948948+ u8 fill_rx = 0;949949+ u32 count = 8;950950+ int total_empty;708951709952restart:710953 spin_lock(&rxq->lock);···720957 if (i == r)721958 IWL_DEBUG_RX(trans, "HW = SW = %d\n", r);722959960960+ /* calculate total frames need to be restock after handling RX */961961+ total_empty = r - rxq->write_actual;962962+ if (total_empty < 0)963963+ total_empty += RX_QUEUE_SIZE;964964+965965+ if (total_empty > (RX_QUEUE_SIZE / 2))966966+ fill_rx = 1;967967+723968 while (i != r) {724969 struct iwl_rx_mem_buffer *rxb;725970···739968 iwl_pcie_rx_handle_rb(trans, rxb);740969741970 i = (i + 1) & RX_QUEUE_MASK;742742-743743- /* If we have RX_CLAIM_REQ_ALLOC released rx buffers -744744- * try to claim the pre-allocated buffers from the allocator */745745- if (rxq->used_count >= RX_CLAIM_REQ_ALLOC) {746746- struct iwl_rb_allocator *rba = &trans_pcie->rba;747747- struct iwl_rx_mem_buffer *out[RX_CLAIM_REQ_ALLOC];748748-749749- /* Add the remaining 6 empty RBDs for allocator use */750750- spin_lock(&rba->lock);751751- list_splice_tail_init(&rxq->rx_used, &rba->rbd_empty);752752- spin_unlock(&rba->lock);753753-754754- /* If not ready - continue, will try to reclaim later.755755- * No need to reschedule work - allocator exits only on756756- * success */757757- if (!iwl_pcie_rx_allocator_get(trans, out)) {758758- /* If success - then RX_CLAIM_REQ_ALLOC759759- * buffers were retrieved and should be added760760- * to free list */761761- rxq->used_count -= RX_CLAIM_REQ_ALLOC;762762- for (j = 0; j < RX_CLAIM_REQ_ALLOC; j++) {763763- list_add_tail(&out[j]->list,764764- &rxq->rx_free);765765- rxq->free_count++;766766- }971971+ /* If there are a lot of unused frames,972972+ * restock the Rx queue so ucode wont assert. */973973+ if (fill_rx) {974974+ count++;975975+ if (count >= 8) {976976+ rxq->read = i;977977+ spin_unlock(&rxq->lock);978978+ iwl_pcie_rx_replenish(trans, GFP_ATOMIC);979979+ count = 0;980980+ goto restart;767981 }768768- }769769- /* handle restock for two cases:770770- * - we just pulled buffers from the allocator771771- * - we have 8+ unstolen pages accumulated */772772- if (rxq->free_count >= RX_CLAIM_REQ_ALLOC) {773773- rxq->read = i;774774- spin_unlock(&rxq->lock);775775- iwl_pcie_rxq_restock(trans);776776- goto restart;777982 }778983 }779984780985 /* Backtrack one entry */781986 rxq->read = i;782987 spin_unlock(&rxq->lock);988988+989989+ if (fill_rx)990990+ iwl_pcie_rx_replenish(trans, GFP_ATOMIC);991991+ else992992+ iwl_pcie_rxq_restock(trans);783993784994 if (trans_pcie->napi.poll)785995 napi_gro_flush(&trans_pcie->napi, false);
+29-23
drivers/net/wireless/iwlwifi/pcie/trans.c
···182182183183static void iwl_pcie_set_pwr(struct iwl_trans *trans, bool vaux)184184{185185- if (!trans->cfg->apmg_not_supported)185185+ if (trans->cfg->apmg_not_supported)186186 return;187187188188 if (vaux && pci_pme_capable(to_pci_dev(trans->dev), PCI_D3cold))···24592459 struct iwl_trans_pcie *trans_pcie;24602460 struct iwl_trans *trans;24612461 u16 pci_cmd;24622462- int err;24622462+ int ret;2463246324642464 trans = iwl_trans_alloc(sizeof(struct iwl_trans_pcie),24652465 &pdev->dev, cfg, &trans_ops_pcie, 0);···24742474 spin_lock_init(&trans_pcie->ref_lock);24752475 init_waitqueue_head(&trans_pcie->ucode_write_waitq);2476247624772477- err = pci_enable_device(pdev);24782478- if (err)24772477+ ret = pci_enable_device(pdev);24782478+ if (ret)24792479 goto out_no_pci;2480248024812481 if (!cfg->base_params->pcie_l1_allowed) {···2491249124922492 pci_set_master(pdev);2493249324942494- err = pci_set_dma_mask(pdev, DMA_BIT_MASK(36));24952495- if (!err)24962496- err = pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(36));24972497- if (err) {24982498- err = pci_set_dma_mask(pdev, DMA_BIT_MASK(32));24992499- if (!err)25002500- err = pci_set_consistent_dma_mask(pdev,24942494+ ret = pci_set_dma_mask(pdev, DMA_BIT_MASK(36));24952495+ if (!ret)24962496+ ret = pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(36));24972497+ if (ret) {24982498+ ret = pci_set_dma_mask(pdev, DMA_BIT_MASK(32));24992499+ if (!ret)25002500+ ret = pci_set_consistent_dma_mask(pdev,25012501 DMA_BIT_MASK(32));25022502 /* both attempts failed: */25032503- if (err) {25032503+ if (ret) {25042504 dev_err(&pdev->dev, "No suitable DMA available\n");25052505 goto out_pci_disable_device;25062506 }25072507 }2508250825092509- err = pci_request_regions(pdev, DRV_NAME);25102510- if (err) {25092509+ ret = pci_request_regions(pdev, DRV_NAME);25102510+ if (ret) {25112511 dev_err(&pdev->dev, "pci_request_regions failed\n");25122512 goto out_pci_disable_device;25132513 }···25152515 trans_pcie->hw_base = pci_ioremap_bar(pdev, 0);25162516 if (!trans_pcie->hw_base) {25172517 dev_err(&pdev->dev, "pci_ioremap_bar failed\n");25182518- err = -ENODEV;25182518+ ret = -ENODEV;25192519 goto out_pci_release_regions;25202520 }25212521···25272527 trans_pcie->pci_dev = pdev;25282528 iwl_disable_interrupts(trans);2529252925302530- err = pci_enable_msi(pdev);25312531- if (err) {25322532- dev_err(&pdev->dev, "pci_enable_msi failed(0X%x)\n", err);25302530+ ret = pci_enable_msi(pdev);25312531+ if (ret) {25322532+ dev_err(&pdev->dev, "pci_enable_msi failed(0X%x)\n", ret);25332533 /* enable rfkill interrupt: hw bug w/a */25342534 pci_read_config_word(pdev, PCI_COMMAND, &pci_cmd);25352535 if (pci_cmd & PCI_COMMAND_INTX_DISABLE) {···25472547 */25482548 if (trans->cfg->device_family == IWL_DEVICE_FAMILY_8000) {25492549 unsigned long flags;25502550- int ret;2551255025522551 trans->hw_rev = (trans->hw_rev & 0xfff0) |25532552 (CSR_HW_REV_STEP(trans->hw_rev << 2) << 2);25532553+25542554+ ret = iwl_pcie_prepare_card_hw(trans);25552555+ if (ret) {25562556+ IWL_WARN(trans, "Exit HW not ready\n");25572557+ goto out_pci_disable_msi;25582558+ }2554255925552560 /*25562561 * in-order to recognize C step driver should read chip version···25962591 /* Initialize the wait queue for commands */25972592 init_waitqueue_head(&trans_pcie->wait_command_queue);2598259325992599- if (iwl_pcie_alloc_ict(trans))25942594+ ret = iwl_pcie_alloc_ict(trans);25952595+ if (ret)26002596 goto out_pci_disable_msi;2601259726022602- err = request_threaded_irq(pdev->irq, iwl_pcie_isr,25982598+ ret = request_threaded_irq(pdev->irq, iwl_pcie_isr,26032599 iwl_pcie_irq_handler,26042600 IRQF_SHARED, DRV_NAME, trans);26052605- if (err) {26012601+ if (ret) {26062602 IWL_ERR(trans, "Error allocating IRQ %d\n", pdev->irq);26072603 goto out_free_ict;26082604 }···26232617 pci_disable_device(pdev);26242618out_no_pci:26252619 iwl_trans_free(trans);26262626- return ERR_PTR(err);26202620+ return ERR_PTR(ret);26272621}
···891891 par_dev->dev.release = free_pardevice;892892 par_dev->devmodel = true;893893 ret = device_register(&par_dev->dev);894894- if (ret)895895- goto err_put_dev;894894+ if (ret) {895895+ put_device(&par_dev->dev);896896+ goto err_put_port;897897+ }896898897899 /* Chain this onto the list */898900 par_dev->prev = NULL;···909907 spin_unlock(&port->physport->pardevice_lock);910908 pr_debug("%s: cannot grant exclusive access for device %s\n",911909 port->name, name);912912- goto err_put_dev;910910+ device_unregister(&par_dev->dev);911911+ goto err_put_port;913912 }914913 port->flags |= PARPORT_FLAG_EXCL;915914 }···941938942939 return par_dev;943940944944-err_put_dev:945945- put_device(&par_dev->dev);946941err_free_devname:947942 kfree(devname);948943err_free_par_dev:
+2
drivers/phy/Kconfig
···56565757config PHY_PXA_28NM_HSIC5858 tristate "Marvell USB HSIC 28nm PHY Driver"5959+ depends on HAS_IOMEM5960 select GENERIC_PHY6061 help6162 Enable this to support Marvell USB HSIC PHY driver for Marvell···67666867config PHY_PXA_28NM_USB26968 tristate "Marvell USB 2.0 28nm PHY Driver"6969+ depends on HAS_IOMEM7070 select GENERIC_PHY7171 help7272 Enable this to support Marvell USB 2.0 PHY driver for Marvell
+2-2
drivers/phy/phy-berlin-usb.c
···105105106106static const u32 phy_berlin_pll_dividers[] = {107107 /* Berlin 2 */108108- CLK_REF_DIV(0xc) | FEEDBACK_CLK_DIV(0x54),109109- /* Berlin 2CD */110108 CLK_REF_DIV(0x6) | FEEDBACK_CLK_DIV(0x55),109109+ /* Berlin 2CD/Q */110110+ CLK_REF_DIV(0xc) | FEEDBACK_CLK_DIV(0x54),111111};112112113113struct phy_berlin_usb_priv {
+40-130
drivers/phy/phy-ti-pipe3.c
···2828#include <linux/delay.h>2929#include <linux/phy/omap_control_phy.h>3030#include <linux/of_platform.h>3131-#include <linux/spinlock.h>32313332#define PLL_STATUS 0x000000043433#define PLL_GO 0x00000008···8283 struct clk *refclk;8384 struct clk *div_clk;8485 struct pipe3_dpll_map *dpll_map;8585- bool enabled;8686- spinlock_t lock; /* serialize clock enable/disable */8787- /* the below flag is needed specifically for SATA */8888- bool refclk_enabled;8986};90879188static struct pipe3_dpll_map dpll_map_usb[] = {···131136132137 return NULL;133138}139139+140140+static int ti_pipe3_enable_clocks(struct ti_pipe3 *phy);141141+static void ti_pipe3_disable_clocks(struct ti_pipe3 *phy);134142135143static int ti_pipe3_power_off(struct phy *x)136144{···215217 u32 val;216218 int ret = 0;217219220220+ ti_pipe3_enable_clocks(phy);218221 /*219222 * Set pcie_pcs register to 0x96 for proper functioning of phy220223 * as recommended in AM572x TRM SPRUHZ6, section 18.5.2.2, table···249250 u32 val;250251 unsigned long timeout;251252252252- /* SATA DPLL can't be powered down due to Errata i783 and PCIe253253- * does not have internal DPLL254254- */255255- if (of_device_is_compatible(phy->dev->of_node, "ti,phy-pipe3-sata") ||256256- of_device_is_compatible(phy->dev->of_node, "ti,phy-pipe3-pcie"))253253+ /* SATA DPLL can't be powered down due to Errata i783 */254254+ if (of_device_is_compatible(phy->dev->of_node, "ti,phy-pipe3-sata"))257255 return 0;258256259259- /* Put DPLL in IDLE mode */260260- val = ti_pipe3_readl(phy->pll_ctrl_base, PLL_CONFIGURATION2);261261- val |= PLL_IDLE;262262- ti_pipe3_writel(phy->pll_ctrl_base, PLL_CONFIGURATION2, val);257257+ /* PCIe doesn't have internal DPLL */258258+ if (!of_device_is_compatible(phy->dev->of_node, "ti,phy-pipe3-pcie")) {259259+ /* Put DPLL in IDLE mode */260260+ val = ti_pipe3_readl(phy->pll_ctrl_base, PLL_CONFIGURATION2);261261+ val |= PLL_IDLE;262262+ ti_pipe3_writel(phy->pll_ctrl_base, PLL_CONFIGURATION2, val);263263264264- /* wait for LDO and Oscillator to power down */265265- timeout = jiffies + msecs_to_jiffies(PLL_IDLE_TIME);266266- do {267267- cpu_relax();268268- val = ti_pipe3_readl(phy->pll_ctrl_base, PLL_STATUS);269269- if ((val & PLL_TICOPWDN) && (val & PLL_LDOPWDN))270270- break;271271- } while (!time_after(jiffies, timeout));264264+ /* wait for LDO and Oscillator to power down */265265+ timeout = jiffies + msecs_to_jiffies(PLL_IDLE_TIME);266266+ do {267267+ cpu_relax();268268+ val = ti_pipe3_readl(phy->pll_ctrl_base, PLL_STATUS);269269+ if ((val & PLL_TICOPWDN) && (val & PLL_LDOPWDN))270270+ break;271271+ } while (!time_after(jiffies, timeout));272272273273- if (!(val & PLL_TICOPWDN) || !(val & PLL_LDOPWDN)) {274274- dev_err(phy->dev, "Failed to power down: PLL_STATUS 0x%x\n",275275- val);276276- return -EBUSY;273273+ if (!(val & PLL_TICOPWDN) || !(val & PLL_LDOPWDN)) {274274+ dev_err(phy->dev, "Failed to power down: PLL_STATUS 0x%x\n",275275+ val);276276+ return -EBUSY;277277+ }277278 }279279+280280+ ti_pipe3_disable_clocks(phy);278281279282 return 0;280283}···307306 return -ENOMEM;308307309308 phy->dev = &pdev->dev;310310- spin_lock_init(&phy->lock);311309312310 if (!of_device_is_compatible(node, "ti,phy-pipe3-pcie")) {313311 match = of_match_device(ti_pipe3_id_table, &pdev->dev);···402402403403 platform_set_drvdata(pdev, phy);404404 pm_runtime_enable(phy->dev);405405+ /* Prevent auto-disable of refclk for SATA PHY due to Errata i783 */406406+ if (of_device_is_compatible(node, "ti,phy-pipe3-sata"))407407+ if (!IS_ERR(phy->refclk))408408+ clk_prepare_enable(phy->refclk);405409406410 generic_phy = devm_phy_create(phy->dev, NULL, &ops);407411 if (IS_ERR(generic_phy))···417413 if (IS_ERR(phy_provider))418414 return PTR_ERR(phy_provider);419415420420- pm_runtime_get(&pdev->dev);421421-422416 return 0;423417}424418425419static int ti_pipe3_remove(struct platform_device *pdev)426420{427427- if (!pm_runtime_suspended(&pdev->dev))428428- pm_runtime_put(&pdev->dev);429421 pm_runtime_disable(&pdev->dev);430422431423 return 0;432424}433425434434-#ifdef CONFIG_PM435435-static int ti_pipe3_enable_refclk(struct ti_pipe3 *phy)426426+static int ti_pipe3_enable_clocks(struct ti_pipe3 *phy)436427{437437- if (!IS_ERR(phy->refclk) && !phy->refclk_enabled) {438438- int ret;428428+ int ret = 0;439429430430+ if (!IS_ERR(phy->refclk)) {440431 ret = clk_prepare_enable(phy->refclk);441432 if (ret) {442433 dev_err(phy->dev, "Failed to enable refclk %d\n", ret);443434 return ret;444435 }445445- phy->refclk_enabled = true;446436 }447447-448448- return 0;449449-}450450-451451-static void ti_pipe3_disable_refclk(struct ti_pipe3 *phy)452452-{453453- if (!IS_ERR(phy->refclk))454454- clk_disable_unprepare(phy->refclk);455455-456456- phy->refclk_enabled = false;457457-}458458-459459-static int ti_pipe3_enable_clocks(struct ti_pipe3 *phy)460460-{461461- int ret = 0;462462- unsigned long flags;463463-464464- spin_lock_irqsave(&phy->lock, flags);465465- if (phy->enabled)466466- goto err1;467467-468468- ret = ti_pipe3_enable_refclk(phy);469469- if (ret)470470- goto err1;471437472438 if (!IS_ERR(phy->wkupclk)) {473439 ret = clk_prepare_enable(phy->wkupclk);474440 if (ret) {475441 dev_err(phy->dev, "Failed to enable wkupclk %d\n", ret);476476- goto err2;442442+ goto disable_refclk;477443 }478444 }479445···451477 ret = clk_prepare_enable(phy->div_clk);452478 if (ret) {453479 dev_err(phy->dev, "Failed to enable div_clk %d\n", ret);454454- goto err3;480480+ goto disable_wkupclk;455481 }456482 }457483458458- phy->enabled = true;459459- spin_unlock_irqrestore(&phy->lock, flags);460484 return 0;461485462462-err3:486486+disable_wkupclk:463487 if (!IS_ERR(phy->wkupclk))464488 clk_disable_unprepare(phy->wkupclk);465489466466-err2:490490+disable_refclk:467491 if (!IS_ERR(phy->refclk))468492 clk_disable_unprepare(phy->refclk);469493470470- ti_pipe3_disable_refclk(phy);471471-err1:472472- spin_unlock_irqrestore(&phy->lock, flags);473494 return ret;474495}475496476497static void ti_pipe3_disable_clocks(struct ti_pipe3 *phy)477498{478478- unsigned long flags;479479-480480- spin_lock_irqsave(&phy->lock, flags);481481- if (!phy->enabled) {482482- spin_unlock_irqrestore(&phy->lock, flags);483483- return;484484- }485485-486499 if (!IS_ERR(phy->wkupclk))487500 clk_disable_unprepare(phy->wkupclk);488488- /* Don't disable refclk for SATA PHY due to Errata i783 */489489- if (!of_device_is_compatible(phy->dev->of_node, "ti,phy-pipe3-sata"))490490- ti_pipe3_disable_refclk(phy);501501+ if (!IS_ERR(phy->refclk))502502+ clk_disable_unprepare(phy->refclk);491503 if (!IS_ERR(phy->div_clk))492504 clk_disable_unprepare(phy->div_clk);493493- phy->enabled = false;494494- spin_unlock_irqrestore(&phy->lock, flags);495505}496496-497497-static int ti_pipe3_runtime_suspend(struct device *dev)498498-{499499- struct ti_pipe3 *phy = dev_get_drvdata(dev);500500-501501- ti_pipe3_disable_clocks(phy);502502- return 0;503503-}504504-505505-static int ti_pipe3_runtime_resume(struct device *dev)506506-{507507- struct ti_pipe3 *phy = dev_get_drvdata(dev);508508- int ret = 0;509509-510510- ret = ti_pipe3_enable_clocks(phy);511511- return ret;512512-}513513-514514-static int ti_pipe3_suspend(struct device *dev)515515-{516516- struct ti_pipe3 *phy = dev_get_drvdata(dev);517517-518518- ti_pipe3_disable_clocks(phy);519519- return 0;520520-}521521-522522-static int ti_pipe3_resume(struct device *dev)523523-{524524- struct ti_pipe3 *phy = dev_get_drvdata(dev);525525- int ret;526526-527527- ret = ti_pipe3_enable_clocks(phy);528528- if (ret)529529- return ret;530530-531531- pm_runtime_disable(dev);532532- pm_runtime_set_active(dev);533533- pm_runtime_enable(dev);534534- return 0;535535-}536536-#endif537537-538538-static const struct dev_pm_ops ti_pipe3_pm_ops = {539539- SET_RUNTIME_PM_OPS(ti_pipe3_runtime_suspend,540540- ti_pipe3_runtime_resume, NULL)541541- SET_SYSTEM_SLEEP_PM_OPS(ti_pipe3_suspend, ti_pipe3_resume)542542-};543506544507static const struct of_device_id ti_pipe3_id_table[] = {545508 {···503592 .remove = ti_pipe3_remove,504593 .driver = {505594 .name = "ti-pipe3",506506- .pm = &ti_pipe3_pm_ops,507595 .of_match_table = ti_pipe3_id_table,508596 },509597};
+2
drivers/pinctrl/bcm/pinctrl-bcm2835.c
···473473474474 spin_lock_irqsave(&pc->irq_lock[bank], flags);475475 bcm2835_gpio_irq_config(pc, gpio, false);476476+ /* Clear events that were latched prior to clearing event sources */477477+ bcm2835_gpio_set_bit(pc, GPEDS0, gpio);476478 clear_bit(offset, &pc->enabled_irq_map[bank]);477479 spin_unlock_irqrestore(&pc->irq_lock[bank], flags);478480}
+1-2
drivers/pinctrl/freescale/pinctrl-imx1-core.c
···403403 unsigned num_configs)404404{405405 struct imx1_pinctrl *ipctl = pinctrl_dev_get_drvdata(pctldev);406406- const struct imx1_pinctrl_soc_info *info = ipctl->info;407406 int i;408407409408 for (i = 0; i != num_configs; ++i) {410409 imx1_write_bit(ipctl, pin_id, configs[i] & 0x01, MX1_PUEN);411410412411 dev_dbg(ipctl->dev, "pinconf set pullup pin %s\n",413413- info->pins[pin_id].name);412412+ pin_desc_get(pctldev, pin_id)->name);414413 }415414416415 return 0;
···3434#include <linux/mfd/samsung/s2mps14.h>3535#include <linux/mfd/samsung/s2mpu02.h>36363737+/* The highest number of possible regulators for supported devices. */3838+#define S2MPS_REGULATOR_MAX S2MPS13_REGULATOR_MAX3739struct s2mps11_info {3840 unsigned int rdev_num;3941 int ramp_delay2;···5149 * One bit for each S2MPS13/S2MPS14/S2MPU02 regulator whether5250 * the suspend mode was enabled.5351 */5454- unsigned long long s2mps14_suspend_state:50;5252+ DECLARE_BITMAP(suspend_state, S2MPS_REGULATOR_MAX);55535654 /* Array of size rdev_num with GPIO-s for external sleep control */5755 int *ext_control_gpio;···502500 switch (s2mps11->dev_type) {503501 case S2MPS13X:504502 case S2MPS14X:505505- if (s2mps11->s2mps14_suspend_state & (1 << rdev_get_id(rdev)))503503+ if (test_bit(rdev_get_id(rdev), s2mps11->suspend_state))506504 val = S2MPS14_ENABLE_SUSPEND;507505 else if (gpio_is_valid(s2mps11->ext_control_gpio[rdev_get_id(rdev)]))508506 val = S2MPS14_ENABLE_EXT_CONTROL;···510508 val = rdev->desc->enable_mask;511509 break;512510 case S2MPU02:513513- if (s2mps11->s2mps14_suspend_state & (1 << rdev_get_id(rdev)))511511+ if (test_bit(rdev_get_id(rdev), s2mps11->suspend_state))514512 val = S2MPU02_ENABLE_SUSPEND;515513 else516514 val = rdev->desc->enable_mask;···564562 if (ret < 0)565563 return ret;566564567567- s2mps11->s2mps14_suspend_state |= (1 << rdev_get_id(rdev));565565+ set_bit(rdev_get_id(rdev), s2mps11->suspend_state);568566 /*569567 * Don't enable suspend mode if regulator is already disabled because570568 * this would effectively for a short time turn on the regulator after···962960 case S2MPS11X:963961 s2mps11->rdev_num = ARRAY_SIZE(s2mps11_regulators);964962 regulators = s2mps11_regulators;963963+ BUILD_BUG_ON(S2MPS_REGULATOR_MAX < s2mps11->rdev_num);965964 break;966965 case S2MPS13X:967966 s2mps11->rdev_num = ARRAY_SIZE(s2mps13_regulators);968967 regulators = s2mps13_regulators;968968+ BUILD_BUG_ON(S2MPS_REGULATOR_MAX < s2mps11->rdev_num);969969 break;970970 case S2MPS14X:971971 s2mps11->rdev_num = ARRAY_SIZE(s2mps14_regulators);972972 regulators = s2mps14_regulators;973973+ BUILD_BUG_ON(S2MPS_REGULATOR_MAX < s2mps11->rdev_num);973974 break;974975 case S2MPU02:975976 s2mps11->rdev_num = ARRAY_SIZE(s2mpu02_regulators);976977 regulators = s2mpu02_regulators;978978+ BUILD_BUG_ON(S2MPS_REGULATOR_MAX < s2mps11->rdev_num);977979 break;978980 default:979981 dev_err(&pdev->dev, "Invalid device type: %u\n",
+1-1
drivers/s390/Makefile
···22# Makefile for the S/390 specific device drivers33#4455-obj-y += cio/ block/ char/ crypto/ net/ scsi/ kvm/55+obj-y += cio/ block/ char/ crypto/ net/ scsi/ virtio/6677drivers-y += drivers/s390/built-in.o88
···11851185config SERIAL_SC16IS7XX11861186 tristate "SC16IS7xx serial support"11871187 select SERIAL_CORE11881188- depends on I2C || SPI_MASTER11881188+ depends on (SPI_MASTER && !I2C) || I2C11891189 help11901190 This selects support for SC16IS7xx serial ports.11911191 Supported ICs are SC16IS740, SC16IS741, SC16IS750, SC16IS752,
+2-2
drivers/tty/serial/amba-pl011.c
···23102310 void __iomem *base;2311231123122312 base = devm_ioremap_resource(dev, mmiobase);23132313- if (!base)23142314- return -ENOMEM;23132313+ if (IS_ERR(base))23142314+ return PTR_ERR(base);2315231523162316 index = pl011_probe_dt_alias(index, dev);23172317
···122122 return usb_get_intfdata(hdev->actconfig->interface[0]);123123}124124125125-static int usb_device_supports_lpm(struct usb_device *udev)125125+int usb_device_supports_lpm(struct usb_device *udev)126126{127127 /* USB 2.1 (and greater) devices indicate LPM support through128128 * their USB 2.0 Extended Capabilities BOS descriptor.
+1
drivers/usb/core/usb.h
···6565extern void usb_hub_cleanup(void);6666extern int usb_major_init(void);6767extern void usb_major_cleanup(void);6868+extern int usb_device_supports_lpm(struct usb_device *udev);68696970#ifdef CONFIG_PM7071
+4
drivers/usb/dwc3/ep0.c
···727727 dwc3_trace(trace_dwc3_ep0, "USB_REQ_SET_ISOCH_DELAY");728728 ret = dwc3_ep0_set_isoch_delay(dwc, ctrl);729729 break;730730+ case USB_REQ_SET_INTERFACE:731731+ dwc3_trace(trace_dwc3_ep0, "USB_REQ_SET_INTERFACE");732732+ dwc->start_config_issued = false;733733+ /* Fall through */730734 default:731735 dwc3_trace(trace_dwc3_ep0, "Forwarding to gadget driver");732736 ret = dwc3_ep0_delegate_req(dwc, ctrl);
···981981 int completed, modified;982982 __hc32 *prev;983983984984- /* Is this ED already invisible to the hardware? */985985- if (ed->state == ED_IDLE)986986- goto ed_idle;987987-988984 /* only take off EDs that the HC isn't using, accounting for989985 * frame counter wraps and EDs with partially retired TDs990986 */···10081012 }1009101310101014 /* ED's now officially unlinked, hc doesn't see */10111011- ed->state = ED_IDLE;10121015 ed->hwHeadP &= ~cpu_to_hc32(ohci, ED_H);10131016 ed->hwNextED = 0;10141017 wmb();10151018 ed->hwINFO &= ~cpu_to_hc32(ohci, ED_SKIP | ED_DEQUEUE);10161016-ed_idle:1017101910181020 /* reentrancy: if we drop the schedule lock, someone might10191021 * have modified this list. normally it's just prepending···10821088 if (list_empty(&ed->td_list)) {10831089 *last = ed->ed_next;10841090 ed->ed_next = NULL;10911091+ ed->state = ED_IDLE;10851092 list_del(&ed->in_use_list);10861093 } else if (ohci->rh_state == OHCI_RH_RUNNING) {10871094 *last = ed->ed_next;
···484484 u32 pls = status_reg & PORT_PLS_MASK;485485486486 /* resume state is a xHCI internal state.487487- * Do not report it to usb core.487487+ * Do not report it to usb core, instead, pretend to be U3,488488+ * thus usb core knows it's not ready for transfer488489 */489489- if (pls == XDEV_RESUME)490490+ if (pls == XDEV_RESUME) {491491+ *status |= USB_SS_PORT_LS_U3;490492 return;493493+ }491494492495 /* When the CAS bit is set then warm reset493496 * should be performed on port···591588 status |= USB_PORT_STAT_C_RESET << 16;592589 /* USB3.0 only */593590 if (hcd->speed == HCD_USB3) {594594- if ((raw_port_status & PORT_PLC))591591+ /* Port link change with port in resume state should not be592592+ * reported to usbcore, as this is an internal state to be593593+ * handled by xhci driver. Reporting PLC to usbcore may594594+ * cause usbcore clearing PLC first and port change event595595+ * irq won't be generated.596596+ */597597+ if ((raw_port_status & PORT_PLC) &&598598+ (raw_port_status & PORT_PLS_MASK) != XDEV_RESUME)595599 status |= USB_PORT_STAT_C_LINK_STATE << 16;596600 if ((raw_port_status & PORT_WRC))597601 status |= USB_PORT_STAT_C_BH_RESET << 16;···11301120 spin_lock_irqsave(&xhci->lock, flags);1131112111321122 if (hcd->self.root_hub->do_remote_wakeup) {11331133- if (bus_state->resuming_ports) {11231123+ if (bus_state->resuming_ports || /* USB2 */11241124+ bus_state->port_remote_wakeup) { /* USB3 */11341125 spin_unlock_irqrestore(&xhci->lock, flags);11351135- xhci_dbg(xhci, "suspend failed because "11361136- "a port is resuming\n");11261126+ xhci_dbg(xhci, "suspend failed because a port is resuming\n");11371127 return -EBUSY;11381128 }11391129 }
+1-1
drivers/usb/host/xhci-mem.c
···14271427 /* Attempt to use the ring cache */14281428 if (virt_dev->num_rings_cached == 0)14291429 return -ENOMEM;14301430+ virt_dev->num_rings_cached--;14301431 virt_dev->eps[ep_index].new_ring =14311432 virt_dev->ring_cache[virt_dev->num_rings_cached];14321433 virt_dev->ring_cache[virt_dev->num_rings_cached] = NULL;14331433- virt_dev->num_rings_cached--;14341434 xhci_reinit_cached_ring(xhci, virt_dev->eps[ep_index].new_ring,14351435 1, type);14361436 }
+54-3
drivers/usb/host/xhci-pci.c
···2323#include <linux/pci.h>2424#include <linux/slab.h>2525#include <linux/module.h>2626+#include <linux/acpi.h>26272728#include "xhci.h"2829#include "xhci-trace.h"3030+3131+#define PORT2_SSIC_CONFIG_REG2 0x883c3232+#define PROG_DONE (1 << 30)3333+#define SSIC_PORT_UNUSED (1 << 31)29343035/* Device for a quirk */3136#define PCI_VENDOR_ID_FRESCO_LOGIC 0x1b73···181176}182177183178/*179179+ * In some Intel xHCI controllers, in order to get D3 working,180180+ * through a vendor specific SSIC CONFIG register at offset 0x883c,181181+ * SSIC PORT need to be marked as "unused" before putting xHCI182182+ * into D3. After D3 exit, the SSIC port need to be marked as "used".183183+ * Without this change, xHCI might not enter D3 state.184184 * Make sure PME works on some Intel xHCI controllers by writing 1 to clear185185 * the Internal PME flag bit in vendor specific PMCTRL register at offset 0x80a4186186 */187187-static void xhci_pme_quirk(struct xhci_hcd *xhci)187187+static void xhci_pme_quirk(struct usb_hcd *hcd, bool suspend)188188{189189+ struct xhci_hcd *xhci = hcd_to_xhci(hcd);190190+ struct pci_dev *pdev = to_pci_dev(hcd->self.controller);189191 u32 val;190192 void __iomem *reg;193193+194194+ if (pdev->vendor == PCI_VENDOR_ID_INTEL &&195195+ pdev->device == PCI_DEVICE_ID_INTEL_CHERRYVIEW_XHCI) {196196+197197+ reg = (void __iomem *) xhci->cap_regs + PORT2_SSIC_CONFIG_REG2;198198+199199+ /* Notify SSIC that SSIC profile programming is not done */200200+ val = readl(reg) & ~PROG_DONE;201201+ writel(val, reg);202202+203203+ /* Mark SSIC port as unused(suspend) or used(resume) */204204+ val = readl(reg);205205+ if (suspend)206206+ val |= SSIC_PORT_UNUSED;207207+ else208208+ val &= ~SSIC_PORT_UNUSED;209209+ writel(val, reg);210210+211211+ /* Notify SSIC that SSIC profile programming is done */212212+ val = readl(reg) | PROG_DONE;213213+ writel(val, reg);214214+ readl(reg);215215+ }191216192217 reg = (void __iomem *) xhci->cap_regs + 0x80a4;193218 val = readl(reg);194219 writel(val | BIT(28), reg);195220 readl(reg);196221}222222+223223+#ifdef CONFIG_ACPI224224+static void xhci_pme_acpi_rtd3_enable(struct pci_dev *dev)225225+{226226+ static const u8 intel_dsm_uuid[] = {227227+ 0xb7, 0x0c, 0x34, 0xac, 0x01, 0xe9, 0xbf, 0x45,228228+ 0xb7, 0xe6, 0x2b, 0x34, 0xec, 0x93, 0x1e, 0x23,229229+ };230230+ acpi_evaluate_dsm(ACPI_HANDLE(&dev->dev), intel_dsm_uuid, 3, 1, NULL);231231+}232232+#else233233+ static void xhci_pme_acpi_rtd3_enable(struct pci_dev *dev) { }234234+#endif /* CONFIG_ACPI */197235198236/* called during probe() after chip reset completes */199237static int xhci_pci_setup(struct usb_hcd *hcd)···311263 HCC_MAX_PSA(xhci->hcc_params) >= 4)312264 xhci->shared_hcd->can_do_streams = 1;313265266266+ if (xhci->quirks & XHCI_PME_STUCK_QUIRK)267267+ xhci_pme_acpi_rtd3_enable(dev);268268+314269 /* USB-2 and USB-3 roothubs initialized, allow runtime pm suspend */315270 pm_runtime_put_noidle(&dev->dev);316271···358307 pdev->no_d3cold = true;359308360309 if (xhci->quirks & XHCI_PME_STUCK_QUIRK)361361- xhci_pme_quirk(xhci);310310+ xhci_pme_quirk(hcd, true);362311363312 return xhci_suspend(xhci, do_wakeup);364313}···391340 usb_enable_intel_xhci_ports(pdev);392341393342 if (xhci->quirks & XHCI_PME_STUCK_QUIRK)394394- xhci_pme_quirk(xhci);343343+ xhci_pme_quirk(hcd, false);395344396345 retval = xhci_resume(xhci, hibernated);397346 return retval;
+3
drivers/usb/host/xhci-ring.c
···15461546 usb_hcd_resume_root_hub(hcd);15471547 }1548154815491549+ if (hcd->speed == HCD_USB3 && (temp & PORT_PLS_MASK) == XDEV_INACTIVE)15501550+ bus_state->port_remote_wakeup &= ~(1 << faked_port_index);15511551+15491552 if ((temp & PORT_PLC) && (temp & PORT_PLS_MASK) == XDEV_RESUME) {15501553 xhci_dbg(xhci, "port resume event for port %d\n", port_id);15511554
+3
drivers/usb/host/xhci.c
···34533453 return -EINVAL;34543454 }3455345534563456+ if (virt_dev->tt_info)34573457+ old_active_eps = virt_dev->tt_info->active_eps;34583458+34563459 if (virt_dev->udev != udev) {34573460 /* If the virt_dev and the udev does not match, this virt_dev34583461 * may belong to another udev.
+1
drivers/usb/host/xhci.h
···285285#define XDEV_U0 (0x0 << 5)286286#define XDEV_U2 (0x2 << 5)287287#define XDEV_U3 (0x3 << 5)288288+#define XDEV_INACTIVE (0x6 << 5)288289#define XDEV_RESUME (0xf << 5)289290/* true: port has power (see HCC_PPC) */290291#define PORT_POWER (1 << 9)
+23
drivers/usb/storage/unusual_devs.h
···20652065 USB_SC_DEVICE, USB_PR_DEVICE, NULL,20662066 US_FL_NO_READ_DISC_INFO ),2067206720682068+/* Reported by Oliver Neukum <oneukum@suse.com>20692069+ * This device morphes spontaneously into another device if the access20702070+ * pattern of Windows isn't followed. Thus writable media would be dirty20712071+ * if the initial instance is used. So the device is limited to its20722072+ * virtual CD.20732073+ * And yes, the concept that BCD goes up to 9 is not heeded */20742074+UNUSUAL_DEV( 0x19d2, 0x1225, 0x0000, 0xffff,20752075+ "ZTE,Incorporated",20762076+ "ZTE WCDMA Technologies MSM",20772077+ USB_SC_DEVICE, USB_PR_DEVICE, NULL,20782078+ US_FL_SINGLE_LUN ),20792079+20682080/* Reported by Sven Geggus <sven-usbst@geggus.net>20692081 * This encrypted pen drive returns bogus data for the initial READ(10).20702082 */···20852073 "Padlock v2",20862074 USB_SC_DEVICE, USB_PR_DEVICE, NULL,20872075 US_FL_INITIAL_READ10 ),20762076+20772077+/* Reported by Hans de Goede <hdegoede@redhat.com>20782078+ * These are mini projectors using USB for both power and video data transport20792079+ * The usb-storage interface is a virtual windows driver CD, which the gm12u32020802080+ * driver automatically converts into framebuffer & kms dri device nodes.20812081+ */20822082+UNUSUAL_DEV( 0x1de1, 0xc102, 0x0000, 0xffff,20832083+ "Grain-media Technology Corp.",20842084+ "USB3.0 Device GM12U320",20852085+ USB_SC_DEVICE, USB_PR_DEVICE, NULL,20862086+ US_FL_IGNORE_DEVICE ),2088208720892088/* Patch by Richard Schütz <r.schtz@t-online.de>20902089 * This external hard drive enclosure uses a JMicron chip which
+51-16
drivers/vhost/vhost.c
···2222#include <linux/file.h>2323#include <linux/highmem.h>2424#include <linux/slab.h>2525+#include <linux/vmalloc.h>2526#include <linux/kthread.h>2627#include <linux/cgroup.h>2728#include <linux/module.h>2929+#include <linux/sort.h>28302931#include "vhost.h"30323333+static ushort max_mem_regions = 64;3434+module_param(max_mem_regions, ushort, 0444);3535+MODULE_PARM_DESC(max_mem_regions,3636+ "Maximum number of memory regions in memory map. (default: 64)");3737+3138enum {3232- VHOST_MEMORY_MAX_NREGIONS = 64,3339 VHOST_MEMORY_F_LOG = 0x1,3440};3541···549543 fput(dev->log_file);550544 dev->log_file = NULL;551545 /* No one will access memory at this point */552552- kfree(dev->memory);546546+ kvfree(dev->memory);553547 dev->memory = NULL;554548 WARN_ON(!list_empty(&dev->work_list));555549 if (dev->worker) {···669663}670664EXPORT_SYMBOL_GPL(vhost_vq_access_ok);671665666666+static int vhost_memory_reg_sort_cmp(const void *p1, const void *p2)667667+{668668+ const struct vhost_memory_region *r1 = p1, *r2 = p2;669669+ if (r1->guest_phys_addr < r2->guest_phys_addr)670670+ return 1;671671+ if (r1->guest_phys_addr > r2->guest_phys_addr)672672+ return -1;673673+ return 0;674674+}675675+676676+static void *vhost_kvzalloc(unsigned long size)677677+{678678+ void *n = kzalloc(size, GFP_KERNEL | __GFP_NOWARN | __GFP_REPEAT);679679+680680+ if (!n) {681681+ n = vzalloc(size);682682+ if (!n)683683+ return ERR_PTR(-ENOMEM);684684+ }685685+ return n;686686+}687687+672688static long vhost_set_memory(struct vhost_dev *d, struct vhost_memory __user *m)673689{674690 struct vhost_memory mem, *newmem, *oldmem;···701673 return -EFAULT;702674 if (mem.padding)703675 return -EOPNOTSUPP;704704- if (mem.nregions > VHOST_MEMORY_MAX_NREGIONS)676676+ if (mem.nregions > max_mem_regions)705677 return -E2BIG;706706- newmem = kmalloc(size + mem.nregions * sizeof *m->regions, GFP_KERNEL);678678+ newmem = vhost_kvzalloc(size + mem.nregions * sizeof(*m->regions));707679 if (!newmem)708680 return -ENOMEM;709681710682 memcpy(newmem, &mem, size);711683 if (copy_from_user(newmem->regions, m->regions,712684 mem.nregions * sizeof *m->regions)) {713713- kfree(newmem);685685+ kvfree(newmem);714686 return -EFAULT;715687 }688688+ sort(newmem->regions, newmem->nregions, sizeof(*newmem->regions),689689+ vhost_memory_reg_sort_cmp, NULL);716690717691 if (!memory_access_ok(d, newmem, 0)) {718718- kfree(newmem);692692+ kvfree(newmem);719693 return -EFAULT;720694 }721695 oldmem = d->memory;···729699 d->vqs[i]->memory = newmem;730700 mutex_unlock(&d->vqs[i]->mutex);731701 }732732- kfree(oldmem);702702+ kvfree(oldmem);733703 return 0;734704}735705···1022992static const struct vhost_memory_region *find_region(struct vhost_memory *mem,1023993 __u64 addr, __u32 len)1024994{10251025- struct vhost_memory_region *reg;10261026- int i;995995+ const struct vhost_memory_region *reg;996996+ int start = 0, end = mem->nregions;102799710281028- /* linear search is not brilliant, but we really have on the order of 610291029- * regions in practice */10301030- for (i = 0; i < mem->nregions; ++i) {10311031- reg = mem->regions + i;10321032- if (reg->guest_phys_addr <= addr &&10331033- reg->guest_phys_addr + reg->memory_size - 1 >= addr)10341034- return reg;998998+ while (start < end) {999999+ int slot = start + (end - start) / 2;10001000+ reg = mem->regions + slot;10011001+ if (addr >= reg->guest_phys_addr)10021002+ end = slot;10031003+ else10041004+ start = slot + 1;10351005 }10061006+10071007+ reg = mem->regions + start;10081008+ if (addr >= reg->guest_phys_addr &&10091009+ reg->guest_phys_addr + reg->memory_size > addr)10101010+ return reg;10361011 return NULL;10371012}10381013
+1
fs/fs-writeback.c
···702702 else703703 wbc->wb_tcand_bytes -= min(bytes, wbc->wb_tcand_bytes);704704}705705+EXPORT_SYMBOL_GPL(wbc_account_io);705706706707/**707708 * inode_congested - test whether an inode is congested
+33-9
fs/namespace.c
···13611361 UMOUNT_PROPAGATE = 2,13621362 UMOUNT_CONNECTED = 4,13631363};13641364+13651365+static bool disconnect_mount(struct mount *mnt, enum umount_tree_flags how)13661366+{13671367+ /* Leaving mounts connected is only valid for lazy umounts */13681368+ if (how & UMOUNT_SYNC)13691369+ return true;13701370+13711371+ /* A mount without a parent has nothing to be connected to */13721372+ if (!mnt_has_parent(mnt))13731373+ return true;13741374+13751375+ /* Because the reference counting rules change when mounts are13761376+ * unmounted and connected, umounted mounts may not be13771377+ * connected to mounted mounts.13781378+ */13791379+ if (!(mnt->mnt_parent->mnt.mnt_flags & MNT_UMOUNT))13801380+ return true;13811381+13821382+ /* Has it been requested that the mount remain connected? */13831383+ if (how & UMOUNT_CONNECTED)13841384+ return false;13851385+13861386+ /* Is the mount locked such that it needs to remain connected? */13871387+ if (IS_MNT_LOCKED(mnt))13881388+ return false;13891389+13901390+ /* By default disconnect the mount */13911391+ return true;13921392+}13931393+13641394/*13651395 * mount_lock must be held13661396 * namespace_sem must be held for write···14281398 if (how & UMOUNT_SYNC)14291399 p->mnt.mnt_flags |= MNT_SYNC_UMOUNT;1430140014311431- disconnect = !(((how & UMOUNT_CONNECTED) &&14321432- mnt_has_parent(p) &&14331433- (p->mnt_parent->mnt.mnt_flags & MNT_UMOUNT)) ||14341434- IS_MNT_LOCKED_AND_LAZY(p));14011401+ disconnect = disconnect_mount(p, how);1435140214361403 pin_insert_group(&p->mnt_umount, &p->mnt_parent->mnt,14371404 disconnect ? &unmounted : NULL);···15651538 while (!hlist_empty(&mp->m_list)) {15661539 mnt = hlist_entry(mp->m_list.first, struct mount, mnt_mp_list);15671540 if (mnt->mnt.mnt_flags & MNT_UMOUNT) {15681568- struct mount *p, *tmp;15691569- list_for_each_entry_safe(p, tmp, &mnt->mnt_mounts, mnt_child) {15701570- hlist_add_head(&p->mnt_umount.s_list, &unmounted);15711571- umount_mnt(p);15721572- }15411541+ hlist_add_head(&mnt->mnt_umount.s_list, &unmounted);15421542+ umount_mnt(mnt);15731543 }15741544 else umount_tree(mnt, UMOUNT_CONNECTED);15751545 }
+20-14
fs/notify/mark.c
···152152 BUG();153153154154 list_del_init(&mark->g_list);155155+155156 spin_unlock(&mark->lock);156157157158 if (inode && (mark->flags & FSNOTIFY_MARK_FLAG_OBJECT_PINNED))158159 iput(inode);160160+ /* release lock temporarily */161161+ mutex_unlock(&group->mark_mutex);159162160163 spin_lock(&destroy_lock);161164 list_add(&mark->g_list, &destroy_list);162165 spin_unlock(&destroy_lock);163166 wake_up(&destroy_waitq);167167+ /*168168+ * We don't necessarily have a ref on mark from caller so the above destroy169169+ * may have actually freed it, unless this group provides a 'freeing_mark'170170+ * function which must be holding a reference.171171+ */172172+173173+ /*174174+ * Some groups like to know that marks are being freed. This is a175175+ * callback to the group function to let it know that this mark176176+ * is being freed.177177+ */178178+ if (group->ops->freeing_mark)179179+ group->ops->freeing_mark(mark, group);164180165181 /*166182 * __fsnotify_update_child_dentry_flags(inode);···191175 */192176193177 atomic_dec(&group->num_marks);178178+179179+ mutex_lock_nested(&group->mark_mutex, SINGLE_DEPTH_NESTING);194180}195181196182void fsnotify_destroy_mark(struct fsnotify_mark *mark,···205187206188/*207189 * Destroy all marks in the given list. The marks must be already detached from208208- * the original inode / vfsmount. Note that we can race with209209- * fsnotify_clear_marks_by_group_flags(). However we hold a reference to each210210- * mark so they won't get freed from under us and nobody else touches our211211- * free_list list_head.190190+ * the original inode / vfsmount.212191 */213192void fsnotify_destroy_marks(struct list_head *to_free)214193{···406391}407392408393/*409409- * Clear any marks in a group in which mark->flags & flags is true.394394+ * clear any marks in a group in which mark->flags & flags is true410395 */411396void fsnotify_clear_marks_by_group_flags(struct fsnotify_group *group,412397 unsigned int flags)···460445{461446 struct fsnotify_mark *mark, *next;462447 struct list_head private_destroy_list;463463- struct fsnotify_group *group;464448465449 for (;;) {466450 spin_lock(&destroy_lock);···471457472458 list_for_each_entry_safe(mark, next, &private_destroy_list, g_list) {473459 list_del_init(&mark->g_list);474474- group = mark->group;475475- /*476476- * Some groups like to know that marks are being freed.477477- * This is a callback to the group function to let it478478- * know that this mark is being freed.479479- */480480- if (group && group->ops->freeing_mark)481481- group->ops->freeing_mark(mark, group);482460 fsnotify_put_mark(mark);483461 }484462
···116116 * SAVE_REGS. If another ops with this flag set is already registered117117 * for any of the functions that this ops will be registered for, then118118 * this ops will fail to register or set_filter_ip.119119+ * PID - Is affected by set_ftrace_pid (allows filtering on those pids)119120 */120121enum {121122 FTRACE_OPS_FL_ENABLED = 1 << 0,···133132 FTRACE_OPS_FL_MODIFYING = 1 << 11,134133 FTRACE_OPS_FL_ALLOC_TRAMP = 1 << 12,135134 FTRACE_OPS_FL_IPMODIFY = 1 << 13,135135+ FTRACE_OPS_FL_PID = 1 << 14,136136};137137138138#ifdef CONFIG_DYNAMIC_FTRACE···161159 struct ftrace_ops *next;162160 unsigned long flags;163161 void *private;162162+ ftrace_func_t saved_func;164163 int __percpu *disabled;165164#ifdef CONFIG_DYNAMIC_FTRACE166165 int nr_trampolines;
+2
include/linux/libata.h
···431431 ATA_HORKAGE_WD_BROKEN_LPM = (1 << 21), /* some WDs have broken LPM */432432 ATA_HORKAGE_ZERO_AFTER_TRIM = (1 << 22),/* guarantees zero after trim */433433 ATA_HORKAGE_NO_NCQ_LOG = (1 << 23), /* don't use NCQ for log read */434434+ ATA_HORKAGE_NOTRIM = (1 << 24), /* don't use TRIM */435435+ ATA_HORKAGE_MAX_SEC_1024 = (1 << 25), /* Limit max sects to 1024 */434436435437 /* DMA mask for user DMA control: User visible values; DO NOT436438 renumber */
+5-5
include/linux/mtd/nand.h
···178178/* Chip may not exist, so silence any errors in scan */179179#define NAND_SCAN_SILENT_NODEV 0x00040000180180/*181181- * This option could be defined by controller drivers to protect against182182- * kmap'ed, vmalloc'ed highmem buffers being passed from upper layers183183- */184184-#define NAND_USE_BOUNCE_BUFFER 0x00080000185185-/*186181 * Autodetect nand buswidth with readid/onfi.187182 * This suppose the driver will configure the hardware in 8 bits mode188183 * when calling nand_scan_ident, and update its configuration189184 * before calling nand_scan_tail.190185 */191186#define NAND_BUSWIDTH_AUTO 0x00080000187187+/*188188+ * This option could be defined by controller drivers to protect against189189+ * kmap'ed, vmalloc'ed highmem buffers being passed from upper layers190190+ */191191+#define NAND_USE_BOUNCE_BUFFER 0x00100000192192193193/* Options set by nand scan */194194/* Nand scan has allocated controller struct */
-1
include/linux/platform_data/mmc-esdhc-imx.h
···4343 enum wp_types wp_type;4444 enum cd_types cd_type;4545 int max_bus_width;4646- unsigned int f_max;4746 bool support_vsel;4847 unsigned int delay_line;4948};
+17
include/net/cfg80211.h
···48684868 struct cfg80211_chan_def *chandef,48694869 enum nl80211_iftype iftype);4870487048714871+/**48724872+ * cfg80211_reg_can_beacon_relax - check if beaconing is allowed with relaxation48734873+ * @wiphy: the wiphy48744874+ * @chandef: the channel definition48754875+ * @iftype: interface type48764876+ *48774877+ * Return: %true if there is no secondary channel or the secondary channel(s)48784878+ * can be used for beaconing (i.e. is not a radar channel etc.). This version48794879+ * also checks if IR-relaxation conditions apply, to allow beaconing under48804880+ * more permissive conditions.48814881+ *48824882+ * Requires the RTNL to be held.48834883+ */48844884+bool cfg80211_reg_can_beacon_relax(struct wiphy *wiphy,48854885+ struct cfg80211_chan_def *chandef,48864886+ enum nl80211_iftype iftype);48874887+48714888/*48724889 * cfg80211_ch_switch_notify - update wdev channel and notify userspace48734890 * @dev: the device which switched channels
···614614 uint32_t vram_type;615615 /** video memory bit width*/616616 uint32_t vram_bit_width;617617+ /* vce harvesting instance */618618+ uint32_t vce_harvest_config;617619};618620619621struct drm_amdgpu_info_hw_ip {
+8
include/uapi/drm/i915_drm.h
···10701070 __u64 offset;10711071 __u64 val; /* Return value */10721072};10731073+/* Known registers:10741074+ *10751075+ * Render engine timestamp - 0x2358 + 64bit - gen7+10761076+ * - Note this register returns an invalid value if using the default10771077+ * single instruction 8byte read, in order to workaround that use10781078+ * offset (0x2538 | 1) instead.10791079+ *10801080+ */1073108110741082struct drm_i915_reset_stats {10751083 __u32 ctx_id;
+16
include/uapi/linux/virtio_net.h
···3434/* The feature bitmap for virtio net */3535#define VIRTIO_NET_F_CSUM 0 /* Host handles pkts w/ partial csum */3636#define VIRTIO_NET_F_GUEST_CSUM 1 /* Guest handles pkts w/ partial csum */3737+#define VIRTIO_NET_F_CTRL_GUEST_OFFLOADS 2 /* Dynamic offload configuration. */3738#define VIRTIO_NET_F_MAC 5 /* Host has given MAC address. */3839#define VIRTIO_NET_F_GUEST_TSO4 7 /* Guest can handle TSOv4 in. */3940#define VIRTIO_NET_F_GUEST_TSO6 8 /* Guest can handle TSOv6 in. */···226225 #define VIRTIO_NET_CTRL_MQ_VQ_PAIRS_SET 0227226 #define VIRTIO_NET_CTRL_MQ_VQ_PAIRS_MIN 1228227 #define VIRTIO_NET_CTRL_MQ_VQ_PAIRS_MAX 0x8000228228+229229+/*230230+ * Control network offloads231231+ *232232+ * Reconfigures the network offloads that Guest can handle.233233+ *234234+ * Available with the VIRTIO_NET_F_CTRL_GUEST_OFFLOADS feature bit.235235+ *236236+ * Command data format matches the feature bit mask exactly.237237+ *238238+ * See VIRTIO_NET_F_GUEST_* for the list of offloads239239+ * that can be enabled/disabled.240240+ */241241+#define VIRTIO_NET_CTRL_GUEST_OFFLOADS 5242242+#define VIRTIO_NET_CTRL_GUEST_OFFLOADS_SET 0229243230244#endif /* _LINUX_VIRTIO_NET_H */
+6
include/uapi/linux/virtio_pci.h
···157157 __le32 queue_used_hi; /* read-write */158158};159159160160+/* Fields in VIRTIO_PCI_CAP_PCI_CFG: */161161+struct virtio_pci_cfg_cap {162162+ struct virtio_pci_cap cap;163163+ __u8 pci_cfg_data[4]; /* Data for BAR access. */164164+};165165+160166/* Macro versions of offsets for the Old Timers! */161167#define VIRTIO_PCI_CAP_VNDR 0162168#define VIRTIO_PCI_CAP_NEXT 1
···504504{505505 struct resource *p;506506 resource_size_t end = start + size - 1;507507- int flags = IORESOURCE_MEM | IORESOURCE_BUSY;507507+ unsigned long flags = IORESOURCE_MEM | IORESOURCE_BUSY;508508 const char *name = "System RAM";509509 int ret = -1;510510511511 read_lock(&resource_lock);512512 for (p = iomem_resource.child; p ; p = p->sibling) {513513- if (end < p->start)513513+ if (p->end < start)514514 continue;515515516516 if (p->start <= start && end <= p->end) {···521521 ret = 1;522522 break;523523 }524524- if (p->end < start)524524+ if (end < p->start)525525 break; /* not found */526526 }527527 read_unlock(&resource_lock);
+34-18
kernel/trace/ftrace.c
···9898 struct pid *pid;9999};100100101101+static bool ftrace_pids_enabled(void)102102+{103103+ return !list_empty(&ftrace_pids);104104+}105105+106106+static void ftrace_update_trampoline(struct ftrace_ops *ops);107107+101108/*102109 * ftrace_disabled is set when an anomaly is discovered.103110 * ftrace_disabled is much stronger than ftrace_enabled.···116109static struct ftrace_ops *ftrace_control_list __read_mostly = &ftrace_list_end;117110static struct ftrace_ops *ftrace_ops_list __read_mostly = &ftrace_list_end;118111ftrace_func_t ftrace_trace_function __read_mostly = ftrace_stub;119119-ftrace_func_t ftrace_pid_function __read_mostly = ftrace_stub;120112static struct ftrace_ops global_ops;121113static struct ftrace_ops control_ops;122114···189183 if (!test_tsk_trace_trace(current))190184 return;191185192192- ftrace_pid_function(ip, parent_ip, op, regs);193193-}194194-195195-static void set_ftrace_pid_function(ftrace_func_t func)196196-{197197- /* do not set ftrace_pid_function to itself! */198198- if (func != ftrace_pid_func)199199- ftrace_pid_function = func;186186+ op->saved_func(ip, parent_ip, op, regs);200187}201188202189/**···201202void clear_ftrace_function(void)202203{203204 ftrace_trace_function = ftrace_stub;204204- ftrace_pid_function = ftrace_stub;205205}206206207207static void control_ops_disable_all(struct ftrace_ops *ops)···434436 } else435437 add_ftrace_ops(&ftrace_ops_list, ops);436438439439+ /* Always save the function, and reset at unregistering */440440+ ops->saved_func = ops->func;441441+442442+ if (ops->flags & FTRACE_OPS_FL_PID && ftrace_pids_enabled())443443+ ops->func = ftrace_pid_func;444444+437445 ftrace_update_trampoline(ops);438446439447 if (ftrace_enabled)···467463 if (ftrace_enabled)468464 update_ftrace_function();469465466466+ ops->func = ops->saved_func;467467+470468 return 0;471469}472470473471static void ftrace_update_pid_func(void)474472{473473+ bool enabled = ftrace_pids_enabled();474474+ struct ftrace_ops *op;475475+475476 /* Only do something if we are tracing something */476477 if (ftrace_trace_function == ftrace_stub)477478 return;479479+480480+ do_for_each_ftrace_op(op, ftrace_ops_list) {481481+ if (op->flags & FTRACE_OPS_FL_PID) {482482+ op->func = enabled ? ftrace_pid_func :483483+ op->saved_func;484484+ ftrace_update_trampoline(op);485485+ }486486+ } while_for_each_ftrace_op(op);478487479488 update_ftrace_function();480489}···11501133 .local_hash.filter_hash = EMPTY_HASH,11511134 INIT_OPS_HASH(global_ops)11521135 .flags = FTRACE_OPS_FL_RECURSION_SAFE |11531153- FTRACE_OPS_FL_INITIALIZED,11361136+ FTRACE_OPS_FL_INITIALIZED |11371137+ FTRACE_OPS_FL_PID,11541138};1155113911561140/*···5041502350425024static struct ftrace_ops global_ops = {50435025 .func = ftrace_stub,50445044- .flags = FTRACE_OPS_FL_RECURSION_SAFE | FTRACE_OPS_FL_INITIALIZED,50265026+ .flags = FTRACE_OPS_FL_RECURSION_SAFE |50275027+ FTRACE_OPS_FL_INITIALIZED |50285028+ FTRACE_OPS_FL_PID,50455029};5046503050475031static int __init ftrace_nodyn_init(void)···51005080 if (WARN_ON(tr->ops->func != ftrace_stub))51015081 printk("ftrace ops had %pS for function\n",51025082 tr->ops->func);51035103- /* Only the top level instance does pid tracing */51045104- if (!list_empty(&ftrace_pids)) {51055105- set_ftrace_pid_function(func);51065106- func = ftrace_pid_func;51075107- }51085083 }51095084 tr->ops->func = func;51105085 tr->ops->private = tr;···53865371{53875372 mutex_lock(&ftrace_lock);5388537353895389- if (list_empty(&ftrace_pids) && (!*pos))53745374+ if (!ftrace_pids_enabled() && (!*pos))53905375 return (void *) 1;5391537653925377 return seq_list_start(&ftrace_pids, *pos);···56255610 .func = ftrace_stub,56265611 .flags = FTRACE_OPS_FL_RECURSION_SAFE |56275612 FTRACE_OPS_FL_INITIALIZED |56135613+ FTRACE_OPS_FL_PID |56285614 FTRACE_OPS_FL_STUB,56295615#ifdef FTRACE_GRAPH_TRAMP_ADDR56305616 .trampoline = FTRACE_GRAPH_TRAMP_ADDR,
···121121 * Copied from sock.c:sock_queue_rcv_skb(), but changed so packets are122122 * not dropped, but CAIF is sending flow off instead.123123 */124124-static int caif_queue_rcv_skb(struct sock *sk, struct sk_buff *skb)124124+static void caif_queue_rcv_skb(struct sock *sk, struct sk_buff *skb)125125{126126 int err;127127 unsigned long flags;128128 struct sk_buff_head *list = &sk->sk_receive_queue;129129 struct caifsock *cf_sk = container_of(sk, struct caifsock, sk);130130+ bool queued = false;130131131132 if (atomic_read(&sk->sk_rmem_alloc) + skb->truesize >=132133 (unsigned int)sk->sk_rcvbuf && rx_flow_is_on(cf_sk)) {···140139141140 err = sk_filter(sk, skb);142141 if (err)143143- return err;142142+ goto out;143143+144144 if (!sk_rmem_schedule(sk, skb, skb->truesize) && rx_flow_is_on(cf_sk)) {145145 set_rx_flow_off(cf_sk);146146 net_dbg_ratelimited("sending flow OFF due to rmem_schedule\n");···149147 }150148 skb->dev = NULL;151149 skb_set_owner_r(skb, sk);152152- /* Cache the SKB length before we tack it onto the receive153153- * queue. Once it is added it no longer belongs to us and154154- * may be freed by other threads of control pulling packets155155- * from the queue.156156- */157150 spin_lock_irqsave(&list->lock, flags);158158- if (!sock_flag(sk, SOCK_DEAD))151151+ queued = !sock_flag(sk, SOCK_DEAD);152152+ if (queued)159153 __skb_queue_tail(list, skb);160154 spin_unlock_irqrestore(&list->lock, flags);161161-162162- if (!sock_flag(sk, SOCK_DEAD))155155+out:156156+ if (queued)163157 sk->sk_data_ready(sk);164158 else165159 kfree_skb(skb);166166- return 0;167160}168161169162/* Packet Receive Callback function called from CAIF Stack */
+47-9
net/core/datagram.c
···131131 goto out;132132}133133134134+static int skb_set_peeked(struct sk_buff *skb)135135+{136136+ struct sk_buff *nskb;137137+138138+ if (skb->peeked)139139+ return 0;140140+141141+ /* We have to unshare an skb before modifying it. */142142+ if (!skb_shared(skb))143143+ goto done;144144+145145+ nskb = skb_clone(skb, GFP_ATOMIC);146146+ if (!nskb)147147+ return -ENOMEM;148148+149149+ skb->prev->next = nskb;150150+ skb->next->prev = nskb;151151+ nskb->prev = skb->prev;152152+ nskb->next = skb->next;153153+154154+ consume_skb(skb);155155+ skb = nskb;156156+157157+done:158158+ skb->peeked = 1;159159+160160+ return 0;161161+}162162+134163/**135164 * __skb_recv_datagram - Receive a datagram skbuff136165 * @sk: socket···194165struct sk_buff *__skb_recv_datagram(struct sock *sk, unsigned int flags,195166 int *peeked, int *off, int *err)196167{168168+ struct sk_buff_head *queue = &sk->sk_receive_queue;197169 struct sk_buff *skb, *last;170170+ unsigned long cpu_flags;198171 long timeo;199172 /*200173 * Caller is allowed not to check sk->sk_err before skb_recv_datagram()···215184 * Look at current nfs client by the way...216185 * However, this function was correct in any case. 8)217186 */218218- unsigned long cpu_flags;219219- struct sk_buff_head *queue = &sk->sk_receive_queue;220187 int _off = *off;221188222189 last = (struct sk_buff *)queue;···228199 _off -= skb->len;229200 continue;230201 }231231- skb->peeked = 1;202202+203203+ error = skb_set_peeked(skb);204204+ if (error)205205+ goto unlock_err;206206+232207 atomic_inc(&skb->users);233208 } else234209 __skb_unlink(skb, queue);···256223257224 return NULL;258225226226+unlock_err:227227+ spin_unlock_irqrestore(&queue->lock, cpu_flags);259228no_packet:260229 *err = error;261230 return NULL;···657622 !skb->csum_complete_sw)658623 netdev_rx_csum_fault(skb->dev);659624 }660660- skb->csum_valid = !sum;625625+ if (!skb_shared(skb))626626+ skb->csum_valid = !sum;661627 return sum;662628}663629EXPORT_SYMBOL(__skb_checksum_complete_head);···678642 netdev_rx_csum_fault(skb->dev);679643 }680644681681- /* Save full packet checksum */682682- skb->csum = csum;683683- skb->ip_summed = CHECKSUM_COMPLETE;684684- skb->csum_complete_sw = 1;685685- skb->csum_valid = !sum;645645+ if (!skb_shared(skb)) {646646+ /* Save full packet checksum */647647+ skb->csum = csum;648648+ skb->ip_summed = CHECKSUM_COMPLETE;649649+ skb->csum_complete_sw = 1;650650+ skb->csum_valid = !sum;651651+ }686652687653 return sum;688654}
+3-1
net/core/dst.c
···284284 int newrefcnt;285285286286 newrefcnt = atomic_dec_return(&dst->__refcnt);287287- WARN_ON(newrefcnt < 0);287287+ if (unlikely(newrefcnt < 0))288288+ net_warn_ratelimited("%s: dst:%p refcnt:%d\n",289289+ __func__, dst, newrefcnt);288290 if (unlikely(dst->flags & DST_NOCACHE) && !newrefcnt)289291 call_rcu(&dst->rcu_head, dst_destroy_rcu);290292 }
···18631863 ieee80211_teardown_sdata(sdata);18641864}1865186518661866-/*18671867- * Remove all interfaces, may only be called at hardware unregistration18681868- * time because it doesn't do RCU-safe list removals.18691869- */18701866void ieee80211_remove_interfaces(struct ieee80211_local *local)18711867{18721868 struct ieee80211_sub_if_data *sdata, *tmp;···1871187518721876 ASSERT_RTNL();1873187718741874- /*18751875- * Close all AP_VLAN interfaces first, as otherwise they18761876- * might be closed while the AP interface they belong to18771877- * is closed, causing unregister_netdevice_many() to crash.18781878+ /* Before destroying the interfaces, make sure they're all stopped so18791879+ * that the hardware is stopped. Otherwise, the driver might still be18801880+ * iterating the interfaces during the shutdown, e.g. from a worker18811881+ * or from RX processing or similar, and if it does so (using atomic18821882+ * iteration) while we're manipulating the list, the iteration will18831883+ * crash.18841884+ *18851885+ * After this, the hardware should be stopped and the driver should18861886+ * have stopped all of its activities, so that we can do RCU-unaware18871887+ * manipulations of the interface list below.18781888 */18791879- list_for_each_entry(sdata, &local->interfaces, list)18801880- if (sdata->vif.type == NL80211_IFTYPE_AP_VLAN)18811881- dev_close(sdata->dev);18891889+ cfg80211_shutdown_all_interfaces(local->hw.wiphy);18901890+18911891+ WARN(local->open_count, "%s: open count remains %d\n",18921892+ wiphy_name(local->hw.wiphy), local->open_count);1882189318831894 mutex_lock(&local->iflist_mtx);18841895 list_for_each_entry_safe(sdata, tmp, &local->interfaces, list) {
···7676 if (sdata->vif.type != NL80211_IFTYPE_STATION)7777 continue;7878 ieee80211_mgd_quiesce(sdata);7979+ /* If suspended during TX in progress, and wowlan8080+ * is enabled (connection will be active) there8181+ * can be a race where the driver is put out8282+ * of power-save due to TX and during suspend8383+ * dynamic_ps_timer is cancelled and TX packet8484+ * is flushed, leaving the driver in ACTIVE even8585+ * after resuming until dynamic_ps_timer puts8686+ * driver back in DOZE.8787+ */8888+ if (sdata->u.mgd.associated &&8989+ sdata->u.mgd.powersave &&9090+ !(local->hw.conf.flags & IEEE80211_CONF_PS)) {9191+ local->hw.conf.flags |= IEEE80211_CONF_PS;9292+ ieee80211_hw_config(local,9393+ IEEE80211_CONF_CHANGE_PS);9494+ }7995 }80968197 err = drv_suspend(local, wowlan);
+3-3
net/mac80211/tdls.c
···6060 struct ieee80211_channel *ch;6161 struct cfg80211_chan_def chandef;6262 int i, subband_start;6363+ struct wiphy *wiphy = sdata->local->hw.wiphy;63646465 for (i = start; i <= end; i += spacing) {6566 if (!ch_cnt)···7170 /* we will be active on the channel */7271 cfg80211_chandef_create(&chandef, ch,7372 NL80211_CHAN_NO_HT);7474- if (cfg80211_reg_can_beacon(sdata->local->hw.wiphy,7575- &chandef,7676- sdata->wdev.iftype)) {7373+ if (cfg80211_reg_can_beacon_relax(wiphy, &chandef,7474+ sdata->wdev.iftype)) {7775 ch_cnt++;7876 /*7977 * check if the next channel is also part of
···797797 return false;798798}799799800800-bool cfg80211_reg_can_beacon(struct wiphy *wiphy,801801- struct cfg80211_chan_def *chandef,802802- enum nl80211_iftype iftype)800800+static bool _cfg80211_reg_can_beacon(struct wiphy *wiphy,801801+ struct cfg80211_chan_def *chandef,802802+ enum nl80211_iftype iftype,803803+ bool check_no_ir)803804{804805 bool res;805806 u32 prohibited_flags = IEEE80211_CHAN_DISABLED |806807 IEEE80211_CHAN_RADAR;807808808808- trace_cfg80211_reg_can_beacon(wiphy, chandef, iftype);809809+ trace_cfg80211_reg_can_beacon(wiphy, chandef, iftype, check_no_ir);809810810810- /*811811- * Under certain conditions suggested by some regulatory bodies a812812- * GO/STA can IR on channels marked with IEEE80211_NO_IR. Set this flag813813- * only if such relaxations are not enabled and the conditions are not814814- * met.815815- */816816- if (!cfg80211_ir_permissive_chan(wiphy, iftype, chandef->chan))811811+ if (check_no_ir)817812 prohibited_flags |= IEEE80211_CHAN_NO_IR;818813819814 if (cfg80211_chandef_dfs_required(wiphy, chandef, iftype) > 0 &&···822827 trace_cfg80211_return_bool(res);823828 return res;824829}830830+831831+bool cfg80211_reg_can_beacon(struct wiphy *wiphy,832832+ struct cfg80211_chan_def *chandef,833833+ enum nl80211_iftype iftype)834834+{835835+ return _cfg80211_reg_can_beacon(wiphy, chandef, iftype, true);836836+}825837EXPORT_SYMBOL(cfg80211_reg_can_beacon);838838+839839+bool cfg80211_reg_can_beacon_relax(struct wiphy *wiphy,840840+ struct cfg80211_chan_def *chandef,841841+ enum nl80211_iftype iftype)842842+{843843+ bool check_no_ir;844844+845845+ ASSERT_RTNL();846846+847847+ /*848848+ * Under certain conditions suggested by some regulatory bodies a849849+ * GO/STA can IR on channels marked with IEEE80211_NO_IR. Set this flag850850+ * only if such relaxations are not enabled and the conditions are not851851+ * met.852852+ */853853+ check_no_ir = !cfg80211_ir_permissive_chan(wiphy, iftype,854854+ chandef->chan);855855+856856+ return _cfg80211_reg_can_beacon(wiphy, chandef, iftype, check_no_ir);857857+}858858+EXPORT_SYMBOL(cfg80211_reg_can_beacon_relax);826859827860int cfg80211_set_monitor_channel(struct cfg80211_registered_device *rdev,828861 struct cfg80211_chan_def *chandef)
+8-6
net/wireless/nl80211.c
···20032003 switch (iftype) {20042004 case NL80211_IFTYPE_AP:20052005 case NL80211_IFTYPE_P2P_GO:20062006- if (!cfg80211_reg_can_beacon(&rdev->wiphy, &chandef, iftype)) {20062006+ if (!cfg80211_reg_can_beacon_relax(&rdev->wiphy, &chandef,20072007+ iftype)) {20072008 result = -EINVAL;20082009 break;20092010 }···34043403 } else if (!nl80211_get_ap_channel(rdev, ¶ms))34053404 return -EINVAL;3406340534073407- if (!cfg80211_reg_can_beacon(&rdev->wiphy, ¶ms.chandef,34083408- wdev->iftype))34063406+ if (!cfg80211_reg_can_beacon_relax(&rdev->wiphy, ¶ms.chandef,34073407+ wdev->iftype))34093408 return -EINVAL;3410340934113410 if (info->attrs[NL80211_ATTR_ACL_POLICY]) {···64936492 if (err)64946493 return err;6495649464966496- if (!cfg80211_reg_can_beacon(&rdev->wiphy, ¶ms.chandef,64976497- wdev->iftype))64956495+ if (!cfg80211_reg_can_beacon_relax(&rdev->wiphy, ¶ms.chandef,64966496+ wdev->iftype))64986497 return -EINVAL;6499649865006499 err = cfg80211_chandef_dfs_required(wdev->wiphy,···1017110170 return -EINVAL;10172101711017310172 /* we will be active on the TDLS link */1017410174- if (!cfg80211_reg_can_beacon(&rdev->wiphy, &chandef, wdev->iftype))1017310173+ if (!cfg80211_reg_can_beacon_relax(&rdev->wiphy, &chandef,1017410174+ wdev->iftype))1017510175 return -EINVAL;10176101761017710177 /* don't allow switching to DFS channels */
+4-4
net/wireless/reg.c
···544544 reg_regdb_query(alpha2);545545546546 if (reg_crda_timeouts > REG_MAX_CRDA_TIMEOUTS) {547547- pr_info("Exceeded CRDA call max attempts. Not calling CRDA\n");547547+ pr_debug("Exceeded CRDA call max attempts. Not calling CRDA\n");548548 return -EINVAL;549549 }550550551551 if (!is_world_regdom((char *) alpha2))552552- pr_info("Calling CRDA for country: %c%c\n",552552+ pr_debug("Calling CRDA for country: %c%c\n",553553 alpha2[0], alpha2[1]);554554 else555555- pr_info("Calling CRDA to update world regulatory domain\n");555555+ pr_debug("Calling CRDA to update world regulatory domain\n");556556557557 return kobject_uevent_env(®_pdev->dev.kobj, KOBJ_CHANGE, env);558558}···15891589 case NL80211_IFTYPE_AP:15901590 case NL80211_IFTYPE_P2P_GO:15911591 case NL80211_IFTYPE_ADHOC:15921592- return cfg80211_reg_can_beacon(wiphy, &chandef, iftype);15921592+ return cfg80211_reg_can_beacon_relax(wiphy, &chandef, iftype);15931593 case NL80211_IFTYPE_STATION:15941594 case NL80211_IFTYPE_P2P_CLIENT:15951595 return cfg80211_chandef_usable(wiphy, &chandef,
···168168 *169169 * For __dynamic_array(int, foo, bar) use __get_dynamic_array(foo)170170 * Use __get_dynamic_array_len(foo) to get the length of the array171171- * saved.171171+ * saved. Note, __get_dynamic_array_len() returns the total allocated172172+ * length of the dynamic array; __print_array() expects the second173173+ * parameter to be the number of elements. To get that, the array length174174+ * needs to be divided by the element size.172175 *173176 * For __string(foo, bar) use __get_str(foo)174177 *···291288 * This prints out the array that is defined by __array in a nice format.292289 */293290 __print_array(__get_dynamic_array(list),294294- __get_dynamic_array_len(list),291291+ __get_dynamic_array_len(list) / sizeof(int),295292 sizeof(int)),296293 __get_str(str), __get_bitmask(cpus))297294);