···3232 interrupt.33333434 This file switches between these two modes:3535- - "mcu" makes the button press event be handled by the MCU to3636- change the LEDs panel intensity.3737- - "cpu" makes the button press event be handled by the CPU.3535+ - ``mcu`` makes the button press event be handled by the MCU to3636+ change the LEDs panel intensity.3737+ - ``cpu`` makes the button press event be handled by the CPU.38383939 Format: %s.4040
+1-1
Documentation/admin-guide/cifs/usage.rst
···742742 may use NTLMSSP 0x00080743743 must use NTLMSSP 0x80080744744 seal (packet encryption) 0x00040745745- must seal (not implemented yet) 0x40040745745+ must seal 0x40040746746747747cifsFYI If set to non-zero value, additional debug information748748 will be logged to the system error log. This field
+1-3
Documentation/admin-guide/kernel-parameters.txt
···4798479847994799 profile= [KNL] Enable kernel profiling via /proc/profile48004800 Format: [<profiletype>,]<number>48014801- Param: <profiletype>: "schedule", "sleep", or "kvm"48014801+ Param: <profiletype>: "schedule" or "kvm"48024802 [defaults to kernel profiling]48034803 Param: "schedule" - profile schedule points.48044804- Param: "sleep" - profile D-state sleeping (millisecs).48054805- Requires CONFIG_SCHEDSTATS48064804 Param: "kvm" - profile VM exits.48074805 Param: <number> - step/bucket size as a power of 2 for48084806 statistical time based profiling.
+18
Documentation/arch/arm64/silicon-errata.rst
···122122+----------------+-----------------+-----------------+-----------------------------+123123| ARM | Cortex-A76 | #1490853 | N/A |124124+----------------+-----------------+-----------------+-----------------------------+125125+| ARM | Cortex-A76 | #3324349 | ARM64_ERRATUM_3194386 |126126++----------------+-----------------+-----------------+-----------------------------+125127| ARM | Cortex-A77 | #1491015 | N/A |126128+----------------+-----------------+-----------------+-----------------------------+127129| ARM | Cortex-A77 | #1508412 | ARM64_ERRATUM_1508412 |130130++----------------+-----------------+-----------------+-----------------------------+131131+| ARM | Cortex-A77 | #3324348 | ARM64_ERRATUM_3194386 |132132++----------------+-----------------+-----------------+-----------------------------+133133+| ARM | Cortex-A78 | #3324344 | ARM64_ERRATUM_3194386 |134134++----------------+-----------------+-----------------+-----------------------------+135135+| ARM | Cortex-A78C | #3324346,3324347| ARM64_ERRATUM_3194386 |128136+----------------+-----------------+-----------------+-----------------------------+129137| ARM | Cortex-A710 | #2119858 | ARM64_ERRATUM_2119858 |130138+----------------+-----------------+-----------------+-----------------------------+···146138+----------------+-----------------+-----------------+-----------------------------+147139| ARM | Cortex-A720 | #3456091 | ARM64_ERRATUM_3194386 |148140+----------------+-----------------+-----------------+-----------------------------+141141+| ARM | Cortex-A725 | #3456106 | ARM64_ERRATUM_3194386 |142142++----------------+-----------------+-----------------+-----------------------------+149143| ARM | Cortex-X1 | #1502854 | N/A |144144++----------------+-----------------+-----------------+-----------------------------+145145+| ARM | Cortex-X1 | #3324344 | ARM64_ERRATUM_3194386 |146146++----------------+-----------------+-----------------+-----------------------------+147147+| ARM | Cortex-X1C | #3324346 | ARM64_ERRATUM_3194386 |150148+----------------+-----------------+-----------------+-----------------------------+151149| ARM | Cortex-X2 | #2119858 | ARM64_ERRATUM_2119858 |152150+----------------+-----------------+-----------------+-----------------------------+···174160+----------------+-----------------+-----------------+-----------------------------+175161| ARM | Neoverse-N1 | #1542419 | ARM64_ERRATUM_1542419 |176162+----------------+-----------------+-----------------+-----------------------------+163163+| ARM | Neoverse-N1 | #3324349 | ARM64_ERRATUM_3194386 |164164++----------------+-----------------+-----------------+-----------------------------+177165| ARM | Neoverse-N2 | #2139208 | ARM64_ERRATUM_2139208 |178166+----------------+-----------------+-----------------+-----------------------------+179167| ARM | Neoverse-N2 | #2067961 | ARM64_ERRATUM_2067961 |···185169| ARM | Neoverse-N2 | #3324339 | ARM64_ERRATUM_3194386 |186170+----------------+-----------------+-----------------+-----------------------------+187171| ARM | Neoverse-V1 | #1619801 | N/A |172172++----------------+-----------------+-----------------+-----------------------------+173173+| ARM | Neoverse-V1 | #3324341 | ARM64_ERRATUM_3194386 |188174+----------------+-----------------+-----------------+-----------------------------+189175| ARM | Neoverse-V2 | #3324336 | ARM64_ERRATUM_3194386 |190176+----------------+-----------------+-----------------+-----------------------------+
···4455Written by Sujith Thomas <sujith.thomas@intel.com>, Zhang Rui <rui.zhang@intel.com>6677-Updated: 2 January 200888-97Copyright (c) 2008 Intel Corporation108119···36383739 ::38403939- struct thermal_zone_device4040- *thermal_zone_device_register(char *type,4141- int trips, int mask, void *devdata,4242- struct thermal_zone_device_ops *ops,4343- const struct thermal_zone_params *tzp,4444- int passive_delay, int polling_delay))4141+ struct thermal_zone_device *4242+ thermal_zone_device_register_with_trips(const char *type,4343+ const struct thermal_trip *trips,4444+ int num_trips, void *devdata,4545+ const struct thermal_zone_device_ops *ops,4646+ const struct thermal_zone_params *tzp,4747+ unsigned int passive_delay,4848+ unsigned int polling_delay)45494646- This interface function adds a new thermal zone device (sensor) to5050+ This interface function adds a new thermal zone device (sensor) to the4751 /sys/class/thermal folder as `thermal_zone[0-*]`. It tries to bind all the4848- thermal cooling devices registered at the same time.5252+ thermal cooling devices registered to it at the same time.49535054 type:5155 the thermal zone type.5256 trips:5353- the total number of trip points this thermal zone supports.5454- mask:5555- Bit string: If 'n'th bit is set, then trip point 'n' is writable.5757+ the table of trip points for this thermal zone.5658 devdata:5759 device private data5860 ops:···6567 .get_temp:6668 get the current temperature of the thermal zone.6769 .set_trips:6868- set the trip points window. Whenever the current temperature6969- is updated, the trip points immediately below and above the7070- current temperature are found.7171- .get_mode:7272- get the current mode (enabled/disabled) of the thermal zone.7373-7474- - "enabled" means the kernel thermal management is7575- enabled.7676- - "disabled" will prevent kernel thermal driver action7777- upon trip points so that user applications can take7878- charge of thermal management.7979- .set_mode:8080- set the mode (enabled/disabled) of the thermal zone.8181- .get_trip_type:8282- get the type of certain trip point.8383- .get_trip_temp:8484- get the temperature above which the certain trip point8585- will be fired.7070+ set the trip points window. Whenever the current temperature7171+ is updated, the trip points immediately below and above the7272+ current temperature are found.7373+ .change_mode:7474+ change the mode (enabled/disabled) of the thermal zone.7575+ .set_trip_temp:7676+ set the temperature of a given trip point.7777+ .get_crit_temp:7878+ get the critical temperature for this thermal zone.8679 .set_emul_temp:8787- set the emulation temperature which helps in debugging8888- different threshold temperature points.8080+ set the emulation temperature which helps in debugging8181+ different threshold temperature points.8282+ .get_trend:8383+ get the trend of most recent zone temperature changes.8484+ .hot:8585+ hot trip point crossing handler.8686+ .critical:8787+ critical trip point crossing handler.8988 tzp:9089 thermal zone platform parameters.9190 passive_delay:9292- number of milliseconds to wait between polls when9393- performing passive cooling.9191+ number of milliseconds to wait between polls when performing passive9292+ cooling.9493 polling_delay:9594 number of milliseconds to wait between polls when checking9695 whether trip points have been crossed (0 for interrupt driven systems).
···1313Hardware issues like Meltdown, Spectre, L1TF etc. must be treated1414differently because they usually affect all Operating Systems ("OS") and1515therefore need coordination across different OS vendors, distributions,1616-hardware vendors and other parties. For some of the issues, software1717-mitigations can depend on microcode or firmware updates, which need further1818-coordination.1616+silicon vendors, hardware integrators, and other parties. For some of the1717+issues, software mitigations can depend on microcode or firmware updates,1818+which need further coordination.19192020.. _Contact:2121···3232<securitybugs>`) instead.33333434The team can be contacted by email at <hardware-security@kernel.org>. This3535-is a private list of security officers who will help you to coordinate a3636-fix according to our documented process.3535+is a private list of security officers who will help you coordinate a fix3636+according to our documented process.37373838The list is encrypted and email to the list can be sent by either PGP or3939S/MIME encrypted and must be signed with the reporter's PGP key or S/MIME···4343 - PGP: https://www.kernel.org/static/files/hardware-security.asc4444 - S/MIME: https://www.kernel.org/static/files/hardware-security.crt45454646-While hardware security issues are often handled by the affected hardware4646+While hardware security issues are often handled by the affected silicon4747vendor, we welcome contact from researchers or individuals who have4848identified a potential hardware flaw.4949···6565ability to access the embargoed information, but are obliged to6666confidentiality by their employment contract. Linux Foundation IT6767personnel are also responsible for operating and managing the rest of6868-kernel.org infrastructure.6868+kernel.org's infrastructure.69697070The Linux Foundation's current director of IT Project infrastructure is7171Konstantin Ryabitsev.···85858686The Linux kernel community has a deep understanding of the requirement to8787keep hardware security issues under embargo for coordination between8888-different OS vendors, distributors, hardware vendors and other parties.8888+different OS vendors, distributors, silicon vendors, and other parties.89899090The Linux kernel community has successfully handled hardware security9191issues in the past and has the necessary mechanisms in place to allow···103103All involved developers pledge to adhere to the embargo rules and to keep104104the received information confidential. Violation of the pledge will lead to105105immediate exclusion from the current issue and removal from all related106106-mailing-lists. In addition, the hardware security team will also exclude106106+mailing lists. In addition, the hardware security team will also exclude107107the offender from future issues. The impact of this consequence is a highly108108effective deterrent in our community. In case a violation happens the109109hardware security team will inform the involved parties immediately. If you110110-or anyone becomes aware of a potential violation, please report it110110+or anyone else becomes aware of a potential violation, please report it111111immediately to the Hardware security officers.112112113113···124124Start of Disclosure125125"""""""""""""""""""126126127127-Disclosure starts by contacting the Linux kernel hardware security team by128128-email. This initial contact should contain a description of the problem and129129-a list of any known affected hardware. If your organization builds or130130-distributes the affected hardware, we encourage you to also consider what131131-other hardware could be affected.127127+Disclosure starts by emailing the Linux kernel hardware security team per128128+the Contact section above. This initial contact should contain a129129+description of the problem and a list of any known affected silicon. If130130+your organization builds or distributes the affected hardware, we encourage131131+you to also consider what other hardware could be affected. The disclosing132132+party is responsible for contacting the affected silicon vendors in a133133+timely manner.132134133135The hardware security team will provide an incident-specific encrypted134134-mailing-list which will be used for initial discussion with the reporter,136136+mailing list which will be used for initial discussion with the reporter,135137further disclosure, and coordination of fixes.136138137139The hardware security team will provide the disclosing party a list of···160158 - The disclosed entities can be contacted to name experts who should161159 participate in the mitigation development.162160163163- - If an expert which is required to handle an issue is employed by an164164- listed entity or member of an listed entity, then the response teams can161161+ - If an expert who is required to handle an issue is employed by a listed162162+ entity or member of an listed entity, then the response teams can165163 request the disclosure of that expert from that entity. This ensures166164 that the expert is also part of the entity's response team.167165···171169The disclosing party provides detailed information to the initial response172170team via the specific encrypted mailing-list.173171174174-From our experience the technical documentation of these issues is usually175175-a sufficient starting point and further technical clarification is best172172+From our experience, the technical documentation of these issues is usually173173+a sufficient starting point, and further technical clarification is best176174done via email.177175178176Mitigation development···181179The initial response team sets up an encrypted mailing-list or repurposes182180an existing one if appropriate.183181184184-Using a mailing-list is close to the normal Linux development process and185185-has been successfully used in developing mitigations for various hardware182182+Using a mailing list is close to the normal Linux development process and183183+has been successfully used to develop mitigations for various hardware186184security issues in the past.187185188188-The mailing-list operates in the same way as normal Linux development.189189-Patches are posted, discussed and reviewed and if agreed on applied to a190190-non-public git repository which is only accessible to the participating186186+The mailing list operates in the same way as normal Linux development.187187+Patches are posted, discussed, and reviewed and if agreed upon, applied to188188+a non-public git repository which is only accessible to the participating191189developers via a secure connection. The repository contains the main192190development branch against the mainline kernel and backport branches for193191stable kernel versions as necessary.194192195193The initial response team will identify further experts from the Linux196196-kernel developer community as needed. Bringing in experts can happen at any197197-time of the development process and needs to be handled in a timely manner.194194+kernel developer community as needed. Any involved party can suggest195195+further experts to be included, each of which will be subject to the same196196+requirements outlined above.198197199199-If an expert is employed by or member of an entity on the disclosure list198198+Bringing in experts can happen at any time in the development process and199199+needs to be handled in a timely manner.200200+201201+If an expert is employed by or a member of an entity on the disclosure list200202provided by the disclosing party, then participation will be requested from201203the relevant entity.202204203203-If not, then the disclosing party will be informed about the experts205205+If not, then the disclosing party will be informed about the experts'204206participation. The experts are covered by the Memorandum of Understanding205205-and the disclosing party is requested to acknowledge the participation. In206206-case that the disclosing party has a compelling reason to object, then this207207-objection has to be raised within five work days and resolved with the208208-incident team immediately. If the disclosing party does not react within209209-five work days this is taken as silent acknowledgement.207207+and the disclosing party is requested to acknowledge their participation.208208+In the case where the disclosing party has a compelling reason to object,209209+any objection must to be raised within five working days and resolved with210210+the incident team immediately. If the disclosing party does not react211211+within five working days this is taken as silent acknowledgment.210212211211-After acknowledgement or resolution of an objection the expert is disclosed212212-by the incident team and brought into the development process.213213+After the incident team acknowledges or resolves an objection, the expert214214+is disclosed and brought into the development process.213215214216List participants may not communicate about the issue outside of the215217private mailing list. List participants may not use any shared resources216218(e.g. employer build farms, CI systems, etc) when working on patches.217219220220+Early access221221+""""""""""""222222+223223+The patches discussed and developed on the list can neither be distributed224224+to any individual who is not a member of the response team nor to any other225225+organization.226226+227227+To allow the affected silicon vendors to work with their internal teams and228228+industry partners on testing, validation, and logistics, the following229229+exception is provided:230230+231231+ Designated representatives of the affected silicon vendors are232232+ allowed to hand over the patches at any time to the silicon233233+ vendor’s response team. The representative must notify the kernel234234+ response team about the handover. The affected silicon vendor must235235+ have and maintain their own documented security process for any236236+ patches shared with their response team that is consistent with237237+ this policy.238238+239239+ The silicon vendor’s response team can distribute these patches to240240+ their industry partners and to their internal teams under the241241+ silicon vendor’s documented security process. Feedback from the242242+ industry partners goes back to the silicon vendor and is243243+ communicated by the silicon vendor to the kernel response team.244244+245245+ The handover to the silicon vendor’s response team removes any246246+ responsibility or liability from the kernel response team regarding247247+ premature disclosure, which happens due to the involvement of the248248+ silicon vendor’s internal teams or industry partners. The silicon249249+ vendor guarantees this release of liability by agreeing to this250250+ process.218251219252Coordinated release220253"""""""""""""""""""221254222222-The involved parties will negotiate the date and time where the embargo223223-ends. At that point the prepared mitigations are integrated into the224224-relevant kernel trees and published. There is no pre-notification process:225225-fixes are published in public and available to everyone at the same time.255255+The involved parties will negotiate the date and time when the embargo256256+ends. At that point, the prepared mitigations are published into the257257+relevant kernel trees. There is no pre-notification process: the258258+mitigations are published in public and available to everyone at the same259259+time.226260227261While we understand that hardware security issues need coordinated embargo228228-time, the embargo time should be constrained to the minimum time which is229229-required for all involved parties to develop, test and prepare the262262+time, the embargo time should be constrained to the minimum time that is263263+required for all involved parties to develop, test, and prepare their230264mitigations. Extending embargo time artificially to meet conference talk231231-dates or other non-technical reasons is creating more work and burden for232232-the involved developers and response teams as the patches need to be kept233233-up to date in order to follow the ongoing upstream kernel development,234234-which might create conflicting changes.265265+dates or other non-technical reasons creates more work and burden for the266266+involved developers and response teams as the patches need to be kept up to267267+date in order to follow the ongoing upstream kernel development, which268268+might create conflicting changes.235269236270CVE assignment237271""""""""""""""···313275314276If you want your organization to be added to the ambassadors list, please315277contact the hardware security team. The nominated ambassador has to316316-understand and support our process fully and is ideally well connected in278278+understand and support our process fully and is ideally well-connected in317279the Linux kernel community.318280319281Encrypted mailing-lists320282-----------------------321283322322-We use encrypted mailing-lists for communication. The operating principle284284+We use encrypted mailing lists for communication. The operating principle323285of these lists is that email sent to the list is encrypted either with the324324-list's PGP key or with the list's S/MIME certificate. The mailing-list286286+list's PGP key or with the list's S/MIME certificate. The mailing list325287software decrypts the email and re-encrypts it individually for each326288subscriber with the subscriber's PGP key or S/MIME certificate. Details327327-about the mailing-list software and the setup which is used to ensure the289289+about the mailing list software and the setup that is used to ensure the328290security of the lists and protection of the data can be found here:329291https://korg.wiki.kernel.org/userdoc/remail.330292331293List keys332294^^^^^^^^^333295334334-For initial contact see :ref:`Contact`. For incident specific mailing-lists335335-the key and S/MIME certificate are conveyed to the subscribers by email336336-sent from the specific list.296296+For initial contact see the :ref:`Contact` section above. For incident297297+specific mailing lists, the key and S/MIME certificate are conveyed to the298298+subscribers by email sent from the specific list.337299338338-Subscription to incident specific lists300300+Subscription to incident-specific lists339301^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^340302341341-Subscription is handled by the response teams. Disclosed parties who want342342-to participate in the communication send a list of potential subscribers to343343-the response team so the response team can validate subscription requests.303303+Subscription to incident-specific lists is handled by the response teams.304304+Disclosed parties who want to participate in the communication send a list305305+of potential experts to the response team so the response team can validate306306+subscription requests.344307345308Each subscriber needs to send a subscription request to the response team346309by email. The email must be signed with the subscriber's PGP key or S/MIME
···63686368See KVM_SET_USER_MEMORY_REGION2 for additional details.63696369637063704.143 KVM_PRE_FAULT_MEMORY63716371-------------------------63716371+---------------------------6372637263736373:Capability: KVM_CAP_PRE_FAULT_MEMORY63746374:Architectures: none···64046404for the current vCPU state. KVM maps memory as if the vCPU generated a64056405stage-2 read page fault, e.g. faults in memory as needed, but doesn't break64066406CoW. However, KVM does not mark any newly created stage-2 PTE as Accessed.64076407+64086408+In the case of confidential VM types where there is an initial set up of64096409+private guest memory before the guest is 'finalized'/measured, this ioctl64106410+should only be issued after completing all the necessary setup to put the64116411+guest into a 'finalized' state so that the above semantics can be reliably64126412+ensured.6407641364086414In some cases, multiple vCPUs might share the page tables. In this64096415case, the ioctl can be called in parallel.
+3-3
Documentation/wmi/devices/msi-wmi-platform.rst
···130130131131Due to a peculiarity in how Windows handles the ``CreateByteField()`` ACPI operator (errors only132132happen when a invalid byte field is ultimately accessed), all methods require a 32 byte input133133-buffer, even if the Binay MOF says otherwise.133133+buffer, even if the Binary MOF says otherwise.134134135135The input buffer contains a single byte to select the subfeature to be accessed and 31 bytes of136136input data, the meaning of which depends on the subfeature being accessed.137137138138-The output buffer contains a singe byte which signals success or failure (``0x00`` on failure)138138+The output buffer contains a single byte which signals success or failure (``0x00`` on failure)139139and 31 bytes of output data, the meaning if which depends on the subfeature being accessed.140140141141WMI method Get_EC()···147147The first 4 bits of the flag byte contain the minor version of the embedded controller interface,148148with the next 2 bits containing the major version of the embedded controller interface.149149150150-The 7th bit signals if the embedded controller page chaged (exact meaning is unknown), and the150150+The 7th bit signals if the embedded controller page changed (exact meaning is unknown), and the151151last bit signals if the platform is a Tigerlake platform.152152153153The MSI software seems to only use this interface when the last bit is set.
+8-5
MAINTAINERS
···53065306CIRRUS LOGIC AUDIO CODEC DRIVERS53075307M: David Rhodes <david.rhodes@cirrus.com>53085308M: Richard Fitzgerald <rf@opensource.cirrus.com>53095309-L: alsa-devel@alsa-project.org (moderated for non-subscribers)53095309+L: linux-sound@vger.kernel.org53105310L: patches@opensource.cirrus.com53115311S: Maintained53125312F: Documentation/devicetree/bindings/sound/cirrus,cs*···53755375CIRRUS LOGIC MADERA CODEC DRIVERS53765376M: Charles Keepax <ckeepax@opensource.cirrus.com>53775377M: Richard Fitzgerald <rf@opensource.cirrus.com>53785378-L: alsa-devel@alsa-project.org (moderated for non-subscribers)53785378+L: linux-sound@vger.kernel.org53795379L: patches@opensource.cirrus.com53805380S: Supported53815381W: https://github.com/CirrusLogic/linux-drivers/wiki···1332413324F: drivers/i2c/muxes/i2c-mux-ltc4306.c13325133251332613326LTP (Linux Test Project)1332713327+M: Andrea Cervesato <andrea.cervesato@suse.com>1332713328M: Cyril Hrubis <chrubis@suse.cz>1332813329M: Jan Stancek <jstancek@redhat.com>1332913330M: Petr Vorel <pvorel@suse.cz>1333013331M: Li Wang <liwang@redhat.com>1333113332M: Yang Xu <xuyang2018.jy@fujitsu.com>1333313333+M: Xiao Yang <yangx.jy@fujitsu.com>1333213334L: ltp@lists.linux.it (subscribers-only)1333313335S: Maintained1333413334-W: http://linux-test-project.github.io/1333613336+W: https://linux-test-project.readthedocs.io/1333513337T: git https://github.com/linux-test-project/ltp.git13336133381333713339LTR390 AMBIENT/UV LIGHT SENSOR DRIVER···1354113539M: Mirko Lindner <mlindner@marvell.com>1354213540M: Stephen Hemminger <stephen@networkplumber.org>1354313541L: netdev@vger.kernel.org1354413544-S: Maintained1354213542+S: Odd fixes1354513543F: drivers/net/ethernet/marvell/sk*13546135441354713545MARVELL LIBERTAS WIRELESS DRIVER···1593815936F: include/linux/indirect_call_wrapper.h1593915937F: include/linux/net.h1594015938F: include/linux/netdevice.h1593915939+F: include/linux/skbuff.h1594115940F: include/net/1594215941F: include/uapi/linux/in.h1594315942F: include/uapi/linux/net.h···1855918556QCOM IPA DRIVER1856018557M: Alex Elder <elder@kernel.org>1856118558L: netdev@vger.kernel.org1856218562-S: Supported1855918559+S: Maintained1856318560F: drivers/net/ipa/18564185611856518562QEMU MACHINE EMULATOR AND VIRTUALIZER SUPPORT
···8787 select HAVE_ARCH_PFN_VALID8888 select HAVE_ARCH_SECCOMP8989 select HAVE_ARCH_SECCOMP_FILTER if AEABI && !OABI_COMPAT9090+ select HAVE_ARCH_STACKLEAK9091 select HAVE_ARCH_THREAD_STRUCT_WHITELIST9192 select HAVE_ARCH_TRACEHOOK9293 select HAVE_ARCH_TRANSPARENT_HUGEPAGE if ARM_LPAE···117116 select HAVE_KERNEL_XZ118117 select HAVE_KPROBES if !XIP_KERNEL && !CPU_ENDIAN_BE32 && !CPU_V7M119118 select HAVE_KRETPROBES if HAVE_KPROBES119119+ select HAVE_LD_DEAD_CODE_DATA_ELIMINATION120120 select HAVE_MOD_ARCH_SPECIFIC121121 select HAVE_NMI122122 select HAVE_OPTPROBES if !THUMB2_KERNEL···738736 bool "ARM errata: Read to DBGPRSR and DBGOSLSR may generate Undefined instruction"739737 depends on CPU_V7740738 help741741- This option enables the workaround for the 764319 Cortex A-9 erratum.739739+ This option enables the workaround for the 764319 Cortex-A9 erratum.742740 CP14 read accesses to the DBGPRSR and DBGOSLSR registers generate an743741 unexpected Undefined Instruction exception when the DBGSWENABLE744742 external pin is set to 0, even when the CP14 accesses are performed
···2929 /*3030 * Set CPU resume address -3131 * secure firmware running on boot will jump to this address3232- * after setting proper CPU mode, and initialiing e.g. secure3232+ * after setting proper CPU mode, and initializing e.g. secure3333 * regs (the same mode all CPUs are booted to - usually HYP)3434 */3535 writel(phys_resume_addr,
···1717__ADDRESSABLE(cpu_arm7tdmi_proc_init);1818void cpu_arm7tdmi_proc_fin(void);1919__ADDRESSABLE(cpu_arm7tdmi_proc_fin);2020-void cpu_arm7tdmi_reset(void);2020+void cpu_arm7tdmi_reset(unsigned long addr, bool hvc);2121__ADDRESSABLE(cpu_arm7tdmi_reset);2222int cpu_arm7tdmi_do_idle(void);2323__ADDRESSABLE(cpu_arm7tdmi_do_idle);···3232__ADDRESSABLE(cpu_arm720_proc_init);3333void cpu_arm720_proc_fin(void);3434__ADDRESSABLE(cpu_arm720_proc_fin);3535-void cpu_arm720_reset(void);3535+void cpu_arm720_reset(unsigned long addr, bool hvc);3636__ADDRESSABLE(cpu_arm720_reset);3737int cpu_arm720_do_idle(void);3838__ADDRESSABLE(cpu_arm720_do_idle);···4949__ADDRESSABLE(cpu_arm740_proc_init);5050void cpu_arm740_proc_fin(void);5151__ADDRESSABLE(cpu_arm740_proc_fin);5252-void cpu_arm740_reset(void);5252+void cpu_arm740_reset(unsigned long addr, bool hvc);5353__ADDRESSABLE(cpu_arm740_reset);5454int cpu_arm740_do_idle(void);5555__ADDRESSABLE(cpu_arm740_do_idle);···6464__ADDRESSABLE(cpu_arm9tdmi_proc_init);6565void cpu_arm9tdmi_proc_fin(void);6666__ADDRESSABLE(cpu_arm9tdmi_proc_fin);6767-void cpu_arm9tdmi_reset(void);6767+void cpu_arm9tdmi_reset(unsigned long addr, bool hvc);6868__ADDRESSABLE(cpu_arm9tdmi_reset);6969int cpu_arm9tdmi_do_idle(void);7070__ADDRESSABLE(cpu_arm9tdmi_do_idle);···7979__ADDRESSABLE(cpu_arm920_proc_init);8080void cpu_arm920_proc_fin(void);8181__ADDRESSABLE(cpu_arm920_proc_fin);8282-void cpu_arm920_reset(void);8282+void cpu_arm920_reset(unsigned long addr, bool hvc);8383__ADDRESSABLE(cpu_arm920_reset);8484int cpu_arm920_do_idle(void);8585__ADDRESSABLE(cpu_arm920_do_idle);···102102__ADDRESSABLE(cpu_arm922_proc_init);103103void cpu_arm922_proc_fin(void);104104__ADDRESSABLE(cpu_arm922_proc_fin);105105-void cpu_arm922_reset(void);105105+void cpu_arm922_reset(unsigned long addr, bool hvc);106106__ADDRESSABLE(cpu_arm922_reset);107107int cpu_arm922_do_idle(void);108108__ADDRESSABLE(cpu_arm922_do_idle);···119119__ADDRESSABLE(cpu_arm925_proc_init);120120void cpu_arm925_proc_fin(void);121121__ADDRESSABLE(cpu_arm925_proc_fin);122122-void cpu_arm925_reset(void);122122+void cpu_arm925_reset(unsigned long addr, bool hvc);123123__ADDRESSABLE(cpu_arm925_reset);124124int cpu_arm925_do_idle(void);125125__ADDRESSABLE(cpu_arm925_do_idle);···159159__ADDRESSABLE(cpu_arm940_proc_init);160160void cpu_arm940_proc_fin(void);161161__ADDRESSABLE(cpu_arm940_proc_fin);162162-void cpu_arm940_reset(void);162162+void cpu_arm940_reset(unsigned long addr, bool hvc);163163__ADDRESSABLE(cpu_arm940_reset);164164int cpu_arm940_do_idle(void);165165__ADDRESSABLE(cpu_arm940_do_idle);···174174__ADDRESSABLE(cpu_arm946_proc_init);175175void cpu_arm946_proc_fin(void);176176__ADDRESSABLE(cpu_arm946_proc_fin);177177-void cpu_arm946_reset(void);177177+void cpu_arm946_reset(unsigned long addr, bool hvc);178178__ADDRESSABLE(cpu_arm946_reset);179179int cpu_arm946_do_idle(void);180180__ADDRESSABLE(cpu_arm946_do_idle);···429429__ADDRESSABLE(cpu_v7_proc_init);430430void cpu_v7_proc_fin(void);431431__ADDRESSABLE(cpu_v7_proc_fin);432432-void cpu_v7_reset(void);432432+void cpu_v7_reset(unsigned long addr, bool hvc);433433__ADDRESSABLE(cpu_v7_reset);434434int cpu_v7_do_idle(void);435435__ADDRESSABLE(cpu_v7_do_idle);
+16-6
arch/arm64/Kconfig
···10691069 If unsure, say Y.1070107010711071config ARM64_ERRATUM_319438610721072- bool "Cortex-{A720,X4,X925}/Neoverse-V3: workaround for MSR SSBS not self-synchronizing"10721072+ bool "Cortex-*/Neoverse-*: workaround for MSR SSBS not self-synchronizing"10731073 default y10741074 help10751075 This option adds the workaround for the following errata:1076107610771077+ * ARM Cortex-A76 erratum 332434910781078+ * ARM Cortex-A77 erratum 332434810791079+ * ARM Cortex-A78 erratum 332434410801080+ * ARM Cortex-A78C erratum 332434610811081+ * ARM Cortex-A78C erratum 332434710771082 * ARM Cortex-A710 erratam 332433810781083 * ARM Cortex-A720 erratum 345609110841084+ * ARM Cortex-A725 erratum 345610610851085+ * ARM Cortex-X1 erratum 332434410861086+ * ARM Cortex-X1C erratum 332434610791087 * ARM Cortex-X2 erratum 332433810801088 * ARM Cortex-X3 erratum 332433510811089 * ARM Cortex-X4 erratum 319438610821090 * ARM Cortex-X925 erratum 332433410911091+ * ARM Neoverse-N1 erratum 332434910831092 * ARM Neoverse N2 erratum 332433910931093+ * ARM Neoverse-V1 erratum 332434110841094 * ARM Neoverse V2 erratum 332433610851095 * ARM Neoverse-V3 erratum 331241710861096···10981088 subsequent speculative instructions, which may permit unexepected10991089 speculative store bypassing.1100109011011101- Work around this problem by placing a speculation barrier after11021102- kernel changes to SSBS. The presence of the SSBS special-purpose11031103- register is hidden from hwcaps and EL0 reads of ID_AA64PFR1_EL1, such11041104- that userspace will use the PR_SPEC_STORE_BYPASS prctl to change11051105- SSBS.10911091+ Work around this problem by placing a Speculation Barrier (SB) or10921092+ Instruction Synchronization Barrier (ISB) after kernel changes to10931093+ SSBS. The presence of the SSBS special-purpose register is hidden10941094+ from hwcaps and EL0 reads of ID_AA64PFR1_EL1, such that userspace10951095+ will use the PR_SPEC_STORE_BYPASS prctl to change SSBS.1106109611071097 If unsure, say Y.11081098
···138138 vin-supply = <®_1v8>;139139 };140140141141- /*142142- * By default we enable CTRL_SLEEP_MOCI#, this is required to have143143- * peripherals on the carrier board powered.144144- * If more granularity or power saving is required this can be disabled145145- * in the carrier board device tree files.146146- */147141 reg_force_sleep_moci: regulator-force-sleep-moci {148142 compatible = "regulator-fixed";149143 enable-active-high;
···26262727#define KVM_MAX_VCPUS 2562828#define KVM_MAX_CPUCFG_REGS 212929-/* memory slots that does not exposed to userspace */3030-#define KVM_PRIVATE_MEM_SLOTS 031293230#define KVM_HALT_POLL_NS_DEFAULT 5000003331#define KVM_REQ_TLB_FLUSH_GPA KVM_ARCH_REQ(0)
+2-2
arch/loongarch/include/asm/kvm_para.h
···3939 * Hypercall interface for KVM hypervisor4040 *4141 * a0: function identifier4242- * a1-a6: args4242+ * a1-a5: args4343 * Return value will be placed in a0.4444- * Up to 6 arguments are passed in a1, a2, a3, a4, a5, a6.4444+ * Up to 5 arguments are passed in a1, a2, a3, a4, a5.4545 */4646static __always_inline long kvm_hypercall0(u64 fid)4747{
···432432 bitmap_copy(prev_resolved_isa, resolved_isa, RISCV_ISA_EXT_MAX);433433 for_each_set_bit(bit, source_isa, RISCV_ISA_EXT_MAX) {434434 ext = riscv_get_isa_ext_data(bit);435435- if (!ext)436436- continue;437435438438- if (ext->validate) {436436+ if (ext && ext->validate) {439437 ret = ext->validate(ext, resolved_isa);440438 if (ret == -EPROBE_DEFER) {441439 loop = true;442440 continue;443441 } else if (ret) {444442 /* Disable the extension entirely */445445- clear_bit(ext->id, source_isa);443443+ clear_bit(bit, source_isa);446444 continue;447445 }448446 }449447450450- set_bit(ext->id, resolved_isa);448448+ set_bit(bit, resolved_isa);451449 /* No need to keep it in source isa now that it is enabled */452452- clear_bit(ext->id, source_isa);450450+ clear_bit(bit, source_isa);453451454452 /* Single letter extensions get set in hwcap */455455- if (ext->id < RISCV_ISA_EXT_BASE)456456- *this_hwcap |= isa2hwcap[ext->id];453453+ if (bit < RISCV_ISA_EXT_BASE)454454+ *this_hwcap |= isa2hwcap[bit];457455 }458456 } while (loop && memcmp(prev_resolved_isa, resolved_isa, sizeof(prev_resolved_isa)));459457}
+1-1
arch/riscv/kernel/sbi-ipi.c
···7171 * the masking/unmasking of virtual IPIs is done7272 * via generic IPI-Mux7373 */7474- cpuhp_setup_state(CPUHP_AP_ONLINE_DYN,7474+ cpuhp_setup_state(CPUHP_AP_IRQ_RISCV_SBI_IPI_STARTING,7575 "irqchip/sbi-ipi:starting",7676 sbi_ipi_starting_cpu, NULL);7777
+9-8
arch/riscv/mm/fault.c
···61616262static inline void mm_fault_error(struct pt_regs *regs, unsigned long addr, vm_fault_t fault)6363{6464+ if (!user_mode(regs)) {6565+ no_context(regs, addr);6666+ return;6767+ }6868+6469 if (fault & VM_FAULT_OOM) {6570 /*6671 * We ran out of memory, call the OOM killer, and return the userspace6772 * (which will retry the fault, or kill us if we got oom-killed).6873 */6969- if (!user_mode(regs)) {7070- no_context(regs, addr);7171- return;7272- }7374 pagefault_out_of_memory();7475 return;7576 } else if (fault & (VM_FAULT_SIGBUS | VM_FAULT_HWPOISON | VM_FAULT_HWPOISON_LARGE)) {7677 /* Kernel mode? Handle exceptions or die */7777- if (!user_mode(regs)) {7878- no_context(regs, addr);7979- return;8080- }8178 do_trap(regs, SIGBUS, BUS_ADRERR, addr);8279 return;8080+ } else if (fault & VM_FAULT_SIGSEGV) {8181+ do_trap(regs, SIGSEGV, SEGV_MAPERR, addr);8282+ return;8383 }8484+8485 BUG();8586}8687
+11-4
arch/riscv/mm/init.c
···234234 */235235 memblock_reserve(vmlinux_start, vmlinux_end - vmlinux_start);236236237237- phys_ram_end = memblock_end_of_DRAM();238238-239237 /*240238 * Make sure we align the start of the memory on a PMD boundary so that241239 * at worst, we map the linear mapping with PMD mappings.···247249 */248250 if (IS_ENABLED(CONFIG_64BIT) && IS_ENABLED(CONFIG_MMU))249251 kernel_map.va_pa_offset = PAGE_OFFSET - phys_ram_base;252252+253253+ /*254254+ * The size of the linear page mapping may restrict the amount of255255+ * usable RAM.256256+ */257257+ if (IS_ENABLED(CONFIG_64BIT)) {258258+ max_mapped_addr = __pa(PAGE_OFFSET) + KERN_VIRT_SIZE;259259+ memblock_cap_memory_range(phys_ram_base,260260+ max_mapped_addr - phys_ram_base);261261+ }250262251263 /*252264 * Reserve physical address space that would be mapped to virtual···274266 memblock_reserve(max_mapped_addr, (phys_addr_t)-max_mapped_addr);275267 }276268269269+ phys_ram_end = memblock_end_of_DRAM();277270 min_low_pfn = PFN_UP(phys_ram_base);278271 max_low_pfn = max_pfn = PFN_DOWN(phys_ram_end);279272 high_memory = (void *)(__va(PFN_PHYS(max_low_pfn)));···12931284 if (start <= __pa(PAGE_OFFSET) &&12941285 __pa(PAGE_OFFSET) < end)12951286 start = __pa(PAGE_OFFSET);12961296- if (end >= __pa(PAGE_OFFSET) + memory_limit)12971297- end = __pa(PAGE_OFFSET) + memory_limit;1298128712991288 create_linear_mapping_range(start, end, 0, NULL);13001289 }
···113113 int mask;114114115115 if (flags & KERNEL_FPC)116116- fpu_lfpc(&state->fpc);116116+ fpu_lfpc_safe(&state->fpc);117117 if (!cpu_has_vx()) {118118 if (flags & KERNEL_VXR_V0V7)119119 load_fp_regs_vx(state->vxrs);
···33#include <linux/ptdump.h>44#include <linux/seq_file.h>55#include <linux/debugfs.h>66+#include <linux/sort.h>67#include <linux/mm.h>78#include <linux/kfence.h>89#include <linux/kasan.h>···1615static unsigned long max_addr;17161817struct addr_marker {1818+ int is_start;1919 unsigned long start_address;2020 const char *name;2121};22222323enum address_markers_idx {2424- IDENTITY_BEFORE_NR = 0,2525- IDENTITY_BEFORE_END_NR,2424+ KVA_NR = 0,2525+ LOWCORE_START_NR,2626+ LOWCORE_END_NR,2627 AMODE31_START_NR,2728 AMODE31_END_NR,2829 KERNEL_START_NR,···3330 KFENCE_START_NR,3431 KFENCE_END_NR,3532#endif3636- IDENTITY_AFTER_NR,3737- IDENTITY_AFTER_END_NR,3333+ IDENTITY_START_NR,3434+ IDENTITY_END_NR,3835 VMEMMAP_NR,3936 VMEMMAP_END_NR,4037 VMALLOC_NR,···6259};63606461static struct addr_marker address_markers[] = {6565- [IDENTITY_BEFORE_NR] = {0, "Identity Mapping Start"},6666- [IDENTITY_BEFORE_END_NR] = {(unsigned long)_stext, "Identity Mapping End"},6767- [AMODE31_START_NR] = {0, "Amode31 Area Start"},6868- [AMODE31_END_NR] = {0, "Amode31 Area End"},6969- [KERNEL_START_NR] = {(unsigned long)_stext, "Kernel Image Start"},7070- [KERNEL_END_NR] = {(unsigned long)_end, "Kernel Image End"},6262+ [KVA_NR] = {0, 0, "Kernel Virtual Address Space"},6363+ [LOWCORE_START_NR] = {1, 0, "Lowcore Start"},6464+ [LOWCORE_END_NR] = {0, 0, "Lowcore End"},6565+ [IDENTITY_START_NR] = {1, 0, "Identity Mapping Start"},6666+ [IDENTITY_END_NR] = {0, 0, "Identity Mapping End"},6767+ [AMODE31_START_NR] = {1, 0, "Amode31 Area Start"},6868+ [AMODE31_END_NR] = {0, 0, "Amode31 Area End"},6969+ [KERNEL_START_NR] = {1, (unsigned long)_stext, "Kernel Image Start"},7070+ [KERNEL_END_NR] = {0, (unsigned long)_end, "Kernel Image End"},7171#ifdef CONFIG_KFENCE7272- [KFENCE_START_NR] = {0, "KFence Pool Start"},7373- [KFENCE_END_NR] = {0, "KFence Pool End"},7272+ [KFENCE_START_NR] = {1, 0, "KFence Pool Start"},7373+ [KFENCE_END_NR] = {0, 0, "KFence Pool End"},7474#endif7575- [IDENTITY_AFTER_NR] = {(unsigned long)_end, "Identity Mapping Start"},7676- [IDENTITY_AFTER_END_NR] = {0, "Identity Mapping End"},7777- [VMEMMAP_NR] = {0, "vmemmap Area Start"},7878- [VMEMMAP_END_NR] = {0, "vmemmap Area End"},7979- [VMALLOC_NR] = {0, "vmalloc Area Start"},8080- [VMALLOC_END_NR] = {0, "vmalloc Area End"},7575+ [VMEMMAP_NR] = {1, 0, "vmemmap Area Start"},7676+ [VMEMMAP_END_NR] = {0, 0, "vmemmap Area End"},7777+ [VMALLOC_NR] = {1, 0, "vmalloc Area Start"},7878+ [VMALLOC_END_NR] = {0, 0, "vmalloc Area End"},8179#ifdef CONFIG_KMSAN8282- [KMSAN_VMALLOC_SHADOW_START_NR] = {0, "Kmsan vmalloc Shadow Start"},8383- [KMSAN_VMALLOC_SHADOW_END_NR] = {0, "Kmsan vmalloc Shadow End"},8484- [KMSAN_VMALLOC_ORIGIN_START_NR] = {0, "Kmsan vmalloc Origins Start"},8585- [KMSAN_VMALLOC_ORIGIN_END_NR] = {0, "Kmsan vmalloc Origins End"},8686- [KMSAN_MODULES_SHADOW_START_NR] = {0, "Kmsan Modules Shadow Start"},8787- [KMSAN_MODULES_SHADOW_END_NR] = {0, "Kmsan Modules Shadow End"},8888- [KMSAN_MODULES_ORIGIN_START_NR] = {0, "Kmsan Modules Origins Start"},8989- [KMSAN_MODULES_ORIGIN_END_NR] = {0, "Kmsan Modules Origins End"},8080+ [KMSAN_VMALLOC_SHADOW_START_NR] = {1, 0, "Kmsan vmalloc Shadow Start"},8181+ [KMSAN_VMALLOC_SHADOW_END_NR] = {0, 0, "Kmsan vmalloc Shadow End"},8282+ [KMSAN_VMALLOC_ORIGIN_START_NR] = {1, 0, "Kmsan vmalloc Origins Start"},8383+ [KMSAN_VMALLOC_ORIGIN_END_NR] = {0, 0, "Kmsan vmalloc Origins End"},8484+ [KMSAN_MODULES_SHADOW_START_NR] = {1, 0, "Kmsan Modules Shadow Start"},8585+ [KMSAN_MODULES_SHADOW_END_NR] = {0, 0, "Kmsan Modules Shadow End"},8686+ [KMSAN_MODULES_ORIGIN_START_NR] = {1, 0, "Kmsan Modules Origins Start"},8787+ [KMSAN_MODULES_ORIGIN_END_NR] = {0, 0, "Kmsan Modules Origins End"},9088#endif9191- [MODULES_NR] = {0, "Modules Area Start"},9292- [MODULES_END_NR] = {0, "Modules Area End"},9393- [ABS_LOWCORE_NR] = {0, "Lowcore Area Start"},9494- [ABS_LOWCORE_END_NR] = {0, "Lowcore Area End"},9595- [MEMCPY_REAL_NR] = {0, "Real Memory Copy Area Start"},9696- [MEMCPY_REAL_END_NR] = {0, "Real Memory Copy Area End"},8989+ [MODULES_NR] = {1, 0, "Modules Area Start"},9090+ [MODULES_END_NR] = {0, 0, "Modules Area End"},9191+ [ABS_LOWCORE_NR] = {1, 0, "Lowcore Area Start"},9292+ [ABS_LOWCORE_END_NR] = {0, 0, "Lowcore Area End"},9393+ [MEMCPY_REAL_NR] = {1, 0, "Real Memory Copy Area Start"},9494+ [MEMCPY_REAL_END_NR] = {0, 0, "Real Memory Copy Area End"},9795#ifdef CONFIG_KASAN9898- [KASAN_SHADOW_START_NR] = {KASAN_SHADOW_START, "Kasan Shadow Start"},9999- [KASAN_SHADOW_END_NR] = {KASAN_SHADOW_END, "Kasan Shadow End"},9696+ [KASAN_SHADOW_START_NR] = {1, KASAN_SHADOW_START, "Kasan Shadow Start"},9797+ [KASAN_SHADOW_END_NR] = {0, KASAN_SHADOW_END, "Kasan Shadow End"},10098#endif101101- { -1, NULL }9999+ {1, -1UL, NULL}102100};103101104102struct pg_state {···167163 st->wx_pages += (addr - st->start_address) / PAGE_SIZE;168164}169165166166+static void note_page_update_state(struct pg_state *st, unsigned long addr, unsigned int prot, int level)167167+{168168+ struct seq_file *m = st->seq;169169+170170+ while (addr >= st->marker[1].start_address) {171171+ st->marker++;172172+ pt_dump_seq_printf(m, "---[ %s ]---\n", st->marker->name);173173+ }174174+ st->start_address = addr;175175+ st->current_prot = prot;176176+ st->level = level;177177+}178178+170179static void note_page(struct ptdump_state *pt_st, unsigned long addr, int level, u64 val)171180{172181 int width = sizeof(unsigned long) * 2;···203186 addr = max_addr;204187 if (st->level == -1) {205188 pt_dump_seq_printf(m, "---[ %s ]---\n", st->marker->name);206206- st->start_address = addr;207207- st->current_prot = prot;208208- st->level = level;189189+ note_page_update_state(st, addr, prot, level);209190 } else if (prot != st->current_prot || level != st->level ||210191 addr >= st->marker[1].start_address) {211192 note_prot_wx(st, addr);···217202 }218203 pt_dump_seq_printf(m, "%9lu%c ", delta, *unit);219204 print_prot(m, st->current_prot, st->level);220220- while (addr >= st->marker[1].start_address) {221221- st->marker++;222222- pt_dump_seq_printf(m, "---[ %s ]---\n", st->marker->name);223223- }224224- st->start_address = addr;225225- st->current_prot = prot;226226- st->level = level;205205+ note_page_update_state(st, addr, prot, level);227206 }228207}229208···289280DEFINE_SHOW_ATTRIBUTE(ptdump);290281#endif /* CONFIG_PTDUMP_DEBUGFS */291282292292-/*293293- * Heapsort from lib/sort.c is not a stable sorting algorithm, do a simple294294- * insertion sort to preserve the original order of markers with the same295295- * start address.296296- */297297-static void sort_address_markers(void)283283+static int ptdump_cmp(const void *a, const void *b)298284{299299- struct addr_marker tmp;300300- int i, j;285285+ const struct addr_marker *ama = a;286286+ const struct addr_marker *amb = b;301287302302- for (i = 1; i < ARRAY_SIZE(address_markers) - 1; i++) {303303- tmp = address_markers[i];304304- for (j = i - 1; j >= 0 && address_markers[j].start_address > tmp.start_address; j--)305305- address_markers[j + 1] = address_markers[j];306306- address_markers[j + 1] = tmp;307307- }288288+ if (ama->start_address > amb->start_address)289289+ return 1;290290+ if (ama->start_address < amb->start_address)291291+ return -1;292292+ /*293293+ * If the start addresses of two markers are identical consider the294294+ * marker which defines the start of an area higher than the one which295295+ * defines the end of an area. This keeps pairs of markers sorted.296296+ */297297+ if (ama->is_start)298298+ return 1;299299+ if (amb->is_start)300300+ return -1;301301+ return 0;308302}309303310304static int pt_dump_init(void)···315303#ifdef CONFIG_KFENCE316304 unsigned long kfence_start = (unsigned long)__kfence_pool;317305#endif306306+ unsigned long lowcore = (unsigned long)get_lowcore();307307+318308 /*319309 * Figure out the maximum virtual address being accessible with the320310 * kernel ASCE. We need this to keep the page table walker functions···324310 */325311 max_addr = (get_lowcore()->kernel_asce.val & _REGION_ENTRY_TYPE_MASK) >> 2;326312 max_addr = 1UL << (max_addr * 11 + 31);327327- address_markers[IDENTITY_AFTER_END_NR].start_address = ident_map_size;313313+ address_markers[LOWCORE_START_NR].start_address = lowcore;314314+ address_markers[LOWCORE_END_NR].start_address = lowcore + sizeof(struct lowcore);315315+ address_markers[IDENTITY_START_NR].start_address = __identity_base;316316+ address_markers[IDENTITY_END_NR].start_address = __identity_base + ident_map_size;328317 address_markers[AMODE31_START_NR].start_address = (unsigned long)__samode31;329318 address_markers[AMODE31_END_NR].start_address = (unsigned long)__eamode31;330319 address_markers[MODULES_NR].start_address = MODULES_VADDR;···354337 address_markers[KMSAN_MODULES_ORIGIN_START_NR].start_address = KMSAN_MODULES_ORIGIN_START;355338 address_markers[KMSAN_MODULES_ORIGIN_END_NR].start_address = KMSAN_MODULES_ORIGIN_END;356339#endif357357- sort_address_markers();340340+ sort(address_markers, ARRAY_SIZE(address_markers) - 1,341341+ sizeof(address_markers[0]), ptdump_cmp, NULL);358342#ifdef CONFIG_PTDUMP_DEBUGFS359343 debugfs_create_file("kernel_page_tables", 0400, NULL, NULL, &ptdump_fops);360344#endif /* CONFIG_PTDUMP_DEBUGFS */
+2-7
arch/s390/mm/init.c
···108108{109109 unsigned long size = __end_ro_after_init - __start_ro_after_init;110110111111+ if (MACHINE_HAS_NX)112112+ system_ctl_set_bit(0, CR0_INSTRUCTION_EXEC_PROTECTION_BIT);111113 __set_memory_ro(__start_ro_after_init, __end_ro_after_init);112114 pr_info("Write protected read-only-after-init data: %luk\n", size >> 10);113115}···170168 /* this will put all low memory onto the freelists */171169 memblock_free_all();172170 setup_zero_pages(); /* Setup zeroed pages. */173173-}174174-175175-void free_initmem(void)176176-{177177- set_memory_rwnx((unsigned long)_sinittext,178178- (unsigned long)(_einittext - _sinittext) >> PAGE_SHIFT);179179- free_initmem_default(POISON_FREE_INITMEM);180171}181172182173unsigned long memory_block_size_bytes(void)
+2-11
arch/s390/mm/vmem.c
···661661{662662 __set_memory_rox(_stext, _etext);663663 __set_memory_ro(_etext, __end_rodata);664664- __set_memory_rox(_sinittext, _einittext);665664 __set_memory_rox(__stext_amode31, __etext_amode31);666665 /*667666 * If the BEAR-enhancement facility is not installed the first···669670 */670671 if (!static_key_enabled(&cpu_has_bear))671672 set_memory_x(0, 1);672672- if (debug_pagealloc_enabled()) {673673- /*674674- * Use RELOC_HIDE() as long as __va(0) translates to NULL,675675- * since performing pointer arithmetic on a NULL pointer676676- * has undefined behavior and generates compiler warnings.677677- */678678- __set_memory_4k(__va(0), RELOC_HIDE(__va(0), ident_map_size));679679- }680680- if (MACHINE_HAS_NX)681681- system_ctl_set_bit(0, CR0_INSTRUCTION_EXEC_PROTECTION_BIT);673673+ if (debug_pagealloc_enabled())674674+ __set_memory_4k(__va(0), __va(0) + ident_map_size);682675 pr_info("Write protected kernel read-only data: %luk\n",683676 (unsigned long)(__end_rodata - _stext) >> 10);684677}
···344344332 common statx sys_statx345345333 common io_pgetevents sys_io_pgetevents346346334 common rseq sys_rseq347347+335 common uretprobe sys_uretprobe347348# don't use numbers 387 through 423, add new calls after the last348349# 'common' entry349350424 common pidfd_send_signal sys_pidfd_send_signal···386385460 common lsm_set_self_attr sys_lsm_set_self_attr387386461 common lsm_list_modules sys_lsm_list_modules388387462 common mseal sys_mseal389389-467 common uretprobe sys_uretprobe390388391389#392390# Due to a historical design error, certain syscalls are numbered differently
+12-10
arch/x86/events/core.c
···15201520void perf_event_print_debug(void)15211521{15221522 u64 ctrl, status, overflow, pmc_ctrl, pmc_count, prev_left, fixed;15231523+ unsigned long *cntr_mask, *fixed_cntr_mask;15241524+ struct event_constraint *pebs_constraints;15251525+ struct cpu_hw_events *cpuc;15231526 u64 pebs, debugctl;15241524- int cpu = smp_processor_id();15251525- struct cpu_hw_events *cpuc = &per_cpu(cpu_hw_events, cpu);15261526- unsigned long *cntr_mask = hybrid(cpuc->pmu, cntr_mask);15271527- unsigned long *fixed_cntr_mask = hybrid(cpuc->pmu, fixed_cntr_mask);15281528- struct event_constraint *pebs_constraints = hybrid(cpuc->pmu, pebs_constraints);15291529- unsigned long flags;15301530- int idx;15271527+ int cpu, idx;15281528+15291529+ guard(irqsave)();15301530+15311531+ cpu = smp_processor_id();15321532+ cpuc = &per_cpu(cpu_hw_events, cpu);15331533+ cntr_mask = hybrid(cpuc->pmu, cntr_mask);15341534+ fixed_cntr_mask = hybrid(cpuc->pmu, fixed_cntr_mask);15351535+ pebs_constraints = hybrid(cpuc->pmu, pebs_constraints);1531153615321537 if (!*(u64 *)cntr_mask)15331538 return;15341534-15351535- local_irq_save(flags);1536153915371540 if (x86_pmu.version >= 2) {15381541 rdmsrl(MSR_CORE_PERF_GLOBAL_CTRL, ctrl);···15801577 pr_info("CPU#%d: fixed-PMC%d count: %016llx\n",15811578 cpu, idx, pmc_count);15821579 }15831583- local_irq_restore(flags);15841580}1585158115861582void x86_pmu_stop(struct perf_event *event, int flags)
···66666767#ifdef CONFIG_PARAVIRT6868/*6969- * virt_spin_lock_key - enables (by default) the virt_spin_lock() hijack.6969+ * virt_spin_lock_key - disables by default the virt_spin_lock() hijack.7070 *7171- * Native (and PV wanting native due to vCPU pinning) should disable this key.7272- * It is done in this backwards fashion to only have a single direction change,7373- * which removes ordering between native_pv_spin_init() and HV setup.7171+ * Native (and PV wanting native due to vCPU pinning) should keep this key7272+ * disabled. Native does not touch the key.7373+ *7474+ * When in a guest then native_pv_lock_init() enables the key first and7575+ * KVM/XEN might conditionally disable it later in the boot process again.7476 */7575-DECLARE_STATIC_KEY_TRUE(virt_spin_lock_key);7777+DECLARE_STATIC_KEY_FALSE(virt_spin_lock_key);76787779/*7880 * Shortcut for the queued_spin_lock_slowpath() function that allows
···462462 switch (c->x86_model) {463463 case 0x00 ... 0x2f:464464 case 0x40 ... 0x4f:465465- case 0x70 ... 0x7f:465465+ case 0x60 ... 0x7f:466466 setup_force_cpu_cap(X86_FEATURE_ZEN5);467467 break;468468 default:
+4-2
arch/x86/kernel/cpu/aperfmperf.c
···306306 WARN_ON_ONCE(1);307307 return;308308 }309309- static_branch_enable(&arch_scale_freq_key);309309+ static_branch_enable_cpuslocked(&arch_scale_freq_key);310310 register_freq_invariance_syscore_ops();311311 pr_info("Estimated ratio of average max frequency by base frequency (times 1024): %llu\n", arch_max_freq_ratio);312312}···323323 if (boot_cpu_data.x86_vendor != X86_VENDOR_INTEL)324324 return;325325326326- if (intel_set_max_freq_ratio())326326+ if (intel_set_max_freq_ratio()) {327327+ guard(cpus_read_lock)();327328 freq_invariance_enable();329329+ }328330}329331330332static void disable_freq_invariance_workfn(struct work_struct *work)
+1-1
arch/x86/kernel/cpu/mtrr/mtrr.c
···609609{610610 int first_cpu;611611612612- if (!mtrr_enabled())612612+ if (!mtrr_enabled() || !mtrr_state.have_fixed)613613 return;614614615615 first_cpu = cpumask_first(cpu_online_mask);
···141141 depends on CRYPTO_DEV_SP_PSP && !(KVM_AMD=y && CRYPTO_DEV_CCP_DD=m)142142 select ARCH_HAS_CC_PLATFORM143143 select KVM_GENERIC_PRIVATE_MEM144144- select HAVE_KVM_GMEM_PREPARE145145- select HAVE_KVM_GMEM_INVALIDATE144144+ select HAVE_KVM_ARCH_GMEM_PREPARE145145+ select HAVE_KVM_ARCH_GMEM_INVALIDATE146146 help147147 Provides support for launching Encrypted VMs (SEV) and Encrypted VMs148148 with Encrypted State (SEV-ES) on AMD processors.
+1-1
arch/x86/kvm/lapic.c
···17431743 s64 min_period = min_timer_period_us * 1000LL;1744174417451745 if (apic->lapic_timer.period < min_period) {17461746- pr_info_ratelimited(17461746+ pr_info_once(17471747 "vcpu %i: requested %lld ns "17481748 "lapic timer period limited to %lld ns\n",17491749 apic->vcpu->vcpu_id,
+5-2
arch/x86/kvm/mmu/mmu.c
···43354335 if (req_max_level)43364336 max_level = min(max_level, req_max_level);4337433743384338- return req_max_level;43384338+ return max_level;43394339}4340434043414341static int kvm_faultin_pfn_private(struct kvm_vcpu *vcpu,···47424742 u8 level = PG_LEVEL_4K;47434743 u64 end;47444744 int r;47454745+47464746+ if (!vcpu->kvm->arch.pre_fault_allowed)47474747+ return -EOPNOTSUPP;4745474847464749 /*47474750 * reload is efficient when called repeatedly, so we can do it on···75137510 const unsigned long end = start + KVM_PAGES_PER_HPAGE(level);7514751175157512 if (level == PG_LEVEL_2M)75167516- return kvm_range_has_memory_attributes(kvm, start, end, attrs);75137513+ return kvm_range_has_memory_attributes(kvm, start, end, ~0, attrs);7517751475187515 for (gfn = start; gfn < end; gfn += KVM_PAGES_PER_HPAGE(level - 1)) {75197516 if (hugepage_test_mixed(slot, gfn, level - 1) ||
+9-8
arch/x86/kvm/svm/sev.c
···22792279 bool assigned;22802280 int level;2281228122822282- if (!kvm_mem_is_private(kvm, gfn)) {22832283- pr_debug("%s: Failed to ensure GFN 0x%llx has private memory attribute set\n",22842284- __func__, gfn);22852285- ret = -EINVAL;22862286- goto err;22872287- }22882288-22892282 ret = snp_lookup_rmpentry((u64)pfn + i, &assigned, &level);22902283 if (ret || assigned) {22912284 pr_debug("%s: Failed to ensure GFN 0x%llx RMP entry is initial shared state, ret: %d assigned: %d\n",22922285 __func__, gfn, ret, assigned);22932293- ret = -EINVAL;22862286+ ret = ret ? -EINVAL : -EEXIST;22942287 goto err;22952288 }22962289···25412548 memcpy(data->host_data, params.host_data, KVM_SEV_SNP_FINISH_DATA_SIZE);25422549 data->gctx_paddr = __psp_pa(sev->snp_context);25432550 ret = sev_issue_cmd(kvm, SEV_CMD_SNP_LAUNCH_FINISH, data, &argp->error);25512551+25522552+ /*25532553+ * Now that there will be no more SNP_LAUNCH_UPDATE ioctls, private pages25542554+ * can be given to the guest simply by marking the RMP entry as private.25552555+ * This can happen on first access and also with KVM_PRE_FAULT_MEMORY.25562556+ */25572557+ if (!ret)25582558+ kvm->arch.pre_fault_allowed = true;2544255925452560 kfree(id_auth);25462561
···241241 *242242 * Returns a pointer to a PTE on success, or NULL on failure.243243 */244244-static pte_t *pti_user_pagetable_walk_pte(unsigned long address)244244+static pte_t *pti_user_pagetable_walk_pte(unsigned long address, bool late_text)245245{246246 gfp_t gfp = (GFP_KERNEL | __GFP_NOTRACK | __GFP_ZERO);247247 pmd_t *pmd;···251251 if (!pmd)252252 return NULL;253253254254- /* We can't do anything sensible if we hit a large mapping. */254254+ /* Large PMD mapping found */255255 if (pmd_leaf(*pmd)) {256256- WARN_ON(1);257257- return NULL;256256+ /* Clear the PMD if we hit a large mapping from the first round */257257+ if (late_text) {258258+ set_pmd(pmd, __pmd(0));259259+ } else {260260+ WARN_ON_ONCE(1);261261+ return NULL;262262+ }258263 }259264260265 if (pmd_none(*pmd)) {···288283 if (!pte || WARN_ON(level != PG_LEVEL_4K) || pte_none(*pte))289284 return;290285291291- target_pte = pti_user_pagetable_walk_pte(VSYSCALL_ADDR);286286+ target_pte = pti_user_pagetable_walk_pte(VSYSCALL_ADDR, false);292287 if (WARN_ON(!target_pte))293288 return;294289···306301307302static void308303pti_clone_pgtable(unsigned long start, unsigned long end,309309- enum pti_clone_level level)304304+ enum pti_clone_level level, bool late_text)310305{311306 unsigned long addr;312307···379374 */380375 *target_pmd = *pmd;381376382382- addr += PMD_SIZE;377377+ addr = round_up(addr + 1, PMD_SIZE);383378384379 } else if (level == PTI_CLONE_PTE) {385380386381 /* Walk the page-table down to the pte level */387382 pte = pte_offset_kernel(pmd, addr);388383 if (pte_none(*pte)) {389389- addr += PAGE_SIZE;384384+ addr = round_up(addr + 1, PAGE_SIZE);390385 continue;391386 }392387···395390 return;396391397392 /* Allocate PTE in the user page-table */398398- target_pte = pti_user_pagetable_walk_pte(addr);393393+ target_pte = pti_user_pagetable_walk_pte(addr, late_text);399394 if (WARN_ON(!target_pte))400395 return;401396···406401 /* Clone the PTE */407402 *target_pte = *pte;408403409409- addr += PAGE_SIZE;404404+ addr = round_up(addr + 1, PAGE_SIZE);410405411406 } else {412407 BUG();···457452 phys_addr_t pa = per_cpu_ptr_to_phys((void *)va);458453 pte_t *target_pte;459454460460- target_pte = pti_user_pagetable_walk_pte(va);455455+ target_pte = pti_user_pagetable_walk_pte(va, false);461456 if (WARN_ON(!target_pte))462457 return;463458···480475 start = CPU_ENTRY_AREA_BASE;481476 end = start + (PAGE_SIZE * CPU_ENTRY_AREA_PAGES);482477483483- pti_clone_pgtable(start, end, PTI_CLONE_PMD);478478+ pti_clone_pgtable(start, end, PTI_CLONE_PMD, false);484479}485480#endif /* CONFIG_X86_64 */486481···497492/*498493 * Clone the populated PMDs of the entry text and force it RO.499494 */500500-static void pti_clone_entry_text(void)495495+static void pti_clone_entry_text(bool late)501496{502497 pti_clone_pgtable((unsigned long) __entry_text_start,503498 (unsigned long) __entry_text_end,504504- PTI_CLONE_PMD);499499+ PTI_LEVEL_KERNEL_IMAGE, late);505500}506501507502/*···576571 * pti_set_kernel_image_nonglobal() did to clear the577572 * global bit.578573 */579579- pti_clone_pgtable(start, end_clone, PTI_LEVEL_KERNEL_IMAGE);574574+ pti_clone_pgtable(start, end_clone, PTI_LEVEL_KERNEL_IMAGE, false);580575581576 /*582577 * pti_clone_pgtable() will set the global bit in any PMDs···643638644639 /* Undo all global bits from the init pagetables in head_64.S: */645640 pti_set_kernel_image_nonglobal();641641+646642 /* Replace some of the global bits just for shared entry text: */647647- pti_clone_entry_text();643643+ /*644644+ * This is very early in boot. Device and Late initcalls can do645645+ * modprobe before free_initmem() and mark_readonly(). This646646+ * pti_clone_entry_text() allows those user-mode-helpers to function,647647+ * but notably the text is still RW.648648+ */649649+ pti_clone_entry_text(false);648650 pti_setup_espfix64();649651 pti_setup_vsyscall();650652}···668656 if (!boot_cpu_has(X86_FEATURE_PTI))669657 return;670658 /*671671- * We need to clone everything (again) that maps parts of the672672- * kernel image.659659+ * This is after free_initmem() (all initcalls are done) and we've done660660+ * mark_readonly(). Text is now NX which might've split some PMDs661661+ * relative to the early clone.673662 */674674- pti_clone_entry_text();663663+ pti_clone_entry_text(true);675664 pti_clone_kernel_text();676665677666 debug_checkwx_user();
-11
block/blk-throttle.c
···31313232#define rb_entry_tg(node) rb_entry((node), struct throtl_grp, rb_node)33333434-/* We measure latency for request size from <= 4k to >= 1M */3535-#define LATENCY_BUCKET_SIZE 93636-3737-struct latency_bucket {3838- unsigned long total_latency; /* ns / 1024 */3939- int samples;4040-};4141-4234struct throtl_data4335{4436 /* service tree for active throtl groups */···107115108116 return tg->iops[rw];109117}110110-111111-#define request_bucket_index(sectors) \112112- clamp_t(int, order_base_2(sectors) - 3, 0, LATENCY_BUCKET_SIZE - 1)113118114119/**115120 * throtl_log - log debug message via blktrace
+6-9
drivers/android/binder.c
···10441044}1045104510461046/* Find the smallest unused descriptor the "slow way" */10471047-static u32 slow_desc_lookup_olocked(struct binder_proc *proc)10471047+static u32 slow_desc_lookup_olocked(struct binder_proc *proc, u32 offset)10481048{10491049 struct binder_ref *ref;10501050 struct rb_node *n;10511051 u32 desc;1052105210531053- desc = 1;10531053+ desc = offset;10541054 for (n = rb_first(&proc->refs_by_desc); n; n = rb_next(n)) {10551055 ref = rb_entry(n, struct binder_ref, rb_node_desc);10561056 if (ref->data.desc > desc)···10711071 u32 *desc)10721072{10731073 struct dbitmap *dmap = &proc->dmap;10741074+ unsigned int nbits, offset;10741075 unsigned long *new, bit;10751075- unsigned int nbits;1076107610771077 /* 0 is reserved for the context manager */10781078- if (node == proc->context->binder_context_mgr_node) {10791079- *desc = 0;10801080- return 0;10811081- }10781078+ offset = (node == proc->context->binder_context_mgr_node) ? 0 : 1;1082107910831080 if (!dbitmap_enabled(dmap)) {10841084- *desc = slow_desc_lookup_olocked(proc);10811081+ *desc = slow_desc_lookup_olocked(proc, offset);10851082 return 0;10861083 }1087108410881088- if (dbitmap_acquire_first_zero_bit(dmap, &bit) == 0) {10851085+ if (dbitmap_acquire_next_zero_bit(dmap, offset, &bit) == 0) {10891086 *desc = bit;10901087 return 0;10911088 }
···66 *77 * Used by the binder driver to optimize the allocation of the smallest88 * available descriptor ID. Each bit in the bitmap represents the state99- * of an ID, with the exception of BIT(0) which is used exclusively to1010- * reference binder's context manager.99+ * of an ID.1110 *1211 * A dbitmap can grow or shrink as needed. This part has been designed1312 * considering that users might need to briefly release their locks in···5758 if (bit < (dmap->nbits >> 2))5859 return dmap->nbits >> 1;59606060- /*6161- * Note that find_last_bit() returns dmap->nbits when no bits6262- * are set. While this is technically not possible here since6363- * BIT(0) is always set, this check is left for extra safety.6464- */6161+ /* find_last_bit() returns dmap->nbits when no bits are set. */6562 if (bit == dmap->nbits)6663 return NBITS_MIN;6764···127132}128133129134/*130130- * Finds and sets the first zero bit in the bitmap. Upon success @bit135135+ * Finds and sets the next zero bit in the bitmap. Upon success @bit131136 * is populated with the index and 0 is returned. Otherwise, -ENOSPC132137 * is returned to indicate that a dbitmap_grow() is needed.133138 */134139static inline int135135-dbitmap_acquire_first_zero_bit(struct dbitmap *dmap, unsigned long *bit)140140+dbitmap_acquire_next_zero_bit(struct dbitmap *dmap, unsigned long offset,141141+ unsigned long *bit)136142{137143 unsigned long n;138144139139- n = find_first_zero_bit(dmap->map, dmap->nbits);145145+ n = find_next_zero_bit(dmap->map, dmap->nbits, offset);140146 if (n == dmap->nbits)141147 return -ENOSPC;142148···150154static inline void151155dbitmap_clear_bit(struct dbitmap *dmap, unsigned long bit)152156{153153- /* BIT(0) should always set for the context manager */154154- if (bit)155155- clear_bit(bit, dmap->map);157157+ clear_bit(bit, dmap->map);156158}157159158160static inline int dbitmap_init(struct dbitmap *dmap)···162168 }163169164170 dmap->nbits = NBITS_MIN;165165- /* BIT(0) is reserved for the context manager */166166- set_bit(0, dmap->map);167171168172 return 0;169173}
+8-5
drivers/base/core.c
···2525#include <linux/mutex.h>2626#include <linux/pm_runtime.h>2727#include <linux/netdevice.h>2828+#include <linux/rcupdate.h>2829#include <linux/sched/signal.h>2930#include <linux/sched/mm.h>3031#include <linux/string_helpers.h>···26412640static int dev_uevent(const struct kobject *kobj, struct kobj_uevent_env *env)26422641{26432642 const struct device *dev = kobj_to_dev(kobj);26432643+ struct device_driver *driver;26442644 int retval = 0;2645264526462646 /* add device node properties if present */···26702668 if (dev->type && dev->type->name)26712669 add_uevent_var(env, "DEVTYPE=%s", dev->type->name);2672267026732673- if (dev->driver)26742674- add_uevent_var(env, "DRIVER=%s", dev->driver->name);26712671+ /* Synchronize with module_remove_driver() */26722672+ rcu_read_lock();26732673+ driver = READ_ONCE(dev->driver);26742674+ if (driver)26752675+ add_uevent_var(env, "DRIVER=%s", driver->name);26762676+ rcu_read_unlock();2675267726762678 /* Add common DT information about the device */26772679 of_device_uevent(dev, env);···27452739 if (!env)27462740 return -ENOMEM;2747274127482748- /* Synchronize with really_probe() */27492749- device_lock(dev);27502742 /* let the kset specific function add its keys */27512743 retval = kset->uevent_ops->uevent(&dev->kobj, env);27522752- device_unlock(dev);27532744 if (retval)27542745 goto out;27552746
···437437}438438EXPORT_SYMBOL_GPL(btmtk_process_coredump);439439440440+#if IS_ENABLED(CONFIG_BT_HCIBTUSB_MTK)440441static void btmtk_usb_wmt_recv(struct urb *urb)441442{442443 struct hci_dev *hdev = urb->context;···12631262 struct btmtk_data *btmtk_data = hci_get_priv(hdev);1264126312651264 /* Stop urb anchor for iso data transmission */12661266- usb_kill_anchored_urbs(&btmtk_data->isopkt_anchor);12651265+ if (test_bit(BTMTK_ISOPKT_RUNNING, &btmtk_data->flags))12661266+ usb_kill_anchored_urbs(&btmtk_data->isopkt_anchor);1267126712681268 return 0;12691269}···14891487 return 0;14901488}14911489EXPORT_SYMBOL_GPL(btmtk_usb_shutdown);14901490+#endif1492149114931492MODULE_AUTHOR("Sean Wang <sean.wang@mediatek.com>");14941493MODULE_AUTHOR("Mark Chen <mark-yw.chen@mediatek.com>");
+9-10
drivers/bluetooth/hci_qca.c
···21602160 qcadev = serdev_device_get_drvdata(hu->serdev);21612161 power = qcadev->bt_power;2162216221632163- if (power->pwrseq) {21632163+ if (power && power->pwrseq) {21642164 pwrseq_power_off(power->pwrseq);21652165 set_bit(QCA_BT_OFF, &qca->flags);21662166 return;···21852185 sw_ctrl_state = gpiod_get_value_cansleep(qcadev->sw_ctrl);21862186 bt_dev_dbg(hu->hdev, "SW_CTRL is %d", sw_ctrl_state);21872187 }21882188- break;21892189-21902190- case QCA_QCA6390:21912191- pwrseq_power_off(qcadev->bt_power->pwrseq);21922188 break;2193218921942190 default:···24122416 break;2413241724142418 case QCA_QCA6390:24152415- qcadev->bt_power->pwrseq = devm_pwrseq_get(&serdev->dev,24162416- "bluetooth");24172417- if (IS_ERR(qcadev->bt_power->pwrseq))24182418- return PTR_ERR(qcadev->bt_power->pwrseq);24192419- break;24192419+ if (dev_of_node(&serdev->dev)) {24202420+ qcadev->bt_power->pwrseq = devm_pwrseq_get(&serdev->dev,24212421+ "bluetooth");24222422+ if (IS_ERR(qcadev->bt_power->pwrseq))24232423+ return PTR_ERR(qcadev->bt_power->pwrseq);24242424+ break;24252425+ }24262426+ fallthrough;2420242724212428 default:24222429 qcadev->bt_en = devm_gpiod_get_optional(&serdev->dev, "enable",
+1
drivers/cache/Kconfig
···1818 bool "StarFive StarLink Cache controller"1919 depends on RISCV2020 depends on ARCH_STARFIVE2121+ depends on 64BIT2122 select RISCV_DMA_NONCOHERENT2223 select RISCV_NONSTANDARD_CACHE_OPS2324 help
···14441444}14451445module_exit(fsi_exit);14461446module_param(discard_errors, int, 0664);14471447+MODULE_DESCRIPTION("FSI core driver");14471448MODULE_LICENSE("GPL");14481449MODULE_PARM_DESC(discard_errors, "Don't invoke error handling on bus accesses");
+1
drivers/fsi/fsi-master-aspeed.c
···670670};671671672672module_platform_driver(fsi_master_aspeed_driver);673673+MODULE_DESCRIPTION("FSI master driver for AST2600");673674MODULE_LICENSE("GPL");
+2-1
drivers/fsi/fsi-master-ast-cf.c
···11// SPDX-License-Identifier: GPL-2.0+22// Copyright 2018 IBM Corp33/*44- * A FSI master controller, using a simple GPIO bit-banging interface44+ * A FSI master based on Aspeed ColdFire coprocessor55 */6677#include <linux/crc4.h>···14381438};1439143914401440module_platform_driver(fsi_master_acf);14411441+MODULE_DESCRIPTION("A FSI master based on Aspeed ColdFire coprocessor");14411442MODULE_LICENSE("GPL");14421443MODULE_FIRMWARE(FW_FILE_NAME);
+1
drivers/fsi/fsi-master-gpio.c
···892892};893893894894module_platform_driver(fsi_master_gpio_driver);895895+MODULE_DESCRIPTION("A FSI master controller, using a simple GPIO bit-banging interface");895896MODULE_LICENSE("GPL");
···268268config DRM_GPUVM269269 tristate270270 depends on DRM271271+ select DRM_EXEC271272 help272273 GPU-VM representation providing helpers to manage a GPUs virtual273274 address space
+8-8
drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c
···17781778 struct ttm_operation_ctx ctx = { false, false };17791779 struct amdgpu_vm *vm = &fpriv->vm;17801780 struct amdgpu_bo_va_mapping *mapping;17811781- int r;17811781+ int i, r;1782178217831783 addr /= AMDGPU_GPU_PAGE_SIZE;17841784···17931793 if (dma_resv_locking_ctx((*bo)->tbo.base.resv) != &parser->exec.ticket)17941794 return -EINVAL;1795179517961796- if (!((*bo)->flags & AMDGPU_GEM_CREATE_VRAM_CONTIGUOUS)) {17971797- (*bo)->flags |= AMDGPU_GEM_CREATE_VRAM_CONTIGUOUS;17981798- amdgpu_bo_placement_from_domain(*bo, (*bo)->allowed_domains);17991799- r = ttm_bo_validate(&(*bo)->tbo, &(*bo)->placement, &ctx);18001800- if (r)18011801- return r;18021802- }17961796+ (*bo)->flags |= AMDGPU_GEM_CREATE_VRAM_CONTIGUOUS;17971797+ amdgpu_bo_placement_from_domain(*bo, (*bo)->allowed_domains);17981798+ for (i = 0; i < (*bo)->placement.num_placement; i++)17991799+ (*bo)->placements[i].flags |= TTM_PL_FLAG_CONTIGUOUS;18001800+ r = ttm_bo_validate(&(*bo)->tbo, &(*bo)->placement, &ctx);18011801+ if (r)18021802+ return r;1803180318041804 return amdgpu_ttm_alloc_gart(&(*bo)->tbo);18051805}
+6
drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.h
···156156 uint64_t addr, uint64_t *flags);157157 /* get the amount of memory used by the vbios for pre-OS console */158158 unsigned int (*get_vbios_fb_size)(struct amdgpu_device *adev);159159+ /* get the DCC buffer alignment */160160+ unsigned int (*get_dcc_alignment)(struct amdgpu_device *adev);159161160162 enum amdgpu_memory_partition (*query_mem_partition_mode)(161163 struct amdgpu_device *adev);···365363 (adev)->gmc.gmc_funcs->override_vm_pte_flags \366364 ((adev), (vm), (addr), (pte_flags))367365#define amdgpu_gmc_get_vbios_fb_size(adev) (adev)->gmc.gmc_funcs->get_vbios_fb_size((adev))366366+#define amdgpu_gmc_get_dcc_alignment(adev) ({ \367367+ typeof(adev) _adev = (adev); \368368+ _adev->gmc.gmc_funcs->get_dcc_alignment(_adev); \369369+})368370369371/**370372 * amdgpu_gmc_vram_full_visible - Check if full VRAM is visible through the BAR
+1-2
drivers/gpu/drm/amd/amdgpu/amdgpu_job.c
···264264 struct dma_fence *fence = NULL;265265 int r;266266267267- /* Ignore soft recovered fences here */268267 r = drm_sched_entity_error(s_entity);269269- if (r && r != -ENODATA)268268+ if (r)270269 goto error;271270272271 if (!fence && job->gang_submit)
···28282929#define MES_API_VERSION 130303131+/* Maximum log buffer size for MES. Needs to be updated if MES expands MES_EVT_INTR_HIST_LOG */3232+#define AMDGPU_MES_LOG_BUFFER_SIZE 0x40003333+3134/* Driver submits one API(cmd) as a single Frame and this command size is same3235 * for all API to ease the debugging and parsing of ring buffer.3336 */
+3
drivers/gpu/drm/amd/include/mes_v12_api_def.h
···28282929#define MES_API_VERSION 0x1430303131+/* Maximum log buffer size for MES. Needs to be updated if MES expands MES_EVT_INTR_HIST_LOG_12 */3232+#define AMDGPU_MES_LOG_BUFFER_SIZE 0xC0003333+3134/* Driver submits one API(cmd) as a single Frame and this command size is same for all API3235 * to ease the debugging and parsing of ring buffer.3336 */
+2-1
drivers/gpu/drm/amd/pm/amdgpu_dpm.c
···618618 const struct amd_pm_funcs *pp_funcs = adev->powerplay.pp_funcs;619619 int r = 0;620620621621- if (!pp_funcs || !pp_funcs->load_firmware || adev->flags & AMD_IS_APU)621621+ if (!pp_funcs || !pp_funcs->load_firmware ||622622+ (is_support_sw_smu(adev) && (adev->flags & AMD_IS_APU)))622623 return 0;623624624625 mutex_lock(&adev->pm.mutex);
···2222 */2323#include <asm/div64.h>24242525-#define SHIFT_AMOUNT 16 /* We multiply all original integers with 2^SHIFT_AMOUNT to get the fInt representation */2525+enum ppevvmath_constants {2626+ /* We multiply all original integers with 2^SHIFT_AMOUNT to get the fInt representation */2727+ SHIFT_AMOUNT = 16,26282727-#define PRECISION 5 /* Change this value to change the number of decimal places in the final output - 5 is a good default */2929+ /* Change this value to change the number of decimal places in the final output - 5 is a good default */3030+ PRECISION = 5,28312929-#define SHIFTED_2 (2 << SHIFT_AMOUNT)3030-#define MAX (1 << (SHIFT_AMOUNT - 1)) - 1 /* 32767 - Might change in the future */3232+ SHIFTED_2 = (2 << SHIFT_AMOUNT),3333+3434+ /* 32767 - Might change in the future */3535+ MAX = (1 << (SHIFT_AMOUNT - 1)) - 1,3636+};31373238/* -------------------------------------------------------------------------------3339 * NEW TYPE - fINT
···27272828#pragma pack(push, 1)29293030-#define SMU_14_0_2_TABLE_FORMAT_REVISION 33030+#define SMU_14_0_2_TABLE_FORMAT_REVISION 233131+#define SMU_14_0_2_CUSTOM_TABLE_FORMAT_REVISION 131323233// POWERPLAYTABLE::ulPlatformCaps3334#define SMU_14_0_2_PP_PLATFORM_CAP_POWERPLAY 0x1 // This cap indicates whether CCC need to show Powerplay page.···4443#define SMU_14_0_2_PP_THERMALCONTROLLER_NONE 045444645#define SMU_14_0_2_PP_OVERDRIVE_VERSION 0x1 // TODO: FIX OverDrive Version TBD4646+#define SMU_14_0_2_PP_CUSTOM_OVERDRIVE_VERSION 0x14747#define SMU_14_0_2_PP_POWERSAVINGCLOCK_VERSION 0x01 // Power Saving Clock Table Version 1.0048484949enum SMU_14_0_2_OD_SW_FEATURE_CAP···109107 SMU_14_0_2_PMSETTING_ACOUSTIC_LIMIT_RPM_BALANCE,110108 SMU_14_0_2_PMSETTING_ACOUSTIC_LIMIT_RPM_TURBO,111109 SMU_14_0_2_PMSETTING_ACOUSTIC_LIMIT_RPM_RAGE,110110+ SMU_14_0_2_PMSETTING_COUNT112111};113112#define SMU_14_0_2_MAX_PMSETTING 32 // Maximum Number of PowerMode Settings114113···130127 int16_t pm_setting[SMU_14_0_2_MAX_PMSETTING]; // Optimized power mode feature settings131128};132129130130+enum smu_14_0_3_pptable_source {131131+ PPTABLE_SOURCE_IFWI = 0,132132+ PPTABLE_SOURCE_DRIVER_HARDCODED = 1,133133+ PPTABLE_SOURCE_PPGEN_REGISTRY = 2,134134+ PPTABLE_SOURCE_MAX = PPTABLE_SOURCE_PPGEN_REGISTRY,135135+};136136+133137struct smu_14_0_2_powerplay_table134138{135139 struct atom_common_table_header header; // header.format_revision = 3 (HAS TO MATCH SMU_14_0_2_TABLE_FORMAT_REVISION), header.content_revision = ? structuresize is calculated by PPGen.136140 uint8_t table_revision; // PPGen use only: table_revision = 3137137- uint8_t padding; // Padding 1 byte to align table_size offset to 6 bytes (pmfw_start_offset, for PMFW to know the starting offset of PPTable_t).141141+ uint8_t pptable_source; // PPGen UI dropdown box138142 uint16_t pmfw_pptable_start_offset; // The start offset of the pmfw portion. i.e. start of PPTable_t (start of SkuTable_t)139143 uint16_t pmfw_pptable_size; // The total size of pmfw_pptable, i.e PPTable_t.140140- uint16_t pmfw_pfe_table_start_offset; // The start offset of the PFE_Settings_t within pmfw_pptable.141141- uint16_t pmfw_pfe_table_size; // The size of PFE_Settings_t.142142- uint16_t pmfw_board_table_start_offset; // The start offset of the BoardTable_t within pmfw_pptable.143143- uint16_t pmfw_board_table_size; // The size of BoardTable_t.144144+ uint16_t pmfw_sku_table_start_offset; // DO NOT CHANGE ORDER; The absolute start offset of the SkuTable_t (within smu_14_0_3_powerplay_table).145145+ uint16_t pmfw_sku_table_size; // DO NOT CHANGE ORDER; The size of SkuTable_t.146146+ uint16_t pmfw_board_table_start_offset; // The start offset of the BoardTable_t147147+ uint16_t pmfw_board_table_size; // The size of BoardTable_t.144148 uint16_t pmfw_custom_sku_table_start_offset; // The start offset of the CustomSkuTable_t within pmfw_pptable.145149 uint16_t pmfw_custom_sku_table_size; // The size of the CustomSkuTable_t.146150 uint32_t golden_pp_id; // PPGen use only: PP Table ID on the Golden Data Base···167157 struct smu_14_0_2_overdrive_table overdrive_table;168158169159 PPTable_t smc_pptable; // PPTable_t in driver_if.h -- as requested by PMFW, this offset should start at a 32-byte boundary, and the table_size above should remain at offset=6 bytes160160+};161161+162162+enum SMU_14_0_2_CUSTOM_OD_SW_FEATURE_CAP {163163+ SMU_14_0_2_CUSTOM_ODCAP_POWER_MODE = 0,164164+ SMU_14_0_2_CUSTOM_ODCAP_COUNT165165+};166166+167167+enum SMU_14_0_2_CUSTOM_OD_FEATURE_SETTING_ID {168168+ SMU_14_0_2_CUSTOM_ODSETTING_POWER_MODE = 0,169169+ SMU_14_0_2_CUSTOM_ODSETTING_COUNT,170170+};171171+172172+struct smu_14_0_2_custom_overdrive_table {173173+ uint8_t revision;174174+ uint8_t reserve[3];175175+ uint8_t cap[SMU_14_0_2_CUSTOM_ODCAP_COUNT];176176+ int32_t max[SMU_14_0_2_CUSTOM_ODSETTING_COUNT];177177+ int32_t min[SMU_14_0_2_CUSTOM_ODSETTING_COUNT];178178+ int16_t pm_setting[SMU_14_0_2_PMSETTING_COUNT];179179+};180180+181181+struct smu_14_0_3_custom_powerplay_table {182182+ uint8_t custom_table_revision;183183+ uint16_t custom_table_size;184184+ uint16_t custom_sku_table_offset;185185+ uint32_t custom_platform_caps;186186+ uint16_t software_shutdown_temp;187187+ struct smu_14_0_2_custom_overdrive_table custom_overdrive_table;188188+ uint32_t reserve[8];189189+ CustomSkuTable_t custom_sku_table_pmfw;170190};171191172192#pragma pack(pop)
···624624static void drm_fb_helper_damage(struct drm_fb_helper *helper, u32 x, u32 y,625625 u32 width, u32 height)626626{627627+ /*628628+ * This function may be invoked by panic() to flush the frame629629+ * buffer, where all CPUs except the panic CPU are stopped.630630+ * During the following schedule_work(), the panic CPU needs631631+ * the worker_pool lock, which might be held by a stopped CPU,632632+ * causing schedule_work() and panic() to block. Return early on633633+ * oops_in_progress to prevent this blocking.634634+ */635635+ if (oops_in_progress)636636+ return;637637+627638 drm_fb_helper_add_damage_clip(helper, x, y, width, height);628639629640 schedule_work(&helper->damage_work);
···351351 if (IS_GEMINILAKE(i915) || IS_BROXTON(i915))352352 return 2;353353354354+ if (INTEL_PCH_TYPE(i915) >= PCH_MTL)355355+ return 2;356356+354357 if (INTEL_PCH_TYPE(i915) >= PCH_DG1)355358 return 1;356359
+49-6
drivers/gpu/drm/i915/gem/i915_gem_mman.c
···290290 return i915_error_to_vmf_fault(err);291291}292292293293+static void set_address_limits(struct vm_area_struct *area,294294+ struct i915_vma *vma,295295+ unsigned long obj_offset,296296+ unsigned long *start_vaddr,297297+ unsigned long *end_vaddr)298298+{299299+ unsigned long vm_start, vm_end, vma_size; /* user's memory parameters */300300+ long start, end; /* memory boundaries */301301+302302+ /*303303+ * Let's move into the ">> PAGE_SHIFT"304304+ * domain to be sure not to lose bits305305+ */306306+ vm_start = area->vm_start >> PAGE_SHIFT;307307+ vm_end = area->vm_end >> PAGE_SHIFT;308308+ vma_size = vma->size >> PAGE_SHIFT;309309+310310+ /*311311+ * Calculate the memory boundaries by considering the offset312312+ * provided by the user during memory mapping and the offset313313+ * provided for the partial mapping.314314+ */315315+ start = vm_start;316316+ start -= obj_offset;317317+ start += vma->gtt_view.partial.offset;318318+ end = start + vma_size;319319+320320+ start = max_t(long, start, vm_start);321321+ end = min_t(long, end, vm_end);322322+323323+ /* Let's move back into the "<< PAGE_SHIFT" domain */324324+ *start_vaddr = (unsigned long)start << PAGE_SHIFT;325325+ *end_vaddr = (unsigned long)end << PAGE_SHIFT;326326+}327327+293328static vm_fault_t vm_fault_gtt(struct vm_fault *vmf)294329{295330#define MIN_CHUNK_PAGES (SZ_1M >> PAGE_SHIFT)···337302 struct i915_ggtt *ggtt = to_gt(i915)->ggtt;338303 bool write = area->vm_flags & VM_WRITE;339304 struct i915_gem_ww_ctx ww;305305+ unsigned long obj_offset;306306+ unsigned long start, end; /* memory boundaries */340307 intel_wakeref_t wakeref;341308 struct i915_vma *vma;342309 pgoff_t page_offset;310310+ unsigned long pfn;343311 int srcu;344312 int ret;345313346346- /* We don't use vmf->pgoff since that has the fake offset */314314+ obj_offset = area->vm_pgoff - drm_vma_node_start(&mmo->vma_node);347315 page_offset = (vmf->address - area->vm_start) >> PAGE_SHIFT;316316+ page_offset += obj_offset;348317349318 trace_i915_gem_object_fault(obj, page_offset, true, write);350319···441402 if (ret)442403 goto err_unpin;443404405405+ set_address_limits(area, vma, obj_offset, &start, &end);406406+407407+ pfn = (ggtt->gmadr.start + i915_ggtt_offset(vma)) >> PAGE_SHIFT;408408+ pfn += (start - area->vm_start) >> PAGE_SHIFT;409409+ pfn += obj_offset - vma->gtt_view.partial.offset;410410+444411 /* Finally, remap it using the new GTT offset */445445- ret = remap_io_mapping(area,446446- area->vm_start + (vma->gtt_view.partial.offset << PAGE_SHIFT),447447- (ggtt->gmadr.start + i915_ggtt_offset(vma)) >> PAGE_SHIFT,448448- min_t(u64, vma->size, area->vm_end - area->vm_start),449449- &ggtt->iomap);412412+ ret = remap_io_mapping(area, start, pfn, end - start, &ggtt->iomap);450413 if (ret)451414 goto err_fence;452415···11251084 mmo = mmap_offset_attach(obj, mmap_type, NULL);11261085 if (IS_ERR(mmo))11271086 return PTR_ERR(mmo);10871087+10881088+ vma->vm_pgoff += drm_vma_node_start(&mmo->vma_node);11281089 }1129109011301091 /*
+7-6
drivers/gpu/drm/i915/gem/i915_gem_ttm.c
···165165 i915_ttm_place_from_region(num_allowed ? obj->mm.placements[0] :166166 obj->mm.region, &places[0], obj->bo_offset,167167 obj->base.size, flags);168168- places[0].flags |= TTM_PL_FLAG_DESIRED;169168170169 /* Cache this on object? */171170 for (i = 0; i < num_allowed; ++i) {···778779 .interruptible = true,779780 .no_wait_gpu = false,780781 };781781- int real_num_busy;782782+ struct ttm_placement initial_placement;783783+ struct ttm_place initial_place;782784 int ret;783785784786 /* First try only the requested placement. No eviction. */785785- real_num_busy = placement->num_placement;786786- placement->num_placement = 1;787787- ret = ttm_bo_validate(bo, placement, &ctx);787787+ initial_placement.num_placement = 1;788788+ memcpy(&initial_place, placement->placement, sizeof(struct ttm_place));789789+ initial_place.flags |= TTM_PL_FLAG_DESIRED;790790+ initial_placement.placement = &initial_place;791791+ ret = ttm_bo_validate(bo, &initial_placement, &ctx);788792 if (ret) {789793 ret = i915_ttm_err_to_gem(ret);790794 /*···802800 * If the initial attempt fails, allow all accepted placements,803801 * evicting if necessary.804802 */805805- placement->num_placement = real_num_busy;806803 ret = ttm_bo_validate(bo, placement, &ctx);807804 if (ret)808805 return i915_ttm_err_to_gem(ret);
-33
drivers/gpu/drm/i915/i915_perf.c
···27492749}2750275027512751static int27522752-gen12_configure_all_contexts(struct i915_perf_stream *stream,27532753- const struct i915_oa_config *oa_config,27542754- struct i915_active *active)27552755-{27562756- struct flex regs[] = {27572757- {27582758- GEN8_R_PWR_CLK_STATE(RENDER_RING_BASE),27592759- CTX_R_PWR_CLK_STATE,27602760- },27612761- };27622762-27632763- if (stream->engine->class != RENDER_CLASS)27642764- return 0;27652765-27662766- return oa_configure_all_contexts(stream,27672767- regs, ARRAY_SIZE(regs),27682768- active);27692769-}27702770-27712771-static int27722752lrc_configure_all_contexts(struct i915_perf_stream *stream,27732753 const struct i915_oa_config *oa_config,27742754 struct i915_active *active)···28542874{28552875 struct drm_i915_private *i915 = stream->perf->i915;28562876 struct intel_uncore *uncore = stream->uncore;28572857- struct i915_oa_config *oa_config = stream->oa_config;28582877 bool periodic = stream->periodic;28592878 u32 period_exponent = stream->period_exponent;28602879 u32 sqcnt1;···28962917 (HAS_OA_BPC_REPORTING(i915) ? GEN12_SQCNT1_OABPC : 0);2897291828982919 intel_uncore_rmw(uncore, GEN12_SQCNT1, 0, sqcnt1);28992899-29002900- /*29012901- * Update all contexts prior writing the mux configurations as we need29022902- * to make sure all slices/subslices are ON before writing to NOA29032903- * registers.29042904- */29052905- ret = gen12_configure_all_contexts(stream, oa_config, active);29062906- if (ret)29072907- return ret;2908292029092921 /*29102922 * For Gen12, performance counters are context···29492979 intel_uncore_write(uncore, GEN7_ROW_CHICKEN2,29502980 _MASKED_BIT_DISABLE(GEN12_DISABLE_DOP_GATING));29512981 }29522952-29532953- /* Reset all contexts' slices/subslices configurations. */29542954- gen12_configure_all_contexts(stream, NULL, NULL);2955298229562983 /* disable the context save/restore or OAR counters */29572984 if (stream->ctx)
+1-1
drivers/gpu/drm/nouveau/nouveau_bo.c
···898898 * Without this the operation can timeout and we'll fallback to a899899 * software copy, which might take several minutes to finish.900900 */901901- nouveau_fence_wait(fence, false);901901+ nouveau_fence_wait(fence, false, false);902902 ret = ttm_bo_move_accel_cleanup(bo, &fence->base, evict, false,903903 new_reg);904904 nouveau_fence_unref(&fence);
+1-1
drivers/gpu/drm/nouveau/nouveau_chan.c
···72727373 ret = nouveau_fence_new(&fence, chan);7474 if (!ret) {7575- ret = nouveau_fence_wait(fence, false);7575+ ret = nouveau_fence_wait(fence, false, false);7676 nouveau_fence_unref(&fence);7777 }7878
···928928 }929929930930 if (sync) {931931- if (!(ret = nouveau_fence_wait(fence, false))) {931931+ if (!(ret = nouveau_fence_wait(fence, false, false))) {932932 if ((ret = dma_fence_get_status(&fence->base)) == 1)933933 ret = 0;934934 }
+2-1
drivers/gpu/drm/nouveau/nouveau_prime.c
···6464 * to the caller, instead of a normal nouveau_bo ttm reference. */6565 ret = drm_gem_object_init(dev, &nvbo->bo.base, size);6666 if (ret) {6767- nouveau_bo_ref(NULL, &nvbo);6767+ drm_gem_object_release(&nvbo->bo.base);6868+ kfree(nvbo);6869 obj = ERR_PTR(-ENOMEM);6970 goto unlock;7071 }
···102102103103 sg_init_one(sgt->sgl, buf, TEST_SIZE);104104105105+ /*106106+ * Set the DMA mask to 64-bits and map the sgtables107107+ * otherwise drm_gem_shmem_free will cause a warning108108+ * on debug kernels.109109+ */110110+ ret = dma_set_mask(drm_dev->dev, DMA_BIT_MASK(64));111111+ KUNIT_ASSERT_EQ(test, ret, 0);112112+113113+ ret = dma_map_sgtable(drm_dev->dev, sgt, DMA_BIDIRECTIONAL, 0);114114+ KUNIT_ASSERT_EQ(test, ret, 0);115115+105116 /* Init a mock DMA-BUF */106117 buf_mock.size = TEST_SIZE;107118 attach_mock.dmabuf = &buf_mock;
···7373 v3d_job_cleanup(job);7474}75757676+void7777+v3d_timestamp_query_info_free(struct v3d_timestamp_query_info *query_info,7878+ unsigned int count)7979+{8080+ if (query_info->queries) {8181+ unsigned int i;8282+8383+ for (i = 0; i < count; i++)8484+ drm_syncobj_put(query_info->queries[i].syncobj);8585+8686+ kvfree(query_info->queries);8787+ }8888+}8989+9090+void9191+v3d_performance_query_info_free(struct v3d_performance_query_info *query_info,9292+ unsigned int count)9393+{9494+ if (query_info->queries) {9595+ unsigned int i;9696+9797+ for (i = 0; i < count; i++)9898+ drm_syncobj_put(query_info->queries[i].syncobj);9999+100100+ kvfree(query_info->queries);101101+ }102102+}103103+76104static void77105v3d_cpu_job_free(struct drm_sched_job *sched_job)78106{79107 struct v3d_cpu_job *job = to_cpu_job(sched_job);8080- struct v3d_timestamp_query_info *timestamp_query = &job->timestamp_query;8181- struct v3d_performance_query_info *performance_query = &job->performance_query;821088383- if (timestamp_query->queries) {8484- for (int i = 0; i < timestamp_query->count; i++)8585- drm_syncobj_put(timestamp_query->queries[i].syncobj);8686- kvfree(timestamp_query->queries);8787- }109109+ v3d_timestamp_query_info_free(&job->timestamp_query,110110+ job->timestamp_query.count);881118989- if (performance_query->queries) {9090- for (int i = 0; i < performance_query->count; i++)9191- drm_syncobj_put(performance_query->queries[i].syncobj);9292- kvfree(performance_query->queries);9393- }112112+ v3d_performance_query_info_free(&job->performance_query,113113+ job->performance_query.count);9411495115 v3d_job_cleanup(&job->base);96116}
+88-33
drivers/gpu/drm/v3d/v3d_submit.c
···452452{453453 u32 __user *offsets, *syncs;454454 struct drm_v3d_timestamp_query timestamp;455455+ unsigned int i;456456+ int err;455457456458 if (!job) {457459 DRM_DEBUG("CPU job extension was attached to a GPU job.\n");···482480 offsets = u64_to_user_ptr(timestamp.offsets);483481 syncs = u64_to_user_ptr(timestamp.syncs);484482485485- for (int i = 0; i < timestamp.count; i++) {483483+ for (i = 0; i < timestamp.count; i++) {486484 u32 offset, sync;487485488486 if (copy_from_user(&offset, offsets++, sizeof(offset))) {489489- kvfree(job->timestamp_query.queries);490490- return -EFAULT;487487+ err = -EFAULT;488488+ goto error;491489 }492490493491 job->timestamp_query.queries[i].offset = offset;494492495493 if (copy_from_user(&sync, syncs++, sizeof(sync))) {496496- kvfree(job->timestamp_query.queries);497497- return -EFAULT;494494+ err = -EFAULT;495495+ goto error;498496 }499497500498 job->timestamp_query.queries[i].syncobj = drm_syncobj_find(file_priv, sync);499499+ if (!job->timestamp_query.queries[i].syncobj) {500500+ err = -ENOENT;501501+ goto error;502502+ }501503 }502504 job->timestamp_query.count = timestamp.count;503505504506 return 0;507507+508508+error:509509+ v3d_timestamp_query_info_free(&job->timestamp_query, i);510510+ return err;505511}506512507513static int···519509{520510 u32 __user *syncs;521511 struct drm_v3d_reset_timestamp_query reset;512512+ unsigned int i;513513+ int err;522514523515 if (!job) {524516 DRM_DEBUG("CPU job extension was attached to a GPU job.\n");···545533546534 syncs = u64_to_user_ptr(reset.syncs);547535548548- for (int i = 0; i < reset.count; i++) {536536+ for (i = 0; i < reset.count; i++) {549537 u32 sync;550538551539 job->timestamp_query.queries[i].offset = reset.offset + 8 * i;552540553541 if (copy_from_user(&sync, syncs++, sizeof(sync))) {554554- kvfree(job->timestamp_query.queries);555555- return -EFAULT;542542+ err = -EFAULT;543543+ goto error;556544 }557545558546 job->timestamp_query.queries[i].syncobj = drm_syncobj_find(file_priv, sync);547547+ if (!job->timestamp_query.queries[i].syncobj) {548548+ err = -ENOENT;549549+ goto error;550550+ }559551 }560552 job->timestamp_query.count = reset.count;561553562554 return 0;555555+556556+error:557557+ v3d_timestamp_query_info_free(&job->timestamp_query, i);558558+ return err;563559}564560565561/* Get data for the copy timestamp query results job submission. */···578558{579559 u32 __user *offsets, *syncs;580560 struct drm_v3d_copy_timestamp_query copy;581581- int i;561561+ unsigned int i;562562+ int err;582563583564 if (!job) {584565 DRM_DEBUG("CPU job extension was attached to a GPU job.\n");···612591 u32 offset, sync;613592614593 if (copy_from_user(&offset, offsets++, sizeof(offset))) {615615- kvfree(job->timestamp_query.queries);616616- return -EFAULT;594594+ err = -EFAULT;595595+ goto error;617596 }618597619598 job->timestamp_query.queries[i].offset = offset;620599621600 if (copy_from_user(&sync, syncs++, sizeof(sync))) {622622- kvfree(job->timestamp_query.queries);623623- return -EFAULT;601601+ err = -EFAULT;602602+ goto error;624603 }625604626605 job->timestamp_query.queries[i].syncobj = drm_syncobj_find(file_priv, sync);606606+ if (!job->timestamp_query.queries[i].syncobj) {607607+ err = -ENOENT;608608+ goto error;609609+ }627610 }628611 job->timestamp_query.count = copy.count;629612···638613 job->copy.stride = copy.stride;639614640615 return 0;616616+617617+error:618618+ v3d_timestamp_query_info_free(&job->timestamp_query, i);619619+ return err;641620}642621643622static int···652623 u32 __user *syncs;653624 u64 __user *kperfmon_ids;654625 struct drm_v3d_reset_performance_query reset;626626+ unsigned int i, j;627627+ int err;655628656629 if (!job) {657630 DRM_DEBUG("CPU job extension was attached to a GPU job.\n");···668637 if (copy_from_user(&reset, ext, sizeof(reset)))669638 return -EFAULT;670639640640+ if (reset.nperfmons > V3D_MAX_PERFMONS)641641+ return -EINVAL;642642+671643 job->job_type = V3D_CPU_JOB_TYPE_RESET_PERFORMANCE_QUERY;672644673645 job->performance_query.queries = kvmalloc_array(reset.count,···682648 syncs = u64_to_user_ptr(reset.syncs);683649 kperfmon_ids = u64_to_user_ptr(reset.kperfmon_ids);684650685685- for (int i = 0; i < reset.count; i++) {651651+ for (i = 0; i < reset.count; i++) {686652 u32 sync;687653 u64 ids;688654 u32 __user *ids_pointer;689655 u32 id;690656691657 if (copy_from_user(&sync, syncs++, sizeof(sync))) {692692- kvfree(job->performance_query.queries);693693- return -EFAULT;658658+ err = -EFAULT;659659+ goto error;694660 }695661696696- job->performance_query.queries[i].syncobj = drm_syncobj_find(file_priv, sync);697697-698662 if (copy_from_user(&ids, kperfmon_ids++, sizeof(ids))) {699699- kvfree(job->performance_query.queries);700700- return -EFAULT;663663+ err = -EFAULT;664664+ goto error;701665 }702666703667 ids_pointer = u64_to_user_ptr(ids);704668705705- for (int j = 0; j < reset.nperfmons; j++) {669669+ for (j = 0; j < reset.nperfmons; j++) {706670 if (copy_from_user(&id, ids_pointer++, sizeof(id))) {707707- kvfree(job->performance_query.queries);708708- return -EFAULT;671671+ err = -EFAULT;672672+ goto error;709673 }710674711675 job->performance_query.queries[i].kperfmon_ids[j] = id;676676+ }677677+678678+ job->performance_query.queries[i].syncobj = drm_syncobj_find(file_priv, sync);679679+ if (!job->performance_query.queries[i].syncobj) {680680+ err = -ENOENT;681681+ goto error;712682 }713683 }714684 job->performance_query.count = reset.count;715685 job->performance_query.nperfmons = reset.nperfmons;716686717687 return 0;688688+689689+error:690690+ v3d_performance_query_info_free(&job->performance_query, i);691691+ return err;718692}719693720694static int···733691 u32 __user *syncs;734692 u64 __user *kperfmon_ids;735693 struct drm_v3d_copy_performance_query copy;694694+ unsigned int i, j;695695+ int err;736696737697 if (!job) {738698 DRM_DEBUG("CPU job extension was attached to a GPU job.\n");···752708 if (copy.pad)753709 return -EINVAL;754710711711+ if (copy.nperfmons > V3D_MAX_PERFMONS)712712+ return -EINVAL;713713+755714 job->job_type = V3D_CPU_JOB_TYPE_COPY_PERFORMANCE_QUERY;756715757716 job->performance_query.queries = kvmalloc_array(copy.count,···766719 syncs = u64_to_user_ptr(copy.syncs);767720 kperfmon_ids = u64_to_user_ptr(copy.kperfmon_ids);768721769769- for (int i = 0; i < copy.count; i++) {722722+ for (i = 0; i < copy.count; i++) {770723 u32 sync;771724 u64 ids;772725 u32 __user *ids_pointer;773726 u32 id;774727775728 if (copy_from_user(&sync, syncs++, sizeof(sync))) {776776- kvfree(job->performance_query.queries);777777- return -EFAULT;729729+ err = -EFAULT;730730+ goto error;778731 }779732780780- job->performance_query.queries[i].syncobj = drm_syncobj_find(file_priv, sync);781781-782733 if (copy_from_user(&ids, kperfmon_ids++, sizeof(ids))) {783783- kvfree(job->performance_query.queries);784784- return -EFAULT;734734+ err = -EFAULT;735735+ goto error;785736 }786737787738 ids_pointer = u64_to_user_ptr(ids);788739789789- for (int j = 0; j < copy.nperfmons; j++) {740740+ for (j = 0; j < copy.nperfmons; j++) {790741 if (copy_from_user(&id, ids_pointer++, sizeof(id))) {791791- kvfree(job->performance_query.queries);792792- return -EFAULT;742742+ err = -EFAULT;743743+ goto error;793744 }794745795746 job->performance_query.queries[i].kperfmon_ids[j] = id;747747+ }748748+749749+ job->performance_query.queries[i].syncobj = drm_syncobj_find(file_priv, sync);750750+ if (!job->performance_query.queries[i].syncobj) {751751+ err = -ENOENT;752752+ goto error;796753 }797754 }798755 job->performance_query.count = copy.count;···810759 job->copy.stride = copy.stride;811760812761 return 0;762762+763763+error:764764+ v3d_performance_query_info_free(&job->performance_query, i);765765+ return err;813766}814767815768/* Whenever userspace sets ioctl extensions, v3d_get_extensions parses data
···11+/* SPDX-License-Identifier: GPL-2.0 OR MIT */12/**********************************************************22- * Copyright 2021 VMware, Inc.33- * SPDX-License-Identifier: GPL-2.0 OR MIT33+ *44+ * Copyright (c) 2021-2024 Broadcom. All Rights Reserved. The term55+ * “Broadcom” refers to Broadcom Inc. and/or its subsidiaries.46 *57 * Permission is hereby granted, free of charge, to any person68 * obtaining a copy of this software and associated documentation···3230#include "device_include/svga3d_surfacedefs.h"33313432#include <drm/vmwgfx_drm.h>3333+3434+#define SVGA3D_FLAGS_UPPER_32(svga3d_flags) ((svga3d_flags) >> 32)3535+#define SVGA3D_FLAGS_LOWER_32(svga3d_flags) \3636+ ((svga3d_flags) & ((uint64_t)U32_MAX))35373638static inline u32 clamped_umul32(u32 a, u32 b)3739{
···203203 reg_val = xe_mmio_rmw32(hwmon->gt, rapl_limit, PKG_PWR_LIM_1_EN, 0);204204 reg_val = xe_mmio_read32(hwmon->gt, rapl_limit);205205 if (reg_val & PKG_PWR_LIM_1_EN) {206206+ drm_warn(>_to_xe(hwmon->gt)->drm, "PL1 disable is not supported!\n");206207 ret = -EOPNOTSUPP;207207- goto unlock;208208 }209209+ goto unlock;209210 }210211211212 /* Computation in 64-bits to avoid overflow. Round to nearest. */
+14-1
drivers/gpu/drm/xe/xe_lrc.c
···16341634 if (!snapshot)16351635 return NULL;1636163616371637+ if (lrc->bo && lrc->bo->vm)16381638+ xe_vm_get(lrc->bo->vm);16391639+16371640 snapshot->context_desc = xe_lrc_ggtt_addr(lrc);16381641 snapshot->indirect_context_desc = xe_lrc_indirect_ring_ggtt_addr(lrc);16391642 snapshot->head = xe_lrc_ring_head(lrc);···16561653void xe_lrc_snapshot_capture_delayed(struct xe_lrc_snapshot *snapshot)16571654{16581655 struct xe_bo *bo;16561656+ struct xe_vm *vm;16591657 struct iosys_map src;1660165816611659 if (!snapshot)16621660 return;1663166116641662 bo = snapshot->lrc_bo;16631663+ vm = bo->vm;16651664 snapshot->lrc_bo = NULL;1666166516671666 snapshot->lrc_snapshot = kvmalloc(snapshot->lrc_size, GFP_KERNEL);···16831678 xe_bo_unlock(bo);16841679put_bo:16851680 xe_bo_put(bo);16811681+ if (vm)16821682+ xe_vm_put(vm);16861683}1687168416881685void xe_lrc_snapshot_print(struct xe_lrc_snapshot *snapshot, struct drm_printer *p)···17341727 return;1735172817361729 kvfree(snapshot->lrc_snapshot);17371737- if (snapshot->lrc_bo)17301730+ if (snapshot->lrc_bo) {17311731+ struct xe_vm *vm;17321732+17331733+ vm = snapshot->lrc_bo->vm;17381734 xe_bo_put(snapshot->lrc_bo);17351735+ if (vm)17361736+ xe_vm_put(vm);17371737+ }17391738 kfree(snapshot);17401739}17411740
+1-1
drivers/gpu/drm/xe/xe_rtp.c
···231231 if (first == last)232232 bitmap_set(ctx->active_entries, first, 1);233233 else234234- bitmap_set(ctx->active_entries, first, last - first + 2);234234+ bitmap_set(ctx->active_entries, first, last - first + 1);235235}236236237237/**
+1-1
drivers/gpu/drm/xe/xe_sync.c
···263263 if (sync->fence)264264 dma_fence_put(sync->fence);265265 if (sync->chain_fence)266266- dma_fence_put(&sync->chain_fence->base);266266+ dma_fence_chain_free(sync->chain_fence);267267 if (sync->ufence)268268 user_fence_put(sync->ufence);269269}
+1-1
drivers/gpu/drm/xe/xe_ttm_vram_mgr.c
···150150 } while (remaining_size);151151152152 if (place->flags & TTM_PL_FLAG_CONTIGUOUS) {153153- if (!drm_buddy_block_trim(mm, vres->base.size, &vres->blocks))153153+ if (!drm_buddy_block_trim(mm, NULL, vres->base.size, &vres->blocks))154154 size = vres->base.size;155155 }156156
+11-7
drivers/hid/amd-sfh-hid/amd_sfh_client.c
···288288 mp2_ops->start(privdata, info);289289 cl_data->sensor_sts[i] = amd_sfh_wait_for_response290290 (privdata, cl_data->sensor_idx[i], SENSOR_ENABLED);291291+292292+ if (cl_data->sensor_sts[i] == SENSOR_ENABLED)293293+ cl_data->is_any_sensor_enabled = true;294294+ }295295+296296+ if (!cl_data->is_any_sensor_enabled ||297297+ (mp2_ops->discovery_status && mp2_ops->discovery_status(privdata) == 0)) {298298+ dev_warn(dev, "Failed to discover, sensors not enabled is %d\n",299299+ cl_data->is_any_sensor_enabled);300300+ rc = -EOPNOTSUPP;301301+ goto cleanup;291302 }292303293304 for (i = 0; i < cl_data->num_hid_devices; i++) {294305 cl_data->cur_hid_dev = i;295306 if (cl_data->sensor_sts[i] == SENSOR_ENABLED) {296296- cl_data->is_any_sensor_enabled = true;297307 rc = amdtp_hid_probe(i, cl_data);298308 if (rc)299309 goto cleanup;···315305 cl_data->sensor_sts[i]);316306 }317307318318- if (!cl_data->is_any_sensor_enabled ||319319- (mp2_ops->discovery_status && mp2_ops->discovery_status(privdata) == 0)) {320320- dev_warn(dev, "Failed to discover, sensors not enabled is %d\n", cl_data->is_any_sensor_enabled);321321- rc = -EOPNOTSUPP;322322- goto cleanup;323323- }324308 schedule_delayed_work(&cl_data->work_buffer, msecs_to_jiffies(AMD_SFH_IDLE_LOOP));325309 return 0;326310
+1-1
drivers/hid/bpf/Kconfig
···3344config HID_BPF55 bool "HID-BPF support"66- depends on BPF66+ depends on BPF_JIT77 depends on BPF_SYSCALL88 depends on DYNAMIC_FTRACE_WITH_DIRECT_CALLS99 help
+5
drivers/hid/bpf/hid_bpf_struct_ops.c
···183183 struct hid_device *hdev;184184 int count, err = 0;185185186186+ /* prevent multiple attach of the same struct_ops */187187+ if (ops->hdev)188188+ return -EINVAL;189189+186190 hdev = hid_get_device(ops->hid_id);187191 if (IS_ERR(hdev))188192 return PTR_ERR(hdev);···252248253249 list_del_rcu(&ops->list);254250 synchronize_srcu(&hdev->bpf.srcu);251251+ ops->hdev = NULL;255252256253 reconnect = hdev->bpf.rdesc_ops == ops;257254 if (reconnect)
+10-57
drivers/hid/wacom_wac.c
···692692693693static int wacom_intuos_get_tool_type(int tool_id)694694{695695- int tool_type = BTN_TOOL_PEN;696696-697697- if (wacom_is_art_pen(tool_id))698698- return tool_type;699699-700695 switch (tool_id) {701696 case 0x812: /* Inking pen */702697 case 0x801: /* Intuos3 Inking pen */703698 case 0x12802: /* Intuos4/5 Inking Pen */704699 case 0x012:705705- tool_type = BTN_TOOL_PENCIL;706706- break;707707-708708- case 0x822: /* Pen */709709- case 0x842:710710- case 0x852:711711- case 0x823: /* Intuos3 Grip Pen */712712- case 0x813: /* Intuos3 Classic Pen */713713- case 0x802: /* Intuos4/5 13HD/24HD General Pen */714714- case 0x8e2: /* IntuosHT2 pen */715715- case 0x022:716716- case 0x200: /* Pro Pen 3 */717717- case 0x04200: /* Pro Pen 3 */718718- case 0x10842: /* MobileStudio Pro Pro Pen slim */719719- case 0x14802: /* Intuos4/5 13HD/24HD Classic Pen */720720- case 0x16802: /* Cintiq 13HD Pro Pen */721721- case 0x18802: /* DTH2242 Pen */722722- case 0x10802: /* Intuos4/5 13HD/24HD General Pen */723723- case 0x80842: /* Intuos Pro and Cintiq Pro 3D Pen */724724- tool_type = BTN_TOOL_PEN;725725- break;700700+ return BTN_TOOL_PENCIL;726701727702 case 0x832: /* Stroke pen */728703 case 0x032:729729- tool_type = BTN_TOOL_BRUSH;730730- break;704704+ return BTN_TOOL_BRUSH;731705732706 case 0x007: /* Mouse 4D and 2D */733707 case 0x09c:734708 case 0x094:735709 case 0x017: /* Intuos3 2D Mouse */736710 case 0x806: /* Intuos4 Mouse */737737- tool_type = BTN_TOOL_MOUSE;738738- break;711711+ return BTN_TOOL_MOUSE;739712740713 case 0x096: /* Lens cursor */741714 case 0x097: /* Intuos3 Lens cursor */742715 case 0x006: /* Intuos4 Lens cursor */743743- tool_type = BTN_TOOL_LENS;744744- break;745745-746746- case 0x82a: /* Eraser */747747- case 0x84a:748748- case 0x85a:749749- case 0x91a:750750- case 0xd1a:751751- case 0x0fa:752752- case 0x82b: /* Intuos3 Grip Pen Eraser */753753- case 0x81b: /* Intuos3 Classic Pen Eraser */754754- case 0x91b: /* Intuos3 Airbrush Eraser */755755- case 0x80c: /* Intuos4/5 13HD/24HD Marker Pen Eraser */756756- case 0x80a: /* Intuos4/5 13HD/24HD General Pen Eraser */757757- case 0x90a: /* Intuos4/5 13HD/24HD Airbrush Eraser */758758- case 0x1480a: /* Intuos4/5 13HD/24HD Classic Pen Eraser */759759- case 0x1090a: /* Intuos4/5 13HD/24HD Airbrush Eraser */760760- case 0x1080c: /* Intuos4/5 13HD/24HD Art Pen Eraser */761761- case 0x1084a: /* MobileStudio Pro Pro Pen slim Eraser */762762- case 0x1680a: /* Cintiq 13HD Pro Pen Eraser */763763- case 0x1880a: /* DTH2242 Eraser */764764- case 0x1080a: /* Intuos4/5 13HD/24HD General Pen Eraser */765765- tool_type = BTN_TOOL_RUBBER;766766- break;716716+ return BTN_TOOL_LENS;767717768718 case 0xd12:769719 case 0x912:···721771 case 0x913: /* Intuos3 Airbrush */722772 case 0x902: /* Intuos4/5 13HD/24HD Airbrush */723773 case 0x10902: /* Intuos4/5 13HD/24HD Airbrush */724724- tool_type = BTN_TOOL_AIRBRUSH;725725- break;774774+ return BTN_TOOL_AIRBRUSH;775775+776776+ default:777777+ if (tool_id & 0x0008)778778+ return BTN_TOOL_RUBBER;779779+ return BTN_TOOL_PEN;726780 }727727- return tool_type;728781}729782730783static void wacom_exit_report(struct wacom_wac *wacom)
+12-12
drivers/hwmon/adt7475.c
···2222#include <linux/util_macros.h>23232424/* Indexes for the sysfs hooks */2525-2626-#define INPUT 02727-#define MIN 12828-#define MAX 22929-#define CONTROL 33030-#define OFFSET 33131-#define AUTOMIN 43232-#define THERM 53333-#define HYSTERSIS 63434-2525+enum adt_sysfs_id {2626+ INPUT = 0,2727+ MIN = 1,2828+ MAX = 2,2929+ CONTROL = 3,3030+ OFFSET = 3, // Dup3131+ AUTOMIN = 4,3232+ THERM = 5,3333+ HYSTERSIS = 6,3534/*3635 * These are unique identifiers for the sysfs functions - unlike the3736 * numbers above, these are not also indexes into an array3837 */3838+ ALARM = 9,3939+ FAULT = 10,4040+};39414040-#define ALARM 94141-#define FAULT 1042424343/* 7475 Common Registers */4444
+4-1
drivers/i2c/busses/i2c-qcom-geni.c
···990990 return ret;991991992992 ret = geni_se_resources_on(&gi2c->se);993993- if (ret)993993+ if (ret) {994994+ clk_disable_unprepare(gi2c->core_clk);995995+ geni_icc_disable(&gi2c->se);994996 return ret;997997+ }995998996999 enable_irq(gi2c->irq);9971000 gi2c->suspended = 0;
+2-2
drivers/i2c/i2c-slave-testunit.c
···18181919enum testunit_cmds {2020 TU_CMD_READ_BYTES = 1, /* save 0 for ABORT, RESET or similar */2121- TU_CMD_HOST_NOTIFY,2121+ TU_CMD_SMBUS_HOST_NOTIFY,2222 TU_CMD_SMBUS_BLOCK_PROC_CALL,2323 TU_NUM_CMDS2424};···6060 msg.len = tu->regs[TU_REG_DATAH];6161 break;62626363- case TU_CMD_HOST_NOTIFY:6363+ case TU_CMD_SMBUS_HOST_NOTIFY:6464 msg.addr = 0x08;6565 msg.flags = 0;6666 msg.len = 3;
+57-7
drivers/i2c/i2c-smbus.c
···3434 struct i2c_client *client = i2c_verify_client(dev);3535 struct alert_data *data = addrp;3636 struct i2c_driver *driver;3737+ int ret;37383839 if (!client || client->addr != data->addr)3940 return 0;···4847 device_lock(dev);4948 if (client->dev.driver) {5049 driver = to_i2c_driver(client->dev.driver);5151- if (driver->alert)5050+ if (driver->alert) {5151+ /* Stop iterating after we find the device */5252 driver->alert(client, data->type, data->data);5353- else5353+ ret = -EBUSY;5454+ } else {5455 dev_warn(&client->dev, "no driver alert()!\n");5555- } else5656+ ret = -EOPNOTSUPP;5757+ }5858+ } else {5659 dev_dbg(&client->dev, "alert with no driver\n");6060+ ret = -ENODEV;6161+ }5762 device_unlock(dev);58635959- /* Stop iterating after we find the device */6060- return -EBUSY;6464+ return ret;6565+}6666+6767+/* Same as above, but call back all drivers with alert handler */6868+6969+static int smbus_do_alert_force(struct device *dev, void *addrp)7070+{7171+ struct i2c_client *client = i2c_verify_client(dev);7272+ struct alert_data *data = addrp;7373+ struct i2c_driver *driver;7474+7575+ if (!client || (client->flags & I2C_CLIENT_TEN))7676+ return 0;7777+7878+ /*7979+ * Drivers should either disable alerts, or provide at least8080+ * a minimal handler. Lock so the driver won't change.8181+ */8282+ device_lock(dev);8383+ if (client->dev.driver) {8484+ driver = to_i2c_driver(client->dev.driver);8585+ if (driver->alert)8686+ driver->alert(client, data->type, data->data);8787+ }8888+ device_unlock(dev);8989+9090+ return 0;6191}62926393/*···9967{10068 struct i2c_smbus_alert *alert = d;10169 struct i2c_client *ara;7070+ unsigned short prev_addr = I2C_CLIENT_END; /* Not a valid address */1027110372 ara = alert->ara;10473···12794 data.addr, data.data);1289512996 /* Notify driver for the device which issued the alert */130130- device_for_each_child(&ara->adapter->dev, &data,131131- smbus_do_alert);9797+ status = device_for_each_child(&ara->adapter->dev, &data,9898+ smbus_do_alert);9999+ /*100100+ * If we read the same address more than once, and the alert101101+ * was not handled by a driver, it won't do any good to repeat102102+ * the loop because it will never terminate. Try again, this103103+ * time calling the alert handlers of all devices connected to104104+ * the bus, and abort the loop afterwards. If this helps, we105105+ * are all set. If it doesn't, there is nothing else we can do,106106+ * so we might as well abort the loop.107107+ * Note: This assumes that a driver with alert handler handles108108+ * the alert properly and clears it if necessary.109109+ */110110+ if (data.addr == prev_addr && status != -EBUSY) {111111+ device_for_each_child(&ara->adapter->dev, &data,112112+ smbus_do_alert_force);113113+ break;114114+ }115115+ prev_addr = data.addr;132116 }133117134118 return IRQ_HANDLED;
+3
drivers/input/input-mt.c
···4646 return 0;4747 if (mt)4848 return mt->num_slots != num_slots ? -EINVAL : 0;4949+ /* Arbitrary limit for avoiding too large memory allocation. */5050+ if (num_slots > 1024)5151+ return -EINVAL;49525053 mt = kzalloc(struct_size(mt, slots, num_slots), GFP_KERNEL);5154 if (!mt)
+1-1
drivers/input/touchscreen/cyttsp4_core.c
···871871 struct cyttsp4_touch tch;872872 int sig;873873 int i, j, t = 0;874874- int ids[max(CY_TMA1036_MAX_TCH, CY_TMA4XX_MAX_TCH)];874874+ int ids[MAX(CY_TMA1036_MAX_TCH, CY_TMA4XX_MAX_TCH)];875875876876 memset(ids, 0, si->si_ofs.tch_abs[CY_TCH_T].max * sizeof(int));877877 for (i = 0; i < num_cur_tch; i++) {
···6464 void __iomem *base;6565};66666767+static inline unsigned int get_mbigen_node_offset(unsigned int nid)6868+{6969+ unsigned int offset = nid * MBIGEN_NODE_OFFSET;7070+7171+ /*7272+ * To avoid touched clear register in unexpected way, we need to directly7373+ * skip clear register when access to more than 10 mbigen nodes.7474+ */7575+ if (nid >= (REG_MBIGEN_CLEAR_OFFSET / MBIGEN_NODE_OFFSET))7676+ offset += MBIGEN_NODE_OFFSET;7777+7878+ return offset;7979+}8080+6781static inline unsigned int get_mbigen_vec_reg(irq_hw_number_t hwirq)6882{6983 unsigned int nid, pin;···8672 nid = hwirq / IRQS_PER_MBIGEN_NODE + 1;8773 pin = hwirq % IRQS_PER_MBIGEN_NODE;88748989- return pin * 4 + nid * MBIGEN_NODE_OFFSET9090- + REG_MBIGEN_VEC_OFFSET;7575+ return pin * 4 + get_mbigen_node_offset(nid) + REG_MBIGEN_VEC_OFFSET;9176}92779378static inline void get_mbigen_type_reg(irq_hw_number_t hwirq,···10188 *mask = 1 << (irq_ofst % 32);10289 ofst = irq_ofst / 32 * 4;10390104104- *addr = ofst + nid * MBIGEN_NODE_OFFSET105105- + REG_MBIGEN_TYPE_OFFSET;9191+ *addr = ofst + get_mbigen_node_offset(nid) + REG_MBIGEN_TYPE_OFFSET;10692}1079310894static inline void get_mbigen_clear_reg(irq_hw_number_t hwirq,
+7-7
drivers/irqchip/irq-meson-gpio.c
···178178 void __iomem *base;179179 u32 channel_irqs[MAX_NUM_CHANNEL];180180 DECLARE_BITMAP(channel_map, MAX_NUM_CHANNEL);181181- spinlock_t lock;181181+ raw_spinlock_t lock;182182};183183184184static void meson_gpio_irq_update_bits(struct meson_gpio_irq_controller *ctl,···187187 unsigned long flags;188188 u32 tmp;189189190190- spin_lock_irqsave(&ctl->lock, flags);190190+ raw_spin_lock_irqsave(&ctl->lock, flags);191191192192 tmp = readl_relaxed(ctl->base + reg);193193 tmp &= ~mask;194194 tmp |= val;195195 writel_relaxed(tmp, ctl->base + reg);196196197197- spin_unlock_irqrestore(&ctl->lock, flags);197197+ raw_spin_unlock_irqrestore(&ctl->lock, flags);198198}199199200200static void meson_gpio_irq_init_dummy(struct meson_gpio_irq_controller *ctl)···244244 unsigned long flags;245245 unsigned int idx;246246247247- spin_lock_irqsave(&ctl->lock, flags);247247+ raw_spin_lock_irqsave(&ctl->lock, flags);248248249249 /* Find a free channel */250250 idx = find_first_zero_bit(ctl->channel_map, ctl->params->nr_channels);251251 if (idx >= ctl->params->nr_channels) {252252- spin_unlock_irqrestore(&ctl->lock, flags);252252+ raw_spin_unlock_irqrestore(&ctl->lock, flags);253253 pr_err("No channel available\n");254254 return -ENOSPC;255255 }···257257 /* Mark the channel as used */258258 set_bit(idx, ctl->channel_map);259259260260- spin_unlock_irqrestore(&ctl->lock, flags);260260+ raw_spin_unlock_irqrestore(&ctl->lock, flags);261261262262 /*263263 * Setup the mux of the channel to route the signal of the pad···567567 if (!ctl)568568 return -ENOMEM;569569570570- spin_lock_init(&ctl->lock);570570+ raw_spin_lock_init(&ctl->lock);571571572572 ctl->base = of_iomap(node, 0);573573 if (!ctl->base) {
+3-3
drivers/irqchip/irq-pic32-evic.c
···161161 return ret;162162}163163164164-int pic32_irq_domain_xlate(struct irq_domain *d, struct device_node *ctrlr,165165- const u32 *intspec, unsigned int intsize,166166- irq_hw_number_t *out_hwirq, unsigned int *out_type)164164+static int pic32_irq_domain_xlate(struct irq_domain *d, struct device_node *ctrlr,165165+ const u32 *intspec, unsigned int intsize,166166+ irq_hw_number_t *out_hwirq, unsigned int *out_type)167167{168168 struct evic_chip_data *priv = d->host_data;169169
+25-7
drivers/irqchip/irq-riscv-aplic-msi.c
···3232 aplic_irq_unmask(d);3333}34343535-static void aplic_msi_irq_eoi(struct irq_data *d)3535+static void aplic_msi_irq_retrigger_level(struct irq_data *d)3636{3737 struct aplic_priv *priv = irq_data_get_irq_chip_data(d);3838-3939- /*4040- * EOI handling is required only for level-triggered interrupts4141- * when APLIC is in MSI mode.4242- */43384439 switch (irqd_get_trigger_type(d)) {4540 case IRQ_TYPE_LEVEL_LOW:···5257 writel(d->hwirq, priv->regs + APLIC_SETIPNUM_LE);5358 break;5459 }6060+}6161+6262+static void aplic_msi_irq_eoi(struct irq_data *d)6363+{6464+ /*6565+ * EOI handling is required only for level-triggered interrupts6666+ * when APLIC is in MSI mode.6767+ */6868+ aplic_msi_irq_retrigger_level(d);6969+}7070+7171+static int aplic_msi_irq_set_type(struct irq_data *d, unsigned int type)7272+{7373+ int rc = aplic_irq_set_type(d, type);7474+7575+ if (rc)7676+ return rc;7777+ /*7878+ * Updating sourcecfg register for level-triggered interrupts7979+ * requires interrupt retriggering when APLIC is in MSI mode.8080+ */8181+ aplic_msi_irq_retrigger_level(d);8282+ return 0;5583}56845785static void aplic_msi_write_msg(struct irq_data *d, struct msi_msg *msg)···148130 .name = "APLIC-MSI",149131 .irq_mask = aplic_msi_irq_mask,150132 .irq_unmask = aplic_msi_irq_unmask,151151- .irq_set_type = aplic_irq_set_type,133133+ .irq_set_type = aplic_msi_irq_set_type,152134 .irq_eoi = aplic_msi_irq_eoi,153135#ifdef CONFIG_SMP154136 .irq_set_affinity = irq_chip_set_affinity_parent,
+1-1
drivers/irqchip/irq-sun6i-r.c
···270270271271static int sun6i_r_intc_suspend(void)272272{273273- u32 buf[BITS_TO_U32(max(SUN6I_NR_TOP_LEVEL_IRQS, SUN6I_NR_MUX_BITS))];273273+ u32 buf[BITS_TO_U32(MAX(SUN6I_NR_TOP_LEVEL_IRQS, SUN6I_NR_MUX_BITS))];274274 int i;275275276276 /* Wake IRQs are enabled during system sleep and shutdown. */
+1-1
drivers/irqchip/irq-xilinx-intc.c
···189189 irqc->intr_mask = 0;190190 }191191192192- if (irqc->intr_mask >> irqc->nr_irq)192192+ if ((u64)irqc->intr_mask >> irqc->nr_irq)193193 pr_warn("irq-xilinx: mismatch in kind-of-intr param\n");194194195195 pr_info("irq-xilinx: %pOF: num_irq=%d, edge=0x%x\n",
···33 depends on ACPI || COMPILE_TEST44 depends on VIDEO_DEV55 depends on X86 && X86_64 && HAS_DMA66+ depends on IPU_BRIDGE || !IPU_BRIDGE77+ select AUXILIARY_BUS68 select DMA_OPS79 select IOMMU_IOVA810 select VIDEO_V4L2_SUBDEV_API911 select MEDIA_CONTROLLER1012 select VIDEOBUF2_DMA_CONTIG1113 select V4L2_FWNODE1212- select IPU_BRIDGE1314 help1415 This is the 6th Gen Intel Image Processing Unit, found in Intel SoCs1516 and used for capturing images and video from camera sensors.
+5-3
drivers/media/usb/uvc/uvc_ctrl.c
···26802680 for (i = 0; i < ARRAY_SIZE(uvc_ctrl_mappings); ++i) {26812681 const struct uvc_control_mapping *mapping = &uvc_ctrl_mappings[i];2682268226832683+ if (!uvc_entity_match_guid(ctrl->entity, mapping->entity) ||26842684+ ctrl->info.selector != mapping->selector)26852685+ continue;26862686+26832687 /* Let the device provide a custom mapping. */26842688 if (mapping->filter_mapping) {26852689 mapping = mapping->filter_mapping(chain, ctrl);···26912687 continue;26922688 }2693268926942694- if (uvc_entity_match_guid(ctrl->entity, mapping->entity) &&26952695- ctrl->info.selector == mapping->selector)26962696- __uvc_ctrl_add_mapping(chain, ctrl, mapping);26902690+ __uvc_ctrl_add_mapping(chain, ctrl, mapping);26972691 }26982692}26992693
+1-1
drivers/misc/Kconfig
···587587588588config MARVELL_CN10K_DPI589589 tristate "Octeon CN10K DPI driver"590590- depends on PCI590590+ depends on PCI && PCI_IOV591591 depends on ARCH_THUNDER || (COMPILE_TEST && 64BIT)592592 help593593 Enables Octeon CN10K DMA packet interface (DPI) driver which
+51-34
drivers/misc/eeprom/ee1004.c
···233233 mutex_unlock(&ee1004_bus_lock);234234}235235236236+static int ee1004_init_bus_data(struct i2c_client *client)237237+{238238+ struct ee1004_bus_data *bd;239239+ int err, cnr = 0;240240+241241+ bd = ee1004_get_bus_data(client->adapter);242242+ if (!bd)243243+ return dev_err_probe(&client->dev, -ENOSPC, "Only %d busses supported",244244+ EE1004_MAX_BUSSES);245245+246246+ i2c_set_clientdata(client, bd);247247+248248+ if (++bd->dev_count == 1) {249249+ /* Use 2 dummy devices for page select command */250250+ for (cnr = 0; cnr < EE1004_NUM_PAGES; cnr++) {251251+ struct i2c_client *cl;252252+253253+ cl = i2c_new_dummy_device(client->adapter, EE1004_ADDR_SET_PAGE + cnr);254254+ if (IS_ERR(cl)) {255255+ err = PTR_ERR(cl);256256+ goto err_out;257257+ }258258+259259+ bd->set_page[cnr] = cl;260260+ }261261+262262+ /* Remember current page to avoid unneeded page select */263263+ err = ee1004_get_current_page(bd);264264+ if (err < 0)265265+ goto err_out;266266+267267+ dev_dbg(&client->dev, "Currently selected page: %d\n", err);268268+ bd->current_page = err;269269+ }270270+271271+ return 0;272272+273273+err_out:274274+ ee1004_cleanup(cnr, bd);275275+276276+ return err;277277+}278278+236279static int ee1004_probe(struct i2c_client *client)237280{238281 struct nvmem_config config = {···294251 .compat = true,295252 .base_dev = &client->dev,296253 };297297- struct ee1004_bus_data *bd;298254 struct nvmem_device *ndev;299299- int err, cnr = 0;255255+ int err;300256301257 /* Make sure we can operate on this adapter */302258 if (!i2c_check_functionality(client->adapter,···306264307265 mutex_lock(&ee1004_bus_lock);308266309309- bd = ee1004_get_bus_data(client->adapter);310310- if (!bd) {267267+ err = ee1004_init_bus_data(client);268268+ if (err < 0) {311269 mutex_unlock(&ee1004_bus_lock);312312- return dev_err_probe(&client->dev, -ENOSPC,313313- "Only %d busses supported", EE1004_MAX_BUSSES);314314- }315315-316316- err = devm_add_action_or_reset(&client->dev, ee1004_cleanup_bus_data, bd);317317- if (err < 0)318270 return err;319319-320320- i2c_set_clientdata(client, bd);321321-322322- if (++bd->dev_count == 1) {323323- /* Use 2 dummy devices for page select command */324324- for (cnr = 0; cnr < EE1004_NUM_PAGES; cnr++) {325325- struct i2c_client *cl;326326-327327- cl = i2c_new_dummy_device(client->adapter, EE1004_ADDR_SET_PAGE + cnr);328328- if (IS_ERR(cl)) {329329- mutex_unlock(&ee1004_bus_lock);330330- return PTR_ERR(cl);331331- }332332- bd->set_page[cnr] = cl;333333- }334334-335335- /* Remember current page to avoid unneeded page select */336336- err = ee1004_get_current_page(bd);337337- if (err < 0) {338338- mutex_unlock(&ee1004_bus_lock);339339- return err;340340- }341341- dev_dbg(&client->dev, "Currently selected page: %d\n", err);342342- bd->current_page = err;343271 }344272345273 ee1004_probe_temp_sensor(client);346274347275 mutex_unlock(&ee1004_bus_lock);276276+277277+ err = devm_add_action_or_reset(&client->dev, ee1004_cleanup_bus_data,278278+ i2c_get_clientdata(client));279279+ if (err < 0)280280+ return err;348281349282 ndev = devm_nvmem_register(&client->dev, &config);350283 if (IS_ERR(ndev))
+1-1
drivers/net/can/usb/etas_es58x/es58x_devlink.c
···215215 struct es58x_sw_version *fw_ver = &es58x_dev->firmware_version;216216 struct es58x_sw_version *bl_ver = &es58x_dev->bootloader_version;217217 struct es58x_hw_revision *hw_rev = &es58x_dev->hardware_revision;218218- char buf[max(sizeof("xx.xx.xx"), sizeof("axxx/xxx"))];218218+ char buf[MAX(sizeof("xx.xx.xx"), sizeof("axxx/xxx"))];219219 int ret = 0;220220221221 if (es58x_sw_version_is_valid(fw_ver)) {
+3-1
drivers/net/dsa/bcm_sf2.c
···675675 of_remove_property(child, prop);676676677677 phydev = of_phy_find_device(child);678678- if (phydev)678678+ if (phydev) {679679 phy_device_remove(phydev);680680+ phy_device_free(phydev);681681+ }680682 }681683682684 err = mdiobus_register(priv->user_mii_bus);
+16
drivers/net/dsa/microchip/ksz_common.c
···25782578 if (!port)25792579 return MICREL_KSZ8_P1_ERRATA;25802580 break;25812581+ case KSZ8567_CHIP_ID:25812582 case KSZ9477_CHIP_ID:25832583+ case KSZ9567_CHIP_ID:25842584+ case KSZ9896_CHIP_ID:25852585+ case KSZ9897_CHIP_ID:25822586 /* KSZ9477 Errata DS80000754C25832587 *25842588 * Module 4: Energy Efficient Ethernet (EEE) feature select must···25922588 * controls. If not disabled, the PHY ports can auto-negotiate25932589 * to enable EEE, and this feature can cause link drops when25942590 * linked to another device supporting EEE.25912591+ *25922592+ * The same item appears in the errata for the KSZ9567, KSZ9896,25932593+ * and KSZ9897.25942594+ *25952595+ * A similar item appears in the errata for the KSZ8567, but25962596+ * provides an alternative workaround. For now, use the simple25972597+ * workaround of disabling the EEE feature for this device too.25952598 */25962599 return MICREL_NO_EEE;25972600 }···37743763 port);37753764 return -EBUSY;37763765 }37663766+37673767+ /* Need to initialize variable as the code to fill in settings may37683768+ * not be executed.37693769+ */37703770+ wol.wolopts = 0;3777377137783772 ksz_get_wol(ds, dp->index, &wol);37793773 if (wol.wolopts & WAKE_MAGIC) {
+11-8
drivers/net/ethernet/broadcom/bnxt/bnxt.c
···75917591 int rx = bp->rx_nr_rings, stat;75927592 int vnic, grp = rx;7593759375947594- if (hw_resc->resv_tx_rings != bp->tx_nr_rings &&75957595- bp->hwrm_spec_code >= 0x10601)75967596- return true;75977597-75987594 /* Old firmware does not need RX ring reservations but we still75997595 * need to setup a default RSS map when needed. With new firmware76007596 * we go through RX ring reservations first and then set up the76017597 * RSS map for the successfully reserved RX rings when needed.76027598 */76037603- if (!BNXT_NEW_RM(bp)) {75997599+ if (!BNXT_NEW_RM(bp))76047600 bnxt_check_rss_tbl_no_rmgr(bp);76017601+76027602+ if (hw_resc->resv_tx_rings != bp->tx_nr_rings &&76037603+ bp->hwrm_spec_code >= 0x10601)76047604+ return true;76057605+76067606+ if (!BNXT_NEW_RM(bp))76057607 return false;76067606- }7607760876087609 vnic = bnxt_get_total_vnics(bp, rx);76097610···76507649static int __bnxt_reserve_rings(struct bnxt *bp)76517650{76527651 struct bnxt_hw_rings hwr = {0};76527652+ int rx_rings, old_rx_rings, rc;76537653 int cp = bp->cp_nr_rings;76547654- int rx_rings, rc;76557654 int ulp_msix = 0;76567655 bool sh = false;76577656 int tx_cp;···76857684 hwr.grp = bp->rx_nr_rings;76867685 hwr.rss_ctx = bnxt_get_total_rss_ctxs(bp, &hwr);76877686 hwr.stat = bnxt_get_func_stat_ctxs(bp);76877687+ old_rx_rings = bp->hw_resc.resv_rx_rings;7688768876897689 rc = bnxt_hwrm_reserve_rings(bp, &hwr);76907690 if (rc)···77407738 if (!bnxt_rings_ok(bp, &hwr))77417739 return -ENOMEM;7742774077437743- if (!netif_is_rxfh_configured(bp->dev))77417741+ if (old_rx_rings != bp->hw_resc.resv_rx_rings &&77427742+ !netif_is_rxfh_configured(bp->dev))77447743 bnxt_set_dflt_rss_indir_tbl(bp, NULL);7745774477467745 if (!bnxt_ulp_registered(bp->edev) && BNXT_NEW_RM(bp)) {
+13-3
drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c
···18631863}1864186418651865static int bnxt_rxfh_context_check(struct bnxt *bp,18661866+ const struct ethtool_rxfh_param *rxfh,18661867 struct netlink_ext_ack *extack)18671868{18691869+ if (rxfh->hfunc && rxfh->hfunc != ETH_RSS_HASH_TOP) {18701870+ NL_SET_ERR_MSG_MOD(extack, "RSS hash function not supported");18711871+ return -EOPNOTSUPP;18721872+ }18731873+18681874 if (!BNXT_SUPPORTS_MULTI_RSS_CTX(bp)) {18691875 NL_SET_ERR_MSG_MOD(extack, "RSS contexts not supported");18701876 return -EOPNOTSUPP;···18941888 struct bnxt_vnic_info *vnic;18951889 int rc;1896189018971897- rc = bnxt_rxfh_context_check(bp, extack);18911891+ rc = bnxt_rxfh_context_check(bp, rxfh, extack);18981892 if (rc)18991893 return rc;19001894···19211915 if (rc)19221916 goto out;1923191719181918+ /* Populate defaults in the context */19241919 bnxt_set_dflt_rss_indir_tbl(bp, ctx);19201920+ ctx->hfunc = ETH_RSS_HASH_TOP;19251921 memcpy(vnic->rss_hash_key, bp->rss_hash_key, HW_HASH_KEY_SIZE);19221922+ memcpy(ethtool_rxfh_context_key(ctx),19231923+ bp->rss_hash_key, HW_HASH_KEY_SIZE);1926192419271925 rc = bnxt_hwrm_vnic_alloc(bp, vnic, 0, bp->rx_nr_rings);19281926 if (rc) {···19631953 struct bnxt_rss_ctx *rss_ctx;19641954 int rc;1965195519661966- rc = bnxt_rxfh_context_check(bp, extack);19561956+ rc = bnxt_rxfh_context_check(bp, rxfh, extack);19671957 if (rc)19681958 return rc;19691959···52905280const struct ethtool_ops bnxt_ethtool_ops = {52915281 .cap_link_lanes_supported = 1,52925282 .cap_rss_ctx_supported = 1,52935293- .rxfh_max_context_id = BNXT_MAX_ETH_RSS_CTX,52835283+ .rxfh_max_num_contexts = BNXT_MAX_ETH_RSS_CTX + 1,52945284 .rxfh_indir_space = BNXT_MAX_RSS_TABLE_ENTRIES_P5,52955285 .rxfh_priv_size = sizeof(struct bnxt_rss_ctx),52965286 .supported_coalesce_params = ETHTOOL_COALESCE_USECS |
···4242 struct bcmgenet_priv *priv = netdev_priv(dev);4343 struct device *kdev = &priv->pdev->dev;44444545- if (dev->phydev) {4545+ if (dev->phydev)4646 phy_ethtool_get_wol(dev->phydev, wol);4747- if (wol->supported)4848- return;4949- }50475151- if (!device_can_wakeup(kdev)) {5252- wol->supported = 0;5353- wol->wolopts = 0;4848+ /* MAC is not wake-up capable, return what the PHY does */4949+ if (!device_can_wakeup(kdev))5450 return;5555- }56515757- wol->supported = WAKE_MAGIC | WAKE_MAGICSECURE | WAKE_FILTER;5252+ /* Overlay MAC capabilities with that of the PHY queried before */5353+ wol->supported |= WAKE_MAGIC | WAKE_MAGICSECURE | WAKE_FILTER;5854 wol->wolopts = priv->wolopts;5955 memset(wol->sopass, 0, sizeof(wol->sopass));6056
+3
drivers/net/ethernet/freescale/fec_ptp.c
···775775 struct net_device *ndev = platform_get_drvdata(pdev);776776 struct fec_enet_private *fep = netdev_priv(ndev);777777778778+ if (fep->pps_enable)779779+ fec_ptp_enable_pps(fep, 0);780780+778781 cancel_delayed_work_sync(&fep->time_keep);779782 hrtimer_cancel(&fep->perout_timer);780783 if (fep->ptp_clock)
+1-1
drivers/net/ethernet/google/gve/gve_ethtool.c
···495495 return -EINVAL;496496 }497497498498- if (!netif_carrier_ok(netdev)) {498498+ if (!netif_running(netdev)) {499499 priv->tx_cfg.num_queues = new_tx;500500 priv->rx_cfg.num_queues = new_rx;501501 return 0;
···559559 if (test_bit(ICE_PREPARED_FOR_RESET, pf->state))560560 return;561561562562+ synchronize_irq(pf->oicr_irq.virq);563563+562564 ice_unplug_aux_dev(pf);563565564566 /* Notify VFs of impending reset */···29502948 ice_for_each_rxq(vsi, i) {29512949 struct ice_rx_ring *rx_ring = vsi->rx_rings[i];2952295029532953- if (rx_ring->xsk_pool)29512951+ if (READ_ONCE(rx_ring->xsk_pool))29542952 napi_schedule(&rx_ring->q_vector->napi);29552953 }29562954}
+4
drivers/net/ethernet/intel/ice/ice_ptp.c
···14771477 /* Update cached link status for this port immediately */14781478 ptp_port->link_up = linkup;1479147914801480+ /* Skip HW writes if reset is in progress */14811481+ if (pf->hw.reset_ongoing)14821482+ return;14831483+14801484 switch (hw->ptp.phy_model) {14811485 case ICE_PHY_E810:14821486 /* Do not reconfigure E810 PHY */
+6-4
drivers/net/ethernet/intel/ice/ice_txrx.c
···456456 if (rx_ring->vsi->type == ICE_VSI_PF)457457 if (xdp_rxq_info_is_reg(&rx_ring->xdp_rxq))458458 xdp_rxq_info_unreg(&rx_ring->xdp_rxq);459459- rx_ring->xdp_prog = NULL;459459+ WRITE_ONCE(rx_ring->xdp_prog, NULL);460460 if (rx_ring->xsk_pool) {461461 kfree(rx_ring->xdp_buf);462462 rx_ring->xdp_buf = NULL;···15211521 * budget and be more aggressive about cleaning up the Tx descriptors.15221522 */15231523 ice_for_each_tx_ring(tx_ring, q_vector->tx) {15241524+ struct xsk_buff_pool *xsk_pool = READ_ONCE(tx_ring->xsk_pool);15241525 bool wd;1525152615261526- if (tx_ring->xsk_pool)15271527- wd = ice_xmit_zc(tx_ring);15271527+ if (xsk_pool)15281528+ wd = ice_xmit_zc(tx_ring, xsk_pool);15281529 else if (ice_ring_is_xdp(tx_ring))15291530 wd = true;15301531 else···15511550 budget_per_ring = budget;1552155115531552 ice_for_each_rx_ring(rx_ring, q_vector->rx) {15531553+ struct xsk_buff_pool *xsk_pool = READ_ONCE(rx_ring->xsk_pool);15541554 int cleaned;1555155515561556 /* A dedicated path for zero-copy allows making a single···15591557 * ice_clean_rx_irq function and makes the codebase cleaner.15601558 */15611559 cleaned = rx_ring->xsk_pool ?15621562- ice_clean_rx_irq_zc(rx_ring, budget_per_ring) :15601560+ ice_clean_rx_irq_zc(rx_ring, xsk_pool, budget_per_ring) :15631561 ice_clean_rx_irq(rx_ring, budget_per_ring);15641562 work_done += cleaned;15651563 /* if we clean as many as budgeted, we must not be done */
+111-73
drivers/net/ethernet/intel/ice/ice_xsk.c
···5252static void ice_qp_clean_rings(struct ice_vsi *vsi, u16 q_idx)5353{5454 ice_clean_tx_ring(vsi->tx_rings[q_idx]);5555- if (ice_is_xdp_ena_vsi(vsi)) {5656- synchronize_rcu();5555+ if (ice_is_xdp_ena_vsi(vsi))5756 ice_clean_tx_ring(vsi->xdp_rings[q_idx]);5858- }5957 ice_clean_rx_ring(vsi->rx_rings[q_idx]);6058}6159···110112 * ice_qvec_cfg_msix - Enable IRQ for given queue vector111113 * @vsi: the VSI that contains queue vector112114 * @q_vector: queue vector115115+ * @qid: queue index113116 */114117static void115115-ice_qvec_cfg_msix(struct ice_vsi *vsi, struct ice_q_vector *q_vector)118118+ice_qvec_cfg_msix(struct ice_vsi *vsi, struct ice_q_vector *q_vector, u16 qid)116119{117120 u16 reg_idx = q_vector->reg_idx;118121 struct ice_pf *pf = vsi->back;119122 struct ice_hw *hw = &pf->hw;120120- struct ice_tx_ring *tx_ring;121121- struct ice_rx_ring *rx_ring;123123+ int q, _qid = qid;122124123125 ice_cfg_itr(hw, q_vector);124126125125- ice_for_each_tx_ring(tx_ring, q_vector->tx)126126- ice_cfg_txq_interrupt(vsi, tx_ring->reg_idx, reg_idx,127127- q_vector->tx.itr_idx);127127+ for (q = 0; q < q_vector->num_ring_tx; q++) {128128+ ice_cfg_txq_interrupt(vsi, _qid, reg_idx, q_vector->tx.itr_idx);129129+ _qid++;130130+ }128131129129- ice_for_each_rx_ring(rx_ring, q_vector->rx)130130- ice_cfg_rxq_interrupt(vsi, rx_ring->reg_idx, reg_idx,131131- q_vector->rx.itr_idx);132132+ _qid = qid;133133+134134+ for (q = 0; q < q_vector->num_ring_rx; q++) {135135+ ice_cfg_rxq_interrupt(vsi, _qid, reg_idx, q_vector->rx.itr_idx);136136+ _qid++;137137+ }132138133139 ice_flush(hw);134140}···166164 struct ice_tx_ring *tx_ring;167165 struct ice_rx_ring *rx_ring;168166 int timeout = 50;167167+ int fail = 0;169168 int err;170169171170 if (q_idx >= vsi->num_rxq || q_idx >= vsi->num_txq)···183180 usleep_range(1000, 2000);184181 }185182183183+ synchronize_net();184184+ netif_carrier_off(vsi->netdev);185185+ netif_tx_stop_queue(netdev_get_tx_queue(vsi->netdev, q_idx));186186+186187 ice_qvec_dis_irq(vsi, rx_ring, q_vector);187188 ice_qvec_toggle_napi(vsi, q_vector, false);188189189189- netif_tx_stop_queue(netdev_get_tx_queue(vsi->netdev, q_idx));190190-191190 ice_fill_txq_meta(vsi, tx_ring, &txq_meta);192191 err = ice_vsi_stop_tx_ring(vsi, ICE_NO_RESET, 0, tx_ring, &txq_meta);193193- if (err)194194- return err;192192+ if (!fail)193193+ fail = err;195194 if (ice_is_xdp_ena_vsi(vsi)) {196195 struct ice_tx_ring *xdp_ring = vsi->xdp_rings[q_idx];197196···201196 ice_fill_txq_meta(vsi, xdp_ring, &txq_meta);202197 err = ice_vsi_stop_tx_ring(vsi, ICE_NO_RESET, 0, xdp_ring,203198 &txq_meta);204204- if (err)205205- return err;199199+ if (!fail)200200+ fail = err;206201 }207207- err = ice_vsi_ctrl_one_rx_ring(vsi, false, q_idx, true);208208- if (err)209209- return err;210202203203+ ice_vsi_ctrl_one_rx_ring(vsi, false, q_idx, false);211204 ice_qp_clean_rings(vsi, q_idx);212205 ice_qp_reset_stats(vsi, q_idx);213206214214- return 0;207207+ return fail;215208}216209217210/**···222219static int ice_qp_ena(struct ice_vsi *vsi, u16 q_idx)223220{224221 struct ice_q_vector *q_vector;222222+ int fail = 0;223223+ bool link_up;225224 int err;226225227226 err = ice_vsi_cfg_single_txq(vsi, vsi->tx_rings, q_idx);228228- if (err)229229- return err;227227+ if (!fail)228228+ fail = err;230229231230 if (ice_is_xdp_ena_vsi(vsi)) {232231 struct ice_tx_ring *xdp_ring = vsi->xdp_rings[q_idx];233232234233 err = ice_vsi_cfg_single_txq(vsi, vsi->xdp_rings, q_idx);235235- if (err)236236- return err;234234+ if (!fail)235235+ fail = err;237236 ice_set_ring_xdp(xdp_ring);238237 ice_tx_xsk_pool(vsi, q_idx);239238 }240239241240 err = ice_vsi_cfg_single_rxq(vsi, q_idx);242242- if (err)243243- return err;241241+ if (!fail)242242+ fail = err;244243245244 q_vector = vsi->rx_rings[q_idx]->q_vector;246246- ice_qvec_cfg_msix(vsi, q_vector);245245+ ice_qvec_cfg_msix(vsi, q_vector, q_idx);247246248247 err = ice_vsi_ctrl_one_rx_ring(vsi, true, q_idx, true);249249- if (err)250250- return err;248248+ if (!fail)249249+ fail = err;251250252251 ice_qvec_toggle_napi(vsi, q_vector, true);253252 ice_qvec_ena_irq(vsi, q_vector);254253255255- netif_tx_start_queue(netdev_get_tx_queue(vsi->netdev, q_idx));254254+ /* make sure NAPI sees updated ice_{t,x}_ring::xsk_pool */255255+ synchronize_net();256256+ ice_get_link_status(vsi->port_info, &link_up);257257+ if (link_up) {258258+ netif_tx_start_queue(netdev_get_tx_queue(vsi->netdev, q_idx));259259+ netif_carrier_on(vsi->netdev);260260+ }256261 clear_bit(ICE_CFG_BUSY, vsi->state);257262258258- return 0;263263+ return fail;259264}260265261266/**···470459/**471460 * __ice_alloc_rx_bufs_zc - allocate a number of Rx buffers472461 * @rx_ring: Rx ring462462+ * @xsk_pool: XSK buffer pool to pick buffers to be filled by HW473463 * @count: The number of buffers to allocate474464 *475465 * Place the @count of descriptors onto Rx ring. Handle the ring wrap···479467 *480468 * Returns true if all allocations were successful, false if any fail.481469 */482482-static bool __ice_alloc_rx_bufs_zc(struct ice_rx_ring *rx_ring, u16 count)470470+static bool __ice_alloc_rx_bufs_zc(struct ice_rx_ring *rx_ring,471471+ struct xsk_buff_pool *xsk_pool, u16 count)483472{484473 u32 nb_buffs_extra = 0, nb_buffs = 0;485474 union ice_32b_rx_flex_desc *rx_desc;···492479 xdp = ice_xdp_buf(rx_ring, ntu);493480494481 if (ntu + count >= rx_ring->count) {495495- nb_buffs_extra = ice_fill_rx_descs(rx_ring->xsk_pool, xdp,496496- rx_desc,482482+ nb_buffs_extra = ice_fill_rx_descs(xsk_pool, xdp, rx_desc,497483 rx_ring->count - ntu);498484 if (nb_buffs_extra != rx_ring->count - ntu) {499485 ntu += nb_buffs_extra;···505493 ice_release_rx_desc(rx_ring, 0);506494 }507495508508- nb_buffs = ice_fill_rx_descs(rx_ring->xsk_pool, xdp, rx_desc, count);496496+ nb_buffs = ice_fill_rx_descs(xsk_pool, xdp, rx_desc, count);509497510498 ntu += nb_buffs;511499 if (ntu == rx_ring->count)···521509/**522510 * ice_alloc_rx_bufs_zc - allocate a number of Rx buffers523511 * @rx_ring: Rx ring512512+ * @xsk_pool: XSK buffer pool to pick buffers to be filled by HW524513 * @count: The number of buffers to allocate525514 *526515 * Wrapper for internal allocation routine; figure out how many tail···529516 *530517 * Returns true if all calls to internal alloc routine succeeded531518 */532532-bool ice_alloc_rx_bufs_zc(struct ice_rx_ring *rx_ring, u16 count)519519+bool ice_alloc_rx_bufs_zc(struct ice_rx_ring *rx_ring,520520+ struct xsk_buff_pool *xsk_pool, u16 count)533521{534522 u16 rx_thresh = ICE_RING_QUARTER(rx_ring);535523 u16 leftover, i, tail_bumps;···539525 leftover = count - (tail_bumps * rx_thresh);540526541527 for (i = 0; i < tail_bumps; i++)542542- if (!__ice_alloc_rx_bufs_zc(rx_ring, rx_thresh))528528+ if (!__ice_alloc_rx_bufs_zc(rx_ring, xsk_pool, rx_thresh))543529 return false;544544- return __ice_alloc_rx_bufs_zc(rx_ring, leftover);530530+ return __ice_alloc_rx_bufs_zc(rx_ring, xsk_pool, leftover);545531}546532547533/**···610596/**611597 * ice_clean_xdp_irq_zc - produce AF_XDP descriptors to CQ612598 * @xdp_ring: XDP Tx ring599599+ * @xsk_pool: AF_XDP buffer pool pointer613600 */614614-static u32 ice_clean_xdp_irq_zc(struct ice_tx_ring *xdp_ring)601601+static u32 ice_clean_xdp_irq_zc(struct ice_tx_ring *xdp_ring,602602+ struct xsk_buff_pool *xsk_pool)615603{616604 u16 ntc = xdp_ring->next_to_clean;617605 struct ice_tx_desc *tx_desc;···664648 if (xdp_ring->next_to_clean >= cnt)665649 xdp_ring->next_to_clean -= cnt;666650 if (xsk_frames)667667- xsk_tx_completed(xdp_ring->xsk_pool, xsk_frames);651651+ xsk_tx_completed(xsk_pool, xsk_frames);668652669653 return completed_frames;670654}···673657 * ice_xmit_xdp_tx_zc - AF_XDP ZC handler for XDP_TX674658 * @xdp: XDP buffer to xmit675659 * @xdp_ring: XDP ring to produce descriptor onto660660+ * @xsk_pool: AF_XDP buffer pool pointer676661 *677662 * note that this function works directly on xdp_buff, no need to convert678663 * it to xdp_frame. xdp_buff pointer is stored to ice_tx_buf so that cleaning···683666 * was not enough space on XDP ring684667 */685668static int ice_xmit_xdp_tx_zc(struct xdp_buff *xdp,686686- struct ice_tx_ring *xdp_ring)669669+ struct ice_tx_ring *xdp_ring,670670+ struct xsk_buff_pool *xsk_pool)687671{688672 struct skb_shared_info *sinfo = NULL;689673 u32 size = xdp->data_end - xdp->data;···698680699681 free_space = ICE_DESC_UNUSED(xdp_ring);700682 if (free_space < ICE_RING_QUARTER(xdp_ring))701701- free_space += ice_clean_xdp_irq_zc(xdp_ring);683683+ free_space += ice_clean_xdp_irq_zc(xdp_ring, xsk_pool);702684703685 if (unlikely(!free_space))704686 goto busy;···718700 dma_addr_t dma;719701720702 dma = xsk_buff_xdp_get_dma(xdp);721721- xsk_buff_raw_dma_sync_for_device(xdp_ring->xsk_pool, dma, size);703703+ xsk_buff_raw_dma_sync_for_device(xsk_pool, dma, size);722704723705 tx_buf->xdp = xdp;724706 tx_buf->type = ICE_TX_BUF_XSK_TX;···760742 * @xdp: xdp_buff used as input to the XDP program761743 * @xdp_prog: XDP program to run762744 * @xdp_ring: ring to be used for XDP_TX action745745+ * @xsk_pool: AF_XDP buffer pool pointer763746 *764747 * Returns any of ICE_XDP_{PASS, CONSUMED, TX, REDIR}765748 */766749static int767750ice_run_xdp_zc(struct ice_rx_ring *rx_ring, struct xdp_buff *xdp,768768- struct bpf_prog *xdp_prog, struct ice_tx_ring *xdp_ring)751751+ struct bpf_prog *xdp_prog, struct ice_tx_ring *xdp_ring,752752+ struct xsk_buff_pool *xsk_pool)769753{770754 int err, result = ICE_XDP_PASS;771755 u32 act;···778758 err = xdp_do_redirect(rx_ring->netdev, xdp, xdp_prog);779759 if (!err)780760 return ICE_XDP_REDIR;781781- if (xsk_uses_need_wakeup(rx_ring->xsk_pool) && err == -ENOBUFS)761761+ if (xsk_uses_need_wakeup(xsk_pool) && err == -ENOBUFS)782762 result = ICE_XDP_EXIT;783763 else784764 result = ICE_XDP_CONSUMED;···789769 case XDP_PASS:790770 break;791771 case XDP_TX:792792- result = ice_xmit_xdp_tx_zc(xdp, xdp_ring);772772+ result = ice_xmit_xdp_tx_zc(xdp, xdp_ring, xsk_pool);793773 if (result == ICE_XDP_CONSUMED)794774 goto out_failure;795775 break;···841821/**842822 * ice_clean_rx_irq_zc - consumes packets from the hardware ring843823 * @rx_ring: AF_XDP Rx ring824824+ * @xsk_pool: AF_XDP buffer pool pointer844825 * @budget: NAPI budget845826 *846827 * Returns number of processed packets on success, remaining budget on failure.847828 */848848-int ice_clean_rx_irq_zc(struct ice_rx_ring *rx_ring, int budget)829829+int ice_clean_rx_irq_zc(struct ice_rx_ring *rx_ring,830830+ struct xsk_buff_pool *xsk_pool,831831+ int budget)849832{850833 unsigned int total_rx_bytes = 0, total_rx_packets = 0;851851- struct xsk_buff_pool *xsk_pool = rx_ring->xsk_pool;852834 u32 ntc = rx_ring->next_to_clean;853835 u32 ntu = rx_ring->next_to_use;854836 struct xdp_buff *first = NULL;···913891 if (ice_is_non_eop(rx_ring, rx_desc))914892 continue;915893916916- xdp_res = ice_run_xdp_zc(rx_ring, first, xdp_prog, xdp_ring);894894+ xdp_res = ice_run_xdp_zc(rx_ring, first, xdp_prog, xdp_ring,895895+ xsk_pool);917896 if (likely(xdp_res & (ICE_XDP_TX | ICE_XDP_REDIR))) {918897 xdp_xmit |= xdp_res;919898 } else if (xdp_res == ICE_XDP_EXIT) {···963940 rx_ring->next_to_clean = ntc;964941 entries_to_alloc = ICE_RX_DESC_UNUSED(rx_ring);965942 if (entries_to_alloc > ICE_RING_QUARTER(rx_ring))966966- failure |= !ice_alloc_rx_bufs_zc(rx_ring, entries_to_alloc);943943+ failure |= !ice_alloc_rx_bufs_zc(rx_ring, xsk_pool,944944+ entries_to_alloc);967945968946 ice_finalize_xdp_rx(xdp_ring, xdp_xmit, 0);969947 ice_update_rx_ring_stats(rx_ring, total_rx_packets, total_rx_bytes);···987963/**988964 * ice_xmit_pkt - produce a single HW Tx descriptor out of AF_XDP descriptor989965 * @xdp_ring: XDP ring to produce the HW Tx descriptor on966966+ * @xsk_pool: XSK buffer pool to pick buffers to be consumed by HW990967 * @desc: AF_XDP descriptor to pull the DMA address and length from991968 * @total_bytes: bytes accumulator that will be used for stats update992969 */993993-static void ice_xmit_pkt(struct ice_tx_ring *xdp_ring, struct xdp_desc *desc,970970+static void ice_xmit_pkt(struct ice_tx_ring *xdp_ring,971971+ struct xsk_buff_pool *xsk_pool, struct xdp_desc *desc,994972 unsigned int *total_bytes)995973{996974 struct ice_tx_desc *tx_desc;997975 dma_addr_t dma;998976999999- dma = xsk_buff_raw_get_dma(xdp_ring->xsk_pool, desc->addr);10001000- xsk_buff_raw_dma_sync_for_device(xdp_ring->xsk_pool, dma, desc->len);977977+ dma = xsk_buff_raw_get_dma(xsk_pool, desc->addr);978978+ xsk_buff_raw_dma_sync_for_device(xsk_pool, dma, desc->len);10019791002980 tx_desc = ICE_TX_DESC(xdp_ring, xdp_ring->next_to_use++);1003981 tx_desc->buf_addr = cpu_to_le64(dma);···1012986/**1013987 * ice_xmit_pkt_batch - produce a batch of HW Tx descriptors out of AF_XDP descriptors1014988 * @xdp_ring: XDP ring to produce the HW Tx descriptors on989989+ * @xsk_pool: XSK buffer pool to pick buffers to be consumed by HW1015990 * @descs: AF_XDP descriptors to pull the DMA addresses and lengths from1016991 * @total_bytes: bytes accumulator that will be used for stats update1017992 */10181018-static void ice_xmit_pkt_batch(struct ice_tx_ring *xdp_ring, struct xdp_desc *descs,993993+static void ice_xmit_pkt_batch(struct ice_tx_ring *xdp_ring,994994+ struct xsk_buff_pool *xsk_pool,995995+ struct xdp_desc *descs,1019996 unsigned int *total_bytes)1020997{1021998 u16 ntu = xdp_ring->next_to_use;···1028999 loop_unrolled_for(i = 0; i < PKTS_PER_BATCH; i++) {10291000 dma_addr_t dma;1030100110311031- dma = xsk_buff_raw_get_dma(xdp_ring->xsk_pool, descs[i].addr);10321032- xsk_buff_raw_dma_sync_for_device(xdp_ring->xsk_pool, dma, descs[i].len);10021002+ dma = xsk_buff_raw_get_dma(xsk_pool, descs[i].addr);10031003+ xsk_buff_raw_dma_sync_for_device(xsk_pool, dma, descs[i].len);1033100410341005 tx_desc = ICE_TX_DESC(xdp_ring, ntu++);10351006 tx_desc->buf_addr = cpu_to_le64(dma);···10451016/**10461017 * ice_fill_tx_hw_ring - produce the number of Tx descriptors onto ring10471018 * @xdp_ring: XDP ring to produce the HW Tx descriptors on10191019+ * @xsk_pool: XSK buffer pool to pick buffers to be consumed by HW10481020 * @descs: AF_XDP descriptors to pull the DMA addresses and lengths from10491021 * @nb_pkts: count of packets to be send10501022 * @total_bytes: bytes accumulator that will be used for stats update10511023 */10521052-static void ice_fill_tx_hw_ring(struct ice_tx_ring *xdp_ring, struct xdp_desc *descs,10531053- u32 nb_pkts, unsigned int *total_bytes)10241024+static void ice_fill_tx_hw_ring(struct ice_tx_ring *xdp_ring,10251025+ struct xsk_buff_pool *xsk_pool,10261026+ struct xdp_desc *descs, u32 nb_pkts,10271027+ unsigned int *total_bytes)10541028{10551029 u32 batched, leftover, i;1056103010571031 batched = ALIGN_DOWN(nb_pkts, PKTS_PER_BATCH);10581032 leftover = nb_pkts & (PKTS_PER_BATCH - 1);10591033 for (i = 0; i < batched; i += PKTS_PER_BATCH)10601060- ice_xmit_pkt_batch(xdp_ring, &descs[i], total_bytes);10341034+ ice_xmit_pkt_batch(xdp_ring, xsk_pool, &descs[i], total_bytes);10611035 for (; i < batched + leftover; i++)10621062- ice_xmit_pkt(xdp_ring, &descs[i], total_bytes);10361036+ ice_xmit_pkt(xdp_ring, xsk_pool, &descs[i], total_bytes);10631037}1064103810651039/**10661040 * ice_xmit_zc - take entries from XSK Tx ring and place them onto HW Tx ring10671041 * @xdp_ring: XDP ring to produce the HW Tx descriptors on10421042+ * @xsk_pool: AF_XDP buffer pool pointer10681043 *10691044 * Returns true if there is no more work that needs to be done, false otherwise10701045 */10711071-bool ice_xmit_zc(struct ice_tx_ring *xdp_ring)10461046+bool ice_xmit_zc(struct ice_tx_ring *xdp_ring, struct xsk_buff_pool *xsk_pool)10721047{10731073- struct xdp_desc *descs = xdp_ring->xsk_pool->tx_descs;10481048+ struct xdp_desc *descs = xsk_pool->tx_descs;10741049 u32 nb_pkts, nb_processed = 0;10751050 unsigned int total_bytes = 0;10761051 int budget;1077105210781078- ice_clean_xdp_irq_zc(xdp_ring);10531053+ ice_clean_xdp_irq_zc(xdp_ring, xsk_pool);10541054+10551055+ if (!netif_carrier_ok(xdp_ring->vsi->netdev) ||10561056+ !netif_running(xdp_ring->vsi->netdev))10571057+ return true;1079105810801059 budget = ICE_DESC_UNUSED(xdp_ring);10811060 budget = min_t(u16, budget, ICE_RING_QUARTER(xdp_ring));1082106110831083- nb_pkts = xsk_tx_peek_release_desc_batch(xdp_ring->xsk_pool, budget);10621062+ nb_pkts = xsk_tx_peek_release_desc_batch(xsk_pool, budget);10841063 if (!nb_pkts)10851064 return true;1086106510871066 if (xdp_ring->next_to_use + nb_pkts >= xdp_ring->count) {10881067 nb_processed = xdp_ring->count - xdp_ring->next_to_use;10891089- ice_fill_tx_hw_ring(xdp_ring, descs, nb_processed, &total_bytes);10681068+ ice_fill_tx_hw_ring(xdp_ring, xsk_pool, descs, nb_processed,10691069+ &total_bytes);10901070 xdp_ring->next_to_use = 0;10911071 }1092107210931093- ice_fill_tx_hw_ring(xdp_ring, &descs[nb_processed], nb_pkts - nb_processed,10941094- &total_bytes);10731073+ ice_fill_tx_hw_ring(xdp_ring, xsk_pool, &descs[nb_processed],10741074+ nb_pkts - nb_processed, &total_bytes);1095107510961076 ice_set_rs_bit(xdp_ring);10971077 ice_xdp_ring_update_tail(xdp_ring);10981078 ice_update_tx_ring_stats(xdp_ring, nb_pkts, total_bytes);1099107911001100- if (xsk_uses_need_wakeup(xdp_ring->xsk_pool))11011101- xsk_set_tx_need_wakeup(xdp_ring->xsk_pool);10801080+ if (xsk_uses_need_wakeup(xsk_pool))10811081+ xsk_set_tx_need_wakeup(xsk_pool);1102108211031083 return nb_pkts < budget;11041084}···11291091 struct ice_vsi *vsi = np->vsi;11301092 struct ice_tx_ring *ring;1131109311321132- if (test_bit(ICE_VSI_DOWN, vsi->state))10941094+ if (test_bit(ICE_VSI_DOWN, vsi->state) || !netif_carrier_ok(netdev))11331095 return -ENETDOWN;1134109611351097 if (!ice_is_xdp_ena_vsi(vsi))···1140110211411103 ring = vsi->rx_rings[queue_id]->xdp_ring;1142110411431143- if (!ring->xsk_pool)11051105+ if (!READ_ONCE(ring->xsk_pool))11441106 return -EINVAL;1145110711461108 /* The idea here is that if NAPI is running, mark a miss, so
···21422142 /* Panic tear down fw command will stop the PCI bus communication21432143 * with the HCA, so the health poll is no longer needed.21442144 */21452145- mlx5_drain_health_wq(dev);21462145 mlx5_stop_health_poll(dev, false);2147214621482147 ret = mlx5_cmd_fast_teardown_hca(dev);···2176217721772178 mlx5_core_info(dev, "Shutdown was called\n");21782179 set_bit(MLX5_BREAK_FW_WAIT, &dev->intf_state);21802180+ mlx5_drain_health_wq(dev);21792181 err = mlx5_try_fast_unload(dev);21802182 if (err)21812183 mlx5_unload_one(dev, false);
···77/* don't try to optimize STE allocation if the stack is too constaraining */88#define DR_RULE_MAX_STES_OPTIMIZED 099#else1010-#define DR_RULE_MAX_STES_OPTIMIZED 51010+#define DR_RULE_MAX_STES_OPTIMIZED 21111#endif1212#define DR_RULE_MAX_STE_CHAIN_OPTIMIZED (DR_RULE_MAX_STES_OPTIMIZED + DR_ACTION_MAX_STES)1313
+1-1
drivers/net/ethernet/meta/Kconfig
···2020config FBNIC2121 tristate "Meta Platforms Host Network Interface"2222 depends on X86_64 || COMPILE_TEST2323- depends on S390=n2323+ depends on !S3902424 depends on MAX_SKB_FRAGS < 222525 depends on PCI_MSI2626 select PHYLINK
+2-6
drivers/net/ethernet/realtek/r8169_main.c
···43494349 if (unlikely(!rtl_tx_slots_avail(tp))) {43504350 if (net_ratelimit())43514351 netdev_err(dev, "BUG! Tx Ring full when queue awake!\n");43524352- goto err_stop_0;43524352+ netif_stop_queue(dev);43534353+ return NETDEV_TX_BUSY;43534354 }4354435543554356 opts[1] = rtl8169_tx_vlan_tag(skb);···44064405 dev_kfree_skb_any(skb);44074406 dev->stats.tx_dropped++;44084407 return NETDEV_TX_OK;44094409-44104410-err_stop_0:44114411- netif_stop_queue(dev);44124412- dev->stats.tx_dropped++;44134413- return NETDEV_TX_BUSY;44144408}4415440944164410static unsigned int rtl_last_frag_len(struct sk_buff *skb)
···653653 unsigned long *possible = phydev->possible_interfaces;654654 unsigned int serdes_mode, rate_adapt;655655 phy_interface_t interface;656656- int i, val, ret;657657-658658- ret = phy_read_mmd_poll_timeout(phydev, MDIO_MMD_VEND1,659659- VEND1_GLOBAL_CFG_10M, val, val != 0,660660- 1000, 100000, false);661661- if (ret)662662- return ret;656656+ int i, val;663657664658 /* Walk the media-speed configuration registers to determine which665659 * host-side serdes modes may be used by the PHY depending on the···702708 return 0;703709}704710711711+static int aqr113c_fill_interface_modes(struct phy_device *phydev)712712+{713713+ int val, ret;714714+715715+ /* It's been observed on some models that - when coming out of suspend716716+ * - the FW signals that the PHY is ready but the GLOBAL_CFG registers717717+ * continue on returning zeroes for some time. Let's poll the 100M718718+ * register until it returns a real value as both 113c and 115c support719719+ * this mode.720720+ */721721+ ret = phy_read_mmd_poll_timeout(phydev, MDIO_MMD_VEND1,722722+ VEND1_GLOBAL_CFG_100M, val, val != 0,723723+ 1000, 100000, false);724724+ if (ret)725725+ return ret;726726+727727+ return aqr107_fill_interface_modes(phydev);728728+}729729+705730static int aqr113c_config_init(struct phy_device *phydev)706731{707732 int ret;···738725 if (ret)739726 return ret;740727741741- return aqr107_fill_interface_modes(phydev);728728+ return aqr113c_fill_interface_modes(phydev);742729}743730744731static int aqr107_probe(struct phy_device *phydev)
+19-15
drivers/net/phy/micrel.c
···13891389 const struct device *dev_walker;13901390 int ret;1391139113921392+ phydev->mdix_ctrl = ETH_TP_MDI_AUTO;13931393+13921394 dev_walker = &phydev->mdio.dev;13931395 do {13941396 of_node = dev_walker->of_node;···14401438#define MII_KSZ9131_AUTO_MDIX 0x1C14411439#define MII_KSZ9131_AUTO_MDI_SET BIT(7)14421440#define MII_KSZ9131_AUTO_MDIX_SWAP_OFF BIT(6)14411441+#define MII_KSZ9131_DIG_AXAN_STS 0x1414421442+#define MII_KSZ9131_DIG_AXAN_STS_LINK_DET BIT(14)14431443+#define MII_KSZ9131_DIG_AXAN_STS_A_SELECT BIT(12)1443144414441445static int ksz9131_mdix_update(struct phy_device *phydev)14451446{14461447 int ret;1447144814481448- ret = phy_read(phydev, MII_KSZ9131_AUTO_MDIX);14491449- if (ret < 0)14501450- return ret;14511451-14521452- if (ret & MII_KSZ9131_AUTO_MDIX_SWAP_OFF) {14531453- if (ret & MII_KSZ9131_AUTO_MDI_SET)14541454- phydev->mdix_ctrl = ETH_TP_MDI;14551455- else14561456- phydev->mdix_ctrl = ETH_TP_MDI_X;14491449+ if (phydev->mdix_ctrl != ETH_TP_MDI_AUTO) {14501450+ phydev->mdix = phydev->mdix_ctrl;14571451 } else {14581458- phydev->mdix_ctrl = ETH_TP_MDI_AUTO;14591459- }14521452+ ret = phy_read(phydev, MII_KSZ9131_DIG_AXAN_STS);14531453+ if (ret < 0)14541454+ return ret;1460145514611461- if (ret & MII_KSZ9131_AUTO_MDI_SET)14621462- phydev->mdix = ETH_TP_MDI;14631463- else14641464- phydev->mdix = ETH_TP_MDI_X;14561456+ if (ret & MII_KSZ9131_DIG_AXAN_STS_LINK_DET) {14571457+ if (ret & MII_KSZ9131_DIG_AXAN_STS_A_SELECT)14581458+ phydev->mdix = ETH_TP_MDI;14591459+ else14601460+ phydev->mdix = ETH_TP_MDI_X;14611461+ } else {14621462+ phydev->mdix = ETH_TP_MDI_INVALID;14631463+ }14641464+ }1465146514661466 return 0;14671467}
···473473{474474 int i;475475476476- clear_bit(ATH12K_FLAG_EXT_IRQ_ENABLED, &ab->dev_flags);476476+ if (!test_and_clear_bit(ATH12K_FLAG_EXT_IRQ_ENABLED, &ab->dev_flags))477477+ return;477478478479 for (i = 0; i < ATH12K_EXT_IRQ_GRP_NUM_MAX; i++) {479480 struct ath12k_ext_irq_grp *irq_grp = &ab->ext_irq_grp[i];
+4-4
drivers/net/wireless/ath/ath12k/wow.c
···361361 struct ath12k *ar = arvif->ar;362362 unsigned long wow_mask = 0;363363 int pattern_id = 0;364364- int ret, i;364364+ int ret, i, j;365365366366 /* Setup requested WOW features */367367 switch (arvif->vdev_type) {···431431 eth_pattern->pattern_len);432432433433 /* convert bitmask to bytemask */434434- for (i = 0; i < eth_pattern->pattern_len; i++)435435- if (eth_pattern->mask[i / 8] & BIT(i % 8))436436- new_pattern.bytemask[i] = 0xff;434434+ for (j = 0; j < eth_pattern->pattern_len; j++)435435+ if (eth_pattern->mask[j / 8] & BIT(j % 8))436436+ new_pattern.bytemask[j] = 0xff;437437438438 new_pattern.pattern_len = eth_pattern->pattern_len;439439 new_pattern.pkt_offset = eth_pattern->pkt_offset;
···485485 struct pci_dev *pdev = ctrl_dev(ctrl);486486487487 pci_config_pm_runtime_get(pdev);488488- pcie_write_cmd_nowait(ctrl, FIELD_PREP(PCI_EXP_SLTCTL_AIC, status),488488+489489+ /* Attention and Power Indicator Control bits are supported */490490+ pcie_write_cmd_nowait(ctrl, FIELD_PREP(PCI_EXP_SLTCTL_AIC | PCI_EXP_SLTCTL_PIC, status),489491 PCI_EXP_SLTCTL_AIC | PCI_EXP_SLTCTL_PIC);490492 pci_config_pm_runtime_put(pdev);491493 return 0;
+8-7
drivers/pci/pci.c
···44774477{44784478 u16 pci_command, new;4479447944804480- /* Preserve the "hybrid" behavior for backwards compatibility */44814481- if (pci_is_managed(pdev)) {44824482- WARN_ON_ONCE(pcim_intx(pdev, enable) != 0);44834483- return;44844484- }44854485-44864480 pci_read_config_word(pdev, PCI_COMMAND, &pci_command);4487448144884482 if (enable)···44844490 else44854491 new = pci_command | PCI_COMMAND_INTX_DISABLE;4486449244874487- if (new != pci_command)44934493+ if (new != pci_command) {44944494+ /* Preserve the "hybrid" behavior for backwards compatibility */44954495+ if (pci_is_managed(pdev)) {44964496+ WARN_ON_ONCE(pcim_intx(pdev, enable) != 0);44974497+ return;44984498+ }44994499+44884500 pci_write_config_word(pdev, PCI_COMMAND, new);45014501+ }44894502}44904503EXPORT_SYMBOL_GPL(pci_intx);44914504
+1-1
drivers/perf/riscv_pmu_sbi.c
···416416 * but not in the user access mode as we want to use the other counters417417 * that support sampling/filtering.418418 */419419- if (hwc->flags & PERF_EVENT_FLAG_LEGACY) {419419+ if ((hwc->flags & PERF_EVENT_FLAG_LEGACY) && (event->attr.type == PERF_TYPE_HARDWARE)) {420420 if (event->attr.config == PERF_COUNT_HW_CPU_CYCLES) {421421 cflags |= SBI_PMU_CFG_FLAG_SKIP_MATCH;422422 cmask = 1;
+2
drivers/platform/chrome/cros_ec_proto.c
···813813 if (ret == -ENOPROTOOPT) {814814 dev_dbg(ec_dev->dev,815815 "GET_NEXT_EVENT returned invalid version error.\n");816816+ mutex_lock(&ec_dev->lock);816817 ret = cros_ec_get_host_command_version_mask(ec_dev,817818 EC_CMD_GET_NEXT_EVENT,818819 &ver_mask);820820+ mutex_unlock(&ec_dev->lock);819821 if (ret < 0 || ver_mask == 0)820822 /*821823 * Do not change the MKBP supported version if we can't
+55-25
drivers/platform/cznic/Kconfig
···1616 tristate "Turris Omnia MCU driver"1717 depends on MACH_ARMADA_38X || COMPILE_TEST1818 depends on I2C1919- depends on OF2020- depends on WATCHDOG2121- depends on GPIOLIB2222- depends on HW_RANDOM2323- depends on RTC_CLASS2424- depends on WATCHDOG_CORE2525- select GPIOLIB_IRQCHIP2619 help2720 Say Y here to add support for the features implemented by the2821 microcontroller on the CZ.NIC's Turris Omnia SOHO router.2929- The features include:3030- - board poweroff into true low power mode (with voltage regulators3131- disabled) and the ability to configure wake up from this mode (via3232- rtcwake)3333- - true random number generator (if available on the MCU)3434- - MCU watchdog3535- - GPIO pins3636- - to get front button press events (the front button can be3737- configured either to generate press events to the CPU or to change3838- front LEDs panel brightness)3939- - to enable / disable USB port voltage regulators and to detect4040- USB overcurrent4141- - to detect MiniPCIe / mSATA card presence in MiniPCIe port 04242- - to configure resets of various peripherals on board revisions 32+4343- - to enable / disable the VHV voltage regulator to the SOC in order4444- to be able to program SOC's OTP on board revisions 32+4545- - to get input from the LED output pins of the WAN ethernet PHY, LAN4646- switch and MiniPCIe ports2222+ This option only enables the core part of the driver. Specific2323+ features can be enabled by subsequent config options.4724 To compile this driver as a module, choose M here; the module will be4825 called turris-omnia-mcu.2626+2727+if TURRIS_OMNIA_MCU2828+2929+config TURRIS_OMNIA_MCU_GPIO3030+ bool "Turris Omnia MCU GPIOs"3131+ default y3232+ depends on GPIOLIB3333+ depends on OF3434+ select GPIOLIB_IRQCHIP3535+ help3636+ Say Y here to add support for controlling MCU GPIO pins and receiving3737+ MCU interrupts on CZ.NIC's Turris Omnia.3838+ This enables you to3939+ - get front button press events (the front button can be configured4040+ either to generate press events to the CPU or to change front LEDs4141+ panel brightness),4242+ - enable / disable USB port voltage regulators and to detect USB4343+ overcurrent,4444+ - detect MiniPCIe / mSATA card presence in MiniPCIe port 0,4545+ - configure resets of various peripherals on board revisions 32+,4646+ - enable / disable the VHV voltage regulator to the SOC in order to be4747+ able to program SOC's OTP on board revisions 32+,4848+ - get input from the LED output pins of the WAN ethernet PHY, LAN4949+ switch and MiniPCIe ports.5050+5151+config TURRIS_OMNIA_MCU_SYSOFF_WAKEUP5252+ bool "Turris Omnia MCU system off and RTC wakeup"5353+ default y5454+ depends on RTC_CLASS5555+ help5656+ Say Y here to add support for CZ.NIC's Turris Omnia board poweroff5757+ into true low power mode (with voltage regulators disabled) and the5858+ ability to configure wake up from this mode (via rtcwake).5959+6060+config TURRIS_OMNIA_MCU_WATCHDOG6161+ bool "Turris Omnia MCU watchdog"6262+ default y6363+ depends on WATCHDOG6464+ select WATCHDOG_CORE6565+ help6666+ Say Y here to add support for watchdog provided by CZ.NIC's Turris6767+ Omnia MCU.6868+6969+config TURRIS_OMNIA_MCU_TRNG7070+ bool "Turris Omnia MCU true random number generator"7171+ default y7272+ depends on TURRIS_OMNIA_MCU_GPIO7373+ depends on HW_RANDOM7474+ help7575+ Say Y here to add support for the true random number generator7676+ provided by CZ.NIC's Turris Omnia MCU.7777+7878+endif # TURRIS_OMNIA_MCU49795080endif # CZNIC_PLATFORMS
···221221 */222222static void ifs_test_core(int cpu, struct device *dev)223223{224224+ union ifs_status status = {};224225 union ifs_scan activate;225225- union ifs_status status;226226 unsigned long timeout;227227 struct ifs_data *ifsd;228228 int to_start, to_stop;
+9
drivers/platform/x86/intel/vbtn.c
···77 */8899#include <linux/acpi.h>1010+#include <linux/cleanup.h>1011#include <linux/dmi.h>1112#include <linux/input.h>1213#include <linux/input/sparse-keymap.h>1314#include <linux/kernel.h>1415#include <linux/module.h>1616+#include <linux/mutex.h>1517#include <linux/platform_device.h>1618#include <linux/suspend.h>1719#include "../dual_accel_detect.h"···6866};69677068struct intel_vbtn_priv {6969+ struct mutex mutex; /* Avoid notify_handler() racing with itself */7170 struct input_dev *buttons_dev;7271 struct input_dev *switches_dev;7372 bool dual_accel;···157154 struct input_dev *input_dev;158155 bool autorelease;159156 int ret;157157+158158+ guard(mutex)(&priv->mutex);160159161160 if ((ke = sparse_keymap_entry_from_scancode(priv->buttons_dev, event))) {162161 if (!priv->has_buttons) {···294289 if (!priv)295290 return -ENOMEM;296291 dev_set_drvdata(&device->dev, priv);292292+293293+ err = devm_mutex_init(&device->dev, &priv->mutex);294294+ if (err)295295+ return err;297296298297 priv->dual_accel = dual_accel;299298 priv->has_buttons = has_buttons;
-1
drivers/platform/x86/sony-laptop.c
···757757 return result;758758}759759760760-#define MIN(a, b) (a > b ? b : a)761760static int sony_nc_buffer_call(acpi_handle handle, char *name, u64 *value,762761 void *buffer, size_t buflen)763762{
···486486 int ret;487487488488 if (!battmgr->service_up)489489- return -ENODEV;489489+ return -EAGAIN;490490491491 if (battmgr->variant == QCOM_BATTMGR_SC8280XP)492492 ret = qcom_battmgr_bat_sc8280xp_update(battmgr, psp);···683683 int ret;684684685685 if (!battmgr->service_up)686686- return -ENODEV;686686+ return -EAGAIN;687687688688 ret = qcom_battmgr_bat_sc8280xp_update(battmgr, psp);689689 if (ret)···748748 int ret;749749750750 if (!battmgr->service_up)751751- return -ENODEV;751751+ return -EAGAIN;752752753753 if (battmgr->variant == QCOM_BATTMGR_SC8280XP)754754 ret = qcom_battmgr_bat_sc8280xp_update(battmgr, psp);···867867 int ret;868868869869 if (!battmgr->service_up)870870- return -ENODEV;870870+ return -EAGAIN;871871872872 if (battmgr->variant == QCOM_BATTMGR_SC8280XP)873873 ret = qcom_battmgr_bat_sc8280xp_update(battmgr, psp);···10071007 battmgr->error = 0;10081008 break;10091009 case BATTMGR_BAT_INFO:10101010- if (payload_len != sizeof(resp->info)) {10101010+ /* some firmware versions report an extra __le32 at the end of the payload */10111011+ if (payload_len != sizeof(resp->info) &&10121012+ payload_len != (sizeof(resp->info) + sizeof(__le32))) {10111013 dev_warn(battmgr->dev,10121014 "invalid payload length for battery information request: %zd\n",10131015 payload_len);
···550550 put_device(&gdev->dev);551551}552552EXPORT_SYMBOL(ccwgroup_remove_ccwdev);553553+MODULE_DESCRIPTION("ccwgroup bus driver");553554MODULE_LICENSE("GPL");
+1
drivers/s390/cio/vfio_ccw_drv.c
···488488module_init(vfio_ccw_sch_init);489489module_exit(vfio_ccw_sch_exit);490490491491+MODULE_DESCRIPTION("VFIO based Subchannel device driver");491492MODULE_LICENSE("GPL v2");
+1-5
drivers/scsi/isci/init.c
···6565#include "task.h"6666#include "probe_roms.h"67676868-#define MAJ 16969-#define MIN 27070-#define BUILD 07171-#define DRV_VERSION __stringify(MAJ) "." __stringify(MIN) "." \7272- __stringify(BUILD)6868+#define DRV_VERSION "1.2.0"73697470MODULE_VERSION(DRV_VERSION);7571
+11
drivers/scsi/mpi3mr/mpi3mr_os.c
···35753575 scmd->sc_data_direction);35763576 priv->meta_sg_valid = 1; /* To unmap meta sg DMA */35773577 } else {35783578+ /*35793579+ * Some firmware versions byte-swap the REPORT ZONES command35803580+ * reply from ATA-ZAC devices by directly accessing in the host35813581+ * buffer. This does not respect the default command DMA35823582+ * direction and causes IOMMU page faults on some architectures35833583+ * with an IOMMU enforcing write mappings (e.g. AMD hosts).35843584+ * Avoid such issue by making the REPORT ZONES buffer mapping35853585+ * bi-directional.35863586+ */35873587+ if (scmd->cmnd[0] == ZBC_IN && scmd->cmnd[1] == ZI_REPORT_ZONES)35883588+ scmd->sc_data_direction = DMA_BIDIRECTIONAL;35783589 sg_scmd = scsi_sglist(scmd);35793590 sges_left = scsi_dma_map(scmd);35803591 }
+18-2
drivers/scsi/mpt3sas/mpt3sas_base.c
···26712671 _base_add_sg_single_ieee(paddr, sgl_flags, 0, 0, -1);26722672}2673267326742674+static inline int _base_scsi_dma_map(struct scsi_cmnd *cmd)26752675+{26762676+ /*26772677+ * Some firmware versions byte-swap the REPORT ZONES command reply from26782678+ * ATA-ZAC devices by directly accessing in the host buffer. This does26792679+ * not respect the default command DMA direction and causes IOMMU page26802680+ * faults on some architectures with an IOMMU enforcing write mappings26812681+ * (e.g. AMD hosts). Avoid such issue by making the report zones buffer26822682+ * mapping bi-directional.26832683+ */26842684+ if (cmd->cmnd[0] == ZBC_IN && cmd->cmnd[1] == ZI_REPORT_ZONES)26852685+ cmd->sc_data_direction = DMA_BIDIRECTIONAL;26862686+26872687+ return scsi_dma_map(cmd);26882688+}26892689+26742690/**26752691 * _base_build_sg_scmd - main sg creation routine26762692 * pcie_device is unused here!···27332717 sgl_flags = sgl_flags << MPI2_SGE_FLAGS_SHIFT;2734271827352719 sg_scmd = scsi_sglist(scmd);27362736- sges_left = scsi_dma_map(scmd);27202720+ sges_left = _base_scsi_dma_map(scmd);27372721 if (sges_left < 0)27382722 return -ENOMEM;27392723···28772861 }2878286228792863 sg_scmd = scsi_sglist(scmd);28802880- sges_left = scsi_dma_map(scmd);28642864+ sges_left = _base_scsi_dma_map(scmd);28812865 if (sges_left < 0)28822866 return -ENOMEM;28832867
+13-7
drivers/scsi/sd.c
···2711271127122712 if (buffer[14] & 0x40) /* LBPRZ */27132713 sdkp->lbprz = 1;27142714-27152715- sd_config_discard(sdkp, lim, SD_LBP_WS16);27162714 }2717271527182716 sdkp->capacity = lba + 1;···33633365 sdkp->unmap_alignment =33643366 get_unaligned_be32(&vpd->data[32]) & ~(1 << 31);3365336733663366- sd_config_discard(sdkp, lim, sd_discard_mode(sdkp));33673367-33683368config_atomic:33693369 sdkp->max_atomic = get_unaligned_be32(&vpd->data[44]);33703370 sdkp->atomic_alignment = get_unaligned_be32(&vpd->data[48]);···37493753 sd_read_block_limits_ext(sdkp);37503754 sd_read_block_characteristics(sdkp, &lim);37513755 sd_zbc_read_zones(sdkp, &lim, buffer);37523752- sd_read_cpr(sdkp);37533756 }37573757+37583758+ sd_config_discard(sdkp, &lim, sd_discard_mode(sdkp));3754375937553760 sd_print_capacity(sdkp, old_capacity);37563761···38043807 blk_mq_unfreeze_queue(sdkp->disk->queue);38053808 if (err)38063809 return err;38103810+38113811+ /*38123812+ * Query concurrent positioning ranges after38133813+ * queue_limits_commit_update() unlocked q->limits_lock to avoid38143814+ * deadlock with q->sysfs_dir_lock and q->sysfs_lock.38153815+ */38163816+ if (sdkp->media_present && scsi_device_supports_vpd(sdp))38173817+ sd_read_cpr(sdkp);3807381838083819 /*38093820 * For a zoned drive, revalidating the zones can be done only once···42104205{42114206 struct scsi_disk *sdkp = dev_get_drvdata(dev);4212420742084208+ sd_printk(KERN_NOTICE, sdkp, "Starting disk\n");42094209+42134210 if (opal_unlock_from_suspend(sdkp->opal_dev)) {42144211 sd_printk(KERN_NOTICE, sdkp, "OPAL unlock failed\n");42154212 return -EIO;···42284221 if (!sdkp) /* E.g.: runtime resume at the start of sd_probe() */42294222 return 0;4230422342314231- sd_printk(KERN_NOTICE, sdkp, "Starting disk\n");42324232-42334224 if (!sd_do_start_stop(sdkp->device, runtime)) {42344225 sdkp->suspended = false;42354226 return 0;42364227 }4237422842294229+ sd_printk(KERN_NOTICE, sdkp, "Starting disk\n");42384230 ret = sd_start_stop_device(sdkp, 1);42394231 if (!ret) {42404232 sd_resume(dev);
+1-1
drivers/scsi/sr_ioctl.c
···431431 struct packet_command cgc;432432433433 /* avoid exceeding the max speed or overflowing integer bounds */434434- speed = clamp(0, speed, 0xffff / 177);434434+ speed = clamp(speed, 0, 0xffff / 177);435435436436 if (speed == 0)437437 speed = 0xffff; /* set to max */
+4-2
drivers/spi/spi-fsl-lpspi.c
···296296static int fsl_lpspi_set_bitrate(struct fsl_lpspi_data *fsl_lpspi)297297{298298 struct lpspi_config config = fsl_lpspi->config;299299- unsigned int perclk_rate, scldiv;299299+ unsigned int perclk_rate, scldiv, div;300300 u8 prescale;301301302302 perclk_rate = clk_get_rate(fsl_lpspi->clk_per);···313313 return -EINVAL;314314 }315315316316+ div = DIV_ROUND_UP(perclk_rate, config.speed_hz);317317+316318 for (prescale = 0; prescale < 8; prescale++) {317317- scldiv = perclk_rate / config.speed_hz / (1 << prescale) - 2;319319+ scldiv = div / (1 << prescale) - 2;318320 if (scldiv < 256) {319321 fsl_lpspi->config.prescale = prescale;320322 break;
+4
drivers/spi/spi-hisi-kunpeng.c
···481481 return -EINVAL;482482 }483483484484+ if (host->max_speed_hz == 0)485485+ return dev_err_probe(dev, -EINVAL, "spi-max-frequency can't be 0\n");486486+484487 ret = device_property_read_u16(dev, "num-cs",485488 &host->num_chipselect);486489 if (ret)···498495 host->transfer_one = hisi_spi_transfer_one;499496 host->handle_err = hisi_spi_handle_err;500497 host->dev.fwnode = dev->fwnode;498498+ host->min_speed_hz = DIV_ROUND_UP(host->max_speed_hz, CLK_DIV_MAX);501499502500 hisi_spi_hw_init(hs);503501
···2222/* force a value to a lower even value */2323#define EVEN_FLOOR(x) ((x) & ~1)24242525-/* for preprocessor and array sizing use MIN and MAX2626- otherwise use min and max */2727-#define MAX(a, b) (((a) > (b)) ? (a) : (b))2828-#define MIN(a, b) (((a) < (b)) ? (a) : (b))2929-3025#define CEIL_DIV(a, b) (((b) != 0) ? ((a) + (b) - 1) / (b) : 0)3126#define CEIL_MUL(a, b) (CEIL_DIV(a, b) * (b))3227#define CEIL_MUL2(a, b) (((a) + (b) - 1) & ~((b) - 1))
···278278279279static bool msi_irq;280280281281+static void proc_thermal_free_msi(struct pci_dev *pdev, struct proc_thermal_pci *pci_info)282282+{283283+ int i;284284+285285+ for (i = 0; i < MSI_THERMAL_MAX; i++) {286286+ if (proc_thermal_msi_map[i])287287+ devm_free_irq(&pdev->dev, proc_thermal_msi_map[i], pci_info);288288+ }289289+290290+ pci_free_irq_vectors(pdev);291291+}292292+281293static int proc_thermal_setup_msi(struct pci_dev *pdev, struct proc_thermal_pci *pci_info)282294{283283- int ret, i, irq;295295+ int ret, i, irq, count;284296285285- ret = pci_alloc_irq_vectors(pdev, 1, MSI_THERMAL_MAX, PCI_IRQ_MSI | PCI_IRQ_MSIX);286286- if (ret < 0) {297297+ count = pci_alloc_irq_vectors(pdev, 1, MSI_THERMAL_MAX, PCI_IRQ_MSI | PCI_IRQ_MSIX);298298+ if (count < 0) {287299 dev_err(&pdev->dev, "Failed to allocate vectors!\n");288288- return ret;300300+ return count;289301 }290302291303 dev_info(&pdev->dev, "msi enabled:%d msix enabled:%d\n", pdev->msi_enabled,292304 pdev->msix_enabled);293305294294- for (i = 0; i < MSI_THERMAL_MAX; i++) {306306+ for (i = 0; i < count; i++) {295307 irq = pci_irq_vector(pdev, i);296308297309 ret = devm_request_threaded_irq(&pdev->dev, irq, proc_thermal_irq_handler,···322310 return 0;323311324312err_free_msi_vectors:325325- pci_free_irq_vectors(pdev);313313+ proc_thermal_free_msi(pdev, pci_info);326314327315 return ret;328316}···409397410398err_free_vectors:411399 if (msi_irq)412412- pci_free_irq_vectors(pdev);400400+ proc_thermal_free_msi(pdev, pci_info);413401err_ret_tzone:414402 thermal_zone_device_unregister(pci_info->tzone);415403err_del_legacy:···430418431419 proc_thermal_mmio_write(pci_info, PROC_THERMAL_MMIO_THRES_0, 0);432420 proc_thermal_mmio_write(pci_info, PROC_THERMAL_MMIO_INT_ENABLE_0, 0);421421+422422+ if (msi_irq)423423+ proc_thermal_free_msi(pdev, pci_info);433424434425 thermal_zone_device_unregister(pci_info->tzone);435426 proc_thermal_mmio_remove(pdev, pci_info->proc_priv);
+2-2
drivers/thermal/thermal_trip.c
···8888 return;89899090 for_each_trip_desc(tz, td) {9191- if (td->threshold < tz->temperature && td->threshold > low)9191+ if (td->threshold <= tz->temperature && td->threshold > low)9292 low = td->threshold;93939494- if (td->threshold > tz->temperature && td->threshold < high)9494+ if (td->threshold >= tz->temperature && td->threshold < high)9595 high = td->threshold;9696 }9797
+15-10
drivers/tty/serial/sc16is7xx.c
···327327 struct kthread_work reg_work;328328 struct kthread_delayed_work ms_work;329329 struct sc16is7xx_one_config config;330330+ unsigned char buf[SC16IS7XX_FIFO_SIZE]; /* Rx buffer. */330331 unsigned int old_mctrl;331332 u8 old_lcr; /* Value before EFR access. */332333 bool irda_mode;···341340 unsigned long gpio_valid_mask;342341#endif343342 u8 mctrl_mask;344344- unsigned char buf[SC16IS7XX_FIFO_SIZE];345343 struct kthread_worker kworker;346344 struct task_struct *kworker_task;347345 struct sc16is7xx_one p[];···592592 SC16IS7XX_MCR_CLKSEL_BIT,593593 prescaler == 1 ? 0 : SC16IS7XX_MCR_CLKSEL_BIT);594594595595+ mutex_lock(&one->efr_lock);596596+595597 /* Backup LCR and access special register set (DLL/DLH) */596598 lcr = sc16is7xx_port_read(port, SC16IS7XX_LCR_REG);597599 sc16is7xx_port_write(port, SC16IS7XX_LCR_REG,···608606 /* Restore LCR and access to general register set */609607 sc16is7xx_port_write(port, SC16IS7XX_LCR_REG, lcr);610608609609+ mutex_unlock(&one->efr_lock);610610+611611 return DIV_ROUND_CLOSEST((clk / prescaler) / 16, div);612612}613613614614static void sc16is7xx_handle_rx(struct uart_port *port, unsigned int rxlen,615615 unsigned int iir)616616{617617- struct sc16is7xx_port *s = dev_get_drvdata(port->dev);617617+ struct sc16is7xx_one *one = to_sc16is7xx_one(port, port);618618 unsigned int lsr = 0, bytes_read, i;619619 bool read_lsr = (iir == SC16IS7XX_IIR_RLSE_SRC) ? true : false;620620 u8 ch, flag;621621622622- if (unlikely(rxlen >= sizeof(s->buf))) {622622+ if (unlikely(rxlen >= sizeof(one->buf))) {623623 dev_warn_ratelimited(port->dev,624624 "ttySC%i: Possible RX FIFO overrun: %d\n",625625 port->line, rxlen);626626 port->icount.buf_overrun++;627627 /* Ensure sanity of RX level */628628- rxlen = sizeof(s->buf);628628+ rxlen = sizeof(one->buf);629629 }630630631631 while (rxlen) {···640636 lsr = 0;641637642638 if (read_lsr) {643643- s->buf[0] = sc16is7xx_port_read(port, SC16IS7XX_RHR_REG);639639+ one->buf[0] = sc16is7xx_port_read(port, SC16IS7XX_RHR_REG);644640 bytes_read = 1;645641 } else {646646- sc16is7xx_fifo_read(port, s->buf, rxlen);642642+ sc16is7xx_fifo_read(port, one->buf, rxlen);647643 bytes_read = rxlen;648644 }649645···676672 }677673678674 for (i = 0; i < bytes_read; ++i) {679679- ch = s->buf[i];675675+ ch = one->buf[i];680676 if (uart_handle_sysrq_char(port, ch))681677 continue;682678···694690695691static void sc16is7xx_handle_tx(struct uart_port *port)696692{697697- struct sc16is7xx_port *s = dev_get_drvdata(port->dev);698693 struct tty_port *tport = &port->state->port;699694 unsigned long flags;700695 unsigned int txlen;696696+ unsigned char *tail;701697702698 if (unlikely(port->x_char)) {703699 sc16is7xx_port_write(port, SC16IS7XX_THR_REG, port->x_char);···722718 txlen = 0;723719 }724720725725- txlen = uart_fifo_out(port, s->buf, txlen);726726- sc16is7xx_fifo_write(port, s->buf, txlen);721721+ txlen = kfifo_out_linear_ptr(&tport->xmit_fifo, &tail, txlen);722722+ sc16is7xx_fifo_write(port, tail, txlen);723723+ uart_xmit_advance(port, txlen);727724728725 uart_port_lock_irqsave(port, &flags);729726 if (kfifo_len(&tport->xmit_fifo) < WAKEUP_CHARS)
+8
drivers/tty/serial/serial_core.c
···881881 new_flags = (__force upf_t)new_info->flags;882882 old_custom_divisor = uport->custom_divisor;883883884884+ if (!(uport->flags & UPF_FIXED_PORT)) {885885+ unsigned int uartclk = new_info->baud_base * 16;886886+ /* check needs to be done here before other settings made */887887+ if (uartclk == 0) {888888+ retval = -EINVAL;889889+ goto exit;890890+ }891891+ }884892 if (!capable(CAP_SYS_ADMIN)) {885893 retval = -EPERM;886894 if (change_irq || change_port ||
+7-13
drivers/tty/vt/conmakehash.c
···1111 * Copyright (C) 1995-1997 H. Peter Anvin1212 */13131414+#include <libgen.h>1515+#include <linux/limits.h>1416#include <stdio.h>1517#include <stdlib.h>1618#include <sysexits.h>···7876int main(int argc, char *argv[])7977{8078 FILE *ctbl;8181- const char *tblname, *rel_tblname;8282- const char *abs_srctree;7979+ const char *tblname;8080+ char base_tblname[PATH_MAX];8381 char buffer[65536];8482 int fontlen;8583 int i, nuni, nent;···103101 exit(EX_NOINPUT);104102 }105103 }106106-107107- abs_srctree = getenv("abs_srctree");108108- if (abs_srctree && !strncmp(abs_srctree, tblname, strlen(abs_srctree)))109109- {110110- rel_tblname = tblname + strlen(abs_srctree);111111- while (*rel_tblname == '/')112112- ++rel_tblname;113113- }114114- else115115- rel_tblname = tblname;116104117105 /* For now we assume the default font is always 256 characters. */118106 fontlen = 256;···245253 for ( i = 0 ; i < fontlen ; i++ )246254 nuni += unicount[i];247255256256+ strncpy(base_tblname, tblname, PATH_MAX);257257+ base_tblname[PATH_MAX - 1] = 0;248258 printf("\249259/*\n\250260 * Do not edit this file; it was automatically generated by\n\···258264#include <linux/types.h>\n\259265\n\260266u8 dfont_unicount[%d] = \n\261261-{\n\t", rel_tblname, fontlen);267267+{\n\t", basename(base_tblname), fontlen);262268263269 for ( i = 0 ; i < fontlen ; i++ )264270 {
+5
drivers/ufs/core/ufshcd-priv.h
···316316 return pm_runtime_get_sync(&hba->ufs_device_wlun->sdev_gendev);317317}318318319319+static inline int ufshcd_rpm_get_if_active(struct ufs_hba *hba)320320+{321321+ return pm_runtime_get_if_active(&hba->ufs_device_wlun->sdev_gendev);322322+}323323+319324static inline int ufshcd_rpm_put_sync(struct ufs_hba *hba)320325{321326 return pm_runtime_put_sync(&hba->ufs_device_wlun->sdev_gendev);
+30-8
drivers/ufs/core/ufshcd.c
···24162416 return err;24172417 }2418241824192419+ /*24202420+ * The UFSHCI 3.0 specification does not define MCQ_SUPPORT and24212421+ * LSDB_SUPPORT, but [31:29] as reserved bits with reset value 0s, which24222422+ * means we can simply read values regardless of version.24232423+ */24192424 hba->mcq_sup = FIELD_GET(MASK_MCQ_SUPPORT, hba->capabilities);24252425+ /*24262426+ * 0h: legacy single doorbell support is available24272427+ * 1h: indicate that legacy single doorbell support has been removed24282428+ */24292429+ hba->lsdb_sup = !FIELD_GET(MASK_LSDB_SUPPORT, hba->capabilities);24202430 if (!hba->mcq_sup)24212431 return 0;24222432···41004090 min_sleep_time_us =41014091 MIN_DELAY_BEFORE_DME_CMDS_US - delta;41024092 else41034103- return; /* no more delay required */40934093+ min_sleep_time_us = 0; /* no more delay required */41044094 }4105409541064106- /* allow sleep for extra 50us if needed */41074107- usleep_range(min_sleep_time_us, min_sleep_time_us + 50);40964096+ if (min_sleep_time_us > 0) {40974097+ /* allow sleep for extra 50us if needed */40984098+ usleep_range(min_sleep_time_us, min_sleep_time_us + 50);40994099+ }41004100+41014101+ /* update the last_dme_cmd_tstamp */41024102+ hba->last_dme_cmd_tstamp = ktime_get();41084103}4109410441104105/**···65686553 if (ufshcd_err_handling_should_stop(hba))65696554 goto skip_err_handling;6570655565716571- if (hba->dev_quirks & UFS_DEVICE_QUIRK_RECOVERY_FROM_DL_NAC_ERRORS) {65566556+ if ((hba->dev_quirks & UFS_DEVICE_QUIRK_RECOVERY_FROM_DL_NAC_ERRORS) &&65576557+ !hba->force_reset) {65726558 bool ret;6573655965746560 spin_unlock_irqrestore(hba->host->host_lock, flags);···82278211 */82288212 val = ts64.tv_sec - hba->dev_info.rtc_time_baseline;8229821382308230- ufshcd_rpm_get_sync(hba);82148214+ /* Skip update RTC if RPM state is not RPM_ACTIVE */82158215+ if (ufshcd_rpm_get_if_active(hba) <= 0)82168216+ return;82178217+82318218 err = ufshcd_query_attr(hba, UPIU_QUERY_OPCODE_WRITE_ATTR, QUERY_ATTR_IDN_SECONDS_PASSED,82328219 0, 0, &val);82338220 ufshcd_rpm_put_sync(hba);···1028410265 */1028510266 ufshcd_readl(hba, REG_UTP_TASK_REQ_LIST_BASE_H);10286102671028710287- /* Resuming from hibernate, assume that link was OFF */1028810288- ufshcd_set_link_off(hba);1028910289-1029010268 return 0;10291102691029210270}···1051210496 }10513104971051410498 if (!is_mcq_supported(hba)) {1049910499+ if (!hba->lsdb_sup) {1050010500+ dev_err(hba->dev, "%s: failed to initialize (legacy doorbell mode not supported)\n",1050110501+ __func__);1050210502+ err = -EINVAL;1050310503+ goto out_disable;1050410504+ }1051510505 err = scsi_add_host(host, hba->dev);1051610506 if (err) {1051710507 dev_err(hba->dev, "scsi_add_host failed\n");
+3
drivers/ufs/host/ufs-exynos.c
···12931293{12941294 struct arm_smccc_res res;1295129512961296+ if (!(hba->caps & UFSHCD_CAP_CRYPTO))12971297+ return;12981298+12961299 arm_smccc_smc(SMC_CMD_FMP_SECURITY, 0, SMU_EMBEDDED, CFG_DESCTYPE_3,12971300 0, 0, 0, 0, &res);12981301 if (res.a0)
+20-12
drivers/usb/gadget/function/f_fs.c
···37343734 if (alt > MAX_ALT_SETTINGS)37353735 return -EINVAL;3736373637373737- if (alt != (unsigned)-1) {37383738- intf = ffs_func_revmap_intf(func, interface);37393739- if (intf < 0)37403740- return intf;37413741- }37373737+ intf = ffs_func_revmap_intf(func, interface);37383738+ if (intf < 0)37393739+ return intf;3742374037433741 if (ffs->func)37443742 ffs_func_eps_disable(ffs->func);···37513753 if (ffs->state != FFS_ACTIVE)37523754 return -ENODEV;3753375537543754- if (alt == (unsigned)-1) {37553755- ffs->func = NULL;37563756- ffs_event_add(ffs, FUNCTIONFS_DISABLE);37573757- return 0;37583758- }37593759-37603756 ffs->func = func;37613757 ret = ffs_func_eps_enable(func);37623758 if (ret >= 0) {···3762377037633771static void ffs_func_disable(struct usb_function *f)37643772{37653765- ffs_func_set_alt(f, 0, (unsigned)-1);37733773+ struct ffs_function *func = ffs_func_from_usb(f);37743774+ struct ffs_data *ffs = func->ffs;37753775+37763776+ if (ffs->func)37773777+ ffs_func_eps_disable(ffs->func);37783778+37793779+ if (ffs->state == FFS_DEACTIVATED) {37803780+ ffs->state = FFS_CLOSING;37813781+ INIT_WORK(&ffs->reset_work, ffs_reset_work);37823782+ schedule_work(&ffs->reset_work);37833783+ return;37843784+ }37853785+37863786+ if (ffs->state == FFS_ACTIVE) {37873787+ ffs->func = NULL;37883788+ ffs_event_add(ffs, FUNCTIONFS_DISABLE);37893789+ }37663790}3767379137683792static int ffs_func_setup(struct usb_function *f,
+15-6
drivers/usb/gadget/function/f_midi2.c
···642642 if (format)643643 return; // invalid644644 blk = (*data >> 8) & 0xff;645645- if (blk >= ep->num_blks)646646- return;647647- if (*data & UMP_STREAM_MSG_REQUEST_FB_INFO)648648- reply_ump_stream_fb_info(ep, blk);649649- if (*data & UMP_STREAM_MSG_REQUEST_FB_NAME)650650- reply_ump_stream_fb_name(ep, blk);645645+ if (blk == 0xff) {646646+ /* inquiry for all blocks */647647+ for (blk = 0; blk < ep->num_blks; blk++) {648648+ if (*data & UMP_STREAM_MSG_REQUEST_FB_INFO)649649+ reply_ump_stream_fb_info(ep, blk);650650+ if (*data & UMP_STREAM_MSG_REQUEST_FB_NAME)651651+ reply_ump_stream_fb_name(ep, blk);652652+ }653653+ } else if (blk < ep->num_blks) {654654+ /* only the specified block */655655+ if (*data & UMP_STREAM_MSG_REQUEST_FB_INFO)656656+ reply_ump_stream_fb_info(ep, blk);657657+ if (*data & UMP_STREAM_MSG_REQUEST_FB_NAME)658658+ reply_ump_stream_fb_name(ep, blk);659659+ }651660 return;652661 }653662}
+34-8
drivers/usb/gadget/function/u_audio.c
···592592 struct usb_ep *ep, *ep_fback;593593 struct uac_rtd_params *prm;594594 struct uac_params *params = &audio_dev->params;595595- int req_len, i;595595+ int req_len, i, ret;596596597597 prm = &uac->c_prm;598598 dev_dbg(dev, "start capture with rate %d\n", prm->srate);599599 ep = audio_dev->out_ep;600600- config_ep_by_speed(gadget, &audio_dev->func, ep);600600+ ret = config_ep_by_speed(gadget, &audio_dev->func, ep);601601+ if (ret < 0) {602602+ dev_err(dev, "config_ep_by_speed for out_ep failed (%d)\n", ret);603603+ return ret;604604+ }605605+601606 req_len = ep->maxpacket;602607603608 prm->ep_enabled = true;604604- usb_ep_enable(ep);609609+ ret = usb_ep_enable(ep);610610+ if (ret < 0) {611611+ dev_err(dev, "usb_ep_enable failed for out_ep (%d)\n", ret);612612+ return ret;613613+ }605614606615 for (i = 0; i < params->req_number; i++) {607616 if (!prm->reqs[i]) {···638629 return 0;639630640631 /* Setup feedback endpoint */641641- config_ep_by_speed(gadget, &audio_dev->func, ep_fback);632632+ ret = config_ep_by_speed(gadget, &audio_dev->func, ep_fback);633633+ if (ret < 0) {634634+ dev_err(dev, "config_ep_by_speed in_ep_fback failed (%d)\n", ret);635635+ return ret; // TODO: Clean up out_ep636636+ }637637+642638 prm->fb_ep_enabled = true;643643- usb_ep_enable(ep_fback);639639+ ret = usb_ep_enable(ep_fback);640640+ if (ret < 0) {641641+ dev_err(dev, "usb_ep_enable failed for in_ep_fback (%d)\n", ret);642642+ return ret; // TODO: Clean up out_ep643643+ }644644 req_len = ep_fback->maxpacket;645645646646 req_fback = usb_ep_alloc_request(ep_fback, GFP_ATOMIC);···705687 struct uac_params *params = &audio_dev->params;706688 unsigned int factor;707689 const struct usb_endpoint_descriptor *ep_desc;708708- int req_len, i;690690+ int req_len, i, ret;709691 unsigned int p_pktsize;710692711693 prm = &uac->p_prm;712694 dev_dbg(dev, "start playback with rate %d\n", prm->srate);713695 ep = audio_dev->in_ep;714714- config_ep_by_speed(gadget, &audio_dev->func, ep);696696+ ret = config_ep_by_speed(gadget, &audio_dev->func, ep);697697+ if (ret < 0) {698698+ dev_err(dev, "config_ep_by_speed for in_ep failed (%d)\n", ret);699699+ return ret;700700+ }715701716702 ep_desc = ep->desc;717703 /*···742720 uac->p_residue_mil = 0;743721744722 prm->ep_enabled = true;745745- usb_ep_enable(ep);723723+ ret = usb_ep_enable(ep);724724+ if (ret < 0) {725725+ dev_err(dev, "usb_ep_enable failed for in_ep (%d)\n", ret);726726+ return ret;727727+ }746728747729 for (i = 0; i < params->req_number; i++) {748730 if (!prm->reqs[i]) {
···118118 goto out;119119120120 /* UDC drivers can't handle endpoints with maxpacket size 0 */121121- if (usb_endpoint_maxp(ep->desc) == 0) {122122- /*123123- * We should log an error message here, but we can't call124124- * dev_err() because there's no way to find the gadget125125- * given only ep.126126- */121121+ if (!ep->desc || usb_endpoint_maxp(ep->desc) == 0) {122122+ WARN_ONCE(1, "%s: ep%d (%s) has %s\n", __func__, ep->address, ep->name,123123+ (!ep->desc) ? "NULL descriptor" : "maxpacket 0");124124+127125 ret = -EINVAL;128126 goto out;129127 }
+1
drivers/usb/serial/ch341.c
···863863864864module_usb_serial_driver(serial_drivers, id_table);865865866866+MODULE_DESCRIPTION("Winchiphead CH341 USB Serial driver");866867MODULE_LICENSE("GPL v2");
+2-3
drivers/usb/serial/garmin_gps.c
···104104 int seq;105105 /* the real size of the data array, always > 0 */106106 int size;107107- __u8 data[];107107+ __u8 data[] __counted_by(size);108108};109109110110/* structure used to keep the current state of the driver */···267267268268 /* process only packets containing data ... */269269 if (data_length) {270270- pkt = kmalloc(sizeof(struct garmin_packet)+data_length,271271- GFP_ATOMIC);270270+ pkt = kmalloc(struct_size(pkt, data, data_length), GFP_ATOMIC);272271 if (!pkt)273272 return 0;274273
+1
drivers/usb/serial/mxuport.c
···1315131513161316MODULE_AUTHOR("Andrew Lunn <andrew@lunn.ch>");13171317MODULE_AUTHOR("<support@moxa.com>");13181318+MODULE_DESCRIPTION("Moxa UPORT USB Serial driver");13181319MODULE_LICENSE("GPL");
+1
drivers/usb/serial/navman.c
···112112113113module_usb_serial_driver(serial_drivers, id_table);114114115115+MODULE_DESCRIPTION("Navman USB Serial driver");115116MODULE_LICENSE("GPL v2");
+1
drivers/usb/serial/qcaux.c
···8484};85858686module_usb_serial_driver(serial_drivers, id_table);8787+MODULE_DESCRIPTION("Qualcomm USB Auxiliary Serial Port driver");8788MODULE_LICENSE("GPL v2");
···190190191191module_usb_serial_driver(serial_drivers, id_table);192192193193+MODULE_DESCRIPTION("Symbol USB barcode to serial driver");193194MODULE_LICENSE("GPL v2");
+1
drivers/usb/serial/usb-serial-simple.c
···163163MODULE_DEVICE_TABLE(usb, id_table);164164165165module_usb_serial_driver(serial_drivers, id_table);166166+MODULE_DESCRIPTION("USB Serial 'Simple' driver");166167MODULE_LICENSE("GPL v2");
···305305 if (err)306306 goto err;307307308308- if (dev->config->create_avq) {309309- err = dev->config->create_avq(dev);310310- if (err)311311- goto err;312312- }313313-314308 err = drv->probe(dev);315309 if (err)316316- goto err_probe;310310+ goto err;317311318312 /* If probe didn't do it, mark device DRIVER_OK ourselves. */319313 if (!(dev->config->get_status(dev) & VIRTIO_CONFIG_S_DRIVER_OK))···320326321327 return 0;322328323323-err_probe:324324- if (dev->config->destroy_avq)325325- dev->config->destroy_avq(dev);326329err:327330 virtio_add_status(dev, VIRTIO_CONFIG_S_FAILED);328331 return err;···334343 virtio_config_disable(dev);335344336345 drv->remove(dev);337337-338338- if (dev->config->destroy_avq)339339- dev->config->destroy_avq(dev);340346341347 /* Driver should have reset device. */342348 WARN_ON_ONCE(dev->config->get_status(dev));···512524 }513525 }514526515515- if (dev->config->destroy_avq)516516- dev->config->destroy_avq(dev);517517-518527 return 0;519528}520529EXPORT_SYMBOL_GPL(virtio_device_freeze);···547562 if (ret)548563 goto err;549564550550- if (dev->config->create_avq) {551551- ret = dev->config->create_avq(dev);552552- if (ret)553553- goto err;554554- }555555-556565 if (drv->restore) {557566 ret = drv->restore(dev);558567 if (ret)559559- goto err_restore;568568+ goto err;560569 }561570562571 /* If restore didn't do it, mark device DRIVER_OK ourselves. */···561582562583 return 0;563584564564-err_restore:565565- if (dev->config->destroy_avq)566566- dev->config->destroy_avq(dev);567585err:568586 virtio_add_status(dev, VIRTIO_CONFIG_S_FAILED);569587 return ret;
+151-41
drivers/virtio/virtio_pci_common.c
···4646 return true;4747}48484949+/* Notify all slow path virtqueues on an interrupt. */5050+static void vp_vring_slow_path_interrupt(int irq,5151+ struct virtio_pci_device *vp_dev)5252+{5353+ struct virtio_pci_vq_info *info;5454+ unsigned long flags;5555+5656+ spin_lock_irqsave(&vp_dev->lock, flags);5757+ list_for_each_entry(info, &vp_dev->slow_virtqueues, node)5858+ vring_interrupt(irq, info->vq);5959+ spin_unlock_irqrestore(&vp_dev->lock, flags);6060+}6161+4962/* Handle a configuration change: Tell driver if it wants to know. */5063static irqreturn_t vp_config_changed(int irq, void *opaque)5164{5265 struct virtio_pci_device *vp_dev = opaque;53665467 virtio_config_changed(&vp_dev->vdev);6868+ vp_vring_slow_path_interrupt(irq, vp_dev);5569 return IRQ_HANDLED;5670}5771···139125 GFP_KERNEL))140126 goto error;141127128128+ if (!per_vq_vectors)129129+ desc = NULL;130130+142131 if (desc) {143132 flags |= PCI_IRQ_AFFINITY;144133 desc->pre_vectors++; /* virtio config vector */···188171 return err;189172}190173174174+static bool vp_is_slow_path_vector(u16 msix_vec)175175+{176176+ return msix_vec == VP_MSIX_CONFIG_VECTOR;177177+}178178+191179static struct virtqueue *vp_setup_vq(struct virtio_device *vdev, unsigned int index,192180 void (*callback)(struct virtqueue *vq),193181 const char *name,194182 bool ctx,195195- u16 msix_vec)183183+ u16 msix_vec,184184+ struct virtio_pci_vq_info **p_info)196185{197186 struct virtio_pci_device *vp_dev = to_vp_device(vdev);198187 struct virtio_pci_vq_info *info = kmalloc(sizeof *info, GFP_KERNEL);···217194 info->vq = vq;218195 if (callback) {219196 spin_lock_irqsave(&vp_dev->lock, flags);220220- list_add(&info->node, &vp_dev->virtqueues);197197+ if (!vp_is_slow_path_vector(msix_vec))198198+ list_add(&info->node, &vp_dev->virtqueues);199199+ else200200+ list_add(&info->node, &vp_dev->slow_virtqueues);221201 spin_unlock_irqrestore(&vp_dev->lock, flags);222202 } else {223203 INIT_LIST_HEAD(&info->node);224204 }225205226226- vp_dev->vqs[index] = info;206206+ *p_info = info;227207 return vq;228208229209out_info:···262236 int i;263237264238 list_for_each_entry_safe(vq, n, &vdev->vqs, list) {265265- if (vp_dev->is_avq && vp_dev->is_avq(vdev, vq->index))266266- continue;267267-268239 if (vp_dev->per_vq_vectors) {269240 int v = vp_dev->vqs[vq->index]->msix_vector;270241271271- if (v != VIRTIO_MSI_NO_VECTOR) {242242+ if (v != VIRTIO_MSI_NO_VECTOR &&243243+ !vp_is_slow_path_vector(v)) {272244 int irq = pci_irq_vector(vp_dev->pci_dev, v);273245274246 irq_update_affinity_hint(irq, NULL);···308284 vp_dev->vqs = NULL;309285}310286287287+enum vp_vq_vector_policy {288288+ VP_VQ_VECTOR_POLICY_EACH,289289+ VP_VQ_VECTOR_POLICY_SHARED_SLOW,290290+ VP_VQ_VECTOR_POLICY_SHARED,291291+};292292+293293+static struct virtqueue *294294+vp_find_one_vq_msix(struct virtio_device *vdev, int queue_idx,295295+ vq_callback_t *callback, const char *name, bool ctx,296296+ bool slow_path, int *allocated_vectors,297297+ enum vp_vq_vector_policy vector_policy,298298+ struct virtio_pci_vq_info **p_info)299299+{300300+ struct virtio_pci_device *vp_dev = to_vp_device(vdev);301301+ struct virtqueue *vq;302302+ u16 msix_vec;303303+ int err;304304+305305+ if (!callback)306306+ msix_vec = VIRTIO_MSI_NO_VECTOR;307307+ else if (vector_policy == VP_VQ_VECTOR_POLICY_EACH ||308308+ (vector_policy == VP_VQ_VECTOR_POLICY_SHARED_SLOW &&309309+ !slow_path))310310+ msix_vec = (*allocated_vectors)++;311311+ else if (vector_policy != VP_VQ_VECTOR_POLICY_EACH &&312312+ slow_path)313313+ msix_vec = VP_MSIX_CONFIG_VECTOR;314314+ else315315+ msix_vec = VP_MSIX_VQ_VECTOR;316316+ vq = vp_setup_vq(vdev, queue_idx, callback, name, ctx, msix_vec,317317+ p_info);318318+ if (IS_ERR(vq))319319+ return vq;320320+321321+ if (vector_policy == VP_VQ_VECTOR_POLICY_SHARED ||322322+ msix_vec == VIRTIO_MSI_NO_VECTOR ||323323+ vp_is_slow_path_vector(msix_vec))324324+ return vq;325325+326326+ /* allocate per-vq irq if available and necessary */327327+ snprintf(vp_dev->msix_names[msix_vec], sizeof(*vp_dev->msix_names),328328+ "%s-%s", dev_name(&vp_dev->vdev.dev), name);329329+ err = request_irq(pci_irq_vector(vp_dev->pci_dev, msix_vec),330330+ vring_interrupt, 0,331331+ vp_dev->msix_names[msix_vec], vq);332332+ if (err) {333333+ vp_del_vq(vq);334334+ return ERR_PTR(err);335335+ }336336+337337+ return vq;338338+}339339+311340static int vp_find_vqs_msix(struct virtio_device *vdev, unsigned int nvqs,312341 struct virtqueue *vqs[],313342 struct virtqueue_info vqs_info[],314314- bool per_vq_vectors,343343+ enum vp_vq_vector_policy vector_policy,315344 struct irq_affinity *desc)316345{317346 struct virtio_pci_device *vp_dev = to_vp_device(vdev);347347+ struct virtio_pci_admin_vq *avq = &vp_dev->admin_vq;318348 struct virtqueue_info *vqi;319319- u16 msix_vec;320349 int i, err, nvectors, allocated_vectors, queue_idx = 0;350350+ struct virtqueue *vq;351351+ bool per_vq_vectors;352352+ u16 avq_num = 0;321353322354 vp_dev->vqs = kcalloc(nvqs, sizeof(*vp_dev->vqs), GFP_KERNEL);323355 if (!vp_dev->vqs)324356 return -ENOMEM;357357+358358+ if (vp_dev->avq_index) {359359+ err = vp_dev->avq_index(vdev, &avq->vq_index, &avq_num);360360+ if (err)361361+ goto error_find;362362+ }363363+364364+ per_vq_vectors = vector_policy != VP_VQ_VECTOR_POLICY_SHARED;325365326366 if (per_vq_vectors) {327367 /* Best option: one for change interrupt, one per vq. */···395307 if (vqi->name && vqi->callback)396308 ++nvectors;397309 }310310+ if (avq_num && vector_policy == VP_VQ_VECTOR_POLICY_EACH)311311+ ++nvectors;398312 } else {399313 /* Second best: one for change, shared for all vqs. */400314 nvectors = 2;401315 }402316403403- err = vp_request_msix_vectors(vdev, nvectors, per_vq_vectors,404404- per_vq_vectors ? desc : NULL);317317+ err = vp_request_msix_vectors(vdev, nvectors, per_vq_vectors, desc);405318 if (err)406319 goto error_find;407320···414325 vqs[i] = NULL;415326 continue;416327 }417417-418418- if (!vqi->callback)419419- msix_vec = VIRTIO_MSI_NO_VECTOR;420420- else if (vp_dev->per_vq_vectors)421421- msix_vec = allocated_vectors++;422422- else423423- msix_vec = VP_MSIX_VQ_VECTOR;424424- vqs[i] = vp_setup_vq(vdev, queue_idx++, vqi->callback,425425- vqi->name, vqi->ctx, msix_vec);328328+ vqs[i] = vp_find_one_vq_msix(vdev, queue_idx++, vqi->callback,329329+ vqi->name, vqi->ctx, false,330330+ &allocated_vectors, vector_policy,331331+ &vp_dev->vqs[i]);426332 if (IS_ERR(vqs[i])) {427333 err = PTR_ERR(vqs[i]);428334 goto error_find;429335 }430430-431431- if (!vp_dev->per_vq_vectors || msix_vec == VIRTIO_MSI_NO_VECTOR)432432- continue;433433-434434- /* allocate per-vq irq if available and necessary */435435- snprintf(vp_dev->msix_names[msix_vec],436436- sizeof *vp_dev->msix_names,437437- "%s-%s",438438- dev_name(&vp_dev->vdev.dev), vqi->name);439439- err = request_irq(pci_irq_vector(vp_dev->pci_dev, msix_vec),440440- vring_interrupt, 0,441441- vp_dev->msix_names[msix_vec],442442- vqs[i]);443443- if (err) {444444- vp_del_vq(vqs[i]);445445- goto error_find;446446- }447336 }337337+338338+ if (!avq_num)339339+ return 0;340340+ sprintf(avq->name, "avq.%u", avq->vq_index);341341+ vq = vp_find_one_vq_msix(vdev, avq->vq_index, vp_modern_avq_done,342342+ avq->name, false, true, &allocated_vectors,343343+ vector_policy, &vp_dev->admin_vq.info);344344+ if (IS_ERR(vq)) {345345+ err = PTR_ERR(vq);346346+ goto error_find;347347+ }348348+448349 return 0;449350450351error_find:···447368 struct virtqueue_info vqs_info[])448369{449370 struct virtio_pci_device *vp_dev = to_vp_device(vdev);371371+ struct virtio_pci_admin_vq *avq = &vp_dev->admin_vq;450372 int i, err, queue_idx = 0;373373+ struct virtqueue *vq;374374+ u16 avq_num = 0;451375452376 vp_dev->vqs = kcalloc(nvqs, sizeof(*vp_dev->vqs), GFP_KERNEL);453377 if (!vp_dev->vqs)454378 return -ENOMEM;379379+380380+ if (vp_dev->avq_index) {381381+ err = vp_dev->avq_index(vdev, &avq->vq_index, &avq_num);382382+ if (err)383383+ goto out_del_vqs;384384+ }455385456386 err = request_irq(vp_dev->pci_dev->irq, vp_interrupt, IRQF_SHARED,457387 dev_name(&vdev->dev), vp_dev);···478390 }479391 vqs[i] = vp_setup_vq(vdev, queue_idx++, vqi->callback,480392 vqi->name, vqi->ctx,481481- VIRTIO_MSI_NO_VECTOR);393393+ VIRTIO_MSI_NO_VECTOR, &vp_dev->vqs[i]);482394 if (IS_ERR(vqs[i])) {483395 err = PTR_ERR(vqs[i]);484396 goto out_del_vqs;485397 }398398+ }399399+400400+ if (!avq_num)401401+ return 0;402402+ sprintf(avq->name, "avq.%u", avq->vq_index);403403+ vq = vp_setup_vq(vdev, queue_idx++, vp_modern_avq_done, avq->name,404404+ false, VIRTIO_MSI_NO_VECTOR,405405+ &vp_dev->admin_vq.info);406406+ if (IS_ERR(vq)) {407407+ err = PTR_ERR(vq);408408+ goto out_del_vqs;486409 }487410488411 return 0;···510411 int err;511412512413 /* Try MSI-X with one vector per queue. */513513- err = vp_find_vqs_msix(vdev, nvqs, vqs, vqs_info, true, desc);414414+ err = vp_find_vqs_msix(vdev, nvqs, vqs, vqs_info,415415+ VP_VQ_VECTOR_POLICY_EACH, desc);416416+ if (!err)417417+ return 0;418418+ /* Fallback: MSI-X with one shared vector for config and419419+ * slow path queues, one vector per queue for the rest.420420+ */421421+ err = vp_find_vqs_msix(vdev, nvqs, vqs, vqs_info,422422+ VP_VQ_VECTOR_POLICY_SHARED_SLOW, desc);514423 if (!err)515424 return 0;516425 /* Fallback: MSI-X with one vector for config, one shared for queues. */517517- err = vp_find_vqs_msix(vdev, nvqs, vqs, vqs_info, false, desc);426426+ err = vp_find_vqs_msix(vdev, nvqs, vqs, vqs_info,427427+ VP_VQ_VECTOR_POLICY_SHARED, desc);518428 if (!err)519429 return 0;520430 /* Is there an interrupt? If not give up. */···574466 struct virtio_pci_device *vp_dev = to_vp_device(vdev);575467576468 if (!vp_dev->per_vq_vectors ||577577- vp_dev->vqs[index]->msix_vector == VIRTIO_MSI_NO_VECTOR)469469+ vp_dev->vqs[index]->msix_vector == VIRTIO_MSI_NO_VECTOR ||470470+ vp_is_slow_path_vector(vp_dev->vqs[index]->msix_vector))578471 return NULL;579472580473 return pci_irq_get_affinity(vp_dev->pci_dev,···683574 vp_dev->vdev.dev.release = virtio_pci_release_dev;684575 vp_dev->pci_dev = pci_dev;685576 INIT_LIST_HEAD(&vp_dev->virtqueues);577577+ INIT_LIST_HEAD(&vp_dev->slow_virtqueues);686578 spin_lock_init(&vp_dev->lock);687579688580 /* enable the device */
+10-6
drivers/virtio/virtio_pci_common.h
···3535 /* the actual virtqueue */3636 struct virtqueue *vq;37373838- /* the list node for the virtqueues list */3838+ /* the list node for the virtqueues or slow_virtqueues list */3939 struct list_head node;40404141 /* MSI-X vector (or none) */···44444545struct virtio_pci_admin_vq {4646 /* Virtqueue info associated with this admin queue. */4747- struct virtio_pci_vq_info info;4848- /* serializing admin commands execution and virtqueue deletion */4949- struct mutex cmd_lock;4747+ struct virtio_pci_vq_info *info;4848+ /* Protects virtqueue access. */4949+ spinlock_t lock;5050 u64 supported_cmds;5151 /* Name of the admin queue: avq.$vq_index. */5252 char name[10];···6666 /* Where to read and clear interrupt */6767 u8 __iomem *isr;68686969- /* a list of queues so we can dispatch IRQs */6969+ /* Lists of queues and potentially slow path queues7070+ * so we can dispatch IRQs.7171+ */7072 spinlock_t lock;7173 struct list_head virtqueues;7474+ struct list_head slow_virtqueues;72757376 /* Array of all virtqueues reported in the7477 * PCI common config num_queues field···105102 void (*del_vq)(struct virtio_pci_vq_info *info);106103107104 u16 (*config_vector)(struct virtio_pci_device *vp_dev, u16 vector);108108- bool (*is_avq)(struct virtio_device *vdev, unsigned int index);105105+ int (*avq_index)(struct virtio_device *vdev, u16 *index, u16 *num);109106};110107111108/* Constants for MSI-X */···178175#define VIRTIO_ADMIN_CMD_BITMAP 0179176#endif180177178178+void vp_modern_avq_done(struct virtqueue *vq);181179int vp_modern_admin_cmd_exec(struct virtio_device *vdev,182180 struct virtio_admin_cmd *cmd);183181
···8282 bucket_data_type(bucket) != bucket_data_type(ptr);8383}84848585+/*8686+ * It is my general preference to use unsigned types for unsigned quantities -8787+ * however, these helpers are used in disk accounting calculations run by8888+ * triggers where the output will be negated and added to an s64. unsigned is8989+ * right out even though all these quantities will fit in 32 bits, since it9090+ * won't be sign extended correctly; u64 will negate "correctly", but s64 is the9191+ * simpler option here.9292+ */8593static inline s64 bch2_bucket_sectors_total(struct bch_alloc_v4 a)8694{8795 return a.stripe_sectors + a.dirty_sectors + a.cached_sectors;···174166 * avoid overflowing LRU_TIME_BITS on a corrupted fs, when175167 * bucket_sectors_dirty is (much) bigger than bucket_size176168 */177177- u64 d = min(bch2_bucket_sectors_dirty(a),178178- ca->mi.bucket_size);169169+ u64 d = min_t(s64, bch2_bucket_sectors_dirty(a),170170+ ca->mi.bucket_size);179171180172 return div_u64(d * (1ULL << 31), ca->mi.bucket_size);181173}
···856856 * So here we disable page faults in the iov_iter and then retry if we857857 * got -EFAULT, faulting in the pages before the retry.858858 */859859+again:859860 from->nofault = true;860861 dio = btrfs_dio_write(iocb, from, written);861862 from->nofault = false;862863863863- /*864864- * iomap_dio_complete() will call btrfs_sync_file() if we have a dsync865865- * iocb, and that needs to lock the inode. So unlock it before calling866866- * iomap_dio_complete() to avoid a deadlock.867867- */868868- btrfs_inode_unlock(BTRFS_I(inode), ilock_flags);869869-870870- if (IS_ERR_OR_NULL(dio))864864+ if (IS_ERR_OR_NULL(dio)) {871865 ret = PTR_ERR_OR_ZERO(dio);872872- else866866+ } else {867867+ struct btrfs_file_private stack_private = { 0 };868868+ struct btrfs_file_private *private;869869+ const bool have_private = (file->private_data != NULL);870870+871871+ if (!have_private)872872+ file->private_data = &stack_private;873873+874874+ /*875875+ * If we have a synchronous write, we must make sure the fsync876876+ * triggered by the iomap_dio_complete() call below doesn't877877+ * deadlock on the inode lock - we are already holding it and we878878+ * can't call it after unlocking because we may need to complete879879+ * partial writes due to the input buffer (or parts of it) not880880+ * being already faulted in.881881+ */882882+ private = file->private_data;883883+ private->fsync_skip_inode_lock = true;873884 ret = iomap_dio_complete(dio);885885+ private->fsync_skip_inode_lock = false;886886+887887+ if (!have_private)888888+ file->private_data = NULL;889889+ }874890875891 /* No increment (+=) because iomap returns a cumulative value. */876892 if (ret > 0)···913897 } else {914898 fault_in_iov_iter_readable(from, left);915899 prev_left = left;916916- goto relock;900900+ goto again;917901 }918902 }903903+904904+ btrfs_inode_unlock(BTRFS_I(inode), ilock_flags);919905920906 /*921907 * If 'ret' is -ENOTBLK or we have not written all data, then it means
+2-1
fs/btrfs/extent-tree.c
···27932793 readonly = true;27942794 } else if (btrfs_is_zoned(fs_info)) {27952795 /* Need reset before reusing in a zoned block group */27962796- space_info->bytes_zone_unusable += len;27962796+ btrfs_space_info_update_bytes_zone_unusable(fs_info, space_info,27972797+ len);27972798 readonly = true;27982799 }27992800 spin_unlock(&cache->lock);
···16031603 */16041604int btrfs_sync_file(struct file *file, loff_t start, loff_t end, int datasync)16051605{16061606+ struct btrfs_file_private *private = file->private_data;16061607 struct dentry *dentry = file_dentry(file);16071608 struct btrfs_inode *inode = BTRFS_I(d_inode(dentry));16081609 struct btrfs_root *root = inode->root;···16131612 int ret = 0, err;16141613 u64 len;16151614 bool full_sync;16151615+ const bool skip_ilock = (private ? private->fsync_skip_inode_lock : false);1616161616171617 trace_btrfs_sync_file(file, datasync);16181618···16411639 if (ret)16421640 goto out;1643164116441644- btrfs_inode_lock(inode, BTRFS_ILOCK_MMAP);16421642+ if (skip_ilock)16431643+ down_write(&inode->i_mmap_lock);16441644+ else16451645+ btrfs_inode_lock(inode, BTRFS_ILOCK_MMAP);1645164616461647 atomic_inc(&root->log_batch);16471648···16681663 */16691664 ret = start_ordered_ops(inode, start, end);16701665 if (ret) {16711671- btrfs_inode_unlock(inode, BTRFS_ILOCK_MMAP);16661666+ if (skip_ilock)16671667+ up_write(&inode->i_mmap_lock);16681668+ else16691669+ btrfs_inode_unlock(inode, BTRFS_ILOCK_MMAP);16721670 goto out;16731671 }16741672···17961788 * file again, but that will end up using the synchronization17971789 * inside btrfs_sync_log to keep things safe.17981790 */17991799- btrfs_inode_unlock(inode, BTRFS_ILOCK_MMAP);17911791+ if (skip_ilock)17921792+ up_write(&inode->i_mmap_lock);17931793+ else17941794+ btrfs_inode_unlock(inode, BTRFS_ILOCK_MMAP);1800179518011796 if (ret == BTRFS_NO_LOG_SYNC) {18021797 ret = btrfs_end_transaction(trans);···1868185718691858out_release_extents:18701859 btrfs_release_log_ctx_extents(&ctx);18711871- btrfs_inode_unlock(inode, BTRFS_ILOCK_MMAP);18601860+ if (skip_ilock)18611861+ up_write(&inode->i_mmap_lock);18621862+ else18631863+ btrfs_inode_unlock(inode, BTRFS_ILOCK_MMAP);18721864 goto out;18731865}18741866
+3-1
fs/btrfs/free-space-cache.c
···27232723 * If the block group is read-only, we should account freed space into27242724 * bytes_readonly.27252725 */27262726- if (!block_group->ro)27262726+ if (!block_group->ro) {27272727 block_group->zone_unusable += to_unusable;27282728+ WARN_ON(block_group->zone_unusable > block_group->length);27292729+ }27282730 spin_unlock(&ctl->tree_lock);27292731 if (!used) {27302732 spin_lock(&block_group->lock);
···683683 ret = false;684684685685 if (!test_bit(BTRFS_FS_STATE_REMOUNTING, &info->fs_state)) {686686- if (btrfs_raw_test_opt(*mount_opt, SPACE_CACHE))686686+ if (btrfs_raw_test_opt(*mount_opt, SPACE_CACHE)) {687687 btrfs_info(info, "disk space caching is enabled");688688+ btrfs_warn(info,689689+"space cache v1 is being deprecated and will be removed in a future release, please use -o space_cache=v2");690690+ }688691 if (btrfs_raw_test_opt(*mount_opt, FREE_SPACE_TREE))689692 btrfs_info(info, "using free-space-tree");690693 }
+99
fs/btrfs/tests/extent-map-tests.c
···900900 return ret;901901}902902903903+/*904904+ * Test a regression for compressed extent map adjustment when we attempt to905905+ * add an extent map that is partially overlapped by another existing extent906906+ * map. The resulting extent map offset was left unchanged despite having907907+ * incremented its start offset.908908+ */909909+static int test_case_8(struct btrfs_fs_info *fs_info, struct btrfs_inode *inode)910910+{911911+ struct extent_map_tree *em_tree = &inode->extent_tree;912912+ struct extent_map *em;913913+ int ret;914914+ int ret2;915915+916916+ em = alloc_extent_map();917917+ if (!em) {918918+ test_std_err(TEST_ALLOC_EXTENT_MAP);919919+ return -ENOMEM;920920+ }921921+922922+ /* Compressed extent for the file range [120K, 128K). */923923+ em->start = SZ_1K * 120;924924+ em->len = SZ_8K;925925+ em->disk_num_bytes = SZ_4K;926926+ em->ram_bytes = SZ_8K;927927+ em->flags |= EXTENT_FLAG_COMPRESS_ZLIB;928928+ write_lock(&em_tree->lock);929929+ ret = btrfs_add_extent_mapping(inode, &em, em->start, em->len);930930+ write_unlock(&em_tree->lock);931931+ free_extent_map(em);932932+ if (ret < 0) {933933+ test_err("couldn't add extent map for range [120K, 128K)");934934+ goto out;935935+ }936936+937937+ em = alloc_extent_map();938938+ if (!em) {939939+ test_std_err(TEST_ALLOC_EXTENT_MAP);940940+ ret = -ENOMEM;941941+ goto out;942942+ }943943+944944+ /*945945+ * Compressed extent for the file range [108K, 144K), which overlaps946946+ * with the [120K, 128K) we previously inserted.947947+ */948948+ em->start = SZ_1K * 108;949949+ em->len = SZ_1K * 36;950950+ em->disk_num_bytes = SZ_4K;951951+ em->ram_bytes = SZ_1K * 36;952952+ em->flags |= EXTENT_FLAG_COMPRESS_ZLIB;953953+954954+ /*955955+ * Try to add the extent map but with a search range of [140K, 144K),956956+ * this should succeed and adjust the extent map to the range957957+ * [128K, 144K), with a length of 16K and an offset of 20K.958958+ *959959+ * This simulates a scenario where in the subvolume tree of an inode we960960+ * have a compressed file extent item for the range [108K, 144K) and we961961+ * have an overlapping compressed extent map for the range [120K, 128K),962962+ * which was created by an encoded write, but its ordered extent was not963963+ * yet completed, so the subvolume tree doesn't have yet the file extent964964+ * item for that range - we only have the extent map in the inode's965965+ * extent map tree.966966+ */967967+ write_lock(&em_tree->lock);968968+ ret = btrfs_add_extent_mapping(inode, &em, SZ_1K * 140, SZ_4K);969969+ write_unlock(&em_tree->lock);970970+ free_extent_map(em);971971+ if (ret < 0) {972972+ test_err("couldn't add extent map for range [108K, 144K)");973973+ goto out;974974+ }975975+976976+ if (em->start != SZ_128K) {977977+ test_err("unexpected extent map start %llu (should be 128K)", em->start);978978+ ret = -EINVAL;979979+ goto out;980980+ }981981+ if (em->len != SZ_16K) {982982+ test_err("unexpected extent map length %llu (should be 16K)", em->len);983983+ ret = -EINVAL;984984+ goto out;985985+ }986986+ if (em->offset != SZ_1K * 20) {987987+ test_err("unexpected extent map offset %llu (should be 20K)", em->offset);988988+ ret = -EINVAL;989989+ goto out;990990+ }991991+out:992992+ ret2 = free_extent_map_tree(inode);993993+ if (ret == 0)994994+ ret = ret2;995995+996996+ return ret;997997+}998998+903999struct rmap_test_vector {9041000 u64 raid_type;9051001 u64 physical_start;···11721076 if (ret)11731077 goto out;11741078 ret = test_case_7(fs_info, BTRFS_I(inode));10791079+ if (ret)10801080+ goto out;10811081+ ret = test_case_8(fs_info, BTRFS_I(inode));11751082 if (ret)11761083 goto out;11771084
+48-1
fs/btrfs/tree-checker.c
···634634 */635635 if (key->type == BTRFS_DIR_ITEM_KEY ||636636 key->type == BTRFS_XATTR_ITEM_KEY) {637637- char namebuf[max(BTRFS_NAME_LEN, XATTR_NAME_MAX)];637637+ char namebuf[MAX(BTRFS_NAME_LEN, XATTR_NAME_MAX)];638638639639 read_extent_buffer(leaf, namebuf,640640 (unsigned long)(di + 1), name_len);···12891289 va_end(args);12901290}1291129112921292+static bool is_valid_dref_root(u64 rootid)12931293+{12941294+ /*12951295+ * The following tree root objectids are allowed to have a data backref:12961296+ * - subvolume trees12971297+ * - data reloc tree12981298+ * - tree root12991299+ * For v1 space cache13001300+ */13011301+ return is_fstree(rootid) || rootid == BTRFS_DATA_RELOC_TREE_OBJECTID ||13021302+ rootid == BTRFS_ROOT_TREE_OBJECTID;13031303+}13041304+12921305static int check_extent_item(struct extent_buffer *leaf,12931306 struct btrfs_key *key, int slot,12941307 struct btrfs_key *prev_key)···14541441 struct btrfs_extent_data_ref *dref;14551442 struct btrfs_shared_data_ref *sref;14561443 u64 seq;14441444+ u64 dref_root;14451445+ u64 dref_objectid;14571446 u64 dref_offset;14581447 u64 inline_offset;14591448 u8 inline_type;···14991484 */15001485 case BTRFS_EXTENT_DATA_REF_KEY:15011486 dref = (struct btrfs_extent_data_ref *)(&iref->offset);14871487+ dref_root = btrfs_extent_data_ref_root(leaf, dref);14881488+ dref_objectid = btrfs_extent_data_ref_objectid(leaf, dref);15021489 dref_offset = btrfs_extent_data_ref_offset(leaf, dref);15031490 seq = hash_extent_data_ref(15041491 btrfs_extent_data_ref_root(leaf, dref),15051492 btrfs_extent_data_ref_objectid(leaf, dref),15061493 btrfs_extent_data_ref_offset(leaf, dref));14941494+ if (unlikely(!is_valid_dref_root(dref_root))) {14951495+ extent_err(leaf, slot,14961496+ "invalid data ref root value %llu",14971497+ dref_root);14981498+ return -EUCLEAN;14991499+ }15001500+ if (unlikely(dref_objectid < BTRFS_FIRST_FREE_OBJECTID ||15011501+ dref_objectid > BTRFS_LAST_FREE_OBJECTID)) {15021502+ extent_err(leaf, slot,15031503+ "invalid data ref objectid value %llu",15041504+ dref_root);15051505+ return -EUCLEAN;15061506+ }15071507 if (unlikely(!IS_ALIGNED(dref_offset,15081508 fs_info->sectorsize))) {15091509 extent_err(leaf, slot,···16571627 return -EUCLEAN;16581628 }16591629 for (; ptr < end; ptr += sizeof(*dref)) {16301630+ u64 root;16311631+ u64 objectid;16601632 u64 offset;1661163316621634 /*···16661634 * overflow from the leaf due to hash collisions.16671635 */16681636 dref = (struct btrfs_extent_data_ref *)ptr;16371637+ root = btrfs_extent_data_ref_root(leaf, dref);16381638+ objectid = btrfs_extent_data_ref_objectid(leaf, dref);16691639 offset = btrfs_extent_data_ref_offset(leaf, dref);16401640+ if (unlikely(!is_valid_dref_root(root))) {16411641+ extent_err(leaf, slot,16421642+ "invalid extent data backref root value %llu",16431643+ root);16441644+ return -EUCLEAN;16451645+ }16461646+ if (unlikely(objectid < BTRFS_FIRST_FREE_OBJECTID ||16471647+ objectid > BTRFS_LAST_FREE_OBJECTID)) {16481648+ extent_err(leaf, slot,16491649+ "invalid extent data backref objectid value %llu",16501650+ root);16511651+ return -EUCLEAN;16521652+ }16701653 if (unlikely(!IS_ALIGNED(offset, leaf->fs_info->sectorsize))) {16711654 extent_err(leaf, slot,16721655 "invalid extent data backref offset, have %llu expect aligned to %u",
+24-11
fs/ceph/caps.c
···20162016 * CHECK_CAPS_AUTHONLY - we should only check the auth cap20172017 * CHECK_CAPS_FLUSH - we should flush any dirty caps immediately, without20182018 * further delay.20192019+ * CHECK_CAPS_FLUSH_FORCE - we should flush any caps immediately, without20202020+ * further delay.20192021 */20202022void ceph_check_caps(struct ceph_inode_info *ci, int flags)20212023{···20992097 }2100209821012099 doutc(cl, "%p %llx.%llx file_want %s used %s dirty %s "21022102- "flushing %s issued %s revoking %s retain %s %s%s%s\n",21002100+ "flushing %s issued %s revoking %s retain %s %s%s%s%s\n",21032101 inode, ceph_vinop(inode), ceph_cap_string(file_wanted),21042102 ceph_cap_string(used), ceph_cap_string(ci->i_dirty_caps),21052103 ceph_cap_string(ci->i_flushing_caps),···21072105 ceph_cap_string(retain),21082106 (flags & CHECK_CAPS_AUTHONLY) ? " AUTHONLY" : "",21092107 (flags & CHECK_CAPS_FLUSH) ? " FLUSH" : "",21102110- (flags & CHECK_CAPS_NOINVAL) ? " NOINVAL" : "");21082108+ (flags & CHECK_CAPS_NOINVAL) ? " NOINVAL" : "",21092109+ (flags & CHECK_CAPS_FLUSH_FORCE) ? " FLUSH_FORCE" : "");2111211021122111 /*21132112 * If we no longer need to hold onto old our caps, and we may···21812178 if (S_ISREG(inode->i_mode) && ci->i_wrbuffer_ref &&21822179 (revoking & CEPH_CAP_FILE_BUFFER))21832180 queue_writeback = true;21812181+ }21822182+21832183+ if (flags & CHECK_CAPS_FLUSH_FORCE) {21842184+ doutc(cl, "force to flush caps\n");21852185+ goto ack;21842186 }2185218721862188 if (cap == ci->i_auth_cap &&···35183510 bool queue_invalidate = false;35193511 bool deleted_inode = false;35203512 bool fill_inline = false;35133513+ bool revoke_wait = false;35143514+ int flags = 0;3521351535223516 /*35233517 * If there is at least one crypto block then we'll trust···37153705 ceph_cap_string(cap->issued), ceph_cap_string(newcaps),37163706 ceph_cap_string(revoking));37173707 if (S_ISREG(inode->i_mode) &&37183718- (revoking & used & CEPH_CAP_FILE_BUFFER))37083708+ (revoking & used & CEPH_CAP_FILE_BUFFER)) {37193709 writeback = true; /* initiate writeback; will delay ack */37203720- else if (queue_invalidate &&37103710+ revoke_wait = true;37113711+ } else if (queue_invalidate &&37213712 revoking == CEPH_CAP_FILE_CACHE &&37223722- (newcaps & CEPH_CAP_FILE_LAZYIO) == 0)37233723- ; /* do nothing yet, invalidation will be queued */37243724- else if (cap == ci->i_auth_cap)37133713+ (newcaps & CEPH_CAP_FILE_LAZYIO) == 0) {37143714+ revoke_wait = true; /* do nothing yet, invalidation will be queued */37153715+ } else if (cap == ci->i_auth_cap) {37253716 check_caps = 1; /* check auth cap only */37263726- else37173717+ } else {37273718 check_caps = 2; /* check all caps */37193719+ }37283720 /* If there is new caps, try to wake up the waiters */37293721 if (~cap->issued & newcaps)37303722 wake = true;···37533741 BUG_ON(cap->issued & ~cap->implemented);3754374237553743 /* don't let check_caps skip sending a response to MDS for revoke msgs */37563756- if (le32_to_cpu(grant->op) == CEPH_CAP_OP_REVOKE) {37443744+ if (!revoke_wait && le32_to_cpu(grant->op) == CEPH_CAP_OP_REVOKE) {37573745 cap->mds_wanted = 0;37463746+ flags |= CHECK_CAPS_FLUSH_FORCE;37583747 if (cap == ci->i_auth_cap)37593748 check_caps = 1; /* check auth cap only */37603749 else···3811379838123799 mutex_unlock(&session->s_mutex);38133800 if (check_caps == 1)38143814- ceph_check_caps(ci, CHECK_CAPS_AUTHONLY | CHECK_CAPS_NOINVAL);38013801+ ceph_check_caps(ci, flags | CHECK_CAPS_AUTHONLY | CHECK_CAPS_NOINVAL);38153802 else if (check_caps == 2)38163816- ceph_check_caps(ci, CHECK_CAPS_NOINVAL);38033803+ ceph_check_caps(ci, flags | CHECK_CAPS_NOINVAL);38173804}3818380538193806/*
+4-3
fs/ceph/super.h
···200200 struct list_head caps_item;201201};202202203203-#define CHECK_CAPS_AUTHONLY 1 /* only check auth cap */204204-#define CHECK_CAPS_FLUSH 2 /* flush any dirty caps */205205-#define CHECK_CAPS_NOINVAL 4 /* don't invalidate pagecache */203203+#define CHECK_CAPS_AUTHONLY 1 /* only check auth cap */204204+#define CHECK_CAPS_FLUSH 2 /* flush any dirty caps */205205+#define CHECK_CAPS_NOINVAL 4 /* don't invalidate pagecache */206206+#define CHECK_CAPS_FLUSH_FORCE 8 /* force flush any caps */206207207208struct ceph_cap_flush {208209 u64 tid;
+1
fs/file.c
···12481248 * tables and this condition does not arise without those.12491249 */12501250 fdt = files_fdtable(files);12511251+ fd = array_index_nospec(fd, fdt->max_fds);12511252 tofree = fdt->fd[fd];12521253 if (!tofree && fd_is_open(fd, fdt))12531254 goto Ebusy;
+1-2
fs/nfsd/nfsctl.c
···20692069 continue;20702070 }2071207120722072- ret = svc_xprt_create_from_sa(serv, xcl_name, net, sa,20732073- SVC_SOCK_ANONYMOUS,20722072+ ret = svc_xprt_create_from_sa(serv, xcl_name, net, sa, 0,20742073 get_current_cred());20752074 /* always save the latest error */20762075 if (ret < 0)
+1-1
fs/smb/client/cifs_debug.c
···10721072static void10731073cifs_security_flags_handle_must_flags(unsigned int *flags)10741074{10751075- unsigned int signflags = *flags & CIFSSEC_MUST_SIGN;10751075+ unsigned int signflags = *flags & (CIFSSEC_MUST_SIGN | CIFSSEC_MUST_SEAL);1076107610771077 if ((*flags & CIFSSEC_MUST_KRB5) == CIFSSEC_MUST_KRB5)10781078 *flags = CIFSSEC_MUST_KRB5;
+2-2
fs/smb/client/cifsfs.h
···147147#endif /* CONFIG_CIFS_NFSD_EXPORT */148148149149/* when changing internal version - update following two lines at same time */150150-#define SMB3_PRODUCT_BUILD 49151151-#define CIFS_VERSION "2.49"150150+#define SMB3_PRODUCT_BUILD 50151151+#define CIFS_VERSION "2.50"152152#endif /* _CIFSFS_H */
+6-30
fs/smb/client/cifsglob.h
···345345 /* connect to a server share */346346 int (*tree_connect)(const unsigned int, struct cifs_ses *, const char *,347347 struct cifs_tcon *, const struct nls_table *);348348- /* close tree connecion */348348+ /* close tree connection */349349 int (*tree_disconnect)(const unsigned int, struct cifs_tcon *);350350 /* get DFS referrals */351351 int (*get_dfs_refer)(const unsigned int, struct cifs_ses *,···816816 * Protected by @refpath_lock and @srv_lock. The @refpath_lock is817817 * mostly used for not requiring a copy of @leaf_fullpath when getting818818 * cached or new DFS referrals (which might also sleep during I/O).819819- * While @srv_lock is held for making string and NULL comparions against819819+ * While @srv_lock is held for making string and NULL comparisons against820820 * both fields as in mount(2) and cache refresh.821821 *822822 * format: \\HOST\SHARE[\OPTIONAL PATH]···14711471 struct TCP_Server_Info *server;14721472};1473147314741474-struct cifs_aio_ctx {14751475- struct kref refcount;14761476- struct list_head list;14771477- struct mutex aio_mutex;14781478- struct completion done;14791479- struct iov_iter iter;14801480- struct kiocb *iocb;14811481- struct cifsFileInfo *cfile;14821482- struct bio_vec *bv;14831483- loff_t pos;14841484- unsigned int nr_pinned_pages;14851485- ssize_t rc;14861486- unsigned int len;14871487- unsigned int total_len;14881488- unsigned int bv_need_unpin; /* If ->bv[] needs unpinning */14891489- bool should_dirty;14901490- /*14911491- * Indicates if this aio_ctx is for direct_io,14921492- * If yes, iter is a copy of the user passed iov_iter14931493- */14941494- bool direct_io;14951495-};14961496-14971474struct cifs_io_request {14981475 struct netfs_io_request rreq;14991476 struct cifsFileInfo *cfile;···18811904#define CIFSSEC_MAY_SIGN 0x0000118821905#define CIFSSEC_MAY_NTLMV2 0x0000418831906#define CIFSSEC_MAY_KRB5 0x0000818841884-#define CIFSSEC_MAY_SEAL 0x00040 /* not supported yet */19071907+#define CIFSSEC_MAY_SEAL 0x0004018851908#define CIFSSEC_MAY_NTLMSSP 0x00080 /* raw ntlmssp with ntlmv2 */1886190918871910#define CIFSSEC_MUST_SIGN 0x01001···18911914#define CIFSSEC_MUST_NTLMV2 0x0400418921915#define CIFSSEC_MUST_KRB5 0x0800818931916#ifdef CONFIG_CIFS_UPCALL18941894-#define CIFSSEC_MASK 0x8F08F /* flags supported if no weak allowed */19171917+#define CIFSSEC_MASK 0xCF0CF /* flags supported if no weak allowed */18951918#else18961896-#define CIFSSEC_MASK 0x87087 /* flags supported if no weak allowed */19191919+#define CIFSSEC_MASK 0xC70C7 /* flags supported if no weak allowed */18971920#endif /* UPCALL */18981898-#define CIFSSEC_MUST_SEAL 0x40040 /* not supported yet */19211921+#define CIFSSEC_MUST_SEAL 0x4004018991922#define CIFSSEC_MUST_NTLMSSP 0x80080 /* raw ntlmssp with ntlmv2 */1900192319011924#define CIFSSEC_DEF (CIFSSEC_MAY_SIGN | CIFSSEC_MAY_NTLMV2 | CIFSSEC_MAY_NTLMSSP | CIFSSEC_MAY_SEAL)···19872010 * cifsFileInfo->file_info_lock cifsFileInfo->count cifs_new_fileinfo19882011 * ->invalidHandle initiate_cifs_search19892012 * ->oplock_break_cancelled19901990- * cifs_aio_ctx->aio_mutex cifs_aio_ctx cifs_aio_ctx_alloc19912013 ****************************************************************************/1992201419932015#ifdef DECLARE_GLOBALS_HERE
···10421042 }1043104310441044 rc = -EOPNOTSUPP;10451045- switch ((data->reparse.tag = tag)) {10461046- case 0: /* SMB1 symlink */10451045+ data->reparse.tag = tag;10461046+ if (!data->reparse.tag) {10471047 if (server->ops->query_symlink) {10481048 rc = server->ops->query_symlink(xid, tcon,10491049 cifs_sb, full_path,10501050 &data->symlink_target);10511051+ }10521052+ if (rc == -EOPNOTSUPP)10531053+ data->reparse.tag = IO_REPARSE_TAG_INTERNAL;10541054+ }10551055+10561056+ switch (data->reparse.tag) {10571057+ case 0: /* SMB1 symlink */10581058+ break;10591059+ case IO_REPARSE_TAG_INTERNAL:10601060+ rc = 0;10611061+ if (le32_to_cpu(data->fi.Attributes) & ATTR_DIRECTORY) {10621062+ cifs_create_junction_fattr(fattr, sb);10631063+ goto out;10511064 }10521065 break;10531066 case IO_REPARSE_TAG_MOUNT_POINT:
+25-7
fs/smb/client/ioctl.c
···170170static int cifs_shutdown(struct super_block *sb, unsigned long arg)171171{172172 struct cifs_sb_info *sbi = CIFS_SB(sb);173173+ struct tcon_link *tlink;174174+ struct cifs_tcon *tcon;173175 __u32 flags;176176+ int rc;174177175178 if (!capable(CAP_SYS_ADMIN))176179 return -EPERM;···181178 if (get_user(flags, (__u32 __user *)arg))182179 return -EFAULT;183180184184- if (flags > CIFS_GOING_FLAGS_NOLOGFLUSH)185185- return -EINVAL;181181+ tlink = cifs_sb_tlink(sbi);182182+ if (IS_ERR(tlink))183183+ return PTR_ERR(tlink);184184+ tcon = tlink_tcon(tlink);185185+186186+ trace_smb3_shutdown_enter(flags, tcon->tid);187187+ if (flags > CIFS_GOING_FLAGS_NOLOGFLUSH) {188188+ rc = -EINVAL;189189+ goto shutdown_out_err;190190+ }186191187192 if (cifs_forced_shutdown(sbi))188188- return 0;193193+ goto shutdown_good;189194190195 cifs_dbg(VFS, "shut down requested (%d)", flags);191191-/* trace_cifs_shutdown(sb, flags);*/192196193197 /*194198 * see:···211201 */212202 case CIFS_GOING_FLAGS_DEFAULT:213203 cifs_dbg(FYI, "shutdown with default flag not supported\n");214214- return -EINVAL;204204+ rc = -EINVAL;205205+ goto shutdown_out_err;215206 /*216207 * FLAGS_LOGFLUSH is easy since it asks to write out metadata (not217208 * data) but metadata writes are not cached on the client, so can treat···221210 case CIFS_GOING_FLAGS_LOGFLUSH:222211 case CIFS_GOING_FLAGS_NOLOGFLUSH:223212 sbi->mnt_cifs_flags |= CIFS_MOUNT_SHUTDOWN;224224- return 0;213213+ goto shutdown_good;225214 default:226226- return -EINVAL;215215+ rc = -EINVAL;216216+ goto shutdown_out_err;227217 }218218+219219+shutdown_good:220220+ trace_smb3_shutdown_done(flags, tcon->tid);228221 return 0;222222+shutdown_out_err:223223+ trace_smb3_shutdown_err(rc, flags, tcon->tid);224224+ return rc;229225}230226231227static int cifs_dump_full_key(struct cifs_tcon *tcon, struct smb3_full_key_debug_info __user *in)
+6-59
fs/smb/client/misc.c
···352352 * on simple responses (wct, bcc both zero)353353 * in particular have seen this on354354 * ulogoffX and FindClose. This leaves355355- * one byte of bcc potentially unitialized355355+ * one byte of bcc potentially uninitialized356356 */357357 /* zero rest of bcc */358358 tmp[sizeof(struct smb_hdr)+1] = 0;···995995 return rc;996996}997997998998-struct cifs_aio_ctx *999999-cifs_aio_ctx_alloc(void)10001000-{10011001- struct cifs_aio_ctx *ctx;10021002-10031003- /*10041004- * Must use kzalloc to initialize ctx->bv to NULL and ctx->direct_io10051005- * to false so that we know when we have to unreference pages within10061006- * cifs_aio_ctx_release()10071007- */10081008- ctx = kzalloc(sizeof(struct cifs_aio_ctx), GFP_KERNEL);10091009- if (!ctx)10101010- return NULL;10111011-10121012- INIT_LIST_HEAD(&ctx->list);10131013- mutex_init(&ctx->aio_mutex);10141014- init_completion(&ctx->done);10151015- kref_init(&ctx->refcount);10161016- return ctx;10171017-}10181018-10191019-void10201020-cifs_aio_ctx_release(struct kref *refcount)10211021-{10221022- struct cifs_aio_ctx *ctx = container_of(refcount,10231023- struct cifs_aio_ctx, refcount);10241024-10251025- cifsFileInfo_put(ctx->cfile);10261026-10271027- /*10281028- * ctx->bv is only set if setup_aio_ctx_iter() was call successfuly10291029- * which means that iov_iter_extract_pages() was a success and thus10301030- * that we may have references or pins on pages that we need to10311031- * release.10321032- */10331033- if (ctx->bv) {10341034- if (ctx->should_dirty || ctx->bv_need_unpin) {10351035- unsigned int i;10361036-10371037- for (i = 0; i < ctx->nr_pinned_pages; i++) {10381038- struct page *page = ctx->bv[i].bv_page;10391039-10401040- if (ctx->should_dirty)10411041- set_page_dirty(page);10421042- if (ctx->bv_need_unpin)10431043- unpin_user_page(page);10441044- }10451045- }10461046- kvfree(ctx->bv);10471047- }10481048-10491049- kfree(ctx);10501050-}10511051-1052998/**1053999 * cifs_alloc_hash - allocate hash and hash context together10541000 * @name: The name of the crypto hash algo···12341288 const char *full_path,12351289 bool *islink)12361290{12911291+ struct TCP_Server_Info *server = tcon->ses->server;12371292 struct cifs_ses *ses = tcon->ses;12381293 size_t len;12391294 char *path;···12511304 !is_tcon_dfs(tcon))12521305 return 0;1253130612541254- spin_lock(&tcon->tc_lock);12551255- if (!tcon->origin_fullpath) {12561256- spin_unlock(&tcon->tc_lock);13071307+ spin_lock(&server->srv_lock);13081308+ if (!server->leaf_fullpath) {13091309+ spin_unlock(&server->srv_lock);12571310 return 0;12581311 }12591259- spin_unlock(&tcon->tc_lock);13121312+ spin_unlock(&server->srv_lock);1260131312611314 /*12621315 * Slow path - tcon is DFS and @full_path has prefix path, so attempt
+4
fs/smb/client/reparse.c
···505505 }506506507507 switch (tag) {508508+ case IO_REPARSE_TAG_INTERNAL:509509+ if (!(fattr->cf_cifsattrs & ATTR_DIRECTORY))510510+ return false;511511+ fallthrough;508512 case IO_REPARSE_TAG_DFS:509513 case IO_REPARSE_TAG_DFSR:510514 case IO_REPARSE_TAG_MOUNT_POINT:
+17-2
fs/smb/client/reparse.h
···1212#include "fs_context.h"1313#include "cifsglob.h"14141515+/*1616+ * Used only by cifs.ko to ignore reparse points from files when client or1717+ * server doesn't support FSCTL_GET_REPARSE_POINT.1818+ */1919+#define IO_REPARSE_TAG_INTERNAL ((__u32)~0U)2020+1521static inline dev_t reparse_nfs_mkdev(struct reparse_posix_data *buf)1622{1723 u64 v = le64_to_cpu(*(__le64 *)buf->DataBuffer);···8478static inline bool reparse_inode_match(struct inode *inode,8579 struct cifs_fattr *fattr)8680{8181+ struct cifsInodeInfo *cinode = CIFS_I(inode);8782 struct timespec64 ctime = inode_get_ctime(inode);88838989- return (CIFS_I(inode)->cifsAttrs & ATTR_REPARSE) &&9090- CIFS_I(inode)->reparse_tag == fattr->cf_cifstag &&8484+ /*8585+ * Do not match reparse tags when client or server doesn't support8686+ * FSCTL_GET_REPARSE_POINT. @fattr->cf_cifstag should contain correct8787+ * reparse tag from query dir response but the client won't be able to8888+ * read the reparse point data anyway. This spares us a revalidation.8989+ */9090+ if (cinode->reparse_tag != IO_REPARSE_TAG_INTERNAL &&9191+ cinode->reparse_tag != fattr->cf_cifstag)9292+ return false;9393+ return (cinode->cifsAttrs & ATTR_REPARSE) &&9194 timespec64_equal(&ctime, &fattr->cf_ctime);9295}9396
···406406 else407407 response = get_empty_queue_buffer(info);408408 if (!response) {409409- /* now switch to emtpy packet queue */409409+ /* now switch to empty packet queue */410410 if (use_receive_queue) {411411 use_receive_queue = 0;412412 continue;···618618619619/*620620 * Test if FRWR (Fast Registration Work Requests) is supported on the device621621- * This implementation requries FRWR on RDMA read/write621621+ * This implementation requires FRWR on RDMA read/write622622 * return value: true if it is supported623623 */624624static bool frwr_is_supported(struct ib_device_attr *attrs)···21772177 * MR available in the list. It may access the list while the21782178 * smbd_mr_recovery_work is recovering the MR list. This doesn't need a lock21792179 * as they never modify the same places. However, there may be several CPUs21802180- * issueing I/O trying to get MR at the same time, mr_list_lock is used to21802180+ * issuing I/O trying to get MR at the same time, mr_list_lock is used to21812181 * protect this situation.21822182 */21832183static struct smbd_mr *get_mr(struct smbd_connection *info)···23112311 /*23122312 * There is no need for waiting for complemtion on ib_post_send23132313 * on IB_WR_REG_MR. Hardware enforces a barrier and order of execution23142314- * on the next ib_post_send when we actaully send I/O to remote peer23142314+ * on the next ib_post_send when we actually send I/O to remote peer23152315 */23162316 rc = ib_post_send(info->id->qp, ®_wr->wr, NULL);23172317 if (!rc)
···12891289out:12901290 /*12911291 * This will dequeue all mids. After this it is important that the12921292- * demultiplex_thread will not process any of these mids any futher.12921292+ * demultiplex_thread will not process any of these mids any further.12931293 * This is prevented above by using a noop callback that will not12941294 * wake this thread except for the very last PDU.12951295 */
+2-2
fs/tracefs/event_inode.c
···112112 entry->release(entry->name, ei->data);113113 }114114115115- call_rcu(&ei->rcu, free_ei_rcu);115115+ call_srcu(&eventfs_srcu, &ei->rcu, free_ei_rcu);116116}117117118118static inline void put_ei(struct eventfs_inode *ei)···736736 /* Was the parent freed? */737737 if (list_empty(&ei->list)) {738738 cleanup_ei(ei);739739- ei = NULL;739739+ ei = ERR_PTR(-EBUSY);740740 }741741 return ei;742742}
···1010};11111212struct tracefs_inode {1313- union {1414- struct inode vfs_inode;1515- struct rcu_head rcu;1616- };1313+ struct inode vfs_inode;1714 /* The below gets initialized with memset_after(ti, 0, vfs_inode) */1815 struct list_head list;1916 unsigned long flags;
+1-1
fs/xfs/libxfs/xfs_quota_defs.h
···5656 * And, of course, we also need to take into account the dquot log format item5757 * used to describe each dquot.5858 */5959-#define XFS_DQUOT_LOGRES(mp) \5959+#define XFS_DQUOT_LOGRES \6060 ((sizeof(struct xfs_dq_logformat) + sizeof(struct xfs_disk_dquot)) * 6)61616262#define XFS_IS_QUOTA_ON(mp) ((mp)->m_qflags & XFS_ALL_QUOTA_ACCT)
···799799 }800800801801 if (pp->sc->sm->sm_flags & XFS_SCRUB_OFLAG_CORRUPT)802802- goto out_pp;802802+ goto out_names;803803804804 /*805805 * Complain if the number of parent pointers doesn't match the link
···110110 args->whichfork = XFS_ATTR_FORK;111111 xfs_attr_sethash(args);112112113113- return xfs_attr_set(args, op, args->attr_filter & XFS_ATTR_ROOT);113113+ /*114114+ * Some xattrs must be resistant to allocation failure at ENOSPC, e.g.115115+ * creating an inode with ACLs or security attributes requires the116116+ * allocation of the xattr holding that information to succeed. Hence117117+ * we allow xattrs in the VFS TRUSTED, SYSTEM, POSIX_ACL and SECURITY118118+ * (LSM xattr) namespaces to dip into the reserve block pool to allow119119+ * manipulation of these xattrs when at ENOSPC. These VFS xattr120120+ * namespaces translate to the XFS_ATTR_ROOT and XFS_ATTR_SECURE on-disk121121+ * namespaces.122122+ *123123+ * For most of these cases, these special xattrs will fit in the inode124124+ * itself and so consume no extra space or only require temporary extra125125+ * space while an overwrite is being made. Hence the use of the reserved126126+ * pool is largely to avoid the worst case reservation from preventing127127+ * the xattr from being created at ENOSPC.128128+ */129129+ return xfs_attr_set(args, op,130130+ args->attr_filter & (XFS_ATTR_ROOT | XFS_ATTR_SECURE));114131}115132116133
···297297#define is_unsigned_type(type) (!is_signed_type(type))298298299299/*300300+ * Useful shorthand for "is this condition known at compile-time?"301301+ *302302+ * Note that the condition may involve non-constant values,303303+ * but the compiler may know enough about the details of the304304+ * values to determine that the condition is statically true.305305+ */306306+#define statically_true(x) (__builtin_constant_p(x) && (x))307307+308308+/*300309 * This is needed in functions which generate the stack canary, see301310 * arch/x86/kernel/smpboot.c::start_secondary() for an example.302311 */
···736736 * @rxfh_key_space: same as @rxfh_indir_space, but for the key.737737 * @rxfh_priv_size: size of the driver private data area the core should738738 * allocate for an RSS context (in &struct ethtool_rxfh_context).739739- * @rxfh_max_context_id: maximum (exclusive) supported RSS context ID. If this740740- * is zero then the core may choose any (nonzero) ID, otherwise the core741741- * will only use IDs strictly less than this value, as the @rss_context742742- * argument to @create_rxfh_context and friends.739739+ * @rxfh_max_num_contexts: maximum (exclusive) supported RSS context ID.740740+ * If this is zero then the core may choose any (nonzero) ID, otherwise741741+ * the core will only use IDs strictly less than this value, as the742742+ * @rss_context argument to @create_rxfh_context and friends.743743 * @supported_coalesce_params: supported types of interrupt coalescing.744744 * @supported_ring_params: supported ring params.745745 * @get_drvinfo: Report driver/device information. Modern drivers no···954954 u32 rxfh_indir_space;955955 u16 rxfh_key_space;956956 u16 rxfh_priv_size;957957- u32 rxfh_max_context_id;957957+ u32 rxfh_max_num_contexts;958958 u32 supported_coalesce_params;959959 u32 supported_ring_params;960960 void (*get_drvinfo)(struct net_device *, struct ethtool_drvinfo *);
···24142414}2415241524162416bool kvm_range_has_memory_attributes(struct kvm *kvm, gfn_t start, gfn_t end,24172417- unsigned long attrs);24172417+ unsigned long mask, unsigned long attrs);24182418bool kvm_arch_pre_set_memory_attributes(struct kvm *kvm,24192419 struct kvm_gfn_range *range);24202420bool kvm_arch_post_set_memory_attributes(struct kvm *kvm,···24452445}24462446#endif /* CONFIG_KVM_PRIVATE_MEM */2447244724482448-#ifdef CONFIG_HAVE_KVM_GMEM_PREPARE24482448+#ifdef CONFIG_HAVE_KVM_ARCH_GMEM_PREPARE24492449int kvm_arch_gmem_prepare(struct kvm *kvm, gfn_t gfn, kvm_pfn_t pfn, int max_order);24502450-bool kvm_arch_gmem_prepare_needed(struct kvm *kvm);24512450#endif2452245124522452+#ifdef CONFIG_KVM_GENERIC_PRIVATE_MEM24532453/**24542454 * kvm_gmem_populate() - Populate/prepare a GPA range with guest data24552455 *···2476247624772477long kvm_gmem_populate(struct kvm *kvm, gfn_t gfn, void __user *src, long npages,24782478 kvm_gmem_populate_cb post_populate, void *opaque);24792479+#endif2479248024802480-#ifdef CONFIG_HAVE_KVM_GMEM_INVALIDATE24812481+#ifdef CONFIG_HAVE_KVM_ARCH_GMEM_INVALIDATE24812482void kvm_arch_gmem_invalidate(kvm_pfn_t start, kvm_pfn_t end);24822483#endif24832484
+83-32
include/linux/minmax.h
···2626#define __typecheck(x, y) \2727 (!!(sizeof((typeof(x) *)1 == (typeof(y) *)1)))28282929-/* is_signed_type() isn't a constexpr for pointer types */3030-#define __is_signed(x) \3131- __builtin_choose_expr(__is_constexpr(is_signed_type(typeof(x))), \3232- is_signed_type(typeof(x)), 0)2929+/*3030+ * __sign_use for integer expressions:3131+ * bit #0 set if ok for unsigned comparisons3232+ * bit #1 set if ok for signed comparisons3333+ *3434+ * In particular, statically non-negative signed integer3535+ * expressions are ok for both.3636+ *3737+ * NOTE! Unsigned types smaller than 'int' are implicitly3838+ * converted to 'int' in expressions, and are accepted for3939+ * signed conversions for now. This is debatable.4040+ *4141+ * Note that 'x' is the original expression, and 'ux' is4242+ * the unique variable that contains the value.4343+ *4444+ * We use 'ux' for pure type checking, and 'x' for when4545+ * we need to look at the value (but without evaluating4646+ * it for side effects! Careful to only ever evaluate it4747+ * with sizeof() or __builtin_constant_p() etc).4848+ *4949+ * Pointers end up being checked by the normal C type5050+ * rules at the actual comparison, and these expressions5151+ * only need to be careful to not cause warnings for5252+ * pointer use.5353+ */5454+#define __signed_type_use(x,ux) (2+__is_nonneg(x,ux))5555+#define __unsigned_type_use(x,ux) (1+2*(sizeof(ux)<4))5656+#define __sign_use(x,ux) (is_signed_type(typeof(ux))? \5757+ __signed_type_use(x,ux):__unsigned_type_use(x,ux))33583434-/* True for a non-negative signed int constant */3535-#define __is_noneg_int(x) \3636- (__builtin_choose_expr(__is_constexpr(x) && __is_signed(x), x, -1) >= 0)5959+/*6060+ * To avoid warnings about casting pointers to integers6161+ * of different sizes, we need that special sign type.6262+ *6363+ * On 64-bit we can just always use 'long', since any6464+ * integer or pointer type can just be cast to that.6565+ *6666+ * This does not work for 128-bit signed integers since6767+ * the cast would truncate them, but we do not use s1286868+ * types in the kernel (we do use 'u128', but they will6969+ * be handled by the !is_signed_type() case).7070+ *7171+ * NOTE! The cast is there only to avoid any warnings7272+ * from when values that aren't signed integer types.7373+ */7474+#ifdef CONFIG_64BIT7575+ #define __signed_type(ux) long7676+#else7777+ #define __signed_type(ux) typeof(__builtin_choose_expr(sizeof(ux)>4,1LL,1L))7878+#endif7979+#define __is_nonneg(x,ux) statically_true((__signed_type(ux))(x)>=0)37803838-#define __types_ok(x, y) \3939- (__is_signed(x) == __is_signed(y) || \4040- __is_signed((x) + 0) == __is_signed((y) + 0) || \4141- __is_noneg_int(x) || __is_noneg_int(y))8181+#define __types_ok(x,y,ux,uy) \8282+ (__sign_use(x,ux) & __sign_use(y,uy))8383+8484+#define __types_ok3(x,y,z,ux,uy,uz) \8585+ (__sign_use(x,ux) & __sign_use(y,uy) & __sign_use(z,uz))42864387#define __cmp_op_min <4488#define __cmp_op_max >···9551#define __cmp_once(op, type, x, y) \9652 __cmp_once_unique(op, type, x, y, __UNIQUE_ID(x_), __UNIQUE_ID(y_))97539898-#define __careful_cmp_once(op, x, y) ({ \9999- static_assert(__types_ok(x, y), \100100- #op "(" #x ", " #y ") signedness error, fix types or consider u" #op "() before " #op "_t()"); \101101- __cmp_once(op, __auto_type, x, y); })5454+#define __careful_cmp_once(op, x, y, ux, uy) ({ \5555+ __auto_type ux = (x); __auto_type uy = (y); \5656+ BUILD_BUG_ON_MSG(!__types_ok(x,y,ux,uy), \5757+ #op"("#x", "#y") signedness error"); \5858+ __cmp(op, ux, uy); })10259103103-#define __careful_cmp(op, x, y) \104104- __builtin_choose_expr(__is_constexpr((x) - (y)), \105105- __cmp(op, x, y), __careful_cmp_once(op, x, y))6060+#define __careful_cmp(op, x, y) \6161+ __careful_cmp_once(op, x, y, __UNIQUE_ID(x_), __UNIQUE_ID(y_))1066210763#define __clamp(val, lo, hi) \10864 ((val) >= (hi) ? (hi) : ((val) <= (lo) ? (lo) : (val)))10965110110-#define __clamp_once(val, lo, hi, unique_val, unique_lo, unique_hi) ({ \111111- typeof(val) unique_val = (val); \112112- typeof(lo) unique_lo = (lo); \113113- typeof(hi) unique_hi = (hi); \6666+#define __clamp_once(val, lo, hi, uval, ulo, uhi) ({ \6767+ __auto_type uval = (val); \6868+ __auto_type ulo = (lo); \6969+ __auto_type uhi = (hi); \11470 static_assert(__builtin_choose_expr(__is_constexpr((lo) > (hi)), \11571 (lo) <= (hi), true), \11672 "clamp() low limit " #lo " greater than high limit " #hi); \117117- static_assert(__types_ok(val, lo), "clamp() 'lo' signedness error"); \118118- static_assert(__types_ok(val, hi), "clamp() 'hi' signedness error"); \119119- __clamp(unique_val, unique_lo, unique_hi); })7373+ BUILD_BUG_ON_MSG(!__types_ok3(val,lo,hi,uval,ulo,uhi), \7474+ "clamp("#val", "#lo", "#hi") signedness error"); \7575+ __clamp(uval, ulo, uhi); })12076121121-#define __careful_clamp(val, lo, hi) ({ \122122- __builtin_choose_expr(__is_constexpr((val) - (lo) + (hi)), \123123- __clamp(val, lo, hi), \124124- __clamp_once(val, lo, hi, __UNIQUE_ID(__val), \125125- __UNIQUE_ID(__lo), __UNIQUE_ID(__hi))); })7777+#define __careful_clamp(val, lo, hi) \7878+ __clamp_once(val, lo, hi, __UNIQUE_ID(v_), __UNIQUE_ID(l_), __UNIQUE_ID(h_))1267912780/**12881 * min - return minimum of two values of the same or compatible types···152111#define umax(x, y) \153112 __careful_cmp(max, (x) + 0u + 0ul + 0ull, (y) + 0u + 0ul + 0ull)154113114114+#define __careful_op3(op, x, y, z, ux, uy, uz) ({ \115115+ __auto_type ux = (x); __auto_type uy = (y);__auto_type uz = (z);\116116+ BUILD_BUG_ON_MSG(!__types_ok3(x,y,z,ux,uy,uz), \117117+ #op"3("#x", "#y", "#z") signedness error"); \118118+ __cmp(op, ux, __cmp(op, uy, uz)); })119119+155120/**156121 * min3 - return minimum of three values157122 * @x: first value158123 * @y: second value159124 * @z: third value160125 */161161-#define min3(x, y, z) min((typeof(x))min(x, y), z)126126+#define min3(x, y, z) \127127+ __careful_op3(min, x, y, z, __UNIQUE_ID(x_), __UNIQUE_ID(y_), __UNIQUE_ID(z_))162128163129/**164130 * max3 - return maximum of three values···173125 * @y: second value174126 * @z: third value175127 */176176-#define max3(x, y, z) max((typeof(x))max(x, y), z)128128+#define max3(x, y, z) \129129+ __careful_op3(max, x, y, z, __UNIQUE_ID(x_), __UNIQUE_ID(y_), __UNIQUE_ID(z_))177130178131/**179132 * min_not_zero - return the minimum that is _not_ zero, unless both are zero···326277 * Use these carefully: no type checking, and uses the arguments327278 * multiple times. Use for obvious constants only.328279 */280280+#define MIN(a,b) __cmp(min,a,b)281281+#define MAX(a,b) __cmp(max,a,b)329282#define MIN_T(type,a,b) __cmp(min,(type)(a),(type)(b))330283#define MAX_T(type,a,b) __cmp(max,(type)(a),(type)(b))331284
···193193void ring_buffer_set_time_stamp_abs(struct trace_buffer *buffer, bool abs);194194bool ring_buffer_time_stamp_abs(struct trace_buffer *buffer);195195196196-size_t ring_buffer_nr_pages(struct trace_buffer *buffer, int cpu);197196size_t ring_buffer_nr_dirty_pages(struct trace_buffer *buffer, int cpu);198197199198struct buffer_data_read_page;
+1-2
include/linux/trace_events.h
···680680 * caching and such. Which is mostly OK ;-)681681 */682682 unsigned long flags;683683- atomic_t ref; /* ref count for opened files */683683+ refcount_t ref; /* ref count for opened files */684684 atomic_t sm_ref; /* soft-mode reference counter */685685 atomic_t tm_ref; /* trigger-mode reference counter */686686};···880880struct perf_event;881881882882DECLARE_PER_CPU(struct pt_regs, perf_trace_regs);883883-DECLARE_PER_CPU(int, bpf_kprobe_override);884883885884extern int perf_trace_init(struct perf_event *event);886885extern void perf_trace_destroy(struct perf_event *event);
+3
include/linux/virtio.h
···1010#include <linux/mod_devicetable.h>1111#include <linux/gfp.h>1212#include <linux/dma-mapping.h>1313+#include <linux/completion.h>13141415/**1516 * struct virtqueue - a queue to register buffers for sending or receiving.···110109 __le64 group_member_id;111110 struct scatterlist *data_sg;112111 struct scatterlist *result_sg;112112+ struct completion completion;113113+ int ret;113114};114115115116/**
-4
include/linux/virtio_config.h
···104104 * Returns 0 on success or error status105105 * If disable_vq_and_reset is set, then enable_vq_after_reset must also be106106 * set.107107- * @create_avq: create admin virtqueue resource.108108- * @destroy_avq: destroy admin virtqueue resource.109107 */110108struct virtio_config_ops {111109 void (*get)(struct virtio_device *vdev, unsigned offset,···131133 struct virtio_shm_region *region, u8 id);132134 int (*disable_vq_and_reset)(struct virtqueue *vq);133135 int (*enable_vq_after_reset)(struct virtqueue *vq);134134- int (*create_avq)(struct virtio_device *vdev);135135- void (*destroy_avq)(struct virtio_device *vdev);136136};137137138138/* If driver didn't advertise the feature, it will never appear. */
+5-11
include/linux/virtio_net.h
···5656 unsigned int thlen = 0;5757 unsigned int p_off = 0;5858 unsigned int ip_proto;5959- u64 ret, remainder, gso_size;60596160 if (hdr->gso_type != VIRTIO_NET_HDR_GSO_NONE) {6261 switch (hdr->gso_type & ~VIRTIO_NET_HDR_GSO_ECN) {···9798 u32 start = __virtio16_to_cpu(little_endian, hdr->csum_start);9899 u32 off = __virtio16_to_cpu(little_endian, hdr->csum_offset);99100 u32 needed = start + max_t(u32, thlen, off + sizeof(__sum16));100100-101101- if (hdr->gso_size) {102102- gso_size = __virtio16_to_cpu(little_endian, hdr->gso_size);103103- ret = div64_u64_rem(skb->len, gso_size, &remainder);104104- if (!(ret && (hdr->gso_size > needed) &&105105- ((remainder > needed) || (remainder == 0)))) {106106- return -EINVAL;107107- }108108- skb_shinfo(skb)->tx_flags |= SKBFL_SHARED_FRAG;109109- }110101111102 if (!pskb_may_pull(skb, needed))112103 return -EINVAL;···169180 if (skb->len - p_off > gso_size * UDP_MAX_SEGMENTS)170181 return -EINVAL;171182 if (gso_type != SKB_GSO_UDP_L4)183183+ return -EINVAL;184184+ break;185185+ case SKB_GSO_TCPV4:186186+ case SKB_GSO_TCPV6:187187+ if (skb->csum_offset != offsetof(struct tcphdr, check))172188 return -EINVAL;173189 break;174190 }
···841841#define __NR_mseal 462842842__SYSCALL(__NR_mseal, sys_mseal)843843844844-#define __NR_uretprobe 463845845-__SYSCALL(__NR_uretprobe, sys_uretprobe)846846-847844#undef __NR_syscalls848848-#define __NR_syscalls 464845845+#define __NR_syscalls 463849846850847/*851848 * 32 bit systems traditionally used different
···19021902 depends on !MODVERSIONS19031903 depends on !GCC_PLUGINS19041904 depends on !RANDSTRUCT19051905+ depends on !SHADOW_CALL_STACK19051906 depends on !DEBUG_INFO_BTF || PAHOLE_HAS_LANG_EXCLUDE19061907 help19071908 Enables Rust support in the kernel.
···347347 v &= IO_POLL_REF_MASK;348348 } while (atomic_sub_return(v, &req->poll_refs) & IO_POLL_REF_MASK);349349350350+ io_napi_add(req);350351 return IOU_POLL_NO_ACTION;351352}352353
+4-1
kernel/dma/debug.c
···416416 * dma_active_cacheline entry to track per event. dma_map_sg(), on the417417 * other hand, consumes a single dma_debug_entry, but inserts 'nents'418418 * entries into the tree.419419+ *420420+ * Use __GFP_NOWARN because the printk from an OOM, to netconsole, could end421421+ * up right back in the DMA debugging code, leading to a deadlock.419422 */420420-static RADIX_TREE(dma_active_cacheline, GFP_ATOMIC);423423+static RADIX_TREE(dma_active_cacheline, GFP_ATOMIC | __GFP_NOWARN);421424static DEFINE_SPINLOCK(radix_lock);422425#define ACTIVE_CACHELINE_MAX_OVERLAP ((1 << RADIX_TREE_MAX_TAGS) - 1)423426#define CACHELINE_PER_PAGE_SHIFT (PAGE_SHIFT - L1_CACHE_SHIFT)
···236236 }237237238238 jump_label_lock();239239- if (atomic_cmpxchg(&key->enabled, 1, 0))239239+ if (atomic_cmpxchg(&key->enabled, 1, 0) == 1)240240 jump_label_update(key);241241 jump_label_unlock();242242}···289289 return;290290291291 guard(mutex)(&jump_label_mutex);292292- if (atomic_cmpxchg(&key->enabled, 1, 0))292292+ if (atomic_cmpxchg(&key->enabled, 1, 0) == 1)293293 jump_label_update(key);294294 else295295 WARN_ON_ONCE(!static_key_slow_try_dec(key));
+12-3
kernel/kcov.c
···161161 kmsan_unpoison_memory(&area->list, sizeof(area->list));162162}163163164164+/*165165+ * Unlike in_serving_softirq(), this function returns false when called during166166+ * a hardirq or an NMI that happened in the softirq context.167167+ */168168+static inline bool in_softirq_really(void)169169+{170170+ return in_serving_softirq() && !in_hardirq() && !in_nmi();171171+}172172+164173static notrace bool check_kcov_mode(enum kcov_mode needed_mode, struct task_struct *t)165174{166175 unsigned int mode;···179170 * so we ignore code executed in interrupts, unless we are in a remote180171 * coverage collection section in a softirq.181172 */182182- if (!in_task() && !(in_serving_softirq() && t->kcov_softirq))173173+ if (!in_task() && !(in_softirq_really() && t->kcov_softirq))183174 return false;184175 mode = READ_ONCE(t->kcov_mode);185176 /*···858849859850 if (WARN_ON(!kcov_check_handle(handle, true, true, true)))860851 return;861861- if (!in_task() && !in_serving_softirq())852852+ if (!in_task() && !in_softirq_really())862853 return;863854864855 local_lock_irqsave(&kcov_percpu_data.lock, flags);···1000991 int sequence;1001992 unsigned long flags;100299310031003- if (!in_task() && !in_serving_softirq())994994+ if (!in_task() && !in_softirq_really())1004995 return;10059961006997 local_lock_irqsave(&kcov_percpu_data.lock, flags);
···9292 const char *buf, size_t count)9393{9494 int ret;9595+ static DEFINE_MUTEX(lock);95969797+ /*9898+ * We need serialization, for profile_setup() initializes prof_on9999+ * value and profile_init() must not reallocate prof_buffer after100100+ * once allocated.101101+ */102102+ guard(mutex)(&lock);96103 if (prof_on)97104 return -EEXIST;98105 /*
+6
kernel/locking/lockdep.c
···59365936 if (DEBUG_LOCKS_WARN_ON(!depth))59375937 return;5938593859395939+ if (unlikely(lock->key == &__lockdep_no_track__))59405940+ return;59415941+59395942 hlock = find_held_lock(curr, lock, depth, &i);59405943 if (!hlock) {59415944 print_lock_contention_bug(curr, lock, ip);···59795976 * acquire, how the heck did that happen?59805977 */59815978 if (DEBUG_LOCKS_WARN_ON(!depth))59795979+ return;59805980+59815981+ if (unlikely(lock->key == &__lockdep_no_track__))59825982 return;5983598359845984 hlock = find_held_lock(curr, lock, depth, &i);
+1-1
kernel/locking/qspinlock_paravirt.h
···357357static void pv_kick_node(struct qspinlock *lock, struct mcs_spinlock *node)358358{359359 struct pv_node *pn = (struct pv_node *)node;360360- enum vcpu_state old = vcpu_halted;360360+ u8 old = vcpu_halted;361361 /*362362 * If the vCPU is indeed halted, advance its state to match that of363363 * pv_wait_node(). If OTOH this fails, the vCPU was running and will
+32-9
kernel/module/main.c
···31043104 struct idempotent *existing;31053105 bool first;3106310631073107- u->ret = 0;31073107+ u->ret = -EINTR;31083108 u->cookie = cookie;31093109 init_completion(&u->complete);31103110···31403140 hlist_for_each_entry_safe(pos, next, head, entry) {31413141 if (pos->cookie != cookie)31423142 continue;31433143- hlist_del(&pos->entry);31433143+ hlist_del_init(&pos->entry);31443144 pos->ret = ret;31453145 complete(&pos->complete);31463146 }31473147 spin_unlock(&idem_lock);31483148 return ret;31493149+}31503150+31513151+/*31523152+ * Wait for the idempotent worker.31533153+ *31543154+ * If we get interrupted, we need to remove ourselves from the31553155+ * the idempotent list, and the completion may still come in.31563156+ *31573157+ * The 'idem_lock' protects against the race, and 'idem.ret' was31583158+ * initialized to -EINTR and is thus always the right return31593159+ * value even if the idempotent work then completes between31603160+ * the wait_for_completion and the cleanup.31613161+ */31623162+static int idempotent_wait_for_completion(struct idempotent *u)31633163+{31643164+ if (wait_for_completion_interruptible(&u->complete)) {31653165+ spin_lock(&idem_lock);31663166+ if (!hlist_unhashed(&u->entry))31673167+ hlist_del(&u->entry);31683168+ spin_unlock(&idem_lock);31693169+ }31703170+ return u->ret;31493171}3150317231513173static int init_module_from_file(struct file *f, const char __user * uargs, int flags)···32053183 if (!f || !(f->f_mode & FMODE_READ))32063184 return -EBADF;3207318532083208- /* See if somebody else is doing the operation? */32093209- if (idempotent(&idem, file_inode(f))) {32103210- wait_for_completion(&idem.complete);32113211- return idem.ret;31863186+ /* Are we the winners of the race and get to do this? */31873187+ if (!idempotent(&idem, file_inode(f))) {31883188+ int ret = init_module_from_file(f, uargs, flags);31893189+ return idempotent_complete(&idem, ret);32123190 }3213319132143214- /* Otherwise, we'll do it and complete others */32153215- return idempotent_complete(&idem,32163216- init_module_from_file(f, uargs, flags));31923192+ /*31933193+ * Somebody else won the race and is loading the module.31943194+ */31953195+ return idempotent_wait_for_completion(&idem);32173196}3218319732193198SYSCALL_DEFINE3(finit_module, int, fd, const char __user *, uargs, int, flags)
+7
kernel/padata.c
···517517 ps.chunk_size = max(ps.chunk_size, job->min_chunk);518518 ps.chunk_size = roundup(ps.chunk_size, job->align);519519520520+ /*521521+ * chunk_size can be 0 if the caller sets min_chunk to 0. So force it522522+ * to at least 1 to prevent divide-by-0 panic in padata_mt_helper().`523523+ */524524+ if (!ps.chunk_size)525525+ ps.chunk_size = 1U;526526+520527 list_for_each_entry(pw, &works, pw_list)521528 if (job->numa_aware) {522529 int old_node = atomic_read(&last_used_nid);
+7-235
kernel/profile.c
···4747int prof_on __read_mostly;4848EXPORT_SYMBOL_GPL(prof_on);49495050-static cpumask_var_t prof_cpu_mask;5151-#if defined(CONFIG_SMP) && defined(CONFIG_PROC_FS)5252-static DEFINE_PER_CPU(struct profile_hit *[2], cpu_profile_hits);5353-static DEFINE_PER_CPU(int, cpu_profile_flip);5454-static DEFINE_MUTEX(profile_flip_mutex);5555-#endif /* CONFIG_SMP */5656-5750int profile_setup(char *str)5851{5952 static const char schedstr[] = "schedule";6060- static const char sleepstr[] = "sleep";6153 static const char kvmstr[] = "kvm";6254 const char *select = NULL;6355 int par;64566565- if (!strncmp(str, sleepstr, strlen(sleepstr))) {6666-#ifdef CONFIG_SCHEDSTATS6767- force_schedstat_enabled();6868- prof_on = SLEEP_PROFILING;6969- select = sleepstr;7070-#else7171- pr_warn("kernel sleep profiling requires CONFIG_SCHEDSTATS\n");7272-#endif /* CONFIG_SCHEDSTATS */7373- } else if (!strncmp(str, schedstr, strlen(schedstr))) {5757+ if (!strncmp(str, schedstr, strlen(schedstr))) {7458 prof_on = SCHED_PROFILING;7559 select = schedstr;7660 } else if (!strncmp(str, kvmstr, strlen(kvmstr))) {···9811499115 buffer_bytes = prof_len*sizeof(atomic_t);100116101101- if (!alloc_cpumask_var(&prof_cpu_mask, GFP_KERNEL))102102- return -ENOMEM;103103-104104- cpumask_copy(prof_cpu_mask, cpu_possible_mask);105105-106117 prof_buffer = kzalloc(buffer_bytes, GFP_KERNEL|__GFP_NOWARN);107118 if (prof_buffer)108119 return 0;···111132 if (prof_buffer)112133 return 0;113134114114- free_cpumask_var(prof_cpu_mask);115135 return -ENOMEM;116136}117117-118118-#if defined(CONFIG_SMP) && defined(CONFIG_PROC_FS)119119-/*120120- * Each cpu has a pair of open-addressed hashtables for pending121121- * profile hits. read_profile() IPI's all cpus to request them122122- * to flip buffers and flushes their contents to prof_buffer itself.123123- * Flip requests are serialized by the profile_flip_mutex. The sole124124- * use of having a second hashtable is for avoiding cacheline125125- * contention that would otherwise happen during flushes of pending126126- * profile hits required for the accuracy of reported profile hits127127- * and so resurrect the interrupt livelock issue.128128- *129129- * The open-addressed hashtables are indexed by profile buffer slot130130- * and hold the number of pending hits to that profile buffer slot on131131- * a cpu in an entry. When the hashtable overflows, all pending hits132132- * are accounted to their corresponding profile buffer slots with133133- * atomic_add() and the hashtable emptied. As numerous pending hits134134- * may be accounted to a profile buffer slot in a hashtable entry,135135- * this amortizes a number of atomic profile buffer increments likely136136- * to be far larger than the number of entries in the hashtable,137137- * particularly given that the number of distinct profile buffer138138- * positions to which hits are accounted during short intervals (e.g.139139- * several seconds) is usually very small. Exclusion from buffer140140- * flipping is provided by interrupt disablement (note that for141141- * SCHED_PROFILING or SLEEP_PROFILING profile_hit() may be called from142142- * process context).143143- * The hash function is meant to be lightweight as opposed to strong,144144- * and was vaguely inspired by ppc64 firmware-supported inverted145145- * pagetable hash functions, but uses a full hashtable full of finite146146- * collision chains, not just pairs of them.147147- *148148- * -- nyc149149- */150150-static void __profile_flip_buffers(void *unused)151151-{152152- int cpu = smp_processor_id();153153-154154- per_cpu(cpu_profile_flip, cpu) = !per_cpu(cpu_profile_flip, cpu);155155-}156156-157157-static void profile_flip_buffers(void)158158-{159159- int i, j, cpu;160160-161161- mutex_lock(&profile_flip_mutex);162162- j = per_cpu(cpu_profile_flip, get_cpu());163163- put_cpu();164164- on_each_cpu(__profile_flip_buffers, NULL, 1);165165- for_each_online_cpu(cpu) {166166- struct profile_hit *hits = per_cpu(cpu_profile_hits, cpu)[j];167167- for (i = 0; i < NR_PROFILE_HIT; ++i) {168168- if (!hits[i].hits) {169169- if (hits[i].pc)170170- hits[i].pc = 0;171171- continue;172172- }173173- atomic_add(hits[i].hits, &prof_buffer[hits[i].pc]);174174- hits[i].hits = hits[i].pc = 0;175175- }176176- }177177- mutex_unlock(&profile_flip_mutex);178178-}179179-180180-static void profile_discard_flip_buffers(void)181181-{182182- int i, cpu;183183-184184- mutex_lock(&profile_flip_mutex);185185- i = per_cpu(cpu_profile_flip, get_cpu());186186- put_cpu();187187- on_each_cpu(__profile_flip_buffers, NULL, 1);188188- for_each_online_cpu(cpu) {189189- struct profile_hit *hits = per_cpu(cpu_profile_hits, cpu)[i];190190- memset(hits, 0, NR_PROFILE_HIT*sizeof(struct profile_hit));191191- }192192- mutex_unlock(&profile_flip_mutex);193193-}194194-195195-static void do_profile_hits(int type, void *__pc, unsigned int nr_hits)196196-{197197- unsigned long primary, secondary, flags, pc = (unsigned long)__pc;198198- int i, j, cpu;199199- struct profile_hit *hits;200200-201201- pc = min((pc - (unsigned long)_stext) >> prof_shift, prof_len - 1);202202- i = primary = (pc & (NR_PROFILE_GRP - 1)) << PROFILE_GRPSHIFT;203203- secondary = (~(pc << 1) & (NR_PROFILE_GRP - 1)) << PROFILE_GRPSHIFT;204204- cpu = get_cpu();205205- hits = per_cpu(cpu_profile_hits, cpu)[per_cpu(cpu_profile_flip, cpu)];206206- if (!hits) {207207- put_cpu();208208- return;209209- }210210- /*211211- * We buffer the global profiler buffer into a per-CPU212212- * queue and thus reduce the number of global (and possibly213213- * NUMA-alien) accesses. The write-queue is self-coalescing:214214- */215215- local_irq_save(flags);216216- do {217217- for (j = 0; j < PROFILE_GRPSZ; ++j) {218218- if (hits[i + j].pc == pc) {219219- hits[i + j].hits += nr_hits;220220- goto out;221221- } else if (!hits[i + j].hits) {222222- hits[i + j].pc = pc;223223- hits[i + j].hits = nr_hits;224224- goto out;225225- }226226- }227227- i = (i + secondary) & (NR_PROFILE_HIT - 1);228228- } while (i != primary);229229-230230- /*231231- * Add the current hit(s) and flush the write-queue out232232- * to the global buffer:233233- */234234- atomic_add(nr_hits, &prof_buffer[pc]);235235- for (i = 0; i < NR_PROFILE_HIT; ++i) {236236- atomic_add(hits[i].hits, &prof_buffer[hits[i].pc]);237237- hits[i].pc = hits[i].hits = 0;238238- }239239-out:240240- local_irq_restore(flags);241241- put_cpu();242242-}243243-244244-static int profile_dead_cpu(unsigned int cpu)245245-{246246- struct page *page;247247- int i;248248-249249- if (cpumask_available(prof_cpu_mask))250250- cpumask_clear_cpu(cpu, prof_cpu_mask);251251-252252- for (i = 0; i < 2; i++) {253253- if (per_cpu(cpu_profile_hits, cpu)[i]) {254254- page = virt_to_page(per_cpu(cpu_profile_hits, cpu)[i]);255255- per_cpu(cpu_profile_hits, cpu)[i] = NULL;256256- __free_page(page);257257- }258258- }259259- return 0;260260-}261261-262262-static int profile_prepare_cpu(unsigned int cpu)263263-{264264- int i, node = cpu_to_mem(cpu);265265- struct page *page;266266-267267- per_cpu(cpu_profile_flip, cpu) = 0;268268-269269- for (i = 0; i < 2; i++) {270270- if (per_cpu(cpu_profile_hits, cpu)[i])271271- continue;272272-273273- page = __alloc_pages_node(node, GFP_KERNEL | __GFP_ZERO, 0);274274- if (!page) {275275- profile_dead_cpu(cpu);276276- return -ENOMEM;277277- }278278- per_cpu(cpu_profile_hits, cpu)[i] = page_address(page);279279-280280- }281281- return 0;282282-}283283-284284-static int profile_online_cpu(unsigned int cpu)285285-{286286- if (cpumask_available(prof_cpu_mask))287287- cpumask_set_cpu(cpu, prof_cpu_mask);288288-289289- return 0;290290-}291291-292292-#else /* !CONFIG_SMP */293293-#define profile_flip_buffers() do { } while (0)294294-#define profile_discard_flip_buffers() do { } while (0)295137296138static void do_profile_hits(int type, void *__pc, unsigned int nr_hits)297139{298140 unsigned long pc;299141 pc = ((unsigned long)__pc - (unsigned long)_stext) >> prof_shift;300300- atomic_add(nr_hits, &prof_buffer[min(pc, prof_len - 1)]);142142+ if (pc < prof_len)143143+ atomic_add(nr_hits, &prof_buffer[pc]);301144}302302-#endif /* !CONFIG_SMP */303145304146void profile_hits(int type, void *__pc, unsigned int nr_hits)305147{···134334{135335 struct pt_regs *regs = get_irq_regs();136336137137- if (!user_mode(regs) && cpumask_available(prof_cpu_mask) &&138138- cpumask_test_cpu(smp_processor_id(), prof_cpu_mask))337337+ /* This is the old kernel-only legacy profiling */338338+ if (!user_mode(regs))139339 profile_hit(type, (void *)profile_pc(regs));140340}141341···158358 char *pnt;159359 unsigned long sample_step = 1UL << prof_shift;160360161161- profile_flip_buffers();162361 if (p >= (prof_len+1)*sizeof(unsigned int))163362 return 0;164363 if (count > (prof_len+1)*sizeof(unsigned int) - p)···203404 return -EINVAL;204405 }205406#endif206206- profile_discard_flip_buffers();207407 memset(prof_buffer, 0, prof_len * sizeof(atomic_t));208408 return count;209409}···216418int __ref create_proc_profile(void)217419{218420 struct proc_dir_entry *entry;219219-#ifdef CONFIG_SMP220220- enum cpuhp_state online_state;221221-#endif222222-223421 int err = 0;224422225423 if (!prof_on)226424 return 0;227227-#ifdef CONFIG_SMP228228- err = cpuhp_setup_state(CPUHP_PROFILE_PREPARE, "PROFILE_PREPARE",229229- profile_prepare_cpu, profile_dead_cpu);230230- if (err)231231- return err;232232-233233- err = cpuhp_setup_state(CPUHP_AP_ONLINE_DYN, "AP_PROFILE_ONLINE",234234- profile_online_cpu, NULL);235235- if (err < 0)236236- goto err_state_prep;237237- online_state = err;238238- err = 0;239239-#endif240425 entry = proc_create("profile", S_IWUSR | S_IRUGO,241426 NULL, &profile_proc_ops);242242- if (!entry)243243- goto err_state_onl;244244- proc_set_size(entry, (1 + prof_len) * sizeof(atomic_t));245245-246246- return err;247247-err_state_onl:248248-#ifdef CONFIG_SMP249249- cpuhp_remove_state(online_state);250250-err_state_prep:251251- cpuhp_remove_state(CPUHP_PROFILE_PREPARE);252252-#endif427427+ if (entry)428428+ proc_set_size(entry, (1 + prof_len) * sizeof(atomic_t));253429 return err;254430}255431subsys_initcall(create_proc_profile);
+47-21
kernel/sched/core.c
···78457845 }78467846}7847784778487848+static inline void sched_set_rq_online(struct rq *rq, int cpu)78497849+{78507850+ struct rq_flags rf;78517851+78527852+ rq_lock_irqsave(rq, &rf);78537853+ if (rq->rd) {78547854+ BUG_ON(!cpumask_test_cpu(cpu, rq->rd->span));78557855+ set_rq_online(rq);78567856+ }78577857+ rq_unlock_irqrestore(rq, &rf);78587858+}78597859+78607860+static inline void sched_set_rq_offline(struct rq *rq, int cpu)78617861+{78627862+ struct rq_flags rf;78637863+78647864+ rq_lock_irqsave(rq, &rf);78657865+ if (rq->rd) {78667866+ BUG_ON(!cpumask_test_cpu(cpu, rq->rd->span));78677867+ set_rq_offline(rq);78687868+ }78697869+ rq_unlock_irqrestore(rq, &rf);78707870+}78717871+78487872/*78497873 * used to mark begin/end of suspend/resume:78507874 */···79197895 return 0;79207896}7921789778987898+static inline void sched_smt_present_inc(int cpu)78997899+{79007900+#ifdef CONFIG_SCHED_SMT79017901+ if (cpumask_weight(cpu_smt_mask(cpu)) == 2)79027902+ static_branch_inc_cpuslocked(&sched_smt_present);79037903+#endif79047904+}79057905+79067906+static inline void sched_smt_present_dec(int cpu)79077907+{79087908+#ifdef CONFIG_SCHED_SMT79097909+ if (cpumask_weight(cpu_smt_mask(cpu)) == 2)79107910+ static_branch_dec_cpuslocked(&sched_smt_present);79117911+#endif79127912+}79137913+79227914int sched_cpu_activate(unsigned int cpu)79237915{79247916 struct rq *rq = cpu_rq(cpu);79257925- struct rq_flags rf;7926791779277918 /*79287919 * Clear the balance_push callback and prepare to schedule···79457906 */79467907 balance_push_set(cpu, false);7947790879487948-#ifdef CONFIG_SCHED_SMT79497909 /*79507910 * When going up, increment the number of cores with SMT present.79517911 */79527952- if (cpumask_weight(cpu_smt_mask(cpu)) == 2)79537953- static_branch_inc_cpuslocked(&sched_smt_present);79547954-#endif79127912+ sched_smt_present_inc(cpu);79557913 set_cpu_active(cpu, true);7956791479577915 if (sched_smp_initialized) {···79667930 * 2) At runtime, if cpuset_cpu_active() fails to rebuild the79677931 * domains.79687932 */79697969- rq_lock_irqsave(rq, &rf);79707970- if (rq->rd) {79717971- BUG_ON(!cpumask_test_cpu(cpu, rq->rd->span));79727972- set_rq_online(rq);79737973- }79747974- rq_unlock_irqrestore(rq, &rf);79337933+ sched_set_rq_online(rq, cpu);7975793479767935 return 0;79777936}···79747943int sched_cpu_deactivate(unsigned int cpu)79757944{79767945 struct rq *rq = cpu_rq(cpu);79777977- struct rq_flags rf;79787946 int ret;7979794779807948 /*···80047974 */80057975 synchronize_rcu();8006797680078007- rq_lock_irqsave(rq, &rf);80088008- if (rq->rd) {80098009- BUG_ON(!cpumask_test_cpu(cpu, rq->rd->span));80108010- set_rq_offline(rq);80118011- }80128012- rq_unlock_irqrestore(rq, &rf);79777977+ sched_set_rq_offline(rq, cpu);8013797880148014-#ifdef CONFIG_SCHED_SMT80157979 /*80167980 * When going down, decrement the number of cores with SMT present.80177981 */80188018- if (cpumask_weight(cpu_smt_mask(cpu)) == 2)80198019- static_branch_dec_cpuslocked(&sched_smt_present);79827982+ sched_smt_present_dec(cpu);8020798379847984+#ifdef CONFIG_SCHED_SMT80217985 sched_core_cpu_deactivate(cpu);80227986#endif80237987···80217997 sched_update_numa(cpu, false);80227998 ret = cpuset_cpu_inactive(cpu);80237999 if (ret) {80008000+ sched_smt_present_inc(cpu);80018001+ sched_set_rq_online(rq, cpu);80248002 balance_push_set(cpu, false);80258003 set_cpu_active(cpu, true);80268004 sched_update_numa(cpu, true);
+6
kernel/sched/cputime.c
···582582 }583583584584 stime = mul_u64_u64_div_u64(stime, rtime, stime + utime);585585+ /*586586+ * Because mul_u64_u64_div_u64() can approximate on some587587+ * achitectures; enforce the constraint that: a*b/(b+c) <= a.588588+ */589589+ if (unlikely(stime > rtime))590590+ stime = rtime;585591586592update:587593 /*
-10
kernel/sched/stats.c
···92929393 trace_sched_stat_blocked(p, delta);94949595- /*9696- * Blocking time is in units of nanosecs, so shift by9797- * 20 to get a milliseconds-range estimation of the9898- * amount of time that the task spent sleeping:9999- */100100- if (unlikely(prof_on == SLEEP_PROFILING)) {101101- profile_hits(SLEEP_PROFILING,102102- (void *)get_wchan(p),103103- delta >> 20);104104- }10595 account_scheduler_latency(p, delta >> 10, 0);10696 }10797 }
+6
kernel/task_work.c
···6677static struct callback_head work_exited; /* all we need is ->next == NULL */8899+#ifdef CONFIG_IRQ_WORK910static void task_work_set_notify_irq(struct irq_work *entry)1011{1112 test_and_set_tsk_thread_flag(current, TIF_NOTIFY_RESUME);1213}1314static DEFINE_PER_CPU(struct irq_work, irq_work_NMI_resume) =1415 IRQ_WORK_INIT_HARD(task_work_set_notify_irq);1616+#endif15171618/**1719 * task_work_add - ask the @task to execute @work->func()···5957 if (notify == TWA_NMI_CURRENT) {6058 if (WARN_ON_ONCE(task != current))6159 return -EINVAL;6060+ if (!IS_ENABLED(CONFIG_IRQ_WORK))6161+ return -EINVAL;6262 } else {6363 /* record the work call stack in order to print it in KASAN reports */6464 kasan_record_aux_stack(work);···8581 case TWA_SIGNAL_NO_IPI:8682 __set_notify_signal(task);8783 break;8484+#ifdef CONFIG_IRQ_WORK8885 case TWA_NMI_CURRENT:8986 irq_work_queue(this_cpu_ptr(&irq_work_NMI_resume));9087 break;8888+#endif9189 default:9290 WARN_ON_ONCE(1);9391 break;
+1-1
kernel/time/clocksource.c
···246246247247 wd_delay = cycles_to_nsec_safe(watchdog, *wdnow, wd_end);248248 if (wd_delay <= WATCHDOG_MAX_SKEW) {249249- if (nretries > 1 || nretries >= max_retries) {249249+ if (nretries > 1 && nretries >= max_retries) {250250 pr_warn("timekeeping watchdog on CPU%d: %s retried %d times before success\n",251251 smp_processor_id(), watchdog->name, nretries);252252 }
···902902903903 i = *idx ? : task->curr_ret_stack;904904 while (i > 0) {905905- ret_stack = get_ret_stack(current, i, &i);905905+ ret_stack = get_ret_stack(task, i, &i);906906 if (!ret_stack)907907 break;908908 /*
···693693}694694695695/**696696- * ring_buffer_nr_pages - get the number of buffer pages in the ring buffer697697- * @buffer: The ring_buffer to get the number of pages from698698- * @cpu: The cpu of the ring_buffer to get the number of pages from699699- *700700- * Returns the number of pages used by a per_cpu buffer of the ring buffer.701701- */702702-size_t ring_buffer_nr_pages(struct trace_buffer *buffer, int cpu)703703-{704704- return buffer->buffers[cpu]->nr_pages;705705-}706706-707707-/**708696 * ring_buffer_nr_dirty_pages - get the number of used pages in the ring buffer709697 * @buffer: The ring_buffer to get the number of pages from710698 * @cpu: The cpu of the ring_buffer to get the number of pages from
+23
kernel/trace/trace.h
···16341634extern struct mutex event_mutex;16351635extern struct list_head ftrace_events;1636163616371637+/*16381638+ * When the trace_event_file is the filp->i_private pointer,16391639+ * it must be taken under the event_mutex lock, and then checked16401640+ * if the EVENT_FILE_FL_FREED flag is set. If it is, then the16411641+ * data pointed to by the trace_event_file can not be trusted.16421642+ *16431643+ * Use the event_file_file() to access the trace_event_file from16441644+ * the filp the first time under the event_mutex and check for16451645+ * NULL. If it is needed to be retrieved again and the event_mutex16461646+ * is still held, then the event_file_data() can be used and it16471647+ * is guaranteed to be valid.16481648+ */16491649+static inline struct trace_event_file *event_file_file(struct file *filp)16501650+{16511651+ struct trace_event_file *file;16521652+16531653+ lockdep_assert_held(&event_mutex);16541654+ file = READ_ONCE(file_inode(filp)->i_private);16551655+ if (!file || file->flags & EVENT_FILE_FL_FREED)16561656+ return NULL;16571657+ return file;16581658+}16591659+16371660extern const struct file_operations event_trigger_fops;16381661extern const struct file_operations event_hist_fops;16391662extern const struct file_operations event_hist_debug_fops;
+24-17
kernel/trace/trace_events.c
···992992993993void event_file_get(struct trace_event_file *file)994994{995995- atomic_inc(&file->ref);995995+ refcount_inc(&file->ref);996996}997997998998void event_file_put(struct trace_event_file *file)999999{10001000- if (WARN_ON_ONCE(!atomic_read(&file->ref))) {10001000+ if (WARN_ON_ONCE(!refcount_read(&file->ref))) {10011001 if (file->flags & EVENT_FILE_FL_FREED)10021002 kmem_cache_free(file_cachep, file);10031003 return;10041004 }1005100510061006- if (atomic_dec_and_test(&file->ref)) {10061006+ if (refcount_dec_and_test(&file->ref)) {10071007 /* Count should only go to zero when it is freed */10081008 if (WARN_ON_ONCE(!(file->flags & EVENT_FILE_FL_FREED)))10091009 return;···13861386 char buf[4] = "0";1387138713881388 mutex_lock(&event_mutex);13891389- file = event_file_data(filp);13891389+ file = event_file_file(filp);13901390 if (likely(file))13911391 flags = file->flags;13921392 mutex_unlock(&event_mutex);1393139313941394- if (!file || flags & EVENT_FILE_FL_FREED)13941394+ if (!file)13951395 return -ENODEV;1396139613971397 if (flags & EVENT_FILE_FL_ENABLED &&···14241424 case 1:14251425 ret = -ENODEV;14261426 mutex_lock(&event_mutex);14271427- file = event_file_data(filp);14281428- if (likely(file && !(file->flags & EVENT_FILE_FL_FREED))) {14271427+ file = event_file_file(filp);14281428+ if (likely(file)) {14291429 ret = tracing_update_buffers(file->tr);14301430 if (ret < 0) {14311431 mutex_unlock(&event_mutex);···1540154015411541static void *f_next(struct seq_file *m, void *v, loff_t *pos)15421542{15431543- struct trace_event_call *call = event_file_data(m->private);15431543+ struct trace_event_file *file = event_file_data(m->private);15441544+ struct trace_event_call *call = file->event_call;15441545 struct list_head *common_head = &ftrace_common_fields;15451546 struct list_head *head = trace_get_fields(call);15461547 struct list_head *node = v;···1573157215741573static int f_show(struct seq_file *m, void *v)15751574{15761576- struct trace_event_call *call = event_file_data(m->private);15751575+ struct trace_event_file *file = event_file_data(m->private);15761576+ struct trace_event_call *call = file->event_call;15771577 struct ftrace_event_field *field;15781578 const char *array_descriptor;15791579···1629162716301628static void *f_start(struct seq_file *m, loff_t *pos)16311629{16301630+ struct trace_event_file *file;16321631 void *p = (void *)FORMAT_HEADER;16331632 loff_t l = 0;1634163316351634 /* ->stop() is called even if ->start() fails */16361635 mutex_lock(&event_mutex);16371637- if (!event_file_data(m->private))16361636+ file = event_file_file(m->private);16371637+ if (!file)16381638 return ERR_PTR(-ENODEV);1639163916401640 while (l < *pos && p)···17101706 trace_seq_init(s);1711170717121708 mutex_lock(&event_mutex);17131713- file = event_file_data(filp);17141714- if (file && !(file->flags & EVENT_FILE_FL_FREED))17091709+ file = event_file_file(filp);17101710+ if (file)17151711 print_event_filter(file, s);17161712 mutex_unlock(&event_mutex);17171713···17401736 return PTR_ERR(buf);1741173717421738 mutex_lock(&event_mutex);17431743- file = event_file_data(filp);17441744- if (file)17451745- err = apply_event_filter(file, buf);17391739+ file = event_file_file(filp);17401740+ if (file) {17411741+ if (file->flags & EVENT_FILE_FL_FREED)17421742+ err = -ENODEV;17431743+ else17441744+ err = apply_event_filter(file, buf);17451745+ }17461746 mutex_unlock(&event_mutex);1747174717481748 kfree(buf);···24932485 if (strcmp(name, "format") == 0) {24942486 *mode = TRACE_MODE_READ;24952487 *fops = &ftrace_event_format_fops;24962496- *data = call;24972488 return 1;24982489 }24992490···30032996 atomic_set(&file->tm_ref, 0);30042997 INIT_LIST_HEAD(&file->triggers);30052998 list_add(&file->list, &tr->events);30063006- event_file_get(file);29992999+ refcount_set(&file->ref, 1);3007300030083001 return file;30093002}
+2-2
kernel/trace/trace_events_hist.c
···5601560156025602 mutex_lock(&event_mutex);5603560356045604- event_file = event_file_data(m->private);56045604+ event_file = event_file_file(m->private);56055605 if (unlikely(!event_file)) {56065606 ret = -ENODEV;56075607 goto out_unlock;···5880588058815881 mutex_lock(&event_mutex);5882588258835883- event_file = event_file_data(m->private);58835883+ event_file = event_file_file(m->private);58845884 if (unlikely(!event_file)) {58855885 ret = -ENODEV;58865886 goto out_unlock;
···37373838#include <linux/decompress/mm.h>39394040+#ifndef MIN4041#define MIN(a, b) (((a) < (b)) ? (a) : (b))4242+#endif41434244static long long INIT read_int(unsigned char *ptr, int size)4345{
···120120#define CLASS_BITS 8121121#define MAGIC_VAL_BITS 8122122123123-#define MAX(a, b) ((a) >= (b) ? (a) : (b))124124-125123#define ZS_MAX_PAGES_PER_ZSPAGE (_AC(CONFIG_ZSMALLOC_CHAIN_SIZE, UL))126124127125/* ZS_MIN_ALLOC_SIZE must be multiple of ZS_ALIGN */
-7
net/bluetooth/hci_core.c
···119119 case DISCOVERY_STARTING:120120 break;121121 case DISCOVERY_FINDING:122122- /* If discovery was not started then it was initiated by the123123- * MGMT interface so no MGMT event shall be generated either124124- */125125- if (old_state != DISCOVERY_STARTING) {126126- hdev->discovery.state = old_state;127127- return;128128- }129122 mgmt_discovering(hdev, 1);130123 break;131124 case DISCOVERY_RESOLVING:
+3-2
net/bluetooth/hci_event.c
···17211721 switch (enable) {17221722 case LE_SCAN_ENABLE:17231723 hci_dev_set_flag(hdev, HCI_LE_SCAN);17241724- if (hdev->le_scan_type == LE_SCAN_ACTIVE)17241724+ if (hdev->le_scan_type == LE_SCAN_ACTIVE) {17251725 clear_pending_adv_report(hdev);17261726- hci_discovery_set_state(hdev, DISCOVERY_FINDING);17261726+ hci_discovery_set_state(hdev, DISCOVERY_FINDING);17271727+ }17271728 break;1728172917291730 case LE_SCAN_DISABLE:
+35
net/bluetooth/hci_sync.c
···29762976 */29772977 filter_policy = hci_update_accept_list_sync(hdev);2978297829792979+ /* If suspended and filter_policy set to 0x00 (no acceptlist) then29802980+ * passive scanning cannot be started since that would require the host29812981+ * to be woken up to process the reports.29822982+ */29832983+ if (hdev->suspended && !filter_policy) {29842984+ /* Check if accept list is empty then there is no need to scan29852985+ * while suspended.29862986+ */29872987+ if (list_empty(&hdev->le_accept_list))29882988+ return 0;29892989+29902990+ /* If there are devices is the accept_list that means some29912991+ * devices could not be programmed which in non-suspended case29922992+ * means filter_policy needs to be set to 0x00 so the host needs29932993+ * to filter, but since this is treating suspended case we29942994+ * can ignore device needing host to filter to allow devices in29952995+ * the acceptlist to be able to wakeup the system.29962996+ */29972997+ filter_policy = 0x01;29982998+ }29992999+29793000 /* When the controller is using random resolvable addresses and29803001 * with that having LE privacy enabled, then controllers with29813002 * Extended Scanner Filter Policies support can now enable support···30192998 } else if (hci_is_adv_monitoring(hdev)) {30202999 window = hdev->le_scan_window_adv_monitor;30213000 interval = hdev->le_scan_int_adv_monitor;30013001+30023002+ /* Disable duplicates filter when scanning for advertisement30033003+ * monitor for the following reasons.30043004+ *30053005+ * For HW pattern filtering (ex. MSFT), Realtek and Qualcomm30063006+ * controllers ignore RSSI_Sampling_Period when the duplicates30073007+ * filter is enabled.30083008+ *30093009+ * For SW pattern filtering, when we're not doing interleaved30103010+ * scanning, it is necessary to disable duplicates filter,30113011+ * otherwise hosts can only receive one advertisement and it's30123012+ * impossible to know if a peer is still in range.30133013+ */30143014+ filter_dups = LE_SCAN_FILTER_DUP_DISABLE;30223015 } else {30233016 window = hdev->le_scan_window;30243017 interval = hdev->le_scan_interval;
···20452045{20462046 struct net_bridge *br = port->br;20472047 struct net_bridge_port_group *pg;20482048- HLIST_HEAD(deleted_head);20492048 struct hlist_node *n;2050204920512050 /* Take care of the remaining groups, only perm ones should be left */20522051 spin_lock_bh(&br->multicast_lock);20532052 hlist_for_each_entry_safe(pg, n, &port->mglist, mglist)20542053 br_multicast_find_del_pg(br, pg);20552055- hlist_move_list(&br->mcast_gc_list, &deleted_head);20562054 spin_unlock_bh(&br->multicast_lock);20572057- br_multicast_gc(&deleted_head);20552055+ flush_work(&br->mcast_gc_work);20582056 br_multicast_port_ctx_deinit(&port->multicast_ctx);20592057 free_percpu(port->mcast_stats);20602058}
···32883288 if (ifm->ifi_index > 0)32893289 dev = __dev_get_by_index(tgt_net, ifm->ifi_index);32903290 else if (tb[IFLA_IFNAME] || tb[IFLA_ALT_IFNAME])32913291- dev = rtnl_dev_get(net, tb);32913291+ dev = rtnl_dev_get(tgt_net, tb);32923292 else if (tb[IFLA_GROUP])32933293 err = rtnl_group_dellink(tgt_net, nla_get_u32(tb[IFLA_GROUP]));32943294 else
+44-17
net/ethtool/ioctl.c
···13311331 u32 rss_cfg_offset = offsetof(struct ethtool_rxfh, rss_config[0]);13321332 const struct ethtool_ops *ops = dev->ethtool_ops;13331333 u32 dev_indir_size = 0, dev_key_size = 0, i;13341334+ u32 user_indir_len = 0, indir_bytes = 0;13341335 struct ethtool_rxfh_param rxfh_dev = {};13351336 struct ethtool_rxfh_context *ctx = NULL;13361337 struct netlink_ext_ack *extack = NULL;13371338 struct ethtool_rxnfc rx_rings;13381339 struct ethtool_rxfh rxfh;13391340 bool locked = false; /* dev->ethtool->rss_lock taken */13401340- u32 indir_bytes = 0;13411341 bool create = false;13421342 u8 *rss_config;13431343 int ret;···13691369 return -EOPNOTSUPP;13701370 create = rxfh.rss_context == ETH_RXFH_CONTEXT_ALLOC;1371137113721372- /* If either indir, hash key or function is valid, proceed further.13731373- * Must request at least one change: indir size, hash key, function13741374- * or input transformation.13751375- */13761372 if ((rxfh.indir_size &&13771373 rxfh.indir_size != ETH_RXFH_INDIR_NO_CHANGE &&13781374 rxfh.indir_size != dev_indir_size) ||13791379- (rxfh.key_size && (rxfh.key_size != dev_key_size)) ||13751375+ (rxfh.key_size && rxfh.key_size != dev_key_size))13761376+ return -EINVAL;13771377+13781378+ /* Must request at least one change: indir size, hash key, function13791379+ * or input transformation.13801380+ * There's no need for any of it in case of context creation.13811381+ */13821382+ if (!create &&13801383 (rxfh.indir_size == ETH_RXFH_INDIR_NO_CHANGE &&13811384 rxfh.key_size == 0 && rxfh.hfunc == ETH_RSS_HASH_NO_CHANGE &&13821385 rxfh.input_xfrm == RXH_XFRM_NO_CHANGE))13831386 return -EINVAL;1384138713851385- if (rxfh.indir_size != ETH_RXFH_INDIR_NO_CHANGE)13861386- indir_bytes = dev_indir_size * sizeof(rxfh_dev.indir[0]);13881388+ indir_bytes = dev_indir_size * sizeof(rxfh_dev.indir[0]);1387138913881388- rss_config = kzalloc(indir_bytes + rxfh.key_size, GFP_USER);13901390+ rss_config = kzalloc(indir_bytes + dev_key_size, GFP_USER);13891391 if (!rss_config)13901392 return -ENOMEM;13911393···14021400 */14031401 if (rxfh.indir_size &&14041402 rxfh.indir_size != ETH_RXFH_INDIR_NO_CHANGE) {14031403+ user_indir_len = indir_bytes;14051404 rxfh_dev.indir = (u32 *)rss_config;14061405 rxfh_dev.indir_size = dev_indir_size;14071406 ret = ethtool_copy_validate_indir(rxfh_dev.indir,···14291426 rxfh_dev.key_size = dev_key_size;14301427 rxfh_dev.key = rss_config + indir_bytes;14311428 if (copy_from_user(rxfh_dev.key,14321432- useraddr + rss_cfg_offset + indir_bytes,14291429+ useraddr + rss_cfg_offset + user_indir_len,14331430 rxfh.key_size)) {14341431 ret = -EFAULT;14351432 goto out;···14521449 }1453145014541451 if (ops->create_rxfh_context) {14551455- u32 limit = ops->rxfh_max_context_id ?: U32_MAX;14521452+ u32 limit = ops->rxfh_max_num_contexts ?: U32_MAX;14561453 u32 ctx_id;1457145414581455 /* driver uses new API, core allocates ID */14591456 ret = xa_alloc(&dev->ethtool->rss_ctx, &ctx_id, ctx,14601460- XA_LIMIT(1, limit), GFP_KERNEL_ACCOUNT);14571457+ XA_LIMIT(1, limit - 1),14581458+ GFP_KERNEL_ACCOUNT);14611459 if (ret < 0) {14621460 kfree(ctx);14631461 goto out;···14781474 rxfh_dev.input_xfrm = rxfh.input_xfrm;1479147514801476 if (rxfh.rss_context && ops->create_rxfh_context) {14811481- if (create)14771477+ if (create) {14821478 ret = ops->create_rxfh_context(dev, ctx, &rxfh_dev,14831479 extack);14841484- else if (rxfh_dev.rss_delete)14801480+ /* Make sure driver populates defaults */14811481+ WARN_ON_ONCE(!ret && !rxfh_dev.key &&14821482+ !memchr_inv(ethtool_rxfh_context_key(ctx),14831483+ 0, ctx->key_size));14841484+ } else if (rxfh_dev.rss_delete) {14851485 ret = ops->remove_rxfh_context(dev, ctx,14861486 rxfh.rss_context,14871487 extack);14881488- else14881488+ } else {14891489 ret = ops->modify_rxfh_context(dev, ctx, &rxfh_dev,14901490 extack);14911491+ }14911492 } else {14921493 ret = ops->set_rxfh(dev, &rxfh_dev, extack);14931494 }···15311522 kfree(ctx);15321523 goto out;15331524 }15251525+15261526+ /* Fetch the defaults for the old API, in the new API drivers15271527+ * should write defaults into ctx themselves.15281528+ */15291529+ rxfh_dev.indir = (u32 *)rss_config;15301530+ rxfh_dev.indir_size = dev_indir_size;15311531+15321532+ rxfh_dev.key = rss_config + indir_bytes;15331533+ rxfh_dev.key_size = dev_key_size;15341534+15351535+ ret = ops->get_rxfh(dev, &rxfh_dev);15361536+ if (WARN_ON(ret)) {15371537+ xa_erase(&dev->ethtool->rss_ctx, rxfh.rss_context);15381538+ kfree(ctx);15391539+ goto out;15401540+ }15341541 }15351542 if (rxfh_dev.rss_delete) {15361543 WARN_ON(xa_erase(&dev->ethtool->rss_ctx, rxfh.rss_context) != ctx);···15551530 if (rxfh_dev.indir) {15561531 for (i = 0; i < dev_indir_size; i++)15571532 ethtool_rxfh_context_indir(ctx)[i] = rxfh_dev.indir[i];15581558- ctx->indir_configured = 1;15331533+ ctx->indir_configured =15341534+ rxfh.indir_size &&15351535+ rxfh.indir_size != ETH_RXFH_INDIR_NO_CHANGE;15591536 }15601537 if (rxfh_dev.key) {15611538 memcpy(ethtool_rxfh_context_key(ctx), rxfh_dev.key,15621539 dev_key_size);15631563- ctx->key_configured = 1;15401540+ ctx->key_configured = !!rxfh.key_size;15641541 }15651542 if (rxfh_dev.hfunc != ETH_RSS_HASH_NO_CHANGE)15661543 ctx->hfunc = rxfh_dev.hfunc;
···145145146146static int __init iptable_nat_init(void)147147{148148- int ret = xt_register_template(&nf_nat_ipv4_table,149149- iptable_nat_table_init);148148+ int ret;150149150150+ /* net->gen->ptr[iptable_nat_net_id] must be allocated151151+ * before calling iptable_nat_table_init().152152+ */153153+ ret = register_pernet_subsys(&iptable_nat_net_ops);151154 if (ret < 0)152155 return ret;153156154154- ret = register_pernet_subsys(&iptable_nat_net_ops);155155- if (ret < 0) {156156- xt_unregister_template(&nf_nat_ipv4_table);157157- return ret;158158- }157157+ ret = xt_register_template(&nf_nat_ipv4_table,158158+ iptable_nat_table_init);159159+ if (ret < 0)160160+ unregister_pernet_subsys(&iptable_nat_net_ops);159161160162 return ret;161163}162164163165static void __exit iptable_nat_exit(void)164166{165165- unregister_pernet_subsys(&iptable_nat_net_ops);166167 xt_unregister_template(&nf_nat_ipv4_table);168168+ unregister_pernet_subsys(&iptable_nat_net_ops);167169}168170169171module_init(iptable_nat_init);
···754754 * <prev RTT . ><current RTT .. ><next RTT .... >755755 */756756757757- if (READ_ONCE(sock_net(sk)->ipv4.sysctl_tcp_moderate_rcvbuf) &&758758- !(sk->sk_userlocks & SOCK_RCVBUF_LOCK)) {757757+ if (READ_ONCE(sock_net(sk)->ipv4.sysctl_tcp_moderate_rcvbuf)) {759758 u64 rcvwin, grow;760759 int rcvbuf;761760···770771771772 rcvbuf = min_t(u64, tcp_space_from_win(sk, rcvwin),772773 READ_ONCE(sock_net(sk)->ipv4.sysctl_tcp_rmem[2]));773773- if (rcvbuf > sk->sk_rcvbuf) {774774- WRITE_ONCE(sk->sk_rcvbuf, rcvbuf);774774+ if (!(sk->sk_userlocks & SOCK_RCVBUF_LOCK)) {775775+ if (rcvbuf > sk->sk_rcvbuf) {776776+ WRITE_ONCE(sk->sk_rcvbuf, rcvbuf);775777776776- /* Make the window clamp follow along. */777777- WRITE_ONCE(tp->window_clamp,778778- tcp_win_from_space(sk, rcvbuf));778778+ /* Make the window clamp follow along. */779779+ WRITE_ONCE(tp->window_clamp,780780+ tcp_win_from_space(sk, rcvbuf));781781+ }782782+ } else {783783+ /* Make the window clamp follow along while being bounded784784+ * by SO_RCVBUF.785785+ */786786+ int clamp = tcp_win_from_space(sk, min(rcvbuf, sk->sk_rcvbuf));787787+788788+ if (clamp > tp->window_clamp)789789+ WRITE_ONCE(tp->window_clamp, clamp);779790 }780791 }781792 tp->rcvq_space.space = copied;
+3
net/ipv4/tcp_offload.c
···140140 if (thlen < sizeof(*th))141141 goto out;142142143143+ if (unlikely(skb_checksum_start(skb) != skb_transport_header(skb)))144144+ goto out;145145+143146 if (!pskb_may_pull(skb, thlen))144147 goto out;145148
+4
net/ipv4/udp_offload.c
···278278 if (gso_skb->len <= sizeof(*uh) + mss)279279 return ERR_PTR(-EINVAL);280280281281+ if (unlikely(skb_checksum_start(gso_skb) !=282282+ skb_transport_header(gso_skb)))283283+ return ERR_PTR(-EINVAL);284284+281285 if (skb_gso_ok(gso_skb, features | NETIF_F_GSO_ROBUST)) {282286 /* Packet is from an untrusted source, reset gso_segs. */283287 skb_shinfo(gso_skb)->gso_segs = DIV_ROUND_UP(gso_skb->len - sizeof(*uh),
+18-16
net/ipv6/ndisc.c
···227227 return NULL;228228 memset(ndopts, 0, sizeof(*ndopts));229229 while (opt_len) {230230+ bool unknown = false;230231 int l;231232 if (opt_len < sizeof(struct nd_opt_hdr))232233 return NULL;···263262 break;264263#endif265264 default:266266- if (ndisc_is_useropt(dev, nd_opt)) {267267- ndopts->nd_useropts_end = nd_opt;268268- if (!ndopts->nd_useropts)269269- ndopts->nd_useropts = nd_opt;270270- } else {271271- /*272272- * Unknown options must be silently ignored,273273- * to accommodate future extension to the274274- * protocol.275275- */276276- ND_PRINTK(2, notice,277277- "%s: ignored unsupported option; type=%d, len=%d\n",278278- __func__,279279- nd_opt->nd_opt_type,280280- nd_opt->nd_opt_len);281281- }265265+ unknown = true;266266+ }267267+ if (ndisc_is_useropt(dev, nd_opt)) {268268+ ndopts->nd_useropts_end = nd_opt;269269+ if (!ndopts->nd_useropts)270270+ ndopts->nd_useropts = nd_opt;271271+ } else if (unknown) {272272+ /*273273+ * Unknown options must be silently ignored,274274+ * to accommodate future extension to the275275+ * protocol.276276+ */277277+ ND_PRINTK(2, notice,278278+ "%s: ignored unsupported option; type=%d, len=%d\n",279279+ __func__,280280+ nd_opt->nd_opt_type,281281+ nd_opt->nd_opt_len);282282 }283283next_opt:284284 opt_len -= l;
+9-5
net/ipv6/netfilter/ip6table_nat.c
···147147148148static int __init ip6table_nat_init(void)149149{150150- int ret = xt_register_template(&nf_nat_ipv6_table,151151- ip6table_nat_table_init);150150+ int ret;152151152152+ /* net->gen->ptr[ip6table_nat_net_id] must be allocated153153+ * before calling ip6t_nat_register_lookups().154154+ */155155+ ret = register_pernet_subsys(&ip6table_nat_net_ops);153156 if (ret < 0)154157 return ret;155158156156- ret = register_pernet_subsys(&ip6table_nat_net_ops);159159+ ret = xt_register_template(&nf_nat_ipv6_table,160160+ ip6table_nat_table_init);157161 if (ret)158158- xt_unregister_template(&nf_nat_ipv6_table);162162+ unregister_pernet_subsys(&ip6table_nat_net_ops);159163160164 return ret;161165}162166163167static void __exit ip6table_nat_exit(void)164168{165165- unregister_pernet_subsys(&ip6table_nat_net_ops);166169 xt_unregister_template(&nf_nat_ipv6_table);170170+ unregister_pernet_subsys(&ip6table_nat_net_ops);167171}168172169173module_init(ip6table_nat_init);
+2-2
net/iucv/af_iucv.c
···335335 struct iucv_sock *iucv = iucv_sk(sk);336336 struct iucv_path *path = iucv->path;337337338338- if (iucv->path) {339339- iucv->path = NULL;338338+ /* Whoever resets the path pointer, must sever and free it. */339339+ if (xchg(&iucv->path, NULL)) {340340 if (with_user_data) {341341 low_nmcpy(user_data, iucv->src_name);342342 high_nmcpy(user_data, iucv->dst_name);
+13-2
net/l2tp/l2tp_core.c
···8686/* Default trace flags */8787#define L2TP_DEFAULT_DEBUG_FLAGS 088888989+#define L2TP_DEPTH_NESTING 29090+#if L2TP_DEPTH_NESTING == SINGLE_DEPTH_NESTING9191+#error "L2TP requires its own lockdep subclass"9292+#endif9393+8994/* Private data stored for received packets in the skb.9095 */9196struct l2tp_skb_cb {···11291124 IPCB(skb)->flags &= ~(IPSKB_XFRM_TUNNEL_SIZE | IPSKB_XFRM_TRANSFORMED | IPSKB_REROUTED);11301125 nf_reset_ct(skb);1131112611321132- bh_lock_sock_nested(sk);11271127+ /* L2TP uses its own lockdep subclass to avoid lockdep splats caused by11281128+ * nested socket calls on the same lockdep socket class. This can11291129+ * happen when data from a user socket is routed over l2tp, which uses11301130+ * another userspace socket.11311131+ */11321132+ spin_lock_nested(&sk->sk_lock.slock, L2TP_DEPTH_NESTING);11331133+11331134 if (sock_owned_by_user(sk)) {11341135 kfree_skb(skb);11351136 ret = NET_XMIT_DROP;···11871176 ret = l2tp_xmit_queue(tunnel, skb, &inet->cork.fl);1188117711891178out_unlock:11901190- bh_unlock_sock(sk);11791179+ spin_unlock(&sk->sk_lock.slock);1191118011921181 return ret;11931182}
+5-2
net/mac80211/cfg.c
···114114115115 /* apply all changes now - no failures allowed */116116117117- if (monitor_sdata)117117+ if (monitor_sdata && ieee80211_hw_check(&local->hw, WANT_MONITOR_VIF))118118 ieee80211_set_mu_mimo_follow(monitor_sdata, params);119119120120 if (params->flags) {···30533053 sdata = IEEE80211_WDEV_TO_SUB_IF(wdev);3054305430553055 if (sdata->vif.type == NL80211_IFTYPE_MONITOR) {30563056+ if (!ieee80211_hw_check(&local->hw, WANT_MONITOR_VIF))30573057+ return -EOPNOTSUPP;30583058+30563059 sdata = wiphy_dereference(local->hw.wiphy,30573060 local->monitor_sdata);30583061 if (!sdata)···31183115 if (has_monitor) {31193116 sdata = wiphy_dereference(local->hw.wiphy,31203117 local->monitor_sdata);31213121- if (sdata) {31183118+ if (sdata && ieee80211_hw_check(&local->hw, WANT_MONITOR_VIF)) {31223119 sdata->deflink.user_power_level = local->user_power_level;31233120 if (txp_type != sdata->vif.bss_conf.txpower_type)31243121 update_txp_type = true;
···1414 MPTCP_MIB_RETRANSSEGS, /* Segments retransmitted at the MPTCP-level */1515 MPTCP_MIB_JOINNOTOKEN, /* Received MP_JOIN but the token was not found */1616 MPTCP_MIB_JOINSYNRX, /* Received a SYN + MP_JOIN */1717+ MPTCP_MIB_JOINSYNBACKUPRX, /* Received a SYN + MP_JOIN + backup flag */1718 MPTCP_MIB_JOINSYNACKRX, /* Received a SYN/ACK + MP_JOIN */1919+ MPTCP_MIB_JOINSYNACKBACKUPRX, /* Received a SYN/ACK + MP_JOIN + backup flag */1820 MPTCP_MIB_JOINSYNACKMAC, /* HMAC was wrong on SYN/ACK + MP_JOIN */1921 MPTCP_MIB_JOINACKRX, /* Received an ACK + MP_JOIN */2022 MPTCP_MIB_JOINACKMAC, /* HMAC was wrong on ACK + MP_JOIN */
+3-2
net/mptcp/options.c
···909909 return true;910910 } else if (subflow_req->mp_join) {911911 opts->suboptions = OPTION_MPTCP_MPJ_SYNACK;912912- opts->backup = subflow_req->backup;912912+ opts->backup = subflow_req->request_bkup;913913 opts->join_id = subflow_req->local_id;914914 opts->thmac = subflow_req->thmac;915915 opts->nonce = subflow_req->local_nonce;···958958959959 if (subflow->remote_key_valid &&960960 (((mp_opt->suboptions & OPTION_MPTCP_DSS) && mp_opt->use_ack) ||961961- ((mp_opt->suboptions & OPTION_MPTCP_ADD_ADDR) && !mp_opt->echo))) {961961+ ((mp_opt->suboptions & OPTION_MPTCP_ADD_ADDR) &&962962+ (!mp_opt->echo || subflow->mp_join)))) {962963 /* subflows are fully established as soon as we get any963964 * additional ack, including ADD_ADDR.964965 */
···2233//! Firmware abstraction44//!55-//! C header: [`include/linux/firmware.h`](srctree/include/linux/firmware.h")55+//! C header: [`include/linux/firmware.h`](srctree/include/linux/firmware.h)6677use crate::{bindings, device::Device, error::Error, error::Result, str::CStr};88use core::ptr::NonNull;
+3-3
scripts/syscall.tbl
···535339 common umount2 sys_umount545440 common mount sys_mount555541 common pivot_root sys_pivot_root5656+42 common nfsservctl sys_ni_syscall565743 32 statfs64 sys_statfs64 compat_sys_statfs64575843 64 statfs sys_statfs585944 32 fstatfs64 sys_fstatfs64 compat_sys_fstatfs64···999877 common tee sys_tee1009978 common readlinkat sys_readlinkat10110079 stat64 fstatat64 sys_fstatat64102102-79 newstat fstatat sys_newfstatat101101+79 64 newfstatat sys_newfstatat10310280 stat64 fstat64 sys_fstat64104104-80 newstat fstat sys_newfstat103103+80 64 fstat sys_newfstat10510481 common sync sys_sync10610582 common fsync sys_fsync10710683 common fdatasync sys_fdatasync···403402460 common lsm_set_self_attr sys_lsm_set_self_attr404403461 common lsm_list_modules sys_lsm_list_modules405404462 common mseal sys_mseal406406-467 common uretprobe sys_uretprobe
+2-12
sound/core/seq/seq_ports.h
···77#define __SND_SEQ_PORTS_H8899#include <sound/seq_kernel.h>1010+#include <sound/ump_convert.h>1011#include "seq_lock.h"11121213/* list of 'exported' ports */···4140 rwlock_t list_lock;4241 int (*open)(void *private_data, struct snd_seq_port_subscribe *info);4342 int (*close)(void *private_data, struct snd_seq_port_subscribe *info);4444-};4545-4646-/* context for converting from legacy control event to UMP packet */4747-struct snd_seq_ump_midi2_bank {4848- bool rpn_set;4949- bool nrpn_set;5050- bool bank_set;5151- unsigned char cc_rpn_msb, cc_rpn_lsb;5252- unsigned char cc_nrpn_msb, cc_nrpn_lsb;5353- unsigned char cc_data_msb, cc_data_lsb;5454- unsigned char cc_bank_msb, cc_bank_lsb;5543};56445745struct snd_seq_client_port {···7888 unsigned char ump_group;79898090#if IS_ENABLED(CONFIG_SND_SEQ_UMP)8181- struct snd_seq_ump_midi2_bank midi2_bank[16]; /* per channel */9191+ struct ump_cvt_to_ump_bank midi2_bank[16]; /* per channel */8292#endif8393};8494
+86-52
sound/core/seq/seq_ump_convert.c
···368368 struct snd_seq_ump_event ev_cvt;369369 const union snd_ump_midi1_msg *midi1 = (const union snd_ump_midi1_msg *)event->ump;370370 union snd_ump_midi2_msg *midi2 = (union snd_ump_midi2_msg *)ev_cvt.ump;371371- struct snd_seq_ump_midi2_bank *cc;371371+ struct ump_cvt_to_ump_bank *cc;372372373373 ev_cvt = *event;374374 memset(&ev_cvt.ump, 0, sizeof(ev_cvt.ump));···789789 return 1;790790}791791792792-/* set up the MIDI2 RPN/NRPN packet data from the parsed info */793793-static void fill_rpn(struct snd_seq_ump_midi2_bank *cc,794794- union snd_ump_midi2_msg *data,795795- unsigned char channel)792792+static void reset_rpn(struct ump_cvt_to_ump_bank *cc)796793{794794+ cc->rpn_set = 0;795795+ cc->nrpn_set = 0;796796+ cc->cc_rpn_msb = cc->cc_rpn_lsb = 0;797797+ cc->cc_data_msb = cc->cc_data_lsb = 0;798798+ cc->cc_data_msb_set = cc->cc_data_lsb_set = 0;799799+}800800+801801+/* set up the MIDI2 RPN/NRPN packet data from the parsed info */802802+static int fill_rpn(struct ump_cvt_to_ump_bank *cc,803803+ union snd_ump_midi2_msg *data,804804+ unsigned char channel,805805+ bool flush)806806+{807807+ if (!(cc->cc_data_lsb_set || cc->cc_data_msb_set))808808+ return 0; // skip809809+ /* when not flushing, wait for complete data set */810810+ if (!flush && (!cc->cc_data_lsb_set || !cc->cc_data_msb_set))811811+ return 0; // skip812812+797813 if (cc->rpn_set) {798814 data->rpn.status = UMP_MSG_STATUS_RPN;799815 data->rpn.bank = cc->cc_rpn_msb;800816 data->rpn.index = cc->cc_rpn_lsb;801801- cc->rpn_set = 0;802802- cc->cc_rpn_msb = cc->cc_rpn_lsb = 0;803803- } else {817817+ } else if (cc->nrpn_set) {804818 data->rpn.status = UMP_MSG_STATUS_NRPN;805819 data->rpn.bank = cc->cc_nrpn_msb;806820 data->rpn.index = cc->cc_nrpn_lsb;807807- cc->nrpn_set = 0;808808- cc->cc_nrpn_msb = cc->cc_nrpn_lsb = 0;821821+ } else {822822+ return 0; // skip809823 }824824+810825 data->rpn.data = upscale_14_to_32bit((cc->cc_data_msb << 7) |811826 cc->cc_data_lsb);812827 data->rpn.channel = channel;813813- cc->cc_data_msb = cc->cc_data_lsb = 0;828828+829829+ reset_rpn(cc);830830+ return 1;814831}815832816833/* convert CC event to MIDI 2.0 UMP */···839822 unsigned char channel = event->data.control.channel & 0x0f;840823 unsigned char index = event->data.control.param & 0x7f;841824 unsigned char val = event->data.control.value & 0x7f;842842- struct snd_seq_ump_midi2_bank *cc = &dest_port->midi2_bank[channel];825825+ struct ump_cvt_to_ump_bank *cc = &dest_port->midi2_bank[channel];826826+ int ret;843827844828 /* process special CC's (bank/rpn/nrpn) */845829 switch (index) {846830 case UMP_CC_RPN_MSB:831831+ ret = fill_rpn(cc, data, channel, true);847832 cc->rpn_set = 1;848833 cc->cc_rpn_msb = val;849849- return 0; // skip834834+ if (cc->cc_rpn_msb == 0x7f && cc->cc_rpn_lsb == 0x7f)835835+ reset_rpn(cc);836836+ return ret;850837 case UMP_CC_RPN_LSB:838838+ ret = fill_rpn(cc, data, channel, true);851839 cc->rpn_set = 1;852840 cc->cc_rpn_lsb = val;853853- return 0; // skip841841+ if (cc->cc_rpn_msb == 0x7f && cc->cc_rpn_lsb == 0x7f)842842+ reset_rpn(cc);843843+ return ret;854844 case UMP_CC_NRPN_MSB:845845+ ret = fill_rpn(cc, data, channel, true);855846 cc->nrpn_set = 1;856847 cc->cc_nrpn_msb = val;857857- return 0; // skip848848+ return ret;858849 case UMP_CC_NRPN_LSB:850850+ ret = fill_rpn(cc, data, channel, true);859851 cc->nrpn_set = 1;860852 cc->cc_nrpn_lsb = val;861861- return 0; // skip853853+ return ret;862854 case UMP_CC_DATA:855855+ cc->cc_data_msb_set = 1;863856 cc->cc_data_msb = val;864864- return 0; // skip857857+ return fill_rpn(cc, data, channel, false);865858 case UMP_CC_BANK_SELECT:866859 cc->bank_set = 1;867860 cc->cc_bank_msb = val;···881854 cc->cc_bank_lsb = val;882855 return 0; // skip883856 case UMP_CC_DATA_LSB:857857+ cc->cc_data_lsb_set = 1;884858 cc->cc_data_lsb = val;885885- if (!(cc->rpn_set || cc->nrpn_set))886886- return 0; // skip887887- fill_rpn(cc, data, channel);888888- return 1;859859+ return fill_rpn(cc, data, channel, false);889860 }890861891862 data->cc.status = status;···912887 unsigned char status)913888{914889 unsigned char channel = event->data.control.channel & 0x0f;915915- struct snd_seq_ump_midi2_bank *cc = &dest_port->midi2_bank[channel];890890+ struct ump_cvt_to_ump_bank *cc = &dest_port->midi2_bank[channel];916891917892 data->pg.status = status;918893 data->pg.channel = channel;···949924{950925 unsigned char channel = event->data.control.channel & 0x0f;951926 unsigned char index = event->data.control.param & 0x7f;952952- struct snd_seq_ump_midi2_bank *cc = &dest_port->midi2_bank[channel];927927+ struct ump_cvt_to_ump_bank *cc = &dest_port->midi2_bank[channel];953928 unsigned char msb, lsb;929929+ int ret;954930955931 msb = (event->data.control.value >> 7) & 0x7f;956932 lsb = event->data.control.value & 0x7f;···965939 cc->cc_bank_lsb = lsb;966940 return 0; // skip967941 case UMP_CC_RPN_MSB:968968- cc->cc_rpn_msb = msb;969969- fallthrough;970942 case UMP_CC_RPN_LSB:971971- cc->rpn_set = 1;943943+ ret = fill_rpn(cc, data, channel, true);944944+ cc->cc_rpn_msb = msb;972945 cc->cc_rpn_lsb = lsb;973973- return 0; // skip946946+ cc->rpn_set = 1;947947+ if (cc->cc_rpn_msb == 0x7f && cc->cc_rpn_lsb == 0x7f)948948+ reset_rpn(cc);949949+ return ret;974950 case UMP_CC_NRPN_MSB:975975- cc->cc_nrpn_msb = msb;976976- fallthrough;977951 case UMP_CC_NRPN_LSB:952952+ ret = fill_rpn(cc, data, channel, true);953953+ cc->cc_nrpn_msb = msb;978954 cc->nrpn_set = 1;979955 cc->cc_nrpn_lsb = lsb;980980- return 0; // skip956956+ return ret;981957 case UMP_CC_DATA:982982- cc->cc_data_msb = msb;983983- fallthrough;984958 case UMP_CC_DATA_LSB:959959+ cc->cc_data_msb_set = cc->cc_data_lsb_set = 1;960960+ cc->cc_data_msb = msb;985961 cc->cc_data_lsb = lsb;986986- if (!(cc->rpn_set || cc->nrpn_set))987987- return 0; // skip988988- fill_rpn(cc, data, channel);989989- return 1;962962+ return fill_rpn(cc, data, channel, false);990963 }991964992965 data->cc.status = UMP_MSG_STATUS_CC;···12171192{12181193 struct snd_seq_ump_event ev_cvt;12191194 unsigned char status;12201220- u8 buf[6], *xbuf;11951195+ u8 buf[8], *xbuf;12211196 int offset = 0;12221197 int len, err;11981198+ bool finished = false;1223119912241200 if (!snd_seq_ev_is_variable(event))12251201 return 0;1226120212271203 setup_ump_event(&ev_cvt, event);12281228- for (;;) {12041204+ while (!finished) {12291205 len = snd_seq_expand_var_event_at(event, sizeof(buf), buf, offset);12301206 if (len <= 0)12311207 break;12321232- if (WARN_ON(len > 6))12081208+ if (WARN_ON(len > sizeof(buf)))12331209 break;12341234- offset += len;12101210+12351211 xbuf = buf;12121212+ status = UMP_SYSEX_STATUS_CONTINUE;12131213+ /* truncate the sysex start-marker */12361214 if (*xbuf == UMP_MIDI1_MSG_SYSEX_START) {12371215 status = UMP_SYSEX_STATUS_START;12381238- xbuf++;12391216 len--;12401240- if (len > 0 && xbuf[len - 1] == UMP_MIDI1_MSG_SYSEX_END) {12411241- status = UMP_SYSEX_STATUS_SINGLE;12421242- len--;12431243- }12441244- } else {12451245- if (xbuf[len - 1] == UMP_MIDI1_MSG_SYSEX_END) {12461246- status = UMP_SYSEX_STATUS_END;12471247- len--;12481248- } else {12491249- status = UMP_SYSEX_STATUS_CONTINUE;12501250- }12171217+ offset++;12181218+ xbuf++;12511219 }12201220+12211221+ /* if the last of this packet or the 1st byte of the next packet12221222+ * is the end-marker, finish the transfer with this packet12231223+ */12241224+ if (len > 0 && len < 8 &&12251225+ xbuf[len - 1] == UMP_MIDI1_MSG_SYSEX_END) {12261226+ if (status == UMP_SYSEX_STATUS_START)12271227+ status = UMP_SYSEX_STATUS_SINGLE;12281228+ else12291229+ status = UMP_SYSEX_STATUS_END;12301230+ len--;12311231+ finished = true;12321232+ }12331233+12341234+ len = min(len, 6);12521235 fill_sysex7_ump(dest_port, ev_cvt.ump, status, xbuf, len);12531236 err = __snd_seq_deliver_single_event(dest, dest_port,12541237 (struct snd_seq_event *)&ev_cvt,12551238 atomic, hop);12561239 if (err < 0)12571240 return err;12411241+ offset += len;12581242 }12591243 return 0;12601244}
···7777// overrun. Actual device can skip more, then this module stops the packet streaming.7878#define IR_JUMBO_PAYLOAD_MAX_SKIP_CYCLES 579798080+static void pcm_period_work(struct work_struct *work);8181+8082/**8183 * amdtp_stream_init - initialize an AMDTP stream structure8284 * @s: the AMDTP stream to initialize···107105 s->flags = flags;108106 s->context = ERR_PTR(-1);109107 mutex_init(&s->mutex);108108+ INIT_WORK(&s->period_work, pcm_period_work);110109 s->packet_index = 0;111110112111 init_waitqueue_head(&s->ready_wait);···350347 */351348void amdtp_stream_pcm_prepare(struct amdtp_stream *s)352349{350350+ cancel_work_sync(&s->period_work);353351 s->pcm_buffer_pointer = 0;354352 s->pcm_period_pointer = 0;355353}···615611 // The program in user process should periodically check the status of intermediate616612 // buffer associated to PCM substream to process PCM frames in the buffer, instead617613 // of receiving notification of period elapsed by poll wait.618618- if (!pcm->runtime->no_period_wakeup) {619619- if (in_softirq()) {620620- // In software IRQ context for 1394 OHCI.621621- snd_pcm_period_elapsed(pcm);622622- } else {623623- // In process context of ALSA PCM application under acquired lock of624624- // PCM substream.625625- snd_pcm_period_elapsed_under_stream_lock(pcm);626626- }627627- }614614+ if (!pcm->runtime->no_period_wakeup)615615+ queue_work(system_highpri_wq, &s->period_work);628616 }617617+}618618+619619+static void pcm_period_work(struct work_struct *work)620620+{621621+ struct amdtp_stream *s = container_of(work, struct amdtp_stream,622622+ period_work);623623+ struct snd_pcm_substream *pcm = READ_ONCE(s->pcm);624624+625625+ if (pcm)626626+ snd_pcm_period_elapsed(pcm);629627}630628631629static int queue_packet(struct amdtp_stream *s, struct fw_iso_packet *params,···18551849{18561850 struct amdtp_stream *irq_target = d->irq_target;1857185118581858- // Process isochronous packets queued till recent isochronous cycle to handle PCM frames.18591852 if (irq_target && amdtp_stream_running(irq_target)) {18601860- // In software IRQ context, the call causes dead-lock to disable the tasklet18611861- // synchronously.18621862- if (!in_softirq())18531853+ // use wq to prevent AB/BA deadlock competition for18541854+ // substream lock:18551855+ // fw_iso_context_flush_completions() acquires18561856+ // lock by ohci_flush_iso_completions(),18571857+ // amdtp-stream process_rx_packets() attempts to18581858+ // acquire same lock by snd_pcm_elapsed()18591859+ if (current_work() != &s->period_work)18631860 fw_iso_context_flush_completions(irq_target->context);18641861 }18651862···19181909 return;19191910 }1920191119121912+ cancel_work_sync(&s->period_work);19211913 fw_iso_context_stop(s->context);19221914 fw_iso_context_destroy(s->context);19231915 s->context = ERR_PTR(-1);
+1
sound/firewire/amdtp-stream.h
···191191192192 /* For a PCM substream processing. */193193 struct snd_pcm_substream *pcm;194194+ struct work_struct period_work;194195 snd_pcm_uframes_t pcm_buffer_pointer;195196 unsigned int pcm_period_pointer;196197 unsigned int pcm_frame_multiplier;
···559559 kfree(coeff_filename);560560}561561562562-static void cs35l56_hda_create_dsp_controls_work(struct work_struct *work)563563-{564564- struct cs35l56_hda *cs35l56 = container_of(work, struct cs35l56_hda, control_work);565565- struct hda_cs_dsp_ctl_info info;566566-567567- info.device_name = cs35l56->amp_name;568568- info.fw_type = HDA_CS_DSP_FW_MISC;569569- info.card = cs35l56->codec->card;570570-571571- hda_cs_dsp_add_controls(&cs35l56->cs_dsp, &info);572572-}573573-574562static void cs35l56_hda_apply_calibration(struct cs35l56_hda *cs35l56)575563{576564 int ret;···583595 char *wmfw_filename = NULL;584596 unsigned int preloaded_fw_ver;585597 bool firmware_missing;586586- bool add_dsp_controls_required = false;587598 int ret;588588-589589- /*590590- * control_work must be flushed before proceeding, but we can't do that591591- * here as it would create a deadlock on controls_rwsem so it must be592592- * performed before queuing dsp_work.593593- */594594- WARN_ON_ONCE(work_busy(&cs35l56->control_work));595599596600 /*597601 * Prepare for a new DSP power-up. If the DSP has had firmware598602 * downloaded previously then it needs to be powered down so that it599599- * can be updated and if hadn't been patched before then the controls600600- * will need to be added once firmware download succeeds.603603+ * can be updated.601604 */602605 if (cs35l56->base.fw_patched)603606 cs_dsp_power_down(&cs35l56->cs_dsp);604604- else605605- add_dsp_controls_required = true;606607607608 cs35l56->base.fw_patched = false;608609···675698 CS35L56_FIRMWARE_MISSING);676699 cs35l56->base.fw_patched = true;677700678678- /*679679- * Adding controls is deferred to prevent a lock inversion - ALSA takes680680- * the controls_rwsem when adding a control, the get() / put()681681- * functions of a control are called holding controls_rwsem and those682682- * that depend on running firmware wait for dsp_work() to complete.683683- */684684- if (add_dsp_controls_required)685685- queue_work(system_long_wq, &cs35l56->control_work);686686-687701 ret = cs_dsp_run(&cs35l56->cs_dsp);688702 if (ret)689703 dev_dbg(cs35l56->base.dev, "%s: cs_dsp_run ret %d\n", __func__, ret);···721753 strscpy(comp->name, dev_name(dev), sizeof(comp->name));722754 comp->playback_hook = cs35l56_hda_playback_hook;723755724724- flush_work(&cs35l56->control_work);725756 queue_work(system_long_wq, &cs35l56->dsp_work);726757727758 cs35l56_hda_create_controls(cs35l56);···742775 struct hda_component *comp;743776744777 cancel_work_sync(&cs35l56->dsp_work);745745- cancel_work_sync(&cs35l56->control_work);746778747779 cs35l56_hda_remove_controls(cs35l56);748780···772806 struct cs35l56_hda *cs35l56 = dev_get_drvdata(dev);773807774808 cs35l56_hda_wait_dsp_ready(cs35l56);775775- flush_work(&cs35l56->control_work);776809777810 if (cs35l56->playing)778811 cs35l56_hda_pause(cs35l56);···9911026 dev_set_drvdata(cs35l56->base.dev, cs35l56);99210279931028 INIT_WORK(&cs35l56->dsp_work, cs35l56_hda_dsp_work);994994- INIT_WORK(&cs35l56->control_work, cs35l56_hda_create_dsp_controls_work);99510299961030 ret = cs35l56_hda_read_acpi(cs35l56, hid, id);9971031 if (ret)
···49554955}49564956EXPORT_SYMBOL_GPL(snd_hda_gen_stream_pm);4957495749584958+/* forcibly mute the speaker output without caching; return true if updated */49594959+static bool force_mute_output_path(struct hda_codec *codec, hda_nid_t nid)49604960+{49614961+ if (!nid)49624962+ return false;49634963+ if (!nid_has_mute(codec, nid, HDA_OUTPUT))49644964+ return false; /* no mute, skip */49654965+ if (snd_hda_codec_amp_read(codec, nid, 0, HDA_OUTPUT, 0) &49664966+ snd_hda_codec_amp_read(codec, nid, 1, HDA_OUTPUT, 0) &49674967+ HDA_AMP_MUTE)49684968+ return false; /* both channels already muted, skip */49694969+49704970+ /* direct amp update without caching */49714971+ snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_AMP_GAIN_MUTE,49724972+ AC_AMP_SET_OUTPUT | AC_AMP_SET_LEFT |49734973+ AC_AMP_SET_RIGHT | HDA_AMP_MUTE);49744974+ return true;49754975+}49764976+49774977+/**49784978+ * snd_hda_gen_shutup_speakers - Forcibly mute the speaker outputs49794979+ * @codec: the HDA codec49804980+ *49814981+ * Forcibly mute the speaker outputs, to be called at suspend or shutdown.49824982+ *49834983+ * The mute state done by this function isn't cached, hence the original state49844984+ * will be restored at resume.49854985+ *49864986+ * Return true if the mute state has been changed.49874987+ */49884988+bool snd_hda_gen_shutup_speakers(struct hda_codec *codec)49894989+{49904990+ struct hda_gen_spec *spec = codec->spec;49914991+ const int *paths;49924992+ const struct nid_path *path;49934993+ int i, p, num_paths;49944994+ bool updated = false;49954995+49964996+ /* if already powered off, do nothing */49974997+ if (!snd_hdac_is_power_on(&codec->core))49984998+ return false;49994999+50005000+ if (spec->autocfg.line_out_type == AUTO_PIN_SPEAKER_OUT) {50015001+ paths = spec->out_paths;50025002+ num_paths = spec->autocfg.line_outs;50035003+ } else {50045004+ paths = spec->speaker_paths;50055005+ num_paths = spec->autocfg.speaker_outs;50065006+ }50075007+50085008+ for (i = 0; i < num_paths; i++) {50095009+ path = snd_hda_get_path_from_idx(codec, paths[i]);50105010+ if (!path)50115011+ continue;50125012+ for (p = 0; p < path->depth; p++)50135013+ if (force_mute_output_path(codec, path->path[p]))50145014+ updated = true;50155015+ }50165016+50175017+ return updated;50185018+}50195019+EXPORT_SYMBOL_GPL(snd_hda_gen_shutup_speakers);50205020+49585021/**49595022 * snd_hda_gen_parse_auto_config - Parse the given BIOS configuration and49605023 * set up the hda_gen_spec
···2323/* Register addresses are offset when sent over SoundWire */2424#define CS35L56_SDW_ADDR_OFFSET 0x800025252626+/* Cirrus bus bridge registers */2727+#define CS35L56_SDW_MEM_ACCESS_STATUS 0xd02828+#define CS35L56_SDW_MEM_READ_DATA 0xd82929+3030+#define CS35L56_SDW_LAST_LATE BIT(3)3131+#define CS35L56_SDW_CMD_IN_PROGRESS BIT(2)3232+#define CS35L56_SDW_RDATA_RDY BIT(0)3333+3434+#define CS35L56_LATE_READ_POLL_US 103535+#define CS35L56_LATE_READ_TIMEOUT_US 10003636+3737+static int cs35l56_sdw_poll_mem_status(struct sdw_slave *peripheral,3838+ unsigned int mask,3939+ unsigned int match)4040+{4141+ int ret, val;4242+4343+ ret = read_poll_timeout(sdw_read_no_pm, val,4444+ (val < 0) || ((val & mask) == match),4545+ CS35L56_LATE_READ_POLL_US, CS35L56_LATE_READ_TIMEOUT_US,4646+ false, peripheral, CS35L56_SDW_MEM_ACCESS_STATUS);4747+ if (ret < 0)4848+ return ret;4949+5050+ if (val < 0)5151+ return val;5252+5353+ return 0;5454+}5555+5656+static int cs35l56_sdw_slow_read(struct sdw_slave *peripheral, unsigned int reg,5757+ u8 *buf, size_t val_size)5858+{5959+ int ret, i;6060+6161+ reg += CS35L56_SDW_ADDR_OFFSET;6262+6363+ for (i = 0; i < val_size; i += sizeof(u32)) {6464+ /* Poll for bus bridge idle */6565+ ret = cs35l56_sdw_poll_mem_status(peripheral,6666+ CS35L56_SDW_CMD_IN_PROGRESS,6767+ 0);6868+ if (ret < 0) {6969+ dev_err(&peripheral->dev, "!CMD_IN_PROGRESS fail: %d\n", ret);7070+ return ret;7171+ }7272+7373+ /* Reading LSByte triggers read of register to holding buffer */7474+ sdw_read_no_pm(peripheral, reg + i);7575+7676+ /* Wait for data available */7777+ ret = cs35l56_sdw_poll_mem_status(peripheral,7878+ CS35L56_SDW_RDATA_RDY,7979+ CS35L56_SDW_RDATA_RDY);8080+ if (ret < 0) {8181+ dev_err(&peripheral->dev, "RDATA_RDY fail: %d\n", ret);8282+ return ret;8383+ }8484+8585+ /* Read data from buffer */8686+ ret = sdw_nread_no_pm(peripheral, CS35L56_SDW_MEM_READ_DATA,8787+ sizeof(u32), &buf[i]);8888+ if (ret) {8989+ dev_err(&peripheral->dev, "Late read @%#x failed: %d\n", reg + i, ret);9090+ return ret;9191+ }9292+9393+ swab32s((u32 *)&buf[i]);9494+ }9595+9696+ return 0;9797+}9898+2699static int cs35l56_sdw_read_one(struct sdw_slave *peripheral, unsigned int reg, void *buf)27100{28101 int ret;···12148 int ret;1224912350 reg = le32_to_cpu(*(const __le32 *)reg_buf);5151+5252+ if (cs35l56_is_otp_register(reg))5353+ return cs35l56_sdw_slow_read(peripheral, reg, buf8, val_size);5454+12455 reg += CS35L56_SDW_ADDR_OFFSET;1255612657 if (val_size == 4)
+1
sound/soc/codecs/cs35l56-shared.c
···3636 { CS35L56_SWIRE_DP3_CH2_INPUT, 0x00000019 },3737 { CS35L56_SWIRE_DP3_CH3_INPUT, 0x00000029 },3838 { CS35L56_SWIRE_DP3_CH4_INPUT, 0x00000028 },3939+ { CS35L56_IRQ1_MASK_18, 0x1f7df0ff },39404041 /* These are not reset by a soft-reset, so patch to defaults. */4142 { CS35L56_MAIN_RENDER_USER_MUTE, 0x00000000 },
+11
sound/soc/codecs/cs35l56.c
···10951095}10961096EXPORT_SYMBOL_GPL(cs35l56_system_resume);1097109710981098+static int cs35l56_control_add_nop(struct wm_adsp *dsp, struct cs_dsp_coeff_ctl *cs_ctl)10991099+{11001100+ return 0;11011101+}11021102+10981103static int cs35l56_dsp_init(struct cs35l56_private *cs35l56)10991104{11001105 struct wm_adsp *dsp;···11211116 */11221117 dsp->fw = 12;11231118 dsp->wmfw_optional = true;11191119+11201120+ /*11211121+ * None of the firmware controls need to be exported so add a no-op11221122+ * callback that suppresses creating an ALSA control.11231123+ */11241124+ dsp->control_add = &cs35l56_control_add_nop;1124112511251126 dev_dbg(cs35l56->base.dev, "DSP system name: '%s'\n", dsp->system_name);11261127
+57-18
sound/soc/codecs/cs42l43.c
···7788#include <linux/bitops.h>99#include <linux/bits.h>1010+#include <linux/build_bug.h>1011#include <linux/clk.h>1112#include <linux/device.h>1213#include <linux/err.h>···253252static irqreturn_t cs42l43_mic_shutter(int irq, void *data)254253{255254 struct cs42l43_codec *priv = data;256256- static const char * const controls[] = {257257- "Decimator 1 Switch",258258- "Decimator 2 Switch",259259- "Decimator 3 Switch",260260- "Decimator 4 Switch",261261- };262262- int i, ret;255255+ struct snd_soc_component *component = priv->component;256256+ int i;263257264258 dev_dbg(priv->dev, "Microphone shutter changed\n");265259266266- if (!priv->component)260260+ if (!component)267261 return IRQ_NONE;268262269269- for (i = 0; i < ARRAY_SIZE(controls); i++) {270270- ret = snd_soc_component_notify_control(priv->component,271271- controls[i]);272272- if (ret)263263+ for (i = 1; i < ARRAY_SIZE(priv->kctl); i++) {264264+ if (!priv->kctl[i])273265 return IRQ_NONE;266266+267267+ snd_ctl_notify(component->card->snd_card,268268+ SNDRV_CTL_EVENT_MASK_VALUE, &priv->kctl[i]->id);274269 }275270276271 return IRQ_HANDLED;···275278static irqreturn_t cs42l43_spk_shutter(int irq, void *data)276279{277280 struct cs42l43_codec *priv = data;278278- int ret;281281+ struct snd_soc_component *component = priv->component;279282280283 dev_dbg(priv->dev, "Speaker shutter changed\n");281284282282- if (!priv->component)285285+ if (!component)283286 return IRQ_NONE;284287285285- ret = snd_soc_component_notify_control(priv->component,286286- "Speaker Digital Switch");287287- if (ret)288288+ if (!priv->kctl[0])288289 return IRQ_NONE;290290+291291+ snd_ctl_notify(component->card->snd_card,292292+ SNDRV_CTL_EVENT_MASK_VALUE, &priv->kctl[0]->id);289293290294 return IRQ_HANDLED;291295}···588590 return 0;589591}590592593593+static int cs42l43_dai_probe(struct snd_soc_dai *dai)594594+{595595+ struct snd_soc_component *component = dai->component;596596+ struct cs42l43_codec *priv = snd_soc_component_get_drvdata(component);597597+ static const char * const controls[] = {598598+ "Speaker Digital Switch",599599+ "Decimator 1 Switch",600600+ "Decimator 2 Switch",601601+ "Decimator 3 Switch",602602+ "Decimator 4 Switch",603603+ };604604+ int i;605605+606606+ static_assert(ARRAY_SIZE(controls) == ARRAY_SIZE(priv->kctl));607607+608608+ for (i = 0; i < ARRAY_SIZE(controls); i++) {609609+ if (priv->kctl[i])610610+ continue;611611+612612+ priv->kctl[i] = snd_soc_component_get_kcontrol(component, controls[i]);613613+ }614614+615615+ return 0;616616+}617617+618618+static int cs42l43_dai_remove(struct snd_soc_dai *dai)619619+{620620+ struct snd_soc_component *component = dai->component;621621+ struct cs42l43_codec *priv = snd_soc_component_get_drvdata(component);622622+ int i;623623+624624+ for (i = 0; i < ARRAY_SIZE(priv->kctl); i++)625625+ priv->kctl[i] = NULL;626626+627627+ return 0;628628+}629629+591630static const struct snd_soc_dai_ops cs42l43_asp_ops = {631631+ .probe = cs42l43_dai_probe,632632+ .remove = cs42l43_dai_remove,592633 .startup = cs42l43_startup,593634 .hw_params = cs42l43_asp_hw_params,594635 .set_fmt = cs42l43_asp_set_fmt,···645608 return ret;646609647610 return cs42l43_set_sample_rate(substream, params, dai);648648-};611611+}649612650613static const struct snd_soc_dai_ops cs42l43_sdw_ops = {614614+ .probe = cs42l43_dai_probe,615615+ .remove = cs42l43_dai_remove,651616 .startup = cs42l43_startup,652617 .set_stream = cs42l43_sdw_set_stream,653618 .hw_params = cs42l43_sdw_hw_params,
···831831 {REG_MICFIL_CTRL1, 0x00000000},832832 {REG_MICFIL_CTRL2, 0x00000000},833833 {REG_MICFIL_STAT, 0x00000000},834834- {REG_MICFIL_FIFO_CTRL, 0x00000007},834834+ {REG_MICFIL_FIFO_CTRL, 0x0000001F},835835 {REG_MICFIL_FIFO_STAT, 0x00000000},836836 {REG_MICFIL_DATACH0, 0x00000000},837837 {REG_MICFIL_DATACH1, 0x00000000},···855855856856static bool fsl_micfil_readable_reg(struct device *dev, unsigned int reg)857857{858858+ struct fsl_micfil *micfil = dev_get_drvdata(dev);859859+858860 switch (reg) {859861 case REG_MICFIL_CTRL1:860862 case REG_MICFIL_CTRL2:···874872 case REG_MICFIL_DC_CTRL:875873 case REG_MICFIL_OUT_CTRL:876874 case REG_MICFIL_OUT_STAT:877877- case REG_MICFIL_FSYNC_CTRL:878878- case REG_MICFIL_VERID:879879- case REG_MICFIL_PARAM:880875 case REG_MICFIL_VAD0_CTRL1:881876 case REG_MICFIL_VAD0_CTRL2:882877 case REG_MICFIL_VAD0_STAT:···882883 case REG_MICFIL_VAD0_NDATA:883884 case REG_MICFIL_VAD0_ZCD:884885 return true;886886+ case REG_MICFIL_FSYNC_CTRL:887887+ case REG_MICFIL_VERID:888888+ case REG_MICFIL_PARAM:889889+ if (micfil->soc->use_verid)890890+ return true;891891+ fallthrough;885892 default:886893 return false;887894 }···895890896891static bool fsl_micfil_writeable_reg(struct device *dev, unsigned int reg)897892{893893+ struct fsl_micfil *micfil = dev_get_drvdata(dev);894894+898895 switch (reg) {899896 case REG_MICFIL_CTRL1:900897 case REG_MICFIL_CTRL2:···906899 case REG_MICFIL_DC_CTRL:907900 case REG_MICFIL_OUT_CTRL:908901 case REG_MICFIL_OUT_STAT: /* Write 1 to Clear */909909- case REG_MICFIL_FSYNC_CTRL:910902 case REG_MICFIL_VAD0_CTRL1:911903 case REG_MICFIL_VAD0_CTRL2:912904 case REG_MICFIL_VAD0_STAT: /* Write 1 to Clear */···913907 case REG_MICFIL_VAD0_NCONFIG:914908 case REG_MICFIL_VAD0_ZCD:915909 return true;910910+ case REG_MICFIL_FSYNC_CTRL:911911+ if (micfil->soc->use_verid)912912+ return true;913913+ fallthrough;916914 default:917915 return false;918916 }
···244244 SNDRV_CHMAP_FR, /* right front */245245 SNDRV_CHMAP_FC, /* center front */246246 SNDRV_CHMAP_LFE, /* LFE */247247- SNDRV_CHMAP_SL, /* left surround */248248- SNDRV_CHMAP_SR, /* right surround */247247+ SNDRV_CHMAP_RL, /* left surround */248248+ SNDRV_CHMAP_RR, /* right surround */249249 SNDRV_CHMAP_FLC, /* left of center */250250 SNDRV_CHMAP_FRC, /* right of center */251251 SNDRV_CHMAP_RC, /* surround */
+43-10
tools/build/feature/Makefile
···82828383FILES := $(addprefix $(OUTPUT),$(FILES))84848585-PKG_CONFIG ?= $(CROSS_COMPILE)pkg-config8585+# Some distros provide the command $(CROSS_COMPILE)pkg-config for8686+# searching packges installed with Multiarch. Use it for cross8787+# compilation if it is existed.8888+ifneq (, $(shell which $(CROSS_COMPILE)pkg-config))8989+ PKG_CONFIG ?= $(CROSS_COMPILE)pkg-config9090+else9191+ PKG_CONFIG ?= pkg-config9292+9393+ # PKG_CONFIG_PATH or PKG_CONFIG_LIBDIR, alongside PKG_CONFIG_SYSROOT_DIR9494+ # for modified system root, are required for the cross compilation.9595+ # If these PKG_CONFIG environment variables are not set, Multiarch library9696+ # paths are used instead.9797+ ifdef CROSS_COMPILE9898+ ifeq ($(PKG_CONFIG_LIBDIR)$(PKG_CONFIG_PATH)$(PKG_CONFIG_SYSROOT_DIR),)9999+ CROSS_ARCH = $(shell $(CC) -dumpmachine)100100+ PKG_CONFIG_LIBDIR := /usr/local/$(CROSS_ARCH)/lib/pkgconfig/101101+ PKG_CONFIG_LIBDIR := $(PKG_CONFIG_LIBDIR):/usr/local/lib/$(CROSS_ARCH)/pkgconfig/102102+ PKG_CONFIG_LIBDIR := $(PKG_CONFIG_LIBDIR):/usr/lib/$(CROSS_ARCH)/pkgconfig/103103+ PKG_CONFIG_LIBDIR := $(PKG_CONFIG_LIBDIR):/usr/local/share/pkgconfig/104104+ PKG_CONFIG_LIBDIR := $(PKG_CONFIG_LIBDIR):/usr/share/pkgconfig/105105+ export PKG_CONFIG_LIBDIR106106+ endif107107+ endif108108+endif8610987110all: $(FILES)88111···170147171148DWARFLIBS := -ldw172149ifeq ($(findstring -static,${LDFLAGS}),-static)173173-DWARFLIBS += -lelf -lebl -lz -llzma -lbz2150150+ DWARFLIBS += -lelf -lz -llzma -lbz2 -lzstd151151+152152+ LIBDW_VERSION := $(shell $(PKG_CONFIG) --modversion libdw)153153+ LIBDW_VERSION_1 := $(word 1, $(subst ., ,$(LIBDW_VERSION)))154154+ LIBDW_VERSION_2 := $(word 2, $(subst ., ,$(LIBDW_VERSION)))155155+156156+ # Elfutils merged libebl.a into libdw.a starting from version 0.177,157157+ # Link libebl.a only if libdw is older than this version.158158+ ifeq ($(shell test $(LIBDW_VERSION_2) -lt 177; echo $$?),0)159159+ DWARFLIBS += -lebl160160+ endif174161endif175162176163$(OUTPUT)test-dwarf.bin:···211178 $(BUILD) -lnuma212179213180$(OUTPUT)test-libunwind.bin:214214- $(BUILD) -lelf181181+ $(BUILD) -lelf -llzma215182216183$(OUTPUT)test-libunwind-debug-frame.bin:217217- $(BUILD) -lelf184184+ $(BUILD) -lelf -llzma218185$(OUTPUT)test-libunwind-x86.bin:219219- $(BUILD) -lelf -lunwind-x86186186+ $(BUILD) -lelf -llzma -lunwind-x86220187221188$(OUTPUT)test-libunwind-x86_64.bin:222222- $(BUILD) -lelf -lunwind-x86_64189189+ $(BUILD) -lelf -llzma -lunwind-x86_64223190224191$(OUTPUT)test-libunwind-arm.bin:225225- $(BUILD) -lelf -lunwind-arm192192+ $(BUILD) -lelf -llzma -lunwind-arm226193227194$(OUTPUT)test-libunwind-aarch64.bin:228228- $(BUILD) -lelf -lunwind-aarch64195195+ $(BUILD) -lelf -llzma -lunwind-aarch64229196230197$(OUTPUT)test-libunwind-debug-frame-arm.bin:231231- $(BUILD) -lelf -lunwind-arm198198+ $(BUILD) -lelf -llzma -lunwind-arm232199233200$(OUTPUT)test-libunwind-debug-frame-aarch64.bin:234234- $(BUILD) -lelf -lunwind-aarch64201201+ $(BUILD) -lelf -llzma -lunwind-aarch64235202236203$(OUTPUT)test-libaudit.bin:237204 $(BUILD) -laudit
+28
tools/perf/Documentation/Build.txt
···7171 $ UBSAN_OPTIONS=print_stacktrace=1 ./perf record -a72727373If UBSan detects any problem at runtime, it outputs a “runtime error:” message.7474+7575+4) Cross compilation7676+====================7777+As Multiarch is commonly supported in Linux distributions, we can install7878+libraries for multiple architectures on the same system and then cross-compile7979+Linux perf. For example, Aarch64 libraries and toolchains can be installed on8080+an x86_64 machine, allowing us to compile perf for an Aarch64 target.8181+8282+Below is the command for building the perf with dynamic linking.8383+8484+ $ cd /path/to/Linux8585+ $ make ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- -C tools/perf8686+8787+For static linking, the option `LDFLAGS="-static"` is required.8888+8989+ $ make ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- \9090+ LDFLAGS="-static" -C tools/perf9191+9292+In the embedded system world, a use case is to explicitly specify the package9393+configuration paths for cross building:9494+9595+ $ PKG_CONFIG_SYSROOT_DIR="/path/to/cross/build/sysroot" \9696+ PKG_CONFIG_LIBDIR="/usr/lib/:/usr/local/lib" \9797+ make ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- -C tools/perf9898+9999+In this case, the variable PKG_CONFIG_SYSROOT_DIR can be used alongside the100100+variable PKG_CONFIG_LIBDIR or PKG_CONFIG_PATH to prepend the sysroot path to101101+the library paths for cross compilation.
···193193HOSTAR ?= ar194194CLANG ?= clang195195196196-PKG_CONFIG = $(CROSS_COMPILE)pkg-config196196+# Some distros provide the command $(CROSS_COMPILE)pkg-config for197197+# searching packges installed with Multiarch. Use it for cross198198+# compilation if it is existed.199199+ifneq (, $(shell which $(CROSS_COMPILE)pkg-config))200200+ PKG_CONFIG ?= $(CROSS_COMPILE)pkg-config201201+else202202+ PKG_CONFIG ?= pkg-config203203+204204+ # PKG_CONFIG_PATH or PKG_CONFIG_LIBDIR, alongside PKG_CONFIG_SYSROOT_DIR205205+ # for modified system root, is required for the cross compilation.206206+ # If these PKG_CONFIG environment variables are not set, Multiarch library207207+ # paths are used instead.208208+ ifdef CROSS_COMPILE209209+ ifeq ($(PKG_CONFIG_LIBDIR)$(PKG_CONFIG_PATH)$(PKG_CONFIG_SYSROOT_DIR),)210210+ CROSS_ARCH = $(shell $(CC) -dumpmachine)211211+ PKG_CONFIG_LIBDIR := /usr/local/$(CROSS_ARCH)/lib/pkgconfig/212212+ PKG_CONFIG_LIBDIR := $(PKG_CONFIG_LIBDIR):/usr/local/lib/$(CROSS_ARCH)/pkgconfig/213213+ PKG_CONFIG_LIBDIR := $(PKG_CONFIG_LIBDIR):/usr/lib/$(CROSS_ARCH)/pkgconfig/214214+ PKG_CONFIG_LIBDIR := $(PKG_CONFIG_LIBDIR):/usr/local/share/pkgconfig/215215+ PKG_CONFIG_LIBDIR := $(PKG_CONFIG_LIBDIR):/usr/share/pkgconfig/216216+ export PKG_CONFIG_LIBDIR217217+ $(warning Missing PKG_CONFIG_LIBDIR, PKG_CONFIG_PATH and PKG_CONFIG_SYSROOT_DIR for cross compilation,)218218+ $(warning set PKG_CONFIG_LIBDIR for using Multiarch libs.)219219+ endif220220+ endif221221+endif197222198223RM = rm -f199224LN = ln -f
···7474 {7575 "PublicDescription": "Sent SFENCE.VMA with ASID request to other HART event",7676 "ConfigCode": "0x800000000000000c",7777- "EventName": "FW_SFENCE_VMA_RECEIVED",7777+ "EventName": "FW_SFENCE_VMA_ASID_SENT",7878 "BriefDescription": "Sent SFENCE.VMA with ASID request to other HART event"7979 },8080 {
···713713# Make sure we are able to include and link libbpf against c++.714714$(OUTPUT)/test_cpp: test_cpp.cpp $(OUTPUT)/test_core_extern.skel.h $(BPFOBJ)715715 $(call msg,CXX,,$@)716716- $(Q)$(CXX) $(CFLAGS) $(filter %.a %.o %.cpp,$^) $(LDLIBS) -o $@716716+ $(Q)$(CXX) $(subst -D_GNU_SOURCE=,,$(CFLAGS)) $(filter %.a %.o %.cpp,$^) $(LDLIBS) -o $@717717718718# Benchmark runner719719$(OUTPUT)/bench_%.o: benchs/bench_%.c bench.h $(BPFOBJ)
···2929 version.name = name;30303131 ret = ioctl(fd, DRM_IOCTL_VERSION, &version);3232- if (ret)3232+ if (ret || version.name_len != 4)3333 return 0;3434+3535+ name[4] = '\0';34363537 return !strcmp(name, "vgem");3638}
+34-3
tools/testing/selftests/drivers/net/hw/rss_ctx.py
···1919 return [random.randint(0, 255) for _ in range(length)]202021212222+def _rss_key_check(cfg, data=None, context=0):2323+ if data is None:2424+ data = get_rss(cfg, context=context)2525+ if 'rss-hash-key' not in data:2626+ return2727+ non_zero = [x for x in data['rss-hash-key'] if x != 0]2828+ ksft_eq(bool(non_zero), True, comment=f"RSS key is all zero {data['rss-hash-key']}")2929+3030+2231def get_rss(cfg, context=0):2332 return ethtool(f"-x {cfg.ifname} context {context}", json=True)[0]2433···9990def test_rss_key_indir(cfg):10091 """Test basics like updating the main RSS key and indirection table."""10192102102- if len(_get_rx_cnts(cfg)) < 2:103103- KsftSkipEx("Device has only one queue (or doesn't support queue stats)")9393+ qcnt = len(_get_rx_cnts(cfg))9494+ if qcnt < 3:9595+ KsftSkipEx("Device has fewer than 3 queues (or doesn't support queue stats)")1049610597 data = get_rss(cfg)10698 want_keys = ['rss-hash-key', 'rss-hash-function', 'rss-indirection-table']···111101 if not data[k]:112102 raise KsftFailEx(f"ethtool results empty for '{k}': {data[k]}")113103104104+ _rss_key_check(cfg, data=data)114105 key_len = len(data['rss-hash-key'])115106116107 # Set the key···121110 data = get_rss(cfg)122111 ksft_eq(key, data['rss-hash-key'])123112113113+ # Set the indirection table and the key together114114+ key = _rss_key_rand(key_len)115115+ ethtool(f"-X {cfg.ifname} equal 3 hkey " + _rss_key_str(key))116116+ reset_indir = defer(ethtool, f"-X {cfg.ifname} default")117117+118118+ data = get_rss(cfg)119119+ _rss_key_check(cfg, data=data)120120+ ksft_eq(0, min(data['rss-indirection-table']))121121+ ksft_eq(2, max(data['rss-indirection-table']))122122+123123+ # Reset indirection table and set the key124124+ key = _rss_key_rand(key_len)125125+ ethtool(f"-X {cfg.ifname} default hkey " + _rss_key_str(key))126126+ data = get_rss(cfg)127127+ _rss_key_check(cfg, data=data)128128+ ksft_eq(0, min(data['rss-indirection-table']))129129+ ksft_eq(qcnt - 1, max(data['rss-indirection-table']))130130+124131 # Set the indirection table125132 ethtool(f"-X {cfg.ifname} equal 2")126126- reset_indir = defer(ethtool, f"-X {cfg.ifname} default")127133 data = get_rss(cfg)128134 ksft_eq(0, min(data['rss-indirection-table']))129135 ksft_eq(1, max(data['rss-indirection-table']))···345317 ctx_cnt = i346318 break347319320320+ _rss_key_check(cfg, context=ctx_id)321321+348322 if not create_with_cfg:349323 ethtool(f"-X {cfg.ifname} context {ctx_id} {want_cfg}")324324+ _rss_key_check(cfg, context=ctx_id)350325351326 # Sanity check the context we just created352327 data = get_rss(cfg, ctx_id)
+26
tools/testing/selftests/hid/hid_bpf.c
···532532 FIXTURE_DATA(hid_bpf) * self,533533 const FIXTURE_VARIANT(hid_bpf) * variant)534534{535535+ struct bpf_map *iter_map;535536 int err = -EINVAL;536537537538 ASSERT_LE(progs_count, ARRAY_SIZE(self->hid_links))···564563565564 *ops_hid_id = self->hid_id;566565 }566566+567567+ /* we disable the auto-attach feature of all maps because we568568+ * only want the tested one to be manually attached in the next569569+ * call to bpf_map__attach_struct_ops()570570+ */571571+ bpf_object__for_each_map(iter_map, *self->skel->skeleton->obj)572572+ bpf_map__set_autoattach(iter_map, false);567573568574 err = hid__load(self->skel);569575 ASSERT_OK(err) TH_LOG("hid_skel_load failed: %d", err);···692684 err = read(self->hidraw_fd, buf, sizeof(buf));693685 ASSERT_EQ(err, 6) TH_LOG("read_hidraw");694686 ASSERT_EQ(buf[2], 52);687687+}688688+689689+/*690690+ * Attach hid_first_event to the given uhid device,691691+ * attempt at re-attaching it, we should not lock and692692+ * return an invalid struct bpf_link693693+ */694694+TEST_F(hid_bpf, multiple_attach)695695+{696696+ const struct test_program progs[] = {697697+ { .name = "hid_first_event" },698698+ };699699+ struct bpf_link *link;700700+701701+ LOAD_PROGRAMS(progs);702702+703703+ link = bpf_map__attach_struct_ops(self->skel->maps.first_event);704704+ ASSERT_NULL(link) TH_LOG("unexpected return value when re-attaching the struct_ops");695705}696706697707/*
+1-1
tools/testing/selftests/hid/progs/hid.c
···455455 __type(value, struct elem);456456} hmap SEC(".maps");457457458458-static int wq_cb_sleepable(void *map, int *key, struct bpf_wq *work)458458+static int wq_cb_sleepable(void *map, int *key, void *work)459459{460460 __u8 buf[9] = {2, 3, 4, 5, 6, 7, 8, 9, 10};461461 struct hid_bpf_ctx *hid_ctx;
···113113 select KVM_PRIVATE_MEM114114 bool115115116116-config HAVE_KVM_GMEM_PREPARE116116+config HAVE_KVM_ARCH_GMEM_PREPARE117117 bool118118 depends on KVM_PRIVATE_MEM119119120120-config HAVE_KVM_GMEM_INVALIDATE120120+config HAVE_KVM_ARCH_GMEM_INVALIDATE121121 bool122122 depends on KVM_PRIVATE_MEM
+136-91
virt/kvm/guest_memfd.c
···1313 struct list_head entry;1414};15151616-static int kvm_gmem_prepare_folio(struct inode *inode, pgoff_t index, struct folio *folio)1616+/**1717+ * folio_file_pfn - like folio_file_page, but return a pfn.1818+ * @folio: The folio which contains this index.1919+ * @index: The index we want to look up.2020+ *2121+ * Return: The pfn for this index.2222+ */2323+static inline kvm_pfn_t folio_file_pfn(struct folio *folio, pgoff_t index)1724{1818-#ifdef CONFIG_HAVE_KVM_GMEM_PREPARE1919- struct list_head *gmem_list = &inode->i_mapping->i_private_list;2020- struct kvm_gmem *gmem;2525+ return folio_pfn(folio) + (index & (folio_nr_pages(folio) - 1));2626+}21272222- list_for_each_entry(gmem, gmem_list, entry) {2323- struct kvm_memory_slot *slot;2424- struct kvm *kvm = gmem->kvm;2525- struct page *page;2626- kvm_pfn_t pfn;2727- gfn_t gfn;2828- int rc;2929-3030- if (!kvm_arch_gmem_prepare_needed(kvm))3131- continue;3232-3333- slot = xa_load(&gmem->bindings, index);3434- if (!slot)3535- continue;3636-3737- page = folio_file_page(folio, index);3838- pfn = page_to_pfn(page);3939- gfn = slot->base_gfn + index - slot->gmem.pgoff;4040- rc = kvm_arch_gmem_prepare(kvm, gfn, pfn, compound_order(compound_head(page)));4141- if (rc) {4242- pr_warn_ratelimited("gmem: Failed to prepare folio for index %lx GFN %llx PFN %llx error %d.\n",4343- index, gfn, pfn, rc);4444- return rc;4545- }2828+static int __kvm_gmem_prepare_folio(struct kvm *kvm, struct kvm_memory_slot *slot,2929+ pgoff_t index, struct folio *folio)3030+{3131+#ifdef CONFIG_HAVE_KVM_ARCH_GMEM_PREPARE3232+ kvm_pfn_t pfn = folio_file_pfn(folio, index);3333+ gfn_t gfn = slot->base_gfn + index - slot->gmem.pgoff;3434+ int rc = kvm_arch_gmem_prepare(kvm, gfn, pfn, folio_order(folio));3535+ if (rc) {3636+ pr_warn_ratelimited("gmem: Failed to prepare folio for index %lx GFN %llx PFN %llx error %d.\n",3737+ index, gfn, pfn, rc);3838+ return rc;4639 }4747-4840#endif4141+4942 return 0;5043}51445252-static struct folio *kvm_gmem_get_folio(struct inode *inode, pgoff_t index, bool prepare)4545+static inline void kvm_gmem_mark_prepared(struct folio *folio)5346{5454- struct folio *folio;4747+ folio_mark_uptodate(folio);4848+}55495656- /* TODO: Support huge pages. */5757- folio = filemap_grab_folio(inode->i_mapping, index);5858- if (IS_ERR(folio))5959- return folio;5050+/*5151+ * Process @folio, which contains @gfn, so that the guest can use it.5252+ * The folio must be locked and the gfn must be contained in @slot.5353+ * On successful return the guest sees a zero page so as to avoid5454+ * leaking host data and the up-to-date flag is set.5555+ */5656+static int kvm_gmem_prepare_folio(struct kvm *kvm, struct kvm_memory_slot *slot,5757+ gfn_t gfn, struct folio *folio)5858+{5959+ unsigned long nr_pages, i;6060+ pgoff_t index;6161+ int r;6262+6363+ nr_pages = folio_nr_pages(folio);6464+ for (i = 0; i < nr_pages; i++)6565+ clear_highpage(folio_page(folio, i));60666167 /*6262- * Use the up-to-date flag to track whether or not the memory has been6363- * zeroed before being handed off to the guest. There is no backing6464- * storage for the memory, so the folio will remain up-to-date until6565- * it's removed.6868+ * Preparing huge folios should always be safe, since it should6969+ * be possible to split them later if needed.6670 *6767- * TODO: Skip clearing pages when trusted firmware will do it when6868- * assigning memory to the guest.7171+ * Right now the folio order is always going to be zero, but the7272+ * code is ready for huge folios. The only assumption is that7373+ * the base pgoff of memslots is naturally aligned with the7474+ * requested page order, ensuring that huge folios can also use7575+ * huge page table entries for GPA->HPA mapping.7676+ *7777+ * The order will be passed when creating the guest_memfd, and7878+ * checked when creating memslots.6979 */7070- if (!folio_test_uptodate(folio)) {7171- unsigned long nr_pages = folio_nr_pages(folio);7272- unsigned long i;8080+ WARN_ON(!IS_ALIGNED(slot->gmem.pgoff, 1 << folio_order(folio)));8181+ index = gfn - slot->base_gfn + slot->gmem.pgoff;8282+ index = ALIGN_DOWN(index, 1 << folio_order(folio));8383+ r = __kvm_gmem_prepare_folio(kvm, slot, index, folio);8484+ if (!r)8585+ kvm_gmem_mark_prepared(folio);73867474- for (i = 0; i < nr_pages; i++)7575- clear_highpage(folio_page(folio, i));8787+ return r;8888+}76897777- folio_mark_uptodate(folio);7878- }7979-8080- if (prepare) {8181- int r = kvm_gmem_prepare_folio(inode, index, folio);8282- if (r < 0) {8383- folio_unlock(folio);8484- folio_put(folio);8585- return ERR_PTR(r);8686- }8787- }8888-8989- /*9090- * Ignore accessed, referenced, and dirty flags. The memory is9191- * unevictable and there is no storage to write back to.9292- */9393- return folio;9090+/*9191+ * Returns a locked folio on success. The caller is responsible for9292+ * setting the up-to-date flag before the memory is mapped into the guest.9393+ * There is no backing storage for the memory, so the folio will remain9494+ * up-to-date until it's removed.9595+ *9696+ * Ignore accessed, referenced, and dirty flags. The memory is9797+ * unevictable and there is no storage to write back to.9898+ */9999+static struct folio *kvm_gmem_get_folio(struct inode *inode, pgoff_t index)100100+{101101+ /* TODO: Support huge pages. */102102+ return filemap_grab_folio(inode->i_mapping, index);94103}9510496105static void kvm_gmem_invalidate_begin(struct kvm_gmem *gmem, pgoff_t start,···199190 break;200191 }201192202202- folio = kvm_gmem_get_folio(inode, index, true);193193+ folio = kvm_gmem_get_folio(inode, index);203194 if (IS_ERR(folio)) {204195 r = PTR_ERR(folio);205196 break;···352343 return MF_DELAYED;353344}354345355355-#ifdef CONFIG_HAVE_KVM_GMEM_INVALIDATE346346+#ifdef CONFIG_HAVE_KVM_ARCH_GMEM_INVALIDATE356347static void kvm_gmem_free_folio(struct folio *folio)357348{358349 struct page *page = folio_page(folio, 0);···367358 .dirty_folio = noop_dirty_folio,368359 .migrate_folio = kvm_gmem_migrate_folio,369360 .error_remove_folio = kvm_gmem_error_folio,370370-#ifdef CONFIG_HAVE_KVM_GMEM_INVALIDATE361361+#ifdef CONFIG_HAVE_KVM_ARCH_GMEM_INVALIDATE371362 .free_folio = kvm_gmem_free_folio,372363#endif373364};···550541 fput(file);551542}552543553553-static int __kvm_gmem_get_pfn(struct file *file, struct kvm_memory_slot *slot,554554- gfn_t gfn, kvm_pfn_t *pfn, int *max_order, bool prepare)544544+/* Returns a locked folio on success. */545545+static struct folio *546546+__kvm_gmem_get_pfn(struct file *file, struct kvm_memory_slot *slot,547547+ gfn_t gfn, kvm_pfn_t *pfn, bool *is_prepared,548548+ int *max_order)555549{556550 pgoff_t index = gfn - slot->base_gfn + slot->gmem.pgoff;557551 struct kvm_gmem *gmem = file->private_data;558552 struct folio *folio;559559- struct page *page;560560- int r;561553562554 if (file != slot->gmem.file) {563555 WARN_ON_ONCE(slot->gmem.file);564564- return -EFAULT;556556+ return ERR_PTR(-EFAULT);565557 }566558567559 gmem = file->private_data;568560 if (xa_load(&gmem->bindings, index) != slot) {569561 WARN_ON_ONCE(xa_load(&gmem->bindings, index));570570- return -EIO;562562+ return ERR_PTR(-EIO);571563 }572564573573- folio = kvm_gmem_get_folio(file_inode(file), index, prepare);565565+ folio = kvm_gmem_get_folio(file_inode(file), index);574566 if (IS_ERR(folio))575575- return PTR_ERR(folio);567567+ return folio;576568577569 if (folio_test_hwpoison(folio)) {578570 folio_unlock(folio);579571 folio_put(folio);580580- return -EHWPOISON;572572+ return ERR_PTR(-EHWPOISON);581573 }582574583583- page = folio_file_page(folio, index);584584-585585- *pfn = page_to_pfn(page);575575+ *pfn = folio_file_pfn(folio, index);586576 if (max_order)587577 *max_order = 0;588578589589- r = 0;590590-591591- folio_unlock(folio);592592-593593- return r;579579+ *is_prepared = folio_test_uptodate(folio);580580+ return folio;594581}595582596583int kvm_gmem_get_pfn(struct kvm *kvm, struct kvm_memory_slot *slot,597584 gfn_t gfn, kvm_pfn_t *pfn, int *max_order)598585{599586 struct file *file = kvm_gmem_get_file(slot);600600- int r;587587+ struct folio *folio;588588+ bool is_prepared = false;589589+ int r = 0;601590602591 if (!file)603592 return -EFAULT;604593605605- r = __kvm_gmem_get_pfn(file, slot, gfn, pfn, max_order, true);594594+ folio = __kvm_gmem_get_pfn(file, slot, gfn, pfn, &is_prepared, max_order);595595+ if (IS_ERR(folio)) {596596+ r = PTR_ERR(folio);597597+ goto out;598598+ }599599+600600+ if (!is_prepared)601601+ r = kvm_gmem_prepare_folio(kvm, slot, gfn, folio);602602+603603+ folio_unlock(folio);604604+ if (r < 0)605605+ folio_put(folio);606606+607607+out:606608 fput(file);607609 return r;608610}609611EXPORT_SYMBOL_GPL(kvm_gmem_get_pfn);610612613613+#ifdef CONFIG_KVM_GENERIC_PRIVATE_MEM611614long kvm_gmem_populate(struct kvm *kvm, gfn_t start_gfn, void __user *src, long npages,612615 kvm_gmem_populate_cb post_populate, void *opaque)613616{···646625647626 npages = min_t(ulong, slot->npages - (start_gfn - slot->base_gfn), npages);648627 for (i = 0; i < npages; i += (1 << max_order)) {628628+ struct folio *folio;649629 gfn_t gfn = start_gfn + i;630630+ bool is_prepared = false;650631 kvm_pfn_t pfn;651632652633 if (signal_pending(current)) {···656633 break;657634 }658635659659- ret = __kvm_gmem_get_pfn(file, slot, gfn, &pfn, &max_order, false);660660- if (ret)636636+ folio = __kvm_gmem_get_pfn(file, slot, gfn, &pfn, &is_prepared, &max_order);637637+ if (IS_ERR(folio)) {638638+ ret = PTR_ERR(folio);661639 break;640640+ }662641663663- if (!IS_ALIGNED(gfn, (1 << max_order)) ||664664- (npages - i) < (1 << max_order))665665- max_order = 0;642642+ if (is_prepared) {643643+ folio_unlock(folio);644644+ folio_put(folio);645645+ ret = -EEXIST;646646+ break;647647+ }648648+649649+ folio_unlock(folio);650650+ WARN_ON(!IS_ALIGNED(gfn, 1 << max_order) ||651651+ (npages - i) < (1 << max_order));652652+653653+ ret = -EINVAL;654654+ while (!kvm_range_has_memory_attributes(kvm, gfn, gfn + (1 << max_order),655655+ KVM_MEMORY_ATTRIBUTE_PRIVATE,656656+ KVM_MEMORY_ATTRIBUTE_PRIVATE)) {657657+ if (!max_order)658658+ goto put_folio_and_exit;659659+ max_order--;660660+ }666661667662 p = src ? src + i * PAGE_SIZE : NULL;668663 ret = post_populate(kvm, gfn, pfn, p, max_order, opaque);664664+ if (!ret)665665+ kvm_gmem_mark_prepared(folio);669666670670- put_page(pfn_to_page(pfn));667667+put_folio_and_exit:668668+ folio_put(folio);671669 if (ret)672670 break;673671 }···699655 return ret && !i ? ret : i;700656}701657EXPORT_SYMBOL_GPL(kvm_gmem_populate);658658+#endif
+36-37
virt/kvm/kvm_main.c
···23982398#endif /* CONFIG_KVM_GENERIC_DIRTYLOG_READ_PROTECT */2399239924002400#ifdef CONFIG_KVM_GENERIC_MEMORY_ATTRIBUTES24012401-/*24022402- * Returns true if _all_ gfns in the range [@start, @end) have attributes24032403- * matching @attrs.24042404- */24052405-bool kvm_range_has_memory_attributes(struct kvm *kvm, gfn_t start, gfn_t end,24062406- unsigned long attrs)24072407-{24082408- XA_STATE(xas, &kvm->mem_attr_array, start);24092409- unsigned long index;24102410- bool has_attrs;24112411- void *entry;24122412-24132413- rcu_read_lock();24142414-24152415- if (!attrs) {24162416- has_attrs = !xas_find(&xas, end - 1);24172417- goto out;24182418- }24192419-24202420- has_attrs = true;24212421- for (index = start; index < end; index++) {24222422- do {24232423- entry = xas_next(&xas);24242424- } while (xas_retry(&xas, entry));24252425-24262426- if (xas.xa_index != index || xa_to_value(entry) != attrs) {24272427- has_attrs = false;24282428- break;24292429- }24302430- }24312431-24322432-out:24332433- rcu_read_unlock();24342434- return has_attrs;24352435-}24362436-24372401static u64 kvm_supported_mem_attributes(struct kvm *kvm)24382402{24392403 if (!kvm || kvm_arch_has_private_mem(kvm))24402404 return KVM_MEMORY_ATTRIBUTE_PRIVATE;2441240524422406 return 0;24072407+}24082408+24092409+/*24102410+ * Returns true if _all_ gfns in the range [@start, @end) have attributes24112411+ * such that the bits in @mask match @attrs.24122412+ */24132413+bool kvm_range_has_memory_attributes(struct kvm *kvm, gfn_t start, gfn_t end,24142414+ unsigned long mask, unsigned long attrs)24152415+{24162416+ XA_STATE(xas, &kvm->mem_attr_array, start);24172417+ unsigned long index;24182418+ void *entry;24192419+24202420+ mask &= kvm_supported_mem_attributes(kvm);24212421+ if (attrs & ~mask)24222422+ return false;24232423+24242424+ if (end == start + 1)24252425+ return (kvm_get_memory_attributes(kvm, start) & mask) == attrs;24262426+24272427+ guard(rcu)();24282428+ if (!attrs)24292429+ return !xas_find(&xas, end - 1);24302430+24312431+ for (index = start; index < end; index++) {24322432+ do {24332433+ entry = xas_next(&xas);24342434+ } while (xas_retry(&xas, entry));24352435+24362436+ if (xas.xa_index != index ||24372437+ (xa_to_value(entry) & mask) != attrs)24382438+ return false;24392439+ }24402440+24412441+ return true;24432442}2444244324452444static __always_inline void kvm_handle_gfn_range(struct kvm *kvm,···25332534 mutex_lock(&kvm->slots_lock);2534253525352536 /* Nothing to do if the entire range as the desired attributes. */25362536- if (kvm_range_has_memory_attributes(kvm, start, end, attributes))25372537+ if (kvm_range_has_memory_attributes(kvm, start, end, ~0, attributes))25372538 goto out_unlock;2538253925392540 /*