···1616 gating mechanism in Gaudi. Due to how Gaudi is built, the1717 clock gating needs to be disabled in order to access the1818 registers of the TPC and MME engines. This is sometimes needed1919- during debug by the user and hence the user needs this option1919+ during debug by the user and hence the user needs this option.2020+ The user can supply a bitmask value, each bit represents2121+ a different engine to disable/enable its clock gating feature.2222+ The bitmask is composed of 20 bits:2323+ 0 - 7 : DMA channels2424+ 8 - 11 : MME engines2525+ 12 - 19 : TPC engines2626+ The bit's location of a specific engine can be determined2727+ using (1 << GAUDI_ENGINE_ID_*). GAUDI_ENGINE_ID_* values2828+ are defined in uapi habanalabs.h file in enum gaudi_engine_id20292130What: /sys/kernel/debug/habanalabs/hl<n>/command_buffers2231Date: Jan 2019
···2323 + Ancillary clock features2424 - Time stamp external events2525 - Period output signals configurable from user space2626+ - Low Pass Filter (LPF) access from user space2627 - Synchronization of the Linux system time via the PPS subsystem27282829PTP hardware clock kernel API···95949695 - Auxiliary Slave/Master Mode Snapshot (optional interrupt)9796 - Target Time (optional interrupt)9797+9898+ * Renesas (IDT) ClockMatrix™9999+100100+ - Up to 4 independent PHC channels101101+ - Integrated low pass filter (LPF), access via .adjPhase (compliant to ITU-T G.8273.2)102102+ - Programmable output periodic signals103103+ - Programmable inputs can time stamp external triggers104104+ - Driver and/or hardware configuration through firmware (idtcm.bin)105105+ - LPF settings (bandwidth, phase limiting, automatic holdover, physical layer assist (per ITU-T G.8273.2))106106+ - Programmable output PTP clocks, any frequency up to 1GHz (to other PHY/MAC time stampers, refclk to ASSPs/SoCs/FPGAs)107107+ - Lock to GNSS input, automatic switching between GNSS and user-space PHC control (optional)
+13-6
Documentation/networking/bareudp.rst
···262627271) Device creation & deletion28282929- a) ip link add dev bareudp0 type bareudp dstport 6635 ethertype 0x8847.2929+ a) ip link add dev bareudp0 type bareudp dstport 6635 ethertype mpls_uc30303131 This creates a bareudp tunnel device which tunnels L3 traffic with ethertype3232 0x8847 (MPLS traffic). The destination port of the UDP header will be set to···34343535 b) ip link delete bareudp036363737-2) Device creation with multiple proto mode enabled3737+2) Device creation with multiproto mode enabled38383939-There are two ways to create a bareudp device for MPLS & IP with multiproto mode4040-enabled.3939+The multiproto mode allows bareudp tunnels to handle several protocols of the4040+same family. It is currently only available for IP and MPLS. This mode has to4141+be enabled explicitly with the "multiproto" flag.41424242- a) ip link add dev bareudp0 type bareudp dstport 6635 ethertype 0x8847 multiproto4343+ a) ip link add dev bareudp0 type bareudp dstport 6635 ethertype ipv4 multiproto43444444- b) ip link add dev bareudp0 type bareudp dstport 6635 ethertype mpls4545+ For an IPv4 tunnel the multiproto mode allows the tunnel to also handle4646+ IPv6.4747+4848+ b) ip link add dev bareudp0 type bareudp dstport 6635 ethertype mpls_uc multiproto4949+5050+ For MPLS, the multiproto mode allows the tunnel to handle both unicast5151+ and multicast MPLS packets.455246533) Device Usage4754
···6060extern unsigned long __cmpxchg_u32(volatile unsigned int *m, unsigned int old,6161 unsigned int new_);6262extern u64 __cmpxchg_u64(volatile u64 *ptr, u64 old, u64 new_);6363+extern u8 __cmpxchg_u8(volatile u8 *ptr, u8 old, u8 new_);63646465/* don't worry...optimizer will get rid of most of this */6566static inline unsigned long···7271#endif7372 case 4: return __cmpxchg_u32((unsigned int *)ptr,7473 (unsigned int)old, (unsigned int)new_);7474+ case 1: return __cmpxchg_u8((u8 *)ptr, (u8)old, (u8)new_);7575 }7676 __cmpxchg_called_with_bad_pointer();7777 return old;
···9595#ifdef CONFIG_BLK_DEV_INITRD9696static void __init setup_initrd(void)9797{9898+ phys_addr_t start;9899 unsigned long size;99100100100- if (initrd_start >= initrd_end) {101101- pr_info("initrd not found or empty");102102- goto disable;103103- }104104- if (__pa_symbol(initrd_end) > PFN_PHYS(max_low_pfn)) {105105- pr_err("initrd extends beyond end of memory");101101+ /* Ignore the virtul address computed during device tree parsing */102102+ initrd_start = initrd_end = 0;103103+104104+ if (!phys_initrd_size)105105+ return;106106+ /*107107+ * Round the memory region to page boundaries as per free_initrd_mem()108108+ * This allows us to detect whether the pages overlapping the initrd109109+ * are in use, but more importantly, reserves the entire set of pages110110+ * as we don't want these pages allocated for other purposes.111111+ */112112+ start = round_down(phys_initrd_start, PAGE_SIZE);113113+ size = phys_initrd_size + (phys_initrd_start - start);114114+ size = round_up(size, PAGE_SIZE);115115+116116+ if (!memblock_is_region_memory(start, size)) {117117+ pr_err("INITRD: 0x%08llx+0x%08lx is not a memory region",118118+ (u64)start, size);106119 goto disable;107120 }108121109109- size = initrd_end - initrd_start;110110- memblock_reserve(__pa_symbol(initrd_start), size);122122+ if (memblock_is_region_reserved(start, size)) {123123+ pr_err("INITRD: 0x%08llx+0x%08lx overlaps in-use memory region\n",124124+ (u64)start, size);125125+ goto disable;126126+ }127127+128128+ memblock_reserve(start, size);129129+ /* Now convert initrd to virtual addresses */130130+ initrd_start = (unsigned long)__va(phys_initrd_start);131131+ initrd_end = initrd_start + phys_initrd_size;111132 initrd_below_start_ok = 1;112133113134 pr_info("Initial ramdisk at: 0x%p (%lu bytes)\n",···147126{148127 struct memblock_region *reg;149128 phys_addr_t mem_size = 0;129129+ phys_addr_t total_mem = 0;130130+ phys_addr_t mem_start, end = 0;150131 phys_addr_t vmlinux_end = __pa_symbol(&_end);151132 phys_addr_t vmlinux_start = __pa_symbol(&_start);152133153134 /* Find the memory region containing the kernel */154135 for_each_memblock(memory, reg) {155155- phys_addr_t end = reg->base + reg->size;156156-157157- if (reg->base <= vmlinux_start && vmlinux_end <= end) {158158- mem_size = min(reg->size, (phys_addr_t)-PAGE_OFFSET);159159-160160- /*161161- * Remove memblock from the end of usable area to the162162- * end of region163163- */164164- if (reg->base + mem_size < end)165165- memblock_remove(reg->base + mem_size,166166- end - reg->base - mem_size);167167- }136136+ end = reg->base + reg->size;137137+ if (!total_mem)138138+ mem_start = reg->base;139139+ if (reg->base <= vmlinux_start && vmlinux_end <= end)140140+ BUG_ON(reg->size == 0);141141+ total_mem = total_mem + reg->size;168142 }169169- BUG_ON(mem_size == 0);143143+144144+ /*145145+ * Remove memblock from the end of usable area to the146146+ * end of region147147+ */148148+ mem_size = min(total_mem, (phys_addr_t)-PAGE_OFFSET);149149+ if (mem_start + mem_size < end)150150+ memblock_remove(mem_start + mem_size,151151+ end - mem_start - mem_size);170152171153 /* Reserve from the start of the kernel to the end of the kernel */172154 memblock_reserve(vmlinux_start, vmlinux_end - vmlinux_start);173155174174- set_max_mapnr(PFN_DOWN(mem_size));175156 max_pfn = PFN_DOWN(memblock_end_of_DRAM());176157 max_low_pfn = max_pfn;158158+ set_max_mapnr(max_low_pfn);177159178160#ifdef CONFIG_BLK_DEV_INITRD179161 setup_initrd();
···7171 printk("%s %s%pB\n", log_lvl, reliable ? "" : "? ", (void *)address);7272}73737474+static int copy_code(struct pt_regs *regs, u8 *buf, unsigned long src,7575+ unsigned int nbytes)7676+{7777+ if (!user_mode(regs))7878+ return copy_from_kernel_nofault(buf, (u8 *)src, nbytes);7979+8080+ /*8181+ * Make sure userspace isn't trying to trick us into dumping kernel8282+ * memory by pointing the userspace instruction pointer at it.8383+ */8484+ if (__chk_range_not_ok(src, nbytes, TASK_SIZE_MAX))8585+ return -EINVAL;8686+8787+ return copy_from_user_nmi(buf, (void __user *)src, nbytes);8888+}8989+7490/*7591 * There are a couple of reasons for the 2/3rd prologue, courtesy of Linus:7692 *···11397#define OPCODE_BUFSIZE (PROLOGUE_SIZE + 1 + EPILOGUE_SIZE)11498 u8 opcodes[OPCODE_BUFSIZE];11599 unsigned long prologue = regs->ip - PROLOGUE_SIZE;116116- bool bad_ip;117100118118- /*119119- * Make sure userspace isn't trying to trick us into dumping kernel120120- * memory by pointing the userspace instruction pointer at it.121121- */122122- bad_ip = user_mode(regs) &&123123- __chk_range_not_ok(prologue, OPCODE_BUFSIZE, TASK_SIZE_MAX);124124-125125- if (bad_ip || copy_from_kernel_nofault(opcodes, (u8 *)prologue,126126- OPCODE_BUFSIZE)) {101101+ if (copy_code(regs, opcodes, prologue, sizeof(opcodes))) {127102 printk("%sCode: Bad RIP value.\n", loglvl);128103 } else {129104 printk("%sCode: %" __stringify(PROLOGUE_SIZE) "ph <%02x> %"
+1-1
arch/x86/kernel/fpu/xstate.c
···10741074 copy_part(offsetof(struct fxregs_state, st_space), 128,10751075 &xsave->i387.st_space, &kbuf, &offset_start, &count);10761076 if (header.xfeatures & XFEATURE_MASK_SSE)10771077- copy_part(xstate_offsets[XFEATURE_MASK_SSE], 256,10771077+ copy_part(xstate_offsets[XFEATURE_SSE], 256,10781078 &xsave->i387.xmm_space, &kbuf, &offset_start, &count);10791079 /*10801080 * Fill xsave->i387.sw_reserved value for ptrace frame:
-5
arch/x86/kernel/stacktrace.c
···5858 * or a page fault), which can make frame pointers5959 * unreliable.6060 */6161-6261 if (IS_ENABLED(CONFIG_FRAME_POINTER))6362 return -EINVAL;6463 }···78797980 /* Check for stack corruption */8081 if (unwind_error(&state))8181- return -EINVAL;8282-8383- /* Success path for non-user tasks, i.e. kthreads and idle tasks */8484- if (!(task->flags & (PF_KTHREAD | PF_IDLE)))8582 return -EINVAL;86838784 return 0;
+6-2
arch/x86/kernel/unwind_orc.c
···440440 /*441441 * Find the orc_entry associated with the text address.442442 *443443- * Decrement call return addresses by one so they work for sibling444444- * calls and calls to noreturn functions.443443+ * For a call frame (as opposed to a signal frame), state->ip points to444444+ * the instruction after the call. That instruction's stack layout445445+ * could be different from the call instruction's layout, for example446446+ * if the call was to a noreturn function. So get the ORC data for the447447+ * call instruction itself.445448 */446449 orc = orc_find(state->signal ? state->ip : state->ip - 1);447450 if (!orc) {···665662 state->sp = task->thread.sp;666663 state->bp = READ_ONCE_NOCHECK(frame->bp);667664 state->ip = READ_ONCE_NOCHECK(frame->ret_addr);665665+ state->signal = (void *)state->ip == ret_from_fork;668666 }669667670668 if (get_stack_info((unsigned long *)state->sp, state->task,
···721721 return next;722722723723 /* When no more children in primary, continue with secondary */724724- if (!IS_ERR_OR_NULL(fwnode->secondary))724724+ if (fwnode && !IS_ERR_OR_NULL(fwnode->secondary))725725 next = fwnode_get_next_child_node(fwnode->secondary, child);726726727727 return next;
+22
drivers/bus/ti-sysc.c
···28652865 return error;28662866}2867286728682868+/*28692869+ * Ignore timers tagged with no-reset and no-idle. These are likely in use,28702870+ * for example by drivers/clocksource/timer-ti-dm-systimer.c. If more checks28712871+ * are needed, we could also look at the timer register configuration.28722872+ */28732873+static int sysc_check_active_timer(struct sysc *ddata)28742874+{28752875+ if (ddata->cap->type != TI_SYSC_OMAP2_TIMER &&28762876+ ddata->cap->type != TI_SYSC_OMAP4_TIMER)28772877+ return 0;28782878+28792879+ if ((ddata->cfg.quirks & SYSC_QUIRK_NO_RESET_ON_INIT) &&28802880+ (ddata->cfg.quirks & SYSC_QUIRK_NO_IDLE))28812881+ return -EBUSY;28822882+28832883+ return 0;28842884+}28852885+28682886static const struct of_device_id sysc_match_table[] = {28692887 { .compatible = "simple-bus", },28702888 { /* sentinel */ },···29362918 sysc_init_early_quirks(ddata);2937291929382920 error = sysc_check_disabled_devices(ddata);29212921+ if (error)29222922+ return error;29232923+29242924+ error = sysc_check_active_timer(ddata);29392925 if (error)29402926 return error;29412927
+7-3
drivers/char/mem.c
···814814#ifdef CONFIG_IO_STRICT_DEVMEM815815void revoke_devmem(struct resource *res)816816{817817- struct inode *inode = READ_ONCE(devmem_inode);817817+ /* pairs with smp_store_release() in devmem_init_inode() */818818+ struct inode *inode = smp_load_acquire(&devmem_inode);818819819820 /*820821 * Check that the initialization has completed. Losing the race···10291028 return rc;10301029 }1031103010321032- /* publish /dev/mem initialized */10331033- WRITE_ONCE(devmem_inode, inode);10311031+ /*10321032+ * Publish /dev/mem initialized.10331033+ * Pairs with smp_load_acquire() in revoke_devmem().10341034+ */10351035+ smp_store_release(&devmem_inode, inode);1034103610351037 return 0;10361038}
+36-10
drivers/clocksource/timer-ti-dm-systimer.c
···1919/* For type1, set SYSC_OMAP2_CLOCKACTIVITY for fck off on idle, l4 clock on */2020#define DMTIMER_TYPE1_ENABLE ((1 << 9) | (SYSC_IDLE_SMART << 3) | \2121 SYSC_OMAP2_ENAWAKEUP | SYSC_OMAP2_AUTOIDLE)2222-2222+#define DMTIMER_TYPE1_DISABLE (SYSC_OMAP2_SOFTRESET | SYSC_OMAP2_AUTOIDLE)2323#define DMTIMER_TYPE2_ENABLE (SYSC_IDLE_SMART_WKUP << 2)2424#define DMTIMER_RESET_WAIT 1000002525···4444 u8 ctrl;4545 u8 wakeup;4646 u8 ifctrl;4747+ struct clk *fck;4848+ struct clk *ick;4749 unsigned long rate;4850};4951···300298}301299302300/* Interface clocks are only available on some SoCs variants */303303-static int __init dmtimer_systimer_init_clock(struct device_node *np,301301+static int __init dmtimer_systimer_init_clock(struct dmtimer_systimer *t,302302+ struct device_node *np,304303 const char *name,305304 unsigned long *rate)306305{307306 struct clk *clock;308307 unsigned long r;308308+ bool is_ick = false;309309 int error;310310311311+ is_ick = !strncmp(name, "ick", 3);312312+311313 clock = of_clk_get_by_name(np, name);312312- if ((PTR_ERR(clock) == -EINVAL) && !strncmp(name, "ick", 3))314314+ if ((PTR_ERR(clock) == -EINVAL) && is_ick)313315 return 0;314316 else if (IS_ERR(clock))315317 return PTR_ERR(clock);···325319 r = clk_get_rate(clock);326320 if (!r)327321 return -ENODEV;322322+323323+ if (is_ick)324324+ t->ick = clock;325325+ else326326+ t->fck = clock;328327329328 *rate = r;330329···350339351340static void dmtimer_systimer_disable(struct dmtimer_systimer *t)352341{353353- writel_relaxed(0, t->base + t->sysc);342342+ if (!dmtimer_systimer_revision1(t))343343+ return;344344+345345+ writel_relaxed(DMTIMER_TYPE1_DISABLE, t->base + t->sysc);354346}355347356348static int __init dmtimer_systimer_setup(struct device_node *np,···380366 pr_err("%s: clock source init failed: %i\n", __func__, error);381367382368 /* For ti-sysc, we have timer clocks at the parent module level */383383- error = dmtimer_systimer_init_clock(np->parent, "fck", &rate);369369+ error = dmtimer_systimer_init_clock(t, np->parent, "fck", &rate);384370 if (error)385371 goto err_unmap;386372387373 t->rate = rate;388374389389- error = dmtimer_systimer_init_clock(np->parent, "ick", &rate);375375+ error = dmtimer_systimer_init_clock(t, np->parent, "ick", &rate);390376 if (error)391377 goto err_unmap;392378···510496 struct dmtimer_systimer *t = &clkevt->t;511497512498 dmtimer_systimer_disable(t);499499+ clk_disable(t->fck);513500}514501515502static void omap_clockevent_unidle(struct clock_event_device *evt)516503{517504 struct dmtimer_clockevent *clkevt = to_dmtimer_clockevent(evt);518505 struct dmtimer_systimer *t = &clkevt->t;506506+ int error;507507+508508+ error = clk_enable(t->fck);509509+ if (error)510510+ pr_err("could not enable timer fck on resume: %i\n", error);519511520512 dmtimer_systimer_enable(t);521513 writel_relaxed(OMAP_TIMER_INT_OVERFLOW, t->base + t->irq_ena);···590570 3, /* Timer internal resynch latency */591571 0xffffffff);592572593593- if (of_device_is_compatible(np, "ti,am33xx") ||594594- of_device_is_compatible(np, "ti,am43")) {573573+ if (of_machine_is_compatible("ti,am33xx") ||574574+ of_machine_is_compatible("ti,am43")) {595575 dev->suspend = omap_clockevent_idle;596576 dev->resume = omap_clockevent_unidle;597577 }···636616637617 clksrc->loadval = readl_relaxed(t->base + t->counter);638618 dmtimer_systimer_disable(t);619619+ clk_disable(t->fck);639620}640621641622static void dmtimer_clocksource_resume(struct clocksource *cs)642623{643624 struct dmtimer_clocksource *clksrc = to_dmtimer_clocksource(cs);644625 struct dmtimer_systimer *t = &clksrc->t;626626+ int error;627627+628628+ error = clk_enable(t->fck);629629+ if (error)630630+ pr_err("could not enable timer fck on resume: %i\n", error);645631646632 dmtimer_systimer_enable(t);647633 writel_relaxed(clksrc->loadval, t->base + t->counter);···679653 dev->mask = CLOCKSOURCE_MASK(32);680654 dev->flags = CLOCK_SOURCE_IS_CONTINUOUS;681655682682- if (of_device_is_compatible(np, "ti,am33xx") ||683683- of_device_is_compatible(np, "ti,am43")) {656656+ /* Unlike for clockevent, legacy code sets suspend only for am4 */657657+ if (of_machine_is_compatible("ti,am43")) {684658 dev->suspend = dmtimer_clocksource_suspend;685659 dev->resume = dmtimer_clocksource_resume;686660 }
+1-1
drivers/crypto/chelsio/chtls/chtls_cm.c
···102102 case PF_INET:103103 if (likely(!inet_sk(sk)->inet_rcv_saddr))104104 return ndev;105105- ndev = ip_dev_find(&init_net, inet_sk(sk)->inet_rcv_saddr);105105+ ndev = __ip_dev_find(&init_net, inet_sk(sk)->inet_rcv_saddr, false);106106 break;107107#if IS_ENABLED(CONFIG_IPV6)108108 case PF_INET6:
+4-3
drivers/crypto/chelsio/chtls/chtls_io.c
···10521052 &record_type);10531053 if (err)10541054 goto out_err;10551055+10561056+ /* Avoid appending tls handshake, alert to tls data */10571057+ if (skb)10581058+ tx_skb_finalize(skb);10551059 }1056106010571061 recordsz = size;10581062 csk->tlshws.txleft = recordsz;10591063 csk->tlshws.type = record_type;10601060-10611061- if (skb)10621062- ULP_SKB_CB(skb)->ulp.tls.type = record_type;10631064 }1064106510651066 if (!skb || (ULP_SKB_CB(skb)->flags & ULPCB_FLAG_NO_APPEND) ||
+1-4
drivers/firmware/efi/efi-pstore.c
···356356357357static __init int efivars_pstore_init(void)358358{359359- if (!efi_rt_services_supported(EFI_RT_SUPPORTED_VARIABLE_SERVICES))360360- return 0;361361-362362- if (!efivars_kobject())359359+ if (!efivars_kobject() || !efivar_supports_writes())363360 return 0;364361365362 if (efivars_pstore_disable)
+8-4
drivers/firmware/efi/efi.c
···176176static int generic_ops_register(void)177177{178178 generic_ops.get_variable = efi.get_variable;179179- generic_ops.set_variable = efi.set_variable;180180- generic_ops.set_variable_nonblocking = efi.set_variable_nonblocking;181179 generic_ops.get_next_variable = efi.get_next_variable;182180 generic_ops.query_variable_store = efi_query_variable_store;183181182182+ if (efi_rt_services_supported(EFI_RT_SUPPORTED_SET_VARIABLE)) {183183+ generic_ops.set_variable = efi.set_variable;184184+ generic_ops.set_variable_nonblocking = efi.set_variable_nonblocking;185185+ }184186 return efivars_register(&generic_efivars, &generic_ops, efi_kobj);185187}186188···384382 return -ENOMEM;385383 }386384387387- if (efi_rt_services_supported(EFI_RT_SUPPORTED_VARIABLE_SERVICES)) {385385+ if (efi_rt_services_supported(EFI_RT_SUPPORTED_GET_VARIABLE |386386+ EFI_RT_SUPPORTED_GET_NEXT_VARIABLE_NAME)) {388387 efivar_ssdt_load();389388 error = generic_ops_register();390389 if (error)···419416err_remove_group:420417 sysfs_remove_group(efi_kobj, &efi_subsys_attr_group);421418err_unregister:422422- if (efi_rt_services_supported(EFI_RT_SUPPORTED_VARIABLE_SERVICES))419419+ if (efi_rt_services_supported(EFI_RT_SUPPORTED_GET_VARIABLE |420420+ EFI_RT_SUPPORTED_GET_NEXT_VARIABLE_NAME))423421 generic_ops_unregister();424422err_put:425423 kobject_put(efi_kobj);
+1-4
drivers/firmware/efi/efivars.c
···680680 struct kobject *parent_kobj = efivars_kobject();681681 int error = 0;682682683683- if (!efi_rt_services_supported(EFI_RT_SUPPORTED_VARIABLE_SERVICES))684684- return -ENODEV;685685-686683 /* No efivars has been registered yet */687687- if (!parent_kobj)684684+ if (!parent_kobj || !efivar_supports_writes())688685 return 0;689686690687 printk(KERN_INFO "EFI Variables Facility v%s %s\n", EFIVARS_VERSION,
+1-2
drivers/firmware/efi/libstub/Makefile
···66# enabled, even if doing so doesn't break the build.77#88cflags-$(CONFIG_X86_32) := -march=i38699-cflags-$(CONFIG_X86_64) := -mcmodel=small \1010- $(call cc-option,-maccumulate-outgoing-args)99+cflags-$(CONFIG_X86_64) := -mcmodel=small1110cflags-$(CONFIG_X86) += -m$(BITS) -D__KERNEL__ \1211 -fPIC -fno-strict-aliasing -mno-red-zone \1312 -mno-mmx -mno-sse -fshort-wchar \
+1-1
drivers/firmware/efi/libstub/alignedmem.c
···4444 *addr = ALIGN((unsigned long)alloc_addr, align);45454646 if (slack > 0) {4747- int l = (alloc_addr % align) / EFI_PAGE_SIZE;4747+ int l = (alloc_addr & (align - 1)) / EFI_PAGE_SIZE;48484949 if (l) {5050 efi_bs_call(free_pages, alloc_addr, slack - l + 1);
-17
drivers/firmware/efi/libstub/efi-stub.c
···122122}123123124124/*125125- * This function handles the architcture specific differences between arm and126126- * arm64 regarding where the kernel image must be loaded and any memory that127127- * must be reserved. On failure it is required to free all128128- * all allocations it has made.129129- */130130-efi_status_t handle_kernel_image(unsigned long *image_addr,131131- unsigned long *image_size,132132- unsigned long *reserve_addr,133133- unsigned long *reserve_size,134134- unsigned long dram_base,135135- efi_loaded_image_t *image);136136-137137-asmlinkage void __noreturn efi_enter_kernel(unsigned long entrypoint,138138- unsigned long fdt_addr,139139- unsigned long fdt_size);140140-141141-/*142125 * EFI entry point for the arm/arm64 EFI stubs. This is the entrypoint143126 * that is described in the PE/COFF header. Most of the code is the same144127 * for both archictectures, with the arch-specific code provided in the
+16
drivers/firmware/efi/libstub/efistub.h
···776776 unsigned long *load_size,777777 unsigned long soft_limit,778778 unsigned long hard_limit);779779+/*780780+ * This function handles the architcture specific differences between arm and781781+ * arm64 regarding where the kernel image must be loaded and any memory that782782+ * must be reserved. On failure it is required to free all783783+ * all allocations it has made.784784+ */785785+efi_status_t handle_kernel_image(unsigned long *image_addr,786786+ unsigned long *image_size,787787+ unsigned long *reserve_addr,788788+ unsigned long *reserve_size,789789+ unsigned long dram_base,790790+ efi_loaded_image_t *image);791791+792792+asmlinkage void __noreturn efi_enter_kernel(unsigned long entrypoint,793793+ unsigned long fdt_addr,794794+ unsigned long fdt_size);779795780796void efi_handle_post_ebs_state(void);781797
+4-4
drivers/firmware/efi/libstub/x86-stub.c
···8899#include <linux/efi.h>1010#include <linux/pci.h>1111+#include <linux/stddef.h>11121213#include <asm/efi.h>1314#include <asm/e820/types.h>···362361 int options_size = 0;363362 efi_status_t status;364363 char *cmdline_ptr;365365- unsigned long ramdisk_addr;366366- unsigned long ramdisk_size;367364368365 efi_system_table = sys_table_arg;369366···389390390391 hdr = &boot_params->hdr;391392392392- /* Copy the second sector to boot_params */393393- memcpy(&hdr->jump, image_base + 512, 512);393393+ /* Copy the setup header from the second sector to boot_params */394394+ memcpy(&hdr->jump, image_base + 512,395395+ sizeof(struct setup_header) - offsetof(struct setup_header, jump));394396395397 /*396398 * Fill out some of the header fields ourselves because the
···8383 * on this port and minimum soft reset pulse width has elapsed.8484 * Driver polls port_soft_reset_ack to determine if reset done by HW.8585 */8686- if (readq_poll_timeout(base + PORT_HDR_CTRL, v, v & PORT_CTRL_SFTRST,8686+ if (readq_poll_timeout(base + PORT_HDR_CTRL, v,8787+ v & PORT_CTRL_SFTRST_ACK,8788 RST_POLL_INVL, RST_POLL_TIMEOUT)) {8889 dev_err(&pdev->dev, "timeout, fail to reset device\n");8990 return -ETIMEDOUT;
+2-1
drivers/fpga/dfl-pci.c
···227227{228228 struct cci_drvdata *drvdata = pci_get_drvdata(pcidev);229229 struct dfl_fpga_cdev *cdev = drvdata->cdev;230230- int ret = 0;231230232231 if (!num_vfs) {233232 /*···238239 dfl_fpga_cdev_config_ports_pf(cdev);239240240241 } else {242242+ int ret;243243+241244 /*242245 * before enable SRIOV, put released ports into VF access mode243246 * first of all.
+3-6
drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c
···778778 tmp_str++;779779 while (isspace(*++tmp_str));780780781781- while (tmp_str[0]) {782782- sub_str = strsep(&tmp_str, delimiter);781781+ while ((sub_str = strsep(&tmp_str, delimiter)) != NULL) {783782 ret = kstrtol(sub_str, 0, ¶meter[parameter_size]);784783 if (ret)785784 return -EINVAL;···10381039 memcpy(buf_cpy, buf, bytes);10391040 buf_cpy[bytes] = '\0';10401041 tmp = buf_cpy;10411041- while (tmp[0]) {10421042- sub_str = strsep(&tmp, delimiter);10421042+ while ((sub_str = strsep(&tmp, delimiter)) != NULL) {10431043 if (strlen(sub_str)) {10441044 ret = kstrtol(sub_str, 0, &level);10451045 if (ret)···16351637 i++;16361638 memcpy(buf_cpy, buf, count-i);16371639 tmp_str = buf_cpy;16381638- while (tmp_str[0]) {16391639- sub_str = strsep(&tmp_str, delimiter);16401640+ while ((sub_str = strsep(&tmp_str, delimiter)) != NULL) {16401641 ret = kstrtol(sub_str, 0, ¶meter[parameter_size]);16411642 if (ret)16421643 return -EINVAL;
···644644645645 /* sclk is bigger than max sclk in the dependence table */646646 *voltage |= (dep_table->entries[i - 1].vddc * VOLTAGE_SCALE) << VDDC_SHIFT;647647- vddci = phm_find_closest_vddci(&(data->vddci_voltage_table),648648- (dep_table->entries[i - 1].vddc -649649- (uint16_t)VDDC_VDDCI_DELTA));650647651648 if (SMU7_VOLTAGE_CONTROL_NONE == data->vddci_control)652649 *voltage |= (data->vbios_boot_state.vddci_bootup_value *···651654 else if (dep_table->entries[i - 1].vddci)652655 *voltage |= (dep_table->entries[i - 1].vddci *653656 VOLTAGE_SCALE) << VDDC_SHIFT;654654- else657657+ else {658658+ vddci = phm_find_closest_vddci(&(data->vddci_voltage_table),659659+ (dep_table->entries[i - 1].vddc -660660+ (uint16_t)VDDC_VDDCI_DELTA));661661+655662 *voltage |= (vddci * VOLTAGE_SCALE) << VDDCI_SHIFT;663663+ }656664657665 if (SMU7_VOLTAGE_CONTROL_NONE == data->mvdd_control)658666 *mvdd = data->vbios_boot_state.mvdd_bootup_value * VOLTAGE_SCALE;
+2
drivers/gpu/drm/lima/lima_pp.c
···271271272272int lima_pp_bcast_resume(struct lima_ip *ip)273273{274274+ /* PP has been reset by individual PP resume */275275+ ip->data.async_reset = false;274276 return 0;275277}276278
+1-1
drivers/gpu/drm/sun4i/sun4i_hdmi_enc.c
···260260 unsigned long reg;261261262262 reg = readl(hdmi->base + SUN4I_HDMI_HPD_REG);263263- if (reg & SUN4I_HDMI_HPD_HIGH) {263263+ if (!(reg & SUN4I_HDMI_HPD_HIGH)) {264264 cec_phys_addr_invalidate(hdmi->cec_adap);265265 return connector_status_disconnected;266266 }
+12-16
drivers/i2c/busses/i2c-cadence.c
···421421 /* Read data if receive data valid is set */422422 while (cdns_i2c_readreg(CDNS_I2C_SR_OFFSET) &423423 CDNS_I2C_SR_RXDV) {424424- /*425425- * Clear hold bit that was set for FIFO control if426426- * RX data left is less than FIFO depth, unless427427- * repeated start is selected.428428- */429429- if ((id->recv_count < CDNS_I2C_FIFO_DEPTH) &&430430- !id->bus_hold_flag)431431- cdns_i2c_clear_bus_hold(id);432432-433424 if (id->recv_count > 0) {434425 *(id->p_recv_buf)++ =435426 cdns_i2c_readreg(CDNS_I2C_DATA_OFFSET);436427 id->recv_count--;437428 id->curr_recv_count--;429429+430430+ /*431431+ * Clear hold bit that was set for FIFO control432432+ * if RX data left is less than or equal to433433+ * FIFO DEPTH unless repeated start is selected434434+ */435435+ if (id->recv_count <= CDNS_I2C_FIFO_DEPTH &&436436+ !id->bus_hold_flag)437437+ cdns_i2c_clear_bus_hold(id);438438+438439 } else {439440 dev_err(id->adap.dev.parent,440441 "xfer_size reg rollover. xfer aborted!\n");···595594 * Check for the message size against FIFO depth and set the596595 * 'hold bus' bit if it is greater than FIFO depth.597596 */598598- if ((id->recv_count > CDNS_I2C_FIFO_DEPTH) || id->bus_hold_flag)597597+ if (id->recv_count > CDNS_I2C_FIFO_DEPTH)599598 ctrl_reg |= CDNS_I2C_CR_HOLD;600600- else601601- ctrl_reg = ctrl_reg & ~CDNS_I2C_CR_HOLD;602599603600 cdns_i2c_writereg(ctrl_reg, CDNS_I2C_CR_OFFSET);604601···653654 * Check for the message size against FIFO depth and set the654655 * 'hold bus' bit if it is greater than FIFO depth.655656 */656656- if ((id->send_count > CDNS_I2C_FIFO_DEPTH) || id->bus_hold_flag)657657+ if (id->send_count > CDNS_I2C_FIFO_DEPTH)657658 ctrl_reg |= CDNS_I2C_CR_HOLD;658658- else659659- ctrl_reg = ctrl_reg & ~CDNS_I2C_CR_HOLD;660660-661659 cdns_i2c_writereg(ctrl_reg, CDNS_I2C_CR_OFFSET);662660663661 /* Clear the interrupts in interrupt status register. */
···868868 /* disable irqs and ensure none is running before clearing ptr */869869 rcar_i2c_write(priv, ICSIER, 0);870870 rcar_i2c_write(priv, ICSCR, 0);871871+ rcar_i2c_write(priv, ICSAR, 0); /* Gen2: must be 0 if not using slave */871872872873 synchronize_irq(priv->irq);873874 priv->slave = NULL;···969968 ret = rcar_i2c_clock_calculate(priv);970969 if (ret < 0)971970 goto out_pm_put;971971+972972+ rcar_i2c_write(priv, ICSAR, 0); /* Gen2: must be 0 if not using slave */972973973974 if (priv->devtype == I2C_RCAR_GEN3) {974975 priv->rstc = devm_reset_control_get_exclusive(&pdev->dev, NULL);
···649649{650650 struct ib_uverbs_file *ufile = attrs->ufile;651651652652- /* alloc_commit consumes the uobj kref */653653- uobj->uapi_object->type_class->alloc_commit(uobj);654654-655652 /* kref is held so long as the uobj is on the uobj list. */656653 uverbs_uobject_get(uobj);657654 spin_lock_irq(&ufile->uobjects_lock);···657660658661 /* matches atomic_set(-1) in alloc_uobj */659662 atomic_set(&uobj->usecnt, 0);663663+664664+ /* alloc_commit consumes the uobj kref */665665+ uobj->uapi_object->type_class->alloc_commit(uobj);660666661667 /* Matches the down_read in rdma_alloc_begin_uobject */662668 up_read(&ufile->hw_destroy_rwsem);
···601601 */602602 synchronize_srcu(&dev->odp_srcu);603603604604+ /*605605+ * All work on the prefetch list must be completed, xa_erase() prevented606606+ * new work from being created.607607+ */608608+ wait_event(imr->q_deferred_work, !atomic_read(&imr->num_deferred_work));609609+610610+ /*611611+ * At this point it is forbidden for any other thread to enter612612+ * pagefault_mr() on this imr. It is already forbidden to call613613+ * pagefault_mr() on an implicit child. Due to this additions to614614+ * implicit_children are prevented.615615+ */616616+617617+ /*618618+ * Block destroy_unused_implicit_child_mr() from incrementing619619+ * num_deferred_work.620620+ */604621 xa_lock(&imr->implicit_children);605622 xa_for_each (&imr->implicit_children, idx, mtt) {606623 __xa_erase(&imr->implicit_children, idx);···626609 xa_unlock(&imr->implicit_children);627610628611 /*629629- * num_deferred_work can only be incremented inside the odp_srcu, or630630- * under xa_lock while the child is in the xarray. Thus at this point631631- * it is only decreasing, and all work holding it is now on the wq.612612+ * Wait for any concurrent destroy_unused_implicit_child_mr() to613613+ * complete.632614 */633615 wait_event(imr->q_deferred_work, !atomic_read(&imr->num_deferred_work));634616
···24202420 unsigned prev_free_sectors;2421242124222422 /* the following test is not needed, but it tests the replay code */24232423- if (unlikely(dm_suspended(ic->ti)) && !ic->meta_dev)24232423+ if (unlikely(dm_post_suspending(ic->ti)) && !ic->meta_dev)24242424 return;2425242524262426 spin_lock_irq(&ic->endio_wait.lock);···2481248124822482next_chunk:2483248324842484- if (unlikely(dm_suspended(ic->ti)))24842484+ if (unlikely(dm_post_suspending(ic->ti)))24852485 goto unlock_ret;2486248624872487 range.logical_sector = le64_to_cpu(ic->sb->recalc_sector);
+17
drivers/md/dm.c
···143143#define DMF_NOFLUSH_SUSPENDING 5144144#define DMF_DEFERRED_REMOVE 6145145#define DMF_SUSPENDED_INTERNALLY 7146146+#define DMF_POST_SUSPENDING 8146147147148#define DM_NUMA_NODE NUMA_NO_NODE148149static int dm_numa_node = DM_NUMA_NODE;···24092408 if (!dm_suspended_md(md)) {24102409 dm_table_presuspend_targets(map);24112410 set_bit(DMF_SUSPENDED, &md->flags);24112411+ set_bit(DMF_POST_SUSPENDING, &md->flags);24122412 dm_table_postsuspend_targets(map);24132413 }24142414 /* dm_put_live_table must be before msleep, otherwise deadlock is possible */···27682766 if (r)27692767 goto out_unlock;2770276827692769+ set_bit(DMF_POST_SUSPENDING, &md->flags);27712770 dm_table_postsuspend_targets(map);27712771+ clear_bit(DMF_POST_SUSPENDING, &md->flags);2772277227732773out_unlock:27742774 mutex_unlock(&md->suspend_lock);···28672863 (void) __dm_suspend(md, map, suspend_flags, TASK_UNINTERRUPTIBLE,28682864 DMF_SUSPENDED_INTERNALLY);2869286528662866+ set_bit(DMF_POST_SUSPENDING, &md->flags);28702867 dm_table_postsuspend_targets(map);28682868+ clear_bit(DMF_POST_SUSPENDING, &md->flags);28712869}2872287028732871static void __dm_internal_resume(struct mapped_device *md)···30303024 return test_bit(DMF_SUSPENDED, &md->flags);30313025}3032302630273027+static int dm_post_suspending_md(struct mapped_device *md)30283028+{30293029+ return test_bit(DMF_POST_SUSPENDING, &md->flags);30303030+}30313031+30333032int dm_suspended_internally_md(struct mapped_device *md)30343033{30353034 return test_bit(DMF_SUSPENDED_INTERNALLY, &md->flags);···30503039 return dm_suspended_md(dm_table_get_md(ti->table));30513040}30523041EXPORT_SYMBOL_GPL(dm_suspended);30423042+30433043+int dm_post_suspending(struct dm_target *ti)30443044+{30453045+ return dm_post_suspending_md(dm_table_get_md(ti->table));30463046+}30473047+EXPORT_SYMBOL_GPL(dm_post_suspending);3053304830543049int dm_noflush_suspending(struct dm_target *ti)30553050{
+11-3
drivers/misc/habanalabs/command_submission.c
···499499 struct asic_fixed_properties *asic = &hdev->asic_prop;500500 struct hw_queue_properties *hw_queue_prop;501501502502+ /* This must be checked here to prevent out-of-bounds access to503503+ * hw_queues_props array504504+ */505505+ if (chunk->queue_index >= HL_MAX_QUEUES) {506506+ dev_err(hdev->dev, "Queue index %d is invalid\n",507507+ chunk->queue_index);508508+ return -EINVAL;509509+ }510510+502511 hw_queue_prop = &asic->hw_queues_props[chunk->queue_index];503512504504- if ((chunk->queue_index >= HL_MAX_QUEUES) ||505505- (hw_queue_prop->type == QUEUE_TYPE_NA)) {506506- dev_err(hdev->dev, "Queue index %d is invalid\n",513513+ if (hw_queue_prop->type == QUEUE_TYPE_NA) {514514+ dev_err(hdev->dev, "Queue index %d is not applicable\n",507515 chunk->queue_index);508516 return -EINVAL;509517 }
···578578 * @mmu_invalidate_cache_range: flush specific MMU STLB cache lines with579579 * ASID-VA-size mask.580580 * @send_heartbeat: send is-alive packet to ArmCP and verify response.581581- * @enable_clock_gating: enable clock gating for reducing power consumption.582582- * @disable_clock_gating: disable clock for accessing registers on HBW.581581+ * @set_clock_gating: enable/disable clock gating per engine according to582582+ * clock gating mask in hdev583583+ * @disable_clock_gating: disable clock gating completely583584 * @debug_coresight: perform certain actions on Coresight for debugging.584585 * @is_device_idle: return true if device is idle, false otherwise.585586 * @soft_reset_late_init: perform certain actions needed after soft reset.···588587 * @hw_queues_unlock: release H/W queues lock.589588 * @get_pci_id: retrieve PCI ID.590589 * @get_eeprom_data: retrieve EEPROM data from F/W.591591- * @send_cpu_message: send buffer to ArmCP.590590+ * @send_cpu_message: send message to F/W. If the message is timedout, the591591+ * driver will eventually reset the device. The timeout can592592+ * be determined by the calling function or it can be 0 and593593+ * then the timeout is the default timeout for the specific594594+ * ASIC592595 * @get_hw_state: retrieve the H/W state593596 * @pci_bars_map: Map PCI BARs.594597 * @set_dram_bar_base: Set DRAM BAR to map specific device address. Returns···685680 int (*mmu_invalidate_cache_range)(struct hl_device *hdev, bool is_hard,686681 u32 asid, u64 va, u64 size);687682 int (*send_heartbeat)(struct hl_device *hdev);688688- void (*enable_clock_gating)(struct hl_device *hdev);683683+ void (*set_clock_gating)(struct hl_device *hdev);689684 void (*disable_clock_gating)(struct hl_device *hdev);690685 int (*debug_coresight)(struct hl_device *hdev, void *data);691686 bool (*is_device_idle)(struct hl_device *hdev, u32 *mask,···14031398 * @max_power: the max power of the device, as configured by the sysadmin. This14041399 * value is saved so in case of hard-reset, the driver will restore14051400 * this value and update the F/W after the re-initialization14011401+ * @clock_gating_mask: is clock gating enabled. bitmask that represents the14021402+ * different engines. See debugfs-driver-habanalabs for14031403+ * details.14061404 * @in_reset: is device in reset flow.14071405 * @curr_pll_profile: current PLL profile.14081406 * @cs_active_cnt: number of active command submissions on this device (active···14331425 * @init_done: is the initialization of the device done.14341426 * @mmu_enable: is MMU enabled.14351427 * @mmu_huge_page_opt: is MMU huge pages optimization enabled.14361436- * @clock_gating: is clock gating enabled.14371428 * @device_cpu_disabled: is the device CPU disabled (due to timeouts)14381429 * @dma_mask: the dma mask that was set for this device14391430 * @in_debug: is device under debug. This, together with fpriv_list, enforces···15001493 atomic64_t dram_used_mem;15011494 u64 timeout_jiffies;15021495 u64 max_power;14961496+ u64 clock_gating_mask;15031497 atomic_t in_reset;15041498 enum hl_pll_frequency curr_pll_profile;15051499 int cs_active_cnt;···15221514 u8 dram_default_page_mapping;15231515 u8 pmmu_huge_range;15241516 u8 init_done;15251525- u8 clock_gating;15261517 u8 device_cpu_disabled;15271518 u8 dma_mask;15281519 u8 in_debug;
···6868 if (WARN_ON(clock > host->max_clk))6969 clock = host->max_clk;70707171- for (div = 1; div < 256; div *= 2) {7171+ for (div = 2; div < 256; div *= 2) {7272 if ((parent / div) <= clock)7373 break;7474 }
···974974 PORT_MIRROR_SNIFFER, false);975975}976976977977-static void ksz9477_phy_setup(struct ksz_device *dev, int port,978978- struct phy_device *phy)979979-{980980- /* Only apply to port with PHY. */981981- if (port >= dev->phy_port_cnt)982982- return;983983-984984- /* The MAC actually cannot run in 1000 half-duplex mode. */985985- phy_remove_link_mode(phy,986986- ETHTOOL_LINK_MODE_1000baseT_Half_BIT);987987-988988- /* PHY does not support gigabit. */989989- if (!(dev->features & GBIT_SUPPORT))990990- phy_remove_link_mode(phy,991991- ETHTOOL_LINK_MODE_1000baseT_Full_BIT);992992-}993993-994977static bool ksz9477_get_gbit(struct ksz_device *dev, u8 data)995978{996979 bool gbit;···15861603 .get_port_addr = ksz9477_get_port_addr,15871604 .cfg_port_member = ksz9477_cfg_port_member,15881605 .flush_dyn_mac_table = ksz9477_flush_dyn_mac_table,15891589- .phy_setup = ksz9477_phy_setup,15901606 .port_setup = ksz9477_port_setup,15911607 .r_mib_cnt = ksz9477_r_mib_cnt,15921608 .r_mib_pkt = ksz9477_r_mib_pkt,···1599161716001618int ksz9477_switch_register(struct ksz_device *dev)16011619{16021602- return ksz_switch_register(dev, &ksz9477_dev_ops);16201620+ int ret, i;16211621+ struct phy_device *phydev;16221622+16231623+ ret = ksz_switch_register(dev, &ksz9477_dev_ops);16241624+ if (ret)16251625+ return ret;16261626+16271627+ for (i = 0; i < dev->phy_port_cnt; ++i) {16281628+ if (!dsa_is_user_port(dev->ds, i))16291629+ continue;16301630+16311631+ phydev = dsa_to_port(dev->ds, i)->slave->phydev;16321632+16331633+ /* The MAC actually cannot run in 1000 half-duplex mode. */16341634+ phy_remove_link_mode(phydev,16351635+ ETHTOOL_LINK_MODE_1000baseT_Half_BIT);16361636+16371637+ /* PHY does not support gigabit. */16381638+ if (!(dev->features & GBIT_SUPPORT))16391639+ phy_remove_link_mode(phydev,16401640+ ETHTOOL_LINK_MODE_1000baseT_Full_BIT);16411641+ }16421642+ return ret;16031643}16041644EXPORT_SYMBOL(ksz9477_switch_register);16051645
-2
drivers/net/dsa/microchip/ksz_common.c
···358358359359 /* setup slave port */360360 dev->dev_ops->port_setup(dev, port, false);361361- if (dev->dev_ops->phy_setup)362362- dev->dev_ops->phy_setup(dev, port, phy);363361364362 /* port_stp_state_set() will be called after to enable the port so365363 * there is no need to do anything.
-2
drivers/net/dsa/microchip/ksz_common.h
···119119 u32 (*get_port_addr)(int port, int offset);120120 void (*cfg_port_member)(struct ksz_device *dev, int port, u8 member);121121 void (*flush_dyn_mac_table)(struct ksz_device *dev, int port);122122- void (*phy_setup)(struct ksz_device *dev, int port,123123- struct phy_device *phy);124122 void (*port_cleanup)(struct ksz_device *dev, int port);125123 void (*port_setup)(struct ksz_device *dev, int port, bool cpu_port);126124 void (*r_phy)(struct ksz_device *dev, u16 phy, u16 reg, u16 *val);
+19-3
drivers/net/dsa/mv88e6xxx/chip.c
···664664 const struct phylink_link_state *state)665665{666666 struct mv88e6xxx_chip *chip = ds->priv;667667+ struct mv88e6xxx_port *p;667668 int err;669669+670670+ p = &chip->ports[port];668671669672 /* FIXME: is this the correct test? If we're in fixed mode on an670673 * internal port, why should we process this any different from···678675 return;679676680677 mv88e6xxx_reg_lock(chip);681681- /* FIXME: should we force the link down here - but if we do, how682682- * do we restore the link force/unforce state? The driver layering683683- * gets in the way.678678+ /* In inband mode, the link may come up at any time while the link679679+ * is not forced down. Force the link down while we reconfigure the680680+ * interface mode.684681 */682682+ if (mode == MLO_AN_INBAND && p->interface != state->interface &&683683+ chip->info->ops->port_set_link)684684+ chip->info->ops->port_set_link(chip, port, LINK_FORCED_DOWN);685685+685686 err = mv88e6xxx_port_config_interface(chip, port, state->interface);686687 if (err && err != -EOPNOTSUPP)687688 goto err_unlock;···697690 */698691 if (err > 0)699692 err = 0;693693+694694+ /* Undo the forced down state above after completing configuration695695+ * irrespective of its state on entry, which allows the link to come up.696696+ */697697+ if (mode == MLO_AN_INBAND && p->interface != state->interface &&698698+ chip->info->ops->port_set_link)699699+ chip->info->ops->port_set_link(chip, port, LINK_UNFORCED);700700+701701+ p->interface = state->interface;700702701703err_unlock:702704 mv88e6xxx_reg_unlock(chip);
···415415 self->aq_nic_cfg.aq_hw_caps->media_type == AQ_HW_MEDIA_TYPE_TP) {416416 self->aq_hw->phy_id = HW_ATL_PHY_ID_MAX;417417 err = aq_phy_init(self->aq_hw);418418+419419+ /* Disable the PTP on NICs where it's known to cause datapath420420+ * problems.421421+ * Ideally this should have been done by PHY provisioning, but422422+ * many units have been shipped with enabled PTP block already.423423+ */424424+ if (self->aq_nic_cfg.aq_hw_caps->quirks & AQ_NIC_QUIRK_BAD_PTP)425425+ if (self->aq_hw->phy_id != HW_ATL_PHY_ID_MAX)426426+ aq_phy_disable_ptp(self->aq_hw);418427 }419428420429 for (i = 0U; i < self->aq_vecs; i++) {
···3736373637373737 if (!(bp->caps & MACB_CAPS_USRIO_DISABLED)) {37383738 val = 0;37393739- if (bp->phy_interface == PHY_INTERFACE_MODE_RGMII)37393739+ if (phy_interface_mode_is_rgmii(bp->phy_interface))37403740 val = GEM_BIT(RGMII);37413741 else if (bp->phy_interface == PHY_INTERFACE_MODE_RMII &&37423742 (bp->caps & MACB_CAPS_USRIO_DEFAULT_IS_MII_GMII))
···29382938 DMA_BIT_MASK(40));29392939 if (err) {29402940 netdev_err(net_dev, "dma_coerce_mask_and_coherent() failed\n");29412941- return err;29412941+ goto free_netdev;29422942 }2943294329442944 /* If fsl_fm_max_frm is set to a higher value than the all-common 1500,
+1-1
drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c
···3632363236333633 dpni_dev = to_fsl_mc_device(priv->net_dev->dev.parent);36343634 dpmac_dev = fsl_mc_get_endpoint(dpni_dev);36353635- if (IS_ERR(dpmac_dev) || dpmac_dev->dev.type != &fsl_mc_bus_dpmac_type)36353635+ if (IS_ERR_OR_NULL(dpmac_dev) || dpmac_dev->dev.type != &fsl_mc_bus_dpmac_type)36363636 return 0;3637363736383638 if (dpaa2_mac_is_type_fixed(dpmac_dev, priv->mc_io))
···12941294 ndev->stats.tx_bytes += skb->len;12951295 }1296129612971297- if (unlikely(skb_shinfo(skb)->tx_flags & SKBTX_IN_PROGRESS) &&12981298- fep->bufdesc_ex) {12971297+ /* NOTE: SKBTX_IN_PROGRESS being set does not imply it's we who12981298+ * are to time stamp the packet, so we still need to check time12991299+ * stamping enabled flag.13001300+ */13011301+ if (unlikely(skb_shinfo(skb)->tx_flags & SKBTX_IN_PROGRESS &&13021302+ fep->hwts_tx_en) &&13031303+ fep->bufdesc_ex) {12991304 struct skb_shared_hwtstamps shhwtstamps;13001305 struct bufdesc_ex *ebdp = (struct bufdesc_ex *)bdp;13011306···27282723 return -ENODEV;2729272427302725 if (fep->bufdesc_ex) {27312731- if (cmd == SIOCSHWTSTAMP)27322732- return fec_ptp_set(ndev, rq);27332733- if (cmd == SIOCGHWTSTAMP)27342734- return fec_ptp_get(ndev, rq);27262726+ bool use_fec_hwts = !phy_has_hwtstamp(phydev);27272727+27282728+ if (cmd == SIOCSHWTSTAMP) {27292729+ if (use_fec_hwts)27302730+ return fec_ptp_set(ndev, rq);27312731+ fec_ptp_disable_hwts(ndev);27322732+ } else if (cmd == SIOCGHWTSTAMP) {27332733+ if (use_fec_hwts)27342734+ return fec_ptp_get(ndev, rq);27352735+ }27352736 }2736273727372738 return phy_mii_ioctl(phydev, rq, cmd);
···2121void ionic_rx_filter_replay(struct ionic_lif *lif)2222{2323 struct ionic_rx_filter_add_cmd *ac;2424+ struct hlist_head new_id_list;2425 struct ionic_admin_ctx ctx;2526 struct ionic_rx_filter *f;2627 struct hlist_head *head;2728 struct hlist_node *tmp;2929+ unsigned int key;2830 unsigned int i;2931 int err;30323333+ INIT_HLIST_HEAD(&new_id_list);3134 ac = &ctx.cmd.rx_filter_add;32353336 for (i = 0; i < IONIC_RX_FILTER_HLISTS; i++) {···6158 ac->mac.addr);6259 break;6360 }6161+ spin_lock_bh(&lif->rx_filters.lock);6262+ ionic_rx_filter_free(lif, f);6363+ spin_unlock_bh(&lif->rx_filters.lock);6464+6565+ continue;6466 }6767+6868+ /* remove from old id list, save new id in tmp list */6969+ spin_lock_bh(&lif->rx_filters.lock);7070+ hlist_del(&f->by_id);7171+ spin_unlock_bh(&lif->rx_filters.lock);7272+ f->filter_id = le32_to_cpu(ctx.comp.rx_filter_add.filter_id);7373+ hlist_add_head(&f->by_id, &new_id_list);6574 }6675 }7676+7777+ /* rebuild the by_id hash lists with the new filter ids */7878+ spin_lock_bh(&lif->rx_filters.lock);7979+ hlist_for_each_entry_safe(f, tmp, &new_id_list, by_id) {8080+ key = f->filter_id & IONIC_RX_FILTER_HLISTS_MASK;8181+ head = &lif->rx_filters.by_id[key];8282+ hlist_add_head(&f->by_id, head);8383+ }8484+ spin_unlock_bh(&lif->rx_filters.lock);6785}68866987int ionic_rx_filters_init(struct ionic_lif *lif)···93699470 spin_lock_init(&lif->rx_filters.lock);95717272+ spin_lock_bh(&lif->rx_filters.lock);9673 for (i = 0; i < IONIC_RX_FILTER_HLISTS; i++) {9774 INIT_HLIST_HEAD(&lif->rx_filters.by_hash[i]);9875 INIT_HLIST_HEAD(&lif->rx_filters.by_id[i]);9976 }7777+ spin_unlock_bh(&lif->rx_filters.lock);1007810179 return 0;10280}···11084 struct hlist_node *tmp;11185 unsigned int i;112868787+ spin_lock_bh(&lif->rx_filters.lock);11388 for (i = 0; i < IONIC_RX_FILTER_HLISTS; i++) {11489 head = &lif->rx_filters.by_id[i];11590 hlist_for_each_entry_safe(f, tmp, head, by_id)11691 ionic_rx_filter_free(lif, f);11792 }9393+ spin_unlock_bh(&lif->rx_filters.lock);11894}1199512096int ionic_rx_filter_save(struct ionic_lif *lif, u32 flow_id, u16 rxq_index,···152124 f->filter_id = le32_to_cpu(ctx->comp.rx_filter_add.filter_id);153125 f->rxq_index = rxq_index;154126 memcpy(&f->cmd, ac, sizeof(f->cmd));127127+ netdev_dbg(lif->netdev, "rx_filter add filter_id %d\n", f->filter_id);155128156129 INIT_HLIST_NODE(&f->by_hash);157130 INIT_HLIST_NODE(&f->by_id);
-6
drivers/net/ethernet/pensando/ionic/ionic_txrx.c
···161161 return;162162 }163163164164- /* no packet processing while resetting */165165- if (unlikely(test_bit(IONIC_LIF_F_QUEUE_RESET, q->lif->state))) {166166- stats->dropped++;167167- return;168168- }169169-170164 stats->pkts++;171165 stats->bytes += le16_to_cpu(comp->len);172166
+2-2
drivers/net/ethernet/qlogic/qed/qed_cxt.c
···20082008 enum protocol_type proto;2009200920102010 if (p_hwfn->mcp_info->func_info.protocol == QED_PCI_ETH_RDMA) {20112011- DP_NOTICE(p_hwfn,20122012- "Current day drivers don't support RoCE & iWARP simultaneously on the same PF. Default to RoCE-only\n");20112011+ DP_VERBOSE(p_hwfn, QED_MSG_SP,20122012+ "Current day drivers don't support RoCE & iWARP simultaneously on the same PF. Default to RoCE-only\n");20132013 p_hwfn->hw_info.personality = QED_PCI_ETH_ROCE;20142014 }20152015
+1-1
drivers/net/ethernet/qlogic/qed/qed_dev.c
···31023102 }3103310331043104 /* Log and clear previous pglue_b errors if such exist */31053105- qed_pglueb_rbc_attn_handler(p_hwfn, p_hwfn->p_main_ptt);31053105+ qed_pglueb_rbc_attn_handler(p_hwfn, p_hwfn->p_main_ptt, true);3106310631073107 /* Enable the PF's internal FID_enable in the PXP */31083108 rc = qed_pglueb_set_pfid_enable(p_hwfn, p_hwfn->p_main_ptt,
···14501450 struct ravb_private *priv = container_of(work, struct ravb_private,14511451 work);14521452 struct net_device *ndev = priv->ndev;14531453+ int error;1453145414541455 netif_tx_stop_all_queues(ndev);14551456···14591458 ravb_ptp_stop(ndev);1460145914611460 /* Wait for DMA stopping */14621462- ravb_stop_dma(ndev);14611461+ if (ravb_stop_dma(ndev)) {14621462+ /* If ravb_stop_dma() fails, the hardware is still operating14631463+ * for TX and/or RX. So, this should not call the following14641464+ * functions because ravb_dmac_init() is possible to fail too.14651465+ * Also, this should not retry ravb_stop_dma() again and again14661466+ * here because it's possible to wait forever. So, this just14671467+ * re-enables the TX and RX and skip the following14681468+ * re-initialization procedure.14691469+ */14701470+ ravb_rcv_snd_enable(ndev);14711471+ goto out;14721472+ }1463147314641474 ravb_ring_free(ndev, RAVB_BE);14651475 ravb_ring_free(ndev, RAVB_NC);1466147614671477 /* Device init */14681468- ravb_dmac_init(ndev);14781478+ error = ravb_dmac_init(ndev);14791479+ if (error) {14801480+ /* If ravb_dmac_init() fails, descriptors are freed. So, this14811481+ * should return here to avoid re-enabling the TX and RX in14821482+ * ravb_emac_init().14831483+ */14841484+ netdev_err(ndev, "%s: ravb_dmac_init() failed, error %d\n",14851485+ __func__, error);14861486+ return;14871487+ }14691488 ravb_emac_init(ndev);1470148914901490+out:14711491 /* Initialise PTP Clock driver */14721492 if (priv->chip_id == RCAR_GEN2)14731493 ravb_ptp_init(ndev, priv->pdev);
+2-2
drivers/net/ethernet/smsc/smc91x.c
···22742274 ret = try_toggle_control_gpio(&pdev->dev, &lp->power_gpio,22752275 "power", 0, 0, 100);22762276 if (ret)22772277- return ret;22772277+ goto out_free_netdev;2278227822792279 /*22802280 * Optional reset GPIO configured? Minimum 100 ns reset needed···22832283 ret = try_toggle_control_gpio(&pdev->dev, &lp->reset_gpio,22842284 "reset", 0, 0, 100);22852285 if (ret)22862286- return ret;22862286+ goto out_free_netdev;2287228722882288 /*22892289 * Need to wait for optional EEPROM to load, max 750 us according
+1-1
drivers/net/ethernet/socionext/sni_ave.c
···11911191 ret = regmap_update_bits(priv->regmap, SG_ETPINMODE,11921192 priv->pinmode_mask, priv->pinmode_val);11931193 if (ret)11941194- return ret;11941194+ goto out_reset_assert;1195119511961196 ave_global_reset(ndev);11971197
···183183 netif_wake_queue(sl->dev);184184}185185186186-/* Send one completely decapsulated IP datagram to the IP layer. */186186+/* Send an LAPB frame to the LAPB module to process. */187187188188static void x25_asy_bump(struct x25_asy *sl)189189{···195195 count = sl->rcount;196196 dev->stats.rx_bytes += count;197197198198- skb = dev_alloc_skb(count+1);198198+ skb = dev_alloc_skb(count);199199 if (skb == NULL) {200200 netdev_warn(sl->dev, "memory squeeze, dropping packet\n");201201 dev->stats.rx_dropped++;202202 return;203203 }204204- skb_push(skb, 1); /* LAPB internal control */205204 skb_put_data(skb, sl->rbuff, count);206205 skb->protocol = x25_type_trans(skb, sl->dev);207206 err = lapb_data_received(skb->dev, skb);···208209 kfree_skb(skb);209210 printk(KERN_DEBUG "x25_asy: data received err - %d\n", err);210211 } else {211211- netif_rx(skb);212212 dev->stats.rx_packets++;213213 }214214}···354356 */355357356358/*357357- * Called when I frame data arrives. We did the work above - throw it358358- * at the net layer.359359+ * Called when I frame data arrive. We add a pseudo header for upper360360+ * layers and pass it to upper layers.359361 */360362361363static int x25_asy_data_indication(struct net_device *dev, struct sk_buff *skb)362364{365365+ if (skb_cow(skb, 1)) {366366+ kfree_skb(skb);367367+ return NET_RX_DROP;368368+ }369369+ skb_push(skb, 1);370370+ skb->data[0] = X25_IFACE_DATA;371371+372372+ skb->protocol = x25_type_trans(skb, dev);373373+363374 return netif_rx(skb);364375}365376···664657 switch (s) {665658 case X25_END:666659 if (!test_and_clear_bit(SLF_ERROR, &sl->flags) &&667667- sl->rcount > 2)660660+ sl->rcount >= 2)668661 x25_asy_bump(sl);669662 clear_bit(SLF_ESCAPE, &sl->flags);670663 sl->rcount = 0;
···7272{7373 int ret;74747575- ret = mt76_eeprom_init(&dev->mt76, MT7615_EEPROM_SIZE +7676- MT7615_EEPROM_EXTRA_DATA);7575+ ret = mt76_eeprom_init(&dev->mt76, MT7615_EEPROM_FULL_SIZE);7776 if (ret < 0)7877 return ret;7978
···46384638 * pcie_wait_for_link_delay - Wait until link is active or inactive46394639 * @pdev: Bridge device46404640 * @active: waiting for active or inactive?46414641- * @delay: Delay to wait after link has become active (in ms). Specify %046424642- * for no delay.46414641+ * @delay: Delay to wait after link has become active (in ms)46434642 *46444643 * Use this to wait till link becomes active or inactive.46454644 */···46794680 msleep(10);46804681 timeout -= 10;46814682 }46824682- if (active && ret && delay)46834683+ if (active && ret)46834684 msleep(delay);46844685 else if (ret != active)46854686 pci_info(pdev, "Data Link Layer Link Active not %s in 1000 msec\n",···48004801 if (!pcie_downstream_port(dev))48014802 return;4802480348034803- /*48044804- * Per PCIe r5.0, sec 6.6.1, for downstream ports that support48054805- * speeds > 5 GT/s, we must wait for link training to complete48064806- * before the mandatory delay.48074807- *48084808- * We can only tell when link training completes via DLL Link48094809- * Active, which is required for downstream ports that support48104810- * speeds > 5 GT/s (sec 7.5.3.6). Unfortunately some common48114811- * devices do not implement Link Active reporting even when it's48124812- * required, so we'll check for that directly instead of checking48134813- * the supported link speed. We assume devices without Link Active48144814- * reporting can train in 100 ms regardless of speed.48154815- */48164816- if (dev->link_active_reporting) {48174817- pci_dbg(dev, "waiting for link to train\n");48184818- if (!pcie_wait_for_link_delay(dev, true, 0)) {48044804+ if (pcie_get_speed_cap(dev) <= PCIE_SPEED_5_0GT) {48054805+ pci_dbg(dev, "waiting %d ms for downstream link\n", delay);48064806+ msleep(delay);48074807+ } else {48084808+ pci_dbg(dev, "waiting %d ms for downstream link, after activation\n",48094809+ delay);48104810+ if (!pcie_wait_for_link_delay(dev, true, delay)) {48194811 /* Did not train, no need to wait any further */48204812 return;48214813 }48224814 }48234823- pci_dbg(child, "waiting %d ms to become accessible\n", delay);48244824- msleep(delay);4825481548264816 if (!pci_device_is_present(child)) {48274817 pci_dbg(child, "waiting additional %d ms to become accessible\n", delay);
+11-5
drivers/scsi/scsi_lib.c
···547547 scsi_uninit_cmd(cmd);548548}549549550550+static void scsi_run_queue_async(struct scsi_device *sdev)551551+{552552+ if (scsi_target(sdev)->single_lun ||553553+ !list_empty(&sdev->host->starved_list))554554+ kblockd_schedule_work(&sdev->requeue_work);555555+ else556556+ blk_mq_run_hw_queues(sdev->request_queue, true);557557+}558558+550559/* Returns false when no more bytes to process, true if there are more */551560static bool scsi_end_request(struct request *req, blk_status_t error,552561 unsigned int bytes)···600591601592 __blk_mq_end_request(req, error);602593603603- if (scsi_target(sdev)->single_lun ||604604- !list_empty(&sdev->host->starved_list))605605- kblockd_schedule_work(&sdev->requeue_work);606606- else607607- blk_mq_run_hw_queues(q, true);594594+ scsi_run_queue_async(sdev);608595609596 percpu_ref_put(&q->q_usage_counter);610597 return false;···17071702 */17081703 if (req->rq_flags & RQF_DONTPREP)17091704 scsi_mq_uninit_cmd(cmd);17051705+ scsi_run_queue_async(sdev);17101706 break;17111707 }17121708 return ret;
···332332 case COMEDI_DIGITAL_TRIG_ENABLE_EDGES:333333 /* check shift amount */334334 shift = data[3];335335- if (shift >= s->n_chan) {335335+ if (shift >= 32) {336336 mask = 0;337337 rising = 0;338338 falling = 0;
+1-1
drivers/staging/media/atomisp/Kconfig
···2222 module will be called atomisp23232424config VIDEO_ATOMISP_ISP24012525- bool "VIDEO_ATOMISP_ISP2401"2525+ bool "Use Intel Atom ISP on Cherrytail/Anniedale (ISP2401)"2626 depends on VIDEO_ATOMISP2727 help2828 Enable support for Atom ISP2401-based boards.
···495495 ret = ov2680_read_reg(client, 1, OV2680_MIRROR_REG, &val);496496 if (ret)497497 return ret;498498- if (value) {498498+ if (value)499499 val |= OV2680_FLIP_MIRROR_BIT_ENABLE;500500- } else {500500+ else501501 val &= ~OV2680_FLIP_MIRROR_BIT_ENABLE;502502- }502502+503503 ret = ov2680_write_reg(client, 1,504504 OV2680_MIRROR_REG, val);505505 if (ret)
···250250#define IS_MFLD __IS_SOC(INTEL_FAM6_ATOM_SALTWELL_MID)251251#define IS_BYT __IS_SOC(INTEL_FAM6_ATOM_SILVERMONT)252252#define IS_CHT __IS_SOC(INTEL_FAM6_ATOM_AIRMONT)253253+#define IS_MRFD __IS_SOC(INTEL_FAM6_ATOM_SILVERMONT_MID)253254#define IS_MOFD __IS_SOC(INTEL_FAM6_ATOM_AIRMONT_MID)254255255256/* Both CHT and MOFD come with ISP2401 */
···355355356356 pgnr = DIV_ROUND_UP(map->length, PAGE_SIZE);357357 if (pgnr < ((PAGE_ALIGN(map->length)) >> PAGE_SHIFT)) {358358- dev_err(atomisp_dev,358358+ dev_err(asd->isp->dev,359359 "user space memory size is less than the expected size..\n");360360 return -ENOMEM;361361 } else if (pgnr > ((PAGE_ALIGN(map->length)) >> PAGE_SHIFT)) {362362- dev_err(atomisp_dev,362362+ dev_err(asd->isp->dev,363363 "user space memory size is large than the expected size..\n");364364 return -ENOMEM;365365 }
···2626#define CLK_RATE_19_2MHZ 192000002727#define CLK_RATE_25_0MHZ 2500000028282929+/* Valid clock number range from 0 to 5 */3030+#define MAX_CLK_COUNT 53131+2932/* X-Powers AXP288 register set */3033#define ALDO1_SEL_REG 0x283134#define ALDO1_CTRL3_REG 0x13···64616562struct gmin_subdev {6663 struct v4l2_subdev *subdev;6767- int clock_num;6864 enum clock_rate clock_src;6969- bool clock_on;7065 struct clk *pmc_clk;7166 struct gpio_desc *gpio0;7267 struct gpio_desc *gpio1;···7675 unsigned int csi_lanes;7776 enum atomisp_input_format csi_fmt;7877 enum atomisp_bayer_order csi_bayer;7878+7979+ bool clock_on;7980 bool v1p8_on;8081 bool v2p8_on;8182 bool v1p2_on;8283 bool v2p8_vcm_on;8484+8585+ int v1p8_gpio;8686+ int v2p8_gpio;83878488 u8 pwm_i2c_addr;8589···9690static struct gmin_subdev gmin_subdevs[MAX_SUBDEVS];97919892/* ACPI HIDs for the PMICs that could be used by this driver */9999-#define PMIC_ACPI_AXP "INT33F4:00" /* XPower AXP288 PMIC */100100-#define PMIC_ACPI_TI "INT33F5:00" /* Dollar Cove TI PMIC */101101-#define PMIC_ACPI_CRYSTALCOVE "INT33FD:00" /* Crystal Cove PMIC */9393+#define PMIC_ACPI_AXP "INT33F4" /* XPower AXP288 PMIC */9494+#define PMIC_ACPI_TI "INT33F5" /* Dollar Cove TI PMIC */9595+#define PMIC_ACPI_CRYSTALCOVE "INT33FD" /* Crystal Cove PMIC */1029610397#define PMIC_PLATFORM_TI "intel_soc_pmic_chtdc_ti"10498···111105} pmic_id;112106113107static const char *pmic_name[] = {114114- [PMIC_UNSET] = "unset",108108+ [PMIC_UNSET] = "ACPI device PM",115109 [PMIC_REGULATOR] = "regulator driver",116110 [PMIC_AXP] = "XPower AXP288 PMIC",117111 [PMIC_TI] = "Dollar Cove TI PMIC",···124118static const struct atomisp_platform_data pdata = {125119 .subdevs = pdata_subdevs,126120};127127-128128-/*129129- * Something of a hack. The ECS E7 board drives camera 2.8v from an130130- * external regulator instead of the PMIC. There's a gmin_CamV2P8131131- * config variable that specifies the GPIO to handle this particular132132- * case, but this needs a broader architecture for handling camera133133- * power.134134- */135135-enum { V2P8_GPIO_UNSET = -2, V2P8_GPIO_NONE = -1 };136136-static int v2p8_gpio = V2P8_GPIO_UNSET;137137-138138-/*139139- * Something of a hack. The CHT RVP board drives camera 1.8v from an140140- * external regulator instead of the PMIC just like ECS E7 board, see the141141- * comments above.142142- */143143-enum { V1P8_GPIO_UNSET = -2, V1P8_GPIO_NONE = -1 };144144-static int v1p8_gpio = V1P8_GPIO_UNSET;145121146122static LIST_HEAD(vcm_devices);147123static DEFINE_MUTEX(vcm_lock);···187199 * gmin_subdev struct is already initialized for us.188200 */189201 gs = find_gmin_subdev(subdev);202202+ if (!gs)203203+ return -ENODEV;190204191205 pdata.subdevs[i].type = type;192206 pdata.subdevs[i].port = gs->csi_port;···284294 {"INT33F8:00_CsiFmt", "13"},285295 {"INT33F8:00_CsiBayer", "0"},286296 {"INT33F8:00_CamClk", "0"},297297+287298 {"INT33F9:00_CamType", "1"},288299 {"INT33F9:00_CsiPort", "0"},289300 {"INT33F9:00_CsiLanes", "1"},···300309 {"INT33BE:00_CsiFmt", "13"},301310 {"INT33BE:00_CsiBayer", "2"},302311 {"INT33BE:00_CamClk", "0"},312312+303313 {"INT33F0:00_CsiPort", "0"},304314 {"INT33F0:00_CsiLanes", "1"},305315 {"INT33F0:00_CsiFmt", "13"},···314322 {"XXOV2680:00_CsiPort", "1"},315323 {"XXOV2680:00_CsiLanes", "1"},316324 {"XXOV2680:00_CamClk", "0"},325325+317326 {"XXGC0310:00_CsiPort", "0"},318327 {"XXGC0310:00_CsiLanes", "1"},319328 {"XXGC0310:00_CamClk", "1"},···374381#define GMIN_PMC_CLK_NAME 14 /* "pmc_plt_clk_[0..5]" */375382static char gmin_pmc_clk_name[GMIN_PMC_CLK_NAME];376383377377-static int gmin_i2c_match_one(struct device *dev, const void *data)378378-{379379- const char *name = data;380380- struct i2c_client *client;381381-382382- if (dev->type != &i2c_client_type)383383- return 0;384384-385385- client = to_i2c_client(dev);386386-387387- return (!strcmp(name, client->name));388388-}389389-390384static struct i2c_client *gmin_i2c_dev_exists(struct device *dev, char *name,391385 struct i2c_client **client)392386{387387+ struct acpi_device *adev;393388 struct device *d;394389395395- while ((d = bus_find_device(&i2c_bus_type, NULL, name,396396- gmin_i2c_match_one))) {397397- *client = to_i2c_client(d);398398- dev_dbg(dev, "found '%s' at address 0x%02x, adapter %d\n",399399- (*client)->name, (*client)->addr,400400- (*client)->adapter->nr);401401- return *client;402402- }390390+ adev = acpi_dev_get_first_match_dev(name, NULL, -1);391391+ if (!adev)392392+ return NULL;403393404404- return NULL;394394+ d = bus_find_device_by_acpi_dev(&i2c_bus_type, adev);395395+ acpi_dev_put(adev);396396+ if (!d)397397+ return NULL;398398+399399+ *client = i2c_verify_client(d);400400+ put_device(d);401401+402402+ dev_dbg(dev, "found '%s' at address 0x%02x, adapter %d\n",403403+ (*client)->name, (*client)->addr, (*client)->adapter->nr);404404+ return *client;405405}406406407407static int gmin_i2c_write(struct device *dev, u16 i2c_addr, u8 reg,···413427 "I2C write, addr: 0x%02x, reg: 0x%02x, value: 0x%02x, mask: 0x%02x\n",414428 i2c_addr, reg, value, mask);415429416416- ret = intel_soc_pmic_exec_mipi_pmic_seq_element(i2c_addr, reg,417417- value, mask);418418-419419- if (ret == -EOPNOTSUPP) {430430+ ret = intel_soc_pmic_exec_mipi_pmic_seq_element(i2c_addr, reg, value, mask);431431+ if (ret == -EOPNOTSUPP)420432 dev_err(dev,421433 "ACPI didn't mapped the OpRegion needed to access I2C address 0x%02x.\n"422422- "Need to compile the Kernel using CONFIG_*_PMIC_OPREGION settings\n",434434+ "Need to compile the kernel using CONFIG_*_PMIC_OPREGION settings\n",423435 i2c_addr);424424- return ret;425425- }426436427437 return ret;428438}429439430430-static struct gmin_subdev *gmin_subdev_add(struct v4l2_subdev *subdev)440440+static int atomisp_get_acpi_power(struct device *dev)431441{432432- struct i2c_client *power = NULL, *client = v4l2_get_subdevdata(subdev);433433- struct acpi_device *adev;434434- acpi_handle handle;435435- struct device *dev;436436- int i, ret;442442+ char name[5];443443+ struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL };444444+ struct acpi_buffer b_name = { sizeof(name), name };445445+ union acpi_object *package, *element;446446+ acpi_handle handle = ACPI_HANDLE(dev);447447+ acpi_handle rhandle;448448+ acpi_status status;449449+ int clock_num = -1;450450+ int i;437451438438- if (!client)439439- return NULL;452452+ status = acpi_evaluate_object(handle, "_PR0", NULL, &buffer);453453+ if (!ACPI_SUCCESS(status))454454+ return -1;440455441441- dev = &client->dev;456456+ package = buffer.pointer;442457443443- handle = ACPI_HANDLE(dev);458458+ if (!buffer.length || !package459459+ || package->type != ACPI_TYPE_PACKAGE460460+ || !package->package.count)461461+ goto fail;444462445445- // FIXME: may need to release resources allocated by acpi_bus_get_device()446446- if (!handle || acpi_bus_get_device(handle, &adev)) {447447- dev_err(dev, "Error could not get ACPI device\n");448448- return NULL;463463+ for (i = 0; i < package->package.count; i++) {464464+ element = &package->package.elements[i];465465+466466+ if (element->type != ACPI_TYPE_LOCAL_REFERENCE)467467+ continue;468468+469469+ rhandle = element->reference.handle;470470+ if (!rhandle)471471+ goto fail;472472+473473+ acpi_get_name(rhandle, ACPI_SINGLE_NAME, &b_name);474474+475475+ dev_dbg(dev, "Found PM resource '%s'\n", name);476476+ if (strlen(name) == 4 && !strncmp(name, "CLK", 3)) {477477+ if (name[3] >= '0' && name[3] <= '4')478478+ clock_num = name[3] - '0';479479+#if 0480480+ /*481481+ * We could abort here, but let's parse all resources,482482+ * as this is helpful for debugging purposes483483+ */484484+ if (clock_num >= 0)485485+ break;486486+#endif487487+ }449488 }450489451451- dev_info(&client->dev, "%s: ACPI detected it on bus ID=%s, HID=%s\n",452452- __func__, acpi_device_bid(adev), acpi_device_hid(adev));490490+fail:491491+ ACPI_FREE(buffer.pointer);453492454454- if (!pmic_id) {455455- if (gmin_i2c_dev_exists(dev, PMIC_ACPI_TI, &power))456456- pmic_id = PMIC_TI;457457- else if (gmin_i2c_dev_exists(dev, PMIC_ACPI_AXP, &power))458458- pmic_id = PMIC_AXP;459459- else if (gmin_i2c_dev_exists(dev, PMIC_ACPI_CRYSTALCOVE, &power))460460- pmic_id = PMIC_CRYSTALCOVE;461461- else462462- pmic_id = PMIC_REGULATOR;463463- }493493+ return clock_num;494494+}464495465465- for (i = 0; i < MAX_SUBDEVS && gmin_subdevs[i].subdev; i++)466466- ;467467- if (i >= MAX_SUBDEVS)468468- return NULL;496496+static u8 gmin_get_pmic_id_and_addr(struct device *dev)497497+{498498+ struct i2c_client *power;499499+ static u8 pmic_i2c_addr;469500470470- if (power) {471471- gmin_subdevs[i].pwm_i2c_addr = power->addr;472472- dev_info(dev,473473- "gmin: power management provided via %s (i2c addr 0x%02x)\n",474474- pmic_name[pmic_id], power->addr);475475- } else {476476- dev_info(dev, "gmin: power management provided via %s\n",477477- pmic_name[pmic_id]);478478- }501501+ if (pmic_id)502502+ return pmic_i2c_addr;479503480480- gmin_subdevs[i].subdev = subdev;481481- gmin_subdevs[i].clock_num = gmin_get_var_int(dev, false, "CamClk", 0);504504+ if (gmin_i2c_dev_exists(dev, PMIC_ACPI_TI, &power))505505+ pmic_id = PMIC_TI;506506+ else if (gmin_i2c_dev_exists(dev, PMIC_ACPI_AXP, &power))507507+ pmic_id = PMIC_AXP;508508+ else if (gmin_i2c_dev_exists(dev, PMIC_ACPI_CRYSTALCOVE, &power))509509+ pmic_id = PMIC_CRYSTALCOVE;510510+ else511511+ pmic_id = PMIC_REGULATOR;512512+513513+ pmic_i2c_addr = power ? power->addr : 0;514514+ return pmic_i2c_addr;515515+}516516+517517+static int gmin_detect_pmic(struct v4l2_subdev *subdev)518518+{519519+ struct i2c_client *client = v4l2_get_subdevdata(subdev);520520+ struct device *dev = &client->dev;521521+ u8 pmic_i2c_addr;522522+523523+ pmic_i2c_addr = gmin_get_pmic_id_and_addr(dev);524524+ dev_info(dev, "gmin: power management provided via %s (i2c addr 0x%02x)\n",525525+ pmic_name[pmic_id], pmic_i2c_addr);526526+ return pmic_i2c_addr;527527+}528528+529529+static int gmin_subdev_add(struct gmin_subdev *gs)530530+{531531+ struct i2c_client *client = v4l2_get_subdevdata(gs->subdev);532532+ struct device *dev = &client->dev;533533+ struct acpi_device *adev = ACPI_COMPANION(dev);534534+ int ret, clock_num = -1;535535+536536+ dev_info(dev, "%s: ACPI path is %pfw\n", __func__, dev_fwnode(dev));537537+482538 /*WA:CHT requires XTAL clock as PLL is not stable.*/483483- gmin_subdevs[i].clock_src = gmin_get_var_int(dev, false, "ClkSrc",484484- VLV2_CLK_PLL_19P2MHZ);485485- gmin_subdevs[i].csi_port = gmin_get_var_int(dev, false, "CsiPort", 0);486486- gmin_subdevs[i].csi_lanes = gmin_get_var_int(dev, false, "CsiLanes", 1);539539+ gs->clock_src = gmin_get_var_int(dev, false, "ClkSrc",540540+ VLV2_CLK_PLL_19P2MHZ);487541488488- /* get PMC clock with clock framework */489489- snprintf(gmin_pmc_clk_name,490490- sizeof(gmin_pmc_clk_name),491491- "%s_%d", "pmc_plt_clk", gmin_subdevs[i].clock_num);542542+ gs->csi_port = gmin_get_var_int(dev, false, "CsiPort", 0);543543+ gs->csi_lanes = gmin_get_var_int(dev, false, "CsiLanes", 1);492544493493- gmin_subdevs[i].pmc_clk = devm_clk_get(dev, gmin_pmc_clk_name);494494- if (IS_ERR(gmin_subdevs[i].pmc_clk)) {495495- ret = PTR_ERR(gmin_subdevs[i].pmc_clk);545545+ gs->gpio0 = gpiod_get_index(dev, NULL, 0, GPIOD_OUT_LOW);546546+ if (IS_ERR(gs->gpio0))547547+ gs->gpio0 = NULL;548548+ else549549+ dev_info(dev, "will handle gpio0 via ACPI\n");496550497497- dev_err(dev,498498- "Failed to get clk from %s : %d\n",499499- gmin_pmc_clk_name,500500- ret);551551+ gs->gpio1 = gpiod_get_index(dev, NULL, 1, GPIOD_OUT_LOW);552552+ if (IS_ERR(gs->gpio1))553553+ gs->gpio1 = NULL;554554+ else555555+ dev_info(dev, "will handle gpio1 via ACPI\n");501556502502- return NULL;557557+ /*558558+ * Those are used only when there is an external regulator apart559559+ * from the PMIC that would be providing power supply, like on the560560+ * two cases below:561561+ *562562+ * The ECS E7 board drives camera 2.8v from an external regulator563563+ * instead of the PMIC. There's a gmin_CamV2P8 config variable564564+ * that specifies the GPIO to handle this particular case,565565+ * but this needs a broader architecture for handling camera power.566566+ *567567+ * The CHT RVP board drives camera 1.8v from an* external regulator568568+ * instead of the PMIC just like ECS E7 board.569569+ */570570+571571+ gs->v1p8_gpio = gmin_get_var_int(dev, true, "V1P8GPIO", -1);572572+ gs->v2p8_gpio = gmin_get_var_int(dev, true, "V2P8GPIO", -1);573573+574574+ /*575575+ * FIXME:576576+ *577577+ * The ACPI handling code checks for the _PR? tables in order to578578+ * know what is required to switch the device from power state579579+ * D0 (_PR0) up to D3COLD (_PR3).580580+ *581581+ * The adev->flags.power_manageable is set to true if the device582582+ * has a _PR0 table, which can be checked by calling583583+ * acpi_device_power_manageable(adev).584584+ *585585+ * However, this only says that the device can be set to power off586586+ * mode.587587+ *588588+ * At least on the DSDT tables we've seen so far, there's no _PR3,589589+ * nor _PS3 (which would have a somewhat similar effect).590590+ * So, using ACPI for power management won't work, except if adding591591+ * an ACPI override logic somewhere.592592+ *593593+ * So, at least for the existing devices we know, the check below594594+ * will always be false.595595+ */596596+ if (acpi_device_can_wakeup(adev) &&597597+ acpi_device_can_poweroff(adev)) {598598+ dev_info(dev,599599+ "gmin: power management provided via device PM\n");600600+ return 0;503601 }602602+603603+ /*604604+ * The code below is here due to backward compatibility with devices605605+ * whose ACPI BIOS may not contain everything that would be needed606606+ * in order to set clocks and do power management.607607+ */608608+609609+ /*610610+ * According with :611611+ * https://github.com/projectceladon/hardware-intel-kernelflinger/blob/master/doc/fastboot.md612612+ *613613+ * The "CamClk" EFI var is set via fastboot on some Android devices,614614+ * and seems to contain the number of the clock used to feed the615615+ * sensor.616616+ *617617+ * On systems with a proper ACPI table, this is given via the _PR0618618+ * power resource table. The logic below should first check if there619619+ * is a power resource already, falling back to the EFI vars detection620620+ * otherwise.621621+ */622622+623623+ /* Try first to use ACPI to get the clock resource */624624+ if (acpi_device_power_manageable(adev))625625+ clock_num = atomisp_get_acpi_power(dev);626626+627627+ /* Fall-back use EFI and/or DMI match */628628+ if (clock_num < 0)629629+ clock_num = gmin_get_var_int(dev, false, "CamClk", 0);630630+631631+ if (clock_num < 0 || clock_num > MAX_CLK_COUNT) {632632+ dev_err(dev, "Invalid clock number\n");633633+ return -EINVAL;634634+ }635635+636636+ snprintf(gmin_pmc_clk_name, sizeof(gmin_pmc_clk_name),637637+ "%s_%d", "pmc_plt_clk", clock_num);638638+639639+ gs->pmc_clk = devm_clk_get(dev, gmin_pmc_clk_name);640640+ if (IS_ERR(gs->pmc_clk)) {641641+ ret = PTR_ERR(gs->pmc_clk);642642+ dev_err(dev, "Failed to get clk from %s: %d\n", gmin_pmc_clk_name, ret);643643+ return ret;644644+ }645645+ dev_info(dev, "Will use CLK%d (%s)\n", clock_num, gmin_pmc_clk_name);504646505647 /*506648 * The firmware might enable the clock at···640526 * to disable a clock that has not been enabled,641527 * we need to enable the clock first.642528 */643643- ret = clk_prepare_enable(gmin_subdevs[i].pmc_clk);529529+ ret = clk_prepare_enable(gs->pmc_clk);644530 if (!ret)645645- clk_disable_unprepare(gmin_subdevs[i].pmc_clk);646646-647647- gmin_subdevs[i].gpio0 = gpiod_get_index(dev, NULL, 0, GPIOD_OUT_LOW);648648- if (IS_ERR(gmin_subdevs[i].gpio0))649649- gmin_subdevs[i].gpio0 = NULL;650650-651651- gmin_subdevs[i].gpio1 = gpiod_get_index(dev, NULL, 1, GPIOD_OUT_LOW);652652- if (IS_ERR(gmin_subdevs[i].gpio1))653653- gmin_subdevs[i].gpio1 = NULL;531531+ clk_disable_unprepare(gs->pmc_clk);654532655533 switch (pmic_id) {656534 case PMIC_REGULATOR:657657- gmin_subdevs[i].v1p8_reg = regulator_get(dev, "V1P8SX");658658- gmin_subdevs[i].v2p8_reg = regulator_get(dev, "V2P8SX");535535+ gs->v1p8_reg = regulator_get(dev, "V1P8SX");536536+ gs->v2p8_reg = regulator_get(dev, "V2P8SX");659537660660- gmin_subdevs[i].v1p2_reg = regulator_get(dev, "V1P2A");661661- gmin_subdevs[i].v2p8_vcm_reg = regulator_get(dev, "VPROG4B");538538+ gs->v1p2_reg = regulator_get(dev, "V1P2A");539539+ gs->v2p8_vcm_reg = regulator_get(dev, "VPROG4B");662540663541 /* Note: ideally we would initialize v[12]p8_on to the664542 * output of regulator_is_enabled(), but sadly that···662556 break;663557664558 case PMIC_AXP:665665- gmin_subdevs[i].eldo1_1p8v = gmin_get_var_int(dev, false,666666- "eldo1_1p8v",667667- ELDO1_1P8V);668668- gmin_subdevs[i].eldo1_sel_reg = gmin_get_var_int(dev, false,669669- "eldo1_sel_reg",670670- ELDO1_SEL_REG);671671- gmin_subdevs[i].eldo1_ctrl_shift = gmin_get_var_int(dev, false,672672- "eldo1_ctrl_shift",673673- ELDO1_CTRL_SHIFT);674674- gmin_subdevs[i].eldo2_1p8v = gmin_get_var_int(dev, false,675675- "eldo2_1p8v",676676- ELDO2_1P8V);677677- gmin_subdevs[i].eldo2_sel_reg = gmin_get_var_int(dev, false,678678- "eldo2_sel_reg",679679- ELDO2_SEL_REG);680680- gmin_subdevs[i].eldo2_ctrl_shift = gmin_get_var_int(dev, false,681681- "eldo2_ctrl_shift",682682- ELDO2_CTRL_SHIFT);683683- gmin_subdevs[i].pwm_i2c_addr = power->addr;559559+ gs->eldo1_1p8v = gmin_get_var_int(dev, false,560560+ "eldo1_1p8v",561561+ ELDO1_1P8V);562562+ gs->eldo1_sel_reg = gmin_get_var_int(dev, false,563563+ "eldo1_sel_reg",564564+ ELDO1_SEL_REG);565565+ gs->eldo1_ctrl_shift = gmin_get_var_int(dev, false,566566+ "eldo1_ctrl_shift",567567+ ELDO1_CTRL_SHIFT);568568+ gs->eldo2_1p8v = gmin_get_var_int(dev, false,569569+ "eldo2_1p8v",570570+ ELDO2_1P8V);571571+ gs->eldo2_sel_reg = gmin_get_var_int(dev, false,572572+ "eldo2_sel_reg",573573+ ELDO2_SEL_REG);574574+ gs->eldo2_ctrl_shift = gmin_get_var_int(dev, false,575575+ "eldo2_ctrl_shift",576576+ ELDO2_CTRL_SHIFT);684577 break;685578686579 default:687580 break;688581 }689582690690- return &gmin_subdevs[i];583583+ return 0;691584}692585693586static struct gmin_subdev *find_gmin_subdev(struct v4l2_subdev *subdev)···696591 for (i = 0; i < MAX_SUBDEVS; i++)697592 if (gmin_subdevs[i].subdev == subdev)698593 return &gmin_subdevs[i];699699- return gmin_subdev_add(subdev);594594+ return NULL;595595+}596596+597597+static struct gmin_subdev *find_free_gmin_subdev_slot(void)598598+{599599+ unsigned int i;600600+601601+ for (i = 0; i < MAX_SUBDEVS; i++)602602+ if (gmin_subdevs[i].subdev == NULL)603603+ return &gmin_subdevs[i];604604+ return NULL;700605}701606702607static int axp_regulator_set(struct device *dev, struct gmin_subdev *gs,···815700{816701 struct gmin_subdev *gs = find_gmin_subdev(subdev);817702 int ret;818818- struct device *dev;819819- struct i2c_client *client = v4l2_get_subdevdata(subdev);820703 int value;821704822822- dev = &client->dev;823823-824824- if (v1p8_gpio == V1P8_GPIO_UNSET) {825825- v1p8_gpio = gmin_get_var_int(dev, true,826826- "V1P8GPIO", V1P8_GPIO_NONE);827827- if (v1p8_gpio != V1P8_GPIO_NONE) {828828- pr_info("atomisp_gmin_platform: 1.8v power on GPIO %d\n",829829- v1p8_gpio);830830- ret = gpio_request(v1p8_gpio, "camera_v1p8_en");831831- if (!ret)832832- ret = gpio_direction_output(v1p8_gpio, 0);833833- if (ret)834834- pr_err("V1P8 GPIO initialization failed\n");835835- }705705+ if (gs->v1p8_gpio >= 0) {706706+ pr_info("atomisp_gmin_platform: 1.8v power on GPIO %d\n",707707+ gs->v1p8_gpio);708708+ ret = gpio_request(gs->v1p8_gpio, "camera_v1p8_en");709709+ if (!ret)710710+ ret = gpio_direction_output(gs->v1p8_gpio, 0);711711+ if (ret)712712+ pr_err("V1P8 GPIO initialization failed\n");836713 }837714838715 if (!gs || gs->v1p8_on == on)839716 return 0;840717 gs->v1p8_on = on;841718842842- if (v1p8_gpio >= 0)843843- gpio_set_value(v1p8_gpio, on);719719+ if (gs->v1p8_gpio >= 0)720720+ gpio_set_value(gs->v1p8_gpio, on);844721845722 if (gs->v1p8_reg) {846723 regulator_set_voltage(gs->v1p8_reg, 1800000, 1800000);···869762{870763 struct gmin_subdev *gs = find_gmin_subdev(subdev);871764 int ret;872872- struct device *dev;873873- struct i2c_client *client = v4l2_get_subdevdata(subdev);874765 int value;875766876876- dev = &client->dev;877877-878878- if (v2p8_gpio == V2P8_GPIO_UNSET) {879879- v2p8_gpio = gmin_get_var_int(dev, true,880880- "V2P8GPIO", V2P8_GPIO_NONE);881881- if (v2p8_gpio != V2P8_GPIO_NONE) {882882- pr_info("atomisp_gmin_platform: 2.8v power on GPIO %d\n",883883- v2p8_gpio);884884- ret = gpio_request(v2p8_gpio, "camera_v2p8");885885- if (!ret)886886- ret = gpio_direction_output(v2p8_gpio, 0);887887- if (ret)888888- pr_err("V2P8 GPIO initialization failed\n");889889- }767767+ if (gs->v2p8_gpio >= 0) {768768+ pr_info("atomisp_gmin_platform: 2.8v power on GPIO %d\n",769769+ gs->v2p8_gpio);770770+ ret = gpio_request(gs->v2p8_gpio, "camera_v2p8");771771+ if (!ret)772772+ ret = gpio_direction_output(gs->v2p8_gpio, 0);773773+ if (ret)774774+ pr_err("V2P8 GPIO initialization failed\n");890775 }891776892777 if (!gs || gs->v2p8_on == on)893778 return 0;894779 gs->v2p8_on = on;895780896896- if (v2p8_gpio >= 0)897897- gpio_set_value(v2p8_gpio, on);781781+ if (gs->v2p8_gpio >= 0)782782+ gpio_set_value(gs->v2p8_gpio, on);898783899784 if (gs->v2p8_reg) {900785 regulator_set_voltage(gs->v2p8_reg, 2900000, 2900000);···916817 }917818918819 return -EINVAL;820820+}821821+822822+static int gmin_acpi_pm_ctrl(struct v4l2_subdev *subdev, int on)823823+{824824+ int ret = 0;825825+ struct gmin_subdev *gs = find_gmin_subdev(subdev);826826+ struct i2c_client *client = v4l2_get_subdevdata(subdev);827827+ struct acpi_device *adev = ACPI_COMPANION(&client->dev);828828+829829+ /* Use the ACPI power management to control it */830830+ on = !!on;831831+ if (gs->clock_on == on)832832+ return 0;833833+834834+ dev_dbg(subdev->dev, "Setting power state to %s\n",835835+ on ? "on" : "off");836836+837837+ if (on)838838+ ret = acpi_device_set_power(adev,839839+ ACPI_STATE_D0);840840+ else841841+ ret = acpi_device_set_power(adev,842842+ ACPI_STATE_D3_COLD);843843+844844+ if (!ret)845845+ gs->clock_on = on;846846+ else847847+ dev_err(subdev->dev, "Couldn't set power state to %s\n",848848+ on ? "on" : "off");849849+850850+ return ret;919851}920852921853static int gmin_flisclk_ctrl(struct v4l2_subdev *subdev, int on)···1014884 return NULL;1015885}101688610171017-static struct camera_sensor_platform_data gmin_plat = {887887+static struct camera_sensor_platform_data pmic_gmin_plat = {1018888 .gpio0_ctrl = gmin_gpio0_ctrl,1019889 .gpio1_ctrl = gmin_gpio1_ctrl,1020890 .v1p8_ctrl = gmin_v1p8_ctrl,···1025895 .get_vcm_ctrl = gmin_get_vcm_ctrl,1026896};1027897898898+static struct camera_sensor_platform_data acpi_gmin_plat = {899899+ .gpio0_ctrl = gmin_gpio0_ctrl,900900+ .gpio1_ctrl = gmin_gpio1_ctrl,901901+ .v1p8_ctrl = gmin_acpi_pm_ctrl,902902+ .v2p8_ctrl = gmin_acpi_pm_ctrl,903903+ .v1p2_ctrl = gmin_acpi_pm_ctrl,904904+ .flisclk_ctrl = gmin_acpi_pm_ctrl,905905+ .csi_cfg = gmin_csi_cfg,906906+ .get_vcm_ctrl = gmin_get_vcm_ctrl,907907+};908908+1028909struct camera_sensor_platform_data *gmin_camera_platform_data(1029910 struct v4l2_subdev *subdev,1030911 enum atomisp_input_format csi_format,1031912 enum atomisp_bayer_order csi_bayer)1032913{10331033- struct gmin_subdev *gs = find_gmin_subdev(subdev);914914+ u8 pmic_i2c_addr = gmin_detect_pmic(subdev);915915+ struct gmin_subdev *gs;1034916917917+ gs = find_free_gmin_subdev_slot();918918+ gs->subdev = subdev;1035919 gs->csi_fmt = csi_format;1036920 gs->csi_bayer = csi_bayer;921921+ gs->pwm_i2c_addr = pmic_i2c_addr;103792210381038- return &gmin_plat;923923+ gmin_subdev_add(gs);924924+ if (gs->pmc_clk)925925+ return &pmic_gmin_plat;926926+ else927927+ return &acpi_gmin_plat;1039928}1040929EXPORT_SYMBOL_GPL(gmin_camera_platform_data);1041930···1106957 union acpi_object *obj, *cur = NULL;1107958 int i;1108959960960+ /*961961+ * The data reported by "CamClk" seems to be either 0 or 1 at the962962+ * _DSM table.963963+ *964964+ * At the ACPI tables we looked so far, this is not related to the965965+ * actual clock source for the sensor, which is given by the966966+ * _PR0 ACPI table. So, ignore it, as otherwise this will be967967+ * set to a wrong value.968968+ */969969+ if (!strcmp(var, "CamClk"))970970+ return -EINVAL;971971+1109972 obj = acpi_evaluate_dsm(handle, &atomisp_dsm_guid, 0, 0, NULL);1110973 if (!obj) {1111974 dev_info_once(dev, "Didn't find ACPI _DSM table.\n");1112975 return -EINVAL;1113976 }977977+978978+ /* Return on unexpected object type */979979+ if (obj->type != ACPI_TYPE_PACKAGE)980980+ return -EINVAL;11149811115982#if 0 /* Just for debugging purposes */1116983 for (i = 0; i < obj->package.count; i++) {···13201155 * trying. The driver itself does direct calls to the PUNIT to manage13211156 * ISP power.13221157 */13231323-static void isp_pm_cap_fixup(struct pci_dev *dev)11581158+static void isp_pm_cap_fixup(struct pci_dev *pdev)13241159{13251325- dev_info(&dev->dev, "Disabling PCI power management on camera ISP\n");13261326- dev->pm_cap = 0;11601160+ dev_info(&pdev->dev, "Disabling PCI power management on camera ISP\n");11611161+ pdev->pm_cap = 0;13271162}13281163DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, 0x0f38, isp_pm_cap_fixup);13291164
···1313 * more details.1414 */15151616-#ifndef __SYSTEM_GLOBAL_H_INCLUDED__1717-#define __SYSTEM_GLOBAL_H_INCLUDED__1818-1919-#include <hive_isp_css_defs.h>2020-#include <type_support.h>2121-2222-/*2323- * The longest allowed (uninteruptible) bus transfer, does not2424- * take stalling into account2525- */2626-#define HIVE_ISP_MAX_BURST_LENGTH 10242727-2828-/*2929- * Maximum allowed burst length in words for the ISP DMA3030- */3131-#define ISP_DMA_MAX_BURST_LENGTH 1283232-3333-/*3434- * Create a list of HAS and IS properties that defines the system3535- *3636- * The configuration assumes the following3737- * - The system is hetereogeneous; Multiple cells and devices classes3838- * - The cell and device instances are homogeneous, each device type3939- * belongs to the same class4040- * - Device instances supporting a subset of the class capabilities are4141- * allowed4242- *4343- * We could manage different device classes through the enumerated4444- * lists (C) or the use of classes (C++), but that is presently not4545- * fully supported4646- *4747- * N.B. the 3 input formatters are of 2 different classess4848- */4949-5016#define USE_INPUT_SYSTEM_VERSION_25151-5252-#define HAS_MMU_VERSION_25353-#define HAS_DMA_VERSION_25454-#define HAS_GDC_VERSION_25555-#define HAS_VAMEM_VERSION_25656-#define HAS_HMEM_VERSION_15757-#define HAS_BAMEM_VERSION_25858-#define HAS_IRQ_VERSION_25959-#define HAS_IRQ_MAP_VERSION_26060-#define HAS_INPUT_FORMATTER_VERSION_26161-/* 2401: HAS_INPUT_SYSTEM_VERSION_2401 */6262-#define HAS_INPUT_SYSTEM_VERSION_26363-#define HAS_BUFFERED_SENSOR6464-#define HAS_FIFO_MONITORS_VERSION_26565-/* #define HAS_GP_REGS_VERSION_2 */6666-#define HAS_GP_DEVICE_VERSION_26767-#define HAS_GPIO_VERSION_16868-#define HAS_TIMED_CTRL_VERSION_16969-#define HAS_RX_VERSION_27070-7171-#define DMA_DDR_TO_VAMEM_WORKAROUND7272-#define DMA_DDR_TO_HMEM_WORKAROUND7373-7474-/*7575- * Semi global. "HRT" is accessible from SP, but the HRT types do not fully apply7676- */7777-#define HRT_VADDRESS_WIDTH 327878-//#define HRT_ADDRESS_WIDTH 64 /* Surprise, this is a local property*/7979-#define HRT_DATA_WIDTH 328080-8181-#define SIZEOF_HRT_REG (HRT_DATA_WIDTH >> 3)8282-#define HIVE_ISP_CTRL_DATA_BYTES (HIVE_ISP_CTRL_DATA_WIDTH / 8)8383-8484-/* The main bus connecting all devices */8585-#define HRT_BUS_WIDTH HIVE_ISP_CTRL_DATA_WIDTH8686-#define HRT_BUS_BYTES HIVE_ISP_CTRL_DATA_BYTES8787-8888-/* per-frame parameter handling support */8989-#define SH_CSS_ENABLE_PER_FRAME_PARAMS9090-9191-typedef u32 hrt_bus_align_t;9292-9393-/*9494- * Enumerate the devices, device access through the API is by ID, through the DLI by address9595- * The enumerator terminators are used to size the wiring arrays and as an exception value.9696- */9797-typedef enum {9898- DDR0_ID = 0,9999- N_DDR_ID100100-} ddr_ID_t;101101-102102-typedef enum {103103- ISP0_ID = 0,104104- N_ISP_ID105105-} isp_ID_t;106106-107107-typedef enum {108108- SP0_ID = 0,109109- N_SP_ID110110-} sp_ID_t;111111-112112-typedef enum {113113- MMU0_ID = 0,114114- MMU1_ID,115115- N_MMU_ID116116-} mmu_ID_t;117117-118118-typedef enum {119119- DMA0_ID = 0,120120- N_DMA_ID121121-} dma_ID_t;122122-123123-typedef enum {124124- GDC0_ID = 0,125125- GDC1_ID,126126- N_GDC_ID127127-} gdc_ID_t;128128-129129-#define N_GDC_ID_CPP 2 // this extra define is needed because we want to use it also in the preprocessor, and that doesn't work with enums.130130-131131-typedef enum {132132- VAMEM0_ID = 0,133133- VAMEM1_ID,134134- VAMEM2_ID,135135- N_VAMEM_ID136136-} vamem_ID_t;137137-138138-typedef enum {139139- BAMEM0_ID = 0,140140- N_BAMEM_ID141141-} bamem_ID_t;142142-143143-typedef enum {144144- HMEM0_ID = 0,145145- N_HMEM_ID146146-} hmem_ID_t;147147-148148-/*149149-typedef enum {150150- IRQ0_ID = 0,151151- N_IRQ_ID152152-} irq_ID_t;153153-*/154154-155155-typedef enum {156156- IRQ0_ID = 0, // GP IRQ block157157- IRQ1_ID, // Input formatter158158- IRQ2_ID, // input system159159- IRQ3_ID, // input selector160160- N_IRQ_ID161161-} irq_ID_t;162162-163163-typedef enum {164164- FIFO_MONITOR0_ID = 0,165165- N_FIFO_MONITOR_ID166166-} fifo_monitor_ID_t;167167-168168-/*169169- * Deprecated: Since all gp_reg instances are different170170- * and put in the address maps of other devices we cannot171171- * enumerate them as that assumes the instrances are the172172- * same.173173- *174174- * We define a single GP_DEVICE containing all gp_regs175175- * w.r.t. a single base address176176- *177177-typedef enum {178178- GP_REGS0_ID = 0,179179- N_GP_REGS_ID180180-} gp_regs_ID_t;181181- */182182-typedef enum {183183- GP_DEVICE0_ID = 0,184184- N_GP_DEVICE_ID185185-} gp_device_ID_t;186186-187187-typedef enum {188188- GP_TIMER0_ID = 0,189189- GP_TIMER1_ID,190190- GP_TIMER2_ID,191191- GP_TIMER3_ID,192192- GP_TIMER4_ID,193193- GP_TIMER5_ID,194194- GP_TIMER6_ID,195195- GP_TIMER7_ID,196196- N_GP_TIMER_ID197197-} gp_timer_ID_t;198198-199199-typedef enum {200200- GPIO0_ID = 0,201201- N_GPIO_ID202202-} gpio_ID_t;203203-204204-typedef enum {205205- TIMED_CTRL0_ID = 0,206206- N_TIMED_CTRL_ID207207-} timed_ctrl_ID_t;208208-209209-typedef enum {210210- INPUT_FORMATTER0_ID = 0,211211- INPUT_FORMATTER1_ID,212212- INPUT_FORMATTER2_ID,213213- INPUT_FORMATTER3_ID,214214- N_INPUT_FORMATTER_ID215215-} input_formatter_ID_t;216216-217217-/* The IF RST is outside the IF */218218-#define INPUT_FORMATTER0_SRST_OFFSET 0x0824219219-#define INPUT_FORMATTER1_SRST_OFFSET 0x0624220220-#define INPUT_FORMATTER2_SRST_OFFSET 0x0424221221-#define INPUT_FORMATTER3_SRST_OFFSET 0x0224222222-223223-#define INPUT_FORMATTER0_SRST_MASK 0x0001224224-#define INPUT_FORMATTER1_SRST_MASK 0x0002225225-#define INPUT_FORMATTER2_SRST_MASK 0x0004226226-#define INPUT_FORMATTER3_SRST_MASK 0x0008227227-228228-typedef enum {229229- INPUT_SYSTEM0_ID = 0,230230- N_INPUT_SYSTEM_ID231231-} input_system_ID_t;232232-233233-typedef enum {234234- RX0_ID = 0,235235- N_RX_ID236236-} rx_ID_t;237237-238238-enum mipi_port_id {239239- MIPI_PORT0_ID = 0,240240- MIPI_PORT1_ID,241241- MIPI_PORT2_ID,242242- N_MIPI_PORT_ID243243-};244244-245245-#define N_RX_CHANNEL_ID 4246246-247247-/* Generic port enumeration with an internal port type ID */248248-typedef enum {249249- CSI_PORT0_ID = 0,250250- CSI_PORT1_ID,251251- CSI_PORT2_ID,252252- TPG_PORT0_ID,253253- PRBS_PORT0_ID,254254- FIFO_PORT0_ID,255255- MEMORY_PORT0_ID,256256- N_INPUT_PORT_ID257257-} input_port_ID_t;258258-259259-typedef enum {260260- CAPTURE_UNIT0_ID = 0,261261- CAPTURE_UNIT1_ID,262262- CAPTURE_UNIT2_ID,263263- ACQUISITION_UNIT0_ID,264264- DMA_UNIT0_ID,265265- CTRL_UNIT0_ID,266266- GPREGS_UNIT0_ID,267267- FIFO_UNIT0_ID,268268- IRQ_UNIT0_ID,269269- N_SUB_SYSTEM_ID270270-} sub_system_ID_t;271271-272272-#define N_CAPTURE_UNIT_ID 3273273-#define N_ACQUISITION_UNIT_ID 1274274-#define N_CTRL_UNIT_ID 1275275-276276-enum ia_css_isp_memories {277277- IA_CSS_ISP_PMEM0 = 0,278278- IA_CSS_ISP_DMEM0,279279- IA_CSS_ISP_VMEM0,280280- IA_CSS_ISP_VAMEM0,281281- IA_CSS_ISP_VAMEM1,282282- IA_CSS_ISP_VAMEM2,283283- IA_CSS_ISP_HMEM0,284284- IA_CSS_SP_DMEM0,285285- IA_CSS_DDR,286286- N_IA_CSS_MEMORIES287287-};288288-289289-#define IA_CSS_NUM_MEMORIES 9290290-/* For driver compatibility */291291-#define N_IA_CSS_ISP_MEMORIES IA_CSS_NUM_MEMORIES292292-#define IA_CSS_NUM_ISP_MEMORIES IA_CSS_NUM_MEMORIES293293-294294-#if 0295295-typedef enum {296296- dev_chn, /* device channels, external resource */297297- ext_mem, /* external memories */298298- int_mem, /* internal memories */299299- int_chn /* internal channels, user defined */300300-} resource_type_t;301301-302302-/* if this enum is extended with other memory resources, pls also extend the function resource_to_memptr() */303303-typedef enum {304304- vied_nci_dev_chn_dma_ext0,305305- int_mem_vmem0,306306- int_mem_dmem0307307-} resource_id_t;308308-309309-/* enum listing the different memories within a program group.310310- This enum is used in the mem_ptr_t type */311311-typedef enum {312312- buf_mem_invalid = 0,313313- buf_mem_vmem_prog0,314314- buf_mem_dmem_prog0315315-} buf_mem_t;316316-317317-#endif318318-#endif /* __SYSTEM_GLOBAL_H_INCLUDED__ */
···1313 * more details.1414 */15151616-#ifndef __SYSTEM_GLOBAL_H_INCLUDED__1717-#define __SYSTEM_GLOBAL_H_INCLUDED__1818-1919-#include <hive_isp_css_defs.h>2020-#include <type_support.h>2121-2222-/*2323- * The longest allowed (uninteruptible) bus transfer, does not2424- * take stalling into account2525- */2626-#define HIVE_ISP_MAX_BURST_LENGTH 10242727-2828-/*2929- * Maximum allowed burst length in words for the ISP DMA3030- * This value is set to 2 to prevent the ISP DMA from blocking3131- * the bus for too long; as the input system can only buffer3232- * 2 lines on Moorefield and Cherrytrail, the input system buffers3333- * may overflow if blocked for too long (BZ 2726).3434- */3535-#define ISP_DMA_MAX_BURST_LENGTH 23636-3737-/*3838- * Create a list of HAS and IS properties that defines the system3939- *4040- * The configuration assumes the following4141- * - The system is hetereogeneous; Multiple cells and devices classes4242- * - The cell and device instances are homogeneous, each device type4343- * belongs to the same class4444- * - Device instances supporting a subset of the class capabilities are4545- * allowed4646- *4747- * We could manage different device classes through the enumerated4848- * lists (C) or the use of classes (C++), but that is presently not4949- * fully supported5050- *5151- * N.B. the 3 input formatters are of 2 different classess5252- */5353-5454-#define USE_INPUT_SYSTEM_VERSION_24015555-5656-#define HAS_MMU_VERSION_25757-#define HAS_DMA_VERSION_25858-#define HAS_GDC_VERSION_25959-#define HAS_VAMEM_VERSION_26060-#define HAS_HMEM_VERSION_16161-#define HAS_BAMEM_VERSION_26262-#define HAS_IRQ_VERSION_26363-#define HAS_IRQ_MAP_VERSION_26464-#define HAS_INPUT_FORMATTER_VERSION_26565-/* 2401: HAS_INPUT_SYSTEM_VERSION_3 */6666-/* 2400: HAS_INPUT_SYSTEM_VERSION_2 */6767-#define HAS_INPUT_SYSTEM_VERSION_26868-#define HAS_INPUT_SYSTEM_VERSION_24016969-#define HAS_BUFFERED_SENSOR7070-#define HAS_FIFO_MONITORS_VERSION_27171-/* #define HAS_GP_REGS_VERSION_2 */7272-#define HAS_GP_DEVICE_VERSION_27373-#define HAS_GPIO_VERSION_17474-#define HAS_TIMED_CTRL_VERSION_17575-#define HAS_RX_VERSION_27616#define HAS_NO_INPUT_FORMATTER7777-/*#define HAS_NO_PACKED_RAW_PIXELS*/7878-/*#define HAS_NO_DVS_6AXIS_CONFIG_UPDATE*/7979-8080-#define DMA_DDR_TO_VAMEM_WORKAROUND8181-#define DMA_DDR_TO_HMEM_WORKAROUND8282-8383-/*8484- * Semi global. "HRT" is accessible from SP, but8585- * the HRT types do not fully apply8686- */8787-#define HRT_VADDRESS_WIDTH 328888-/* Surprise, this is a local property*/8989-/*#define HRT_ADDRESS_WIDTH 64 */9090-#define HRT_DATA_WIDTH 329191-9292-#define SIZEOF_HRT_REG (HRT_DATA_WIDTH >> 3)9393-#define HIVE_ISP_CTRL_DATA_BYTES (HIVE_ISP_CTRL_DATA_WIDTH / 8)9494-9595-/* The main bus connecting all devices */9696-#define HRT_BUS_WIDTH HIVE_ISP_CTRL_DATA_WIDTH9797-#define HRT_BUS_BYTES HIVE_ISP_CTRL_DATA_BYTES9898-1717+#define USE_INPUT_SYSTEM_VERSION_24011818+#define HAS_INPUT_SYSTEM_VERSION_24019919#define CSI2P_DISABLE_ISYS2401_ONLINE_MODE100100-101101-/* per-frame parameter handling support */102102-#define SH_CSS_ENABLE_PER_FRAME_PARAMS103103-104104-typedef u32 hrt_bus_align_t;105105-106106-/*107107- * Enumerate the devices, device access through the API is by ID,108108- * through the DLI by address. The enumerator terminators are used109109- * to size the wiring arrays and as an exception value.110110- */111111-typedef enum {112112- DDR0_ID = 0,113113- N_DDR_ID114114-} ddr_ID_t;115115-116116-typedef enum {117117- ISP0_ID = 0,118118- N_ISP_ID119119-} isp_ID_t;120120-121121-typedef enum {122122- SP0_ID = 0,123123- N_SP_ID124124-} sp_ID_t;125125-126126-typedef enum {127127- MMU0_ID = 0,128128- MMU1_ID,129129- N_MMU_ID130130-} mmu_ID_t;131131-132132-typedef enum {133133- DMA0_ID = 0,134134- N_DMA_ID135135-} dma_ID_t;136136-137137-typedef enum {138138- GDC0_ID = 0,139139- GDC1_ID,140140- N_GDC_ID141141-} gdc_ID_t;142142-143143-/* this extra define is needed because we want to use it also144144- in the preprocessor, and that doesn't work with enums.145145- */146146-#define N_GDC_ID_CPP 2147147-148148-typedef enum {149149- VAMEM0_ID = 0,150150- VAMEM1_ID,151151- VAMEM2_ID,152152- N_VAMEM_ID153153-} vamem_ID_t;154154-155155-typedef enum {156156- BAMEM0_ID = 0,157157- N_BAMEM_ID158158-} bamem_ID_t;159159-160160-typedef enum {161161- HMEM0_ID = 0,162162- N_HMEM_ID163163-} hmem_ID_t;164164-165165-typedef enum {166166- ISYS_IRQ0_ID = 0, /* port a */167167- ISYS_IRQ1_ID, /* port b */168168- ISYS_IRQ2_ID, /* port c */169169- N_ISYS_IRQ_ID170170-} isys_irq_ID_t;171171-172172-typedef enum {173173- IRQ0_ID = 0, /* GP IRQ block */174174- IRQ1_ID, /* Input formatter */175175- IRQ2_ID, /* input system */176176- IRQ3_ID, /* input selector */177177- N_IRQ_ID178178-} irq_ID_t;179179-180180-typedef enum {181181- FIFO_MONITOR0_ID = 0,182182- N_FIFO_MONITOR_ID183183-} fifo_monitor_ID_t;184184-185185-/*186186- * Deprecated: Since all gp_reg instances are different187187- * and put in the address maps of other devices we cannot188188- * enumerate them as that assumes the instrances are the189189- * same.190190- *191191- * We define a single GP_DEVICE containing all gp_regs192192- * w.r.t. a single base address193193- *194194-typedef enum {195195- GP_REGS0_ID = 0,196196- N_GP_REGS_ID197197-} gp_regs_ID_t;198198- */199199-typedef enum {200200- GP_DEVICE0_ID = 0,201201- N_GP_DEVICE_ID202202-} gp_device_ID_t;203203-204204-typedef enum {205205- GP_TIMER0_ID = 0,206206- GP_TIMER1_ID,207207- GP_TIMER2_ID,208208- GP_TIMER3_ID,209209- GP_TIMER4_ID,210210- GP_TIMER5_ID,211211- GP_TIMER6_ID,212212- GP_TIMER7_ID,213213- N_GP_TIMER_ID214214-} gp_timer_ID_t;215215-216216-typedef enum {217217- GPIO0_ID = 0,218218- N_GPIO_ID219219-} gpio_ID_t;220220-221221-typedef enum {222222- TIMED_CTRL0_ID = 0,223223- N_TIMED_CTRL_ID224224-} timed_ctrl_ID_t;225225-226226-typedef enum {227227- INPUT_FORMATTER0_ID = 0,228228- INPUT_FORMATTER1_ID,229229- INPUT_FORMATTER2_ID,230230- INPUT_FORMATTER3_ID,231231- N_INPUT_FORMATTER_ID232232-} input_formatter_ID_t;233233-234234-/* The IF RST is outside the IF */235235-#define INPUT_FORMATTER0_SRST_OFFSET 0x0824236236-#define INPUT_FORMATTER1_SRST_OFFSET 0x0624237237-#define INPUT_FORMATTER2_SRST_OFFSET 0x0424238238-#define INPUT_FORMATTER3_SRST_OFFSET 0x0224239239-240240-#define INPUT_FORMATTER0_SRST_MASK 0x0001241241-#define INPUT_FORMATTER1_SRST_MASK 0x0002242242-#define INPUT_FORMATTER2_SRST_MASK 0x0004243243-#define INPUT_FORMATTER3_SRST_MASK 0x0008244244-245245-typedef enum {246246- INPUT_SYSTEM0_ID = 0,247247- N_INPUT_SYSTEM_ID248248-} input_system_ID_t;249249-250250-typedef enum {251251- RX0_ID = 0,252252- N_RX_ID253253-} rx_ID_t;254254-255255-enum mipi_port_id {256256- MIPI_PORT0_ID = 0,257257- MIPI_PORT1_ID,258258- MIPI_PORT2_ID,259259- N_MIPI_PORT_ID260260-};261261-262262-#define N_RX_CHANNEL_ID 4263263-264264-/* Generic port enumeration with an internal port type ID */265265-typedef enum {266266- CSI_PORT0_ID = 0,267267- CSI_PORT1_ID,268268- CSI_PORT2_ID,269269- TPG_PORT0_ID,270270- PRBS_PORT0_ID,271271- FIFO_PORT0_ID,272272- MEMORY_PORT0_ID,273273- N_INPUT_PORT_ID274274-} input_port_ID_t;275275-276276-typedef enum {277277- CAPTURE_UNIT0_ID = 0,278278- CAPTURE_UNIT1_ID,279279- CAPTURE_UNIT2_ID,280280- ACQUISITION_UNIT0_ID,281281- DMA_UNIT0_ID,282282- CTRL_UNIT0_ID,283283- GPREGS_UNIT0_ID,284284- FIFO_UNIT0_ID,285285- IRQ_UNIT0_ID,286286- N_SUB_SYSTEM_ID287287-} sub_system_ID_t;288288-289289-#define N_CAPTURE_UNIT_ID 3290290-#define N_ACQUISITION_UNIT_ID 1291291-#define N_CTRL_UNIT_ID 1292292-293293-/*294294- * Input-buffer Controller.295295- */296296-typedef enum {297297- IBUF_CTRL0_ID = 0, /* map to ISYS2401_IBUF_CNTRL_A */298298- IBUF_CTRL1_ID, /* map to ISYS2401_IBUF_CNTRL_B */299299- IBUF_CTRL2_ID, /* map ISYS2401_IBUF_CNTRL_C */300300- N_IBUF_CTRL_ID301301-} ibuf_ctrl_ID_t;302302-/* end of Input-buffer Controller */303303-304304-/*305305- * Stream2MMIO.306306- */307307-typedef enum {308308- STREAM2MMIO0_ID = 0, /* map to ISYS2401_S2M_A */309309- STREAM2MMIO1_ID, /* map to ISYS2401_S2M_B */310310- STREAM2MMIO2_ID, /* map to ISYS2401_S2M_C */311311- N_STREAM2MMIO_ID312312-} stream2mmio_ID_t;313313-314314-typedef enum {315315- /*316316- * Stream2MMIO 0 has 8 SIDs that are indexed by317317- * [STREAM2MMIO_SID0_ID...STREAM2MMIO_SID7_ID].318318- *319319- * Stream2MMIO 1 has 4 SIDs that are indexed by320320- * [STREAM2MMIO_SID0_ID...TREAM2MMIO_SID3_ID].321321- *322322- * Stream2MMIO 2 has 4 SIDs that are indexed by323323- * [STREAM2MMIO_SID0_ID...STREAM2MMIO_SID3_ID].324324- */325325- STREAM2MMIO_SID0_ID = 0,326326- STREAM2MMIO_SID1_ID,327327- STREAM2MMIO_SID2_ID,328328- STREAM2MMIO_SID3_ID,329329- STREAM2MMIO_SID4_ID,330330- STREAM2MMIO_SID5_ID,331331- STREAM2MMIO_SID6_ID,332332- STREAM2MMIO_SID7_ID,333333- N_STREAM2MMIO_SID_ID334334-} stream2mmio_sid_ID_t;335335-/* end of Stream2MMIO */336336-337337-/**338338- * Input System 2401: CSI-MIPI recevier.339339- */340340-typedef enum {341341- CSI_RX_BACKEND0_ID = 0, /* map to ISYS2401_MIPI_BE_A */342342- CSI_RX_BACKEND1_ID, /* map to ISYS2401_MIPI_BE_B */343343- CSI_RX_BACKEND2_ID, /* map to ISYS2401_MIPI_BE_C */344344- N_CSI_RX_BACKEND_ID345345-} csi_rx_backend_ID_t;346346-347347-typedef enum {348348- CSI_RX_FRONTEND0_ID = 0, /* map to ISYS2401_CSI_RX_A */349349- CSI_RX_FRONTEND1_ID, /* map to ISYS2401_CSI_RX_B */350350- CSI_RX_FRONTEND2_ID, /* map to ISYS2401_CSI_RX_C */351351-#define N_CSI_RX_FRONTEND_ID (CSI_RX_FRONTEND2_ID + 1)352352-} csi_rx_frontend_ID_t;353353-354354-typedef enum {355355- CSI_RX_DLANE0_ID = 0, /* map to DLANE0 in CSI RX */356356- CSI_RX_DLANE1_ID, /* map to DLANE1 in CSI RX */357357- CSI_RX_DLANE2_ID, /* map to DLANE2 in CSI RX */358358- CSI_RX_DLANE3_ID, /* map to DLANE3 in CSI RX */359359- N_CSI_RX_DLANE_ID360360-} csi_rx_fe_dlane_ID_t;361361-/* end of CSI-MIPI receiver */362362-363363-typedef enum {364364- ISYS2401_DMA0_ID = 0,365365- N_ISYS2401_DMA_ID366366-} isys2401_dma_ID_t;367367-368368-/**369369- * Pixel-generator. ("system_global.h")370370- */371371-typedef enum {372372- PIXELGEN0_ID = 0,373373- PIXELGEN1_ID,374374- PIXELGEN2_ID,375375- N_PIXELGEN_ID376376-} pixelgen_ID_t;377377-/* end of pixel-generator. ("system_global.h") */378378-379379-typedef enum {380380- INPUT_SYSTEM_CSI_PORT0_ID = 0,381381- INPUT_SYSTEM_CSI_PORT1_ID,382382- INPUT_SYSTEM_CSI_PORT2_ID,383383-384384- INPUT_SYSTEM_PIXELGEN_PORT0_ID,385385- INPUT_SYSTEM_PIXELGEN_PORT1_ID,386386- INPUT_SYSTEM_PIXELGEN_PORT2_ID,387387-388388- N_INPUT_SYSTEM_INPUT_PORT_ID389389-} input_system_input_port_ID_t;390390-391391-#define N_INPUT_SYSTEM_CSI_PORT 3392392-393393-typedef enum {394394- ISYS2401_DMA_CHANNEL_0 = 0,395395- ISYS2401_DMA_CHANNEL_1,396396- ISYS2401_DMA_CHANNEL_2,397397- ISYS2401_DMA_CHANNEL_3,398398- ISYS2401_DMA_CHANNEL_4,399399- ISYS2401_DMA_CHANNEL_5,400400- ISYS2401_DMA_CHANNEL_6,401401- ISYS2401_DMA_CHANNEL_7,402402- ISYS2401_DMA_CHANNEL_8,403403- ISYS2401_DMA_CHANNEL_9,404404- ISYS2401_DMA_CHANNEL_10,405405- ISYS2401_DMA_CHANNEL_11,406406- N_ISYS2401_DMA_CHANNEL407407-} isys2401_dma_channel;408408-409409-enum ia_css_isp_memories {410410- IA_CSS_ISP_PMEM0 = 0,411411- IA_CSS_ISP_DMEM0,412412- IA_CSS_ISP_VMEM0,413413- IA_CSS_ISP_VAMEM0,414414- IA_CSS_ISP_VAMEM1,415415- IA_CSS_ISP_VAMEM2,416416- IA_CSS_ISP_HMEM0,417417- IA_CSS_SP_DMEM0,418418- IA_CSS_DDR,419419- N_IA_CSS_MEMORIES420420-};421421-422422-#define IA_CSS_NUM_MEMORIES 9423423-/* For driver compatibility */424424-#define N_IA_CSS_ISP_MEMORIES IA_CSS_NUM_MEMORIES425425-#define IA_CSS_NUM_ISP_MEMORIES IA_CSS_NUM_MEMORIES426426-427427-#endif /* __SYSTEM_GLOBAL_H_INCLUDED__ */
···11-/* SPDX-License-Identifier: GPL-2.0 */22-/*33- * Support for Intel Camera Imaging ISP subsystem.44- * Copyright (c) 2015, Intel Corporation.55- *66- * This program is free software; you can redistribute it and/or modify it77- * under the terms and conditions of the GNU General Public License,88- * version 2, as published by the Free Software Foundation.99- *1010- * This program is distributed in the hope it will be useful, but WITHOUT1111- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or1212- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for1313- * more details.1414- */1515-1616-#ifndef __SYSTEM_LOCAL_H_INCLUDED__1717-#define __SYSTEM_LOCAL_H_INCLUDED__1818-1919-#ifdef HRT_ISP_CSS_CUSTOM_HOST2020-#ifndef HRT_USE_VIR_ADDRS2121-#define HRT_USE_VIR_ADDRS2222-#endif2323-#endif2424-2525-#include "system_global.h"2626-2727-#define HRT_ADDRESS_WIDTH 64 /* Surprise, this is a local property */2828-2929-/* This interface is deprecated */3030-#include "hive_types.h"3131-3232-/*3333- * Cell specific address maps3434- */3535-#if HRT_ADDRESS_WIDTH == 643636-3737-#define GP_FIFO_BASE ((hrt_address)0x0000000000090104) /* This is NOT a base address */3838-3939-/* DDR */4040-static const hrt_address DDR_BASE[N_DDR_ID] = {4141- 0x0000000120000000ULL4242-};4343-4444-/* ISP */4545-static const hrt_address ISP_CTRL_BASE[N_ISP_ID] = {4646- 0x0000000000020000ULL4747-};4848-4949-static const hrt_address ISP_DMEM_BASE[N_ISP_ID] = {5050- 0x0000000000200000ULL5151-};5252-5353-static const hrt_address ISP_BAMEM_BASE[N_BAMEM_ID] = {5454- 0x0000000000100000ULL5555-};5656-5757-static const hrt_address ISP_VAMEM_BASE[N_VAMEM_ID] = {5858- 0x00000000001C0000ULL,5959- 0x00000000001D0000ULL,6060- 0x00000000001E0000ULL6161-};6262-6363-static const hrt_address ISP_HMEM_BASE[N_HMEM_ID] = {6464- 0x00000000001F0000ULL6565-};6666-6767-/* SP */6868-static const hrt_address SP_CTRL_BASE[N_SP_ID] = {6969- 0x0000000000010000ULL7070-};7171-7272-static const hrt_address SP_DMEM_BASE[N_SP_ID] = {7373- 0x0000000000300000ULL7474-};7575-7676-/* MMU */7777-/*7878- * MMU0_ID: The data MMU7979- * MMU1_ID: The icache MMU8080- */8181-static const hrt_address MMU_BASE[N_MMU_ID] = {8282- 0x0000000000070000ULL,8383- 0x00000000000A0000ULL8484-};8585-8686-/* DMA */8787-static const hrt_address DMA_BASE[N_DMA_ID] = {8888- 0x0000000000040000ULL8989-};9090-9191-static const hrt_address ISYS2401_DMA_BASE[N_ISYS2401_DMA_ID] = {9292- 0x00000000000CA000ULL9393-};9494-9595-/* IRQ */9696-static const hrt_address IRQ_BASE[N_IRQ_ID] = {9797- 0x0000000000000500ULL,9898- 0x0000000000030A00ULL,9999- 0x000000000008C000ULL,100100- 0x0000000000090200ULL101101-};102102-103103-/*104104- 0x0000000000000500ULL};105105- */106106-107107-/* GDC */108108-static const hrt_address GDC_BASE[N_GDC_ID] = {109109- 0x0000000000050000ULL,110110- 0x0000000000060000ULL111111-};112112-113113-/* FIFO_MONITOR (not a subset of GP_DEVICE) */114114-static const hrt_address FIFO_MONITOR_BASE[N_FIFO_MONITOR_ID] = {115115- 0x0000000000000000ULL116116-};117117-118118-/*119119-static const hrt_address GP_REGS_BASE[N_GP_REGS_ID] = {120120- 0x0000000000000000ULL};121121-122122-static const hrt_address GP_DEVICE_BASE[N_GP_DEVICE_ID] = {123123- 0x0000000000090000ULL};124124-*/125125-126126-/* GP_DEVICE (single base for all separate GP_REG instances) */127127-static const hrt_address GP_DEVICE_BASE[N_GP_DEVICE_ID] = {128128- 0x0000000000000000ULL129129-};130130-131131-/*GP TIMER , all timer registers are inter-twined,132132- * so, having multiple base addresses for133133- * different timers does not help*/134134-static const hrt_address GP_TIMER_BASE =135135- (hrt_address)0x0000000000000600ULL;136136-137137-/* GPIO */138138-static const hrt_address GPIO_BASE[N_GPIO_ID] = {139139- 0x0000000000000400ULL140140-};141141-142142-/* TIMED_CTRL */143143-static const hrt_address TIMED_CTRL_BASE[N_TIMED_CTRL_ID] = {144144- 0x0000000000000100ULL145145-};146146-147147-/* INPUT_FORMATTER */148148-static const hrt_address INPUT_FORMATTER_BASE[N_INPUT_FORMATTER_ID] = {149149- 0x0000000000030000ULL,150150- 0x0000000000030200ULL,151151- 0x0000000000030400ULL,152152- 0x0000000000030600ULL153153-}; /* memcpy() */154154-155155-/* INPUT_SYSTEM */156156-static const hrt_address INPUT_SYSTEM_BASE[N_INPUT_SYSTEM_ID] = {157157- 0x0000000000080000ULL158158-};159159-160160-/* 0x0000000000081000ULL, */ /* capture A */161161-/* 0x0000000000082000ULL, */ /* capture B */162162-/* 0x0000000000083000ULL, */ /* capture C */163163-/* 0x0000000000084000ULL, */ /* Acquisition */164164-/* 0x0000000000085000ULL, */ /* DMA */165165-/* 0x0000000000089000ULL, */ /* ctrl */166166-/* 0x000000000008A000ULL, */ /* GP regs */167167-/* 0x000000000008B000ULL, */ /* FIFO */168168-/* 0x000000000008C000ULL, */ /* IRQ */169169-170170-/* RX, the MIPI lane control regs start at offset 0 */171171-static const hrt_address RX_BASE[N_RX_ID] = {172172- 0x0000000000080100ULL173173-};174174-175175-/* IBUF_CTRL, part of the Input System 2401 */176176-static const hrt_address IBUF_CTRL_BASE[N_IBUF_CTRL_ID] = {177177- 0x00000000000C1800ULL, /* ibuf controller A */178178- 0x00000000000C3800ULL, /* ibuf controller B */179179- 0x00000000000C5800ULL /* ibuf controller C */180180-};181181-182182-/* ISYS IRQ Controllers, part of the Input System 2401 */183183-static const hrt_address ISYS_IRQ_BASE[N_ISYS_IRQ_ID] = {184184- 0x00000000000C1400ULL, /* port a */185185- 0x00000000000C3400ULL, /* port b */186186- 0x00000000000C5400ULL /* port c */187187-};188188-189189-/* CSI FE, part of the Input System 2401 */190190-static const hrt_address CSI_RX_FE_CTRL_BASE[N_CSI_RX_FRONTEND_ID] = {191191- 0x00000000000C0400ULL, /* csi fe controller A */192192- 0x00000000000C2400ULL, /* csi fe controller B */193193- 0x00000000000C4400ULL /* csi fe controller C */194194-};195195-196196-/* CSI BE, part of the Input System 2401 */197197-static const hrt_address CSI_RX_BE_CTRL_BASE[N_CSI_RX_BACKEND_ID] = {198198- 0x00000000000C0800ULL, /* csi be controller A */199199- 0x00000000000C2800ULL, /* csi be controller B */200200- 0x00000000000C4800ULL /* csi be controller C */201201-};202202-203203-/* PIXEL Generator, part of the Input System 2401 */204204-static const hrt_address PIXELGEN_CTRL_BASE[N_PIXELGEN_ID] = {205205- 0x00000000000C1000ULL, /* pixel gen controller A */206206- 0x00000000000C3000ULL, /* pixel gen controller B */207207- 0x00000000000C5000ULL /* pixel gen controller C */208208-};209209-210210-/* Stream2MMIO, part of the Input System 2401 */211211-static const hrt_address STREAM2MMIO_CTRL_BASE[N_STREAM2MMIO_ID] = {212212- 0x00000000000C0C00ULL, /* stream2mmio controller A */213213- 0x00000000000C2C00ULL, /* stream2mmio controller B */214214- 0x00000000000C4C00ULL /* stream2mmio controller C */215215-};216216-#elif HRT_ADDRESS_WIDTH == 32217217-218218-#define GP_FIFO_BASE ((hrt_address)0x00090104) /* This is NOT a base address */219219-220220-/* DDR : Attention, this value not defined in 32-bit */221221-static const hrt_address DDR_BASE[N_DDR_ID] = {222222- 0x00000000UL223223-};224224-225225-/* ISP */226226-static const hrt_address ISP_CTRL_BASE[N_ISP_ID] = {227227- 0x00020000UL228228-};229229-230230-static const hrt_address ISP_DMEM_BASE[N_ISP_ID] = {231231- 0xffffffffUL232232-};233233-234234-static const hrt_address ISP_BAMEM_BASE[N_BAMEM_ID] = {235235- 0xffffffffUL236236-};237237-238238-static const hrt_address ISP_VAMEM_BASE[N_VAMEM_ID] = {239239- 0xffffffffUL,240240- 0xffffffffUL,241241- 0xffffffffUL242242-};243243-244244-static const hrt_address ISP_HMEM_BASE[N_HMEM_ID] = {245245- 0xffffffffUL246246-};247247-248248-/* SP */249249-static const hrt_address SP_CTRL_BASE[N_SP_ID] = {250250- 0x00010000UL251251-};252252-253253-static const hrt_address SP_DMEM_BASE[N_SP_ID] = {254254- 0x00300000UL255255-};256256-257257-/* MMU */258258-/*259259- * MMU0_ID: The data MMU260260- * MMU1_ID: The icache MMU261261- */262262-static const hrt_address MMU_BASE[N_MMU_ID] = {263263- 0x00070000UL,264264- 0x000A0000UL265265-};266266-267267-/* DMA */268268-static const hrt_address DMA_BASE[N_DMA_ID] = {269269- 0x00040000UL270270-};271271-272272-static const hrt_address ISYS2401_DMA_BASE[N_ISYS2401_DMA_ID] = {273273- 0x000CA000UL274274-};275275-276276-/* IRQ */277277-static const hrt_address IRQ_BASE[N_IRQ_ID] = {278278- 0x00000500UL,279279- 0x00030A00UL,280280- 0x0008C000UL,281281- 0x00090200UL282282-};283283-284284-/*285285- 0x00000500UL};286286- */287287-288288-/* GDC */289289-static const hrt_address GDC_BASE[N_GDC_ID] = {290290- 0x00050000UL,291291- 0x00060000UL292292-};293293-294294-/* FIFO_MONITOR (not a subset of GP_DEVICE) */295295-static const hrt_address FIFO_MONITOR_BASE[N_FIFO_MONITOR_ID] = {296296- 0x00000000UL297297-};298298-299299-/*300300-static const hrt_address GP_REGS_BASE[N_GP_REGS_ID] = {301301- 0x00000000UL};302302-303303-static const hrt_address GP_DEVICE_BASE[N_GP_DEVICE_ID] = {304304- 0x00090000UL};305305-*/306306-307307-/* GP_DEVICE (single base for all separate GP_REG instances) */308308-static const hrt_address GP_DEVICE_BASE[N_GP_DEVICE_ID] = {309309- 0x00000000UL310310-};311311-312312-/*GP TIMER , all timer registers are inter-twined,313313- * so, having multiple base addresses for314314- * different timers does not help*/315315-static const hrt_address GP_TIMER_BASE =316316- (hrt_address)0x00000600UL;317317-/* GPIO */318318-static const hrt_address GPIO_BASE[N_GPIO_ID] = {319319- 0x00000400UL320320-};321321-322322-/* TIMED_CTRL */323323-static const hrt_address TIMED_CTRL_BASE[N_TIMED_CTRL_ID] = {324324- 0x00000100UL325325-};326326-327327-/* INPUT_FORMATTER */328328-static const hrt_address INPUT_FORMATTER_BASE[N_INPUT_FORMATTER_ID] = {329329- 0x00030000UL,330330- 0x00030200UL,331331- 0x00030400UL332332-};333333-334334-/* 0x00030600UL, */ /* memcpy() */335335-336336-/* INPUT_SYSTEM */337337-static const hrt_address INPUT_SYSTEM_BASE[N_INPUT_SYSTEM_ID] = {338338- 0x00080000UL339339-};340340-341341-/* 0x00081000UL, */ /* capture A */342342-/* 0x00082000UL, */ /* capture B */343343-/* 0x00083000UL, */ /* capture C */344344-/* 0x00084000UL, */ /* Acquisition */345345-/* 0x00085000UL, */ /* DMA */346346-/* 0x00089000UL, */ /* ctrl */347347-/* 0x0008A000UL, */ /* GP regs */348348-/* 0x0008B000UL, */ /* FIFO */349349-/* 0x0008C000UL, */ /* IRQ */350350-351351-/* RX, the MIPI lane control regs start at offset 0 */352352-static const hrt_address RX_BASE[N_RX_ID] = {353353- 0x00080100UL354354-};355355-356356-/* IBUF_CTRL, part of the Input System 2401 */357357-static const hrt_address IBUF_CTRL_BASE[N_IBUF_CTRL_ID] = {358358- 0x000C1800UL, /* ibuf controller A */359359- 0x000C3800UL, /* ibuf controller B */360360- 0x000C5800UL /* ibuf controller C */361361-};362362-363363-/* ISYS IRQ Controllers, part of the Input System 2401 */364364-static const hrt_address ISYS_IRQ_BASE[N_ISYS_IRQ_ID] = {365365- 0x000C1400ULL, /* port a */366366- 0x000C3400ULL, /* port b */367367- 0x000C5400ULL /* port c */368368-};369369-370370-/* CSI FE, part of the Input System 2401 */371371-static const hrt_address CSI_RX_FE_CTRL_BASE[N_CSI_RX_FRONTEND_ID] = {372372- 0x000C0400UL, /* csi fe controller A */373373- 0x000C2400UL, /* csi fe controller B */374374- 0x000C4400UL /* csi fe controller C */375375-};376376-377377-/* CSI BE, part of the Input System 2401 */378378-static const hrt_address CSI_RX_FE_CTRL_BASE[N_CSI_RX_BACKEND_ID] = {379379- 0x000C0800UL, /* csi be controller A */380380- 0x000C2800UL, /* csi be controller B */381381- 0x000C4800UL /* csi be controller C */382382-};383383-384384-/* PIXEL Generator, part of the Input System 2401 */385385-static const hrt_address PIXELGEN_CTRL_BASE[N_PIXELGEN_ID] = {386386- 0x000C1000UL, /* pixel gen controller A */387387- 0x000C3000UL, /* pixel gen controller B */388388- 0x000C5000UL /* pixel gen controller C */389389-};390390-391391-/* Stream2MMIO, part of the Input System 2401 */392392-static const hrt_address STREAM2MMIO_CTRL_BASE[N_STREAM2MMIO_ID] = {393393- 0x000C0C00UL, /* stream2mmio controller A */394394- 0x000C2C00UL, /* stream2mmio controller B */395395- 0x000C4C00UL /* stream2mmio controller C */396396-};397397-398398-#else399399-#error "system_local.h: HRT_ADDRESS_WIDTH must be one of {32,64}"400400-#endif401401-402402-#endif /* __SYSTEM_LOCAL_H_INCLUDED__ */
···44 * (c) 2020 Mauro Carvalho Chehab <mchehab+huawei@kernel.org>55 */6677+#ifndef __SYSTEM_GLOBAL_H_INCLUDED__88+#define __SYSTEM_GLOBAL_H_INCLUDED__99+1010+/*1111+ * Create a list of HAS and IS properties that defines the system1212+ * Those are common for both ISP2400 and ISP24011313+ *1414+ * The configuration assumes the following1515+ * - The system is hetereogeneous; Multiple cells and devices classes1616+ * - The cell and device instances are homogeneous, each device type1717+ * belongs to the same class1818+ * - Device instances supporting a subset of the class capabilities are1919+ * allowed2020+ *2121+ * We could manage different device classes through the enumerated2222+ * lists (C) or the use of classes (C++), but that is presently not2323+ * fully supported2424+ *2525+ * N.B. the 3 input formatters are of 2 different classess2626+ */2727+2828+#define HAS_MMU_VERSION_22929+#define HAS_DMA_VERSION_23030+#define HAS_GDC_VERSION_23131+#define HAS_VAMEM_VERSION_23232+#define HAS_HMEM_VERSION_13333+#define HAS_BAMEM_VERSION_23434+#define HAS_IRQ_VERSION_23535+#define HAS_IRQ_MAP_VERSION_23636+#define HAS_INPUT_FORMATTER_VERSION_23737+#define HAS_INPUT_SYSTEM_VERSION_23838+#define HAS_BUFFERED_SENSOR3939+#define HAS_FIFO_MONITORS_VERSION_24040+#define HAS_GP_DEVICE_VERSION_24141+#define HAS_GPIO_VERSION_14242+#define HAS_TIMED_CTRL_VERSION_14343+#define HAS_RX_VERSION_24444+4545+/* per-frame parameter handling support */4646+#define SH_CSS_ENABLE_PER_FRAME_PARAMS4747+4848+#define DMA_DDR_TO_VAMEM_WORKAROUND4949+#define DMA_DDR_TO_HMEM_WORKAROUND5050+5151+/*5252+ * The longest allowed (uninteruptible) bus transfer, does not5353+ * take stalling into account5454+ */5555+#define HIVE_ISP_MAX_BURST_LENGTH 10245656+5757+/*5858+ * Maximum allowed burst length in words for the ISP DMA5959+ * This value is set to 2 to prevent the ISP DMA from blocking6060+ * the bus for too long; as the input system can only buffer6161+ * 2 lines on Moorefield and Cherrytrail, the input system buffers6262+ * may overflow if blocked for too long (BZ 2726).6363+ */6464+#define ISP2400_DMA_MAX_BURST_LENGTH 1286565+#define ISP2401_DMA_MAX_BURST_LENGTH 26666+767#ifdef ISP2401868# include "isp2401_system_global.h"969#else1070# include "isp2400_system_global.h"1171#endif7272+7373+#include <hive_isp_css_defs.h>7474+#include <type_support.h>7575+7676+/* This interface is deprecated */7777+#include "hive_types.h"7878+7979+/*8080+ * Semi global. "HRT" is accessible from SP, but the HRT types do not fully apply8181+ */8282+#define HRT_VADDRESS_WIDTH 328383+8484+#define SIZEOF_HRT_REG (HRT_DATA_WIDTH >> 3)8585+#define HIVE_ISP_CTRL_DATA_BYTES (HIVE_ISP_CTRL_DATA_WIDTH / 8)8686+8787+/* The main bus connecting all devices */8888+#define HRT_BUS_WIDTH HIVE_ISP_CTRL_DATA_WIDTH8989+#define HRT_BUS_BYTES HIVE_ISP_CTRL_DATA_BYTES9090+9191+typedef u32 hrt_bus_align_t;9292+9393+/*9494+ * Enumerate the devices, device access through the API is by ID,9595+ * through the DLI by address. The enumerator terminators are used9696+ * to size the wiring arrays and as an exception value.9797+ */9898+typedef enum {9999+ DDR0_ID = 0,100100+ N_DDR_ID101101+} ddr_ID_t;102102+103103+typedef enum {104104+ ISP0_ID = 0,105105+ N_ISP_ID106106+} isp_ID_t;107107+108108+typedef enum {109109+ SP0_ID = 0,110110+ N_SP_ID111111+} sp_ID_t;112112+113113+typedef enum {114114+ MMU0_ID = 0,115115+ MMU1_ID,116116+ N_MMU_ID117117+} mmu_ID_t;118118+119119+typedef enum {120120+ DMA0_ID = 0,121121+ N_DMA_ID122122+} dma_ID_t;123123+124124+typedef enum {125125+ GDC0_ID = 0,126126+ GDC1_ID,127127+ N_GDC_ID128128+} gdc_ID_t;129129+130130+/* this extra define is needed because we want to use it also131131+ in the preprocessor, and that doesn't work with enums.132132+ */133133+#define N_GDC_ID_CPP 2134134+135135+typedef enum {136136+ VAMEM0_ID = 0,137137+ VAMEM1_ID,138138+ VAMEM2_ID,139139+ N_VAMEM_ID140140+} vamem_ID_t;141141+142142+typedef enum {143143+ BAMEM0_ID = 0,144144+ N_BAMEM_ID145145+} bamem_ID_t;146146+147147+typedef enum {148148+ HMEM0_ID = 0,149149+ N_HMEM_ID150150+} hmem_ID_t;151151+152152+typedef enum {153153+ IRQ0_ID = 0, /* GP IRQ block */154154+ IRQ1_ID, /* Input formatter */155155+ IRQ2_ID, /* input system */156156+ IRQ3_ID, /* input selector */157157+ N_IRQ_ID158158+} irq_ID_t;159159+160160+typedef enum {161161+ FIFO_MONITOR0_ID = 0,162162+ N_FIFO_MONITOR_ID163163+} fifo_monitor_ID_t;164164+165165+typedef enum {166166+ GP_DEVICE0_ID = 0,167167+ N_GP_DEVICE_ID168168+} gp_device_ID_t;169169+170170+typedef enum {171171+ GP_TIMER0_ID = 0,172172+ GP_TIMER1_ID,173173+ GP_TIMER2_ID,174174+ GP_TIMER3_ID,175175+ GP_TIMER4_ID,176176+ GP_TIMER5_ID,177177+ GP_TIMER6_ID,178178+ GP_TIMER7_ID,179179+ N_GP_TIMER_ID180180+} gp_timer_ID_t;181181+182182+typedef enum {183183+ GPIO0_ID = 0,184184+ N_GPIO_ID185185+} gpio_ID_t;186186+187187+typedef enum {188188+ TIMED_CTRL0_ID = 0,189189+ N_TIMED_CTRL_ID190190+} timed_ctrl_ID_t;191191+192192+typedef enum {193193+ INPUT_FORMATTER0_ID = 0,194194+ INPUT_FORMATTER1_ID,195195+ INPUT_FORMATTER2_ID,196196+ INPUT_FORMATTER3_ID,197197+ N_INPUT_FORMATTER_ID198198+} input_formatter_ID_t;199199+200200+/* The IF RST is outside the IF */201201+#define INPUT_FORMATTER0_SRST_OFFSET 0x0824202202+#define INPUT_FORMATTER1_SRST_OFFSET 0x0624203203+#define INPUT_FORMATTER2_SRST_OFFSET 0x0424204204+#define INPUT_FORMATTER3_SRST_OFFSET 0x0224205205+206206+#define INPUT_FORMATTER0_SRST_MASK 0x0001207207+#define INPUT_FORMATTER1_SRST_MASK 0x0002208208+#define INPUT_FORMATTER2_SRST_MASK 0x0004209209+#define INPUT_FORMATTER3_SRST_MASK 0x0008210210+211211+typedef enum {212212+ INPUT_SYSTEM0_ID = 0,213213+ N_INPUT_SYSTEM_ID214214+} input_system_ID_t;215215+216216+typedef enum {217217+ RX0_ID = 0,218218+ N_RX_ID219219+} rx_ID_t;220220+221221+enum mipi_port_id {222222+ MIPI_PORT0_ID = 0,223223+ MIPI_PORT1_ID,224224+ MIPI_PORT2_ID,225225+ N_MIPI_PORT_ID226226+};227227+228228+#define N_RX_CHANNEL_ID 4229229+230230+/* Generic port enumeration with an internal port type ID */231231+typedef enum {232232+ CSI_PORT0_ID = 0,233233+ CSI_PORT1_ID,234234+ CSI_PORT2_ID,235235+ TPG_PORT0_ID,236236+ PRBS_PORT0_ID,237237+ FIFO_PORT0_ID,238238+ MEMORY_PORT0_ID,239239+ N_INPUT_PORT_ID240240+} input_port_ID_t;241241+242242+typedef enum {243243+ CAPTURE_UNIT0_ID = 0,244244+ CAPTURE_UNIT1_ID,245245+ CAPTURE_UNIT2_ID,246246+ ACQUISITION_UNIT0_ID,247247+ DMA_UNIT0_ID,248248+ CTRL_UNIT0_ID,249249+ GPREGS_UNIT0_ID,250250+ FIFO_UNIT0_ID,251251+ IRQ_UNIT0_ID,252252+ N_SUB_SYSTEM_ID253253+} sub_system_ID_t;254254+255255+#define N_CAPTURE_UNIT_ID 3256256+#define N_ACQUISITION_UNIT_ID 1257257+#define N_CTRL_UNIT_ID 1258258+259259+260260+enum ia_css_isp_memories {261261+ IA_CSS_ISP_PMEM0 = 0,262262+ IA_CSS_ISP_DMEM0,263263+ IA_CSS_ISP_VMEM0,264264+ IA_CSS_ISP_VAMEM0,265265+ IA_CSS_ISP_VAMEM1,266266+ IA_CSS_ISP_VAMEM2,267267+ IA_CSS_ISP_HMEM0,268268+ IA_CSS_SP_DMEM0,269269+ IA_CSS_DDR,270270+ N_IA_CSS_MEMORIES271271+};272272+273273+#define IA_CSS_NUM_MEMORIES 9274274+/* For driver compatibility */275275+#define N_IA_CSS_ISP_MEMORIES IA_CSS_NUM_MEMORIES276276+#define IA_CSS_NUM_ISP_MEMORIES IA_CSS_NUM_MEMORIES277277+278278+/*279279+ * ISP2401 specific enums280280+ */281281+282282+typedef enum {283283+ ISYS_IRQ0_ID = 0, /* port a */284284+ ISYS_IRQ1_ID, /* port b */285285+ ISYS_IRQ2_ID, /* port c */286286+ N_ISYS_IRQ_ID287287+} isys_irq_ID_t;288288+289289+290290+/*291291+ * Input-buffer Controller.292292+ */293293+typedef enum {294294+ IBUF_CTRL0_ID = 0, /* map to ISYS2401_IBUF_CNTRL_A */295295+ IBUF_CTRL1_ID, /* map to ISYS2401_IBUF_CNTRL_B */296296+ IBUF_CTRL2_ID, /* map ISYS2401_IBUF_CNTRL_C */297297+ N_IBUF_CTRL_ID298298+} ibuf_ctrl_ID_t;299299+/* end of Input-buffer Controller */300300+301301+/*302302+ * Stream2MMIO.303303+ */304304+typedef enum {305305+ STREAM2MMIO0_ID = 0, /* map to ISYS2401_S2M_A */306306+ STREAM2MMIO1_ID, /* map to ISYS2401_S2M_B */307307+ STREAM2MMIO2_ID, /* map to ISYS2401_S2M_C */308308+ N_STREAM2MMIO_ID309309+} stream2mmio_ID_t;310310+311311+typedef enum {312312+ /*313313+ * Stream2MMIO 0 has 8 SIDs that are indexed by314314+ * [STREAM2MMIO_SID0_ID...STREAM2MMIO_SID7_ID].315315+ *316316+ * Stream2MMIO 1 has 4 SIDs that are indexed by317317+ * [STREAM2MMIO_SID0_ID...TREAM2MMIO_SID3_ID].318318+ *319319+ * Stream2MMIO 2 has 4 SIDs that are indexed by320320+ * [STREAM2MMIO_SID0_ID...STREAM2MMIO_SID3_ID].321321+ */322322+ STREAM2MMIO_SID0_ID = 0,323323+ STREAM2MMIO_SID1_ID,324324+ STREAM2MMIO_SID2_ID,325325+ STREAM2MMIO_SID3_ID,326326+ STREAM2MMIO_SID4_ID,327327+ STREAM2MMIO_SID5_ID,328328+ STREAM2MMIO_SID6_ID,329329+ STREAM2MMIO_SID7_ID,330330+ N_STREAM2MMIO_SID_ID331331+} stream2mmio_sid_ID_t;332332+/* end of Stream2MMIO */333333+334334+/**335335+ * Input System 2401: CSI-MIPI recevier.336336+ */337337+typedef enum {338338+ CSI_RX_BACKEND0_ID = 0, /* map to ISYS2401_MIPI_BE_A */339339+ CSI_RX_BACKEND1_ID, /* map to ISYS2401_MIPI_BE_B */340340+ CSI_RX_BACKEND2_ID, /* map to ISYS2401_MIPI_BE_C */341341+ N_CSI_RX_BACKEND_ID342342+} csi_rx_backend_ID_t;343343+344344+typedef enum {345345+ CSI_RX_FRONTEND0_ID = 0, /* map to ISYS2401_CSI_RX_A */346346+ CSI_RX_FRONTEND1_ID, /* map to ISYS2401_CSI_RX_B */347347+ CSI_RX_FRONTEND2_ID, /* map to ISYS2401_CSI_RX_C */348348+#define N_CSI_RX_FRONTEND_ID (CSI_RX_FRONTEND2_ID + 1)349349+} csi_rx_frontend_ID_t;350350+351351+typedef enum {352352+ CSI_RX_DLANE0_ID = 0, /* map to DLANE0 in CSI RX */353353+ CSI_RX_DLANE1_ID, /* map to DLANE1 in CSI RX */354354+ CSI_RX_DLANE2_ID, /* map to DLANE2 in CSI RX */355355+ CSI_RX_DLANE3_ID, /* map to DLANE3 in CSI RX */356356+ N_CSI_RX_DLANE_ID357357+} csi_rx_fe_dlane_ID_t;358358+/* end of CSI-MIPI receiver */359359+360360+typedef enum {361361+ ISYS2401_DMA0_ID = 0,362362+ N_ISYS2401_DMA_ID363363+} isys2401_dma_ID_t;364364+365365+/**366366+ * Pixel-generator. ("system_global.h")367367+ */368368+typedef enum {369369+ PIXELGEN0_ID = 0,370370+ PIXELGEN1_ID,371371+ PIXELGEN2_ID,372372+ N_PIXELGEN_ID373373+} pixelgen_ID_t;374374+/* end of pixel-generator. ("system_global.h") */375375+376376+typedef enum {377377+ INPUT_SYSTEM_CSI_PORT0_ID = 0,378378+ INPUT_SYSTEM_CSI_PORT1_ID,379379+ INPUT_SYSTEM_CSI_PORT2_ID,380380+381381+ INPUT_SYSTEM_PIXELGEN_PORT0_ID,382382+ INPUT_SYSTEM_PIXELGEN_PORT1_ID,383383+ INPUT_SYSTEM_PIXELGEN_PORT2_ID,384384+385385+ N_INPUT_SYSTEM_INPUT_PORT_ID386386+} input_system_input_port_ID_t;387387+388388+#define N_INPUT_SYSTEM_CSI_PORT 3389389+390390+typedef enum {391391+ ISYS2401_DMA_CHANNEL_0 = 0,392392+ ISYS2401_DMA_CHANNEL_1,393393+ ISYS2401_DMA_CHANNEL_2,394394+ ISYS2401_DMA_CHANNEL_3,395395+ ISYS2401_DMA_CHANNEL_4,396396+ ISYS2401_DMA_CHANNEL_5,397397+ ISYS2401_DMA_CHANNEL_6,398398+ ISYS2401_DMA_CHANNEL_7,399399+ ISYS2401_DMA_CHANNEL_8,400400+ ISYS2401_DMA_CHANNEL_9,401401+ ISYS2401_DMA_CHANNEL_10,402402+ ISYS2401_DMA_CHANNEL_11,403403+ N_ISYS2401_DMA_CHANNEL404404+} isys2401_dma_channel;405405+406406+#endif /* __SYSTEM_GLOBAL_H_INCLUDED__ */
+179
drivers/staging/media/atomisp/pci/system_local.c
···11+// SPDX-License-Identifier: GPL-2.022+/*33+ * Support for Intel Camera Imaging ISP subsystem.44+ * Copyright (c) 2015, Intel Corporation.55+ *66+ * This program is free software; you can redistribute it and/or modify it77+ * under the terms and conditions of the GNU General Public License,88+ * version 2, as published by the Free Software Foundation.99+ *1010+ * This program is distributed in the hope it will be useful, but WITHOUT1111+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or1212+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for1313+ * more details.1414+ */1515+1616+#include "system_local.h"1717+1818+/* ISP */1919+const hrt_address ISP_CTRL_BASE[N_ISP_ID] = {2020+ 0x0000000000020000ULL2121+};2222+2323+const hrt_address ISP_DMEM_BASE[N_ISP_ID] = {2424+ 0x0000000000200000ULL2525+};2626+2727+const hrt_address ISP_BAMEM_BASE[N_BAMEM_ID] = {2828+ 0x0000000000100000ULL2929+};3030+3131+/* SP */3232+const hrt_address SP_CTRL_BASE[N_SP_ID] = {3333+ 0x0000000000010000ULL3434+};3535+3636+const hrt_address SP_DMEM_BASE[N_SP_ID] = {3737+ 0x0000000000300000ULL3838+};3939+4040+/* MMU */4141+/*4242+ * MMU0_ID: The data MMU4343+ * MMU1_ID: The icache MMU4444+ */4545+const hrt_address MMU_BASE[N_MMU_ID] = {4646+ 0x0000000000070000ULL,4747+ 0x00000000000A0000ULL4848+};4949+5050+/* DMA */5151+const hrt_address DMA_BASE[N_DMA_ID] = {5252+ 0x0000000000040000ULL5353+};5454+5555+const hrt_address ISYS2401_DMA_BASE[N_ISYS2401_DMA_ID] = {5656+ 0x00000000000CA000ULL5757+};5858+5959+/* IRQ */6060+const hrt_address IRQ_BASE[N_IRQ_ID] = {6161+ 0x0000000000000500ULL,6262+ 0x0000000000030A00ULL,6363+ 0x000000000008C000ULL,6464+ 0x0000000000090200ULL6565+};6666+6767+/*6868+ 0x0000000000000500ULL};6969+ */7070+7171+/* GDC */7272+const hrt_address GDC_BASE[N_GDC_ID] = {7373+ 0x0000000000050000ULL,7474+ 0x0000000000060000ULL7575+};7676+7777+/* FIFO_MONITOR (not a subset of GP_DEVICE) */7878+const hrt_address FIFO_MONITOR_BASE[N_FIFO_MONITOR_ID] = {7979+ 0x0000000000000000ULL8080+};8181+8282+/*8383+const hrt_address GP_REGS_BASE[N_GP_REGS_ID] = {8484+ 0x0000000000000000ULL};8585+8686+const hrt_address GP_DEVICE_BASE[N_GP_DEVICE_ID] = {8787+ 0x0000000000090000ULL};8888+*/8989+9090+/* GP_DEVICE (single base for all separate GP_REG instances) */9191+const hrt_address GP_DEVICE_BASE[N_GP_DEVICE_ID] = {9292+ 0x0000000000000000ULL9393+};9494+9595+/*GP TIMER , all timer registers are inter-twined,9696+ * so, having multiple base addresses for9797+ * different timers does not help*/9898+const hrt_address GP_TIMER_BASE =9999+ (hrt_address)0x0000000000000600ULL;100100+101101+/* GPIO */102102+const hrt_address GPIO_BASE[N_GPIO_ID] = {103103+ 0x0000000000000400ULL104104+};105105+106106+/* TIMED_CTRL */107107+const hrt_address TIMED_CTRL_BASE[N_TIMED_CTRL_ID] = {108108+ 0x0000000000000100ULL109109+};110110+111111+/* INPUT_FORMATTER */112112+const hrt_address INPUT_FORMATTER_BASE[N_INPUT_FORMATTER_ID] = {113113+ 0x0000000000030000ULL,114114+ 0x0000000000030200ULL,115115+ 0x0000000000030400ULL,116116+ 0x0000000000030600ULL117117+}; /* memcpy() */118118+119119+/* INPUT_SYSTEM */120120+const hrt_address INPUT_SYSTEM_BASE[N_INPUT_SYSTEM_ID] = {121121+ 0x0000000000080000ULL122122+};123123+124124+/* 0x0000000000081000ULL, */ /* capture A */125125+/* 0x0000000000082000ULL, */ /* capture B */126126+/* 0x0000000000083000ULL, */ /* capture C */127127+/* 0x0000000000084000ULL, */ /* Acquisition */128128+/* 0x0000000000085000ULL, */ /* DMA */129129+/* 0x0000000000089000ULL, */ /* ctrl */130130+/* 0x000000000008A000ULL, */ /* GP regs */131131+/* 0x000000000008B000ULL, */ /* FIFO */132132+/* 0x000000000008C000ULL, */ /* IRQ */133133+134134+/* RX, the MIPI lane control regs start at offset 0 */135135+const hrt_address RX_BASE[N_RX_ID] = {136136+ 0x0000000000080100ULL137137+};138138+139139+/* IBUF_CTRL, part of the Input System 2401 */140140+const hrt_address IBUF_CTRL_BASE[N_IBUF_CTRL_ID] = {141141+ 0x00000000000C1800ULL, /* ibuf controller A */142142+ 0x00000000000C3800ULL, /* ibuf controller B */143143+ 0x00000000000C5800ULL /* ibuf controller C */144144+};145145+146146+/* ISYS IRQ Controllers, part of the Input System 2401 */147147+const hrt_address ISYS_IRQ_BASE[N_ISYS_IRQ_ID] = {148148+ 0x00000000000C1400ULL, /* port a */149149+ 0x00000000000C3400ULL, /* port b */150150+ 0x00000000000C5400ULL /* port c */151151+};152152+153153+/* CSI FE, part of the Input System 2401 */154154+const hrt_address CSI_RX_FE_CTRL_BASE[N_CSI_RX_FRONTEND_ID] = {155155+ 0x00000000000C0400ULL, /* csi fe controller A */156156+ 0x00000000000C2400ULL, /* csi fe controller B */157157+ 0x00000000000C4400ULL /* csi fe controller C */158158+};159159+160160+/* CSI BE, part of the Input System 2401 */161161+const hrt_address CSI_RX_BE_CTRL_BASE[N_CSI_RX_BACKEND_ID] = {162162+ 0x00000000000C0800ULL, /* csi be controller A */163163+ 0x00000000000C2800ULL, /* csi be controller B */164164+ 0x00000000000C4800ULL /* csi be controller C */165165+};166166+167167+/* PIXEL Generator, part of the Input System 2401 */168168+const hrt_address PIXELGEN_CTRL_BASE[N_PIXELGEN_ID] = {169169+ 0x00000000000C1000ULL, /* pixel gen controller A */170170+ 0x00000000000C3000ULL, /* pixel gen controller B */171171+ 0x00000000000C5000ULL /* pixel gen controller C */172172+};173173+174174+/* Stream2MMIO, part of the Input System 2401 */175175+const hrt_address STREAM2MMIO_CTRL_BASE[N_STREAM2MMIO_ID] = {176176+ 0x00000000000C0C00ULL, /* stream2mmio controller A */177177+ 0x00000000000C2C00ULL, /* stream2mmio controller B */178178+ 0x00000000000C4C00ULL /* stream2mmio controller C */179179+};
+98-6
drivers/staging/media/atomisp/pci/system_local.h
···11/* SPDX-License-Identifier: GPL-2.0 */22-// SPDX-License-Identifier: GPL-2.0-or-later32/*44- * (c) 2020 Mauro Carvalho Chehab <mchehab+huawei@kernel.org>33+ * Support for Intel Camera Imaging ISP subsystem.44+ * Copyright (c) 2015, Intel Corporation.55+ *66+ * This program is free software; you can redistribute it and/or modify it77+ * under the terms and conditions of the GNU General Public License,88+ * version 2, as published by the Free Software Foundation.99+ *1010+ * This program is distributed in the hope it will be useful, but WITHOUT1111+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or1212+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for1313+ * more details.514 */61577-#ifdef ISP240188-# include "isp2401_system_local.h"99-#else1010-# include "isp2400_system_local.h"1616+#ifndef __SYSTEM_LOCAL_H_INCLUDED__1717+#define __SYSTEM_LOCAL_H_INCLUDED__1818+1919+#ifdef HRT_ISP_CSS_CUSTOM_HOST2020+#ifndef HRT_USE_VIR_ADDRS2121+#define HRT_USE_VIR_ADDRS1122#endif2323+#endif2424+2525+#include "system_global.h"2626+2727+/* This interface is deprecated */2828+#include "hive_types.h"2929+3030+/*3131+ * Cell specific address maps3232+ */3333+3434+#define GP_FIFO_BASE ((hrt_address)0x0000000000090104) /* This is NOT a base address */3535+3636+/* ISP */3737+extern const hrt_address ISP_CTRL_BASE[N_ISP_ID];3838+extern const hrt_address ISP_DMEM_BASE[N_ISP_ID];3939+extern const hrt_address ISP_BAMEM_BASE[N_BAMEM_ID];4040+4141+/* SP */4242+extern const hrt_address SP_CTRL_BASE[N_SP_ID];4343+extern const hrt_address SP_DMEM_BASE[N_SP_ID];4444+4545+/* MMU */4646+4747+extern const hrt_address MMU_BASE[N_MMU_ID];4848+4949+/* DMA */5050+extern const hrt_address DMA_BASE[N_DMA_ID];5151+extern const hrt_address ISYS2401_DMA_BASE[N_ISYS2401_DMA_ID];5252+5353+/* IRQ */5454+extern const hrt_address IRQ_BASE[N_IRQ_ID];5555+5656+/* GDC */5757+extern const hrt_address GDC_BASE[N_GDC_ID];5858+5959+/* FIFO_MONITOR (not a subset of GP_DEVICE) */6060+extern const hrt_address FIFO_MONITOR_BASE[N_FIFO_MONITOR_ID];6161+6262+/* GP_DEVICE (single base for all separate GP_REG instances) */6363+extern const hrt_address GP_DEVICE_BASE[N_GP_DEVICE_ID];6464+6565+/*GP TIMER , all timer registers are inter-twined,6666+ * so, having multiple base addresses for6767+ * different timers does not help*/6868+extern const hrt_address GP_TIMER_BASE;6969+7070+/* GPIO */7171+extern const hrt_address GPIO_BASE[N_GPIO_ID];7272+7373+/* TIMED_CTRL */7474+extern const hrt_address TIMED_CTRL_BASE[N_TIMED_CTRL_ID];7575+7676+/* INPUT_FORMATTER */7777+extern const hrt_address INPUT_FORMATTER_BASE[N_INPUT_FORMATTER_ID];7878+7979+/* INPUT_SYSTEM */8080+extern const hrt_address INPUT_SYSTEM_BASE[N_INPUT_SYSTEM_ID];8181+8282+/* RX, the MIPI lane control regs start at offset 0 */8383+extern const hrt_address RX_BASE[N_RX_ID];8484+8585+/* IBUF_CTRL, part of the Input System 2401 */8686+extern const hrt_address IBUF_CTRL_BASE[N_IBUF_CTRL_ID];8787+8888+/* ISYS IRQ Controllers, part of the Input System 2401 */8989+extern const hrt_address ISYS_IRQ_BASE[N_ISYS_IRQ_ID];9090+9191+/* CSI FE, part of the Input System 2401 */9292+extern const hrt_address CSI_RX_FE_CTRL_BASE[N_CSI_RX_FRONTEND_ID];9393+9494+/* CSI BE, part of the Input System 2401 */9595+extern const hrt_address CSI_RX_BE_CTRL_BASE[N_CSI_RX_BACKEND_ID];9696+9797+/* PIXEL Generator, part of the Input System 2401 */9898+extern const hrt_address PIXELGEN_CTRL_BASE[N_PIXELGEN_ID];9999+100100+/* Stream2MMIO, part of the Input System 2401 */101101+extern const hrt_address STREAM2MMIO_CTRL_BASE[N_STREAM2MMIO_ID];102102+103103+#endif /* __SYSTEM_LOCAL_H_INCLUDED__ */
+15-1
drivers/staging/wlan-ng/prism2usb.c
···6161 const struct usb_device_id *id)6262{6363 struct usb_device *dev;6464-6464+ const struct usb_endpoint_descriptor *epd;6565+ const struct usb_host_interface *iface_desc = interface->cur_altsetting;6566 struct wlandevice *wlandev = NULL;6667 struct hfa384x *hw = NULL;6768 int result = 0;6969+7070+ if (iface_desc->desc.bNumEndpoints != 2) {7171+ result = -ENODEV;7272+ goto failed;7373+ }7474+7575+ result = -EINVAL;7676+ epd = &iface_desc->endpoint[1].desc;7777+ if (!usb_endpoint_is_bulk_in(epd))7878+ goto failed;7979+ epd = &iface_desc->endpoint[2].desc;8080+ if (!usb_endpoint_is_bulk_out(epd))8181+ goto failed;68826983 dev = interface_to_usbdev(interface);7084 wlandev = create_wlan();
+1-1
drivers/tty/serial/8250/8250_core.c
···524524 */525525 up->mcr_mask = ~ALPHA_KLUDGE_MCR;526526 up->mcr_force = ALPHA_KLUDGE_MCR;527527+ serial8250_set_defaults(up);527528 }528529529530 /* chain base port ops to support Remote Supervisor Adapter */···548547 port->membase = old_serial_port[i].iomem_base;549548 port->iotype = old_serial_port[i].io_type;550549 port->regshift = old_serial_port[i].iomem_reg_shift;551551- serial8250_set_defaults(up);552550553551 port->irqflags |= irqflag;554552 if (serial8250_isa_config != NULL)
+11-1
drivers/tty/serial/8250/8250_exar.c
···326326 * devices will export them as GPIOs, so we pre-configure them safely327327 * as inputs.328328 */329329- u8 dir = pcidev->vendor == PCI_VENDOR_ID_EXAR ? 0xff : 0x00;329329+330330+ u8 dir = 0x00;331331+332332+ if ((pcidev->vendor == PCI_VENDOR_ID_EXAR) &&333333+ (pcidev->subsystem_vendor != PCI_VENDOR_ID_SEALEVEL)) {334334+ // Configure GPIO as inputs for Commtech adapters335335+ dir = 0xff;336336+ } else {337337+ // Configure GPIO as outputs for SeaLevel adapters338338+ dir = 0x00;339339+ }330340331341 writeb(0x00, p + UART_EXAR_MPIOINT_7_0);332342 writeb(0x00, p + UART_EXAR_MPIOLVL_7_0);
+18
drivers/tty/serial/8250/8250_mtk.c
···306306 }307307#endif308308309309+ /*310310+ * Store the requested baud rate before calling the generic 8250311311+ * set_termios method. Standard 8250 port expects bauds to be312312+ * no higher than (uartclk / 16) so the baud will be clamped if it313313+ * gets out of that bound. Mediatek 8250 port supports speed314314+ * higher than that, therefore we'll get original baud rate back315315+ * after calling the generic set_termios method and recalculate316316+ * the speed later in this method.317317+ */318318+ baud = tty_termios_baud_rate(termios);319319+309320 serial8250_do_set_termios(port, termios, old);321321+322322+ tty_termios_encode_baud_rate(termios, baud, baud);310323311324 /*312325 * Mediatek UARTs use an extra highspeed register (MTK_UART_HIGHS)···351338 * interrupts disabled.352339 */353340 spin_lock_irqsave(&port->lock, flags);341341+342342+ /*343343+ * Update the per-port timeout.344344+ */345345+ uart_update_timeout(port, termios->c_cflag, baud);354346355347 /* set DLAB we have cval saved in up->lcr from the call to the core */356348 serial_port_out(port, UART_LCR, up->lcr | UART_LCR_DLAB);
+7-9
drivers/tty/serial/serial-tegra.c
···635635}636636637637static void tegra_uart_handle_rx_pio(struct tegra_uart_port *tup,638638- struct tty_port *tty)638638+ struct tty_port *port)639639{640640 do {641641 char flag = TTY_NORMAL;···653653 ch = (unsigned char) tegra_uart_read(tup, UART_RX);654654 tup->uport.icount.rx++;655655656656- if (!uart_handle_sysrq_char(&tup->uport, ch) && tty)657657- tty_insert_flip_char(tty, ch, flag);656656+ if (uart_handle_sysrq_char(&tup->uport, ch))657657+ continue;658658659659 if (tup->uport.ignore_status_mask & UART_LSR_DR)660660 continue;661661+662662+ tty_insert_flip_char(port, ch, flag);661663 } while (1);662664}663665664666static void tegra_uart_copy_rx_to_tty(struct tegra_uart_port *tup,665665- struct tty_port *tty,667667+ struct tty_port *port,666668 unsigned int count)667669{668670 int copied;···674672 return;675673676674 tup->uport.icount.rx += count;677677- if (!tty) {678678- dev_err(tup->uport.dev, "No tty port\n");679679- return;680680- }681675682676 if (tup->uport.ignore_status_mask & UART_LSR_DR)683677 return;684678685679 dma_sync_single_for_cpu(tup->uport.dev, tup->rx_dma_buf_phys,686680 count, DMA_FROM_DEVICE);687687- copied = tty_insert_flip_string(tty,681681+ copied = tty_insert_flip_string(port,688682 ((unsigned char *)(tup->rx_dma_buf_virt)), count);689683 if (copied != count) {690684 WARN_ON(1);
+6-2
drivers/tty/serial/xilinx_uartps.c
···15801580 * If register_console() don't assign value, then console_port pointer15811581 * is cleanup.15821582 */15831583- if (!console_port)15831583+ if (!console_port) {15841584+ cdns_uart_console.index = id;15841585 console_port = port;15861586+ }15851587#endif1586158815871589 rc = uart_add_one_port(&cdns_uart_uart_driver, port);···15961594#ifdef CONFIG_SERIAL_XILINX_PS_UART_CONSOLE15971595 /* This is not port which is used for console that's why clean it up */15981596 if (console_port == port &&15991599- !(cdns_uart_uart_driver.cons->flags & CON_ENABLED))15971597+ !(cdns_uart_uart_driver.cons->flags & CON_ENABLED)) {16001598 console_port = NULL;15991599+ cdns_uart_console.index = -1;16001600+ }16011601#endif1602160216031603 cdns_uart_data->cts_override = of_property_read_bool(pdev->dev.of_node,
+18-11
drivers/tty/vt/vt.c
···10921092 .destruct = vc_port_destruct,10931093};1094109410951095+/*10961096+ * Change # of rows and columns (0 means unchanged/the size of fg_console)10971097+ * [this is to be used together with some user program10981098+ * like resize that changes the hardware videomode]10991099+ */11001100+#define VC_MAXCOL (32767)11011101+#define VC_MAXROW (32767)11021102+10951103int vc_allocate(unsigned int currcons) /* return 0 on success */10961104{10971105 struct vt_notifier_param param;10981106 struct vc_data *vc;11071107+ int err;1099110811001109 WARN_CONSOLE_UNLOCKED();11011110···11341125 if (!*vc->vc_uni_pagedir_loc)11351126 con_set_default_unimap(vc);1136112711281128+ err = -EINVAL;11291129+ if (vc->vc_cols > VC_MAXCOL || vc->vc_rows > VC_MAXROW ||11301130+ vc->vc_screenbuf_size > KMALLOC_MAX_SIZE || !vc->vc_screenbuf_size)11311131+ goto err_free;11321132+ err = -ENOMEM;11371133 vc->vc_screenbuf = kzalloc(vc->vc_screenbuf_size, GFP_KERNEL);11381134 if (!vc->vc_screenbuf)11391135 goto err_free;···11571143 visual_deinit(vc);11581144 kfree(vc);11591145 vc_cons[currcons].d = NULL;11601160- return -ENOMEM;11461146+ return err;11611147}1162114811631149static inline int resize_screen(struct vc_data *vc, int width, int height,···1171115711721158 return err;11731159}11741174-11751175-/*11761176- * Change # of rows and columns (0 means unchanged/the size of fg_console)11771177- * [this is to be used together with some user program11781178- * like resize that changes the hardware videomode]11791179- */11801180-#define VC_RESIZE_MAXCOL (32767)11811181-#define VC_RESIZE_MAXROW (32767)1182116011831161/**11841162 * vc_do_resize - resizing method for the tty···12071201 user = vc->vc_resize_user;12081202 vc->vc_resize_user = 0;1209120312101210- if (cols > VC_RESIZE_MAXCOL || lines > VC_RESIZE_MAXROW)12041204+ if (cols > VC_MAXCOL || lines > VC_MAXROW)12111205 return -EINVAL;1212120612131207 new_cols = (cols ? cols : vc->vc_cols);···12181212 if (new_cols == vc->vc_cols && new_rows == vc->vc_rows)12191213 return 0;1220121412211221- if (new_screen_size > KMALLOC_MAX_SIZE)12151215+ if (new_screen_size > KMALLOC_MAX_SIZE || !new_screen_size)12221216 return -EINVAL;12231217 newscreen = kzalloc(new_screen_size, GFP_USER);12241218 if (!newscreen)···33993393 INIT_WORK(&vc_cons[currcons].SAK_work, vc_SAK);34003394 tty_port_init(&vc->port);34013395 visual_init(vc, currcons, 1);33963396+ /* Assuming vc->vc_{cols,rows,screenbuf_size} are sane here. */34023397 vc->vc_screenbuf = kzalloc(vc->vc_screenbuf_size, GFP_NOWAIT);34033398 vc_init(vc, vc->vc_rows, vc->vc_cols,34043399 currcons || !vc->vc_sw->con_save_screen);
+4
drivers/usb/host/xhci-mtk-sch.c
···557557 if (is_fs_or_ls(speed) && !has_tt)558558 return false;559559560560+ /* skip endpoint with zero maxpkt */561561+ if (usb_endpoint_maxp(&ep->desc) == 0)562562+ return false;563563+560564 return true;561565}562566
···641641 &vm_cmdline_id, &consumed);642642643643 /*644644- * sscanf() must processes at least 2 chunks; also there644644+ * sscanf() must process at least 2 chunks; also there645645 * must be no extra characters after the last chunk, so646646 * str[consumed] must be '\0'647647 */648648- if (processed < 2 || str[consumed])648648+ if (processed < 2 || str[consumed] || irq == 0)649649 return -EINVAL;650650651651 resources[0].flags = IORESOURCE_MEM;
···19991999 if (!PageDirty(pages[i]) ||20002000 pages[i]->mapping != mapping) {20012001 unlock_page(pages[i]);20022002- put_page(pages[i]);20022002+ for (; i < ret; i++)20032003+ put_page(pages[i]);20032004 err = -EAGAIN;20042005 goto out;20052006 }
+10-13
fs/btrfs/inode.c
···81238123 /*81248124 * Qgroup reserved space handler81258125 * Page here will be either81268126- * 1) Already written to disk81278127- * In this case, its reserved space is released from data rsv map81288128- * and will be freed by delayed_ref handler finally.81298129- * So even we call qgroup_free_data(), it won't decrease reserved81308130- * space.81318131- * 2) Not written to disk81328132- * This means the reserved space should be freed here. However,81338133- * if a truncate invalidates the page (by clearing PageDirty)81348134- * and the page is accounted for while allocating extent81358135- * in btrfs_check_data_free_space() we let delayed_ref to81368136- * free the entire extent.81268126+ * 1) Already written to disk or ordered extent already submitted81278127+ * Then its QGROUP_RESERVED bit in io_tree is already cleaned.81288128+ * Qgroup will be handled by its qgroup_record then.81298129+ * btrfs_qgroup_free_data() call will do nothing here.81308130+ *81318131+ * 2) Not written to disk yet81328132+ * Then btrfs_qgroup_free_data() call will clear the QGROUP_RESERVED81338133+ * bit of its io_tree, and free the qgroup reserved data space.81348134+ * Since the IO will never happen for this page.81378135 */81388138- if (PageDirty(page))81398139- btrfs_qgroup_free_data(inode, NULL, page_start, PAGE_SIZE);81368136+ btrfs_qgroup_free_data(inode, NULL, page_start, PAGE_SIZE);81408137 if (!inode_evicting) {81418138 clear_extent_bit(tree, page_start, page_end, EXTENT_LOCKED |81428139 EXTENT_DELALLOC | EXTENT_DELALLOC_NEW |
+8
fs/btrfs/volumes.c
···70527052 mutex_lock(&fs_info->chunk_mutex);7053705370547054 /*70557055+ * It is possible for mount and umount to race in such a way that70567056+ * we execute this code path, but open_fs_devices failed to clear70577057+ * total_rw_bytes. We certainly want it cleared before reading the70587058+ * device items, so clear it here.70597059+ */70607060+ fs_info->fs_devices->total_rw_bytes = 0;70617061+70627062+ /*70557063 * Read all device items, and then all the chunk items. All70567064 * device items are found before any chunk item (their object id70577065 * is smaller than the lowest possible object id for a chunk
+2-8
fs/cifs/inode.c
···20442044 FILE_UNIX_BASIC_INFO *info_buf_target;20452045 unsigned int xid;20462046 int rc, tmprc;20472047- bool new_target = d_really_is_negative(target_dentry);2048204720492048 if (flags & ~RENAME_NOREPLACE)20502049 return -EINVAL;···21202121 */2121212221222123unlink_target:21232123- /*21242124- * If the target dentry was created during the rename, try21252125- * unlinking it if it's not negative21262126- */21272127- if (new_target &&21282128- d_really_is_positive(target_dentry) &&21292129- (rc == -EACCES || rc == -EEXIST)) {21242124+ /* Try unlinking the target dentry if it's not negative */21252125+ if (d_really_is_positive(target_dentry) && (rc == -EACCES || rc == -EEXIST)) {21302126 if (d_is_dir(target_dentry))21312127 tmprc = cifs_rmdir(target_dir, target_dentry);21322128 else
+3-3
fs/efivarfs/super.c
···201201 sb->s_d_op = &efivarfs_d_ops;202202 sb->s_time_gran = 1;203203204204+ if (!efivar_supports_writes())205205+ sb->s_flags |= SB_RDONLY;206206+204207 inode = efivarfs_get_inode(sb, NULL, S_IFDIR | 0755, 0, true);205208 if (!inode)206209 return -ENOMEM;···255252256253static __init int efivarfs_init(void)257254{258258- if (!efi_rt_services_supported(EFI_RT_SUPPORTED_VARIABLE_SERVICES))259259- return -ENODEV;260260-261255 if (!efivars_kobject())262256 return -ENODEV;263257
+1-1
fs/exfat/dir.c
···11121112 ret = exfat_get_next_cluster(sb, &clu.dir);11131113 }1114111411151115- if (ret || clu.dir != EXFAT_EOF_CLUSTER) {11151115+ if (ret || clu.dir == EXFAT_EOF_CLUSTER) {11161116 /* just initialized hint_stat */11171117 hint_stat->clu = p_dir->dir;11181118 hint_stat->eidx = 0;
···175175 /* Extract the length of the metadata block */176176 data = page_address(bvec->bv_page) + bvec->bv_offset;177177 length = data[offset];178178- if (offset <= bvec->bv_len - 1) {178178+ if (offset < bvec->bv_len - 1) {179179 length |= data[offset + 1] << 8;180180 } else {181181 if (WARN_ON_ONCE(!bio_next_segment(bio, &iter_all))) {
+11-7
fs/zonefs/super.c
···607607 int nr_pages;608608 ssize_t ret;609609610610- nr_pages = iov_iter_npages(from, BIO_MAX_PAGES);611611- if (!nr_pages)612612- return 0;613613-614610 max = queue_max_zone_append_sectors(bdev_get_queue(bdev));615611 max = ALIGN_DOWN(max << SECTOR_SHIFT, inode->i_sb->s_blocksize);616612 iov_iter_truncate(from, max);613613+614614+ nr_pages = iov_iter_npages(from, BIO_MAX_PAGES);615615+ if (!nr_pages)616616+ return 0;617617618618 bio = bio_alloc_bioset(GFP_NOFS, nr_pages, &fs_bio_set);619619 if (!bio)···11191119 char *file_name;11201120 struct dentry *dir;11211121 unsigned int n = 0;11221122- int ret = -ENOMEM;11221122+ int ret;1123112311241124 /* If the group is empty, there is nothing to do */11251125 if (!zd->nr_zones[type])···11351135 zgroup_name = "seq";1136113611371137 dir = zonefs_create_inode(sb->s_root, zgroup_name, NULL, type);11381138- if (!dir)11381138+ if (!dir) {11391139+ ret = -ENOMEM;11391140 goto free;11411141+ }1140114211411143 /*11421144 * The first zone contains the super block: skip it.···11761174 * Use the file number within its group as file name.11771175 */11781176 snprintf(file_name, ZONEFS_NAME_MAX - 1, "%u", n);11791179- if (!zonefs_create_inode(dir, file_name, zone, type))11771177+ if (!zonefs_create_inode(dir, file_name, zone, type)) {11781178+ ret = -ENOMEM;11801179 goto free;11801180+ }1181118111821182 n++;11831183 }
···5656 * on a bus (or read from them). Apart from two basic transfer functions to5757 * transmit one message at a time, a more complex version can be used to5858 * transmit an arbitrary number of messages without interruption.5959- * @count must be be less than 64k since msg.len is u16.5959+ * @count must be less than 64k since msg.len is u16.6060 */6161int i2c_transfer_buffer_flags(const struct i2c_client *client,6262 char *buf, int count, u16 flags);
+4-1
include/linux/io-mapping.h
···107107 resource_size_t base,108108 unsigned long size)109109{110110+ iomap->iomem = ioremap_wc(base, size);111111+ if (!iomap->iomem)112112+ return NULL;113113+110114 iomap->base = base;111115 iomap->size = size;112112- iomap->iomem = ioremap_wc(base, size);113116#if defined(pgprot_noncached_wc) /* archs can't agree on a name ... */114117 iomap->prot = pgprot_noncached_wc(PAGE_KERNEL);115118#elif defined(pgprot_writecombine)
+1-1
include/linux/rhashtable.h
···3333 * of two or more hash tables when the rhashtable is being resized.3434 * The end of the chain is marked with a special nulls marks which has3535 * the least significant bit set but otherwise stores the address of3636- * the hash bucket. This allows us to be be sure we've found the end3636+ * the hash bucket. This allows us to be sure we've found the end3737 * of the right list.3838 * The value stored in the hash bucket has BIT(0) used as a lock bit.3939 * This bit must be atomically set before any changes are made to
+4-2
include/linux/tcp.h
···220220 } rack;221221 u16 advmss; /* Advertised MSS */222222 u8 compressed_ack;223223- u8 dup_ack_counter;223223+ u8 dup_ack_counter:2,224224+ tlp_retrans:1, /* TLP is a retransmission */225225+ unused:5;224226 u32 chrono_start; /* Start time in jiffies of a TCP chrono */225227 u32 chrono_stat[3]; /* Time in jiffies for chrono_stat stats */226228 u8 chrono_type:2, /* current chronograph type */···245243 save_syn:1, /* Save headers of SYN packet */246244 is_cwnd_limited:1,/* forward progress limited by snd_cwnd? */247245 syn_smc:1; /* SYN includes SMC */248248- u32 tlp_high_seq; /* snd_nxt at the time of TLP retransmit. */246246+ u32 tlp_high_seq; /* snd_nxt at the time of TLP */249247250248 u32 tcp_tx_delay; /* delay (in usec) added to TX packets */251249 u64 tcp_wstamp_ns; /* departure time for next sent data packet */
···21992199 if (!uprobe) {22002200 if (is_swbp > 0) {22012201 /* No matching uprobe; signal SIGTRAP. */22022202- send_sig(SIGTRAP, current, 0);22022202+ force_sig(SIGTRAP);22032203 } else {22042204 /*22052205 * Either we raced with uprobe_unregister() or we can't
+15-10
kernel/sched/core.c
···41194119 local_irq_disable();41204120 rcu_note_context_switch(preempt);4121412141224122- /* See deactivate_task() below. */41234123- prev_state = prev->state;41244124-41254122 /*41264123 * Make sure that signal_pending_state()->signal_pending() below41274124 * can't be reordered with __set_current_state(TASK_INTERRUPTIBLE)···41424145 update_rq_clock(rq);4143414641444147 switch_count = &prev->nivcsw;41484148+41454149 /*41464146- * We must re-load prev->state in case ttwu_remote() changed it41474147- * before we acquired rq->lock.41504150+ * We must load prev->state once (task_struct::state is volatile), such41514151+ * that:41524152+ *41534153+ * - we form a control dependency vs deactivate_task() below.41544154+ * - ptrace_{,un}freeze_traced() can change ->state underneath us.41484155 */41494149- if (!preempt && prev_state && prev_state == prev->state) {41564156+ prev_state = prev->state;41574157+ if (!preempt && prev_state) {41504158 if (signal_pending_state(prev_state, prev)) {41514159 prev->state = TASK_RUNNING;41524160 } else {···4165416341664164 /*41674165 * __schedule() ttwu()41684168- * prev_state = prev->state; if (READ_ONCE(p->on_rq) && ...)41694169- * LOCK rq->lock goto out;41704170- * smp_mb__after_spinlock(); smp_acquire__after_ctrl_dep();41714171- * p->on_rq = 0; p->state = TASK_WAKING;41664166+ * prev_state = prev->state; if (p->on_rq && ...)41674167+ * if (prev_state) goto out;41684168+ * p->on_rq = 0; smp_acquire__after_ctrl_dep();41694169+ * p->state = TASK_WAKING41704170+ *41714171+ * Where __schedule() and ttwu() have matching control dependencies.41724172 *41734173 * After this, schedule() must not care about p->state any more.41744174 */···44854481int default_wake_function(wait_queue_entry_t *curr, unsigned mode, int wake_flags,44864482 void *key)44874483{44844484+ WARN_ON_ONCE(IS_ENABLED(CONFIG_SCHED_DEBUG) && wake_flags & ~WF_SYNC);44884485 return try_to_wake_up(curr->private, mode, wake_flags);44894486}44904487EXPORT_SYMBOL(default_wake_function);
+10-5
mm/hugetlb.c
···4545unsigned int default_hstate_idx;4646struct hstate hstates[HUGE_MAX_HSTATE];47474848+#ifdef CONFIG_CMA4849static struct cma *hugetlb_cma[MAX_NUMNODES];5050+#endif5151+static unsigned long hugetlb_cma_size __initdata;49525053/*5154 * Minimum page order among possible hugepage sizes, set to a proper value···12381235 * If the page isn't allocated using the cma allocator,12391236 * cma_release() returns false.12401237 */12411241- if (IS_ENABLED(CONFIG_CMA) &&12421242- cma_release(hugetlb_cma[page_to_nid(page)], page, 1 << order))12381238+#ifdef CONFIG_CMA12391239+ if (cma_release(hugetlb_cma[page_to_nid(page)], page, 1 << order))12431240 return;12411241+#endif1244124212451243 free_contig_range(page_to_pfn(page), 1 << order);12461244}···12521248{12531249 unsigned long nr_pages = 1UL << huge_page_order(h);1254125012551255- if (IS_ENABLED(CONFIG_CMA)) {12511251+#ifdef CONFIG_CMA12521252+ {12561253 struct page *page;12571254 int node;12581255···12671262 return page;12681263 }12691264 }12651265+#endif1270126612711267 return alloc_contig_pages(nr_pages, gfp_mask, nid, nodemask);12721268}···2577257125782572 for (i = 0; i < h->max_huge_pages; ++i) {25792573 if (hstate_is_gigantic(h)) {25802580- if (IS_ENABLED(CONFIG_CMA) && hugetlb_cma[0]) {25742574+ if (hugetlb_cma_size) {25812575 pr_warn_once("HugeTLB: hugetlb_cma is enabled, skip boot time allocation\n");25822576 break;25832577 }···56605654}5661565556625656#ifdef CONFIG_CMA56635663-static unsigned long hugetlb_cma_size __initdata;56645657static bool cma_reserve_called __initdata;5665565856665659static int __init cmdline_parse_hugetlb_cma(char *p)
···56695669 if (!mem_cgroup_is_root(mc.to))56705670 page_counter_uncharge(&mc.to->memory, mc.moved_swap);5671567156725672- mem_cgroup_id_get_many(mc.to, mc.moved_swap);56735672 css_put_many(&mc.to->css, mc.moved_swap);5674567356755674 mc.moved_swap = 0;···58595860 ent = target.ent;58605861 if (!mem_cgroup_move_swap_account(ent, mc.from, mc.to)) {58615862 mc.precharge--;58625862- /* we fixup refcnts and charges later. */58635863+ mem_cgroup_id_get_many(mc.to, 1);58645864+ /* we fixup other refcnts and charges later. */58635865 mc.moved_swap++;58645866 }58655867 break;···71867186 { }, /* terminate */71877187};7188718871897189+/*71907190+ * If mem_cgroup_swap_init() is implemented as a subsys_initcall()71917191+ * instead of a core_initcall(), this could mean cgroup_memory_noswap still71927192+ * remains set to false even when memcg is disabled via "cgroup_disable=memory"71937193+ * boot parameter. This may result in premature OOPS inside71947194+ * mem_cgroup_get_nr_swap_pages() function in corner cases.71957195+ */71897196static int __init mem_cgroup_swap_init(void)71907197{71917198 /* No memory control -> no swap control */···7207720072087201 return 0;72097202}72107210-subsys_initcall(mem_cgroup_swap_init);72037203+core_initcall(mem_cgroup_swap_init);7211720472127205#endif /* CONFIG_MEMCG_SWAP */
+1-1
mm/memory.c
···16011601 return insert_pages(vma, addr, pages, num, vma->vm_page_prot);16021602#else16031603 unsigned long idx = 0, pgcount = *num;16041604- int err;16041604+ int err = -EINVAL;1605160516061606 for (; idx < pgcount; ++idx) {16071607 err = vm_insert_page(vma, addr + (PAGE_SIZE * idx), pages[idx]);
+14-2
mm/mmap.c
···26202620 * Create a list of vma's touched by the unmap, removing them from the mm's26212621 * vma list as we go..26222622 */26232623-static void26232623+static bool26242624detach_vmas_to_be_unmapped(struct mm_struct *mm, struct vm_area_struct *vma,26252625 struct vm_area_struct *prev, unsigned long end)26262626{···2645264526462646 /* Kill the cache */26472647 vmacache_invalidate(mm);26482648+26492649+ /*26502650+ * Do not downgrade mmap_lock if we are next to VM_GROWSDOWN or26512651+ * VM_GROWSUP VMA. Such VMAs can change their size under26522652+ * down_read(mmap_lock) and collide with the VMA we are about to unmap.26532653+ */26542654+ if (vma && (vma->vm_flags & VM_GROWSDOWN))26552655+ return false;26562656+ if (prev && (prev->vm_flags & VM_GROWSUP))26572657+ return false;26582658+ return true;26482659}2649266026502661/*···28362825 }2837282628382827 /* Detach vmas from rbtree */28392839- detach_vmas_to_be_unmapped(mm, vma, prev, end);28282828+ if (!detach_vmas_to_be_unmapped(mm, vma, prev, end))28292829+ downgrade = false;2840283028412831 if (downgrade)28422832 mmap_write_downgrade(mm);
···33433343 */33443344 if (err < 0) {33453345 /* If device is not registered at all, free it now */33463346- if (dev->reg_state == NETREG_UNINITIALIZED)33463346+ if (dev->reg_state == NETREG_UNINITIALIZED ||33473347+ dev->reg_state == NETREG_UNREGISTERED)33473348 free_netdev(dev);33483349 goto out;33493350 }
···120120 return skb_clone(frame->skb_std, GFP_ATOMIC);121121}122122123123-static void hsr_fill_tag(struct sk_buff *skb, struct hsr_frame_info *frame,124124- struct hsr_port *port, u8 proto_version)123123+static struct sk_buff *hsr_fill_tag(struct sk_buff *skb,124124+ struct hsr_frame_info *frame,125125+ struct hsr_port *port, u8 proto_version)125126{126127 struct hsr_ethhdr *hsr_ethhdr;127128 int lane_id;128129 int lsdu_size;130130+131131+ /* pad to minimum packet size which is 60 + 6 (HSR tag) */132132+ if (skb_put_padto(skb, ETH_ZLEN + HSR_HLEN))133133+ return NULL;129134130135 if (port->type == HSR_PT_SLAVE_A)131136 lane_id = 0;···149144 hsr_ethhdr->hsr_tag.encap_proto = hsr_ethhdr->ethhdr.h_proto;150145 hsr_ethhdr->ethhdr.h_proto = htons(proto_version ?151146 ETH_P_HSR : ETH_P_PRP);147147+148148+ return skb;152149}153150154151static struct sk_buff *create_tagged_skb(struct sk_buff *skb_o,···179172 memmove(dst, src, movelen);180173 skb_reset_mac_header(skb);181174182182- hsr_fill_tag(skb, frame, port, port->hsr->prot_version);183183-184184- return skb;175175+ /* skb_put_padto free skb on error and hsr_fill_tag returns NULL in176176+ * that case177177+ */178178+ return hsr_fill_tag(skb, frame, port, port->hsr->prot_version);185179}186180187181/* If the original frame was an HSR tagged frame, just clone it to be sent
+2-1
net/hsr/hsr_framereg.c
···325325 if (port->type != node_dst->addr_B_port)326326 return;327327328328- ether_addr_copy(eth_hdr(skb)->h_dest, node_dst->macaddress_B);328328+ if (is_valid_ether_addr(node_dst->macaddress_B))329329+ ether_addr_copy(eth_hdr(skb)->h_dest, node_dst->macaddress_B);329330}330331331332void hsr_register_frame_in(struct hsr_node *node, struct hsr_port *port,
+6-5
net/ipv4/tcp_input.c
···34883488 }34893489}3490349034913491-/* This routine deals with acks during a TLP episode.34923492- * We mark the end of a TLP episode on receiving TLP dupack or when34933493- * ack is after tlp_high_seq.34943494- * Ref: loss detection algorithm in draft-dukkipati-tcpm-tcp-loss-probe.34913491+/* This routine deals with acks during a TLP episode and ends an episode by34923492+ * resetting tlp_high_seq. Ref: TLP algorithm in draft-ietf-tcpm-rack34953493 */34963494static void tcp_process_tlp_ack(struct sock *sk, u32 ack, int flag)34973495{···34983500 if (before(ack, tp->tlp_high_seq))34993501 return;3500350235013501- if (flag & FLAG_DSACKING_ACK) {35033503+ if (!tp->tlp_retrans) {35043504+ /* TLP of new data has been acknowledged */35053505+ tp->tlp_high_seq = 0;35063506+ } else if (flag & FLAG_DSACKING_ACK) {35023507 /* This DSACK means original and TLP probe arrived; no loss */35033508 tp->tlp_high_seq = 0;35043509 } else if (after(ack, tp->tlp_high_seq)) {
+8-5
net/ipv4/tcp_output.c
···26242624 int pcount;26252625 int mss = tcp_current_mss(sk);2626262626272627+ /* At most one outstanding TLP */26282628+ if (tp->tlp_high_seq)26292629+ goto rearm_timer;26302630+26312631+ tp->tlp_retrans = 0;26272632 skb = tcp_send_head(sk);26282633 if (skb && tcp_snd_wnd_test(tp, skb, mss)) {26292634 pcount = tp->packets_out;···26452640 inet_csk(sk)->icsk_pending = 0;26462641 return;26472642 }26482648-26492649- /* At most one outstanding TLP retransmission. */26502650- if (tp->tlp_high_seq)26512651- goto rearm_timer;2652264326532644 if (skb_still_in_host_queue(sk, skb))26542645 goto rearm_timer;···26672666 if (__tcp_retransmit_skb(sk, skb, 1))26682667 goto rearm_timer;2669266826692669+ tp->tlp_retrans = 1;26702670+26712671+probe_sent:26702672 /* Record snd_nxt for loss detection. */26712673 tp->tlp_high_seq = tp->snd_nxt;2672267426732673-probe_sent:26742675 NET_INC_STATS(sock_net(sk), LINUX_MIB_TCPLOSSPROBES);26752676 /* Reset s.t. tcp_rearm_rto will restart timer from now */26762677 inet_csk(sk)->icsk_pending = 0;
+10-7
net/ipv4/udp.c
···416416 struct udp_hslot *hslot2,417417 struct sk_buff *skb)418418{419419- struct sock *sk, *result;419419+ struct sock *sk, *result, *reuseport_result;420420 int score, badness;421421 u32 hash = 0;422422···426426 score = compute_score(sk, net, saddr, sport,427427 daddr, hnum, dif, sdif);428428 if (score > badness) {429429+ reuseport_result = NULL;430430+429431 if (sk->sk_reuseport &&430432 sk->sk_state != TCP_ESTABLISHED) {431433 hash = udp_ehashfn(net, daddr, hnum,432434 saddr, sport);433433- result = reuseport_select_sock(sk, hash, skb,434434- sizeof(struct udphdr));435435- if (result && !reuseport_has_conns(sk, false))436436- return result;435435+ reuseport_result = reuseport_select_sock(sk, hash, skb,436436+ sizeof(struct udphdr));437437+ if (reuseport_result && !reuseport_has_conns(sk, false))438438+ return reuseport_result;437439 }440440+441441+ result = reuseport_result ? : sk;438442 badness = score;439439- result = sk;440443 }441444 }442445 return result;···20542051 /*20552052 * UDP-Lite specific tests, ignored on UDP sockets20562053 */20572057- if ((is_udplite & UDPLITE_RECV_CC) && UDP_SKB_CB(skb)->partial_cov) {20542054+ if ((up->pcflag & UDPLITE_RECV_CC) && UDP_SKB_CB(skb)->partial_cov) {2058205520592056 /*20602057 * MIB statistics other than incrementing the error count are
+6-5
net/ipv6/ip6_gre.c
···15621562static int __net_init ip6gre_init_net(struct net *net)15631563{15641564 struct ip6gre_net *ign = net_generic(net, ip6gre_net_id);15651565+ struct net_device *ndev;15651566 int err;1566156715671568 if (!net_has_fallback_tunnels(net))15681569 return 0;15691569- ign->fb_tunnel_dev = alloc_netdev(sizeof(struct ip6_tnl), "ip6gre0",15701570- NET_NAME_UNKNOWN,15711571- ip6gre_tunnel_setup);15721572- if (!ign->fb_tunnel_dev) {15701570+ ndev = alloc_netdev(sizeof(struct ip6_tnl), "ip6gre0",15711571+ NET_NAME_UNKNOWN, ip6gre_tunnel_setup);15721572+ if (!ndev) {15731573 err = -ENOMEM;15741574 goto err_alloc_dev;15751575 }15761576+ ign->fb_tunnel_dev = ndev;15761577 dev_net_set(ign->fb_tunnel_dev, net);15771578 /* FB netdevice is special: we have one, and only one per netns.15781579 * Allowing to move it to another netns is clearly unsafe.···15931592 return 0;1594159315951594err_reg_dev:15961596- free_netdev(ign->fb_tunnel_dev);15951595+ free_netdev(ndev);15971596err_alloc_dev:15981597 return err;15991598}
+10-7
net/ipv6/udp.c
···148148 int dif, int sdif, struct udp_hslot *hslot2,149149 struct sk_buff *skb)150150{151151- struct sock *sk, *result;151151+ struct sock *sk, *result, *reuseport_result;152152 int score, badness;153153 u32 hash = 0;154154···158158 score = compute_score(sk, net, saddr, sport,159159 daddr, hnum, dif, sdif);160160 if (score > badness) {161161+ reuseport_result = NULL;162162+161163 if (sk->sk_reuseport &&162164 sk->sk_state != TCP_ESTABLISHED) {163165 hash = udp6_ehashfn(net, daddr, hnum,164166 saddr, sport);165167166166- result = reuseport_select_sock(sk, hash, skb,167167- sizeof(struct udphdr));168168- if (result && !reuseport_has_conns(sk, false))169169- return result;168168+ reuseport_result = reuseport_select_sock(sk, hash, skb,169169+ sizeof(struct udphdr));170170+ if (reuseport_result && !reuseport_has_conns(sk, false))171171+ return reuseport_result;170172 }171171- result = sk;173173+174174+ result = reuseport_result ? : sk;172175 badness = score;173176 }174177 }···646643 /*647644 * UDP-Lite specific tests, ignored on UDP sockets (see net/ipv4/udp.c).648645 */649649- if ((is_udplite & UDPLITE_RECV_CC) && UDP_SKB_CB(skb)->partial_cov) {646646+ if ((up->pcflag & UDPLITE_RECV_CC) && UDP_SKB_CB(skb)->partial_cov) {650647651648 if (up->pcrlen == 0) { /* full coverage was set */652649 net_dbg_ratelimited("UDPLITE6: partial coverage %d while full coverage %d requested\n",
+8-4
net/netfilter/ipvs/ip_vs_sync.c
···17171717{17181718 struct ip_vs_sync_thread_data *tinfo = data;17191719 struct netns_ipvs *ipvs = tinfo->ipvs;17201720+ struct sock *sk = tinfo->sock->sk;17211721+ struct udp_sock *up = udp_sk(sk);17201722 int len;1721172317221724 pr_info("sync thread started: state = BACKUP, mcast_ifn = %s, "···17261724 ipvs->bcfg.mcast_ifn, ipvs->bcfg.syncid, tinfo->id);1727172517281726 while (!kthread_should_stop()) {17291729- wait_event_interruptible(*sk_sleep(tinfo->sock->sk),17301730- !skb_queue_empty(&tinfo->sock->sk->sk_receive_queue)17311731- || kthread_should_stop());17271727+ wait_event_interruptible(*sk_sleep(sk),17281728+ !skb_queue_empty_lockless(&sk->sk_receive_queue) ||17291729+ !skb_queue_empty_lockless(&up->reader_queue) ||17301730+ kthread_should_stop());1732173117331732 /* do we have data now? */17341734- while (!skb_queue_empty(&(tinfo->sock->sk->sk_receive_queue))) {17331733+ while (!skb_queue_empty_lockless(&sk->sk_receive_queue) ||17341734+ !skb_queue_empty_lockless(&up->reader_queue)) {17351735 len = ip_vs_receive(tinfo->sock, tinfo->buf,17361736 ipvs->bcfg.sync_maxlen);17371737 if (len <= 0) {
+14-27
net/netfilter/nf_tables_api.c
···188188 nf_unregister_net_hook(net, &hook->ops);189189}190190191191-static int nft_register_basechain_hooks(struct net *net, int family,192192- struct nft_base_chain *basechain)193193-{194194- if (family == NFPROTO_NETDEV)195195- return nft_netdev_register_hooks(net, &basechain->hook_list);196196-197197- return nf_register_net_hook(net, &basechain->ops);198198-}199199-200200-static void nft_unregister_basechain_hooks(struct net *net, int family,201201- struct nft_base_chain *basechain)202202-{203203- if (family == NFPROTO_NETDEV)204204- nft_netdev_unregister_hooks(net, &basechain->hook_list);205205- else206206- nf_unregister_net_hook(net, &basechain->ops);207207-}208208-209191static int nf_tables_register_hook(struct net *net,210192 const struct nft_table *table,211193 struct nft_chain *chain)···205223 if (basechain->type->ops_register)206224 return basechain->type->ops_register(net, ops);207225208208- return nft_register_basechain_hooks(net, table->family, basechain);226226+ if (table->family == NFPROTO_NETDEV)227227+ return nft_netdev_register_hooks(net, &basechain->hook_list);228228+229229+ return nf_register_net_hook(net, &basechain->ops);209230}210231211232static void nf_tables_unregister_hook(struct net *net,···227242 if (basechain->type->ops_unregister)228243 return basechain->type->ops_unregister(net, ops);229244230230- nft_unregister_basechain_hooks(net, table->family, basechain);245245+ if (table->family == NFPROTO_NETDEV)246246+ nft_netdev_unregister_hooks(net, &basechain->hook_list);247247+ else248248+ nf_unregister_net_hook(net, &basechain->ops);231249}232250233251static int nft_trans_table_add(struct nft_ctx *ctx, int msg_type)···820832 if (cnt && i++ == cnt)821833 break;822834823823- nft_unregister_basechain_hooks(net, table->family,824824- nft_base_chain(chain));835835+ nf_tables_unregister_hook(net, table, chain);825836 }826837}827838···835848 if (!nft_is_base_chain(chain))836849 continue;837850838838- err = nft_register_basechain_hooks(net, table->family,839839- nft_base_chain(chain));851851+ err = nf_tables_register_hook(net, table, chain);840852 if (err < 0)841853 goto err_register_hooks;842854···880894 nft_trans_table_enable(trans) = false;881895 } else if (!(flags & NFT_TABLE_F_DORMANT) &&882896 ctx->table->flags & NFT_TABLE_F_DORMANT) {897897+ ctx->table->flags &= ~NFT_TABLE_F_DORMANT;883898 ret = nf_tables_table_enable(ctx->net, ctx->table);884884- if (ret >= 0) {885885- ctx->table->flags &= ~NFT_TABLE_F_DORMANT;899899+ if (ret >= 0)886900 nft_trans_table_enable(trans) = true;887887- }901901+ else902902+ ctx->table->flags |= NFT_TABLE_F_DORMANT;888903 }889904 if (ret < 0)890905 goto err;
···304304 /* this should be in poll */305305 sk_clear_bit(SOCKWQ_ASYNC_NOSPACE, sk);306306307307- if (sk->sk_err || (sk->sk_shutdown & SEND_SHUTDOWN))307307+ if (sk->sk_shutdown & SEND_SHUTDOWN)308308 return -EPIPE;309309310310 more = msg->msg_flags & MSG_MORE;
···2222#include <net/sctp/sm.h>2323#include <net/sctp/stream_sched.h>24242525-/* Migrates chunks from stream queues to new stream queues if needed,2626- * but not across associations. Also, removes those chunks to streams2727- * higher than the new max.2828- */2929-static void sctp_stream_outq_migrate(struct sctp_stream *stream,3030- struct sctp_stream *new, __u16 outcnt)2525+static void sctp_stream_shrink_out(struct sctp_stream *stream, __u16 outcnt)3126{3227 struct sctp_association *asoc;3328 struct sctp_chunk *ch, *temp;3429 struct sctp_outq *outq;3535- int i;36303731 asoc = container_of(stream, struct sctp_association, stream);3832 outq = &asoc->outqueue;···50565157 sctp_chunk_free(ch);5258 }5959+}6060+6161+/* Migrates chunks from stream queues to new stream queues if needed,6262+ * but not across associations. Also, removes those chunks to streams6363+ * higher than the new max.6464+ */6565+static void sctp_stream_outq_migrate(struct sctp_stream *stream,6666+ struct sctp_stream *new, __u16 outcnt)6767+{6868+ int i;6969+7070+ if (stream->outcnt > outcnt)7171+ sctp_stream_shrink_out(stream, outcnt);53725473 if (new) {5574 /* Here we actually move the old ext stuff into the new···10441037 nums = ntohs(addstrm->number_of_streams);10451038 number = stream->outcnt - nums;1046103910471047- if (result == SCTP_STRRESET_PERFORMED)10401040+ if (result == SCTP_STRRESET_PERFORMED) {10481041 for (i = number; i < stream->outcnt; i++)10491042 SCTP_SO(stream, i)->state = SCTP_STREAM_OPEN;10501050- else10431043+ } else {10441044+ sctp_stream_shrink_out(stream, number);10511045 stream->outcnt = number;10461046+ }1052104710531048 *evp = sctp_ulpevent_make_stream_change_event(asoc, flags,10541049 0, nums, GFP_ATOMIC);
+8-4
net/smc/af_smc.c
···126126127127static void smc_restore_fallback_changes(struct smc_sock *smc)128128{129129- smc->clcsock->file->private_data = smc->sk.sk_socket;130130- smc->clcsock->file = NULL;129129+ if (smc->clcsock->file) { /* non-accepted sockets have no file yet */130130+ smc->clcsock->file->private_data = smc->sk.sk_socket;131131+ smc->clcsock->file = NULL;132132+ }131133}132134133135static int __smc_release(struct smc_sock *smc)···354352 */355353 mutex_lock(&lgr->llc_conf_mutex);356354 for (i = 0; i < SMC_LINKS_PER_LGR_MAX; i++) {357357- if (lgr->lnk[i].state != SMC_LNK_ACTIVE)355355+ if (!smc_link_active(&lgr->lnk[i]))358356 continue;359357 rc = smcr_link_reg_rmb(&lgr->lnk[i], rmb_desc);360358 if (rc)···634632 for (i = 0; i < SMC_LINKS_PER_LGR_MAX; i++) {635633 struct smc_link *l = &smc->conn.lgr->lnk[i];636634637637- if (l->peer_qpn == ntoh24(aclc->qpn)) {635635+ if (l->peer_qpn == ntoh24(aclc->qpn) &&636636+ !memcmp(l->peer_gid, &aclc->lcl.gid, SMC_GID_SIZE) &&637637+ !memcmp(l->peer_mac, &aclc->lcl.mac, sizeof(l->peer_mac))) {638638 link = l;639639 break;640640 }
···5252 DECLARE_BITMAP(ports_going_away, SMC_MAX_PORTS);5353 atomic_t lnk_cnt; /* number of links on ibdev */5454 wait_queue_head_t lnks_deleted; /* wait 4 removal of all links*/5555+ struct mutex mutex; /* protect dev setup+cleanup */5556};56575758struct smc_buf_desc;
+85-42
net/smc/smc_llc.c
···428428 rtok_ix = 1;429429 for (i = 0; i < SMC_LINKS_PER_LGR_MAX; i++) {430430 link = &send_link->lgr->lnk[i];431431- if (link->state == SMC_LNK_ACTIVE && link != send_link) {431431+ if (smc_link_active(link) && link != send_link) {432432 rkeyllc->rtoken[rtok_ix].link_id = link->link_id;433433 rkeyllc->rtoken[rtok_ix].rmb_key =434434 htonl(rmb_desc->mr_rx[link->link_idx]->rkey);···895895 return rc;896896}897897898898+/* as an SMC client, invite server to start the add_link processing */899899+static void smc_llc_cli_add_link_invite(struct smc_link *link,900900+ struct smc_llc_qentry *qentry)901901+{902902+ struct smc_link_group *lgr = smc_get_lgr(link);903903+ struct smc_init_info ini;904904+905905+ if (lgr->type == SMC_LGR_SYMMETRIC ||906906+ lgr->type == SMC_LGR_ASYMMETRIC_PEER)907907+ goto out;908908+909909+ ini.vlan_id = lgr->vlan_id;910910+ smc_pnet_find_alt_roce(lgr, &ini, link->smcibdev);911911+ if (!ini.ib_dev)912912+ goto out;913913+914914+ smc_llc_send_add_link(link, ini.ib_dev->mac[ini.ib_port - 1],915915+ ini.ib_gid, NULL, SMC_LLC_REQ);916916+out:917917+ kfree(qentry);918918+}919919+920920+static bool smc_llc_is_local_add_link(union smc_llc_msg *llc)921921+{922922+ if (llc->raw.hdr.common.type == SMC_LLC_ADD_LINK &&923923+ !llc->add_link.qp_mtu && !llc->add_link.link_num)924924+ return true;925925+ return false;926926+}927927+898928static void smc_llc_process_cli_add_link(struct smc_link_group *lgr)899929{900930 struct smc_llc_qentry *qentry;···932902 qentry = smc_llc_flow_qentry_clr(&lgr->llc_flow_lcl);933903934904 mutex_lock(&lgr->llc_conf_mutex);935935- smc_llc_cli_add_link(qentry->link, qentry);905905+ if (smc_llc_is_local_add_link(&qentry->msg))906906+ smc_llc_cli_add_link_invite(qentry->link, qentry);907907+ else908908+ smc_llc_cli_add_link(qentry->link, qentry);936909 mutex_unlock(&lgr->llc_conf_mutex);937910}938911···944911 int i, link_count = 0;945912946913 for (i = 0; i < SMC_LINKS_PER_LGR_MAX; i++) {947947- if (!smc_link_usable(&lgr->lnk[i]))914914+ if (!smc_link_active(&lgr->lnk[i]))948915 continue;949916 link_count++;950917 }···10841051 if (rc)10851052 return -ENOLINK;10861053 /* receive CONFIRM LINK response over the RoCE fabric */10871087- qentry = smc_llc_wait(lgr, link, SMC_LLC_WAIT_FIRST_TIME,10881088- SMC_LLC_CONFIRM_LINK);10891089- if (!qentry) {10541054+ qentry = smc_llc_wait(lgr, link, SMC_LLC_WAIT_FIRST_TIME, 0);10551055+ if (!qentry ||10561056+ qentry->msg.raw.hdr.common.type != SMC_LLC_CONFIRM_LINK) {10901057 /* send DELETE LINK */10911058 smc_llc_send_delete_link(link, link_new->link_id, SMC_LLC_REQ,10921059 false, SMC_LLC_DEL_LOST_PATH);10601060+ if (qentry)10611061+ smc_llc_flow_qentry_del(&lgr->llc_flow_lcl);10931062 return -ENOLINK;10941063 }10951064 smc_llc_save_peer_uid(qentry);···11931158 mutex_unlock(&lgr->llc_conf_mutex);11941159}1195116011961196-/* enqueue a local add_link req to trigger a new add_link flow, only as SERV */11971197-void smc_llc_srv_add_link_local(struct smc_link *link)11611161+/* enqueue a local add_link req to trigger a new add_link flow */11621162+void smc_llc_add_link_local(struct smc_link *link)11981163{11991164 struct smc_llc_msg_add_link add_llc = {0};1200116512011166 add_llc.hd.length = sizeof(add_llc);12021167 add_llc.hd.common.type = SMC_LLC_ADD_LINK;12031203- /* no dev and port needed, we as server ignore client data anyway */11681168+ /* no dev and port needed */12041169 smc_llc_enqueue(link, (union smc_llc_msg *)&add_llc);12051170}12061171···1380134513811346 if (lgr->type == SMC_LGR_SINGLE && !list_empty(&lgr->list)) {13821347 /* trigger setup of asymm alt link */13831383- smc_llc_srv_add_link_local(lnk);13481348+ smc_llc_add_link_local(lnk);13841349 }13851350out:13861351 mutex_unlock(&lgr->llc_conf_mutex);···15091474 if (list_empty(&lgr->list))15101475 goto out; /* lgr is terminating */15111476 if (lgr->role == SMC_CLNT) {15121512- if (lgr->llc_flow_lcl.type == SMC_LLC_FLOW_ADD_LINK) {14771477+ if (smc_llc_is_local_add_link(llc)) {14781478+ if (lgr->llc_flow_lcl.type ==14791479+ SMC_LLC_FLOW_ADD_LINK)14801480+ break; /* add_link in progress */14811481+ if (smc_llc_flow_start(&lgr->llc_flow_lcl,14821482+ qentry)) {14831483+ schedule_work(&lgr->llc_add_link_work);14841484+ }14851485+ return;14861486+ }14871487+ if (lgr->llc_flow_lcl.type == SMC_LLC_FLOW_ADD_LINK &&14881488+ !lgr->llc_flow_lcl.qentry) {15131489 /* a flow is waiting for this message */15141490 smc_llc_flow_qentry_set(&lgr->llc_flow_lcl,15151491 qentry);···15441498 }15451499 break;15461500 case SMC_LLC_DELETE_LINK:15471547- if (lgr->role == SMC_CLNT) {15481548- /* server requests to delete this link, send response */15491549- if (lgr->llc_flow_lcl.type != SMC_LLC_FLOW_NONE) {15501550- /* DEL LINK REQ during ADD LINK SEQ */15511551- smc_llc_flow_qentry_set(&lgr->llc_flow_lcl,15521552- qentry);15531553- wake_up(&lgr->llc_msg_waiter);15541554- } else if (smc_llc_flow_start(&lgr->llc_flow_lcl,15551555- qentry)) {15561556- schedule_work(&lgr->llc_del_link_work);15571557- }15581558- } else {15591559- if (lgr->llc_flow_lcl.type == SMC_LLC_FLOW_ADD_LINK &&15601560- !lgr->llc_flow_lcl.qentry) {15611561- /* DEL LINK REQ during ADD LINK SEQ */15621562- smc_llc_flow_qentry_set(&lgr->llc_flow_lcl,15631563- qentry);15641564- wake_up(&lgr->llc_msg_waiter);15651565- } else if (smc_llc_flow_start(&lgr->llc_flow_lcl,15661566- qentry)) {15671567- schedule_work(&lgr->llc_del_link_work);15681568- }15011501+ if (lgr->llc_flow_lcl.type == SMC_LLC_FLOW_ADD_LINK &&15021502+ !lgr->llc_flow_lcl.qentry) {15031503+ /* DEL LINK REQ during ADD LINK SEQ */15041504+ smc_llc_flow_qentry_set(&lgr->llc_flow_lcl, qentry);15051505+ wake_up(&lgr->llc_msg_waiter);15061506+ } else if (smc_llc_flow_start(&lgr->llc_flow_lcl, qentry)) {15071507+ schedule_work(&lgr->llc_del_link_work);15691508 }15701509 return;15711510 case SMC_LLC_CONFIRM_RKEY:···16161585static void smc_llc_rx_response(struct smc_link *link,16171586 struct smc_llc_qentry *qentry)16181587{15881588+ enum smc_llc_flowtype flowtype = link->lgr->llc_flow_lcl.type;15891589+ struct smc_llc_flow *flow = &link->lgr->llc_flow_lcl;16191590 u8 llc_type = qentry->msg.raw.hdr.common.type;1620159116211592 switch (llc_type) {16221593 case SMC_LLC_TEST_LINK:16231623- if (link->state == SMC_LNK_ACTIVE)15941594+ if (smc_link_active(link))16241595 complete(&link->llc_testlink_resp);16251596 break;16261597 case SMC_LLC_ADD_LINK:16271627- case SMC_LLC_DELETE_LINK:16281628- case SMC_LLC_CONFIRM_LINK:16291598 case SMC_LLC_ADD_LINK_CONT:15991599+ case SMC_LLC_CONFIRM_LINK:16001600+ if (flowtype != SMC_LLC_FLOW_ADD_LINK || flow->qentry)16011601+ break; /* drop out-of-flow response */16021602+ goto assign;16031603+ case SMC_LLC_DELETE_LINK:16041604+ if (flowtype != SMC_LLC_FLOW_DEL_LINK || flow->qentry)16051605+ break; /* drop out-of-flow response */16061606+ goto assign;16301607 case SMC_LLC_CONFIRM_RKEY:16311608 case SMC_LLC_DELETE_RKEY:16321632- /* assign responses to the local flow, we requested them */16331633- smc_llc_flow_qentry_set(&link->lgr->llc_flow_lcl, qentry);16341634- wake_up(&link->lgr->llc_msg_waiter);16351635- return;16091609+ if (flowtype != SMC_LLC_FLOW_RKEY || flow->qentry)16101610+ break; /* drop out-of-flow response */16111611+ goto assign;16361612 case SMC_LLC_CONFIRM_RKEY_CONT:16371613 /* not used because max links is 3 */16381614 break;···16481610 break;16491611 }16501612 kfree(qentry);16131613+ return;16141614+assign:16151615+ /* assign responses to the local flow, we requested them */16161616+ smc_llc_flow_qentry_set(&link->lgr->llc_flow_lcl, qentry);16171617+ wake_up(&link->lgr->llc_msg_waiter);16511618}1652161916531620static void smc_llc_enqueue(struct smc_link *link, union smc_llc_msg *llc)···17061663 u8 user_data[16] = { 0 };17071664 int rc;1708166517091709- if (link->state != SMC_LNK_ACTIVE)16661666+ if (!smc_link_active(link))17101667 return; /* don't reschedule worker */17111668 expire_time = link->wr_rx_tstamp + link->llc_testlink_time;17121669 if (time_is_after_jiffies(expire_time)) {···17181675 /* receive TEST LINK response over RoCE fabric */17191676 rc = wait_for_completion_interruptible_timeout(&link->llc_testlink_resp,17201677 SMC_LLC_WAIT_TIME);17211721- if (link->state != SMC_LNK_ACTIVE)16781678+ if (!smc_link_active(link))17221679 return; /* link state changed */17231680 if (rc <= 0) {17241681 smcr_link_down_cond_sched(link);
···8787 return8888 fi89899090- # Strip out the base of the path9191- code=${code#$basepath/}9090+ # Strip out the base of the path on each line9191+ code=$(while read -r line; do echo "${line#$basepath/}"; done <<< "$code")92929393 # In the case of inlines, move everything to same line9494 code=${code//$'\n'/' '}
+1-1
scripts/gdb/linux/symbols.py
···9696 return ""9797 attrs = sect_attrs['attrs']9898 section_name_to_address = {9999- attrs[n]['name'].string(): attrs[n]['address']9999+ attrs[n]['battr']['attr']['name'].string(): attrs[n]['address']100100 for n in range(int(sect_attrs['nsections']))}101101 args = []102102 for section_name in [".data", ".data..read_mostly", ".rodata", ".bss",
+10-2
scripts/mod/modpost.c
···138138139139char *get_line(char **stringp)140140{141141+ char *orig = *stringp, *next;142142+141143 /* do not return the unwanted extra line at EOF */142142- if (*stringp && **stringp == '\0')144144+ if (!orig || *orig == '\0')143145 return NULL;144146145145- return strsep(stringp, "\n");147147+ next = strchr(orig, '\n');148148+ if (next)149149+ *next++ = '\0';150150+151151+ *stringp = next;152152+153153+ return orig;146154}147155148156/* A list of all modules we processed */
+3-1
sound/core/info.c
···606606{607607 int c;608608609609- if (snd_BUG_ON(!buffer || !buffer->buffer))609609+ if (snd_BUG_ON(!buffer))610610+ return 1;611611+ if (!buffer->buffer)610612 return 1;611613 if (len <= 0 || buffer->stop || buffer->error)612614 return 1;
···543543544544 if (cnt) {545545 ret = device_add_properties(codec_dev, props);546546- if (ret)546546+ if (ret) {547547+ put_device(codec_dev);547548 return ret;549549+ }548550 }549551550552 devm_acpi_dev_add_driver_gpios(codec_dev, byt_cht_es8316_gpios);
+11-12
sound/soc/intel/boards/cht_bsw_rt5672.c
···253253 params_set_format(params, SNDRV_PCM_FORMAT_S24_LE);254254255255 /*256256- * Default mode for SSP configuration is TDM 4 slot256256+ * Default mode for SSP configuration is TDM 4 slot. One board/design,257257+ * the Lenovo Miix 2 10 uses not 1 but 2 codecs connected to SSP2. The258258+ * second piggy-backed, output-only codec is inside the keyboard-dock259259+ * (which has extra speakers). Unlike the main rt5672 codec, we cannot260260+ * configure this codec, it is hard coded to use 2 channel 24 bit I2S.261261+ * Since we only support 2 channels anyways, there is no need for TDM262262+ * on any cht-bsw-rt5672 designs. So we simply use I2S 2ch everywhere.257263 */258258- ret = snd_soc_dai_set_fmt(asoc_rtd_to_codec(rtd, 0),259259- SND_SOC_DAIFMT_DSP_B |260260- SND_SOC_DAIFMT_IB_NF |264264+ ret = snd_soc_dai_set_fmt(asoc_rtd_to_cpu(rtd, 0),265265+ SND_SOC_DAIFMT_I2S |266266+ SND_SOC_DAIFMT_NB_NF |261267 SND_SOC_DAIFMT_CBS_CFS);262268 if (ret < 0) {263263- dev_err(rtd->dev, "can't set format to TDM %d\n", ret);264264- return ret;265265- }266266-267267- /* TDM 4 slots 24 bit, set Rx & Tx bitmask to 4 active slots */268268- ret = snd_soc_dai_set_tdm_slot(asoc_rtd_to_codec(rtd, 0), 0xF, 0xF, 4, 24);269269- if (ret < 0) {270270- dev_err(rtd->dev, "can't set codec TDM slot %d\n", ret);269269+ dev_err(rtd->dev, "can't set format to I2S, err %d\n", ret);271270 return ret;272271 }273272
+1-1
sound/soc/qcom/Kconfig
···72727373config SND_SOC_QDSP67474 tristate "SoC ALSA audio driver for QDSP6"7575- depends on QCOM_APR && HAS_DMA7575+ depends on QCOM_APR7676 select SND_SOC_QDSP6_COMMON7777 select SND_SOC_QDSP6_CORE7878 select SND_SOC_QDSP6_AFE
···25732573EXPORT_SYMBOL_GPL(snd_soc_register_component);2574257425752575/**25762576+ * snd_soc_unregister_component_by_driver - Unregister component using a given driver25772577+ * from the ASoC core25782578+ *25792579+ * @dev: The device to unregister25802580+ * @component_driver: The component driver to unregister25812581+ */25822582+void snd_soc_unregister_component_by_driver(struct device *dev,25832583+ const struct snd_soc_component_driver *component_driver)25842584+{25852585+ struct snd_soc_component *component;25862586+25872587+ if (!component_driver)25882588+ return;25892589+25902590+ mutex_lock(&client_mutex);25912591+ component = snd_soc_lookup_component_nolocked(dev, component_driver->name);25922592+ if (!component)25932593+ goto out;25942594+25952595+ snd_soc_del_component_unlocked(component);25962596+25972597+out:25982598+ mutex_unlock(&client_mutex);25992599+}26002600+EXPORT_SYMBOL_GPL(snd_soc_unregister_component_by_driver);26012601+26022602+/**25762603 * snd_soc_unregister_component - Unregister all related component25772604 * from the ASoC core25782605 *
+38
sound/soc/soc-dai.c
···391391 return stream->channels_min;392392}393393394394+/*395395+ * snd_soc_dai_link_set_capabilities() - set dai_link properties based on its DAIs396396+ */397397+void snd_soc_dai_link_set_capabilities(struct snd_soc_dai_link *dai_link)398398+{399399+ struct snd_soc_dai_link_component *cpu;400400+ struct snd_soc_dai_link_component *codec;401401+ struct snd_soc_dai *dai;402402+ bool supported[SNDRV_PCM_STREAM_LAST + 1];403403+ int direction;404404+ int i;405405+406406+ for_each_pcm_streams(direction) {407407+ supported[direction] = true;408408+409409+ for_each_link_cpus(dai_link, i, cpu) {410410+ dai = snd_soc_find_dai(cpu);411411+ if (!dai || !snd_soc_dai_stream_valid(dai, direction)) {412412+ supported[direction] = false;413413+ break;414414+ }415415+ }416416+ if (!supported[direction])417417+ continue;418418+ for_each_link_codecs(dai_link, i, codec) {419419+ dai = snd_soc_find_dai(codec);420420+ if (!dai || !snd_soc_dai_stream_valid(dai, direction)) {421421+ supported[direction] = false;422422+ break;423423+ }424424+ }425425+ }426426+427427+ dai_link->dpcm_playback = supported[SNDRV_PCM_STREAM_PLAYBACK];428428+ dai_link->dpcm_capture = supported[SNDRV_PCM_STREAM_CAPTURE];429429+}430430+EXPORT_SYMBOL_GPL(snd_soc_dai_link_set_capabilities);431431+394432void snd_soc_dai_action(struct snd_soc_dai *dai,395433 int stream, int action)396434{
···12611261 list_add(&routes[i]->dobj.list, &tplg->comp->dobj_list);1262126212631263 ret = soc_tplg_add_route(tplg, routes[i]);12641264- if (ret < 0)12641264+ if (ret < 0) {12651265+ /*12661266+ * this route was added to the list, it will12671267+ * be freed in remove_route() so increment the12681268+ * counter to skip it in the error handling12691269+ * below.12701270+ */12711271+ i++;12651272 break;12731273+ }1266127412671275 /* add route, but keep going if some fail */12681276 snd_soc_dapm_add_routes(dapm, routes[i], 1);12691277 }1270127812711271- /* free memory allocated for all dapm routes in case of error */12721272- if (ret < 0)12731273- for (i = 0; i < count ; i++)12741274- kfree(routes[i]);12791279+ /*12801280+ * free memory allocated for all dapm routes not added to the12811281+ * list in case of error12821282+ */12831283+ if (ret < 0) {12841284+ while (i < count)12851285+ kfree(routes[i++]);12861286+ }1275128712761288 /*12771289 * free pointer to array of dapm routes as this is no longer needed.···13711359 if (err < 0) {13721360 dev_err(tplg->dev, "ASoC: failed to init %s\n",13731361 mc->hdr.name);13741374- soc_tplg_free_tlv(tplg, &kc[i]);13751362 goto err_sm;13761363 }13771364 }···1378136713791368err_sm:13801369 for (; i >= 0; i--) {13701370+ soc_tplg_free_tlv(tplg, &kc[i]);13811371 sm = (struct soc_mixer_control *)kc[i].private_value;13821372 kfree(sm);13831373 kfree(kc[i].name);
+5-5
sound/soc/sof/core.c
···345345 struct snd_sof_pdata *pdata = sdev->pdata;346346 int ret;347347348348- ret = snd_sof_dsp_power_down_notify(sdev);349349- if (ret < 0)350350- dev_warn(dev, "error: %d failed to prepare DSP for device removal",351351- ret);352352-353348 if (IS_ENABLED(CONFIG_SND_SOC_SOF_PROBE_WORK_QUEUE))354349 cancel_work_sync(&sdev->probe_work);355350356351 if (sdev->fw_state > SOF_FW_BOOT_NOT_STARTED) {352352+ ret = snd_sof_dsp_power_down_notify(sdev);353353+ if (ret < 0)354354+ dev_warn(dev, "error: %d failed to prepare DSP for device removal",355355+ ret);356356+357357 snd_sof_fw_unload(sdev);358358 snd_sof_ipc_free(sdev);359359 snd_sof_free_debug(sdev);
···380380 {381381 "Unit": "CPU-M-CF",382382 "EventCode": "265",383383- "EventName": "DFLT_CCERROR",383383+ "EventName": "DFLT_CCFINISH",384384 "BriefDescription": "Increments by one for every DEFLATE CONVERSION CALL instruction executed that ended in Condition Codes 0, 1 or 2",385385 "PublicDescription": "Increments by one for every DEFLATE CONVERSION CALL instruction executed that ended in Condition Codes 0, 1 or 2"386386 },