···336336- ``--list_tests_attr``: If set, lists all tests that will be run and all of their337337 attributes.338338339339+- ``--list_suites``: If set, lists all suites that will be run.340340+339341Command-line completion340342==============================341343
···168168 offset from voltage set to regulator.169169170170 regulator-uv-protection-microvolt:171171- description: Set over under voltage protection limit. This is a limit where171171+ description: Set under voltage protection limit. This is a limit where172172 hardware performs emergency shutdown. Zero can be passed to disable173173 protection and value '1' indicates that protection should be enabled but174174 limit setting can be omitted. Limit is given as microvolt offset from···182182 is given as microvolt offset from voltage set to regulator.183183184184 regulator-uv-warn-microvolt:185185- description: Set over under voltage warning limit. This is a limit where185185+ description: Set under voltage warning limit. This is a limit where186186 hardware is assumed still to be functional but approaching limit where187187 it gets damaged. Recovery actions should be initiated. Zero can be passed188188 to disable detection and value '1' indicates that detection should
+48
Documentation/driver-api/driver-model/binding.rst
···9999When a driver is removed, the list of devices that it supports is100100iterated over, and the driver's remove callback is called for each101101one. The device is removed from that list and the symlinks removed.102102+103103+104104+Driver Override105105+~~~~~~~~~~~~~~~106106+107107+Userspace may override the standard matching by writing a driver name to108108+a device's ``driver_override`` sysfs attribute. When set, only a driver109109+whose name matches the override will be considered during binding. This110110+bypasses all bus-specific matching (OF, ACPI, ID tables, etc.).111111+112112+The override may be cleared by writing an empty string, which returns113113+the device to standard matching rules. Writing to ``driver_override``114114+does not automatically unbind the device from its current driver or115115+make any attempt to load the specified driver.116116+117117+Buses opt into this mechanism by setting the ``driver_override`` flag in118118+their ``struct bus_type``::119119+120120+ const struct bus_type example_bus_type = {121121+ ...122122+ .driver_override = true,123123+ };124124+125125+When the flag is set, the driver core automatically creates the126126+``driver_override`` sysfs attribute for every device on that bus.127127+128128+The bus's ``match()`` callback should check the override before performing129129+its own matching, using ``device_match_driver_override()``::130130+131131+ static int example_match(struct device *dev, const struct device_driver *drv)132132+ {133133+ int ret;134134+135135+ ret = device_match_driver_override(dev, drv);136136+ if (ret >= 0)137137+ return ret;138138+139139+ /* Fall through to bus-specific matching... */140140+ }141141+142142+``device_match_driver_override()`` returns > 0 if the override matches143143+the given driver, 0 if the override is set but does not match, or < 0 if144144+no override is set at all.145145+146146+Additional helpers are available:147147+148148+- ``device_set_driver_override()`` - set or clear the override from kernel code.149149+- ``device_has_driver_override()`` - check whether an override is set.
···2626 struct platform_device *pdev = to_platform_device(dev);2727 struct platform_driver *pdrv = to_platform_driver(drv);28282929- /* When driver_override is set, only bind to the matching driver */3030- if (pdev->driver_override)3131- return !strcmp(pdev->driver_override, drv->name);3232-3329 /* Then try to match against the id table */3430 if (pdrv->id_table)3531 return platform_match_id(pdrv->id_table, pdev) != NULL;
···13721372 else if (i < n_running)13731373 continue;1374137413751375- if (hwc->state & PERF_HES_ARCH)13751375+ cpuc->events[hwc->idx] = event;13761376+13771377+ if (hwc->state & PERF_HES_ARCH) {13781378+ static_call(x86_pmu_set_period)(event);13761379 continue;13801380+ }1377138113781382 /*13791383 * if cpuc->enabled = 0, then no wrmsr as13801384 * per x86_pmu_enable_event()13811385 */13821382- cpuc->events[hwc->idx] = event;13831386 x86_pmu_start(event, PERF_EF_RELOAD);13841387 }13851388 cpuc->n_added = 0;
+21-10
arch/x86/events/intel/core.c
···46284628 event->hw.dyn_constraint &= hybrid(event->pmu, acr_cause_mask64);46294629}4630463046314631+static inline int intel_set_branch_counter_constr(struct perf_event *event,46324632+ int *num)46334633+{46344634+ if (branch_sample_call_stack(event))46354635+ return -EINVAL;46364636+ if (branch_sample_counters(event)) {46374637+ (*num)++;46384638+ event->hw.dyn_constraint &= x86_pmu.lbr_counters;46394639+ }46404640+46414641+ return 0;46424642+}46434643+46314644static int intel_pmu_hw_config(struct perf_event *event)46324645{46334646 int ret = x86_pmu_hw_config(event);···47114698 * group, which requires the extra space to store the counters.47124699 */47134700 leader = event->group_leader;47144714- if (branch_sample_call_stack(leader))47014701+ if (intel_set_branch_counter_constr(leader, &num))47154702 return -EINVAL;47164716- if (branch_sample_counters(leader)) {47174717- num++;47184718- leader->hw.dyn_constraint &= x86_pmu.lbr_counters;47194719- }47204703 leader->hw.flags |= PERF_X86_EVENT_BRANCH_COUNTERS;4721470447224705 for_each_sibling_event(sibling, leader) {47234723- if (branch_sample_call_stack(sibling))47064706+ if (intel_set_branch_counter_constr(sibling, &num))47244707 return -EINVAL;47254725- if (branch_sample_counters(sibling)) {47264726- num++;47274727- sibling->hw.dyn_constraint &= x86_pmu.lbr_counters;47284728- }47084708+ }47094709+47104710+ /* event isn't installed as a sibling yet. */47114711+ if (event != leader) {47124712+ if (intel_set_branch_counter_constr(event, &num))47134713+ return -EINVAL;47294714 }4730471547314716 if (num > fls(x86_pmu.lbr_counters))
+7-4
arch/x86/events/intel/ds.c
···345345 if (omr.omr_remote)346346 val |= REM;347347348348- val |= omr.omr_hitm ? P(SNOOP, HITM) : P(SNOOP, HIT);349349-350348 if (omr.omr_source == 0x2) {351351- u8 snoop = omr.omr_snoop | omr.omr_promoted;349349+ u8 snoop = omr.omr_snoop | (omr.omr_promoted << 1);352350353353- if (snoop == 0x0)351351+ if (omr.omr_hitm)352352+ val |= P(SNOOP, HITM);353353+ else if (snoop == 0x0)354354 val |= P(SNOOP, NA);355355 else if (snoop == 0x1)356356 val |= P(SNOOP, MISS);···359359 else if (snoop == 0x3)360360 val |= P(SNOOP, NONE);361361 } else if (omr.omr_source > 0x2 && omr.omr_source < 0x7) {362362+ val |= omr.omr_hitm ? P(SNOOP, HITM) : P(SNOOP, HIT);362363 val |= omr.omr_snoop ? P(SNOOPX, FWD) : 0;364364+ } else {365365+ val |= P(SNOOP, NONE);363366 }364367365368 return val;
+61-57
arch/x86/hyperv/hv_crash.c
···107107 cpu_relax();108108}109109110110-/* This cannot be inlined as it needs stack */111111-static noinline __noclone void hv_crash_restore_tss(void)110110+static void hv_crash_restore_tss(void)112111{113112 load_TR_desc();114113}115114116116-/* This cannot be inlined as it needs stack */117117-static noinline void hv_crash_clear_kernpt(void)115115+static void hv_crash_clear_kernpt(void)118116{119117 pgd_t *pgd;120118 p4d_t *p4d;···123125 native_p4d_clear(p4d);124126}125127126126-/*127127- * This is the C entry point from the asm glue code after the disable hypercall.128128- * We enter here in IA32-e long mode, ie, full 64bit mode running on kernel129129- * page tables with our below 4G page identity mapped, but using a temporary130130- * GDT. ds/fs/gs/es are null. ss is not usable. bp is null. stack is not131131- * available. We restore kernel GDT, and rest of the context, and continue132132- * to kexec.133133- */134134-static asmlinkage void __noreturn hv_crash_c_entry(void)128128+129129+static void __noreturn hv_crash_handle(void)135130{136136- struct hv_crash_ctxt *ctxt = &hv_crash_ctxt;137137-138138- /* first thing, restore kernel gdt */139139- native_load_gdt(&ctxt->gdtr);140140-141141- asm volatile("movw %%ax, %%ss" : : "a"(ctxt->ss));142142- asm volatile("movq %0, %%rsp" : : "m"(ctxt->rsp));143143-144144- asm volatile("movw %%ax, %%ds" : : "a"(ctxt->ds));145145- asm volatile("movw %%ax, %%es" : : "a"(ctxt->es));146146- asm volatile("movw %%ax, %%fs" : : "a"(ctxt->fs));147147- asm volatile("movw %%ax, %%gs" : : "a"(ctxt->gs));148148-149149- native_wrmsrq(MSR_IA32_CR_PAT, ctxt->pat);150150- asm volatile("movq %0, %%cr0" : : "r"(ctxt->cr0));151151-152152- asm volatile("movq %0, %%cr8" : : "r"(ctxt->cr8));153153- asm volatile("movq %0, %%cr4" : : "r"(ctxt->cr4));154154- asm volatile("movq %0, %%cr2" : : "r"(ctxt->cr4));155155-156156- native_load_idt(&ctxt->idtr);157157- native_wrmsrq(MSR_GS_BASE, ctxt->gsbase);158158- native_wrmsrq(MSR_EFER, ctxt->efer);159159-160160- /* restore the original kernel CS now via far return */161161- asm volatile("movzwq %0, %%rax\n\t"162162- "pushq %%rax\n\t"163163- "pushq $1f\n\t"164164- "lretq\n\t"165165- "1:nop\n\t" : : "m"(ctxt->cs) : "rax");166166-167167- /* We are in asmlinkage without stack frame, hence make C function168168- * calls which will buy stack frames.169169- */170131 hv_crash_restore_tss();171132 hv_crash_clear_kernpt();172133···134177135178 hv_panic_timeout_reboot();136179}137137-/* Tell gcc we are using lretq long jump in the above function intentionally */180180+181181+/*182182+ * __naked functions do not permit function calls, not even to __always_inline183183+ * functions that only contain asm() blocks themselves. So use a macro instead.184184+ */185185+#define hv_wrmsr(msr, val) \186186+ asm volatile("wrmsr" :: "c"(msr), "a"((u32)val), "d"((u32)(val >> 32)) : "memory")187187+188188+/*189189+ * This is the C entry point from the asm glue code after the disable hypercall.190190+ * We enter here in IA32-e long mode, ie, full 64bit mode running on kernel191191+ * page tables with our below 4G page identity mapped, but using a temporary192192+ * GDT. ds/fs/gs/es are null. ss is not usable. bp is null. stack is not193193+ * available. We restore kernel GDT, and rest of the context, and continue194194+ * to kexec.195195+ */196196+static void __naked hv_crash_c_entry(void)197197+{198198+ /* first thing, restore kernel gdt */199199+ asm volatile("lgdt %0" : : "m" (hv_crash_ctxt.gdtr));200200+201201+ asm volatile("movw %0, %%ss\n\t"202202+ "movq %1, %%rsp"203203+ :: "m"(hv_crash_ctxt.ss), "m"(hv_crash_ctxt.rsp));204204+205205+ asm volatile("movw %0, %%ds" : : "m"(hv_crash_ctxt.ds));206206+ asm volatile("movw %0, %%es" : : "m"(hv_crash_ctxt.es));207207+ asm volatile("movw %0, %%fs" : : "m"(hv_crash_ctxt.fs));208208+ asm volatile("movw %0, %%gs" : : "m"(hv_crash_ctxt.gs));209209+210210+ hv_wrmsr(MSR_IA32_CR_PAT, hv_crash_ctxt.pat);211211+ asm volatile("movq %0, %%cr0" : : "r"(hv_crash_ctxt.cr0));212212+213213+ asm volatile("movq %0, %%cr8" : : "r"(hv_crash_ctxt.cr8));214214+ asm volatile("movq %0, %%cr4" : : "r"(hv_crash_ctxt.cr4));215215+ asm volatile("movq %0, %%cr2" : : "r"(hv_crash_ctxt.cr2));216216+217217+ asm volatile("lidt %0" : : "m" (hv_crash_ctxt.idtr));218218+ hv_wrmsr(MSR_GS_BASE, hv_crash_ctxt.gsbase);219219+ hv_wrmsr(MSR_EFER, hv_crash_ctxt.efer);220220+221221+ /* restore the original kernel CS now via far return */222222+ asm volatile("pushq %q0\n\t"223223+ "pushq %q1\n\t"224224+ "lretq"225225+ :: "r"(hv_crash_ctxt.cs), "r"(hv_crash_handle));226226+}227227+/* Tell objtool we are using lretq long jump in the above function intentionally */138228STACK_FRAME_NON_STANDARD(hv_crash_c_entry);139229140230static void hv_mark_tss_not_busy(void)···199195{200196 struct hv_crash_ctxt *ctxt = &hv_crash_ctxt;201197202202- asm volatile("movq %%rsp,%0" : "=m"(ctxt->rsp));198198+ ctxt->rsp = current_stack_pointer;203199204200 ctxt->cr0 = native_read_cr0();205201 ctxt->cr4 = native_read_cr4();206202207207- asm volatile("movq %%cr2, %0" : "=a"(ctxt->cr2));208208- asm volatile("movq %%cr8, %0" : "=a"(ctxt->cr8));203203+ asm volatile("movq %%cr2, %0" : "=r"(ctxt->cr2));204204+ asm volatile("movq %%cr8, %0" : "=r"(ctxt->cr8));209205210210- asm volatile("movl %%cs, %%eax" : "=a"(ctxt->cs));211211- asm volatile("movl %%ss, %%eax" : "=a"(ctxt->ss));212212- asm volatile("movl %%ds, %%eax" : "=a"(ctxt->ds));213213- asm volatile("movl %%es, %%eax" : "=a"(ctxt->es));214214- asm volatile("movl %%fs, %%eax" : "=a"(ctxt->fs));215215- asm volatile("movl %%gs, %%eax" : "=a"(ctxt->gs));206206+ asm volatile("movw %%cs, %0" : "=m"(ctxt->cs));207207+ asm volatile("movw %%ss, %0" : "=m"(ctxt->ss));208208+ asm volatile("movw %%ds, %0" : "=m"(ctxt->ds));209209+ asm volatile("movw %%es, %0" : "=m"(ctxt->es));210210+ asm volatile("movw %%fs, %0" : "=m"(ctxt->fs));211211+ asm volatile("movw %%gs, %0" : "=m"(ctxt->gs));216212217213 native_store_gdt(&ctxt->gdtr);218214 store_idt(&ctxt->idtr);
+16-2
arch/x86/kernel/apic/x2apic_uv_x.c
···17081708 struct uv_hub_info_s *new_hub;1709170917101710 /* Allocate & fill new per hub info list */17111711- new_hub = (bid == 0) ? &uv_hub_info_node017121712- : kzalloc_node(bytes, GFP_KERNEL, uv_blade_to_node(bid));17111711+ if (bid == 0) {17121712+ new_hub = &uv_hub_info_node0;17131713+ } else {17141714+ int nid;17151715+17161716+ /*17171717+ * Deconfigured sockets are mapped to SOCK_EMPTY. Use17181718+ * NUMA_NO_NODE to allocate on a valid node.17191719+ */17201720+ nid = uv_blade_to_node(bid);17211721+ if (nid == SOCK_EMPTY)17221722+ nid = NUMA_NO_NODE;17231723+17241724+ new_hub = kzalloc_node(bytes, GFP_KERNEL, nid);17251725+ }17261726+17131727 if (WARN_ON_ONCE(!new_hub)) {17141728 /* do not kfree() bid 0, which is statically allocated */17151729 while (--bid > 0)
+11-6
arch/x86/kernel/cpu/mce/amd.c
···875875{876876 amd_reset_thr_limit(m->bank);877877878878- /* Clear MCA_DESTAT for all deferred errors even those logged in MCA_STATUS. */879879- if (m->status & MCI_STATUS_DEFERRED)880880- mce_wrmsrq(MSR_AMD64_SMCA_MCx_DESTAT(m->bank), 0);878878+ if (mce_flags.smca) {879879+ /*880880+ * Clear MCA_DESTAT for all deferred errors even those881881+ * logged in MCA_STATUS.882882+ */883883+ if (m->status & MCI_STATUS_DEFERRED)884884+ mce_wrmsrq(MSR_AMD64_SMCA_MCx_DESTAT(m->bank), 0);881885882882- /* Don't clear MCA_STATUS if MCA_DESTAT was used exclusively. */883883- if (m->kflags & MCE_CHECK_DFR_REGS)884884- return;886886+ /* Don't clear MCA_STATUS if MCA_DESTAT was used exclusively. */887887+ if (m->kflags & MCE_CHECK_DFR_REGS)888888+ return;889889+ }885890886891 mce_wrmsrq(mca_msr_reg(m->bank, MCA_STATUS), 0);887892}
···451451452452 {{"_DSM",453453 METHOD_4ARGS(ACPI_TYPE_BUFFER, ACPI_TYPE_INTEGER, ACPI_TYPE_INTEGER,454454- ACPI_TYPE_ANY | ACPI_TYPE_PACKAGE) |454454+ ACPI_TYPE_PACKAGE | ACPI_TYPE_ANY) |455455 ARG_COUNT_IS_MINIMUM,456456 METHOD_RETURNS(ACPI_RTYPE_ALL)}}, /* Must return a value, but it can be of any type */457457
-3
drivers/acpi/bus.c
···818818 if (list_empty(&adev->pnp.ids))819819 return NULL;820820821821- if (adev->pnp.type.backlight)822822- return adev;823823-824821 return acpi_primary_dev_companion(adev, dev);825822}826823
···381381}382382__exitcall(deferred_probe_exit);383383384384+int __device_set_driver_override(struct device *dev, const char *s, size_t len)385385+{386386+ const char *new, *old;387387+ char *cp;388388+389389+ if (!s)390390+ return -EINVAL;391391+392392+ /*393393+ * The stored value will be used in sysfs show callback (sysfs_emit()),394394+ * which has a length limit of PAGE_SIZE and adds a trailing newline.395395+ * Thus we can store one character less to avoid truncation during sysfs396396+ * show.397397+ */398398+ if (len >= (PAGE_SIZE - 1))399399+ return -EINVAL;400400+401401+ /*402402+ * Compute the real length of the string in case userspace sends us a403403+ * bunch of \0 characters like python likes to do.404404+ */405405+ len = strlen(s);406406+407407+ if (!len) {408408+ /* Empty string passed - clear override */409409+ spin_lock(&dev->driver_override.lock);410410+ old = dev->driver_override.name;411411+ dev->driver_override.name = NULL;412412+ spin_unlock(&dev->driver_override.lock);413413+ kfree(old);414414+415415+ return 0;416416+ }417417+418418+ cp = strnchr(s, len, '\n');419419+ if (cp)420420+ len = cp - s;421421+422422+ new = kstrndup(s, len, GFP_KERNEL);423423+ if (!new)424424+ return -ENOMEM;425425+426426+ spin_lock(&dev->driver_override.lock);427427+ old = dev->driver_override.name;428428+ if (cp != s) {429429+ dev->driver_override.name = new;430430+ spin_unlock(&dev->driver_override.lock);431431+ } else {432432+ /* "\n" passed - clear override */433433+ dev->driver_override.name = NULL;434434+ spin_unlock(&dev->driver_override.lock);435435+436436+ kfree(new);437437+ }438438+ kfree(old);439439+440440+ return 0;441441+}442442+EXPORT_SYMBOL_GPL(__device_set_driver_override);443443+384444/**385445 * device_is_bound() - Check if device is bound to a driver386446 * @dev: device to check
+5-32
drivers/base/platform.c
···603603 kfree(pa->pdev.dev.platform_data);604604 kfree(pa->pdev.mfd_cell);605605 kfree(pa->pdev.resource);606606- kfree(pa->pdev.driver_override);607606 kfree(pa);608607}609608···13081309}13091310static DEVICE_ATTR_RO(numa_node);1310131113111311-static ssize_t driver_override_show(struct device *dev,13121312- struct device_attribute *attr, char *buf)13131313-{13141314- struct platform_device *pdev = to_platform_device(dev);13151315- ssize_t len;13161316-13171317- device_lock(dev);13181318- len = sysfs_emit(buf, "%s\n", pdev->driver_override);13191319- device_unlock(dev);13201320-13211321- return len;13221322-}13231323-13241324-static ssize_t driver_override_store(struct device *dev,13251325- struct device_attribute *attr,13261326- const char *buf, size_t count)13271327-{13281328- struct platform_device *pdev = to_platform_device(dev);13291329- int ret;13301330-13311331- ret = driver_set_override(dev, &pdev->driver_override, buf, count);13321332- if (ret)13331333- return ret;13341334-13351335- return count;13361336-}13371337-static DEVICE_ATTR_RW(driver_override);13381338-13391312static struct attribute *platform_dev_attrs[] = {13401313 &dev_attr_modalias.attr,13411314 &dev_attr_numa_node.attr,13421342- &dev_attr_driver_override.attr,13431315 NULL,13441316};13451317···13481378{13491379 struct platform_device *pdev = to_platform_device(dev);13501380 struct platform_driver *pdrv = to_platform_driver(drv);13811381+ int ret;1351138213521383 /* When driver_override is set, only bind to the matching driver */13531353- if (pdev->driver_override)13541354- return !strcmp(pdev->driver_override, drv->name);13841384+ ret = device_match_driver_override(dev, drv);13851385+ if (ret >= 0)13861386+ return ret;1355138713561388 /* Attempt an OF style match first */13571389 if (of_driver_match_device(dev, drv))···14881516const struct bus_type platform_bus_type = {14891517 .name = "platform",14901518 .dev_groups = platform_dev_groups,15191519+ .driver_override = true,14911520 .match = platform_match,14921521 .uevent = platform_uevent,14931522 .probe = platform_probe,
···3636 * that's not listed in simple_pm_bus_of_match. We don't want to do any3737 * of the simple-pm-bus tasks for these devices, so return early.3838 */3939- if (pdev->driver_override)3939+ if (device_has_driver_override(&pdev->dev))4040 return 0;41414242 match = of_match_device(dev->driver->of_match_table, dev);···7878{7979 const void *data = of_device_get_match_data(&pdev->dev);80808181- if (pdev->driver_override || data)8181+ if (device_has_driver_override(&pdev->dev) || data)8282 return;83838484 dev_dbg(&pdev->dev, "%s\n", __func__);
+2-2
drivers/cache/ax45mp_cache.c
···178178179179static int __init ax45mp_cache_init(void)180180{181181- struct device_node *np;182181 struct resource res;183182 int ret;184183185185- np = of_find_matching_node(NULL, ax45mp_cache_ids);184184+ struct device_node *np __free(device_node) =185185+ of_find_matching_node(NULL, ax45mp_cache_ids);186186 if (!of_device_is_available(np))187187 return -ENODEV;188188
+2-2
drivers/cache/starfive_starlink_cache.c
···102102103103static int __init starlink_cache_init(void)104104{105105- struct device_node *np;106105 u32 block_size;107106 int ret;108107109109- np = of_find_matching_node(NULL, starlink_cache_ids);108108+ struct device_node *np __free(device_node) =109109+ of_find_matching_node(NULL, starlink_cache_ids);110110 if (!of_device_is_available(np))111111 return -ENODEV;112112
+1-2
drivers/clk/imx/clk-scu.c
···706706 if (ret)707707 goto put_device;708708709709- ret = driver_set_override(&pdev->dev, &pdev->driver_override,710710- "imx-scu-clk", strlen("imx-scu-clk"));709709+ ret = device_set_driver_override(&pdev->dev, "imx-scu-clk");711710 if (ret)712711 goto put_device;713712
+1-3
drivers/crypto/ccp/sev-dev.c
···24082408 * in Firmware state on failure. Use snp_reclaim_pages() to24092409 * transition either case back to Hypervisor-owned state.24102410 */24112411- if (snp_reclaim_pages(__pa(data), 1, true)) {24122412- snp_leak_pages(__page_to_pfn(status_page), 1);24112411+ if (snp_reclaim_pages(__pa(data), 1, true))24132412 return -EFAULT;24142414- }24152413 }2416241424172415 if (ret)
+7
drivers/crypto/padlock-sha.c
···332332 if (!x86_match_cpu(padlock_sha_ids) || !boot_cpu_has(X86_FEATURE_PHE_EN))333333 return -ENODEV;334334335335+ /*336336+ * Skip family 0x07 and newer used by Zhaoxin processors,337337+ * as the driver's self-tests fail on these CPUs.338338+ */339339+ if (c->x86 >= 0x07)340340+ return -ENODEV;341341+335342 /* Register the newly added algorithm module if on *336343 * VIA Nano processor, or else just do as before */337344 if (c->x86_model < 0x0f) {
···205205 return 0;206206}207207208208-static int ffa_rxtx_unmap(u16 vm_id)208208+static int ffa_rxtx_unmap(void)209209{210210 ffa_value_t ret;211211212212 invoke_ffa_fn((ffa_value_t){213213- .a0 = FFA_RXTX_UNMAP, .a1 = PACK_TARGET_INFO(vm_id, 0),213213+ .a0 = FFA_RXTX_UNMAP,214214 }, &ret);215215216216 if (ret.a0 == FFA_ERROR)···2097209720982098 pr_err("failed to setup partitions\n");20992099 ffa_notifications_cleanup();21002100- ffa_rxtx_unmap(drv_info->vm_id);21002100+ ffa_rxtx_unmap();21012101free_pages:21022102 if (drv_info->tx_buffer)21032103 free_pages_exact(drv_info->tx_buffer, rxtx_bufsz);···21122112{21132113 ffa_notifications_cleanup();21142114 ffa_partitions_cleanup();21152115- ffa_rxtx_unmap(drv_info->vm_id);21152115+ ffa_rxtx_unmap();21162116 free_pages_exact(drv_info->tx_buffer, drv_info->rxtx_bufsz);21172117 free_pages_exact(drv_info->rx_buffer, drv_info->rxtx_bufsz);21182118 kfree(drv_info);
+2-2
drivers/firmware/arm_scmi/notify.c
···10661066 * since at creation time we usually want to have all setup and ready before10671067 * events really start flowing.10681068 *10691069- * Return: A properly refcounted handler on Success, NULL on Failure10691069+ * Return: A properly refcounted handler on Success, ERR_PTR on Failure10701070 */10711071static inline struct scmi_event_handler *10721072__scmi_event_handler_get_ops(struct scmi_notify_instance *ni,···11131113 }11141114 mutex_unlock(&ni->pending_mtx);1115111511161116- return hndl;11161116+ return hndl ?: ERR_PTR(-ENODEV);11171117}1118111811191119static struct scmi_event_handler *
+2-2
drivers/firmware/arm_scmi/protocols.h
···189189190190/**191191 * struct scmi_iterator_state - Iterator current state descriptor192192- * @desc_index: Starting index for the current mulit-part request.192192+ * @desc_index: Starting index for the current multi-part request.193193 * @num_returned: Number of returned items in the last multi-part reply.194194 * @num_remaining: Number of remaining items in the multi-part message.195195 * @max_resources: Maximum acceptable number of items, configured by the caller196196 * depending on the underlying resources that it is querying.197197 * @loop_idx: The iterator loop index in the current multi-part reply.198198- * @rx_len: Size in bytes of the currenly processed message; it can be used by198198+ * @rx_len: Size in bytes of the currently processed message; it can be used by199199 * the user of the iterator to verify a reply size.200200 * @priv: Optional pointer to some additional state-related private data setup201201 * by the caller during the iterations.
+3-2
drivers/firmware/arm_scpi.c
···18181919#include <linux/bitmap.h>2020#include <linux/bitfield.h>2121+#include <linux/cleanup.h>2122#include <linux/device.h>2223#include <linux/err.h>2324#include <linux/export.h>···941940 int idx = scpi_drvinfo->num_chans;942941 struct scpi_chan *pchan = scpi_drvinfo->channels + idx;943942 struct mbox_client *cl = &pchan->cl;944944- struct device_node *shmem = of_parse_phandle(np, "shmem", idx);943943+ struct device_node *shmem __free(device_node) =944944+ of_parse_phandle(np, "shmem", idx);945945946946 if (!of_match_node(shmem_of_match, shmem))947947 return -ENXIO;948948949949 ret = of_address_to_resource(shmem, 0, &res);950950- of_node_put(shmem);951950 if (ret) {952951 dev_err(dev, "failed to get SCPI payload mem resource\n");953952 return ret;
+4
drivers/gpu/drm/amd/amdgpu/amdgpu_bo_list.c
···36363737#define AMDGPU_BO_LIST_MAX_PRIORITY 32u3838#define AMDGPU_BO_LIST_NUM_BUCKETS (AMDGPU_BO_LIST_MAX_PRIORITY + 1)3939+#define AMDGPU_BO_LIST_MAX_ENTRIES (128 * 1024)39404041static void amdgpu_bo_list_free_rcu(struct rcu_head *rcu)4142{···188187 const uint32_t bo_info_size = in->bo_info_size;189188 const uint32_t bo_number = in->bo_number;190189 struct drm_amdgpu_bo_list_entry *info;190190+191191+ if (bo_number > AMDGPU_BO_LIST_MAX_ENTRIES)192192+ return -EINVAL;191193192194 /* copy the handle array from userspace to a kernel buffer */193195 if (likely(info_size == bo_info_size)) {
+6-1
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
···10691069 }1070107010711071 /* Prepare a TLB flush fence to be attached to PTs */10721072- if (!params->unlocked) {10721072+ /* The check for need_tlb_fence should be dropped once we10731073+ * sort out the issues with KIQ/MES TLB invalidation timeouts.10741074+ */10751075+ if (!params->unlocked && vm->need_tlb_fence) {10731076 amdgpu_vm_tlb_fence_create(params->adev, vm, fence);1074107710751078 /* Makes sure no PD/PT is freed before the flush */···26052602 ttm_lru_bulk_move_init(&vm->lru_bulk_move);2606260326072604 vm->is_compute_context = false;26052605+ vm->need_tlb_fence = amdgpu_userq_enabled(&adev->ddev);2608260626092607 vm->use_cpu_for_update = !!(adev->vm_manager.vm_update_mode &26102608 AMDGPU_VM_USE_CPU_FOR_GFX);···27432739 dma_fence_put(vm->last_update);27442740 vm->last_update = dma_fence_get_stub();27452741 vm->is_compute_context = true;27422742+ vm->need_tlb_fence = true;2746274327472744unreserve_bo:27482745 amdgpu_bo_unreserve(vm->root.bo);
+2
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.h
···441441 struct ttm_lru_bulk_move lru_bulk_move;442442 /* Flag to indicate if VM is used for compute */443443 bool is_compute_context;444444+ /* Flag to indicate if VM needs a TLB fence (KFD or KGD) */445445+ bool need_tlb_fence;444446445447 /* Memory partition number, -1 means any partition */446448 int8_t mem_id;
···129129 if (!pdev)130130 return -EINVAL;131131132132- if (!dev->type->name) {132132+ if (!dev->type || !dev->type->name) {133133 drm_dbg(&adev->ddev, "Invalid device type to add\n");134134 goto exit;135135 }···165165 if (!pdev)166166 return -EINVAL;167167168168- if (!dev->type->name) {168168+ if (!dev->type || !dev->type->name) {169169 drm_dbg(&adev->ddev, "Invalid device type to remove\n");170170 goto exit;171171 }
···19671967 if (engine->sanitize)19681968 engine->sanitize(engine);1969196919701970- engine->set_default_submission(engine);19701970+ if (engine->set_default_submission)19711971+ engine->set_default_submission(engine);19711972 }19721973}19731974
-17
drivers/gpu/drm/imagination/pvr_device.c
···225225 }226226227227 if (pvr_dev->has_safety_events) {228228- int err;229229-230230- /*231231- * Ensure the GPU is powered on since some safety events (such232232- * as ECC faults) can happen outside of job submissions, which233233- * are otherwise the only time a power reference is held.234234- */235235- err = pvr_power_get(pvr_dev);236236- if (err) {237237- drm_err_ratelimited(drm_dev,238238- "%s: could not take power reference (%d)\n",239239- __func__, err);240240- return ret;241241- }242242-243228 while (pvr_device_safety_irq_pending(pvr_dev)) {244229 pvr_device_safety_irq_clear(pvr_dev);245230 pvr_device_handle_safety_events(pvr_dev);246231247232 ret = IRQ_HANDLED;248233 }249249-250250- pvr_power_put(pvr_dev);251234 }252235253236 return ret;
+39-12
drivers/gpu/drm/imagination/pvr_power.c
···9090}91919292static int9393-pvr_power_fw_disable(struct pvr_device *pvr_dev, bool hard_reset)9393+pvr_power_fw_disable(struct pvr_device *pvr_dev, bool hard_reset, bool rpm_suspend)9494{9595- if (!hard_reset) {9696- int err;9595+ int err;97969797+ if (!hard_reset) {9898 cancel_delayed_work_sync(&pvr_dev->watchdog.work);9999100100 err = pvr_power_request_idle(pvr_dev);···106106 return err;107107 }108108109109- return pvr_fw_stop(pvr_dev);109109+ if (rpm_suspend) {110110+ /* This also waits for late processing of GPU or firmware IRQs in other cores */111111+ disable_irq(pvr_dev->irq);112112+ }113113+114114+ err = pvr_fw_stop(pvr_dev);115115+ if (err && rpm_suspend)116116+ enable_irq(pvr_dev->irq);117117+118118+ return err;110119}111120112121static int113113-pvr_power_fw_enable(struct pvr_device *pvr_dev)122122+pvr_power_fw_enable(struct pvr_device *pvr_dev, bool rpm_resume)114123{115124 int err;116125126126+ if (rpm_resume)127127+ enable_irq(pvr_dev->irq);128128+117129 err = pvr_fw_start(pvr_dev);118130 if (err)119119- return err;131131+ goto out;120132121133 err = pvr_wait_for_fw_boot(pvr_dev);122134 if (err) {123135 drm_err(from_pvr_device(pvr_dev), "Firmware failed to boot\n");124136 pvr_fw_stop(pvr_dev);125125- return err;137137+ goto out;126138 }127139128140 queue_delayed_work(pvr_dev->sched_wq, &pvr_dev->watchdog.work,129141 msecs_to_jiffies(WATCHDOG_TIME_MS));130142131143 return 0;144144+145145+out:146146+ if (rpm_resume)147147+ disable_irq(pvr_dev->irq);148148+149149+ return err;132150}133151134152bool···379361 return -EIO;380362381363 if (pvr_dev->fw_dev.booted) {382382- err = pvr_power_fw_disable(pvr_dev, false);364364+ err = pvr_power_fw_disable(pvr_dev, false, true);383365 if (err)384366 goto err_drm_dev_exit;385367 }···409391 goto err_drm_dev_exit;410392411393 if (pvr_dev->fw_dev.booted) {412412- err = pvr_power_fw_enable(pvr_dev);394394+ err = pvr_power_fw_enable(pvr_dev, true);413395 if (err)414396 goto err_power_off;415397 }···528510 }529511530512 /* Disable IRQs for the duration of the reset. */531531- disable_irq(pvr_dev->irq);513513+ if (hard_reset) {514514+ disable_irq(pvr_dev->irq);515515+ } else {516516+ /*517517+ * Soft reset is triggered as a response to a FW command to the Host and is518518+ * processed from the threaded IRQ handler. This code cannot (nor needs to)519519+ * wait for any IRQ processing to complete.520520+ */521521+ disable_irq_nosync(pvr_dev->irq);522522+ }532523533524 do {534525 if (hard_reset) {···545518 queues_disabled = true;546519 }547520548548- err = pvr_power_fw_disable(pvr_dev, hard_reset);521521+ err = pvr_power_fw_disable(pvr_dev, hard_reset, false);549522 if (!err) {550523 if (hard_reset) {551524 pvr_dev->fw_dev.booted = false;···568541569542 pvr_fw_irq_clear(pvr_dev);570543571571- err = pvr_power_fw_enable(pvr_dev);544544+ err = pvr_power_fw_enable(pvr_dev, false);572545 }573546574547 if (err && hard_reset)
···96969797struct vmw_res_func;98989999+struct vmw_bo;100100+struct vmw_bo;101101+struct vmw_resource_dirty;102102+99103/**100100- * struct vmw-resource - base class for hardware resources104104+ * struct vmw_resource - base class for hardware resources101105 *102106 * @kref: For refcounting.103107 * @dev_priv: Pointer to the device private for this resource. Immutable.104108 * @id: Device id. Protected by @dev_priv::resource_lock.109109+ * @used_prio: Priority for this resource.105110 * @guest_memory_size: Guest memory buffer size. Immutable.106111 * @res_dirty: Resource contains data not yet in the guest memory buffer.107112 * Protected by resource reserved.···122117 * pin-count greater than zero. It is not on the resource LRU lists and its123118 * guest memory buffer is pinned. Hence it can't be evicted.124119 * @func: Method vtable for this resource. Immutable.125125- * @mob_node; Node for the MOB guest memory rbtree. Protected by120120+ * @mob_node: Node for the MOB guest memory rbtree. Protected by126121 * @guest_memory_bo reserved.127122 * @lru_head: List head for the LRU list. Protected by @dev_priv::resource_lock.128123 * @binding_head: List head for the context binding list. Protected by129124 * the @dev_priv::binding_mutex125125+ * @dirty: resource's dirty tracker130126 * @res_free: The resource destructor.131127 * @hw_destroy: Callback to destroy the resource on the device, as part of132128 * resource destruction.133129 */134134-struct vmw_bo;135135-struct vmw_bo;136136-struct vmw_resource_dirty;137130struct vmw_resource {138131 struct kref kref;139132 struct vmw_private *dev_priv;···199196 * @quality_level: Quality level.200197 * @autogen_filter: Filter for automatically generated mipmaps.201198 * @array_size: Number of array elements for a 1D/2D texture. For cubemap202202- texture number of faces * array_size. This should be 0 for pre203203- SM4 device.199199+ * texture number of faces * array_size. This should be 0 for pre200200+ * SM4 device.204201 * @buffer_byte_stride: Buffer byte stride.205202 * @num_sizes: Size of @sizes. For GB surface this should always be 1.206203 * @base_size: Surface dimension.···268265struct vmw_res_cache_entry {269266 uint32_t handle;270267 struct vmw_resource *res;268268+ /* private: */271269 void *private;270270+ /* public: */272271 unsigned short valid_handle;273272 unsigned short valid;274273};275274276275/**277276 * enum vmw_dma_map_mode - indicate how to perform TTM page dma mappings.277277+ * @vmw_dma_alloc_coherent: Use TTM coherent pages278278+ * @vmw_dma_map_populate: Unmap from DMA just after unpopulate279279+ * @vmw_dma_map_bind: Unmap from DMA just before unbind278280 */279281enum vmw_dma_map_mode {280280- vmw_dma_alloc_coherent, /* Use TTM coherent pages */281281- vmw_dma_map_populate, /* Unmap from DMA just after unpopulate */282282- vmw_dma_map_bind, /* Unmap from DMA just before unbind */282282+ vmw_dma_alloc_coherent,283283+ vmw_dma_map_populate,284284+ vmw_dma_map_bind,285285+ /* private: */283286 vmw_dma_map_max284287};285288···293284 * struct vmw_sg_table - Scatter/gather table for binding, with additional294285 * device-specific information.295286 *287287+ * @mode: which page mapping mode to use288288+ * @pages: Array of page pointers to the pages.289289+ * @addrs: DMA addresses to the pages if coherent pages are used.296290 * @sgt: Pointer to a struct sg_table with binding information297297- * @num_regions: Number of regions with device-address contiguous pages291291+ * @num_pages: Number of @pages298292 */299293struct vmw_sg_table {300294 enum vmw_dma_map_mode mode;···365353 * than from user-space366354 * @fp: If @kernel is false, points to the file of the client. Otherwise367355 * NULL356356+ * @filp: DRM state for this file368357 * @cmd_bounce: Command bounce buffer used for command validation before369358 * copying to fifo space370359 * @cmd_bounce_size: Current command bounce buffer size···742729bool vmwgfx_supported(struct vmw_private *vmw);743730744731745745-/**732732+/*746733 * GMR utilities - vmwgfx_gmr.c747734 */748735···752739 int gmr_id);753740extern void vmw_gmr_unbind(struct vmw_private *dev_priv, int gmr_id);754741755755-/**742742+/*756743 * User handles757744 */758745struct vmw_user_object {···772759void vmw_user_object_unmap(struct vmw_user_object *uo);773760bool vmw_user_object_is_mapped(struct vmw_user_object *uo);774761775775-/**762762+/*776763 * Resource utilities - vmwgfx_resource.c777764 */778765struct vmw_user_resource_conv;···832819 return !RB_EMPTY_NODE(&res->mob_node);833820}834821835835-/**822822+/*836823 * GEM related functionality - vmwgfx_gem.c837824 */838825struct vmw_bo_params;···846833 struct drm_file *filp);847834extern void vmw_debugfs_gem_init(struct vmw_private *vdev);848835849849-/**836836+/*850837 * Misc Ioctl functionality - vmwgfx_ioctl.c851838 */852839···859846extern int vmw_present_readback_ioctl(struct drm_device *dev, void *data,860847 struct drm_file *file_priv);861848862862-/**849849+/*863850 * Fifo utilities - vmwgfx_fifo.c864851 */865852···893880894881895882/**896896- * vmw_fifo_caps - Returns the capabilities of the FIFO command883883+ * vmw_fifo_caps - Get the capabilities of the FIFO command897884 * queue or 0 if fifo memory isn't present.898885 * @dev_priv: The device private context886886+ *887887+ * Returns: capabilities of the FIFO command or %0 if fifo memory not present899888 */900889static inline uint32_t vmw_fifo_caps(const struct vmw_private *dev_priv)901890{···908893909894910895/**911911- * vmw_is_cursor_bypass3_enabled - Returns TRUE iff Cursor Bypass 3912912- * is enabled in the FIFO.896896+ * vmw_is_cursor_bypass3_enabled - check Cursor Bypass 3 enabled setting897897+ * in the FIFO.913898 * @dev_priv: The device private context899899+ *900900+ * Returns: %true iff Cursor Bypass 3 is enabled in the FIFO914901 */915902static inline bool916903vmw_is_cursor_bypass3_enabled(const struct vmw_private *dev_priv)···920903 return (vmw_fifo_caps(dev_priv) & SVGA_FIFO_CAP_CURSOR_BYPASS_3) != 0;921904}922905923923-/**906906+/*924907 * TTM buffer object driver - vmwgfx_ttm_buffer.c925908 */926909···944927 *945928 * @viter: Pointer to the iterator to advance.946929 *947947- * Returns false if past the list of pages, true otherwise.930930+ * Returns: false if past the list of pages, true otherwise.948931 */949932static inline bool vmw_piter_next(struct vmw_piter *viter)950933{···956939 *957940 * @viter: Pointer to the iterator958941 *959959- * Returns the DMA address of the page pointed to by @viter.942942+ * Returns: the DMA address of the page pointed to by @viter.960943 */961944static inline dma_addr_t vmw_piter_dma_addr(struct vmw_piter *viter)962945{···968951 *969952 * @viter: Pointer to the iterator970953 *971971- * Returns the DMA address of the page pointed to by @viter.954954+ * Returns: the DMA address of the page pointed to by @viter.972955 */973956static inline struct page *vmw_piter_page(struct vmw_piter *viter)974957{975958 return viter->pages[viter->i];976959}977960978978-/**961961+/*979962 * Command submission - vmwgfx_execbuf.c980963 */981964···1010993 int32_t out_fence_fd);1011994bool vmw_cmd_describe(const void *buf, u32 *size, char const **cmd);101299510131013-/**996996+/*1014997 * IRQs and wating - vmwgfx_irq.c1015998 */1016999···10331016bool vmw_generic_waiter_remove(struct vmw_private *dev_priv,10341017 u32 flag, int *waiter_count);1035101810361036-/**10191019+/*10371020 * Kernel modesetting - vmwgfx_kms.c10381021 */10391022···10651048extern void vmw_resource_unpin(struct vmw_resource *res);10661049extern enum vmw_res_type vmw_res_type(const struct vmw_resource *res);1067105010681068-/**10511051+/*10691052 * Overlay control - vmwgfx_overlay.c10701053 */10711054···10801063int vmw_overlay_num_overlays(struct vmw_private *dev_priv);10811064int vmw_overlay_num_free_overlays(struct vmw_private *dev_priv);1082106510831083-/**10661066+/*10841067 * GMR Id manager10851068 */1086106910871070int vmw_gmrid_man_init(struct vmw_private *dev_priv, int type);10881071void vmw_gmrid_man_fini(struct vmw_private *dev_priv, int type);1089107210901090-/**10731073+/*10911074 * System memory manager10921075 */10931076int vmw_sys_man_init(struct vmw_private *dev_priv);10941077void vmw_sys_man_fini(struct vmw_private *dev_priv);1095107810961096-/**10791079+/*10971080 * Prime - vmwgfx_prime.c10981081 */10991082···13091292 * @line: The current line of the blit.13101293 * @line_offset: Offset of the current line segment.13111294 * @cpp: Bytes per pixel (granularity information).13121312- * @memcpy: Which memcpy function to use.12951295+ * @do_cpy: Which memcpy function to use.13131296 */13141297struct vmw_diff_cpy {13151298 struct drm_rect rect;···1397138013981381/**13991382 * VMW_DEBUG_KMS - Debug output for kernel mode-setting13831383+ * @fmt: format string for the args14001384 *14011385 * This macro is for debugging vmwgfx mode-setting code.14021386 */14031387#define VMW_DEBUG_KMS(fmt, ...) \14041388 DRM_DEBUG_DRIVER(fmt, ##__VA_ARGS__)1405138914061406-/**13901390+/*14071391 * Inline helper functions14081392 */14091393···1435141714361418/**14371419 * vmw_fifo_mem_read - Perform a MMIO read from the fifo memory14381438- *14201420+ * @vmw: The device private structure14391421 * @fifo_reg: The fifo register to read from14401422 *14411423 * This function is intended to be equivalent to ioread32() on14421424 * memremap'd memory, but without byteswapping.14251425+ *14261426+ * Returns: the value read14431427 */14441428static inline u32 vmw_fifo_mem_read(struct vmw_private *vmw, uint32 fifo_reg)14451429{···1451143114521432/**14531433 * vmw_fifo_mem_write - Perform a MMIO write to volatile memory14541454- *14551455- * @addr: The fifo register to write to14341434+ * @vmw: The device private structure14351435+ * @fifo_reg: The fifo register to write to14361436+ * @value: The value to write14561437 *14571438 * This function is intended to be equivalent to iowrite32 on14581439 * memremap'd memory, but without byteswapping.
+2-1
drivers/gpu/drm/vmwgfx/vmwgfx_kms.c
···771771 ret = vmw_bo_dirty_add(bo);772772 if (!ret && surface && surface->res.func->dirty_alloc) {773773 surface->res.coherent = true;774774- ret = surface->res.func->dirty_alloc(&surface->res);774774+ if (surface->res.dirty == NULL)775775+ ret = surface->res.func->dirty_alloc(&surface->res);775776 }776777 ttm_bo_unreserve(&bo->tbo);777778 }
···2828 /** @size: Total usable size of this GGTT */2929 u64 size;30303131-#define XE_GGTT_FLAGS_64K BIT(0)3131+#define XE_GGTT_FLAGS_64K BIT(0)3232+#define XE_GGTT_FLAGS_ONLINE BIT(1)3233 /**3334 * @flags: Flags for this GGTT3435 * Acceptable flags:3536 * - %XE_GGTT_FLAGS_64K - if PTE size is 64K. Otherwise, regular is 4K.3737+ * - %XE_GGTT_FLAGS_ONLINE - is GGTT online, protected by ggtt->lock3838+ * after init3639 */3740 unsigned int flags;3841 /** @scratch: Internal object allocation used as a scratch page */
···48484949#define XE_GUC_EXEC_QUEUE_CGP_CONTEXT_ERROR_LEN 650505151+static int guc_submit_reset_prepare(struct xe_guc *guc);5252+5153static struct xe_guc *5254exec_queue_to_guc(struct xe_exec_queue *q)5355{···241239 EXEC_QUEUE_STATE_BANNED));242240}243241244244-static void guc_submit_fini(struct drm_device *drm, void *arg)242242+static void guc_submit_sw_fini(struct drm_device *drm, void *arg)245243{246244 struct xe_guc *guc = arg;247245 struct xe_device *xe = guc_to_xe(guc);···257255 xe_gt_assert(gt, ret);258256259257 xa_destroy(&guc->submission_state.exec_queue_lookup);258258+}259259+260260+static void guc_submit_fini(void *arg)261261+{262262+ struct xe_guc *guc = arg;263263+264264+ /* Forcefully kill any remaining exec queues */265265+ xe_guc_ct_stop(&guc->ct);266266+ guc_submit_reset_prepare(guc);267267+ xe_guc_softreset(guc);268268+ xe_guc_submit_stop(guc);269269+ xe_uc_fw_sanitize(&guc->fw);270270+ xe_guc_submit_pause_abort(guc);260271}261272262273static void guc_submit_wedged_fini(void *arg)···341326342327 guc->submission_state.initialized = true;343328344344- return drmm_add_action_or_reset(&xe->drm, guc_submit_fini, guc);329329+ err = drmm_add_action_or_reset(&xe->drm, guc_submit_sw_fini, guc);330330+ if (err)331331+ return err;332332+333333+ return devm_add_action_or_reset(xe->drm.dev, guc_submit_fini, guc);345334}346335347336/*···12711252 */12721253void xe_guc_submit_wedge(struct xe_guc *guc)12731254{12551255+ struct xe_device *xe = guc_to_xe(guc);12741256 struct xe_gt *gt = guc_to_gt(guc);12751257 struct xe_exec_queue *q;12761258 unsigned long index;···12861266 if (!guc->submission_state.initialized)12871267 return;1288126812891289- err = devm_add_action_or_reset(guc_to_xe(guc)->drm.dev,12901290- guc_submit_wedged_fini, guc);12911291- if (err) {12921292- xe_gt_err(gt, "Failed to register clean-up in wedged.mode=%s; "12931293- "Although device is wedged.\n",12941294- xe_wedged_mode_to_string(XE_WEDGED_MODE_UPON_ANY_HANG_NO_RESET));12951295- return;12961296- }12691269+ if (xe->wedged.mode == 2) {12701270+ err = devm_add_action_or_reset(guc_to_xe(guc)->drm.dev,12711271+ guc_submit_wedged_fini, guc);12721272+ if (err) {12731273+ xe_gt_err(gt, "Failed to register clean-up on wedged.mode=2; "12741274+ "Although device is wedged.\n");12751275+ return;12761276+ }1297127712981298- mutex_lock(&guc->submission_state.lock);12991299- xa_for_each(&guc->submission_state.exec_queue_lookup, index, q)13001300- if (xe_exec_queue_get_unless_zero(q))13011301- set_exec_queue_wedged(q);13021302- mutex_unlock(&guc->submission_state.lock);12781278+ mutex_lock(&guc->submission_state.lock);12791279+ xa_for_each(&guc->submission_state.exec_queue_lookup, index, q)12801280+ if (xe_exec_queue_get_unless_zero(q))12811281+ set_exec_queue_wedged(q);12821282+ mutex_unlock(&guc->submission_state.lock);12831283+ } else {12841284+ /* Forcefully kill any remaining exec queues, signal fences */12851285+ guc_submit_reset_prepare(guc);12861286+ xe_guc_submit_stop(guc);12871287+ xe_guc_softreset(guc);12881288+ xe_uc_fw_sanitize(&guc->fw);12891289+ xe_guc_submit_pause_abort(guc);12901290+ }13031291}1304129213051293static bool guc_submit_hint_wedged(struct xe_guc *guc)···22582230static void guc_exec_queue_stop(struct xe_guc *guc, struct xe_exec_queue *q)22592231{22602232 struct xe_gpu_scheduler *sched = &q->guc->sched;22332233+ bool do_destroy = false;2261223422622235 /* Stop scheduling + flush any DRM scheduler operations */22632236 xe_sched_submission_stop(sched);···22662237 /* Clean up lost G2H + reset engine state */22672238 if (exec_queue_registered(q)) {22682239 if (exec_queue_destroyed(q))22692269- __guc_exec_queue_destroy(guc, q);22402240+ do_destroy = true;22702241 }22712242 if (q->guc->suspend_pending) {22722243 set_exec_queue_suspended(q);···23022273 xe_guc_exec_queue_trigger_cleanup(q);23032274 }23042275 }22762276+22772277+ if (do_destroy)22782278+ __guc_exec_queue_destroy(guc, q);23052279}2306228023072307-int xe_guc_submit_reset_prepare(struct xe_guc *guc)22812281+static int guc_submit_reset_prepare(struct xe_guc *guc)23082282{23092283 int ret;23102310-23112311- if (xe_gt_WARN_ON(guc_to_gt(guc), vf_recovery(guc)))23122312- return 0;23132313-23142314- if (!guc->submission_state.initialized)23152315- return 0;2316228423172285 /*23182286 * Using an atomic here rather than submission_state.lock as this···23232297 wake_up_all(&guc->ct.wq);2324229823252299 return ret;23002300+}23012301+23022302+int xe_guc_submit_reset_prepare(struct xe_guc *guc)23032303+{23042304+ if (xe_gt_WARN_ON(guc_to_gt(guc), vf_recovery(guc)))23052305+ return 0;23062306+23072307+ if (!guc->submission_state.initialized)23082308+ return 0;23092309+23102310+ return guc_submit_reset_prepare(guc);23262311}2327231223282313void xe_guc_submit_reset_wait(struct xe_guc *guc)···27322695 continue;2733269627342697 xe_sched_submission_start(sched);27352735- if (exec_queue_killed_or_banned_or_wedged(q))27362736- xe_guc_exec_queue_trigger_cleanup(q);26982698+ guc_exec_queue_kill(q);27372699 }27382700 mutex_unlock(&guc->submission_state.lock);27392701}
+2-2
drivers/gpu/drm/xe/xe_lrc.c
···24132413 * @lrc: Pointer to the lrc.24142414 *24152415 * Return latest ctx timestamp. With support for active contexts, the24162416- * calculation may bb slightly racy, so follow a read-again logic to ensure that24162416+ * calculation may be slightly racy, so follow a read-again logic to ensure that24172417 * the context is still active before returning the right timestamp.24182418 *24192419 * Returns: New ctx timestamp value24202420 */24212421u64 xe_lrc_timestamp(struct xe_lrc *lrc)24222422{24232423- u64 lrc_ts, reg_ts, new_ts;24232423+ u64 lrc_ts, reg_ts, new_ts = lrc->ctx_timestamp;24242424 u32 engine_id;2425242524262426 lrc_ts = xe_lrc_ctx_timestamp(lrc);
+5-2
drivers/gpu/drm/xe/xe_oa.c
···543543 size_t offset = 0;544544 int ret;545545546546- /* Can't read from disabled streams */547547- if (!stream->enabled || !stream->sample)546546+ if (!stream->sample)548547 return -EINVAL;549548550549 if (!(file->f_flags & O_NONBLOCK)) {···1459146014601461 if (stream->sample)14611462 hrtimer_cancel(&stream->poll_check_timer);14631463+14641464+ /* Update stream->oa_buffer.tail to allow any final reports to be read */14651465+ if (xe_oa_buffer_check_unlocked(stream))14661466+ wake_up(&stream->poll_wq);14621467}1463146814641469static int xe_oa_enable_preempt_timeslice(struct xe_oa_stream *stream)
+29-9
drivers/gpu/drm/xe/xe_pt.c
···16551655 XE_WARN_ON(!level);16561656 /* Check for leaf node */16571657 if (xe_walk->prl && xe_page_reclaim_list_valid(xe_walk->prl) &&16581658- (!xe_child->base.children || !xe_child->base.children[first])) {16581658+ xe_child->level <= MAX_HUGEPTE_LEVEL) {16591659 struct iosys_map *leaf_map = &xe_child->bo->vmap;16601660 pgoff_t count = xe_pt_num_entries(addr, next, xe_child->level, walk);1661166116621662 for (pgoff_t i = 0; i < count; i++) {16631663- u64 pte = xe_map_rd(xe, leaf_map, (first + i) * sizeof(u64), u64);16631663+ u64 pte;16641664 int ret;16651665+16661666+ /*16671667+ * If not a leaf pt, skip unless non-leaf pt is interleaved between16681668+ * leaf ptes which causes the page walk to skip over the child leaves16691669+ */16701670+ if (xe_child->base.children && xe_child->base.children[first + i]) {16711671+ u64 pt_size = 1ULL << walk->shifts[xe_child->level];16721672+ bool edge_pt = (i == 0 && !IS_ALIGNED(addr, pt_size)) ||16731673+ (i == count - 1 && !IS_ALIGNED(next, pt_size));16741674+16751675+ if (!edge_pt) {16761676+ xe_page_reclaim_list_abort(xe_walk->tile->primary_gt,16771677+ xe_walk->prl,16781678+ "PT is skipped by walk at level=%u offset=%lu",16791679+ xe_child->level, first + i);16801680+ break;16811681+ }16821682+ continue;16831683+ }16841684+16851685+ pte = xe_map_rd(xe, leaf_map, (first + i) * sizeof(u64), u64);1665168616661687 /*16671688 * In rare scenarios, pte may not be written yet due to racy conditions.···16951674 }1696167516971676 /* Ensure it is a defined page */16981698- xe_tile_assert(xe_walk->tile,16991699- xe_child->level == 0 ||17001700- (pte & (XE_PTE_PS64 | XE_PDE_PS_2M | XE_PDPE_PS_1G)));16771677+ xe_tile_assert(xe_walk->tile, xe_child->level == 0 ||16781678+ (pte & (XE_PDE_PS_2M | XE_PDPE_PS_1G)));1701167917021680 /* An entry should be added for 64KB but contigious 4K have XE_PTE_PS64 */17031681 if (pte & XE_PTE_PS64)···17211701 killed = xe_pt_check_kill(addr, next, level - 1, xe_child, action, walk);1722170217231703 /*17241724- * Verify PRL is active and if entry is not a leaf pte (base.children conditions),17251725- * there is a potential need to invalidate the PRL if any PTE (num_live) are dropped.17041704+ * Verify if any PTE are potentially dropped at non-leaf levels, either from being17051705+ * killed or the page walk covers the region.17261706 */17271727- if (xe_walk->prl && level > 1 && xe_child->num_live &&17281728- xe_child->base.children && xe_child->base.children[first]) {17071707+ if (xe_walk->prl && xe_page_reclaim_list_valid(xe_walk->prl) &&17081708+ xe_child->level > MAX_HUGEPTE_LEVEL && xe_child->num_live) {17291709 bool covered = xe_pt_covers(addr, next, xe_child->level, &xe_walk->base);1730171017311711 /*
+2
drivers/hid/bpf/hid_bpf_dispatch.c
···444444 (u64)(long)ctx,445445 true); /* prevent infinite recursions */446446447447+ if (ret > size)448448+ ret = size;447449 if (ret > 0)448450 memcpy(buf, dma_data, ret);449451
···20572057 rsize = max_buffer_size;2058205820592059 if (csize < rsize) {20602060- dbg_hid("report %d is too short, (%d < %d)\n", report->id,20612061- csize, rsize);20622062- memset(cdata + csize, 0, rsize - csize);20602060+ hid_warn_ratelimited(hid, "Event data for report %d was too short (%d vs %d)\n",20612061+ report->id, rsize, csize);20622062+ ret = -EINVAL;20632063+ goto out;20632064 }2064206520652066 if ((hid->claimed & HID_CLAIMED_HIDDEV) && hid->hiddev_report_event)
···354354#define HID_BATTERY_QUIRK_FEATURE (1 << 1) /* ask for feature report */355355#define HID_BATTERY_QUIRK_IGNORE (1 << 2) /* completely ignore the battery */356356#define HID_BATTERY_QUIRK_AVOID_QUERY (1 << 3) /* do not query the battery */357357+#define HID_BATTERY_QUIRK_DYNAMIC (1 << 4) /* report present only after life signs */357358358359static const struct hid_device_id hid_battery_quirks[] = {359360 { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE,···387386 { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_LOGITECH,388387 USB_DEVICE_ID_LOGITECH_DINOVO_EDGE_KBD),389388 HID_BATTERY_QUIRK_IGNORE },390390- { HID_USB_DEVICE(USB_VENDOR_ID_ELAN, USB_DEVICE_ID_ASUS_UX550_TOUCHSCREEN),391391- HID_BATTERY_QUIRK_IGNORE },392392- { HID_USB_DEVICE(USB_VENDOR_ID_ELAN, USB_DEVICE_ID_ASUS_UX550VE_TOUCHSCREEN),393393- HID_BATTERY_QUIRK_IGNORE },394389 { HID_USB_DEVICE(USB_VENDOR_ID_UGEE, USB_DEVICE_ID_UGEE_XPPEN_TABLET_DECO_L),395390 HID_BATTERY_QUIRK_AVOID_QUERY },396391 { HID_USB_DEVICE(USB_VENDOR_ID_UGEE, USB_DEVICE_ID_UGEE_XPPEN_TABLET_DECO_PRO_MW),···399402 * Elan HID touchscreens seem to all report a non present battery,400403 * set HID_BATTERY_QUIRK_IGNORE for all Elan I2C and USB HID devices.401404 */402402- { HID_I2C_DEVICE(USB_VENDOR_ID_ELAN, HID_ANY_ID), HID_BATTERY_QUIRK_IGNORE },403403- { HID_USB_DEVICE(USB_VENDOR_ID_ELAN, HID_ANY_ID), HID_BATTERY_QUIRK_IGNORE },405405+ { HID_I2C_DEVICE(USB_VENDOR_ID_ELAN, HID_ANY_ID), HID_BATTERY_QUIRK_DYNAMIC },406406+ { HID_USB_DEVICE(USB_VENDOR_ID_ELAN, HID_ANY_ID), HID_BATTERY_QUIRK_DYNAMIC },404407 {}405408};406409···457460 int ret = 0;458461459462 switch (prop) {460460- case POWER_SUPPLY_PROP_PRESENT:461463 case POWER_SUPPLY_PROP_ONLINE:462464 val->intval = 1;465465+ break;466466+467467+ case POWER_SUPPLY_PROP_PRESENT:468468+ val->intval = dev->battery_present;463469 break;464470465471 case POWER_SUPPLY_PROP_CAPACITY:···577577 if (quirks & HID_BATTERY_QUIRK_AVOID_QUERY)578578 dev->battery_avoid_query = true;579579580580+ dev->battery_present = (quirks & HID_BATTERY_QUIRK_DYNAMIC) ? false : true;581581+580582 dev->battery = power_supply_register(&dev->dev, psy_desc, &psy_cfg);581583 if (IS_ERR(dev->battery)) {582584 error = PTR_ERR(dev->battery);···634632 return;635633636634 if (hidinput_update_battery_charge_status(dev, usage, value)) {635635+ dev->battery_present = true;637636 power_supply_changed(dev->battery);638637 return;639638 }···650647 if (dev->battery_status != HID_BATTERY_REPORTED ||651648 capacity != dev->battery_capacity ||652649 ktime_after(ktime_get_coarse(), dev->battery_ratelimit_time)) {650650+ dev->battery_present = true;653651 dev->battery_capacity = capacity;654652 dev->battery_status = HID_BATTERY_REPORTED;655653 dev->battery_ratelimit_time =
+5-1
drivers/hid/hid-logitech-hidpp.c
···44874487 if (!ret)44884488 ret = hidpp_ff_init(hidpp, &data);4489448944904490- if (ret)44904490+ if (ret) {44914491 hid_warn(hidpp->hid_dev,44924492 "Unable to initialize force feedback support, errno %d\n",44934493 ret);44944494+ ret = 0;44954495+ }44944496 }4495449744964498 /*···46704668 HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_LOGITECH, 0xb038) },46714669 { /* Slim Solar+ K980 Keyboard over Bluetooth */46724670 HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_LOGITECH, 0xb391) },46714671+ { /* MX Master 4 mouse over Bluetooth */46724672+ HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_LOGITECH, 0xb042) },46734673 {}46744674};46754675
+7
drivers/hid/hid-multitouch.c
···526526 dev_warn(&hdev->dev, "failed to fetch feature %d\n",527527 report->id);528528 } else {529529+ /* The report ID in the request and the response should match */530530+ if (report->id != buf[0]) {531531+ hid_err(hdev, "Returned feature report did not match the request\n");532532+ goto free;533533+ }534534+529535 ret = hid_report_raw_event(hdev, HID_FEATURE_REPORT, buf,530536 size, 0);531537 if (ret)532538 dev_warn(&hdev->dev, "failed to report feature\n");533539 }534540541541+free:535542 kfree(buf);536543}537544
···118118 hid->product = le16_to_cpu(qsdev->dev_desc.product_id);119119 snprintf(hid->name, sizeof(hid->name), "%s %04X:%04X", "quickspi-hid",120120 hid->vendor, hid->product);121121+ strscpy(hid->phys, dev_name(qsdev->dev), sizeof(hid->phys));121122122123 ret = hid_add_device(hid);123124 if (ret) {
+10
drivers/hid/wacom_wac.c
···1208120812091209 switch (data[0]) {12101210 case 0x04:12111211+ if (len < 32) {12121212+ dev_warn(wacom->pen_input->dev.parent,12131213+ "Report 0x04 too short: %zu bytes\n", len);12141214+ break;12151215+ }12111216 wacom_intuos_bt_process_data(wacom, data + i);12121217 i += 10;12131218 fallthrough;12141219 case 0x03:12201220+ if (i == 1 && len < 22) {12211221+ dev_warn(wacom->pen_input->dev.parent,12221222+ "Report 0x03 too short: %zu bytes\n", len);12231223+ break;12241224+ }12151225 wacom_intuos_bt_process_data(wacom, data + i);12161226 i += 10;12171227 wacom_intuos_bt_process_data(wacom, data + i);
+4-2
drivers/hv/mshv_regions.c
···314314 ret = pin_user_pages_fast(userspace_addr, nr_pages,315315 FOLL_WRITE | FOLL_LONGTERM,316316 pages);317317- if (ret < 0)317317+ if (ret != nr_pages)318318 goto release_pages;319319 }320320321321 return 0;322322323323release_pages:324324+ if (ret > 0)325325+ done_count += ret;324326 mshv_region_invalidate_pages(region, 0, done_count);325325- return ret;327327+ return ret < 0 ? ret : -ENOMEM;326328}327329328330static int mshv_region_chunk_unmap(struct mshv_mem_region *region,
···120120 HVCALL_SET_VP_REGISTERS,121121 HVCALL_TRANSLATE_VIRTUAL_ADDRESS,122122 HVCALL_CLEAR_VIRTUAL_INTERRUPT,123123- HVCALL_SCRUB_PARTITION,124123 HVCALL_REGISTER_INTERCEPT_RESULT,125124 HVCALL_ASSERT_VIRTUAL_INTERRUPT,126125 HVCALL_GET_GPA_PAGES_ACCESS_STATES,···12881289 */12891290static long12901291mshv_map_user_memory(struct mshv_partition *partition,12911291- struct mshv_user_mem_region mem)12921292+ struct mshv_user_mem_region *mem)12921293{12931294 struct mshv_mem_region *region;12941295 struct vm_area_struct *vma;···12961297 ulong mmio_pfn;12971298 long ret;1298129912991299- if (mem.flags & BIT(MSHV_SET_MEM_BIT_UNMAP) ||13001300- !access_ok((const void __user *)mem.userspace_addr, mem.size))13001300+ if (mem->flags & BIT(MSHV_SET_MEM_BIT_UNMAP) ||13011301+ !access_ok((const void __user *)mem->userspace_addr, mem->size))13011302 return -EINVAL;1302130313031304 mmap_read_lock(current->mm);13041304- vma = vma_lookup(current->mm, mem.userspace_addr);13051305+ vma = vma_lookup(current->mm, mem->userspace_addr);13051306 is_mmio = vma ? !!(vma->vm_flags & (VM_IO | VM_PFNMAP)) : 0;13061307 mmio_pfn = is_mmio ? vma->vm_pgoff : 0;13071308 mmap_read_unlock(current->mm);···13091310 if (!vma)13101311 return -EINVAL;1311131213121312- ret = mshv_partition_create_region(partition, &mem, ®ion,13131313+ ret = mshv_partition_create_region(partition, mem, ®ion,13131314 is_mmio);13141315 if (ret)13151316 return ret;···13471348 return 0;1348134913491350errout:13501350- vfree(region);13511351+ mshv_region_put(region);13511352 return ret;13521353}1353135413541355/* Called for unmapping both the guest ram and the mmio space */13551356static long13561357mshv_unmap_user_memory(struct mshv_partition *partition,13571357- struct mshv_user_mem_region mem)13581358+ struct mshv_user_mem_region *mem)13581359{13591360 struct mshv_mem_region *region;1360136113611361- if (!(mem.flags & BIT(MSHV_SET_MEM_BIT_UNMAP)))13621362+ if (!(mem->flags & BIT(MSHV_SET_MEM_BIT_UNMAP)))13621363 return -EINVAL;1363136413641365 spin_lock(&partition->pt_mem_regions_lock);1365136613661366- region = mshv_partition_region_by_gfn(partition, mem.guest_pfn);13671367+ region = mshv_partition_region_by_gfn(partition, mem->guest_pfn);13671368 if (!region) {13681369 spin_unlock(&partition->pt_mem_regions_lock);13691370 return -ENOENT;13701371 }1371137213721373 /* Paranoia check */13731373- if (region->start_uaddr != mem.userspace_addr ||13741374- region->start_gfn != mem.guest_pfn ||13751375- region->nr_pages != HVPFN_DOWN(mem.size)) {13741374+ if (region->start_uaddr != mem->userspace_addr ||13751375+ region->start_gfn != mem->guest_pfn ||13761376+ region->nr_pages != HVPFN_DOWN(mem->size)) {13761377 spin_unlock(&partition->pt_mem_regions_lock);13771378 return -EINVAL;13781379 }···14031404 return -EINVAL;1404140514051406 if (mem.flags & BIT(MSHV_SET_MEM_BIT_UNMAP))14061406- return mshv_unmap_user_memory(partition, mem);14071407+ return mshv_unmap_user_memory(partition, &mem);1407140814081408- return mshv_map_user_memory(partition, mem);14091409+ return mshv_map_user_memory(partition, &mem);14091410}1410141114111412static long···20632064 return 0;20642065}2065206620662066-static int mshv_cpuhp_online;20672067static int mshv_root_sched_online;2068206820692069static const char *scheduler_type_to_string(enum hv_scheduler_type type)···22472249 free_percpu(root_scheduler_output);22482250}2249225122502250-static int mshv_reboot_notify(struct notifier_block *nb,22512251- unsigned long code, void *unused)22522252-{22532253- cpuhp_remove_state(mshv_cpuhp_online);22542254- return 0;22552255-}22562256-22572257-struct notifier_block mshv_reboot_nb = {22582258- .notifier_call = mshv_reboot_notify,22592259-};22602260-22612261-static void mshv_root_partition_exit(void)22622262-{22632263- unregister_reboot_notifier(&mshv_reboot_nb);22642264-}22652265-22662266-static int __init mshv_root_partition_init(struct device *dev)22672267-{22682268- return register_reboot_notifier(&mshv_reboot_nb);22692269-}22702270-22712252static int __init mshv_init_vmm_caps(struct device *dev)22722253{22732254 int ret;···22912314 MSHV_HV_MAX_VERSION);22922315 }2293231622942294- mshv_root.synic_pages = alloc_percpu(struct hv_synic_pages);22952295- if (!mshv_root.synic_pages) {22962296- dev_err(dev, "Failed to allocate percpu synic page\n");22972297- ret = -ENOMEM;23172317+ ret = mshv_synic_init(dev);23182318+ if (ret)22982319 goto device_deregister;22992299- }23002300-23012301- ret = cpuhp_setup_state(CPUHP_AP_ONLINE_DYN, "mshv_synic",23022302- mshv_synic_init,23032303- mshv_synic_cleanup);23042304- if (ret < 0) {23052305- dev_err(dev, "Failed to setup cpu hotplug state: %i\n", ret);23062306- goto free_synic_pages;23072307- }23082308-23092309- mshv_cpuhp_online = ret;2310232023112321 ret = mshv_init_vmm_caps(dev);23122322 if (ret)23132313- goto remove_cpu_state;23232323+ goto synic_cleanup;2314232423152325 ret = mshv_retrieve_scheduler_type(dev);23162326 if (ret)23172317- goto remove_cpu_state;23182318-23192319- if (hv_root_partition())23202320- ret = mshv_root_partition_init(dev);23212321- if (ret)23222322- goto remove_cpu_state;23272327+ goto synic_cleanup;2323232823242329 ret = root_scheduler_init(dev);23252330 if (ret)23262326- goto exit_partition;23312331+ goto synic_cleanup;2327233223282333 ret = mshv_debugfs_init();23292334 if (ret)···23262367 mshv_debugfs_exit();23272368deinit_root_scheduler:23282369 root_scheduler_deinit();23292329-exit_partition:23302330- if (hv_root_partition())23312331- mshv_root_partition_exit();23322332-remove_cpu_state:23332333- cpuhp_remove_state(mshv_cpuhp_online);23342334-free_synic_pages:23352335- free_percpu(mshv_root.synic_pages);23702370+synic_cleanup:23712371+ mshv_synic_exit();23362372device_deregister:23372373 misc_deregister(&mshv_dev);23382374 return ret;···23412387 misc_deregister(&mshv_dev);23422388 mshv_irqfd_wq_cleanup();23432389 root_scheduler_deinit();23442344- if (hv_root_partition())23452345- mshv_root_partition_exit();23462346- cpuhp_remove_state(mshv_cpuhp_online);23472347- free_percpu(mshv_root.synic_pages);23902390+ mshv_synic_exit();23482391}2349239223502393module_init(mshv_parent_partition_init);
+173-15
drivers/hv/mshv_synic.c
···1010#include <linux/kernel.h>1111#include <linux/slab.h>1212#include <linux/mm.h>1313+#include <linux/interrupt.h>1314#include <linux/io.h>1415#include <linux/random.h>1616+#include <linux/cpuhotplug.h>1717+#include <linux/reboot.h>1518#include <asm/mshyperv.h>1919+#include <linux/acpi.h>16201721#include "mshv_eventfd.h"1822#include "mshv.h"2323+2424+static int synic_cpuhp_online;2525+static struct hv_synic_pages __percpu *synic_pages;2626+static int mshv_sint_vector = -1; /* hwirq for the SynIC SINTs */2727+static int mshv_sint_irq = -1; /* Linux IRQ for mshv_sint_vector */19282029static u32 synic_event_ring_get_queued_port(u32 sint_index)2130{···3526 u32 message;3627 u8 tail;37283838- spages = this_cpu_ptr(mshv_root.synic_pages);2929+ spages = this_cpu_ptr(synic_pages);3930 event_ring_page = &spages->synic_event_ring_page;4031 synic_eventring_tail = (u8 **)this_cpu_ptr(hv_synic_eventring_tail);4132···402393403394void mshv_isr(void)404395{405405- struct hv_synic_pages *spages = this_cpu_ptr(mshv_root.synic_pages);396396+ struct hv_synic_pages *spages = this_cpu_ptr(synic_pages);406397 struct hv_message_page **msg_page = &spages->hyp_synic_message_page;407398 struct hv_message *msg;408399 bool handled;···446437 if (msg->header.message_flags.msg_pending)447438 hv_set_non_nested_msr(HV_MSR_EOM, 0);448439449449-#ifdef HYPERVISOR_CALLBACK_VECTOR450450- add_interrupt_randomness(HYPERVISOR_CALLBACK_VECTOR);451451-#endif440440+ add_interrupt_randomness(mshv_sint_vector);452441 } else {453442 pr_warn_once("%s: unknown message type 0x%x\n", __func__,454443 msg->header.message_type);455444 }456445}457446458458-int mshv_synic_init(unsigned int cpu)447447+static int mshv_synic_cpu_init(unsigned int cpu)459448{460449 union hv_synic_simp simp;461450 union hv_synic_siefp siefp;462451 union hv_synic_sirbp sirbp;463463-#ifdef HYPERVISOR_CALLBACK_VECTOR464452 union hv_synic_sint sint;465465-#endif466453 union hv_synic_scontrol sctrl;467467- struct hv_synic_pages *spages = this_cpu_ptr(mshv_root.synic_pages);454454+ struct hv_synic_pages *spages = this_cpu_ptr(synic_pages);468455 struct hv_message_page **msg_page = &spages->hyp_synic_message_page;469456 struct hv_synic_event_flags_page **event_flags_page =470457 &spages->synic_event_flags_page;···501496502497 hv_set_non_nested_msr(HV_MSR_SIRBP, sirbp.as_uint64);503498504504-#ifdef HYPERVISOR_CALLBACK_VECTOR499499+ if (mshv_sint_irq != -1)500500+ enable_percpu_irq(mshv_sint_irq, 0);501501+505502 /* Enable intercepts */506503 sint.as_uint64 = 0;507507- sint.vector = HYPERVISOR_CALLBACK_VECTOR;504504+ sint.vector = mshv_sint_vector;508505 sint.masked = false;509506 sint.auto_eoi = hv_recommend_using_aeoi();510507 hv_set_non_nested_msr(HV_MSR_SINT0 + HV_SYNIC_INTERCEPTION_SINT_INDEX,···514507515508 /* Doorbell SINT */516509 sint.as_uint64 = 0;517517- sint.vector = HYPERVISOR_CALLBACK_VECTOR;510510+ sint.vector = mshv_sint_vector;518511 sint.masked = false;519512 sint.as_intercept = 1;520513 sint.auto_eoi = hv_recommend_using_aeoi();521514 hv_set_non_nested_msr(HV_MSR_SINT0 + HV_SYNIC_DOORBELL_SINT_INDEX,522515 sint.as_uint64);523523-#endif524516525517 /* Enable global synic bit */526518 sctrl.as_uint64 = hv_get_non_nested_msr(HV_MSR_SCONTROL);···548542 return -EFAULT;549543}550544551551-int mshv_synic_cleanup(unsigned int cpu)545545+static int mshv_synic_cpu_exit(unsigned int cpu)552546{553547 union hv_synic_sint sint;554548 union hv_synic_simp simp;555549 union hv_synic_siefp siefp;556550 union hv_synic_sirbp sirbp;557551 union hv_synic_scontrol sctrl;558558- struct hv_synic_pages *spages = this_cpu_ptr(mshv_root.synic_pages);552552+ struct hv_synic_pages *spages = this_cpu_ptr(synic_pages);559553 struct hv_message_page **msg_page = &spages->hyp_synic_message_page;560554 struct hv_synic_event_flags_page **event_flags_page =561555 &spages->synic_event_flags_page;···573567 sint.masked = true;574568 hv_set_non_nested_msr(HV_MSR_SINT0 + HV_SYNIC_DOORBELL_SINT_INDEX,575569 sint.as_uint64);570570+571571+ if (mshv_sint_irq != -1)572572+ disable_percpu_irq(mshv_sint_irq);576573577574 /* Disable Synic's event ring page */578575 sirbp.as_uint64 = hv_get_non_nested_msr(HV_MSR_SIRBP);···671662 hv_call_delete_port(hv_current_partition_id, port_id);672663673664 mshv_portid_free(doorbell_portid);665665+}666666+667667+static int mshv_synic_reboot_notify(struct notifier_block *nb,668668+ unsigned long code, void *unused)669669+{670670+ if (!hv_root_partition())671671+ return 0;672672+673673+ cpuhp_remove_state(synic_cpuhp_online);674674+ return 0;675675+}676676+677677+static struct notifier_block mshv_synic_reboot_nb = {678678+ .notifier_call = mshv_synic_reboot_notify,679679+};680680+681681+#ifndef HYPERVISOR_CALLBACK_VECTOR682682+static DEFINE_PER_CPU(long, mshv_evt);683683+684684+static irqreturn_t mshv_percpu_isr(int irq, void *dev_id)685685+{686686+ mshv_isr();687687+ return IRQ_HANDLED;688688+}689689+690690+#ifdef CONFIG_ACPI691691+static int __init mshv_acpi_setup_sint_irq(void)692692+{693693+ return acpi_register_gsi(NULL, mshv_sint_vector, ACPI_EDGE_SENSITIVE,694694+ ACPI_ACTIVE_HIGH);695695+}696696+697697+static void mshv_acpi_cleanup_sint_irq(void)698698+{699699+ acpi_unregister_gsi(mshv_sint_vector);700700+}701701+#else702702+static int __init mshv_acpi_setup_sint_irq(void)703703+{704704+ return -ENODEV;705705+}706706+707707+static void mshv_acpi_cleanup_sint_irq(void)708708+{709709+}710710+#endif711711+712712+static int __init mshv_sint_vector_setup(void)713713+{714714+ int ret;715715+ struct hv_register_assoc reg = {716716+ .name = HV_ARM64_REGISTER_SINT_RESERVED_INTERRUPT_ID,717717+ };718718+ union hv_input_vtl input_vtl = { 0 };719719+720720+ if (acpi_disabled)721721+ return -ENODEV;722722+723723+ ret = hv_call_get_vp_registers(HV_VP_INDEX_SELF, HV_PARTITION_ID_SELF,724724+ 1, input_vtl, ®);725725+ if (ret || !reg.value.reg64)726726+ return -ENODEV;727727+728728+ mshv_sint_vector = reg.value.reg64;729729+ ret = mshv_acpi_setup_sint_irq();730730+ if (ret < 0) {731731+ pr_err("Failed to setup IRQ for MSHV SINT vector %d: %d\n",732732+ mshv_sint_vector, ret);733733+ goto out_fail;734734+ }735735+736736+ mshv_sint_irq = ret;737737+738738+ ret = request_percpu_irq(mshv_sint_irq, mshv_percpu_isr, "MSHV",739739+ &mshv_evt);740740+ if (ret)741741+ goto out_unregister;742742+743743+ return 0;744744+745745+out_unregister:746746+ mshv_acpi_cleanup_sint_irq();747747+out_fail:748748+ return ret;749749+}750750+751751+static void mshv_sint_vector_cleanup(void)752752+{753753+ free_percpu_irq(mshv_sint_irq, &mshv_evt);754754+ mshv_acpi_cleanup_sint_irq();755755+}756756+#else /* !HYPERVISOR_CALLBACK_VECTOR */757757+static int __init mshv_sint_vector_setup(void)758758+{759759+ mshv_sint_vector = HYPERVISOR_CALLBACK_VECTOR;760760+ return 0;761761+}762762+763763+static void mshv_sint_vector_cleanup(void)764764+{765765+}766766+#endif /* HYPERVISOR_CALLBACK_VECTOR */767767+768768+int __init mshv_synic_init(struct device *dev)769769+{770770+ int ret = 0;771771+772772+ ret = mshv_sint_vector_setup();773773+ if (ret)774774+ return ret;775775+776776+ synic_pages = alloc_percpu(struct hv_synic_pages);777777+ if (!synic_pages) {778778+ dev_err(dev, "Failed to allocate percpu synic page\n");779779+ ret = -ENOMEM;780780+ goto sint_vector_cleanup;781781+ }782782+783783+ ret = cpuhp_setup_state(CPUHP_AP_ONLINE_DYN, "mshv_synic",784784+ mshv_synic_cpu_init,785785+ mshv_synic_cpu_exit);786786+ if (ret < 0) {787787+ dev_err(dev, "Failed to setup cpu hotplug state: %i\n", ret);788788+ goto free_synic_pages;789789+ }790790+791791+ synic_cpuhp_online = ret;792792+793793+ ret = register_reboot_notifier(&mshv_synic_reboot_nb);794794+ if (ret)795795+ goto remove_cpuhp_state;796796+797797+ return 0;798798+799799+remove_cpuhp_state:800800+ cpuhp_remove_state(synic_cpuhp_online);801801+free_synic_pages:802802+ free_percpu(synic_pages);803803+sint_vector_cleanup:804804+ mshv_sint_vector_cleanup();805805+ return ret;806806+}807807+808808+void mshv_synic_exit(void)809809+{810810+ unregister_reboot_notifier(&mshv_synic_reboot_nb);811811+ cpuhp_remove_state(synic_cpuhp_online);812812+ free_percpu(synic_pages);813813+ mshv_sint_vector_cleanup();674814}
+1-1
drivers/hwmon/axi-fan-control.c
···507507 ret = devm_request_threaded_irq(&pdev->dev, ctl->irq, NULL,508508 axi_fan_control_irq_handler,509509 IRQF_ONESHOT | IRQF_TRIGGER_HIGH,510510- pdev->driver_override, ctl);510510+ NULL, ctl);511511 if (ret)512512 return dev_err_probe(&pdev->dev, ret,513513 "failed to request an irq\n");
+5-5
drivers/hwmon/max6639.c
···232232static int max6639_set_ppr(struct max6639_data *data, int channel, u8 ppr)233233{234234 /* Decrement the PPR value and shift left by 6 to match the register format */235235- return regmap_write(data->regmap, MAX6639_REG_FAN_PPR(channel), ppr-- << 6);235235+ return regmap_write(data->regmap, MAX6639_REG_FAN_PPR(channel), --ppr << 6);236236}237237238238static int max6639_write_fan(struct device *dev, u32 attr, int channel,···524524525525{526526 struct device *dev = &client->dev;527527- u32 i;528528- int err, val;527527+ u32 i, val;528528+ int err;529529530530 err = of_property_read_u32(child, "reg", &i);531531 if (err) {···540540541541 err = of_property_read_u32(child, "pulses-per-revolution", &val);542542 if (!err) {543543- if (val < 1 || val > 5) {544544- dev_err(dev, "invalid pulses-per-revolution %d of %pOFn\n", val, child);543543+ if (val < 1 || val > 4) {544544+ dev_err(dev, "invalid pulses-per-revolution %u of %pOFn\n", val, child);545545 return -EINVAL;546546 }547547 data->ppr[i] = val;
+2
drivers/hwmon/pmbus/hac300s.c
···5858 case PMBUS_MFR_VOUT_MIN:5959 case PMBUS_READ_VOUT:6060 rv = pmbus_read_word_data(client, page, phase, reg);6161+ if (rv < 0)6262+ return rv;6163 return FIELD_GET(LINEAR11_MANTISSA_MASK, rv);6264 default:6365 return -ENODATA;
+2
drivers/hwmon/pmbus/ina233.c
···6767 switch (reg) {6868 case PMBUS_VIRT_READ_VMON:6969 ret = pmbus_read_word_data(client, 0, 0xff, MFR_READ_VSHUNT);7070+ if (ret < 0)7171+ return ret;70727173 /* Adjust returned value to match VIN coefficients */7274 /* VIN: 1.25 mV VSHUNT: 2.5 uV LSB */
···165165{166166 const struct pmbus_driver_info *info = pmbus_get_driver_info(client);167167 struct mp2869_data *data = to_mp2869_data(info);168168- int ret;168168+ int ret, mfr;169169170170 switch (reg) {171171 case PMBUS_VOUT_MODE:···188188 if (ret < 0)189189 return ret;190190191191+ mfr = pmbus_read_byte_data(client, page,192192+ PMBUS_STATUS_MFR_SPECIFIC);193193+ if (mfr < 0)194194+ return mfr;195195+191196 ret = (ret & ~GENMASK(2, 2)) |192197 FIELD_PREP(GENMASK(2, 2),193193- FIELD_GET(GENMASK(1, 1),194194- pmbus_read_byte_data(client, page,195195- PMBUS_STATUS_MFR_SPECIFIC)));198198+ FIELD_GET(GENMASK(1, 1), mfr));196199 break;197200 case PMBUS_STATUS_TEMPERATURE:198201 /*···210207 if (ret < 0)211208 return ret;212209210210+ mfr = pmbus_read_byte_data(client, page,211211+ PMBUS_STATUS_MFR_SPECIFIC);212212+ if (mfr < 0)213213+ return mfr;214214+213215 ret = (ret & ~GENMASK(7, 6)) |214216 FIELD_PREP(GENMASK(6, 6),215215- FIELD_GET(GENMASK(1, 1),216216- pmbus_read_byte_data(client, page,217217- PMBUS_STATUS_MFR_SPECIFIC))) |217217+ FIELD_GET(GENMASK(1, 1), mfr)) |218218 FIELD_PREP(GENMASK(7, 7),219219- FIELD_GET(GENMASK(1, 1),220220- pmbus_read_byte_data(client, page,221221- PMBUS_STATUS_MFR_SPECIFIC)));219219+ FIELD_GET(GENMASK(1, 1), mfr));222220 break;223221 default:224222 ret = -ENODATA;···234230{235231 const struct pmbus_driver_info *info = pmbus_get_driver_info(client);236232 struct mp2869_data *data = to_mp2869_data(info);237237- int ret;233233+ int ret, mfr;238234239235 switch (reg) {240236 case PMBUS_STATUS_WORD:···250246 if (ret < 0)251247 return ret;252248249249+ mfr = pmbus_read_byte_data(client, page,250250+ PMBUS_STATUS_MFR_SPECIFIC);251251+ if (mfr < 0)252252+ return mfr;253253+253254 ret = (ret & ~GENMASK(2, 2)) |254255 FIELD_PREP(GENMASK(2, 2),255255- FIELD_GET(GENMASK(1, 1),256256- pmbus_read_byte_data(client, page,257257- PMBUS_STATUS_MFR_SPECIFIC)));256256+ FIELD_GET(GENMASK(1, 1), mfr));258257 break;259258 case PMBUS_READ_VIN:260259 /*
+2
drivers/hwmon/pmbus/mp2975.c
···313313 case PMBUS_STATUS_WORD:314314 /* MP2973 & MP2971 return PGOOD instead of PB_STATUS_POWER_GOOD_N. */315315 ret = pmbus_read_word_data(client, page, phase, reg);316316+ if (ret < 0)317317+ return ret;316318 ret ^= PB_STATUS_POWER_GOOD_N;317319 break;318320 case PMBUS_OT_FAULT_LIMIT:
+2
drivers/i2c/busses/Kconfig
···12131213 tristate "NVIDIA Tegra internal I2C controller"12141214 depends on ARCH_TEGRA || (COMPILE_TEST && (ARC || ARM || ARM64 || M68K || RISCV || SUPERH || SPARC))12151215 # COMPILE_TEST needs architectures with readsX()/writesX() primitives12161216+ depends on PINCTRL12171217+ # ARCH_TEGRA implies PINCTRL, but the COMPILE_TEST side doesn't.12161218 help12171219 If you say yes to this option, support will be included for the12181220 I2C controller embedded in NVIDIA Tegra SOCs
+3
drivers/i2c/busses/i2c-cp2615.c
···298298 if (!adap)299299 return -ENOMEM;300300301301+ if (!usbdev->serial)302302+ return -EINVAL;303303+301304 strscpy(adap->name, usbdev->serial, sizeof(adap->name));302305 adap->owner = THIS_MODULE;303306 adap->dev.parent = &usbif->dev;
+1
drivers/i2c/busses/i2c-fsi.c
···729729 rc = i2c_add_adapter(&port->adapter);730730 if (rc < 0) {731731 dev_err(dev, "Failed to register adapter: %d\n", rc);732732+ of_node_put(np);732733 kfree(port);733734 continue;734735 }
+16-1
drivers/i2c/busses/i2c-pxa.c
···268268 struct pinctrl *pinctrl;269269 struct pinctrl_state *pinctrl_default;270270 struct pinctrl_state *pinctrl_recovery;271271+ bool reset_before_xfer;271272};272273273274#define _IBMR(i2c) ((i2c)->reg_ibmr)···11451144{11461145 struct pxa_i2c *i2c = adap->algo_data;1147114611471147+ if (i2c->reset_before_xfer) {11481148+ i2c_pxa_reset(i2c);11491149+ i2c->reset_before_xfer = false;11501150+ }11511151+11481152 return i2c_pxa_internal_xfer(i2c, msgs, num, i2c_pxa_do_xfer);11491153}11501154···15271521 }15281522 }1529152315301530- i2c_pxa_reset(i2c);15241524+ /*15251525+ * Skip reset on Armada 3700 when recovery is used to avoid15261526+ * controller hang due to the pinctrl state changes done by15271527+ * the generic recovery initialization code. The reset will15281528+ * be performed later, prior to the first transfer.15291529+ */15301530+ if (i2c_type == REGS_A3700 && i2c->adap.bus_recovery_info)15311531+ i2c->reset_before_xfer = true;15321532+ else15331533+ i2c_pxa_reset(i2c);1531153415321535 ret = i2c_add_numbered_adapter(&i2c->adap);15331536 if (ret < 0)
+4-1
drivers/i2c/busses/i2c-tegra.c
···20472047 *20482048 * VI I2C device shouldn't be marked as IRQ-safe because VI I2C won't20492049 * be used for atomic transfers. ACPI device is not IRQ safe also.20502050+ *20512051+ * Devices with pinctrl states cannot be marked IRQ-safe as the pinctrl20522052+ * state transitions during runtime PM require mutexes.20502053 */20512051- if (!IS_VI(i2c_dev) && !has_acpi_companion(i2c_dev->dev))20542054+ if (!IS_VI(i2c_dev) && !has_acpi_companion(i2c_dev->dev) && !i2c_dev->dev->pins)20522055 pm_runtime_irq_safe(i2c_dev->dev);2053205620542057 pm_runtime_enable(i2c_dev->dev);
+14-1
drivers/iommu/amd/iommu.c
···2909290929102910static struct protection_domain identity_domain;2911291129122912+static int amd_iommu_identity_attach(struct iommu_domain *dom, struct device *dev,29132913+ struct iommu_domain *old)29142914+{29152915+ /*29162916+ * Don't allow attaching a device to the identity domain if SNP is29172917+ * enabled.29182918+ */29192919+ if (amd_iommu_snp_en)29202920+ return -EINVAL;29212921+29222922+ return amd_iommu_attach_device(dom, dev, old);29232923+}29242924+29122925static const struct iommu_domain_ops identity_domain_ops = {29132913- .attach_dev = amd_iommu_attach_device,29262926+ .attach_dev = amd_iommu_identity_attach,29142927};2915292829162929void amd_iommu_init_identity_domain(void)
+1-2
drivers/iommu/intel/dmar.c
···13141314 if (fault & DMA_FSTS_ITE) {13151315 head = readl(iommu->reg + DMAR_IQH_REG);13161316 head = ((head >> shift) - 1 + QI_LENGTH) % QI_LENGTH;13171317- head |= 1;13181317 tail = readl(iommu->reg + DMAR_IQT_REG);13191318 tail = ((tail >> shift) - 1 + QI_LENGTH) % QI_LENGTH;13201319···13301331 do {13311332 if (qi->desc_status[head] == QI_IN_USE)13321333 qi->desc_status[head] = QI_ABORT;13331333- head = (head - 2 + QI_LENGTH) % QI_LENGTH;13341334+ head = (head - 1 + QI_LENGTH) % QI_LENGTH;13341335 } while (head != tail);1335133613361337 /*
+8-4
drivers/iommu/intel/svm.c
···164164 if (IS_ERR(dev_pasid))165165 return PTR_ERR(dev_pasid);166166167167- ret = iopf_for_domain_replace(domain, old, dev);168168- if (ret)169169- goto out_remove_dev_pasid;167167+ /* SVA with non-IOMMU/PRI IOPF handling is allowed. */168168+ if (info->pri_supported) {169169+ ret = iopf_for_domain_replace(domain, old, dev);170170+ if (ret)171171+ goto out_remove_dev_pasid;172172+ }170173171174 /* Setup the pasid table: */172175 sflags = cpu_feature_enabled(X86_FEATURE_LA57) ? PASID_FLAG_FL5LP : 0;···184181185182 return 0;186183out_unwind_iopf:187187- iopf_for_domain_replace(old, domain, dev);184184+ if (info->pri_supported)185185+ iopf_for_domain_replace(old, domain, dev);188186out_remove_dev_pasid:189187 domain_remove_dev_pasid(domain, dev, pasid);190188 return ret;
+6-6
drivers/iommu/iommu-sva.c
···182182 iommu_detach_device_pasid(domain, dev, iommu_mm->pasid);183183 if (--domain->users == 0) {184184 list_del(&domain->next);185185- iommu_domain_free(domain);186186- }185185+ if (list_empty(&iommu_mm->sva_domains)) {186186+ list_del(&iommu_mm->mm_list_elm);187187+ if (list_empty(&iommu_sva_mms))188188+ iommu_sva_present = false;189189+ }187190188188- if (list_empty(&iommu_mm->sva_domains)) {189189- list_del(&iommu_mm->mm_list_elm);190190- if (list_empty(&iommu_sva_mms))191191- iommu_sva_present = false;191191+ iommu_domain_free(domain);192192 }193193194194 mutex_unlock(&iommu_sva_lock);
+5-1
drivers/iommu/iommu.c
···12131213 if (addr == end)12141214 goto map_end;1215121512161216- phys_addr = iommu_iova_to_phys(domain, addr);12161216+ /*12171217+ * Return address by iommu_iova_to_phys for 0 is12181218+ * ambiguous. Offset to address 1 if addr is 0.12191219+ */12201220+ phys_addr = iommu_iova_to_phys(domain, addr ? addr : 1);12171221 if (!phys_addr) {12181222 map_size += pg_size;12191223 continue;
···45324532 * their platform code before calling sdhci_add_host(), and we45334533 * won't assume 8-bit width for hosts without that CAP.45344534 */45354535- if (!(host->quirks & SDHCI_QUIRK_FORCE_1_BIT_DATA))45354535+ if (host->quirks & SDHCI_QUIRK_FORCE_1_BIT_DATA) {45364536+ host->caps1 &= ~(SDHCI_SUPPORT_SDR104 | SDHCI_SUPPORT_SDR50 | SDHCI_SUPPORT_DDR50);45374537+ if (host->quirks2 & SDHCI_QUIRK2_CAPS_BIT63_FOR_HS400)45384538+ host->caps1 &= ~SDHCI_SUPPORT_HS400;45394539+ mmc->caps2 &= ~(MMC_CAP2_HS200 | MMC_CAP2_HS400 | MMC_CAP2_HS400_ES);45404540+ mmc->caps &= ~(MMC_CAP_DDR | MMC_CAP_UHS);45414541+ } else {45364542 mmc->caps |= MMC_CAP_4_BIT_DATA;45434543+ }4537454445384545 if (host->quirks2 & SDHCI_QUIRK2_HOST_NO_CMD23)45394546 mmc->caps &= ~MMC_CAP_CMD23;
+2-4
drivers/mtd/nand/raw/brcmnand/brcmnand.c
···23502350 for (i = 0; i < ctrl->max_oob; i += 4)23512351 oob_reg_write(ctrl, i, 0xffffffff);2352235223532353- if (mtd->oops_panic_write)23532353+ if (mtd->oops_panic_write) {23542354 /* switch to interrupt polling and PIO mode */23552355 disable_ctrl_irqs(ctrl);23562356-23572357- if (use_dma(ctrl) && (has_edu(ctrl) || !oob) && flash_dma_buf_ok(buf)) {23562356+ } else if (use_dma(ctrl) && (has_edu(ctrl) || !oob) && flash_dma_buf_ok(buf)) {23582357 if (ctrl->dma_trans(host, addr, (u32 *)buf, oob, mtd->writesize,23592358 CMD_PROGRAM_PAGE))23602360-23612359 ret = -EIO;2362236023632361 goto out;
+1-1
drivers/mtd/nand/raw/cadence-nand-controller.c
···31333133 sizeof(*cdns_ctrl->cdma_desc),31343134 &cdns_ctrl->dma_cdma_desc,31353135 GFP_KERNEL);31363136- if (!cdns_ctrl->dma_cdma_desc)31363136+ if (!cdns_ctrl->cdma_desc)31373137 return -ENOMEM;3138313831393139 cdns_ctrl->buf_size = SZ_16K;
+12-2
drivers/mtd/nand/raw/nand_base.c
···47374737static int nand_lock(struct mtd_info *mtd, loff_t ofs, uint64_t len)47384738{47394739 struct nand_chip *chip = mtd_to_nand(mtd);47404740+ int ret;4740474147414742 if (!chip->ops.lock_area)47424743 return -ENOTSUPP;4743474447444744- return chip->ops.lock_area(chip, ofs, len);47454745+ nand_get_device(chip);47464746+ ret = chip->ops.lock_area(chip, ofs, len);47474747+ nand_release_device(chip);47484748+47494749+ return ret;47454750}4746475147474752/**···47584753static int nand_unlock(struct mtd_info *mtd, loff_t ofs, uint64_t len)47594754{47604755 struct nand_chip *chip = mtd_to_nand(mtd);47564756+ int ret;4761475747624758 if (!chip->ops.unlock_area)47634759 return -ENOTSUPP;4764476047654765- return chip->ops.unlock_area(chip, ofs, len);47614761+ nand_get_device(chip);47624762+ ret = chip->ops.unlock_area(chip, ofs, len);47634763+ nand_release_device(chip);47644764+47654765+ return ret;47664766}4767476747684768/* Set default functions */
···23452345}2346234623472347/**23482348- * spi_nor_spimem_check_op - check if the operation is supported23492349- * by controller23482348+ * spi_nor_spimem_check_read_pp_op - check if a read or a page program operation is23492349+ * supported by controller23502350 *@nor: pointer to a 'struct spi_nor'23512351 *@op: pointer to op template to be checked23522352 *23532353 * Returns 0 if operation is supported, -EOPNOTSUPP otherwise.23542354 */23552355-static int spi_nor_spimem_check_op(struct spi_nor *nor,23562356- struct spi_mem_op *op)23552355+static int spi_nor_spimem_check_read_pp_op(struct spi_nor *nor,23562356+ struct spi_mem_op *op)23572357{23582358 /*23592359 * First test with 4 address bytes. The opcode itself might···23962396 if (spi_nor_protocol_is_dtr(nor->read_proto))23972397 op.dummy.nbytes *= 2;2398239823992399- return spi_nor_spimem_check_op(nor, &op);23992399+ return spi_nor_spimem_check_read_pp_op(nor, &op);24002400}2401240124022402/**···2414241424152415 spi_nor_spimem_setup_op(nor, &op, pp->proto);2416241624172417- return spi_nor_spimem_check_op(nor, &op);24172417+ return spi_nor_spimem_check_read_pp_op(nor, &op);24182418}2419241924202420/**···2466246624672467 spi_nor_spimem_setup_op(nor, &op, nor->reg_proto);2468246824692469- if (spi_nor_spimem_check_op(nor, &op))24692469+ if (!spi_mem_supports_op(nor->spimem, &op))24702470 nor->flags |= SNOR_F_NO_READ_CR;24712471 }24722472}
···15301530 return ret;15311531}1532153215331533-static int bond_header_parse(const struct sk_buff *skb, unsigned char *haddr)15331533+static int bond_header_parse(const struct sk_buff *skb,15341534+ const struct net_device *dev,15351535+ unsigned char *haddr)15341536{15351535- struct bonding *bond = netdev_priv(skb->dev);15371537+ struct bonding *bond = netdev_priv(dev);15361538 const struct header_ops *slave_ops;15371539 struct slave *slave;15381540 int ret = 0;···15441542 if (slave) {15451543 slave_ops = READ_ONCE(slave->dev->header_ops);15461544 if (slave_ops && slave_ops->parse)15471547- ret = slave_ops->parse(skb, haddr);15451545+ ret = slave_ops->parse(skb, slave->dev, haddr);15481546 }15491547 rcu_read_unlock();15501548 return ret;
+6-2
drivers/net/dsa/bcm_sf2.c
···980980 ret = bcm_sf2_sw_rst(priv);981981 if (ret) {982982 pr_err("%s: failed to software reset switch\n", __func__);983983+ if (!priv->wol_ports_mask)984984+ clk_disable_unprepare(priv->clk);983985 return ret;984986 }985987986988 bcm_sf2_crossbar_setup(priv);987989988990 ret = bcm_sf2_cfp_resume(ds);989989- if (ret)991991+ if (ret) {992992+ if (!priv->wol_ports_mask)993993+ clk_disable_unprepare(priv->clk);990994 return ret;991991-995995+ }992996 if (priv->hw_params.num_gphy == 1)993997 bcm_sf2_gphy_enable_set(ds, true);994998
···357357{358358 struct macb *bp = netdev_priv(ndev);359359360360- if (bp->ptp_clock)360360+ if (bp->ptp_clock) {361361 ptp_clock_unregister(bp->ptp_clock);362362+ bp->ptp_clock = NULL;363363+ }362364363365 gem_ptp_clear_timer(bp);364366
+6-3
drivers/net/ethernet/intel/iavf/iavf_main.c
···757757 adapter->num_vlan_filters++;758758 iavf_schedule_aq_request(adapter, IAVF_FLAG_AQ_ADD_VLAN_FILTER);759759 } else if (f->state == IAVF_VLAN_REMOVE) {760760- /* IAVF_VLAN_REMOVE means that VLAN wasn't yet removed.761761- * We can safely only change the state here.760760+ /* Re-add the filter since we cannot tell whether the761761+ * pending delete has already been processed by the PF.762762+ * A duplicate add is harmless.762763 */763763- f->state = IAVF_VLAN_ACTIVE;764764+ f->state = IAVF_VLAN_ADD;765765+ iavf_schedule_aq_request(adapter,766766+ IAVF_FLAG_AQ_ADD_VLAN_FILTER);764767 }765768766769clearout:
···264264 /* reset next_to_use and next_to_clean */265265 tx_ring->next_to_use = 0;266266 tx_ring->next_to_clean = 0;267267+268268+ /* Clear any lingering XSK TX timestamp requests */269269+ if (test_bit(IGC_RING_FLAG_TX_HWTSTAMP, &tx_ring->flags)) {270270+ struct igc_adapter *adapter = netdev_priv(tx_ring->netdev);271271+272272+ igc_ptp_clear_xsk_tx_tstamp_queue(adapter, tx_ring->queue_index);273273+ }267274}268275269276/**···17371730 /* The minimum packet size with TCTL.PSP set is 17 so pad the skb17381731 * in order to meet this minimum size requirement.17391732 */17401740- if (skb->len < 17) {17411741- if (skb_padto(skb, 17))17421742- return NETDEV_TX_OK;17431743- skb->len = 17;17441744- }17331733+ if (skb_put_padto(skb, 17))17341734+ return NETDEV_TX_OK;1745173517461736 return igc_xmit_frame_ring(skb, igc_tx_queue_mapping(adapter, skb));17471737}
+33
drivers/net/ethernet/intel/igc/igc_ptp.c
···577577 spin_unlock_irqrestore(&adapter->ptp_tx_lock, flags);578578}579579580580+/**581581+ * igc_ptp_clear_xsk_tx_tstamp_queue - Clear pending XSK TX timestamps for a queue582582+ * @adapter: Board private structure583583+ * @queue_id: TX queue index to clear timestamps for584584+ *585585+ * Iterates over all TX timestamp registers and releases any pending586586+ * timestamp requests associated with the given TX queue. This is587587+ * called when an XDP pool is being disabled to ensure no stale588588+ * timestamp references remain.589589+ */590590+void igc_ptp_clear_xsk_tx_tstamp_queue(struct igc_adapter *adapter, u16 queue_id)591591+{592592+ unsigned long flags;593593+ int i;594594+595595+ spin_lock_irqsave(&adapter->ptp_tx_lock, flags);596596+597597+ for (i = 0; i < IGC_MAX_TX_TSTAMP_REGS; i++) {598598+ struct igc_tx_timestamp_request *tstamp = &adapter->tx_tstamp[i];599599+600600+ if (tstamp->buffer_type != IGC_TX_BUFFER_TYPE_XSK)601601+ continue;602602+ if (tstamp->xsk_queue_index != queue_id)603603+ continue;604604+ if (!tstamp->xsk_tx_buffer)605605+ continue;606606+607607+ igc_ptp_free_tx_buffer(adapter, tstamp);608608+ }609609+610610+ spin_unlock_irqrestore(&adapter->ptp_tx_lock, flags);611611+}612612+580613static void igc_ptp_disable_tx_timestamp(struct igc_adapter *adapter)581614{582615 struct igc_hw *hw = &adapter->hw;
+36-13
drivers/net/ethernet/intel/libie/fwlog.c
···433433 module = libie_find_module_by_dentry(fwlog->debugfs_modules, dentry);434434 if (module < 0) {435435 dev_info(dev, "unknown module\n");436436- return -EINVAL;436436+ count = -EINVAL;437437+ goto free_cmd_buf;437438 }438439439440 cnt = sscanf(cmd_buf, "%s", user_val);440440- if (cnt != 1)441441- return -EINVAL;441441+ if (cnt != 1) {442442+ count = -EINVAL;443443+ goto free_cmd_buf;444444+ }442445443446 log_level = sysfs_match_string(libie_fwlog_level_string, user_val);444447 if (log_level < 0) {445448 dev_info(dev, "unknown log level '%s'\n", user_val);446446- return -EINVAL;449449+ count = -EINVAL;450450+ goto free_cmd_buf;447451 }448452449453 if (module != LIBIE_AQC_FW_LOG_ID_MAX) {···461457 for (i = 0; i < LIBIE_AQC_FW_LOG_ID_MAX; i++)462458 fwlog->cfg.module_entries[i].log_level = log_level;463459 }460460+461461+free_cmd_buf:462462+ kfree(cmd_buf);464463465464 return count;466465}···522515 return PTR_ERR(cmd_buf);523516524517 ret = sscanf(cmd_buf, "%s", user_val);525525- if (ret != 1)526526- return -EINVAL;518518+ if (ret != 1) {519519+ count = -EINVAL;520520+ goto free_cmd_buf;521521+ }527522528523 ret = kstrtos16(user_val, 0, &nr_messages);529529- if (ret)530530- return ret;524524+ if (ret) {525525+ count = ret;526526+ goto free_cmd_buf;527527+ }531528532529 if (nr_messages < LIBIE_AQC_FW_LOG_MIN_RESOLUTION ||533530 nr_messages > LIBIE_AQC_FW_LOG_MAX_RESOLUTION) {534531 dev_err(dev, "Invalid FW log number of messages %d, value must be between %d - %d\n",535532 nr_messages, LIBIE_AQC_FW_LOG_MIN_RESOLUTION,536533 LIBIE_AQC_FW_LOG_MAX_RESOLUTION);537537- return -EINVAL;534534+ count = -EINVAL;535535+ goto free_cmd_buf;538536 }539537540538 fwlog->cfg.log_resolution = nr_messages;539539+540540+free_cmd_buf:541541+ kfree(cmd_buf);541542542543 return count;543544}···603588 return PTR_ERR(cmd_buf);604589605590 ret = sscanf(cmd_buf, "%s", user_val);606606- if (ret != 1)607607- return -EINVAL;591591+ if (ret != 1) {592592+ ret = -EINVAL;593593+ goto free_cmd_buf;594594+ }608595609596 ret = kstrtobool(user_val, &enable);610597 if (ret)···641624 */642625 if (WARN_ON(ret != (ssize_t)count && ret >= 0))643626 ret = -EIO;627627+free_cmd_buf:628628+ kfree(cmd_buf);644629645630 return ret;646631}···701682 return PTR_ERR(cmd_buf);702683703684 ret = sscanf(cmd_buf, "%s", user_val);704704- if (ret != 1)705705- return -EINVAL;685685+ if (ret != 1) {686686+ ret = -EINVAL;687687+ goto free_cmd_buf;688688+ }706689707690 index = sysfs_match_string(libie_fwlog_log_size, user_val);708691 if (index < 0) {···733712 */734713 if (WARN_ON(ret != (ssize_t)count && ret >= 0))735714 ret = -EIO;715715+free_cmd_buf:716716+ kfree(cmd_buf);736717737718 return ret;738719}
+2-2
drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c
···50165016 if (priv->percpu_pools)50175017 numbufs = port->nrxqs * 2;5018501850195019- if (change_percpu)50195019+ if (change_percpu && priv->global_tx_fc)50205020 mvpp2_bm_pool_update_priv_fc(priv, false);5021502150225022 for (i = 0; i < numbufs; i++)···50415041 mvpp2_open(port->dev);50425042 }5043504350445044- if (change_percpu)50445044+ if (change_percpu && priv->global_tx_fc)50455045 mvpp2_bm_pool_update_priv_fc(priv, true);5046504650475047 return 0;
···109109 int ret;110110111111 ret = __dev_forward_skb(rx_dev, skb);112112- if (ret)112112+ if (ret) {113113+ if (psp_ext)114114+ __skb_ext_put(psp_ext);113115 return ret;116116+ }114117115118 nsim_psp_handle_ext(skb, psp_ext);116119
···894894 dev_err(&epf->dev, "pci_epc_set_bar() failed: %d\n", ret);895895 bar->submap = old_submap;896896 bar->num_submap = old_nsub;897897+ ret = pci_epc_set_bar(epc, epf->func_no, epf->vfunc_no, bar);898898+ if (ret)899899+ dev_warn(&epf->dev, "Failed to restore the original BAR mapping: %d\n",900900+ ret);901901+897902 kfree(submap);898903 goto err;899904 }
+41-13
drivers/pci/pwrctrl/core.c
···268268}269269EXPORT_SYMBOL_GPL(pci_pwrctrl_power_on_devices);270270271271+/*272272+ * Check whether the pwrctrl device really needs to be created or not. The273273+ * pwrctrl device will only be created if the node satisfies below requirements:274274+ *275275+ * 1. Presence of compatible property with "pci" prefix to match against the276276+ * pwrctrl driver (AND)277277+ * 2. At least one of the power supplies defined in the devicetree node of the278278+ * device (OR) in the remote endpoint parent node to indicate pwrctrl279279+ * requirement.280280+ */281281+static bool pci_pwrctrl_is_required(struct device_node *np)282282+{283283+ struct device_node *endpoint;284284+ const char *compat;285285+ int ret;286286+287287+ ret = of_property_read_string(np, "compatible", &compat);288288+ if (ret < 0)289289+ return false;290290+291291+ if (!strstarts(compat, "pci"))292292+ return false;293293+294294+ if (of_pci_supply_present(np))295295+ return true;296296+297297+ if (of_graph_is_present(np)) {298298+ for_each_endpoint_of_node(np, endpoint) {299299+ struct device_node *remote __free(device_node) =300300+ of_graph_get_remote_port_parent(endpoint);301301+ if (remote) {302302+ if (of_pci_supply_present(remote))303303+ return true;304304+ }305305+ }306306+ }307307+308308+ return false;309309+}310310+271311static int pci_pwrctrl_create_device(struct device_node *np,272312 struct device *parent)273313{···327287 return 0;328288 }329289330330- /*331331- * Sanity check to make sure that the node has the compatible property332332- * to allow driver binding.333333- */334334- if (!of_property_present(np, "compatible"))335335- return 0;336336-337337- /*338338- * Check whether the pwrctrl device really needs to be created or not.339339- * This is decided based on at least one of the power supplies defined340340- * in the devicetree node of the device or the graph property.341341- */342342- if (!of_pci_supply_present(np) && !of_graph_is_present(np)) {290290+ if (!pci_pwrctrl_is_required(np)) {343291 dev_dbg(parent, "Skipping OF node: %s\n", np->name);344292 return 0;345293 }
···136136{137137 u32 val = power_on ? 0 : 1;138138139139+ if (!pwrrdy)140140+ return 0;141141+139142 /* The initialization path guarantees that the mask is 1 bit long. */140143 return regmap_field_update_bits(pwrrdy, 1, val);141144}
+2-4
drivers/slimbus/qcom-ngd-ctrl.c
···15351535 ngd->id = id;15361536 ngd->pdev->dev.parent = parent;1537153715381538- ret = driver_set_override(&ngd->pdev->dev,15391539- &ngd->pdev->driver_override,15401540- QCOM_SLIM_NGD_DRV_NAME,15411541- strlen(QCOM_SLIM_NGD_DRV_NAME));15381538+ ret = device_set_driver_override(&ngd->pdev->dev,15391539+ QCOM_SLIM_NGD_DRV_NAME);15421540 if (ret) {15431541 platform_device_put(ngd->pdev);15441542 kfree(ngd);
+22-2
drivers/soc/fsl/qbman/qman.c
···1827182718281828void qman_destroy_fq(struct qman_fq *fq)18291829{18301830+ int leaked;18311831+18301832 /*18311833 * We don't need to lock the FQ as it is a pre-condition that the FQ be18321834 * quiesced. Instead, run some checks.···18361834 switch (fq->state) {18371835 case qman_fq_state_parked:18381836 case qman_fq_state_oos:18391839- if (fq_isset(fq, QMAN_FQ_FLAG_DYNAMIC_FQID))18401840- qman_release_fqid(fq->fqid);18371837+ /*18381838+ * There's a race condition here on releasing the fqid,18391839+ * setting the fq_table to NULL, and freeing the fqid.18401840+ * To prevent it, this order should be respected:18411841+ */18421842+ if (fq_isset(fq, QMAN_FQ_FLAG_DYNAMIC_FQID)) {18431843+ leaked = qman_shutdown_fq(fq->fqid);18441844+ if (leaked)18451845+ pr_debug("FQID %d leaked\n", fq->fqid);18461846+ }1841184718421848 DPAA_ASSERT(fq_table[fq->idx]);18431849 fq_table[fq->idx] = NULL;18501850+18511851+ if (fq_isset(fq, QMAN_FQ_FLAG_DYNAMIC_FQID) && !leaked) {18521852+ /*18531853+ * fq_table[fq->idx] should be set to null before18541854+ * freeing fq->fqid otherwise it could by allocated by18551855+ * qman_alloc_fqid() while still being !NULL18561856+ */18571857+ smp_wmb();18581858+ gen_pool_free(qm_fqalloc, fq->fqid | DPAA_GENALLOC_OFF, 1);18591859+ }18441860 return;18451861 default:18461862 break;
···142142143143 sys_controller->flash = of_get_mtd_device_by_node(np);144144 of_node_put(np);145145- if (IS_ERR(sys_controller->flash))146146- return dev_err_probe(dev, PTR_ERR(sys_controller->flash), "Failed to get flash\n");145145+ if (IS_ERR(sys_controller->flash)) {146146+ ret = dev_err_probe(dev, PTR_ERR(sys_controller->flash), "Failed to get flash\n");147147+ goto out_free;148148+ }147149148150no_flash:149151 sys_controller->client.dev = dev;···157155 if (IS_ERR(sys_controller->chan)) {158156 ret = dev_err_probe(dev, PTR_ERR(sys_controller->chan),159157 "Failed to get mbox channel\n");160160- kfree(sys_controller);161161- return ret;158158+ goto out_free;162159 }163160164161 init_completion(&sys_controller->c);···175174 dev_info(&pdev->dev, "Registered MPFS system controller\n");176175177176 return 0;177177+178178+out_free:179179+ kfree(sys_controller);180180+ return ret;178181}179182180183static void mpfs_sys_controller_remove(struct platform_device *pdev)
+1
drivers/soc/rockchip/grf.c
···231231 grf = syscon_node_to_regmap(np);232232 if (IS_ERR(grf)) {233233 pr_err("%s: could not get grf syscon\n", __func__);234234+ of_node_put(np);234235 return PTR_ERR(grf);235236 }236237
+7-39
drivers/spi/spi-amlogic-spifc-a4.c
···10831083 return clk_set_rate(sfc->core_clk, SFC_BUS_DEFAULT_CLK);10841084}1085108510861086-static int aml_sfc_disable_clk(struct aml_sfc *sfc)10871087-{10881088- clk_disable_unprepare(sfc->core_clk);10891089- clk_disable_unprepare(sfc->gate_clk);10901090-10911091- return 0;10921092-}10931093-10941086static int aml_sfc_probe(struct platform_device *pdev)10951087{10961088 struct device_node *np = pdev->dev.of_node;···1133114111341142 /* Enable Amlogic flash controller spi mode */11351143 ret = regmap_write(sfc->regmap_base, SFC_SPI_CFG, SPI_MODE_EN);11361136- if (ret) {11371137- dev_err(dev, "failed to enable SPI mode\n");11381138- goto err_out;11391139- }11441144+ if (ret)11451145+ return dev_err_probe(dev, ret, "failed to enable SPI mode\n");1140114611411147 ret = dma_set_mask(sfc->dev, DMA_BIT_MASK(32));11421142- if (ret) {11431143- dev_err(sfc->dev, "failed to set dma mask\n");11441144- goto err_out;11451145- }11481148+ if (ret)11491149+ return dev_err_probe(sfc->dev, ret, "failed to set dma mask\n");1146115011471151 sfc->ecc_eng.dev = &pdev->dev;11481152 sfc->ecc_eng.integration = NAND_ECC_ENGINE_INTEGRATION_PIPELINED;···11461158 sfc->ecc_eng.priv = sfc;1147115911481160 ret = nand_ecc_register_on_host_hw_engine(&sfc->ecc_eng);11491149- if (ret) {11501150- dev_err(&pdev->dev, "failed to register Aml host ecc engine.\n");11511151- goto err_out;11521152- }11611161+ if (ret)11621162+ return dev_err_probe(&pdev->dev, ret, "failed to register Aml host ecc engine.\n");1153116311541164 ret = of_property_read_u32(np, "amlogic,rx-adj", &val);11551165 if (!ret)···11631177 ctrl->min_speed_hz = SFC_MIN_FREQUENCY;11641178 ctrl->num_chipselect = SFC_MAX_CS_NUM;1165117911661166- ret = devm_spi_register_controller(dev, ctrl);11671167- if (ret)11681168- goto err_out;11691169-11701170- return 0;11711171-11721172-err_out:11731173- aml_sfc_disable_clk(sfc);11741174-11751175- return ret;11761176-}11771177-11781178-static void aml_sfc_remove(struct platform_device *pdev)11791179-{11801180- struct spi_controller *ctlr = platform_get_drvdata(pdev);11811181- struct aml_sfc *sfc = spi_controller_get_devdata(ctlr);11821182-11831183- aml_sfc_disable_clk(sfc);11801180+ return devm_spi_register_controller(dev, ctrl);11841181}1185118211861183static const struct of_device_id aml_sfc_of_match[] = {···11811212 .of_match_table = aml_sfc_of_match,11821213 },11831214 .probe = aml_sfc_probe,11841184- .remove = aml_sfc_remove,11851215};11861216module_platform_driver(aml_sfc_driver);11871217
+4-8
drivers/spi/spi-amlogic-spisg.c
···729729 };730730731731 if (of_property_read_bool(dev->of_node, "spi-slave"))732732- ctlr = spi_alloc_target(dev, sizeof(*spisg));732732+ ctlr = devm_spi_alloc_target(dev, sizeof(*spisg));733733 else734734- ctlr = spi_alloc_host(dev, sizeof(*spisg));734734+ ctlr = devm_spi_alloc_host(dev, sizeof(*spisg));735735 if (!ctlr)736736 return -ENOMEM;737737···750750 return dev_err_probe(dev, PTR_ERR(spisg->map), "regmap init failed\n");751751752752 irq = platform_get_irq(pdev, 0);753753- if (irq < 0) {754754- ret = irq;755755- goto out_controller;756756- }753753+ if (irq < 0)754754+ return irq;757755758756 ret = device_reset_optional(dev);759757 if (ret)···815817 if (spisg->core)816818 clk_disable_unprepare(spisg->core);817819 clk_disable_unprepare(spisg->pclk);818818-out_controller:819819- spi_controller_put(ctlr);820820821821 return ret;822822}
+11-20
drivers/spi/spi-axiado.c
···765765 platform_set_drvdata(pdev, ctlr);766766767767 xspi->regs = devm_platform_ioremap_resource(pdev, 0);768768- if (IS_ERR(xspi->regs)) {769769- ret = PTR_ERR(xspi->regs);770770- goto remove_ctlr;771771- }768768+ if (IS_ERR(xspi->regs))769769+ return PTR_ERR(xspi->regs);772770773771 xspi->pclk = devm_clk_get(&pdev->dev, "pclk");774774- if (IS_ERR(xspi->pclk)) {775775- dev_err(&pdev->dev, "pclk clock not found.\n");776776- ret = PTR_ERR(xspi->pclk);777777- goto remove_ctlr;778778- }772772+ if (IS_ERR(xspi->pclk))773773+ return dev_err_probe(&pdev->dev, PTR_ERR(xspi->pclk),774774+ "pclk clock not found.\n");779775780776 xspi->ref_clk = devm_clk_get(&pdev->dev, "ref");781781- if (IS_ERR(xspi->ref_clk)) {782782- dev_err(&pdev->dev, "ref clock not found.\n");783783- ret = PTR_ERR(xspi->ref_clk);784784- goto remove_ctlr;785785- }777777+ if (IS_ERR(xspi->ref_clk))778778+ return dev_err_probe(&pdev->dev, PTR_ERR(xspi->ref_clk),779779+ "ref clock not found.\n");786780787781 ret = clk_prepare_enable(xspi->pclk);788788- if (ret) {789789- dev_err(&pdev->dev, "Unable to enable APB clock.\n");790790- goto remove_ctlr;791791- }782782+ if (ret)783783+ return dev_err_probe(&pdev->dev, ret, "Unable to enable APB clock.\n");792784793785 ret = clk_prepare_enable(xspi->ref_clk);794786 if (ret) {···861869 clk_disable_unprepare(xspi->ref_clk);862870clk_dis_apb:863871 clk_disable_unprepare(xspi->pclk);864864-remove_ctlr:865865- spi_controller_put(ctlr);872872+866873 return ret;867874}868875
···162162 */163163 dma->tx_size = 0;164164165165+ /*166166+ * We can't use `dmaengine_terminate_sync` because `uart_flush_buffer` is167167+ * holding the uart port spinlock.168168+ */165169 dmaengine_terminate_async(dma->txchan);170170+171171+ /*172172+ * The callback might or might not run. If it doesn't run, we need to ensure173173+ * that `tx_running` is cleared so that we can schedule new transactions.174174+ * If it does run, then the zombie callback will clear `tx_running` again175175+ * and perform a no-op since `tx_size` was cleared above.176176+ *177177+ * In either case, we ASSUME the DMA transaction will terminate before we178178+ * issue a new `serial8250_tx_dma`.179179+ */180180+ dma->tx_running = 0;166181}167182168183int serial8250_rx_dma(struct uart_8250_port *p)
+239-65
drivers/tty/serial/8250/8250_dw.c
···99 * LCR is written whilst busy. If it is, then a busy detect interrupt is1010 * raised, the LCR needs to be rewritten and the uart status register read.1111 */1212+#include <linux/bitfield.h>1313+#include <linux/bits.h>1414+#include <linux/cleanup.h>1215#include <linux/clk.h>1316#include <linux/delay.h>1417#include <linux/device.h>1518#include <linux/io.h>1919+#include <linux/lockdep.h>1620#include <linux/mod_devicetable.h>1721#include <linux/module.h>1822#include <linux/notifier.h>···4440#define RZN1_UART_RDMACR 0x110 /* DMA Control Register Receive Mode */45414642/* DesignWare specific register fields */4343+#define DW_UART_IIR_IID GENMASK(3, 0)4444+4745#define DW_UART_MCR_SIRE BIT(6)4646+4747+#define DW_UART_USR_BUSY BIT(0)48484949/* Renesas specific register fields */5050#define RZN1_UART_xDMACR_DMA_EN BIT(0)···6456#define DW_UART_QUIRK_IS_DMA_FC BIT(3)6557#define DW_UART_QUIRK_APMC0D08 BIT(4)6658#define DW_UART_QUIRK_CPR_VALUE BIT(5)5959+#define DW_UART_QUIRK_IER_KICK BIT(6)6060+6161+/*6262+ * Number of consecutive IIR_NO_INT interrupts required to trigger interrupt6363+ * storm prevention code.6464+ */6565+#define DW_UART_QUIRK_IER_KICK_THRES 467666867struct dw8250_platform_data {6968 u8 usr_reg;···92779378 unsigned int skip_autocfg:1;9479 unsigned int uart_16550_compatible:1;8080+ unsigned int in_idle:1;8181+8282+ u8 no_int_count;9583};96849785static inline struct dw8250_data *to_dw8250_data(struct dw8250_port_data *data)···125107 return value;126108}127109128128-/*129129- * This function is being called as part of the uart_port::serial_out()130130- * routine. Hence, it must not call serial_port_out() or serial_out()131131- * against the modified registers here, i.e. LCR.132132- */133133-static void dw8250_force_idle(struct uart_port *p)110110+static void dw8250_idle_exit(struct uart_port *p)134111{112112+ struct dw8250_data *d = to_dw8250_data(p->private_data);135113 struct uart_8250_port *up = up_to_u8250p(p);136136- unsigned int lsr;137114138138- /*139139- * The following call currently performs serial_out()140140- * against the FCR register. Because it differs to LCR141141- * there will be no infinite loop, but if it ever gets142142- * modified, we might need a new custom version of it143143- * that avoids infinite recursion.144144- */145145- serial8250_clear_and_reinit_fifos(up);115115+ if (d->uart_16550_compatible)116116+ return;146117147147- /*148148- * With PSLVERR_RESP_EN parameter set to 1, the device generates an149149- * error response when an attempt to read an empty RBR with FIFO150150- * enabled.151151- */152152- if (up->fcr & UART_FCR_ENABLE_FIFO) {153153- lsr = serial_port_in(p, UART_LSR);154154- if (!(lsr & UART_LSR_DR))155155- return;118118+ if (up->capabilities & UART_CAP_FIFO)119119+ serial_port_out(p, UART_FCR, up->fcr);120120+ serial_port_out(p, UART_MCR, up->mcr);121121+ serial_port_out(p, UART_IER, up->ier);122122+123123+ /* DMA Rx is restarted by IRQ handler as needed. */124124+ if (up->dma)125125+ serial8250_tx_dma_resume(up);126126+127127+ d->in_idle = 0;128128+}129129+130130+/*131131+ * Ensure BUSY is not asserted. If DW UART is configured with132132+ * !uart_16550_compatible, the writes to LCR, DLL, and DLH fail while133133+ * BUSY is asserted.134134+ *135135+ * Context: port's lock must be held136136+ */137137+static int dw8250_idle_enter(struct uart_port *p)138138+{139139+ struct dw8250_data *d = to_dw8250_data(p->private_data);140140+ unsigned int usr_reg = d->pdata ? d->pdata->usr_reg : DW_UART_USR;141141+ struct uart_8250_port *up = up_to_u8250p(p);142142+ int retries;143143+ u32 lsr;144144+145145+ lockdep_assert_held_once(&p->lock);146146+147147+ if (d->uart_16550_compatible)148148+ return 0;149149+150150+ d->in_idle = 1;151151+152152+ /* Prevent triggering interrupt from RBR filling */153153+ serial_port_out(p, UART_IER, 0);154154+155155+ if (up->dma) {156156+ serial8250_rx_dma_flush(up);157157+ if (serial8250_tx_dma_running(up))158158+ serial8250_tx_dma_pause(up);156159 }157160158158- serial_port_in(p, UART_RX);161161+ /*162162+ * Wait until Tx becomes empty + one extra frame time to ensure all bits163163+ * have been sent on the wire.164164+ *165165+ * FIXME: frame_time delay is too long with very low baudrates.166166+ */167167+ serial8250_fifo_wait_for_lsr_thre(up, p->fifosize);168168+ ndelay(p->frame_time);169169+170170+ serial_port_out(p, UART_MCR, up->mcr | UART_MCR_LOOP);171171+172172+ retries = 4; /* Arbitrary limit, 2 was always enough in tests */173173+ do {174174+ serial8250_clear_fifos(up);175175+ if (!(serial_port_in(p, usr_reg) & DW_UART_USR_BUSY))176176+ break;177177+ /* FIXME: frame_time delay is too long with very low baudrates. */178178+ ndelay(p->frame_time);179179+ } while (--retries);180180+181181+ lsr = serial_lsr_in(up);182182+ if (lsr & UART_LSR_DR) {183183+ serial_port_in(p, UART_RX);184184+ up->lsr_saved_flags = 0;185185+ }186186+187187+ /* Now guaranteed to have BUSY deasserted? Just sanity check */188188+ if (serial_port_in(p, usr_reg) & DW_UART_USR_BUSY) {189189+ dw8250_idle_exit(p);190190+ return -EBUSY;191191+ }192192+193193+ return 0;194194+}195195+196196+static void dw8250_set_divisor(struct uart_port *p, unsigned int baud,197197+ unsigned int quot, unsigned int quot_frac)198198+{199199+ struct uart_8250_port *up = up_to_u8250p(p);200200+ int ret;201201+202202+ ret = dw8250_idle_enter(p);203203+ if (ret < 0)204204+ return;205205+206206+ serial_port_out(p, UART_LCR, up->lcr | UART_LCR_DLAB);207207+ if (!(serial_port_in(p, UART_LCR) & UART_LCR_DLAB))208208+ goto idle_failed;209209+210210+ serial_dl_write(up, quot);211211+ serial_port_out(p, UART_LCR, up->lcr);212212+213213+idle_failed:214214+ dw8250_idle_exit(p);159215}160216161217/*162218 * This function is being called as part of the uart_port::serial_out()163163- * routine. Hence, it must not call serial_port_out() or serial_out()164164- * against the modified registers here, i.e. LCR.219219+ * routine. Hence, special care must be taken when serial_port_out() or220220+ * serial_out() against the modified registers here, i.e. LCR (d->in_idle is221221+ * used to break recursion loop).165222 */166223static void dw8250_check_lcr(struct uart_port *p, unsigned int offset, u32 value)167224{168225 struct dw8250_data *d = to_dw8250_data(p->private_data);169169- void __iomem *addr = p->membase + (offset << p->regshift);170170- int tries = 1000;226226+ u32 lcr;227227+ int ret;171228172229 if (offset != UART_LCR || d->uart_16550_compatible)173230 return;174231232232+ lcr = serial_port_in(p, UART_LCR);233233+175234 /* Make sure LCR write wasn't ignored */176176- while (tries--) {177177- u32 lcr = serial_port_in(p, offset);235235+ if ((value & ~UART_LCR_SPAR) == (lcr & ~UART_LCR_SPAR))236236+ return;178237179179- if ((value & ~UART_LCR_SPAR) == (lcr & ~UART_LCR_SPAR))180180- return;238238+ if (d->in_idle)239239+ goto write_err;181240182182- dw8250_force_idle(p);241241+ ret = dw8250_idle_enter(p);242242+ if (ret < 0)243243+ goto write_err;183244184184-#ifdef CONFIG_64BIT185185- if (p->type == PORT_OCTEON)186186- __raw_writeq(value & 0xff, addr);187187- else188188-#endif189189- if (p->iotype == UPIO_MEM32)190190- writel(value, addr);191191- else if (p->iotype == UPIO_MEM32BE)192192- iowrite32be(value, addr);193193- else194194- writeb(value, addr);195195- }245245+ serial_port_out(p, UART_LCR, value);246246+ dw8250_idle_exit(p);247247+ return;248248+249249+write_err:196250 /*197251 * FIXME: this deadlocks if port->lock is already held198252 * dev_err(p->dev, "Couldn't set LCR to %d\n", value);199253 */254254+ return; /* Silences "label at the end of compound statement" */255255+}256256+257257+/*258258+ * With BUSY, LCR writes can be very expensive (IRQ + complex retry logic).259259+ * If the write does not change the value of the LCR register, skip it entirely.260260+ */261261+static bool dw8250_can_skip_reg_write(struct uart_port *p, unsigned int offset, u32 value)262262+{263263+ struct dw8250_data *d = to_dw8250_data(p->private_data);264264+ u32 lcr;265265+266266+ if (offset != UART_LCR || d->uart_16550_compatible)267267+ return false;268268+269269+ lcr = serial_port_in(p, offset);270270+ return lcr == value;200271}201272202273/* Returns once the transmitter is empty or we run out of retries */···314207315208static void dw8250_serial_out(struct uart_port *p, unsigned int offset, u32 value)316209{210210+ if (dw8250_can_skip_reg_write(p, offset, value))211211+ return;212212+317213 writeb(value, p->membase + (offset << p->regshift));318214 dw8250_check_lcr(p, offset, value);319215}320216321217static void dw8250_serial_out38x(struct uart_port *p, unsigned int offset, u32 value)322218{219219+ if (dw8250_can_skip_reg_write(p, offset, value))220220+ return;221221+323222 /* Allow the TX to drain before we reconfigure */324223 if (offset == UART_LCR)325224 dw8250_tx_wait_empty(p);···350237351238static void dw8250_serial_outq(struct uart_port *p, unsigned int offset, u32 value)352239{240240+ if (dw8250_can_skip_reg_write(p, offset, value))241241+ return;242242+353243 value &= 0xff;354244 __raw_writeq(value, p->membase + (offset << p->regshift));355245 /* Read back to ensure register write ordering. */···364248365249static void dw8250_serial_out32(struct uart_port *p, unsigned int offset, u32 value)366250{251251+ if (dw8250_can_skip_reg_write(p, offset, value))252252+ return;253253+367254 writel(value, p->membase + (offset << p->regshift));368255 dw8250_check_lcr(p, offset, value);369256}···380261381262static void dw8250_serial_out32be(struct uart_port *p, unsigned int offset, u32 value)382263{264264+ if (dw8250_can_skip_reg_write(p, offset, value))265265+ return;266266+383267 iowrite32be(value, p->membase + (offset << p->regshift));384268 dw8250_check_lcr(p, offset, value);385269}···394272 return dw8250_modify_msr(p, offset, value);395273}396274275275+/*276276+ * INTC10EE UART can IRQ storm while reporting IIR_NO_INT. Inducing IIR value277277+ * change has been observed to break the storm.278278+ *279279+ * If Tx is empty (THRE asserted), we use here IER_THRI to cause IIR_NO_INT ->280280+ * IIR_THRI transition.281281+ */282282+static void dw8250_quirk_ier_kick(struct uart_port *p)283283+{284284+ struct uart_8250_port *up = up_to_u8250p(p);285285+ u32 lsr;286286+287287+ if (up->ier & UART_IER_THRI)288288+ return;289289+290290+ lsr = serial_lsr_in(up);291291+ if (!(lsr & UART_LSR_THRE))292292+ return;293293+294294+ serial_port_out(p, UART_IER, up->ier | UART_IER_THRI);295295+ serial_port_in(p, UART_LCR); /* safe, no side-effects */296296+ serial_port_out(p, UART_IER, up->ier);297297+}397298398299static int dw8250_handle_irq(struct uart_port *p)399300{···426281 bool rx_timeout = (iir & 0x3f) == UART_IIR_RX_TIMEOUT;427282 unsigned int quirks = d->pdata->quirks;428283 unsigned int status;429429- unsigned long flags;284284+285285+ guard(uart_port_lock_irqsave)(p);286286+287287+ switch (FIELD_GET(DW_UART_IIR_IID, iir)) {288288+ case UART_IIR_NO_INT:289289+ if (d->uart_16550_compatible || up->dma)290290+ return 0;291291+292292+ if (quirks & DW_UART_QUIRK_IER_KICK &&293293+ d->no_int_count == (DW_UART_QUIRK_IER_KICK_THRES - 1))294294+ dw8250_quirk_ier_kick(p);295295+ d->no_int_count = (d->no_int_count + 1) % DW_UART_QUIRK_IER_KICK_THRES;296296+297297+ return 0;298298+299299+ case UART_IIR_BUSY:300300+ /* Clear the USR */301301+ serial_port_in(p, d->pdata->usr_reg);302302+303303+ d->no_int_count = 0;304304+305305+ return 1;306306+ }307307+308308+ d->no_int_count = 0;430309431310 /*432311 * There are ways to get Designware-based UARTs into a state where···463294 * so we limit the workaround only to non-DMA mode.464295 */465296 if (!up->dma && rx_timeout) {466466- uart_port_lock_irqsave(p, &flags);467297 status = serial_lsr_in(up);468298469299 if (!(status & (UART_LSR_DR | UART_LSR_BI)))470300 serial_port_in(p, UART_RX);471471-472472- uart_port_unlock_irqrestore(p, flags);473301 }474302475303 /* Manually stop the Rx DMA transfer when acting as flow controller */476304 if (quirks & DW_UART_QUIRK_IS_DMA_FC && up->dma && up->dma->rx_running && rx_timeout) {477477- uart_port_lock_irqsave(p, &flags);478305 status = serial_lsr_in(up);479479- uart_port_unlock_irqrestore(p, flags);480306481307 if (status & (UART_LSR_DR | UART_LSR_BI)) {482308 dw8250_writel_ext(p, RZN1_UART_RDMACR, 0);···479315 }480316 }481317482482- if (serial8250_handle_irq(p, iir))483483- return 1;318318+ serial8250_handle_irq_locked(p, iir);484319485485- if ((iir & UART_IIR_BUSY) == UART_IIR_BUSY) {486486- /* Clear the USR */487487- serial_port_in(p, d->pdata->usr_reg);488488-489489- return 1;490490- }491491-492492- return 0;320320+ return 1;493321}494322495323static void dw8250_clk_work_cb(struct work_struct *work)···683527 reset_control_assert(data);684528}685529530530+static void dw8250_shutdown(struct uart_port *port)531531+{532532+ struct dw8250_data *d = to_dw8250_data(port->private_data);533533+534534+ serial8250_do_shutdown(port);535535+ d->no_int_count = 0;536536+}537537+686538static int dw8250_probe(struct platform_device *pdev)687539{688540 struct uart_8250_port uart = {}, *up = &uart;···709545 p->type = PORT_8250;710546 p->flags = UPF_FIXED_PORT;711547 p->dev = dev;548548+712549 p->set_ldisc = dw8250_set_ldisc;713550 p->set_termios = dw8250_set_termios;551551+ p->set_divisor = dw8250_set_divisor;714552715553 data = devm_kzalloc(dev, sizeof(*data), GFP_KERNEL);716554 if (!data)···820654 dw8250_quirks(p, data);821655822656 /* If the Busy Functionality is not implemented, don't handle it */823823- if (data->uart_16550_compatible)657657+ if (data->uart_16550_compatible) {824658 p->handle_irq = NULL;825825- else if (data->pdata)659659+ } else if (data->pdata) {826660 p->handle_irq = dw8250_handle_irq;661661+ p->shutdown = dw8250_shutdown;662662+ }827663828664 dw8250_setup_dma_filter(p, data);829665···957789 .quirks = DW_UART_QUIRK_SKIP_SET_RATE,958790};959791792792+static const struct dw8250_platform_data dw8250_intc10ee = {793793+ .usr_reg = DW_UART_USR,794794+ .quirks = DW_UART_QUIRK_IER_KICK,795795+};796796+960797static const struct of_device_id dw8250_of_match[] = {961798 { .compatible = "snps,dw-apb-uart", .data = &dw8250_dw_apb },962799 { .compatible = "cavium,octeon-3860-uart", .data = &dw8250_octeon_3860_data },···991818 { "INT33C5", (kernel_ulong_t)&dw8250_dw_apb },992819 { "INT3434", (kernel_ulong_t)&dw8250_dw_apb },993820 { "INT3435", (kernel_ulong_t)&dw8250_dw_apb },994994- { "INTC10EE", (kernel_ulong_t)&dw8250_dw_apb },821821+ { "INTC10EE", (kernel_ulong_t)&dw8250_intc10ee },995822 { },996823};997824MODULE_DEVICE_TABLE(acpi, dw8250_acpi_match);···10098361010837module_platform_driver(dw8250_platform_driver);1011838839839+MODULE_IMPORT_NS("SERIAL_8250");1012840MODULE_AUTHOR("Jamie Iles");1013841MODULE_LICENSE("GPL");1014842MODULE_DESCRIPTION("Synopsys DesignWare 8250 serial port driver");
···1818#include <linux/irq.h>1919#include <linux/console.h>2020#include <linux/gpio/consumer.h>2121+#include <linux/lockdep.h>2122#include <linux/sysrq.h>2223#include <linux/delay.h>2324#include <linux/platform_device.h>···489488/*490489 * FIFO support.491490 */492492-static void serial8250_clear_fifos(struct uart_8250_port *p)491491+void serial8250_clear_fifos(struct uart_8250_port *p)493492{494493 if (p->capabilities & UART_CAP_FIFO) {495494 serial_out(p, UART_FCR, UART_FCR_ENABLE_FIFO);···498497 serial_out(p, UART_FCR, 0);499498 }500499}500500+EXPORT_SYMBOL_NS_GPL(serial8250_clear_fifos, "SERIAL_8250");501501502502static enum hrtimer_restart serial8250_em485_handle_start_tx(struct hrtimer *t);503503static enum hrtimer_restart serial8250_em485_handle_stop_tx(struct hrtimer *t);···17841782}1785178317861784/*17871787- * This handles the interrupt from one port.17851785+ * Context: port's lock must be held by the caller.17881786 */17891789-int serial8250_handle_irq(struct uart_port *port, unsigned int iir)17871787+void serial8250_handle_irq_locked(struct uart_port *port, unsigned int iir)17901788{17911789 struct uart_8250_port *up = up_to_u8250p(port);17921790 struct tty_port *tport = &port->state->port;17931791 bool skip_rx = false;17941794- unsigned long flags;17951792 u16 status;1796179317971797- if (iir & UART_IIR_NO_INT)17981798- return 0;17991799-18001800- uart_port_lock_irqsave(port, &flags);17941794+ lockdep_assert_held_once(&port->lock);1801179518021796 status = serial_lsr_in(up);18031797···18261828 else if (!up->dma->tx_running)18271829 __stop_tx(up);18281830 }18311831+}18321832+EXPORT_SYMBOL_NS_GPL(serial8250_handle_irq_locked, "SERIAL_8250");1829183318301830- uart_unlock_and_check_sysrq_irqrestore(port, flags);18341834+/*18351835+ * This handles the interrupt from one port.18361836+ */18371837+int serial8250_handle_irq(struct uart_port *port, unsigned int iir)18381838+{18391839+ if (iir & UART_IIR_NO_INT)18401840+ return 0;18411841+18421842+ guard(uart_port_lock_irqsave)(port);18431843+ serial8250_handle_irq_locked(port, iir);1831184418321845 return 1;18331846}···21562147 if (up->port.flags & UPF_NO_THRE_TEST)21572148 return;2158214921592159- if (port->irqflags & IRQF_SHARED)21602160- disable_irq_nosync(port->irq);21502150+ disable_irq(port->irq);2161215121622152 /*21632153 * Test for UARTs that do not reassert THRE when the transmitter is idle and the interrupt···21782170 serial_port_out(port, UART_IER, 0);21792171 }2180217221812181- if (port->irqflags & IRQF_SHARED)21822182- enable_irq(port->irq);21732173+ enable_irq(port->irq);2183217421842175 /*21852176 * If the interrupt is not reasserted, or we otherwise don't trust the iir, setup a timer to···23572350void serial8250_do_shutdown(struct uart_port *port)23582351{23592352 struct uart_8250_port *up = up_to_u8250p(port);23532353+ u32 lcr;2360235423612355 serial8250_rpm_get(up);23622356 /*···23842376 port->mctrl &= ~TIOCM_OUT2;2385237723862378 serial8250_set_mctrl(port, port->mctrl);23792379+23802380+ /* Disable break condition */23812381+ lcr = serial_port_in(port, UART_LCR);23822382+ lcr &= ~UART_LCR_SBC;23832383+ serial_port_out(port, UART_LCR, lcr);23872384 }2388238523892389- /*23902390- * Disable break condition and FIFOs23912391- */23922392- serial_port_out(port, UART_LCR,23932393- serial_port_in(port, UART_LCR) & ~UART_LCR_SBC);23942386 serial8250_clear_fifos(up);2395238723962388 rsa_disable(up);···24002392 * the IRQ chain.24012393 */24022394 serial_port_in(port, UART_RX);23952395+ /*23962396+ * LCR writes on DW UART can trigger late (unmaskable) IRQs.23972397+ * Handle them before releasing the handler.23982398+ */23992399+ synchronize_irq(port->irq);24002400+24032401 serial8250_rpm_put(up);2404240224052403 up->ops->release_irq(up);···31993185}32003186EXPORT_SYMBOL_GPL(serial8250_set_defaults);3201318731883188+void serial8250_fifo_wait_for_lsr_thre(struct uart_8250_port *up, unsigned int count)31893189+{31903190+ unsigned int i;31913191+31923192+ for (i = 0; i < count; i++) {31933193+ if (wait_for_lsr(up, UART_LSR_THRE))31943194+ return;31953195+ }31963196+}31973197+EXPORT_SYMBOL_NS_GPL(serial8250_fifo_wait_for_lsr_thre, "SERIAL_8250");31983198+32023199#ifdef CONFIG_SERIAL_8250_CONSOLE3203320032043201static void serial8250_console_putchar(struct uart_port *port, unsigned char ch)···32513226 serial8250_out_MCR(up, up->mcr | UART_MCR_DTR | UART_MCR_RTS);32523227}3253322832543254-static void fifo_wait_for_lsr(struct uart_8250_port *up, unsigned int count)32553255-{32563256- unsigned int i;32573257-32583258- for (i = 0; i < count; i++) {32593259- if (wait_for_lsr(up, UART_LSR_THRE))32603260- return;32613261- }32623262-}32633263-32643229/*32653230 * Print a string to the serial port using the device FIFO32663231 *···3269325432703255 while (s != end) {32713256 /* Allow timeout for each byte of a possibly full FIFO */32723272- fifo_wait_for_lsr(up, fifosize);32573257+ serial8250_fifo_wait_for_lsr_thre(up, fifosize);3273325832743259 for (i = 0; i < fifosize && s != end; ++i) {32753260 if (*s == '\n' && !cr_sent) {···32873272 * Allow timeout for each byte written since the caller will only wait32883273 * for UART_LSR_BOTH_EMPTY using the timeout of a single character32893274 */32903290- fifo_wait_for_lsr(up, tx_count);32753275+ serial8250_fifo_wait_for_lsr_thre(up, tx_count);32913276}3292327732933278/*
+4-1
drivers/tty/serial/serial_core.c
···643643 unsigned int ret;644644645645 port = uart_port_ref_lock(state, &flags);646646- ret = kfifo_avail(&state->port.xmit_fifo);646646+ if (!state->port.xmit_buf)647647+ ret = 0;648648+ else649649+ ret = kfifo_avail(&state->port.xmit_fifo);647650 uart_port_unlock_deref(port, flags);648651 return ret;649652}
···13931393 .indirect_missing_keys = PREFTREE_INIT13941394 };1395139513961396+ if (unlikely(!root)) {13971397+ btrfs_err(ctx->fs_info,13981398+ "missing extent root for extent at bytenr %llu",13991399+ ctx->bytenr);14001400+ return -EUCLEAN;14011401+ }14021402+13961403 /* Roots ulist is not needed when using a sharedness check context. */13971404 if (sc)13981405 ASSERT(ctx->roots == NULL);···22112204 struct btrfs_extent_item *ei;22122205 struct btrfs_key key;2213220622072207+ if (unlikely(!extent_root)) {22082208+ btrfs_err(fs_info,22092209+ "missing extent root for extent at bytenr %llu",22102210+ logical);22112211+ return -EUCLEAN;22122212+ }22132213+22142214 key.objectid = logical;22152215 if (btrfs_fs_incompat(fs_info, SKINNY_METADATA))22162216 key.type = BTRFS_METADATA_ITEM_KEY;···28652851 struct btrfs_key key;28662852 int ret;2867285328542854+ if (unlikely(!extent_root)) {28552855+ btrfs_err(fs_info,28562856+ "missing extent root for extent at bytenr %llu",28572857+ bytenr);28582858+ return -EUCLEAN;28592859+ }28602860+28682861 key.objectid = bytenr;28692862 key.type = BTRFS_METADATA_ITEM_KEY;28702863 key.offset = (u64)-1;···3008298730092988 /* We're at keyed items, there is no inline item, go to the next one */30102989 extent_root = btrfs_extent_root(iter->fs_info, iter->bytenr);29902990+ if (unlikely(!extent_root)) {29912991+ btrfs_err(iter->fs_info,29922992+ "missing extent root for extent at bytenr %llu",29932993+ iter->bytenr);29942994+ return -EUCLEAN;29952995+ }29962996+30112997 ret = btrfs_next_item(extent_root, iter->path);30122998 if (ret)30132999 return ret;
+36
fs/btrfs/block-group.c
···739739740740 last = max_t(u64, block_group->start, BTRFS_SUPER_INFO_OFFSET);741741 extent_root = btrfs_extent_root(fs_info, last);742742+ if (unlikely(!extent_root)) {743743+ btrfs_err(fs_info,744744+ "missing extent root for block group at offset %llu",745745+ block_group->start);746746+ return -EUCLEAN;747747+ }742748743749#ifdef CONFIG_BTRFS_DEBUG744750 /*···10671061 int ret;1068106210691063 root = btrfs_block_group_root(fs_info);10641064+ if (unlikely(!root)) {10651065+ btrfs_err(fs_info, "missing block group root");10661066+ return -EUCLEAN;10671067+ }10681068+10701069 key.objectid = block_group->start;10711070 key.type = BTRFS_BLOCK_GROUP_ITEM_KEY;10721071 key.offset = block_group->length;···13591348 struct btrfs_root *root = btrfs_block_group_root(fs_info);13601349 struct btrfs_chunk_map *map;13611350 unsigned int num_items;13511351+13521352+ if (unlikely(!root)) {13531353+ btrfs_err(fs_info, "missing block group root");13541354+ return ERR_PTR(-EUCLEAN);13551355+ }1362135613631357 map = btrfs_find_chunk_map(fs_info, chunk_offset, 1);13641358 ASSERT(map != NULL);···21562140 int ret;21572141 struct btrfs_key found_key;2158214221432143+ if (unlikely(!root)) {21442144+ btrfs_err(fs_info, "missing block group root");21452145+ return -EUCLEAN;21462146+ }21472147+21592148 btrfs_for_each_slot(root, key, &found_key, path, ret) {21602149 if (found_key.objectid >= key->objectid &&21612150 found_key.type == BTRFS_BLOCK_GROUP_ITEM_KEY) {···27342713 size_t size;27352714 int ret;2736271527162716+ if (unlikely(!root)) {27172717+ btrfs_err(fs_info, "missing block group root");27182718+ return -EUCLEAN;27192719+ }27202720+27372721 spin_lock(&block_group->lock);27382722 btrfs_set_stack_block_group_v2_used(&bgi, block_group->used);27392723 btrfs_set_stack_block_group_v2_chunk_objectid(&bgi, block_group->global_root_id);···30743048 int ret;30753049 bool dirty_bg_running;3076305030513051+ if (unlikely(!root)) {30523052+ btrfs_err(fs_info, "missing block group root");30533053+ return -EUCLEAN;30543054+ }30553055+30773056 /*30783057 * This can only happen when we are doing read-only scrub on read-only30793058 * mount.···32223191 u32 old_last_identity_remap_count;32233192 u64 used, remap_bytes;32243193 u32 identity_remap_count;31943194+31953195+ if (unlikely(!root)) {31963196+ btrfs_err(fs_info, "missing block group root");31973197+ return -EUCLEAN;31983198+ }3225319932263200 /*32273201 * Block group items update can be triggered out of commit transaction
+8-3
fs/btrfs/compression.c
···320320321321 ASSERT(IS_ALIGNED(ordered->file_offset, fs_info->sectorsize));322322 ASSERT(IS_ALIGNED(ordered->num_bytes, fs_info->sectorsize));323323- ASSERT(cb->writeback);323323+ /*324324+ * This flag determines if we should clear the writeback flag from the325325+ * page cache. But this function is only utilized by encoded writes, it326326+ * never goes through the page cache.327327+ */328328+ ASSERT(!cb->writeback);324329325330 cb->start = ordered->file_offset;326331 cb->len = ordered->num_bytes;332332+ ASSERT(cb->bbio.bio.bi_iter.bi_size == ordered->disk_num_bytes);327333 cb->compressed_len = ordered->disk_num_bytes;328334 cb->bbio.bio.bi_iter.bi_sector = ordered->disk_bytenr >> SECTOR_SHIFT;329335 cb->bbio.ordered = ordered;···351345 cb = alloc_compressed_bio(inode, start, REQ_OP_WRITE, end_bbio_compressed_write);352346 cb->start = start;353347 cb->len = len;354354- cb->writeback = true;355355-348348+ cb->writeback = false;356349 return cb;357350}358351
+17-3
fs/btrfs/disk-io.c
···15911591 * this will bump the backup pointer by one when it is15921592 * done15931593 */15941594-static void backup_super_roots(struct btrfs_fs_info *info)15941594+static int backup_super_roots(struct btrfs_fs_info *info)15951595{15961596 const int next_backup = info->backup_root_index;15971597 struct btrfs_root_backup *root_backup;···16221622 if (!btrfs_fs_incompat(info, EXTENT_TREE_V2)) {16231623 struct btrfs_root *extent_root = btrfs_extent_root(info, 0);16241624 struct btrfs_root *csum_root = btrfs_csum_root(info, 0);16251625+16261626+ if (unlikely(!extent_root)) {16271627+ btrfs_err(info, "missing extent root for extent at bytenr 0");16281628+ return -EUCLEAN;16291629+ }16301630+ if (unlikely(!csum_root)) {16311631+ btrfs_err(info, "missing csum root for extent at bytenr 0");16321632+ return -EUCLEAN;16331633+ }1625163416261635 btrfs_set_backup_extent_root(root_backup,16271636 extent_root->node->start);···16791670 memcpy(&info->super_copy->super_roots,16801671 &info->super_for_commit->super_roots,16811672 sizeof(*root_backup) * BTRFS_NUM_BACKUP_ROOTS);16731673+16741674+ return 0;16821675}1683167616841677/*···40624051 * not from fsync where the tree roots in fs_info have not40634052 * been consistent on disk.40644053 */40654065- if (max_mirrors == 0)40664066- backup_super_roots(fs_info);40544054+ if (max_mirrors == 0) {40554055+ ret = backup_super_roots(fs_info);40564056+ if (ret < 0)40574057+ return ret;40584058+ }4067405940684060 sb = fs_info->super_for_commit;40694061 dev_item = &sb->dev_item;
+93-5
fs/btrfs/extent-tree.c
···7575 struct btrfs_key key;7676 BTRFS_PATH_AUTO_FREE(path);77777878+ if (unlikely(!root)) {7979+ btrfs_err(fs_info,8080+ "missing extent root for extent at bytenr %llu", start);8181+ return -EUCLEAN;8282+ }8383+7884 path = btrfs_alloc_path();7985 if (!path)8086 return -ENOMEM;···137131 key.offset = offset;138132139133 extent_root = btrfs_extent_root(fs_info, bytenr);134134+ if (unlikely(!extent_root)) {135135+ btrfs_err(fs_info,136136+ "missing extent root for extent at bytenr %llu", bytenr);137137+ return -EUCLEAN;138138+ }139139+140140 ret = btrfs_search_slot(NULL, extent_root, &key, path, 0, 0);141141 if (ret < 0)142142 return ret;···448436 int recow;449437 int ret;450438439439+ if (unlikely(!root)) {440440+ btrfs_err(trans->fs_info,441441+ "missing extent root for extent at bytenr %llu", bytenr);442442+ return -EUCLEAN;443443+ }444444+451445 key.objectid = bytenr;452446 if (parent) {453447 key.type = BTRFS_SHARED_DATA_REF_KEY;···527509 u32 size;528510 u32 num_refs;529511 int ret;512512+513513+ if (unlikely(!root)) {514514+ btrfs_err(trans->fs_info,515515+ "missing extent root for extent at bytenr %llu", bytenr);516516+ return -EUCLEAN;517517+ }530518531519 key.objectid = bytenr;532520 if (node->parent) {···692668 struct btrfs_key key;693669 int ret;694670671671+ if (unlikely(!root)) {672672+ btrfs_err(trans->fs_info,673673+ "missing extent root for extent at bytenr %llu", bytenr);674674+ return -EUCLEAN;675675+ }676676+695677 key.objectid = bytenr;696678 if (parent) {697679 key.type = BTRFS_SHARED_BLOCK_REF_KEY;···721691 struct btrfs_root *root = btrfs_extent_root(trans->fs_info, bytenr);722692 struct btrfs_key key;723693 int ret;694694+695695+ if (unlikely(!root)) {696696+ btrfs_err(trans->fs_info,697697+ "missing extent root for extent at bytenr %llu", bytenr);698698+ return -EUCLEAN;699699+ }724700725701 key.objectid = bytenr;726702 if (node->parent) {···817781 int ret;818782 bool skinny_metadata = btrfs_fs_incompat(fs_info, SKINNY_METADATA);819783 int needed;784784+785785+ if (unlikely(!root)) {786786+ btrfs_err(fs_info,787787+ "missing extent root for extent at bytenr %llu", bytenr);788788+ return -EUCLEAN;789789+ }820790821791 key.objectid = bytenr;822792 key.type = BTRFS_EXTENT_ITEM_KEY;···17221680 }1723168117241682 root = btrfs_extent_root(fs_info, key.objectid);16831683+ if (unlikely(!root)) {16841684+ btrfs_err(fs_info,16851685+ "missing extent root for extent at bytenr %llu",16861686+ key.objectid);16871687+ return -EUCLEAN;16881688+ }17251689again:17261690 ret = btrfs_search_slot(trans, root, &key, path, 0, 1);17271691 if (ret < 0) {···19741926 struct btrfs_root *csum_root;1975192719761928 csum_root = btrfs_csum_root(fs_info, head->bytenr);19771977- ret = btrfs_del_csums(trans, csum_root, head->bytenr,19781978- head->num_bytes);19291929+ if (unlikely(!csum_root)) {19301930+ btrfs_err(fs_info,19311931+ "missing csum root for extent at bytenr %llu",19321932+ head->bytenr);19331933+ ret = -EUCLEAN;19341934+ } else {19351935+ ret = btrfs_del_csums(trans, csum_root, head->bytenr,19361936+ head->num_bytes);19371937+ }19791938 }19801939 }19811940···24332378 u32 expected_size;24342379 int type;24352380 int ret;23812381+23822382+ if (unlikely(!extent_root)) {23832383+ btrfs_err(fs_info,23842384+ "missing extent root for extent at bytenr %llu", bytenr);23852385+ return -EUCLEAN;23862386+ }2436238724372388 key.objectid = bytenr;24382389 key.type = BTRFS_EXTENT_ITEM_KEY;···31543093 struct btrfs_root *csum_root;3155309431563095 csum_root = btrfs_csum_root(trans->fs_info, bytenr);30963096+ if (unlikely(!csum_root)) {30973097+ ret = -EUCLEAN;30983098+ btrfs_abort_transaction(trans, ret);30993099+ btrfs_err(trans->fs_info,31003100+ "missing csum root for extent at bytenr %llu",31013101+ bytenr);31023102+ return ret;31033103+ }31043104+31573105 ret = btrfs_del_csums(trans, csum_root, bytenr, num_bytes);31583106 if (unlikely(ret)) {31593107 btrfs_abort_transaction(trans, ret);···32923222 u64 delayed_ref_root = href->owning_root;3293322332943224 extent_root = btrfs_extent_root(info, bytenr);32953295- ASSERT(extent_root);32253225+ if (unlikely(!extent_root)) {32263226+ btrfs_err(info,32273227+ "missing extent root for extent at bytenr %llu", bytenr);32283228+ return -EUCLEAN;32293229+ }3296323032973231 path = btrfs_alloc_path();32983232 if (!path)···50134939 size += btrfs_extent_inline_ref_size(BTRFS_EXTENT_OWNER_REF_KEY);50144940 size += btrfs_extent_inline_ref_size(type);5015494149424942+ extent_root = btrfs_extent_root(fs_info, ins->objectid);49434943+ if (unlikely(!extent_root)) {49444944+ btrfs_err(fs_info,49454945+ "missing extent root for extent at bytenr %llu",49464946+ ins->objectid);49474947+ return -EUCLEAN;49484948+ }49494949+50164950 path = btrfs_alloc_path();50174951 if (!path)50184952 return -ENOMEM;5019495350205020- extent_root = btrfs_extent_root(fs_info, ins->objectid);50214954 ret = btrfs_insert_empty_item(trans, extent_root, path, ins, size);50224955 if (ret) {50234956 btrfs_free_path(path);···51005019 size += sizeof(*block_info);51015020 }5102502150225022+ extent_root = btrfs_extent_root(fs_info, extent_key.objectid);50235023+ if (unlikely(!extent_root)) {50245024+ btrfs_err(fs_info,50255025+ "missing extent root for extent at bytenr %llu",50265026+ extent_key.objectid);50275027+ return -EUCLEAN;50285028+ }50295029+51035030 path = btrfs_alloc_path();51045031 if (!path)51055032 return -ENOMEM;5106503351075107- extent_root = btrfs_extent_root(fs_info, extent_key.objectid);51085034 ret = btrfs_insert_empty_item(trans, extent_root, path, &extent_key,51095035 size);51105036 if (ret) {
+7
fs/btrfs/file-item.c
···308308 /* Current item doesn't contain the desired range, search again */309309 btrfs_release_path(path);310310 csum_root = btrfs_csum_root(fs_info, disk_bytenr);311311+ if (unlikely(!csum_root)) {312312+ btrfs_err(fs_info,313313+ "missing csum root for extent at bytenr %llu",314314+ disk_bytenr);315315+ return -EUCLEAN;316316+ }317317+311318 item = btrfs_lookup_csum(NULL, csum_root, path, disk_bytenr, 0);312319 if (IS_ERR(item)) {313320 ret = PTR_ERR(item);
+8-1
fs/btrfs/free-space-tree.c
···10731073 if (ret)10741074 return ret;1075107510761076+ extent_root = btrfs_extent_root(trans->fs_info, block_group->start);10771077+ if (unlikely(!extent_root)) {10781078+ btrfs_err(trans->fs_info,10791079+ "missing extent root for block group at offset %llu",10801080+ block_group->start);10811081+ return -EUCLEAN;10821082+ }10831083+10761084 mutex_lock(&block_group->free_space_lock);1077108510781086 /*···10941086 key.type = BTRFS_EXTENT_ITEM_KEY;10951087 key.offset = 0;1096108810971097- extent_root = btrfs_extent_root(trans->fs_info, key.objectid);10981089 ret = btrfs_search_slot_for_read(extent_root, &key, path, 1, 0);10991090 if (ret < 0)11001091 goto out_locked;
+20-5
fs/btrfs/inode.c
···20122012 */2013201320142014 csum_root = btrfs_csum_root(root->fs_info, io_start);20152015+ if (unlikely(!csum_root)) {20162016+ btrfs_err(root->fs_info,20172017+ "missing csum root for extent at bytenr %llu", io_start);20182018+ ret = -EUCLEAN;20192019+ goto out;20202020+ }20212021+20152022 ret = btrfs_lookup_csums_list(csum_root, io_start,20162023 io_start + args->file_extent.num_bytes - 1,20172024 NULL, nowait);···27562749 int ret;2757275027582751 list_for_each_entry(sum, list, list) {27592759- trans->adding_csums = true;27602760- if (!csum_root)27522752+ if (!csum_root) {27612753 csum_root = btrfs_csum_root(trans->fs_info,27622754 sum->logical);27552755+ if (unlikely(!csum_root)) {27562756+ btrfs_err(trans->fs_info,27572757+ "missing csum root for extent at bytenr %llu",27582758+ sum->logical);27592759+ return -EUCLEAN;27602760+ }27612761+ }27622762+ trans->adding_csums = true;27632763 ret = btrfs_csum_file_blocks(trans, csum_root, sum);27642764 trans->adding_csums = false;27652765 if (ret)···98889874 int compression;98899875 size_t orig_count;98909876 const u32 min_folio_size = btrfs_min_folio_size(fs_info);98779877+ const u32 blocksize = fs_info->sectorsize;98919878 u64 start, end;98929879 u64 num_bytes, ram_bytes, disk_num_bytes;98939880 struct btrfs_key ins;···99999984 ret = -EFAULT;100009985 goto out_cb;100019986 }1000210002- if (bytes < min_folio_size)1000310003- folio_zero_range(folio, bytes, min_folio_size - bytes);1000410004- ret = bio_add_folio(&cb->bbio.bio, folio, folio_size(folio), 0);99879987+ if (!IS_ALIGNED(bytes, blocksize))99889988+ folio_zero_range(folio, bytes, round_up(bytes, blocksize) - bytes);99899989+ ret = bio_add_folio(&cb->bbio.bio, folio, round_up(bytes, blocksize), 0);100059990 if (unlikely(!ret)) {100069991 folio_put(folio);100079992 ret = -EINVAL;
+9-3
fs/btrfs/ioctl.c
···36173617 }36183618 }3619361936203620- trans = btrfs_join_transaction(root);36203620+ /* 2 BTRFS_QGROUP_RELATION_KEY items. */36213621+ trans = btrfs_start_transaction(root, 2);36213622 if (IS_ERR(trans)) {36223623 ret = PTR_ERR(trans);36233624 goto out;···36903689 goto out;36913690 }3692369136933693- trans = btrfs_join_transaction(root);36923692+ /*36933693+ * 1 BTRFS_QGROUP_INFO_KEY item.36943694+ * 1 BTRFS_QGROUP_LIMIT_KEY item.36953695+ */36963696+ trans = btrfs_start_transaction(root, 2);36943697 if (IS_ERR(trans)) {36953698 ret = PTR_ERR(trans);36963699 goto out;···37433738 goto drop_write;37443739 }3745374037463746- trans = btrfs_join_transaction(root);37413741+ /* 1 BTRFS_QGROUP_LIMIT_KEY item. */37423742+ trans = btrfs_start_transaction(root, 1);37473743 if (IS_ERR(trans)) {37483744 ret = PTR_ERR(trans);37493745 goto out;
+2-2
fs/btrfs/lzo.c
···429429int lzo_decompress_bio(struct list_head *ws, struct compressed_bio *cb)430430{431431 struct workspace *workspace = list_entry(ws, struct workspace, list);432432- const struct btrfs_fs_info *fs_info = cb->bbio.inode->root->fs_info;432432+ struct btrfs_fs_info *fs_info = cb->bbio.inode->root->fs_info;433433 const u32 sectorsize = fs_info->sectorsize;434434 struct folio_iter fi;435435 char *kaddr;···447447 /* There must be a compressed folio and matches the sectorsize. */448448 if (unlikely(!fi.folio))449449 return -EINVAL;450450- ASSERT(folio_size(fi.folio) == sectorsize);450450+ ASSERT(folio_size(fi.folio) == btrfs_min_folio_size(fs_info));451451 kaddr = kmap_local_folio(fi.folio, 0);452452 len_in = read_compress_length(kaddr);453453 kunmap_local(kaddr);
+8
fs/btrfs/qgroup.c
···37393739 mutex_lock(&fs_info->qgroup_rescan_lock);37403740 extent_root = btrfs_extent_root(fs_info,37413741 fs_info->qgroup_rescan_progress.objectid);37423742+ if (unlikely(!extent_root)) {37433743+ btrfs_err(fs_info,37443744+ "missing extent root for extent at bytenr %llu",37453745+ fs_info->qgroup_rescan_progress.objectid);37463746+ mutex_unlock(&fs_info->qgroup_rescan_lock);37473747+ return -EUCLEAN;37483748+ }37493749+37423750 ret = btrfs_search_slot_for_read(extent_root,37433751 &fs_info->qgroup_rescan_progress,37443752 path, 1, 0);
+10-2
fs/btrfs/raid56.c
···22972297static void fill_data_csums(struct btrfs_raid_bio *rbio)22982298{22992299 struct btrfs_fs_info *fs_info = rbio->bioc->fs_info;23002300- struct btrfs_root *csum_root = btrfs_csum_root(fs_info,23012301- rbio->bioc->full_stripe_logical);23002300+ struct btrfs_root *csum_root;23022301 const u64 start = rbio->bioc->full_stripe_logical;23032302 const u32 len = (rbio->nr_data * rbio->stripe_nsectors) <<23042303 fs_info->sectorsize_bits;···23272328 GFP_NOFS);23282329 if (!rbio->csum_buf || !rbio->csum_bitmap) {23292330 ret = -ENOMEM;23312331+ goto error;23322332+ }23332333+23342334+ csum_root = btrfs_csum_root(fs_info, rbio->bioc->full_stripe_logical);23352335+ if (unlikely(!csum_root)) {23362336+ btrfs_err(fs_info,23372337+ "missing csum root for extent at bytenr %llu",23382338+ rbio->bioc->full_stripe_logical);23392339+ ret = -EUCLEAN;23302340 goto error;23312341 }23322342
+32-7
fs/btrfs/relocation.c
···41854185 dest_addr = ins.objectid;41864186 dest_length = ins.offset;4187418741884188+ dest_bg = btrfs_lookup_block_group(fs_info, dest_addr);41894189+41884190 if (!is_data && !IS_ALIGNED(dest_length, fs_info->nodesize)) {41894191 u64 new_length = ALIGN_DOWN(dest_length, fs_info->nodesize);41904192···42974295 if (unlikely(ret))42984296 goto end;4299429743004300- dest_bg = btrfs_lookup_block_group(fs_info, dest_addr);43014301-43024298 adjust_block_group_remap_bytes(trans, dest_bg, dest_length);4303429943044300 mutex_lock(&dest_bg->free_space_lock);43054301 bg_needs_free_space = test_bit(BLOCK_GROUP_FLAG_NEEDS_FREE_SPACE,43064302 &dest_bg->runtime_flags);43074303 mutex_unlock(&dest_bg->free_space_lock);43084308- btrfs_put_block_group(dest_bg);4309430443104305 if (bg_needs_free_space) {43114306 ret = btrfs_add_block_group_free_space(trans, dest_bg);···43324333 btrfs_end_transaction(trans);43334334 }43344335 } else {43354335- dest_bg = btrfs_lookup_block_group(fs_info, dest_addr);43364336 btrfs_free_reserved_bytes(dest_bg, dest_length, 0);43374337- btrfs_put_block_group(dest_bg);4338433743394338 ret = btrfs_commit_transaction(trans);43404339 }43404340+43414341+ btrfs_put_block_group(dest_bg);4341434243424343 return ret;43434344}···49534954 struct btrfs_space_info *sinfo = src_bg->space_info;4954495549554956 extent_root = btrfs_extent_root(fs_info, src_bg->start);49574957+ if (unlikely(!extent_root)) {49584958+ btrfs_err(fs_info,49594959+ "missing extent root for block group at offset %llu",49604960+ src_bg->start);49614961+ return -EUCLEAN;49624962+ }4956496349574964 trans = btrfs_start_transaction(extent_root, 0);49584965 if (IS_ERR(trans))···53115306 int ret;53125307 bool bg_is_ro = false;5313530853095309+ if (unlikely(!extent_root)) {53105310+ btrfs_err(fs_info,53115311+ "missing extent root for block group at offset %llu",53125312+ group_start);53135313+ return -EUCLEAN;53145314+ }53155315+53145316 /*53155317 * This only gets set if we had a half-deleted snapshot on mount. We53165318 * cannot allow relocation to start while we're still trying to clean up···55485536 goto out;55495537 }5550553855395539+ rc->extent_root = btrfs_extent_root(fs_info, 0);55405540+ if (unlikely(!rc->extent_root)) {55415541+ btrfs_err(fs_info, "missing extent root for extent at bytenr 0");55425542+ ret = -EUCLEAN;55435543+ goto out;55445544+ }55455545+55515546 ret = reloc_chunk_start(fs_info);55525547 if (ret < 0)55535548 goto out_end;55545554-55555555- rc->extent_root = btrfs_extent_root(fs_info, 0);5556554955575550 set_reloc_control(rc);55585551···56525635 struct btrfs_root *csum_root = btrfs_csum_root(fs_info, disk_bytenr);56535636 LIST_HEAD(list);56545637 int ret;56385638+56395639+ if (unlikely(!csum_root)) {56405640+ btrfs_mark_ordered_extent_error(ordered);56415641+ btrfs_err(fs_info,56425642+ "missing csum root for extent at bytenr %llu",56435643+ disk_bytenr);56445644+ return -EUCLEAN;56455645+ }5655564656565647 ret = btrfs_lookup_csums_list(csum_root, disk_bytenr,56575648 disk_bytenr + ordered->num_bytes - 1,
+18-1
fs/btrfs/tree-checker.c
···12841284 }12851285 if (unlikely(btrfs_root_drop_level(&ri) >= BTRFS_MAX_LEVEL)) {12861286 generic_err(leaf, slot,12871287- "invalid root level, have %u expect [0, %u]",12871287+ "invalid root drop_level, have %u expect [0, %u]",12881288 btrfs_root_drop_level(&ri), BTRFS_MAX_LEVEL - 1);12891289+ return -EUCLEAN;12901290+ }12911291+ /*12921292+ * If drop_progress.objectid is non-zero, a btrfs_drop_snapshot() was12931293+ * interrupted and the resume point was recorded in drop_progress and12941294+ * drop_level. In that case drop_level must be >= 1: level 0 is the12951295+ * leaf level and drop_snapshot never saves a checkpoint there (it12961296+ * only records checkpoints at internal node levels in DROP_REFERENCE12971297+ * stage). A zero drop_level combined with a non-zero drop_progress12981298+ * objectid indicates on-disk corruption and would cause a BUG_ON in12991299+ * merge_reloc_root() and btrfs_drop_snapshot() at mount time.13001300+ */13011301+ if (unlikely(btrfs_disk_key_objectid(&ri.drop_progress) != 0 &&13021302+ btrfs_root_drop_level(&ri) == 0)) {13031303+ generic_err(leaf, slot,13041304+ "invalid root drop_level 0 with non-zero drop_progress objectid %llu",13051305+ btrfs_disk_key_objectid(&ri.drop_progress));12891306 return -EUCLEAN;12901307 }12911308
+27
fs/btrfs/tree-log.c
···984984985985 sums = list_first_entry(&ordered_sums, struct btrfs_ordered_sum, list);986986 csum_root = btrfs_csum_root(fs_info, sums->logical);987987+ if (unlikely(!csum_root)) {988988+ btrfs_err(fs_info,989989+ "missing csum root for extent at bytenr %llu",990990+ sums->logical);991991+ ret = -EUCLEAN;992992+ }993993+987994 if (!ret) {988995 ret = btrfs_del_csums(trans, csum_root, sums->logical,989996 sums->len);···48974890 }4898489148994892 csum_root = btrfs_csum_root(trans->fs_info, disk_bytenr);48934893+ if (unlikely(!csum_root)) {48944894+ btrfs_err(trans->fs_info,48954895+ "missing csum root for extent at bytenr %llu",48964896+ disk_bytenr);48974897+ return -EUCLEAN;48984898+ }48994899+49004900 disk_bytenr += extent_offset;49014901 ret = btrfs_lookup_csums_list(csum_root, disk_bytenr,49024902 disk_bytenr + extent_num_bytes - 1,···51005086 /* block start is already adjusted for the file extent offset. */51015087 block_start = btrfs_extent_map_block_start(em);51025088 csum_root = btrfs_csum_root(trans->fs_info, block_start);50895089+ if (unlikely(!csum_root)) {50905090+ btrfs_err(trans->fs_info,50915091+ "missing csum root for extent at bytenr %llu",50925092+ block_start);50935093+ return -EUCLEAN;50945094+ }50955095+51035096 ret = btrfs_lookup_csums_list(csum_root, block_start + csum_offset,51045097 block_start + csum_offset + csum_len - 1,51055098 &ordered_sums, false);···62166195 struct btrfs_root *root,62176196 struct btrfs_log_ctx *ctx)62186197{61986198+ const bool orig_log_new_dentries = ctx->log_new_dentries;62196199 int ret = 0;6220620062216201 /*···62786256 * dir index key range logged for the directory. So we62796257 * must make sure the deletion is recorded.62806258 */62596259+ ctx->log_new_dentries = false;62816260 ret = btrfs_log_inode(trans, inode, LOG_INODE_ALL, ctx);62616261+ if (!ret && ctx->log_new_dentries)62626262+ ret = log_new_dir_dentries(trans, inode, ctx);62636263+62826264 btrfs_add_delayed_iput(inode);62836265 if (ret)62846266 break;···63176291 break;63186292 }6319629362946294+ ctx->log_new_dentries = orig_log_new_dentries;63206295 ctx->logging_conflict_inodes = false;63216296 if (ret)63226297 free_conflicting_inodes(ctx);
+18-9
fs/btrfs/volumes.c
···3587358735883588 /* step one, relocate all the extents inside this chunk */35893589 btrfs_scrub_pause(fs_info);35903590- ret = btrfs_relocate_block_group(fs_info, chunk_offset, true);35903590+ ret = btrfs_relocate_block_group(fs_info, chunk_offset, verbose);35913591 btrfs_scrub_continue(fs_info);35923592 if (ret) {35933593 /*···42774277end:42784278 while (!list_empty(chunks)) {42794279 bool is_unused;42804280+ struct btrfs_block_group *bg;4280428142814282 rci = list_first_entry(chunks, struct remap_chunk_info, list);4282428342834283- spin_lock(&rci->bg->lock);42844284- is_unused = !btrfs_is_block_group_used(rci->bg);42854285- spin_unlock(&rci->bg->lock);42844284+ bg = rci->bg;42854285+ if (bg) {42864286+ /*42874287+ * This is a bit racy and the 'used' status can change42884288+ * but this is not a problem as later functions will42894289+ * verify it again.42904290+ */42914291+ spin_lock(&bg->lock);42924292+ is_unused = !btrfs_is_block_group_used(bg);42934293+ spin_unlock(&bg->lock);4286429442874287- if (is_unused)42884288- btrfs_mark_bg_unused(rci->bg);42954295+ if (is_unused)42964296+ btrfs_mark_bg_unused(bg);4289429742904290- if (rci->made_ro)42914291- btrfs_dec_block_group_ro(rci->bg);42984298+ if (rci->made_ro)42994299+ btrfs_dec_block_group_ro(bg);4292430042934293- btrfs_put_block_group(rci->bg);43014301+ btrfs_put_block_group(bg);43024302+ }4294430342954304 list_del(&rci->list);42964305 kfree(rci);
+11-2
fs/btrfs/zoned.c
···337337 if (!btrfs_fs_incompat(fs_info, ZONED))338338 return 0;339339340340- mutex_lock(&fs_devices->device_list_mutex);340340+ /*341341+ * No need to take the device_list mutex here, we're still in the mount342342+ * path and devices cannot be added to or removed from the list yet.343343+ */341344 list_for_each_entry(device, &fs_devices->devices, dev_list) {342345 /* We can skip reading of zone info for missing devices */343346 if (!device->bdev)···350347 if (ret)351348 break;352349 }353353- mutex_unlock(&fs_devices->device_list_mutex);354350355351 return ret;356352}···12611259 key.offset = 0;1262126012631261 root = btrfs_extent_root(fs_info, key.objectid);12621262+ if (unlikely(!root)) {12631263+ btrfs_err(fs_info,12641264+ "missing extent root for extent at bytenr %llu",12651265+ key.objectid);12661266+ return -EUCLEAN;12671267+ }12681268+12641269 ret = btrfs_search_slot(NULL, root, &key, path, 0, 0);12651270 /* We should not find the exact match */12661271 if (unlikely(!ret))
···541541 struct xdr_netobj cr_princhash;542542};543543544544-/* A reasonable value for REPLAY_ISIZE was estimated as follows: 545545- * The OPEN response, typically the largest, requires 546546- * 4(status) + 8(stateid) + 20(changeinfo) + 4(rflags) + 8(verifier) + 547547- * 4(deleg. type) + 8(deleg. stateid) + 4(deleg. recall flag) + 548548- * 20(deleg. space limit) + ~32(deleg. ace) = 112 bytes 544544+/*545545+ * REPLAY_ISIZE is sized for an OPEN response with delegation:546546+ * 4(status) + 8(stateid) + 20(changeinfo) + 4(rflags) +547547+ * 8(verifier) + 4(deleg. type) + 8(deleg. stateid) +548548+ * 4(deleg. recall flag) + 20(deleg. space limit) +549549+ * ~32(deleg. ace) = 112 bytes550550+ *551551+ * Some responses can exceed this. A LOCK denial includes the conflicting552552+ * lock owner, which can be up to 1024 bytes (NFS4_OPAQUE_LIMIT). Responses553553+ * larger than REPLAY_ISIZE are not cached in rp_ibuf; only rp_status is554554+ * saved. Enlarging this constant increases the size of every555555+ * nfs4_stateowner.549556 */550557551558#define NFSD4_REPLAY_ISIZE 112
+6
fs/smb/client/cifsglob.h
···23862386 return opts;23872387}2388238823892389+/*23902390+ * The number of blocks is not related to (i_size / i_blksize), but instead23912391+ * 512 byte (2**9) size is required for calculating num blocks.23922392+ */23932393+#define CIFS_INO_BLOCKS(size) DIV_ROUND_UP_ULL((u64)(size), 512)23942394+23892395#endif /* _CIFS_GLOB_H */
+4
fs/smb/client/connect.c
···19551955 case Kerberos:19561956 if (!uid_eq(ctx->cred_uid, ses->cred_uid))19571957 return 0;19581958+ if (strncmp(ses->user_name ?: "",19591959+ ctx->username ?: "",19601960+ CIFS_MAX_USERNAME_LEN))19611961+ return 0;19581962 break;19591963 case NTLMv2:19601964 case RawNTLMSSP:
-1
fs/smb/client/file.c
···993993 if (!rc) {994994 netfs_resize_file(&cinode->netfs, 0, true);995995 cifs_setsize(inode, 0);996996- inode->i_blocks = 0;997996 }998997 }999998 if (cfile)
+6-15
fs/smb/client/inode.c
···219219 */220220 if (is_size_safe_to_change(cifs_i, fattr->cf_eof, from_readdir)) {221221 i_size_write(inode, fattr->cf_eof);222222-223223- /*224224- * i_blocks is not related to (i_size / i_blksize),225225- * but instead 512 byte (2**9) size is required for226226- * calculating num blocks.227227- */228228- inode->i_blocks = (512 - 1 + fattr->cf_bytes) >> 9;222222+ inode->i_blocks = CIFS_INO_BLOCKS(fattr->cf_bytes);229223 }230224231225 if (S_ISLNK(fattr->cf_mode) && fattr->cf_symlink_target) {···30093015{30103016 spin_lock(&inode->i_lock);30113017 i_size_write(inode, offset);30183018+ /*30193019+ * Until we can query the server for actual allocation size,30203020+ * this is best estimate we have for blocks allocated for a file.30213021+ */30223022+ inode->i_blocks = CIFS_INO_BLOCKS(offset);30123023 spin_unlock(&inode->i_lock);30133024 inode_set_mtime_to_ts(inode, inode_set_ctime_current(inode));30143025 truncate_pagecache(inode, offset);···30863087 if (rc == 0) {30873088 netfs_resize_file(&cifsInode->netfs, size, true);30883089 cifs_setsize(inode, size);30893089- /*30903090- * i_blocks is not related to (i_size / i_blksize), but instead30913091- * 512 byte (2**9) size is required for calculating num blocks.30923092- * Until we can query the server for actual allocation size,30933093- * this is best estimate we have for blocks allocated for a file30943094- * Number of blocks must be rounded up so size 1 is not 0 blocks30953095- */30963096- inode->i_blocks = (512 - 1 + size) >> 9;30973090 }3098309130993092 return rc;
+1-1
fs/smb/client/smb1transport.c
···460460 return 0;461461462462 /*463463- * Windows NT server returns error resposne (e.g. STATUS_DELETE_PENDING463463+ * Windows NT server returns error response (e.g. STATUS_DELETE_PENDING464464 * or STATUS_OBJECT_NAME_NOT_FOUND or ERRDOS/ERRbadfile or any other)465465 * for some TRANS2 requests without the RESPONSE flag set in header.466466 */
+4-16
fs/smb/client/smb2ops.c
···14971497{14981498 struct smb2_file_network_open_info file_inf;14991499 struct inode *inode;15001500+ u64 asize;15001501 int rc;1501150215021503 rc = __SMB2_close(xid, tcon, cfile->fid.persistent_fid,···15211520 inode_set_atime_to_ts(inode,15221521 cifs_NTtimeToUnix(file_inf.LastAccessTime));1523152215241524- /*15251525- * i_blocks is not related to (i_size / i_blksize),15261526- * but instead 512 byte (2**9) size is required for15271527- * calculating num blocks.15281528- */15291529- if (le64_to_cpu(file_inf.AllocationSize) > 4096)15301530- inode->i_blocks =15311531- (512 - 1 + le64_to_cpu(file_inf.AllocationSize)) >> 9;15231523+ asize = le64_to_cpu(file_inf.AllocationSize);15241524+ if (asize > 4096)15251525+ inode->i_blocks = CIFS_INO_BLOCKS(asize);1532152615331527 /* End of file and Attributes should not have to be updated on close */15341528 spin_unlock(&inode->i_lock);···22002204 rc = smb2_set_file_size(xid, tcon, trgtfile, dest_off + len, false);22012205 if (rc)22022206 goto duplicate_extents_out;22032203-22042204- /*22052205- * Although also could set plausible allocation size (i_blocks)22062206- * here in addition to setting the file size, in reflink22072207- * it is likely that the target file is sparse. Its allocation22082208- * size will be queried on next revalidate, but it is important22092209- * to make sure that file's cached size is updated immediately22102210- */22112207 netfs_resize_file(netfs_inode(inode), dest_off + len, true);22122208 cifs_setsize(inode, dest_off + len);22132209 }
+6-3
fs/smb/server/mgmt/tree_connect.c
···102102103103void ksmbd_tree_connect_put(struct ksmbd_tree_connect *tcon)104104{105105- if (atomic_dec_and_test(&tcon->refcount))105105+ if (atomic_dec_and_test(&tcon->refcount)) {106106+ ksmbd_share_config_put(tcon->share_conf);106107 kfree(tcon);108108+ }107109}108110109111static int __ksmbd_tree_conn_disconnect(struct ksmbd_session *sess,···115113116114 ret = ksmbd_ipc_tree_disconnect_request(sess->id, tree_conn->id);117115 ksmbd_release_tree_conn_id(sess, tree_conn->id);118118- ksmbd_share_config_put(tree_conn->share_conf);119116 ksmbd_counter_dec(KSMBD_COUNTER_TREE_CONNS);120120- if (atomic_dec_and_test(&tree_conn->refcount))117117+ if (atomic_dec_and_test(&tree_conn->refcount)) {118118+ ksmbd_share_config_put(tree_conn->share_conf);121119 kfree(tree_conn);120120+ }122121 return ret;123122}124123
+12-5
fs/smb/server/smb2pdu.c
···126126 pr_err("The first operation in the compound does not have tcon\n");127127 return -EINVAL;128128 }129129+ if (work->tcon->t_state != TREE_CONNECTED)130130+ return -ENOENT;129131 if (tree_id != UINT_MAX && work->tcon->id != tree_id) {130132 pr_err("tree id(%u) is different with id(%u) in first operation\n",131133 tree_id, work->tcon->id);···19501948 }19511949 }19521950 smb2_set_err_rsp(work);19511951+ conn->binding = false;19531952 } else {19541953 unsigned int iov_len;19551954···28312828 goto out;28322829 }2833283028342834- dh_info->fp->conn = conn;28312831+ if (dh_info->fp->conn) {28322832+ ksmbd_put_durable_fd(dh_info->fp);28332833+ err = -EBADF;28342834+ goto out;28352835+ }28352836 dh_info->reconnected = true;28362837 goto out;28372838 }···54595452 struct smb2_query_info_req *req,54605453 struct smb2_query_info_rsp *rsp)54615454{54625462- struct ksmbd_session *sess = work->sess;54635455 struct ksmbd_conn *conn = work->conn;54645456 struct ksmbd_share_config *share = work->tcon->share_conf;54655457 int fsinfoclass = 0;···5595558955965590 info = (struct object_id_info *)(rsp->Buffer);5597559155985598- if (!user_guest(sess->user))55995599- memcpy(info->objid, user_passkey(sess->user), 16);55925592+ if (path.mnt->mnt_sb->s_uuid_len == 16)55935593+ memcpy(info->objid, path.mnt->mnt_sb->s_uuid.b,55945594+ path.mnt->mnt_sb->s_uuid_len);56005595 else56015601- memset(info->objid, 0, 16);55965596+ memcpy(info->objid, &stfs.f_fsid, sizeof(stfs.f_fsid));5602559756035598 info->extended_info.magic = cpu_to_le32(EXTENDED_INFO_MAGIC);56045599 info->extended_info.version = cpu_to_le32(1);
···4455#include <uapi/linux/auxvec.h>6677-#define AT_VECTOR_SIZE_BASE 22 /* NEW_AUX_ENT entries in auxiliary table */77+#define AT_VECTOR_SIZE_BASE 24 /* NEW_AUX_ENT entries in auxiliary table */88 /* number of "#define AT_.*" above, minus {AT_NULL, AT_IGNORE, AT_NOTELF} */99#endif /* _LINUX_AUXVEC_H */
+3-1
include/linux/build_bug.h
···3232/**3333 * BUILD_BUG_ON_MSG - break compile if a condition is true & emit supplied3434 * error message.3535- * @condition: the condition which the compiler should know is false.3535+ * @cond: the condition which the compiler should know is false.3636+ * @msg: build-time error message3637 *3738 * See BUILD_BUG_ON for description.3839 */···61606261/**6362 * static_assert - check integer constant expression at build time6363+ * @expr: expression to be checked6464 *6565 * static_assert() is a wrapper for the C11 _Static_assert, with a6666 * little macro magic to make the message optional (defaulting to the
+1
include/linux/console_struct.h
···160160 struct uni_pagedict **uni_pagedict_loc; /* [!] Location of uni_pagedict variable for this console */161161 u32 **vc_uni_lines; /* unicode screen content */162162 u16 *vc_saved_screen;163163+ u32 **vc_saved_uni_lines;163164 unsigned int vc_saved_cols;164165 unsigned int vc_saved_rows;165166 /* additional information is in vt_kern.h */
+54
include/linux/device.h
···483483 * on. This shrinks the "Board Support Packages" (BSPs) and484484 * minimizes board-specific #ifdefs in drivers.485485 * @driver_data: Private pointer for driver specific info.486486+ * @driver_override: Driver name to force a match. Do not touch directly; use487487+ * device_set_driver_override() instead.486488 * @links: Links to suppliers and consumers of this device.487489 * @power: For device power management.488490 * See Documentation/driver-api/pm/devices.rst for details.···578576 core doesn't touch it */579577 void *driver_data; /* Driver data, set and get with580578 dev_set_drvdata/dev_get_drvdata */579579+ struct {580580+ const char *name;581581+ spinlock_t lock;582582+ } driver_override;581583 struct mutex mutex; /* mutex to synchronize calls to582584 * its driver.583585 */···706700};707701708702#define kobj_to_dev(__kobj) container_of_const(__kobj, struct device, kobj)703703+704704+int __device_set_driver_override(struct device *dev, const char *s, size_t len);705705+706706+/**707707+ * device_set_driver_override() - Helper to set or clear driver override.708708+ * @dev: Device to change709709+ * @s: NUL-terminated string, new driver name to force a match, pass empty710710+ * string to clear it ("" or "\n", where the latter is only for sysfs711711+ * interface).712712+ *713713+ * Helper to set or clear driver override of a device.714714+ *715715+ * Returns: 0 on success or a negative error code on failure.716716+ */717717+static inline int device_set_driver_override(struct device *dev, const char *s)718718+{719719+ return __device_set_driver_override(dev, s, s ? strlen(s) : 0);720720+}721721+722722+/**723723+ * device_has_driver_override() - Check if a driver override has been set.724724+ * @dev: device to check725725+ *726726+ * Returns true if a driver override has been set for this device.727727+ */728728+static inline bool device_has_driver_override(struct device *dev)729729+{730730+ guard(spinlock)(&dev->driver_override.lock);731731+ return !!dev->driver_override.name;732732+}733733+734734+/**735735+ * device_match_driver_override() - Match a driver against the device's driver_override.736736+ * @dev: device to check737737+ * @drv: driver to match against738738+ *739739+ * Returns > 0 if a driver override is set and matches the given driver, 0 if a740740+ * driver override is set but does not match, or < 0 if a driver override is not741741+ * set at all.742742+ */743743+static inline int device_match_driver_override(struct device *dev,744744+ const struct device_driver *drv)745745+{746746+ guard(spinlock)(&dev->driver_override.lock);747747+ if (dev->driver_override.name)748748+ return !strcmp(dev->driver_override.name, drv->name);749749+ return -1;750750+}709751710752/**711753 * device_iommu_mapped - Returns true when the device DMA is translated
+4
include/linux/device/bus.h
···6565 * this bus.6666 * @pm: Power management operations of this bus, callback the specific6767 * device driver's pm-ops.6868+ * @driver_override: Set to true if this bus supports the driver_override6969+ * mechanism, which allows userspace to force a specific7070+ * driver to bind to a device via a sysfs attribute.6871 * @need_parent_lock: When probing or removing a device on this bus, the6972 * device core should lock the device's parent.7073 *···109106110107 const struct dev_pm_ops *pm;111108109109+ bool driver_override;112110 bool need_parent_lock;113111};114112
···5353 * tables.5454 * @ias: Input address (iova) size, in bits.5555 * @oas: Output address (paddr) size, in bits.5656- * @coherent_walk A flag to indicate whether or not page table walks made5656+ * @coherent_walk: A flag to indicate whether or not page table walks made5757 * by the IOMMU are coherent with the CPU caches.5858 * @tlb: TLB management callbacks for this set of tables.5959 * @iommu_dev: The device representing the DMA configuration for the···136136 void (*free)(void *cookie, void *pages, size_t size);137137138138 /* Low-level data specific to the table format */139139+ /* private: */139140 union {140141 struct {141142 u64 ttbr;···204203 * @unmap_pages: Unmap a range of virtually contiguous pages of the same size.205204 * @iova_to_phys: Translate iova to physical address.206205 * @pgtable_walk: (optional) Perform a page table walk for a given iova.206206+ * @read_and_clear_dirty: Record dirty info per IOVA. If an IOVA is dirty,207207+ * clear its dirty state from the PTE unless the208208+ * IOMMU_DIRTY_NO_CLEAR flag is passed in.207209 *208210 * These functions map directly onto the iommu_ops member functions with209211 * the same names.···235231 * the configuration actually provided by the allocator (e.g. the236232 * pgsize_bitmap may be restricted).237233 * @cookie: An opaque token provided by the IOMMU driver and passed back to238238- * the callback routines in cfg->tlb.234234+ * the callback routines.235235+ *236236+ * Returns: Pointer to the &struct io_pgtable_ops for this set of page tables.239237 */240238struct io_pgtable_ops *alloc_io_pgtable_ops(enum io_pgtable_fmt fmt,241239 struct io_pgtable_cfg *cfg,
+3
include/linux/io_uring_types.h
···541541 REQ_F_BL_NO_RECYCLE_BIT,542542 REQ_F_BUFFERS_COMMIT_BIT,543543 REQ_F_BUF_NODE_BIT,544544+ REQ_F_BUF_MORE_BIT,544545 REQ_F_HAS_METADATA_BIT,545546 REQ_F_IMPORT_BUFFER_BIT,546547 REQ_F_SQE_COPIED_BIT,···627626 REQ_F_BUFFERS_COMMIT = IO_REQ_FLAG(REQ_F_BUFFERS_COMMIT_BIT),628627 /* buf node is valid */629628 REQ_F_BUF_NODE = IO_REQ_FLAG(REQ_F_BUF_NODE_BIT),629629+ /* incremental buffer consumption, more space available */630630+ REQ_F_BUF_MORE = IO_REQ_FLAG(REQ_F_BUF_MORE_BIT),630631 /* request has read/write metadata assigned */631632 REQ_F_HAS_METADATA = IO_REQ_FLAG(REQ_F_HAS_METADATA_BIT),632633 /*
+1-1
include/linux/local_lock_internal.h
···315315316316#endif /* CONFIG_PREEMPT_RT */317317318318-#if defined(WARN_CONTEXT_ANALYSIS)318318+#if defined(WARN_CONTEXT_ANALYSIS) && !defined(__CHECKER__)319319/*320320 * Because the compiler only knows about the base per-CPU variable, use this321321 * helper function to make the compiler think we lock/unlock the @base variable,
···3131 struct resource *resource;32323333 const struct platform_device_id *id_entry;3434- /*3535- * Driver name to force a match. Do not set directly, because core3636- * frees it. Use driver_set_override() to set or clear it.3737- */3838- const char *driver_override;39344035 /* MFD cell pointer */4136 struct mfd_cell *mfd_cell;
+1
include/linux/serial_8250.h
···195195void serial8250_do_set_divisor(struct uart_port *port, unsigned int baud,196196 unsigned int quot);197197int fsl8250_handle_irq(struct uart_port *port);198198+void serial8250_handle_irq_locked(struct uart_port *port, unsigned int iir);198199int serial8250_handle_irq(struct uart_port *port, unsigned int iir);199200u16 serial8250_rx_chars(struct uart_8250_port *up, u16 lsr);200201void serial8250_read_char(struct uart_8250_port *up, u16 lsr);
···74077407 * @band: the band to transmit on74087408 * @sta: optional pointer to get the station to send the frame to74097409 *74107410- * Return: %true if the skb was prepared, %false otherwise74107410+ * Return: %true if the skb was prepared, %false otherwise.74117411+ * On failure, the skb is freed by this function; callers must not74127412+ * free it again.74117413 *74127414 * Note: must be called under RCU lock74137415 */
···34343535static bool io_kbuf_inc_commit(struct io_buffer_list *bl, int len)3636{3737+ /* No data consumed, return false early to avoid consuming the buffer */3838+ if (!len)3939+ return false;4040+3741 while (len) {3842 struct io_uring_buf *buf;3943 u32 buf_len, this_len;···216212 sel.addr = u64_to_user_ptr(READ_ONCE(buf->addr));217213218214 if (io_should_commit(req, issue_flags)) {219219- io_kbuf_commit(req, sel.buf_list, *len, 1);215215+ if (!io_kbuf_commit(req, sel.buf_list, *len, 1))216216+ req->flags |= REQ_F_BUF_MORE;220217 sel.buf_list = NULL;221218 }222219 return sel;···350345 */351346 if (ret > 0) {352347 req->flags |= REQ_F_BUFFERS_COMMIT | REQ_F_BL_NO_RECYCLE;353353- io_kbuf_commit(req, sel->buf_list, arg->out_len, ret);348348+ if (!io_kbuf_commit(req, sel->buf_list, arg->out_len, ret))349349+ req->flags |= REQ_F_BUF_MORE;354350 }355351 } else {356352 ret = io_provided_buffers_select(req, &arg->out_len, sel->buf_list, arg->iovs);···397391398392 if (bl)399393 ret = io_kbuf_commit(req, bl, len, nr);394394+ if (ret && (req->flags & REQ_F_BUF_MORE))395395+ ret = false;400396401401- req->flags &= ~REQ_F_BUFFER_RING;397397+ req->flags &= ~(REQ_F_BUFFER_RING | REQ_F_BUF_MORE);402398 return ret;403399}404400
+7-2
io_uring/poll.c
···272272 atomic_andnot(IO_POLL_RETRY_FLAG, &req->poll_refs);273273 v &= ~IO_POLL_RETRY_FLAG;274274 }275275+ v &= IO_POLL_REF_MASK;275276 }276277277278 /* the mask was stashed in __io_poll_execute */···305304 return IOU_POLL_REMOVE_POLL_USE_RES;306305 }307306 } else {308308- int ret = io_poll_issue(req, tw);307307+ int ret;309308309309+ /* multiple refs and HUP, ensure we loop once more */310310+ if ((req->cqe.res & (POLLHUP | POLLRDHUP)) && v != 1)311311+ v--;312312+313313+ ret = io_poll_issue(req, tw);310314 if (ret == IOU_COMPLETE)311315 return IOU_POLL_REMOVE_POLL_USE_RES;312316 else if (ret == IOU_REQUEUE)···327321 * Release all references, retry if someone tried to restart328322 * task_work while we were executing it.329323 */330330- v &= IO_POLL_REF_MASK;331324 } while (atomic_sub_return(v, &req->poll_refs) & IO_POLL_REF_MASK);332325333326 io_napi_add(req);
+20-4
kernel/bpf/btf.c
···17871787 * of the _bh() version.17881788 */17891789 spin_lock_irqsave(&btf_idr_lock, flags);17901790- idr_remove(&btf_idr, btf->id);17901790+ if (btf->id) {17911791+ idr_remove(&btf_idr, btf->id);17921792+ /*17931793+ * Clear the id here to make this function idempotent, since it will get17941794+ * called a couple of times for module BTFs: on module unload, and then17951795+ * the final btf_put(). btf_alloc_id() starts IDs with 1, so we can use17961796+ * 0 as sentinel value.17971797+ */17981798+ WRITE_ONCE(btf->id, 0);17991799+ }17911800 spin_unlock_irqrestore(&btf_idr_lock, flags);17921801}17931802···81248115{81258116 const struct btf *btf = filp->private_data;8126811781278127- seq_printf(m, "btf_id:\t%u\n", btf->id);81188118+ seq_printf(m, "btf_id:\t%u\n", READ_ONCE(btf->id));81288119}81298120#endif81308121···82068197 if (copy_from_user(&info, uinfo, info_copy))82078198 return -EFAULT;8208819982098209- info.id = btf->id;82008200+ info.id = READ_ONCE(btf->id);82108201 ubtf = u64_to_user_ptr(info.btf);82118202 btf_copy = min_t(u32, btf->data_size, info.btf_size);82128203 if (copy_to_user(ubtf, btf->data, btf_copy))···8269826082708261u32 btf_obj_id(const struct btf *btf)82718262{82728272- return btf->id;82638263+ return READ_ONCE(btf->id);82738264}8274826582758266bool btf_is_kernel(const struct btf *btf)···83918382 if (btf_mod->module != module)83928383 continue;8393838483858385+ /*83868386+ * For modules, we do the freeing of BTF IDR as soon as83878387+ * module goes away to disable BTF discovery, since the83888388+ * btf_try_get_module() on such BTFs will fail. This may83898389+ * be called again on btf_put(), but it's ok to do so.83908390+ */83918391+ btf_free_id(btf_mod->btf);83948392 list_del(&btf_mod->list);83958393 if (btf_mod->sysfs_attr)83968394 sysfs_remove_bin_file(btf_kobj, btf_mod->sysfs_attr);
+35-8
kernel/bpf/core.c
···14221422 *to++ = BPF_ALU64_IMM(BPF_XOR, BPF_REG_AX, imm_rnd);14231423 *to++ = BPF_STX_MEM(from->code, from->dst_reg, BPF_REG_AX, from->off);14241424 break;14251425+14261426+ case BPF_ST | BPF_PROBE_MEM32 | BPF_DW:14271427+ case BPF_ST | BPF_PROBE_MEM32 | BPF_W:14281428+ case BPF_ST | BPF_PROBE_MEM32 | BPF_H:14291429+ case BPF_ST | BPF_PROBE_MEM32 | BPF_B:14301430+ *to++ = BPF_ALU64_IMM(BPF_MOV, BPF_REG_AX, imm_rnd ^14311431+ from->imm);14321432+ *to++ = BPF_ALU64_IMM(BPF_XOR, BPF_REG_AX, imm_rnd);14331433+ /*14341434+ * Cannot use BPF_STX_MEM() macro here as it14351435+ * hardcodes BPF_MEM mode, losing PROBE_MEM3214361436+ * and breaking arena addressing in the JIT.14371437+ */14381438+ *to++ = (struct bpf_insn) {14391439+ .code = BPF_STX | BPF_PROBE_MEM32 |14401440+ BPF_SIZE(from->code),14411441+ .dst_reg = from->dst_reg,14421442+ .src_reg = BPF_REG_AX,14431443+ .off = from->off,14441444+ };14451445+ break;14251446 }14261447out:14271448 return to - to_buff;···17571736}1758173717591738#ifndef CONFIG_BPF_JIT_ALWAYS_ON17391739+/* Absolute value of s32 without undefined behavior for S32_MIN */17401740+static u32 abs_s32(s32 x)17411741+{17421742+ return x >= 0 ? (u32)x : -(u32)x;17431743+}17441744+17601745/**17611746 * ___bpf_prog_run - run eBPF program on a given context17621747 * @regs: is the array of MAX_BPF_EXT_REG eBPF pseudo-registers···19271900 DST = do_div(AX, (u32) SRC);19281901 break;19291902 case 1:19301930- AX = abs((s32)DST);19311931- AX = do_div(AX, abs((s32)SRC));19031903+ AX = abs_s32((s32)DST);19041904+ AX = do_div(AX, abs_s32((s32)SRC));19321905 if ((s32)DST < 0)19331906 DST = (u32)-AX;19341907 else···19551928 DST = do_div(AX, (u32) IMM);19561929 break;19571930 case 1:19581958- AX = abs((s32)DST);19591959- AX = do_div(AX, abs((s32)IMM));19311931+ AX = abs_s32((s32)DST);19321932+ AX = do_div(AX, abs_s32((s32)IMM));19601933 if ((s32)DST < 0)19611934 DST = (u32)-AX;19621935 else···19821955 DST = (u32) AX;19831956 break;19841957 case 1:19851985- AX = abs((s32)DST);19861986- do_div(AX, abs((s32)SRC));19581958+ AX = abs_s32((s32)DST);19591959+ do_div(AX, abs_s32((s32)SRC));19871960 if (((s32)DST < 0) == ((s32)SRC < 0))19881961 DST = (u32)AX;19891962 else···20091982 DST = (u32) AX;20101983 break;20111984 case 1:20122012- AX = abs((s32)DST);20132013- do_div(AX, abs((s32)IMM));19851985+ AX = abs_s32((s32)DST);19861986+ do_div(AX, abs_s32((s32)IMM));20141987 if (((s32)DST < 0) == ((s32)IMM < 0))20151988 DST = (u32)AX;20161989 else
+25-8
kernel/bpf/verifier.c
···1591015910 /* Apply bswap if alu64 or switch between big-endian and little-endian machines */1591115911 bool need_bswap = alu64 || (to_le == is_big_endian);15912159121591315913+ /*1591415914+ * If the register is mutated, manually reset its scalar ID to break1591515915+ * any existing ties and avoid incorrect bounds propagation.1591615916+ */1591715917+ if (need_bswap || insn->imm == 16 || insn->imm == 32)1591815918+ dst_reg->id = 0;1591915919+1591315920 if (need_bswap) {1591415921 if (insn->imm == 16)1591515922 dst_reg->var_off = tnum_bswap16(dst_reg->var_off);···1599915992 else1600015993 return 0;16001159941600216002- branch = push_stack(env, env->insn_idx + 1, env->insn_idx, false);1599515995+ branch = push_stack(env, env->insn_idx, env->insn_idx, false);1600315996 if (IS_ERR(branch))1600415997 return PTR_ERR(branch);1600515998···1741517408 continue;1741617409 if ((reg->id & ~BPF_ADD_CONST) != (known_reg->id & ~BPF_ADD_CONST))1741717410 continue;1741117411+ /*1741217412+ * Skip mixed 32/64-bit links: the delta relationship doesn't1741317413+ * hold across different ALU widths.1741417414+ */1741517415+ if (((reg->id ^ known_reg->id) & BPF_ADD_CONST) == BPF_ADD_CONST)1741617416+ continue;1741817417 if ((!(reg->id & BPF_ADD_CONST) && !(known_reg->id & BPF_ADD_CONST)) ||1741917418 reg->off == known_reg->off) {1742017419 s32 saved_subreg_def = reg->subreg_def;···1744817435 scalar32_min_max_add(reg, &fake_reg);1744917436 scalar_min_max_add(reg, &fake_reg);1745017437 reg->var_off = tnum_add(reg->var_off, fake_reg.var_off);1745117451- if (known_reg->id & BPF_ADD_CONST32)1743817438+ if ((reg->id | known_reg->id) & BPF_ADD_CONST32)1745217439 zext_32_to_64(reg);1745317440 reg_bounds_sync(reg);1745417441 }···1987619863 * Also verify that new value satisfies old value range knowledge.1987719864 */19878198651987919879- /* ADD_CONST mismatch: different linking semantics */1988019880- if ((rold->id & BPF_ADD_CONST) && !(rcur->id & BPF_ADD_CONST))1988119881- return false;1988219882-1988319883- if (rold->id && !(rold->id & BPF_ADD_CONST) && (rcur->id & BPF_ADD_CONST))1986619866+ /*1986719867+ * ADD_CONST flags must match exactly: BPF_ADD_CONST32 and1986819868+ * BPF_ADD_CONST64 have different linking semantics in1986919869+ * sync_linked_regs() (alu32 zero-extends, alu64 does not),1987019870+ * so pruning across different flag types is unsafe.1987119871+ */1987219872+ if (rold->id &&1987319873+ (rold->id & BPF_ADD_CONST) != (rcur->id & BPF_ADD_CONST))1988419874 return false;19885198751988619876 /* Both have offset linkage: offsets must match */···2092020904 * state when it exits.2092120905 */2092220906 int err = check_resource_leak(env, exception_exit,2092320923- !env->cur_state->curframe,2090720907+ exception_exit || !env->cur_state->curframe,2090820908+ exception_exit ? "bpf_throw" :2092420909 "BPF_EXIT instruction in main prog");2092520910 if (err)2092620911 return err;
···48134813 struct perf_event *sub, *event = data->event;48144814 struct perf_event_context *ctx = event->ctx;48154815 struct perf_cpu_context *cpuctx = this_cpu_ptr(&perf_cpu_context);48164816- struct pmu *pmu = event->pmu;48164816+ struct pmu *pmu;4817481748184818 /*48194819 * If this is a task context, we need to check whether it is···48254825 if (ctx->task && cpuctx->task_ctx != ctx)48264826 return;4827482748284828- raw_spin_lock(&ctx->lock);48284828+ guard(raw_spinlock)(&ctx->lock);48294829 ctx_time_update_event(ctx, event);4830483048314831 perf_event_update_time(event);···48334833 perf_event_update_sibling_time(event);4834483448354835 if (event->state != PERF_EVENT_STATE_ACTIVE)48364836- goto unlock;48364836+ return;4837483748384838 if (!data->group) {48394839- pmu->read(event);48394839+ perf_pmu_read(event);48404840 data->ret = 0;48414841- goto unlock;48414841+ return;48424842 }4843484348444844+ pmu = event->pmu_ctx->pmu;48444845 pmu->start_txn(pmu, PERF_PMU_TXN_READ);4845484648464846- pmu->read(event);48474847-48474847+ perf_pmu_read(event);48484848 for_each_sibling_event(sub, event)48494849 perf_pmu_read(sub);4850485048514851 data->ret = pmu->commit_txn(pmu);48524852-48534853-unlock:48544854- raw_spin_unlock(&ctx->lock);48554852}4856485348574854static inline u64 perf_event_count(struct perf_event *event, bool self)···1474114744 get_ctx(child_ctx);1474214745 child_event->ctx = child_ctx;14743147461474414744- pmu_ctx = find_get_pmu_context(child_event->pmu, child_ctx, child_event);1474714747+ pmu_ctx = find_get_pmu_context(parent_event->pmu_ctx->pmu, child_ctx, child_event);1474514748 if (IS_ERR(pmu_ctx)) {1474614749 free_event(child_event);1474714750 return ERR_CAST(pmu_ctx);
+21-9
kernel/sched/idle.c
···161161 return cpuidle_enter(drv, dev, next_state);162162}163163164164+static void idle_call_stop_or_retain_tick(bool stop_tick)165165+{166166+ if (stop_tick || tick_nohz_tick_stopped())167167+ tick_nohz_idle_stop_tick();168168+ else169169+ tick_nohz_idle_retain_tick();170170+}171171+164172/**165173 * cpuidle_idle_call - the main idle function166174 *···178170 * set, and it returns with polling set. If it ever stops polling, it179171 * must clear the polling bit.180172 */181181-static void cpuidle_idle_call(void)173173+static void cpuidle_idle_call(bool stop_tick)182174{183175 struct cpuidle_device *dev = cpuidle_get_device();184176 struct cpuidle_driver *drv = cpuidle_get_cpu_driver(dev);···194186 }195187196188 if (cpuidle_not_available(drv, dev)) {197197- tick_nohz_idle_stop_tick();189189+ idle_call_stop_or_retain_tick(stop_tick);198190199191 default_idle_call();200192 goto exit_idle;···230222 next_state = cpuidle_find_deepest_state(drv, dev, max_latency_ns);231223 call_cpuidle(drv, dev, next_state);232224 } else if (drv->state_count > 1) {233233- bool stop_tick = true;225225+ /*226226+ * stop_tick is expected to be true by default by cpuidle227227+ * governors, which allows them to select idle states with228228+ * target residency above the tick period length.229229+ */230230+ stop_tick = true;234231235232 /*236233 * Ask the cpuidle framework to choose a convenient idle state.237234 */238235 next_state = cpuidle_select(drv, dev, &stop_tick);239236240240- if (stop_tick || tick_nohz_tick_stopped())241241- tick_nohz_idle_stop_tick();242242- else243243- tick_nohz_idle_retain_tick();237237+ idle_call_stop_or_retain_tick(stop_tick);244238245239 entered_state = call_cpuidle(drv, dev, next_state);246240 /*···250240 */251241 cpuidle_reflect(dev, entered_state);252242 } else {253253- tick_nohz_idle_retain_tick();243243+ idle_call_stop_or_retain_tick(stop_tick);254244255245 /*256246 * If there is only a single idle state (or none), there is···278268static void do_idle(void)279269{280270 int cpu = smp_processor_id();271271+ bool got_tick = false;281272282273 /*283274 * Check if we need to update blocked load···349338 tick_nohz_idle_restart_tick();350339 cpu_idle_poll();351340 } else {352352- cpuidle_idle_call();341341+ cpuidle_idle_call(got_tick);353342 }343343+ got_tick = tick_nohz_idle_got_tick();354344 arch_cpu_idle_exit();355345 }356346
+2-2
kernel/trace/ftrace.c
···66066606 if (!orig_hash)66076607 goto unlock;6608660866096609- /* Enable the tmp_ops to have the same functions as the direct ops */66096609+ /* Enable the tmp_ops to have the same functions as the hash object. */66106610 ftrace_ops_init(&tmp_ops);66116611- tmp_ops.func_hash = ops->func_hash;66116611+ tmp_ops.func_hash->filter_hash = hash;6612661266136613 err = register_ftrace_function_nolock(&tmp_ops);66146614 if (err)
···555555 lockdep_assert_held(&event_mutex);556556557557 if (enabled) {558558- if (!list_empty(&tr->marker_list))558558+ if (tr->trace_flags & TRACE_ITER(COPY_MARKER))559559 return false;560560561561 list_add_rcu(&tr->marker_list, &marker_copies);···563563 return true;564564 }565565566566- if (list_empty(&tr->marker_list))566566+ if (!(tr->trace_flags & TRACE_ITER(COPY_MARKER)))567567 return false;568568569569- list_del_init(&tr->marker_list);569569+ list_del_rcu(&tr->marker_list);570570 tr->trace_flags &= ~TRACE_ITER(COPY_MARKER);571571 return true;572572}···6784678467856785 do {67866786 /*67876787+ * It is possible that something is trying to migrate this67886788+ * task. What happens then, is when preemption is enabled,67896789+ * the migration thread will preempt this task, try to67906790+ * migrate it, fail, then let it run again. That will67916791+ * cause this to loop again and never succeed.67926792+ * On failures, enabled and disable preemption with67936793+ * migration enabled, to allow the migration thread to67946794+ * migrate this task.67956795+ */67966796+ if (trys) {67976797+ preempt_enable_notrace();67986798+ preempt_disable_notrace();67996799+ cpu = smp_processor_id();68006800+ buffer = per_cpu_ptr(tinfo->tbuf, cpu)->buf;68016801+ }68026802+68036803+ /*67876804 * If for some reason, copy_from_user() always causes a context67886805 * switch, this would then cause an infinite loop.67896806 * If this task is preempted by another user space task, it···9761974497629745 list_del(&tr->list);9763974697479747+ if (printk_trace == tr)97489748+ update_printk_trace(&global_trace);97499749+97509750+ /* Must be done before disabling all the flags */97519751+ if (update_marker_trace(tr, 0))97529752+ synchronize_rcu();97539753+97649754 /* Disable all the flags that were enabled coming in */97659755 for (i = 0; i < TRACE_FLAGS_MAX_SIZE; i++) {97669756 if ((1ULL << i) & ZEROED_TRACE_FLAGS)97679757 set_tracer_flag(tr, 1ULL << i, 0);97689758 }97699769-97709770- if (printk_trace == tr)97719771- update_printk_trace(&global_trace);97729772-97739773- if (update_marker_trace(tr, 0))97749774- synchronize_rcu();9775975997769760 tracing_set_nop(tr);97779761 clear_ftrace_function_probes(tr);
+2-1
lib/bootconfig.c
···723723 if (op == ':') {724724 unsigned short nidx = child->next;725725726726- xbc_init_node(child, v, XBC_VALUE);726726+ if (xbc_init_node(child, v, XBC_VALUE) < 0)727727+ return xbc_parse_error("Failed to override value", v);727728 child->next = nidx; /* keep subkeys */728729 goto array;729730 }
+3
lib/crypto/Makefile
···5555libaes-$(CONFIG_X86) += x86/aes-aesni.o5656endif # CONFIG_CRYPTO_LIB_AES_ARCH57575858+# clean-files must be defined unconditionally5959+clean-files += powerpc/aesp8-ppc.S6060+5861################################################################################59626063obj-$(CONFIG_CRYPTO_LIB_AESCFB) += libaescfb.o
···19551955 if (userfaultfd_wp(vma))19561956 return 1;1957195719581958- return folio_pte_batch(folio, pvmw->pte, pte, max_nr);19581958+ /*19591959+ * If unmap fails, we need to restore the ptes. To avoid accidentally19601960+ * upgrading write permissions for ptes that were not originally19611961+ * writable, and to avoid losing the soft-dirty bit, use the19621962+ * appropriate FPB flags.19631963+ */19641964+ return folio_pte_batch_flags(folio, vma, pvmw->pte, &pte, max_nr,19651965+ FPB_RESPECT_WRITE | FPB_RESPECT_SOFT_DIRTY);19591966}1960196719611968/*···24502443 __maybe_unused pmd_t pmdval;2451244424522445 if (flags & TTU_SPLIT_HUGE_PMD) {24462446+ /*24472447+ * split_huge_pmd_locked() might leave the24482448+ * folio mapped through PTEs. Retry the walk24492449+ * so we can detect this scenario and properly24502450+ * abort the walk.24512451+ */24532452 split_huge_pmd_locked(vma, pvmw.address,24542453 pvmw.pmd, true);24552455- ret = false;24562456- page_vma_mapped_walk_done(&pvmw);24572457- break;24542454+ flags &= ~TTU_SPLIT_HUGE_PMD;24552455+ page_vma_mapped_walk_restart(&pvmw);24562456+ continue;24582457 }24592458#ifdef CONFIG_ARCH_ENABLE_THP_MIGRATION24602459 pmdval = pmdp_get(pvmw.pmd);
···66276627 * state.66286628 */66296629 if (hci_dev_test_flag(hdev, HCI_LE_SCAN)) {66306630- hci_scan_disable_sync(hdev);66316630 hci_dev_set_flag(hdev, HCI_LE_SCAN_INTERRUPTED);66316631+ hci_scan_disable_sync(hdev);66326632 }6633663366346634 /* Update random address, but set require_privacy to false so
+14-2
net/bluetooth/hidp/core.c
···986986 skb_queue_purge(&session->intr_transmit);987987 fput(session->intr_sock->file);988988 fput(session->ctrl_sock->file);989989- l2cap_conn_put(session->conn);989989+ if (session->conn)990990+ l2cap_conn_put(session->conn);990991 kfree(session);991992}992993···1165116411661165 down_write(&hidp_session_sem);1167116611671167+ /* Drop L2CAP reference immediately to indicate that11681168+ * l2cap_unregister_user() shall not be called as it is already11691169+ * considered removed.11701170+ */11711171+ if (session->conn) {11721172+ l2cap_conn_put(session->conn);11731173+ session->conn = NULL;11741174+ }11751175+11681176 hidp_session_terminate(session);1169117711701178 cancel_work_sync(&session->dev_init);···13111301 * Instead, this call has the same semantics as if user-space tried to13121302 * delete the session.13131303 */13141314- l2cap_unregister_user(session->conn, &session->user);13041304+ if (session->conn)13051305+ l2cap_unregister_user(session->conn, &session->user);13061306+13151307 hidp_session_put(session);1316130813171309 module_put_and_kthread_exit(0);
+31-20
net/bluetooth/l2cap_core.c
···1678167816791679int l2cap_register_user(struct l2cap_conn *conn, struct l2cap_user *user)16801680{16811681- struct hci_dev *hdev = conn->hcon->hdev;16821681 int ret;1683168216841683 /* We need to check whether l2cap_conn is registered. If it is not, we16851685- * must not register the l2cap_user. l2cap_conn_del() is unregisters16861686- * l2cap_conn objects, but doesn't provide its own locking. Instead, it16871687- * relies on the parent hci_conn object to be locked. This itself relies16881688- * on the hci_dev object to be locked. So we must lock the hci device16891689- * here, too. */16841684+ * must not register the l2cap_user. l2cap_conn_del() unregisters16851685+ * l2cap_conn objects under conn->lock, and we use the same lock here16861686+ * to protect access to conn->users and conn->hchan.16871687+ */1690168816911691- hci_dev_lock(hdev);16891689+ mutex_lock(&conn->lock);1692169016931691 if (!list_empty(&user->list)) {16941692 ret = -EINVAL;···17071709 ret = 0;1708171017091711out_unlock:17101710- hci_dev_unlock(hdev);17121712+ mutex_unlock(&conn->lock);17111713 return ret;17121714}17131715EXPORT_SYMBOL(l2cap_register_user);1714171617151717void l2cap_unregister_user(struct l2cap_conn *conn, struct l2cap_user *user)17161718{17171717- struct hci_dev *hdev = conn->hcon->hdev;17181718-17191719- hci_dev_lock(hdev);17191719+ mutex_lock(&conn->lock);1720172017211721 if (list_empty(&user->list))17221722 goto out_unlock;···17231727 user->remove(conn, user);1724172817251729out_unlock:17261726- hci_dev_unlock(hdev);17301730+ mutex_unlock(&conn->lock);17271731}17281732EXPORT_SYMBOL(l2cap_unregister_user);17291733···4612461646134617 switch (type) {46144618 case L2CAP_IT_FEAT_MASK:46154615- conn->feat_mask = get_unaligned_le32(rsp->data);46194619+ if (cmd_len >= sizeof(*rsp) + sizeof(u32))46204620+ conn->feat_mask = get_unaligned_le32(rsp->data);4616462146174622 if (conn->feat_mask & L2CAP_FEAT_FIXED_CHAN) {46184623 struct l2cap_info_req req;···46324635 break;4633463646344637 case L2CAP_IT_FIXED_CHAN:46354635- conn->remote_fixed_chan = rsp->data[0];46384638+ if (cmd_len >= sizeof(*rsp) + sizeof(rsp->data[0]))46394639+ conn->remote_fixed_chan = rsp->data[0];46364640 conn->info_state |= L2CAP_INFO_FEAT_MASK_REQ_DONE;46374641 conn->info_ident = 0;46384642···50575059 u16 mtu, mps;50585060 __le16 psm;50595061 u8 result, rsp_len = 0;50605060- int i, num_scid;50625062+ int i, num_scid = 0;50615063 bool defer = false;5062506450635065 if (!enable_ecred)···50665068 memset(pdu, 0, sizeof(*pdu));5067506950685070 if (cmd_len < sizeof(*req) || (cmd_len - sizeof(*req)) % sizeof(u16)) {50715071+ result = L2CAP_CR_LE_INVALID_PARAMS;50725072+ goto response;50735073+ }50745074+50755075+ /* Check if there are no pending channels with the same ident */50765076+ __l2cap_chan_list_id(conn, cmd->ident, l2cap_ecred_list_defer,50775077+ &num_scid);50785078+ if (num_scid) {50695079 result = L2CAP_CR_LE_INVALID_PARAMS;50705080 goto response;50715081 }···54305424 u8 *data)54315425{54325426 struct l2cap_chan *chan, *tmp;54335433- struct l2cap_ecred_conn_rsp *rsp = (void *) data;54275427+ struct l2cap_ecred_reconf_rsp *rsp = (void *)data;54345428 u16 result;5435542954365430 if (cmd_len < sizeof(*rsp))···5438543254395433 result = __le16_to_cpu(rsp->result);5440543454415441- BT_DBG("result 0x%4.4x", rsp->result);54355435+ BT_DBG("result 0x%4.4x", result);5442543654435437 if (!result)54445438 return 0;···66686662 return -ENOBUFS;66696663 }6670666466716671- if (chan->imtu < skb->len) {66726672- BT_ERR("Too big LE L2CAP PDU");66656665+ if (skb->len > chan->imtu) {66666666+ BT_ERR("Too big LE L2CAP PDU: len %u > %u", skb->len,66676667+ chan->imtu);66686668+ l2cap_send_disconn_req(chan, ECONNRESET);66736669 return -ENOBUFS;66746670 }66756671···66976689 sdu_len, skb->len, chan->imtu);6698669066996691 if (sdu_len > chan->imtu) {67006700- BT_ERR("Too big LE L2CAP SDU length received");66926692+ BT_ERR("Too big LE L2CAP SDU length: len %u > %u",66936693+ skb->len, sdu_len);66946694+ l2cap_send_disconn_req(chan, ECONNRESET);67016695 err = -EMSGSIZE;67026696 goto failed;67036697 }···6735672567366726 if (chan->sdu->len + skb->len > chan->sdu_len) {67376727 BT_ERR("Too much LE L2CAP data received");67286728+ l2cap_send_disconn_req(chan, ECONNRESET);67386729 err = -EINVAL;67396730 goto failed;67406731 }
···27432743 if (!test_bit(SMP_FLAG_DEBUG_KEY, &smp->flags) &&27442744 !crypto_memneq(key, smp->local_pk, 64)) {27452745 bt_dev_err(hdev, "Remote and local public keys are identical");27462746- return SMP_UNSPECIFIED;27462746+ return SMP_DHKEY_CHECK_FAILED;27472747 }2748274827492749 memcpy(smp->remote_pk, key, 64);
···304304 priv->start_rbe_cookie = (unsigned long)rbe;305305}306306307307-static void nft_rbtree_set_start_cookie_open(struct nft_rbtree *priv,308308- const struct nft_rbtree_elem *rbe,309309- unsigned long open_interval)310310-{311311- priv->start_rbe_cookie = (unsigned long)rbe | open_interval;312312-}313313-314314-#define NFT_RBTREE_OPEN_INTERVAL 1UL315315-316307static bool nft_rbtree_cmp_start_cookie(struct nft_rbtree *priv,317308 const struct nft_rbtree_elem *rbe)318309{319319- return (priv->start_rbe_cookie & ~NFT_RBTREE_OPEN_INTERVAL) == (unsigned long)rbe;310310+ return priv->start_rbe_cookie == (unsigned long)rbe;320311}321312322313static bool nft_rbtree_insert_same_interval(const struct net *net,···337346338347static int __nft_rbtree_insert(const struct net *net, const struct nft_set *set,339348 struct nft_rbtree_elem *new,340340- struct nft_elem_priv **elem_priv, u64 tstamp, bool last)349349+ struct nft_elem_priv **elem_priv, u64 tstamp)341350{342351 struct nft_rbtree_elem *rbe, *rbe_le = NULL, *rbe_ge = NULL, *rbe_prev;343352 struct rb_node *node, *next, *parent, **p, *first = NULL;344353 struct nft_rbtree *priv = nft_set_priv(set);345354 u8 cur_genmask = nft_genmask_cur(net);346355 u8 genmask = nft_genmask_next(net);347347- unsigned long open_interval = 0;348356 int d;349357350358 /* Descend the tree to search for an existing element greater than the···449459 }450460 }451461452452- if (nft_rbtree_interval_null(set, new)) {462462+ if (nft_rbtree_interval_null(set, new))453463 priv->start_rbe_cookie = 0;454454- } else if (nft_rbtree_interval_start(new) && priv->start_rbe_cookie) {455455- if (nft_set_is_anonymous(set)) {456456- priv->start_rbe_cookie = 0;457457- } else if (priv->start_rbe_cookie & NFT_RBTREE_OPEN_INTERVAL) {458458- /* Previous element is an open interval that partially459459- * overlaps with an existing non-open interval.460460- */461461- return -ENOTEMPTY;462462- }463463- }464464+ else if (nft_rbtree_interval_start(new) && priv->start_rbe_cookie)465465+ priv->start_rbe_cookie = 0;464466465467 /* - new start element matching existing start element: full overlap466468 * reported as -EEXIST, cleared by caller if NLM_F_EXCL is not given.···460478 if (rbe_ge && !nft_rbtree_cmp(set, new, rbe_ge) &&461479 nft_rbtree_interval_start(rbe_ge) == nft_rbtree_interval_start(new)) {462480 *elem_priv = &rbe_ge->priv;463463-464464- /* - Corner case: new start element of open interval (which465465- * comes as last element in the batch) overlaps the start of466466- * an existing interval with an end element: partial overlap.467467- */468468- node = rb_first(&priv->root);469469- rbe = __nft_rbtree_next_active(node, genmask);470470- if (rbe && nft_rbtree_interval_end(rbe)) {471471- rbe = nft_rbtree_next_active(rbe, genmask);472472- if (rbe &&473473- nft_rbtree_interval_start(rbe) &&474474- !nft_rbtree_cmp(set, new, rbe)) {475475- if (last)476476- return -ENOTEMPTY;477477-478478- /* Maybe open interval? */479479- open_interval = NFT_RBTREE_OPEN_INTERVAL;480480- }481481- }482482- nft_rbtree_set_start_cookie_open(priv, rbe_ge, open_interval);483483-481481+ nft_rbtree_set_start_cookie(priv, rbe_ge);484482 return -EEXIST;485483 }486484···513551 */514552 if (rbe_ge &&515553 nft_rbtree_interval_end(rbe_ge) && nft_rbtree_interval_end(new))516516- return -ENOTEMPTY;517517-518518- /* - start element overlaps an open interval but end element is new:519519- * partial overlap, reported as -ENOEMPTY.520520- */521521- if (!rbe_ge && priv->start_rbe_cookie && nft_rbtree_interval_end(new))522554 return -ENOTEMPTY;523555524556 /* Accepted element: pick insertion point depending on key value */···624668 struct nft_elem_priv **elem_priv)625669{626670 struct nft_rbtree_elem *rbe = nft_elem_priv_cast(elem->priv);627627- bool last = !!(elem->flags & NFT_SET_ELEM_INTERNAL_LAST);628671 struct nft_rbtree *priv = nft_set_priv(set);629672 u64 tstamp = nft_net_tstamp(net);630673 int err;···640685 cond_resched();641686642687 write_lock_bh(&priv->lock);643643- err = __nft_rbtree_insert(net, set, rbe, elem_priv, tstamp, last);688688+ err = __nft_rbtree_insert(net, set, rbe, elem_priv, tstamp);644689 write_unlock_bh(&priv->lock);645645-646646- if (nft_rbtree_interval_end(rbe))647647- priv->start_rbe_cookie = 0;648648-649690 } while (err == -EAGAIN);650691651692 return err;···729778 const struct nft_set_elem *elem)730779{731780 struct nft_rbtree_elem *rbe, *this = nft_elem_priv_cast(elem->priv);732732- bool last = !!(elem->flags & NFT_SET_ELEM_INTERNAL_LAST);733781 struct nft_rbtree *priv = nft_set_priv(set);734782 const struct rb_node *parent = priv->root.rb_node;735783 u8 genmask = nft_genmask_next(net);···769819 continue;770820 }771821772772- if (nft_rbtree_interval_start(rbe)) {773773- if (!last)774774- nft_rbtree_set_start_cookie(priv, rbe);775775- } else if (!nft_rbtree_deactivate_same_interval(net, priv, rbe))822822+ if (nft_rbtree_interval_start(rbe))823823+ nft_rbtree_set_start_cookie(priv, rbe);824824+ else if (!nft_rbtree_deactivate_same_interval(net, priv, rbe))776825 return NULL;777826778827 nft_rbtree_flush(net, set, &rbe->priv);
+4
net/netfilter/xt_CT.c
···1616#include <net/netfilter/nf_conntrack_ecache.h>1717#include <net/netfilter/nf_conntrack_timeout.h>1818#include <net/netfilter/nf_conntrack_zones.h>1919+#include "nf_internals.h"19202021static inline int xt_ct_target(struct sk_buff *skb, struct nf_conn *ct)2122{···284283 struct nf_conn_help *help;285284286285 if (ct) {286286+ if (info->helper[0] || info->timeout[0])287287+ nf_queue_nf_hook_drop(par->net);288288+287289 help = nfct_help(ct);288290 xt_ct_put_helper(help);289291
+2-2
net/netfilter/xt_time.c
···223223224224 localtime_2(¤t_time, stamp);225225226226- if (!(info->weekdays_match & (1 << current_time.weekday)))226226+ if (!(info->weekdays_match & (1U << current_time.weekday)))227227 return false;228228229229 /* Do not spend time computing monthday if all days match anyway */230230 if (info->monthdays_match != XT_TIME_ALL_MONTHDAYS) {231231 localtime_3(¤t_time, stamp);232232- if (!(info->monthdays_match & (1 << current_time.monthday)))232232+ if (!(info->monthdays_match & (1U << current_time.monthday)))233233 return false;234234 }235235
···318318 unix_free_vertices(fpl);319319}320320321321+static bool gc_in_progress;322322+static seqcount_t unix_peek_seq = SEQCNT_ZERO(unix_peek_seq);323323+324324+void unix_peek_fpl(struct scm_fp_list *fpl)325325+{326326+ static DEFINE_SPINLOCK(unix_peek_lock);327327+328328+ if (!fpl || !fpl->count_unix)329329+ return;330330+331331+ if (!READ_ONCE(gc_in_progress))332332+ return;333333+334334+ /* Invalidate the final refcnt check in unix_vertex_dead(). */335335+ spin_lock(&unix_peek_lock);336336+ raw_write_seqcount_barrier(&unix_peek_seq);337337+ spin_unlock(&unix_peek_lock);338338+}339339+321340static bool unix_vertex_dead(struct unix_vertex *vertex)322341{323342 struct unix_edge *edge;···368349 return false;369350370351 return true;352352+}353353+354354+static LIST_HEAD(unix_visited_vertices);355355+static unsigned long unix_vertex_grouped_index = UNIX_VERTEX_INDEX_MARK2;356356+357357+static bool unix_scc_dead(struct list_head *scc, bool fast)358358+{359359+ struct unix_vertex *vertex;360360+ bool scc_dead = true;361361+ unsigned int seq;362362+363363+ seq = read_seqcount_begin(&unix_peek_seq);364364+365365+ list_for_each_entry_reverse(vertex, scc, scc_entry) {366366+ /* Don't restart DFS from this vertex. */367367+ list_move_tail(&vertex->entry, &unix_visited_vertices);368368+369369+ /* Mark vertex as off-stack for __unix_walk_scc(). */370370+ if (!fast)371371+ vertex->index = unix_vertex_grouped_index;372372+373373+ if (scc_dead)374374+ scc_dead = unix_vertex_dead(vertex);375375+ }376376+377377+ /* If MSG_PEEK intervened, defer this SCC to the next round. */378378+ if (read_seqcount_retry(&unix_peek_seq, seq))379379+ return false;380380+381381+ return scc_dead;371382}372383373384static void unix_collect_skb(struct list_head *scc, struct sk_buff_head *hitlist)···452403453404 return false;454405}455455-456456-static LIST_HEAD(unix_visited_vertices);457457-static unsigned long unix_vertex_grouped_index = UNIX_VERTEX_INDEX_MARK2;458406459407static unsigned long __unix_walk_scc(struct unix_vertex *vertex,460408 unsigned long *last_index,···520474 }521475522476 if (vertex->index == vertex->scc_index) {523523- struct unix_vertex *v;524477 struct list_head scc;525525- bool scc_dead = true;526478527479 /* SCC finalised.528480 *···529485 */530486 __list_cut_position(&scc, &vertex_stack, &vertex->scc_entry);531487532532- list_for_each_entry_reverse(v, &scc, scc_entry) {533533- /* Don't restart DFS from this vertex in unix_walk_scc(). */534534- list_move_tail(&v->entry, &unix_visited_vertices);535535-536536- /* Mark vertex as off-stack. */537537- v->index = unix_vertex_grouped_index;538538-539539- if (scc_dead)540540- scc_dead = unix_vertex_dead(v);541541- }542542-543543- if (scc_dead) {488488+ if (unix_scc_dead(&scc, false)) {544489 unix_collect_skb(&scc, hitlist);545490 } else {546491 if (unix_vertex_max_scc_index < vertex->scc_index)···583550 while (!list_empty(&unix_unvisited_vertices)) {584551 struct unix_vertex *vertex;585552 struct list_head scc;586586- bool scc_dead = true;587553588554 vertex = list_first_entry(&unix_unvisited_vertices, typeof(*vertex), entry);589555 list_add(&scc, &vertex->scc_entry);590556591591- list_for_each_entry_reverse(vertex, &scc, scc_entry) {592592- list_move_tail(&vertex->entry, &unix_visited_vertices);593593-594594- if (scc_dead)595595- scc_dead = unix_vertex_dead(vertex);596596- }597597-598598- if (scc_dead) {557557+ if (unix_scc_dead(&scc, true)) {599558 cyclic_sccs--;600559 unix_collect_skb(&scc, hitlist);601560 }···601576 WRITE_ONCE(unix_graph_state,602577 cyclic_sccs ? UNIX_GRAPH_CYCLIC : UNIX_GRAPH_NOT_CYCLIC);603578}604604-605605-static bool gc_in_progress;606579607580static void unix_gc(struct work_struct *work)608581{
+1
net/wireless/pmsr.c
···664664 }665665 spin_unlock_bh(&wdev->pmsr_lock);666666667667+ cancel_work_sync(&wdev->pmsr_free_wk);667668 if (found)668669 cfg80211_pmsr_process_abort(wdev);669670
+4-5
scripts/livepatch/klp-build
···285285# application from appending it with '+' due to a dirty git working tree.286286set_kernelversion() {287287 local file="$SRC/scripts/setlocalversion"288288- local localversion288288+ local kernelrelease289289290290 stash_file "$file"291291292292- localversion="$(cd "$SRC" && make --no-print-directory kernelversion)"293293- localversion="$(cd "$SRC" && KERNELVERSION="$localversion" ./scripts/setlocalversion)"294294- [[ -z "$localversion" ]] && die "setlocalversion failed"292292+ kernelrelease="$(cd "$SRC" && make syncconfig &>/dev/null && make -s kernelrelease)"293293+ [[ -z "$kernelrelease" ]] && die "failed to get kernel version"295294296296- sed -i "2i echo $localversion; exit 0" scripts/setlocalversion295295+ sed -i "2i echo $kernelrelease; exit 0" scripts/setlocalversion297296}298297299298get_patch_files() {
+3-3
sound/soc/samsung/i2s.c
···13601360 if (!pdev_sec)13611361 return -ENOMEM;1362136213631363- pdev_sec->driver_override = kstrdup("samsung-i2s", GFP_KERNEL);13641364- if (!pdev_sec->driver_override) {13631363+ ret = device_set_driver_override(&pdev_sec->dev, "samsung-i2s");13641364+ if (ret) {13651365 platform_device_put(pdev_sec);13661366- return -ENOMEM;13661366+ return ret;13671367 }1368136813691369 ret = platform_device_add(pdev_sec);
+5-2
tools/bootconfig/main.c
···162162 if (fd < 0)163163 return -errno;164164 ret = fstat(fd, &stat);165165- if (ret < 0)166166- return -errno;165165+ if (ret < 0) {166166+ ret = -errno;167167+ close(fd);168168+ return ret;169169+ }167170168171 ret = load_xbc_fd(fd, buf, stat.st_size);169172
+2-3
tools/objtool/check.c
···21842184 last = insn;2185218521862186 /*21872187- * Store back-pointers for unconditional forward jumps such21872187+ * Store back-pointers for forward jumps such21882188 * that find_jump_table() can back-track using those and21892189 * avoid some potentially confusing code.21902190 */21912191- if (insn->type == INSN_JUMP_UNCONDITIONAL && insn->jump_dest &&21922192- insn->offset > last->offset &&21912191+ if (insn->jump_dest &&21932192 insn->jump_dest->offset > insn->offset &&21942193 !insn->jump_dest->first_jump_src) {21952194
+3-20
tools/objtool/elf.c
···1616#include <string.h>1717#include <unistd.h>1818#include <errno.h>1919-#include <libgen.h>2019#include <ctype.h>2120#include <linux/align.h>2221#include <linux/kernel.h>···11881189struct elf *elf_create_file(GElf_Ehdr *ehdr, const char *name)11891190{11901191 struct section *null, *symtab, *strtab, *shstrtab;11911191- char *dir, *base, *tmp_name;11921192+ char *tmp_name;11921193 struct symbol *sym;11931194 struct elf *elf;11941195···1202120312031204 INIT_LIST_HEAD(&elf->sections);1204120512051205- dir = strdup(name);12061206- if (!dir) {12071207- ERROR_GLIBC("strdup");12081208- return NULL;12091209- }12101210-12111211- dir = dirname(dir);12121212-12131213- base = strdup(name);12141214- if (!base) {12151215- ERROR_GLIBC("strdup");12161216- return NULL;12171217- }12181218-12191219- base = basename(base);12201220-12211221- tmp_name = malloc(256);12061206+ tmp_name = malloc(strlen(name) + 8);12221207 if (!tmp_name) {12231208 ERROR_GLIBC("malloc");12241209 return NULL;12251210 }1226121112271227- snprintf(tmp_name, 256, "%s/%s.XXXXXX", dir, base);12121212+ sprintf(tmp_name, "%s.XXXXXX", name);1228121312291214 elf->fd = mkstemp(tmp_name);12301215 if (elf->fd == -1) {
···409409 CC="$(HOSTCC)" LD="$(HOSTLD)" AR="$(HOSTAR)" \410410 LIBBPF_INCLUDE=$(HOST_INCLUDE_DIR) \411411 EXTRA_LDFLAGS='$(SAN_LDFLAGS) $(EXTRA_LDFLAGS)' \412412- HOSTPKG_CONFIG=$(PKG_CONFIG) \412412+ HOSTPKG_CONFIG='$(PKG_CONFIG)' \413413 OUTPUT=$(HOST_BUILD_DIR)/resolve_btfids/ BPFOBJ=$(HOST_BPFOBJ)414414415415# Get Clang's default includes on this system, as opposed to those seen by