···5959If the userspace hasn't been prepared to ignore the unreliable "opened"6060events and the unreliable initial state notification, Linux users can use6161the following kernel parameters to handle the possible issues:6262-A. button.lid_init_state=open:6262+A. button.lid_init_state=method:6363+ When this option is specified, the ACPI button driver reports the6464+ initial lid state using the returning value of the _LID control method6565+ and whether the "opened"/"closed" events are paired fully relies on the6666+ firmware implementation.6767+ This option can be used to fix some platforms where the returning value6868+ of the _LID control method is reliable but the initial lid state6969+ notification is missing.7070+ This option is the default behavior during the period the userspace7171+ isn't ready to handle the buggy AML tables.7272+B. button.lid_init_state=open:6373 When this option is specified, the ACPI button driver always reports the6474 initial lid state as "opened" and whether the "opened"/"closed" events6575 are paired fully relies on the firmware implementation.6676 This may fix some platforms where the returning value of the _LID6777 control method is not reliable and the initial lid state notification is6878 missing.6969- This option is the default behavior during the period the userspace7070- isn't ready to handle the buggy AML tables.71797280If the userspace has been prepared to ignore the unreliable "opened" events7381and the unreliable initial state notification, Linux users should always7482use the following kernel parameter:7575-B. button.lid_init_state=ignore:8383+C. button.lid_init_state=ignore:7684 When this option is specified, the ACPI button driver never reports the7785 initial lid state and there is a compensation mechanism implemented to7886 ensure that the reliable "closed" notifications can always be delievered
+10-9
Documentation/admin-guide/pm/cpufreq.rst
···11.. |struct cpufreq_policy| replace:: :c:type:`struct cpufreq_policy <cpufreq_policy>`22+.. |intel_pstate| replace:: :doc:`intel_pstate <intel_pstate>`2334=======================45CPU Performance Scaling···7675interface it comes from and may not be easily represented in an abstract,7776platform-independent way. For this reason, ``CPUFreq`` allows scaling drivers7877to bypass the governor layer and implement their own performance scaling7979-algorithms. That is done by the ``intel_pstate`` scaling driver.7878+algorithms. That is done by the |intel_pstate| scaling driver.807981808281``CPUFreq`` Policy Objects···175174into account. That is achieved by invoking the governor's ``->stop`` and176175``->start()`` callbacks, in this order, for the entire policy.177176178178-As mentioned before, the ``intel_pstate`` scaling driver bypasses the scaling177177+As mentioned before, the |intel_pstate| scaling driver bypasses the scaling179178governor layer of ``CPUFreq`` and provides its own P-state selection algorithms.180180-Consequently, if ``intel_pstate`` is used, scaling governors are not attached to179179+Consequently, if |intel_pstate| is used, scaling governors are not attached to181180new policy objects. Instead, the driver's ``->setpolicy()`` callback is invoked182181to register per-CPU utilization update callbacks for each policy. These183182callbacks are invoked by the CPU scheduler in the same way as for scaling184184-governors, but in the ``intel_pstate`` case they both determine the P-state to183183+governors, but in the |intel_pstate| case they both determine the P-state to185184use and change the hardware configuration accordingly in one go from scheduler186185context.187186···258257259258``scaling_available_governors``260259 List of ``CPUFreq`` scaling governors present in the kernel that can261261- be attached to this policy or (if the ``intel_pstate`` scaling driver is260260+ be attached to this policy or (if the |intel_pstate| scaling driver is262261 in use) list of scaling algorithms provided by the driver that can be263262 applied to this policy.264263···275274 the CPU is actually running at (due to hardware design and other276275 limitations).277276278278- Some scaling drivers (e.g. ``intel_pstate``) attempt to provide277277+ Some scaling drivers (e.g. |intel_pstate|) attempt to provide279278 information more precisely reflecting the current CPU frequency through280279 this attribute, but that still may not be the exact current CPU281280 frequency as seen by the hardware at the moment.···285284286285``scaling_governor``287286 The scaling governor currently attached to this policy or (if the288288- ``intel_pstate`` scaling driver is in use) the scaling algorithm287287+ |intel_pstate| scaling driver is in use) the scaling algorithm289288 provided by the driver that is currently applied to this policy.290289291290 This attribute is read-write and writing to it will cause a new scaling292291 governor to be attached to this policy or a new scaling algorithm293292 provided by the scaling driver to be applied to it (in the294294- ``intel_pstate`` case), as indicated by the string written to this293293+ |intel_pstate| case), as indicated by the string written to this295294 attribute (which must be one of the names listed by the296295 ``scaling_available_governors`` attribute described above).297296···620619the "boost" setting for the whole system. It is not present if the underlying621620scaling driver does not support the frequency boost mechanism (or supports it,622621but provides a driver-specific interface for controlling it, like623623-``intel_pstate``).622622+|intel_pstate|).624623625624If the value in this file is 1, the frequency boost mechanism is enabled. This626625means that either the hardware can be put into states in which it is able to
+1
Documentation/admin-guide/pm/index.rst
···66 :maxdepth: 27788 cpufreq99+ intel_pstate9101011.. only:: subproject and html1112
+755
Documentation/admin-guide/pm/intel_pstate.rst
···11+===============================================22+``intel_pstate`` CPU Performance Scaling Driver33+===============================================44+55+::66+77+ Copyright (c) 2017 Intel Corp., Rafael J. Wysocki <rafael.j.wysocki@intel.com>88+99+1010+General Information1111+===================1212+1313+``intel_pstate`` is a part of the1414+:doc:`CPU performance scaling subsystem <cpufreq>` in the Linux kernel1515+(``CPUFreq``). It is a scaling driver for the Sandy Bridge and later1616+generations of Intel processors. Note, however, that some of those processors1717+may not be supported. [To understand ``intel_pstate`` it is necessary to know1818+how ``CPUFreq`` works in general, so this is the time to read :doc:`cpufreq` if1919+you have not done that yet.]2020+2121+For the processors supported by ``intel_pstate``, the P-state concept is broader2222+than just an operating frequency or an operating performance point (see the2323+`LinuxCon Europe 2015 presentation by Kristen Accardi <LCEU2015_>`_ for more2424+information about that). For this reason, the representation of P-states used2525+by ``intel_pstate`` internally follows the hardware specification (for details2626+refer to `Intel® 64 and IA-32 Architectures Software Developer’s Manual2727+Volume 3: System Programming Guide <SDM_>`_). However, the ``CPUFreq`` core2828+uses frequencies for identifying operating performance points of CPUs and2929+frequencies are involved in the user space interface exposed by it, so3030+``intel_pstate`` maps its internal representation of P-states to frequencies too3131+(fortunately, that mapping is unambiguous). At the same time, it would not be3232+practical for ``intel_pstate`` to supply the ``CPUFreq`` core with a table of3333+available frequencies due to the possible size of it, so the driver does not do3434+that. Some functionality of the core is limited by that.3535+3636+Since the hardware P-state selection interface used by ``intel_pstate`` is3737+available at the logical CPU level, the driver always works with individual3838+CPUs. Consequently, if ``intel_pstate`` is in use, every ``CPUFreq`` policy3939+object corresponds to one logical CPU and ``CPUFreq`` policies are effectively4040+equivalent to CPUs. In particular, this means that they become "inactive" every4141+time the corresponding CPU is taken offline and need to be re-initialized when4242+it goes back online.4343+4444+``intel_pstate`` is not modular, so it cannot be unloaded, which means that the4545+only way to pass early-configuration-time parameters to it is via the kernel4646+command line. However, its configuration can be adjusted via ``sysfs`` to a4747+great extent. In some configurations it even is possible to unregister it via4848+``sysfs`` which allows another ``CPUFreq`` scaling driver to be loaded and4949+registered (see `below <status_attr_>`_).5050+5151+5252+Operation Modes5353+===============5454+5555+``intel_pstate`` can operate in three different modes: in the active mode with5656+or without hardware-managed P-states support and in the passive mode. Which of5757+them will be in effect depends on what kernel command line options are used and5858+on the capabilities of the processor.5959+6060+Active Mode6161+-----------6262+6363+This is the default operation mode of ``intel_pstate``. If it works in this6464+mode, the ``scaling_driver`` policy attribute in ``sysfs`` for all ``CPUFreq``6565+policies contains the string "intel_pstate".6666+6767+In this mode the driver bypasses the scaling governors layer of ``CPUFreq`` and6868+provides its own scaling algorithms for P-state selection. Those algorithms6969+can be applied to ``CPUFreq`` policies in the same way as generic scaling7070+governors (that is, through the ``scaling_governor`` policy attribute in7171+``sysfs``). [Note that different P-state selection algorithms may be chosen for7272+different policies, but that is not recommended.]7373+7474+They are not generic scaling governors, but their names are the same as the7575+names of some of those governors. Moreover, confusingly enough, they generally7676+do not work in the same way as the generic governors they share the names with.7777+For example, the ``powersave`` P-state selection algorithm provided by7878+``intel_pstate`` is not a counterpart of the generic ``powersave`` governor7979+(roughly, it corresponds to the ``schedutil`` and ``ondemand`` governors).8080+8181+There are two P-state selection algorithms provided by ``intel_pstate`` in the8282+active mode: ``powersave`` and ``performance``. The way they both operate8383+depends on whether or not the hardware-managed P-states (HWP) feature has been8484+enabled in the processor and possibly on the processor model.8585+8686+Which of the P-state selection algorithms is used by default depends on the8787+:c:macro:`CONFIG_CPU_FREQ_DEFAULT_GOV_PERFORMANCE` kernel configuration option.8888+Namely, if that option is set, the ``performance`` algorithm will be used by8989+default, and the other one will be used by default if it is not set.9090+9191+Active Mode With HWP9292+~~~~~~~~~~~~~~~~~~~~9393+9494+If the processor supports the HWP feature, it will be enabled during the9595+processor initialization and cannot be disabled after that. It is possible9696+to avoid enabling it by passing the ``intel_pstate=no_hwp`` argument to the9797+kernel in the command line.9898+9999+If the HWP feature has been enabled, ``intel_pstate`` relies on the processor to100100+select P-states by itself, but still it can give hints to the processor's101101+internal P-state selection logic. What those hints are depends on which P-state102102+selection algorithm has been applied to the given policy (or to the CPU it103103+corresponds to).104104+105105+Even though the P-state selection is carried out by the processor automatically,106106+``intel_pstate`` registers utilization update callbacks with the CPU scheduler107107+in this mode. However, they are not used for running a P-state selection108108+algorithm, but for periodic updates of the current CPU frequency information to109109+be made available from the ``scaling_cur_freq`` policy attribute in ``sysfs``.110110+111111+HWP + ``performance``112112+.....................113113+114114+In this configuration ``intel_pstate`` will write 0 to the processor's115115+Energy-Performance Preference (EPP) knob (if supported) or its116116+Energy-Performance Bias (EPB) knob (otherwise), which means that the processor's117117+internal P-state selection logic is expected to focus entirely on performance.118118+119119+This will override the EPP/EPB setting coming from the ``sysfs`` interface120120+(see `Energy vs Performance Hints`_ below).121121+122122+Also, in this configuration the range of P-states available to the processor's123123+internal P-state selection logic is always restricted to the upper boundary124124+(that is, the maximum P-state that the driver is allowed to use).125125+126126+HWP + ``powersave``127127+...................128128+129129+In this configuration ``intel_pstate`` will set the processor's130130+Energy-Performance Preference (EPP) knob (if supported) or its131131+Energy-Performance Bias (EPB) knob (otherwise) to whatever value it was132132+previously set to via ``sysfs`` (or whatever default value it was133133+set to by the platform firmware). This usually causes the processor's134134+internal P-state selection logic to be less performance-focused.135135+136136+Active Mode Without HWP137137+~~~~~~~~~~~~~~~~~~~~~~~138138+139139+This is the default operation mode for processors that do not support the HWP140140+feature. It also is used by default with the ``intel_pstate=no_hwp`` argument141141+in the kernel command line. However, in this mode ``intel_pstate`` may refuse142142+to work with the given processor if it does not recognize it. [Note that143143+``intel_pstate`` will never refuse to work with any processor with the HWP144144+feature enabled.]145145+146146+In this mode ``intel_pstate`` registers utilization update callbacks with the147147+CPU scheduler in order to run a P-state selection algorithm, either148148+``powersave`` or ``performance``, depending on the ``scaling_cur_freq`` policy149149+setting in ``sysfs``. The current CPU frequency information to be made150150+available from the ``scaling_cur_freq`` policy attribute in ``sysfs`` is151151+periodically updated by those utilization update callbacks too.152152+153153+``performance``154154+...............155155+156156+Without HWP, this P-state selection algorithm is always the same regardless of157157+the processor model and platform configuration.158158+159159+It selects the maximum P-state it is allowed to use, subject to limits set via160160+``sysfs``, every time the P-state selection computations are carried out by the161161+driver's utilization update callback for the given CPU (that does not happen162162+more often than every 10 ms), but the hardware configuration will not be changed163163+if the new P-state is the same as the current one.164164+165165+This is the default P-state selection algorithm if the166166+:c:macro:`CONFIG_CPU_FREQ_DEFAULT_GOV_PERFORMANCE` kernel configuration option167167+is set.168168+169169+``powersave``170170+.............171171+172172+Without HWP, this P-state selection algorithm generally depends on the173173+processor model and/or the system profile setting in the ACPI tables and there174174+are two variants of it.175175+176176+One of them is used with processors from the Atom line and (regardless of the177177+processor model) on platforms with the system profile in the ACPI tables set to178178+"mobile" (laptops mostly), "tablet", "appliance PC", "desktop", or179179+"workstation". It is also used with processors supporting the HWP feature if180180+that feature has not been enabled (that is, with the ``intel_pstate=no_hwp``181181+argument in the kernel command line). It is similar to the algorithm182182+implemented by the generic ``schedutil`` scaling governor except that the183183+utilization metric used by it is based on numbers coming from feedback184184+registers of the CPU. It generally selects P-states proportional to the185185+current CPU utilization, so it is referred to as the "proportional" algorithm.186186+187187+The second variant of the ``powersave`` P-state selection algorithm, used in all188188+of the other cases (generally, on processors from the Core line, so it is189189+referred to as the "Core" algorithm), is based on the values read from the APERF190190+and MPERF feedback registers and the previously requested target P-state.191191+It does not really take CPU utilization into account explicitly, but as a rule192192+it causes the CPU P-state to ramp up very quickly in response to increased193193+utilization which is generally desirable in server environments.194194+195195+Regardless of the variant, this algorithm is run by the driver's utilization196196+update callback for the given CPU when it is invoked by the CPU scheduler, but197197+not more often than every 10 ms (that can be tweaked via ``debugfs`` in `this198198+particular case <Tuning Interface in debugfs_>`_). Like in the ``performance``199199+case, the hardware configuration is not touched if the new P-state turns out to200200+be the same as the current one.201201+202202+This is the default P-state selection algorithm if the203203+:c:macro:`CONFIG_CPU_FREQ_DEFAULT_GOV_PERFORMANCE` kernel configuration option204204+is not set.205205+206206+Passive Mode207207+------------208208+209209+This mode is used if the ``intel_pstate=passive`` argument is passed to the210210+kernel in the command line (it implies the ``intel_pstate=no_hwp`` setting too).211211+Like in the active mode without HWP support, in this mode ``intel_pstate`` may212212+refuse to work with the given processor if it does not recognize it.213213+214214+If the driver works in this mode, the ``scaling_driver`` policy attribute in215215+``sysfs`` for all ``CPUFreq`` policies contains the string "intel_cpufreq".216216+Then, the driver behaves like a regular ``CPUFreq`` scaling driver. That is,217217+it is invoked by generic scaling governors when necessary to talk to the218218+hardware in order to change the P-state of a CPU (in particular, the219219+``schedutil`` governor can invoke it directly from scheduler context).220220+221221+While in this mode, ``intel_pstate`` can be used with all of the (generic)222222+scaling governors listed by the ``scaling_available_governors`` policy attribute223223+in ``sysfs`` (and the P-state selection algorithms described above are not224224+used). Then, it is responsible for the configuration of policy objects225225+corresponding to CPUs and provides the ``CPUFreq`` core (and the scaling226226+governors attached to the policy objects) with accurate information on the227227+maximum and minimum operating frequencies supported by the hardware (including228228+the so-called "turbo" frequency ranges). In other words, in the passive mode229229+the entire range of available P-states is exposed by ``intel_pstate`` to the230230+``CPUFreq`` core. However, in this mode the driver does not register231231+utilization update callbacks with the CPU scheduler and the ``scaling_cur_freq``232232+information comes from the ``CPUFreq`` core (and is the last frequency selected233233+by the current scaling governor for the given policy).234234+235235+236236+.. _turbo:237237+238238+Turbo P-states Support239239+======================240240+241241+In the majority of cases, the entire range of P-states available to242242+``intel_pstate`` can be divided into two sub-ranges that correspond to243243+different types of processor behavior, above and below a boundary that244244+will be referred to as the "turbo threshold" in what follows.245245+246246+The P-states above the turbo threshold are referred to as "turbo P-states" and247247+the whole sub-range of P-states they belong to is referred to as the "turbo248248+range". These names are related to the Turbo Boost technology allowing a249249+multicore processor to opportunistically increase the P-state of one or more250250+cores if there is enough power to do that and if that is not going to cause the251251+thermal envelope of the processor package to be exceeded.252252+253253+Specifically, if software sets the P-state of a CPU core within the turbo range254254+(that is, above the turbo threshold), the processor is permitted to take over255255+performance scaling control for that core and put it into turbo P-states of its256256+choice going forward. However, that permission is interpreted differently by257257+different processor generations. Namely, the Sandy Bridge generation of258258+processors will never use any P-states above the last one set by software for259259+the given core, even if it is within the turbo range, whereas all of the later260260+processor generations will take it as a license to use any P-states from the261261+turbo range, even above the one set by software. In other words, on those262262+processors setting any P-state from the turbo range will enable the processor263263+to put the given core into all turbo P-states up to and including the maximum264264+supported one as it sees fit.265265+266266+One important property of turbo P-states is that they are not sustainable. More267267+precisely, there is no guarantee that any CPUs will be able to stay in any of268268+those states indefinitely, because the power distribution within the processor269269+package may change over time or the thermal envelope it was designed for might270270+be exceeded if a turbo P-state was used for too long.271271+272272+In turn, the P-states below the turbo threshold generally are sustainable. In273273+fact, if one of them is set by software, the processor is not expected to change274274+it to a lower one unless in a thermal stress or a power limit violation275275+situation (a higher P-state may still be used if it is set for another CPU in276276+the same package at the same time, for example).277277+278278+Some processors allow multiple cores to be in turbo P-states at the same time,279279+but the maximum P-state that can be set for them generally depends on the number280280+of cores running concurrently. The maximum turbo P-state that can be set for 3281281+cores at the same time usually is lower than the analogous maximum P-state for282282+2 cores, which in turn usually is lower than the maximum turbo P-state that can283283+be set for 1 core. The one-core maximum turbo P-state is thus the maximum284284+supported one overall.285285+286286+The maximum supported turbo P-state, the turbo threshold (the maximum supported287287+non-turbo P-state) and the minimum supported P-state are specific to the288288+processor model and can be determined by reading the processor's model-specific289289+registers (MSRs). Moreover, some processors support the Configurable TDP290290+(Thermal Design Power) feature and, when that feature is enabled, the turbo291291+threshold effectively becomes a configurable value that can be set by the292292+platform firmware.293293+294294+Unlike ``_PSS`` objects in the ACPI tables, ``intel_pstate`` always exposes295295+the entire range of available P-states, including the whole turbo range, to the296296+``CPUFreq`` core and (in the passive mode) to generic scaling governors. This297297+generally causes turbo P-states to be set more often when ``intel_pstate`` is298298+used relative to ACPI-based CPU performance scaling (see `below <acpi-cpufreq_>`_299299+for more information).300300+301301+Moreover, since ``intel_pstate`` always knows what the real turbo threshold is302302+(even if the Configurable TDP feature is enabled in the processor), its303303+``no_turbo`` attribute in ``sysfs`` (described `below <no_turbo_attr_>`_) should304304+work as expected in all cases (that is, if set to disable turbo P-states, it305305+always should prevent ``intel_pstate`` from using them).306306+307307+308308+Processor Support309309+=================310310+311311+To handle a given processor ``intel_pstate`` requires a number of different312312+pieces of information on it to be known, including:313313+314314+ * The minimum supported P-state.315315+316316+ * The maximum supported `non-turbo P-state <turbo_>`_.317317+318318+ * Whether or not turbo P-states are supported at all.319319+320320+ * The maximum supported `one-core turbo P-state <turbo_>`_ (if turbo P-states321321+ are supported).322322+323323+ * The scaling formula to translate the driver's internal representation324324+ of P-states into frequencies and the other way around.325325+326326+Generally, ways to obtain that information are specific to the processor model327327+or family. Although it often is possible to obtain all of it from the processor328328+itself (using model-specific registers), there are cases in which hardware329329+manuals need to be consulted to get to it too.330330+331331+For this reason, there is a list of supported processors in ``intel_pstate`` and332332+the driver initialization will fail if the detected processor is not in that333333+list, unless it supports the `HWP feature <Active Mode_>`_. [The interface to334334+obtain all of the information listed above is the same for all of the processors335335+supporting the HWP feature, which is why they all are supported by336336+``intel_pstate``.]337337+338338+339339+User Space Interface in ``sysfs``340340+=================================341341+342342+Global Attributes343343+-----------------344344+345345+``intel_pstate`` exposes several global attributes (files) in ``sysfs`` to346346+control its functionality at the system level. They are located in the347347+``/sys/devices/system/cpu/cpufreq/intel_pstate/`` directory and affect all348348+CPUs.349349+350350+Some of them are not present if the ``intel_pstate=per_cpu_perf_limits``351351+argument is passed to the kernel in the command line.352352+353353+``max_perf_pct``354354+ Maximum P-state the driver is allowed to set in percent of the355355+ maximum supported performance level (the highest supported `turbo356356+ P-state <turbo_>`_).357357+358358+ This attribute will not be exposed if the359359+ ``intel_pstate=per_cpu_perf_limits`` argument is present in the kernel360360+ command line.361361+362362+``min_perf_pct``363363+ Minimum P-state the driver is allowed to set in percent of the364364+ maximum supported performance level (the highest supported `turbo365365+ P-state <turbo_>`_).366366+367367+ This attribute will not be exposed if the368368+ ``intel_pstate=per_cpu_perf_limits`` argument is present in the kernel369369+ command line.370370+371371+``num_pstates``372372+ Number of P-states supported by the processor (between 0 and 255373373+ inclusive) including both turbo and non-turbo P-states (see374374+ `Turbo P-states Support`_).375375+376376+ The value of this attribute is not affected by the ``no_turbo``377377+ setting described `below <no_turbo_attr_>`_.378378+379379+ This attribute is read-only.380380+381381+``turbo_pct``382382+ Ratio of the `turbo range <turbo_>`_ size to the size of the entire383383+ range of supported P-states, in percent.384384+385385+ This attribute is read-only.386386+387387+.. _no_turbo_attr:388388+389389+``no_turbo``390390+ If set (equal to 1), the driver is not allowed to set any turbo P-states391391+ (see `Turbo P-states Support`_). If unset (equalt to 0, which is the392392+ default), turbo P-states can be set by the driver.393393+ [Note that ``intel_pstate`` does not support the general ``boost``394394+ attribute (supported by some other scaling drivers) which is replaced395395+ by this one.]396396+397397+ This attrubute does not affect the maximum supported frequency value398398+ supplied to the ``CPUFreq`` core and exposed via the policy interface,399399+ but it affects the maximum possible value of per-policy P-state limits400400+ (see `Interpretation of Policy Attributes`_ below for details).401401+402402+.. _status_attr:403403+404404+``status``405405+ Operation mode of the driver: "active", "passive" or "off".406406+407407+ "active"408408+ The driver is functional and in the `active mode409409+ <Active Mode_>`_.410410+411411+ "passive"412412+ The driver is functional and in the `passive mode413413+ <Passive Mode_>`_.414414+415415+ "off"416416+ The driver is not functional (it is not registered as a scaling417417+ driver with the ``CPUFreq`` core).418418+419419+ This attribute can be written to in order to change the driver's420420+ operation mode or to unregister it. The string written to it must be421421+ one of the possible values of it and, if successful, the write will422422+ cause the driver to switch over to the operation mode represented by423423+ that string - or to be unregistered in the "off" case. [Actually,424424+ switching over from the active mode to the passive mode or the other425425+ way around causes the driver to be unregistered and registered again426426+ with a different set of callbacks, so all of its settings (the global427427+ as well as the per-policy ones) are then reset to their default428428+ values, possibly depending on the target operation mode.]429429+430430+ That only is supported in some configurations, though (for example, if431431+ the `HWP feature is enabled in the processor <Active Mode With HWP_>`_,432432+ the operation mode of the driver cannot be changed), and if it is not433433+ supported in the current configuration, writes to this attribute with434434+ fail with an appropriate error.435435+436436+Interpretation of Policy Attributes437437+-----------------------------------438438+439439+The interpretation of some ``CPUFreq`` policy attributes described in440440+:doc:`cpufreq` is special with ``intel_pstate`` as the current scaling driver441441+and it generally depends on the driver's `operation mode <Operation Modes_>`_.442442+443443+First of all, the values of the ``cpuinfo_max_freq``, ``cpuinfo_min_freq`` and444444+``scaling_cur_freq`` attributes are produced by applying a processor-specific445445+multiplier to the internal P-state representation used by ``intel_pstate``.446446+Also, the values of the ``scaling_max_freq`` and ``scaling_min_freq``447447+attributes are capped by the frequency corresponding to the maximum P-state that448448+the driver is allowed to set.449449+450450+If the ``no_turbo`` `global attribute <no_turbo_attr_>`_ is set, the driver is451451+not allowed to use turbo P-states, so the maximum value of ``scaling_max_freq``452452+and ``scaling_min_freq`` is limited to the maximum non-turbo P-state frequency.453453+Accordingly, setting ``no_turbo`` causes ``scaling_max_freq`` and454454+``scaling_min_freq`` to go down to that value if they were above it before.455455+However, the old values of ``scaling_max_freq`` and ``scaling_min_freq`` will be456456+restored after unsetting ``no_turbo``, unless these attributes have been written457457+to after ``no_turbo`` was set.458458+459459+If ``no_turbo`` is not set, the maximum possible value of ``scaling_max_freq``460460+and ``scaling_min_freq`` corresponds to the maximum supported turbo P-state,461461+which also is the value of ``cpuinfo_max_freq`` in either case.462462+463463+Next, the following policy attributes have special meaning if464464+``intel_pstate`` works in the `active mode <Active Mode_>`_:465465+466466+``scaling_available_governors``467467+ List of P-state selection algorithms provided by ``intel_pstate``.468468+469469+``scaling_governor``470470+ P-state selection algorithm provided by ``intel_pstate`` currently in471471+ use with the given policy.472472+473473+``scaling_cur_freq``474474+ Frequency of the average P-state of the CPU represented by the given475475+ policy for the time interval between the last two invocations of the476476+ driver's utilization update callback by the CPU scheduler for that CPU.477477+478478+The meaning of these attributes in the `passive mode <Passive Mode_>`_ is the479479+same as for other scaling drivers.480480+481481+Additionally, the value of the ``scaling_driver`` attribute for ``intel_pstate``482482+depends on the operation mode of the driver. Namely, it is either483483+"intel_pstate" (in the `active mode <Active Mode_>`_) or "intel_cpufreq" (in the484484+`passive mode <Passive Mode_>`_).485485+486486+Coordination of P-State Limits487487+------------------------------488488+489489+``intel_pstate`` allows P-state limits to be set in two ways: with the help of490490+the ``max_perf_pct`` and ``min_perf_pct`` `global attributes491491+<Global Attributes_>`_ or via the ``scaling_max_freq`` and ``scaling_min_freq``492492+``CPUFreq`` policy attributes. The coordination between those limits is based493493+on the following rules, regardless of the current operation mode of the driver:494494+495495+ 1. All CPUs are affected by the global limits (that is, none of them can be496496+ requested to run faster than the global maximum and none of them can be497497+ requested to run slower than the global minimum).498498+499499+ 2. Each individual CPU is affected by its own per-policy limits (that is, it500500+ cannot be requested to run faster than its own per-policy maximum and it501501+ cannot be requested to run slower than its own per-policy minimum).502502+503503+ 3. The global and per-policy limits can be set independently.504504+505505+If the `HWP feature is enabled in the processor <Active Mode With HWP_>`_, the506506+resulting effective values are written into its registers whenever the limits507507+change in order to request its internal P-state selection logic to always set508508+P-states within these limits. Otherwise, the limits are taken into account by509509+scaling governors (in the `passive mode <Passive Mode_>`_) and by the driver510510+every time before setting a new P-state for a CPU.511511+512512+Additionally, if the ``intel_pstate=per_cpu_perf_limits`` command line argument513513+is passed to the kernel, ``max_perf_pct`` and ``min_perf_pct`` are not exposed514514+at all and the only way to set the limits is by using the policy attributes.515515+516516+517517+Energy vs Performance Hints518518+---------------------------519519+520520+If ``intel_pstate`` works in the `active mode with the HWP feature enabled521521+<Active Mode With HWP_>`_ in the processor, additional attributes are present522522+in every ``CPUFreq`` policy directory in ``sysfs``. They are intended to allow523523+user space to help ``intel_pstate`` to adjust the processor's internal P-state524524+selection logic by focusing it on performance or on energy-efficiency, or525525+somewhere between the two extremes:526526+527527+``energy_performance_preference``528528+ Current value of the energy vs performance hint for the given policy529529+ (or the CPU represented by it).530530+531531+ The hint can be changed by writing to this attribute.532532+533533+``energy_performance_available_preferences``534534+ List of strings that can be written to the535535+ ``energy_performance_preference`` attribute.536536+537537+ They represent different energy vs performance hints and should be538538+ self-explanatory, except that ``default`` represents whatever hint539539+ value was set by the platform firmware.540540+541541+Strings written to the ``energy_performance_preference`` attribute are542542+internally translated to integer values written to the processor's543543+Energy-Performance Preference (EPP) knob (if supported) or its544544+Energy-Performance Bias (EPB) knob.545545+546546+[Note that tasks may by migrated from one CPU to another by the scheduler's547547+load-balancing algorithm and if different energy vs performance hints are548548+set for those CPUs, that may lead to undesirable outcomes. To avoid such549549+issues it is better to set the same energy vs performance hint for all CPUs550550+or to pin every task potentially sensitive to them to a specific CPU.]551551+552552+.. _acpi-cpufreq:553553+554554+``intel_pstate`` vs ``acpi-cpufreq``555555+====================================556556+557557+On the majority of systems supported by ``intel_pstate``, the ACPI tables558558+provided by the platform firmware contain ``_PSS`` objects returning information559559+that can be used for CPU performance scaling (refer to the `ACPI specification`_560560+for details on the ``_PSS`` objects and the format of the information returned561561+by them).562562+563563+The information returned by the ACPI ``_PSS`` objects is used by the564564+``acpi-cpufreq`` scaling driver. On systems supported by ``intel_pstate``565565+the ``acpi-cpufreq`` driver uses the same hardware CPU performance scaling566566+interface, but the set of P-states it can use is limited by the ``_PSS``567567+output.568568+569569+On those systems each ``_PSS`` object returns a list of P-states supported by570570+the corresponding CPU which basically is a subset of the P-states range that can571571+be used by ``intel_pstate`` on the same system, with one exception: the whole572572+`turbo range <turbo_>`_ is represented by one item in it (the topmost one). By573573+convention, the frequency returned by ``_PSS`` for that item is greater by 1 MHz574574+than the frequency of the highest non-turbo P-state listed by it, but the575575+corresponding P-state representation (following the hardware specification)576576+returned for it matches the maximum supported turbo P-state (or is the577577+special value 255 meaning essentially "go as high as you can get").578578+579579+The list of P-states returned by ``_PSS`` is reflected by the table of580580+available frequencies supplied by ``acpi-cpufreq`` to the ``CPUFreq`` core and581581+scaling governors and the minimum and maximum supported frequencies reported by582582+it come from that list as well. In particular, given the special representation583583+of the turbo range described above, this means that the maximum supported584584+frequency reported by ``acpi-cpufreq`` is higher by 1 MHz than the frequency585585+of the highest supported non-turbo P-state listed by ``_PSS`` which, of course,586586+affects decisions made by the scaling governors, except for ``powersave`` and587587+``performance``.588588+589589+For example, if a given governor attempts to select a frequency proportional to590590+estimated CPU load and maps the load of 100% to the maximum supported frequency591591+(possibly multiplied by a constant), then it will tend to choose P-states below592592+the turbo threshold if ``acpi-cpufreq`` is used as the scaling driver, because593593+in that case the turbo range corresponds to a small fraction of the frequency594594+band it can use (1 MHz vs 1 GHz or more). In consequence, it will only go to595595+the turbo range for the highest loads and the other loads above 50% that might596596+benefit from running at turbo frequencies will be given non-turbo P-states597597+instead.598598+599599+One more issue related to that may appear on systems supporting the600600+`Configurable TDP feature <turbo_>`_ allowing the platform firmware to set the601601+turbo threshold. Namely, if that is not coordinated with the lists of P-states602602+returned by ``_PSS`` properly, there may be more than one item corresponding to603603+a turbo P-state in those lists and there may be a problem with avoiding the604604+turbo range (if desirable or necessary). Usually, to avoid using turbo605605+P-states overall, ``acpi-cpufreq`` simply avoids using the topmost state listed606606+by ``_PSS``, but that is not sufficient when there are other turbo P-states in607607+the list returned by it.608608+609609+Apart from the above, ``acpi-cpufreq`` works like ``intel_pstate`` in the610610+`passive mode <Passive Mode_>`_, except that the number of P-states it can set611611+is limited to the ones listed by the ACPI ``_PSS`` objects.612612+613613+614614+Kernel Command Line Options for ``intel_pstate``615615+================================================616616+617617+Several kernel command line options can be used to pass early-configuration-time618618+parameters to ``intel_pstate`` in order to enforce specific behavior of it. All619619+of them have to be prepended with the ``intel_pstate=`` prefix.620620+621621+``disable``622622+ Do not register ``intel_pstate`` as the scaling driver even if the623623+ processor is supported by it.624624+625625+``passive``626626+ Register ``intel_pstate`` in the `passive mode <Passive Mode_>`_ to627627+ start with.628628+629629+ This option implies the ``no_hwp`` one described below.630630+631631+``force``632632+ Register ``intel_pstate`` as the scaling driver instead of633633+ ``acpi-cpufreq`` even if the latter is preferred on the given system.634634+635635+ This may prevent some platform features (such as thermal controls and636636+ power capping) that rely on the availability of ACPI P-states637637+ information from functioning as expected, so it should be used with638638+ caution.639639+640640+ This option does not work with processors that are not supported by641641+ ``intel_pstate`` and on platforms where the ``pcc-cpufreq`` scaling642642+ driver is used instead of ``acpi-cpufreq``.643643+644644+``no_hwp``645645+ Do not enable the `hardware-managed P-states (HWP) feature646646+ <Active Mode With HWP_>`_ even if it is supported by the processor.647647+648648+``hwp_only``649649+ Register ``intel_pstate`` as the scaling driver only if the650650+ `hardware-managed P-states (HWP) feature <Active Mode With HWP_>`_ is651651+ supported by the processor.652652+653653+``support_acpi_ppc``654654+ Take ACPI ``_PPC`` performance limits into account.655655+656656+ If the preferred power management profile in the FADT (Fixed ACPI657657+ Description Table) is set to "Enterprise Server" or "Performance658658+ Server", the ACPI ``_PPC`` limits are taken into account by default659659+ and this option has no effect.660660+661661+``per_cpu_perf_limits``662662+ Use per-logical-CPU P-State limits (see `Coordination of P-state663663+ Limits`_ for details).664664+665665+666666+Diagnostics and Tuning667667+======================668668+669669+Trace Events670670+------------671671+672672+There are two static trace events that can be used for ``intel_pstate``673673+diagnostics. One of them is the ``cpu_frequency`` trace event generally used674674+by ``CPUFreq``, and the other one is the ``pstate_sample`` trace event specific675675+to ``intel_pstate``. Both of them are triggered by ``intel_pstate`` only if676676+it works in the `active mode <Active Mode_>`_.677677+678678+The following sequence of shell commands can be used to enable them and see679679+their output (if the kernel is generally configured to support event tracing)::680680+681681+ # cd /sys/kernel/debug/tracing/682682+ # echo 1 > events/power/pstate_sample/enable683683+ # echo 1 > events/power/cpu_frequency/enable684684+ # cat trace685685+ gnome-terminal--4510 [001] ..s. 1177.680733: pstate_sample: core_busy=107 scaled=94 from=26 to=26 mperf=1143818 aperf=1230607 tsc=29838618 freq=2474476686686+ cat-5235 [002] ..s. 1177.681723: cpu_frequency: state=2900000 cpu_id=2687687+688688+If ``intel_pstate`` works in the `passive mode <Passive Mode_>`_, the689689+``cpu_frequency`` trace event will be triggered either by the ``schedutil``690690+scaling governor (for the policies it is attached to), or by the ``CPUFreq``691691+core (for the policies with other scaling governors).692692+693693+``ftrace``694694+----------695695+696696+The ``ftrace`` interface can be used for low-level diagnostics of697697+``intel_pstate``. For example, to check how often the function to set a698698+P-state is called, the ``ftrace`` filter can be set to to699699+:c:func:`intel_pstate_set_pstate`::700700+701701+ # cd /sys/kernel/debug/tracing/702702+ # cat available_filter_functions | grep -i pstate703703+ intel_pstate_set_pstate704704+ intel_pstate_cpu_init705705+ ...706706+ # echo intel_pstate_set_pstate > set_ftrace_filter707707+ # echo function > current_tracer708708+ # cat trace | head -15709709+ # tracer: function710710+ #711711+ # entries-in-buffer/entries-written: 80/80 #P:4712712+ #713713+ # _-----=> irqs-off714714+ # / _----=> need-resched715715+ # | / _---=> hardirq/softirq716716+ # || / _--=> preempt-depth717717+ # ||| / delay718718+ # TASK-PID CPU# |||| TIMESTAMP FUNCTION719719+ # | | | |||| | |720720+ Xorg-3129 [000] ..s. 2537.644844: intel_pstate_set_pstate <-intel_pstate_timer_func721721+ gnome-terminal--4510 [002] ..s. 2537.649844: intel_pstate_set_pstate <-intel_pstate_timer_func722722+ gnome-shell-3409 [001] ..s. 2537.650850: intel_pstate_set_pstate <-intel_pstate_timer_func723723+ <idle>-0 [000] ..s. 2537.654843: intel_pstate_set_pstate <-intel_pstate_timer_func724724+725725+Tuning Interface in ``debugfs``726726+-------------------------------727727+728728+The ``powersave`` algorithm provided by ``intel_pstate`` for `the Core line of729729+processors in the active mode <powersave_>`_ is based on a `PID controller`_730730+whose parameters were chosen to address a number of different use cases at the731731+same time. However, it still is possible to fine-tune it to a specific workload732732+and the ``debugfs`` interface under ``/sys/kernel/debug/pstate_snb/`` is733733+provided for this purpose. [Note that the ``pstate_snb`` directory will be734734+present only if the specific P-state selection algorithm matching the interface735735+in it actually is in use.]736736+737737+The following files present in that directory can be used to modify the PID738738+controller parameters at run time:739739+740740+| ``deadband``741741+| ``d_gain_pct``742742+| ``i_gain_pct``743743+| ``p_gain_pct``744744+| ``sample_rate_ms``745745+| ``setpoint``746746+747747+Note, however, that achieving desirable results this way generally requires748748+expert-level understanding of the power vs performance tradeoff, so extra care749749+is recommended when attempting to do that.750750+751751+752752+.. _LCEU2015: http://events.linuxfoundation.org/sites/events/files/slides/LinuxConEurope_2015.pdf753753+.. _SDM: http://www.intel.com/content/www/us/en/architecture-and-technology/64-ia-32-architectures-software-developer-system-programming-manual-325384.html754754+.. _ACPI specification: http://www.uefi.org/sites/default/files/resources/ACPI_6_1.pdf755755+.. _PID controller: https://en.wikipedia.org/wiki/PID_controller
-281
Documentation/cpu-freq/intel-pstate.txt
···11-Intel P-State driver22---------------------33-44-This driver provides an interface to control the P-State selection for the55-SandyBridge+ Intel processors.66-77-The following document explains P-States:88-http://events.linuxfoundation.org/sites/events/files/slides/LinuxConEurope_2015.pdf99-As stated in the document, P-State doesn’t exactly mean a frequency. However, for1010-the sake of the relationship with cpufreq, P-State and frequency are used1111-interchangeably.1212-1313-Understanding the cpufreq core governors and policies are important before1414-discussing more details about the Intel P-State driver. Based on what callbacks1515-a cpufreq driver provides to the cpufreq core, it can support two types of1616-drivers:1717-- with target_index() callback: In this mode, the drivers using cpufreq core1818-simply provide the minimum and maximum frequency limits and an additional1919-interface target_index() to set the current frequency. The cpufreq subsystem2020-has a number of scaling governors ("performance", "powersave", "ondemand",2121-etc.). Depending on which governor is in use, cpufreq core will call for2222-transitions to a specific frequency using target_index() callback.2323-- setpolicy() callback: In this mode, drivers do not provide target_index()2424-callback, so cpufreq core can't request a transition to a specific frequency.2525-The driver provides minimum and maximum frequency limits and callbacks to set a2626-policy. The policy in cpufreq sysfs is referred to as the "scaling governor".2727-The cpufreq core can request the driver to operate in any of the two policies:2828-"performance" and "powersave". The driver decides which frequency to use based2929-on the above policy selection considering minimum and maximum frequency limits.3030-3131-The Intel P-State driver falls under the latter category, which implements the3232-setpolicy() callback. This driver decides what P-State to use based on the3333-requested policy from the cpufreq core. If the processor is capable of3434-selecting its next P-State internally, then the driver will offload this3535-responsibility to the processor (aka HWP: Hardware P-States). If not, the3636-driver implements algorithms to select the next P-State.3737-3838-Since these policies are implemented in the driver, they are not same as the3939-cpufreq scaling governors implementation, even if they have the same name in4040-the cpufreq sysfs (scaling_governors). For example the "performance" policy is4141-similar to cpufreq’s "performance" governor, but "powersave" is completely4242-different than the cpufreq "powersave" governor. The strategy here is similar4343-to cpufreq "ondemand", where the requested P-State is related to the system load.4444-4545-Sysfs Interface4646-4747-In addition to the frequency-controlling interfaces provided by the cpufreq4848-core, the driver provides its own sysfs files to control the P-State selection.4949-These files have been added to /sys/devices/system/cpu/intel_pstate/.5050-Any changes made to these files are applicable to all CPUs (even in a5151-multi-package system, Refer to later section on placing "Per-CPU limits").5252-5353- max_perf_pct: Limits the maximum P-State that will be requested by5454- the driver. It states it as a percentage of the available performance. The5555- available (P-State) performance may be reduced by the no_turbo5656- setting described below.5757-5858- min_perf_pct: Limits the minimum P-State that will be requested by5959- the driver. It states it as a percentage of the max (non-turbo)6060- performance level.6161-6262- no_turbo: Limits the driver to selecting P-State below the turbo6363- frequency range.6464-6565- turbo_pct: Displays the percentage of the total performance that6666- is supported by hardware that is in the turbo range. This number6767- is independent of whether turbo has been disabled or not.6868-6969- num_pstates: Displays the number of P-States that are supported7070- by hardware. This number is independent of whether turbo has7171- been disabled or not.7272-7373-For example, if a system has these parameters:7474- Max 1 core turbo ratio: 0x21 (Max 1 core ratio is the maximum P-State)7575- Max non turbo ratio: 0x177676- Minimum ratio : 0x08 (Here the ratio is called max efficiency ratio)7777-7878-Sysfs will show :7979- max_perf_pct:100, which corresponds to 1 core ratio8080- min_perf_pct:24, max_efficiency_ratio / max 1 Core ratio8181- no_turbo:0, turbo is not disabled8282- num_pstates:26 = (max 1 Core ratio - Max Efficiency Ratio + 1)8383- turbo_pct:39 = (max 1 core ratio - max non turbo ratio) / num_pstates8484-8585-Refer to "Intel® 64 and IA-32 Architectures Software Developer’s Manual8686-Volume 3: System Programming Guide" to understand ratios.8787-8888-There is one more sysfs attribute in /sys/devices/system/cpu/intel_pstate/8989-that can be used for controlling the operation mode of the driver:9090-9191- status: Three settings are possible:9292- "off" - The driver is not in use at this time.9393- "active" - The driver works as a P-state governor (default).9494- "passive" - The driver works as a regular cpufreq one and collaborates9595- with the generic cpufreq governors (it sets P-states as9696- requested by those governors).9797- The current setting is returned by reads from this attribute. Writing one9898- of the above strings to it changes the operation mode as indicated by that9999- string, if possible. If HW-managed P-states (HWP) are enabled, it is not100100- possible to change the driver's operation mode and attempts to write to101101- this attribute will fail.102102-103103-cpufreq sysfs for Intel P-State104104-105105-Since this driver registers with cpufreq, cpufreq sysfs is also presented.106106-There are some important differences, which need to be considered.107107-108108-scaling_cur_freq: This displays the real frequency which was used during109109-the last sample period instead of what is requested. Some other cpufreq driver,110110-like acpi-cpufreq, displays what is requested (Some changes are on the111111-way to fix this for acpi-cpufreq driver). The same is true for frequencies112112-displayed at /proc/cpuinfo.113113-114114-scaling_governor: This displays current active policy. Since each CPU has a115115-cpufreq sysfs, it is possible to set a scaling governor to each CPU. But this116116-is not possible with Intel P-States, as there is one common policy for all117117-CPUs. Here, the last requested policy will be applicable to all CPUs. It is118118-suggested that one use the cpupower utility to change policy to all CPUs at the119119-same time.120120-121121-scaling_setspeed: This attribute can never be used with Intel P-State.122122-123123-scaling_max_freq/scaling_min_freq: This interface can be used similarly to124124-the max_perf_pct/min_perf_pct of Intel P-State sysfs. However since frequencies125125-are converted to nearest possible P-State, this is prone to rounding errors.126126-This method is not preferred to limit performance.127127-128128-affected_cpus: Not used129129-related_cpus: Not used130130-131131-For contemporary Intel processors, the frequency is controlled by the132132-processor itself and the P-State exposed to software is related to133133-performance levels. The idea that frequency can be set to a single134134-frequency is fictional for Intel Core processors. Even if the scaling135135-driver selects a single P-State, the actual frequency the processor136136-will run at is selected by the processor itself.137137-138138-Per-CPU limits139139-140140-The kernel command line option "intel_pstate=per_cpu_perf_limits" forces141141-the intel_pstate driver to use per-CPU performance limits. When it is set,142142-the sysfs control interface described above is subject to limitations.143143-- The following controls are not available for both read and write144144- /sys/devices/system/cpu/intel_pstate/max_perf_pct145145- /sys/devices/system/cpu/intel_pstate/min_perf_pct146146-- The following controls can be used to set performance limits, as far as the147147-architecture of the processor permits:148148- /sys/devices/system/cpu/cpu*/cpufreq/scaling_max_freq149149- /sys/devices/system/cpu/cpu*/cpufreq/scaling_min_freq150150- /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor151151-- User can still observe turbo percent and number of P-States from152152- /sys/devices/system/cpu/intel_pstate/turbo_pct153153- /sys/devices/system/cpu/intel_pstate/num_pstates154154-- User can read write system wide turbo status155155- /sys/devices/system/cpu/no_turbo156156-157157-Support of energy performance hints158158-It is possible to provide hints to the HWP algorithms in the processor159159-to be more performance centric to more energy centric. When the driver160160-is using HWP, two additional cpufreq sysfs attributes are presented for161161-each logical CPU.162162-These attributes are:163163- - energy_performance_available_preferences164164- - energy_performance_preference165165-166166-To get list of supported hints:167167-$ cat energy_performance_available_preferences168168- default performance balance_performance balance_power power169169-170170-The current preference can be read or changed via cpufreq sysfs171171-attribute "energy_performance_preference". Reading from this attribute172172-will display current effective setting. User can write any of the valid173173-preference string to this attribute. User can always restore to power-on174174-default by writing "default".175175-176176-Since threads can migrate to different CPUs, this is possible that the177177-new CPU may have different energy performance preference than the previous178178-one. To avoid such issues, either threads can be pinned to specific CPUs179179-or set the same energy performance preference value to all CPUs.180180-181181-Tuning Intel P-State driver182182-183183-When the performance can be tuned using PID (Proportional Integral184184-Derivative) controller, debugfs files are provided for adjusting performance.185185-They are presented under:186186-/sys/kernel/debug/pstate_snb/187187-188188-The PID tunable parameters are:189189- deadband190190- d_gain_pct191191- i_gain_pct192192- p_gain_pct193193- sample_rate_ms194194- setpoint195195-196196-To adjust these parameters, some understanding of driver implementation is197197-necessary. There are some tweeks described here, but be very careful. Adjusting198198-them requires expert level understanding of power and performance relationship.199199-These limits are only useful when the "powersave" policy is active.200200-201201--To make the system more responsive to load changes, sample_rate_ms can202202-be adjusted (current default is 10ms).203203--To make the system use higher performance, even if the load is lower, setpoint204204-can be adjusted to a lower number. This will also lead to faster ramp up time205205-to reach the maximum P-State.206206-If there are no derivative and integral coefficients, The next P-State will be207207-equal to:208208- current P-State - ((setpoint - current cpu load) * p_gain_pct)209209-210210-For example, if the current PID parameters are (Which are defaults for the core211211-processors like SandyBridge):212212- deadband = 0213213- d_gain_pct = 0214214- i_gain_pct = 0215215- p_gain_pct = 20216216- sample_rate_ms = 10217217- setpoint = 97218218-219219-If the current P-State = 0x08 and current load = 100, this will result in the220220-next P-State = 0x08 - ((97 - 100) * 0.2) = 8.6 (rounded to 9). Here the P-State221221-goes up by only 1. If during next sample interval the current load doesn't222222-change and still 100, then P-State goes up by one again. This process will223223-continue as long as the load is more than the setpoint until the maximum P-State224224-is reached.225225-226226-For the same load at setpoint = 60, this will result in the next P-State227227-= 0x08 - ((60 - 100) * 0.2) = 16228228-So by changing the setpoint from 97 to 60, there is an increase of the229229-next P-State from 9 to 16. So this will make processor execute at higher230230-P-State for the same CPU load. If the load continues to be more than the231231-setpoint during next sample intervals, then P-State will go up again till the232232-maximum P-State is reached. But the ramp up time to reach the maximum P-State233233-will be much faster when the setpoint is 60 compared to 97.234234-235235-Debugging Intel P-State driver236236-237237-Event tracing238238-To debug P-State transition, the Linux event tracing interface can be used.239239-There are two specific events, which can be enabled (Provided the kernel240240-configs related to event tracing are enabled).241241-242242-# cd /sys/kernel/debug/tracing/243243-# echo 1 > events/power/pstate_sample/enable244244-# echo 1 > events/power/cpu_frequency/enable245245-# cat trace246246-gnome-terminal--4510 [001] ..s. 1177.680733: pstate_sample: core_busy=107247247- scaled=94 from=26 to=26 mperf=1143818 aperf=1230607 tsc=29838618248248- freq=2474476249249-cat-5235 [002] ..s. 1177.681723: cpu_frequency: state=2900000 cpu_id=2250250-251251-252252-Using ftrace253253-254254-If function level tracing is required, the Linux ftrace interface can be used.255255-For example if we want to check how often a function to set a P-State is256256-called, we can set ftrace filter to intel_pstate_set_pstate.257257-258258-# cd /sys/kernel/debug/tracing/259259-# cat available_filter_functions | grep -i pstate260260-intel_pstate_set_pstate261261-intel_pstate_cpu_init262262-...263263-264264-# echo intel_pstate_set_pstate > set_ftrace_filter265265-# echo function > current_tracer266266-# cat trace | head -15267267-# tracer: function268268-#269269-# entries-in-buffer/entries-written: 80/80 #P:4270270-#271271-# _-----=> irqs-off272272-# / _----=> need-resched273273-# | / _---=> hardirq/softirq274274-# || / _--=> preempt-depth275275-# ||| / delay276276-# TASK-PID CPU# |||| TIMESTAMP FUNCTION277277-# | | | |||| | |278278- Xorg-3129 [000] ..s. 2537.644844: intel_pstate_set_pstate <-intel_pstate_timer_func279279- gnome-terminal--4510 [002] ..s. 2537.649844: intel_pstate_set_pstate <-intel_pstate_timer_func280280- gnome-shell-3409 [001] ..s. 2537.650850: intel_pstate_set_pstate <-intel_pstate_timer_func281281- <idle>-0 [000] ..s. 2537.654843: intel_pstate_set_pstate <-intel_pstate_timer_func
···3636 control gpios37373838 - threshold: allows setting the "click"-threshold in the range3939- from 20 to 80.3939+ from 0 to 80.40404141 - gain: allows setting the sensitivity in the range from 0 to4242 31. Note that lower values indicate higher
···1616- reg: Base address of PMIC on Hi6220 SoC.1717- interrupt-controller: Hi655x has internal IRQs (has own IRQ domain).1818- pmic-gpios: The GPIO used by PMIC IRQ.1919+- #clock-cells: From common clock binding; shall be set to 02020+2121+Optional properties:2222+- clock-output-names: From common clock binding to override the2323+ default output clock name19242025Example:2126 pmic: pmic@f8000000 {···2924 interrupt-controller;3025 #interrupt-cells = <2>;3126 pmic-gpios = <&gpio1 2 GPIO_ACTIVE_HIGH>;2727+ #clock-cells = <0>;3228 }
···1818 "ext_clock" (External clock provided to the card).1919- post-power-on-delay-ms : Delay in ms after powering the card and2020 de-asserting the reset-gpios (if any)2121+- power-off-delay-us : Delay in us after asserting the reset-gpios (if any)2222+ during power off of the card.21232224Example:2325
+4
Documentation/devicetree/bindings/net/fsl-fec.txt
···1515- phy-reset-active-high : If present then the reset sequence using the GPIO1616 specified in the "phy-reset-gpios" property is reversed (H=reset state,1717 L=operation state).1818+- phy-reset-post-delay : Post reset delay in milliseconds. If present then1919+ a delay of phy-reset-post-delay milliseconds will be observed after the2020+ phy-reset-gpios has been toggled. Can be omitted thus no delay is2121+ observed. Delay is in range of 1ms to 1000ms. Other delays are invalid.1822- phy-supply : regulator that powers the Ethernet PHY.1923- phy-handle : phandle to the PHY device connected to this device.2024- fixed-link : Assume a fixed link. See fixed-link.txt in the same directory.
···247247bias-pull-up - pull up the pin248248bias-pull-down - pull down the pin249249bias-pull-pin-default - use pin-default pull state250250-bi-directional - pin supports simultaneous input/output operations251250drive-push-pull - drive actively high and low252251drive-open-drain - drive with open drain253252drive-open-source - drive with open source···259260power-source - select between different power supplies260261low-power-enable - enable low power mode261262low-power-disable - disable low power mode262262-output-enable - enable output on pin regardless of output value263263output-low - set the pin to output mode with low level264264output-high - set the pin to output mode with high level265265slew-rate - set the slew rate
+1-1
Documentation/input/devices/edt-ft5x06.rst
···1515The driver allows configuration of the touch screen via a set of sysfs files:16161717/sys/class/input/eventX/device/device/threshold:1818- allows setting the "click"-threshold in the range from 20 to 80.1818+ allows setting the "click"-threshold in the range from 0 to 80.19192020/sys/class/input/eventX/device/device/gain:2121 allows setting the sensitivity in the range from 0 to 31. Note that
+65-49
Documentation/sound/hd-audio/models.rst
···1616 6-jack in back, 2-jack in front17176stack-digout1818 6-jack with a SPDIF out1919+6stack-automute2020+ 6-jack with headphone jack detection19212022ALC2602123======···6462 Enables docking station I/O for some Lenovos6563hp-gpio-led6664 GPIO LED support on HP laptops6565+hp-dock-gpio-mic1-led6666+ HP dock with mic LED support6767dell-headset-multi6868 Headset jack, which can also be used as mic-in6969dell-headset-dock···7672 Combo jack sensing on ALC2837773tpt440-dock7874 Pin configs for Lenovo Thinkpad Dock support7575+tpt4407676+ Lenovo Thinkpad T440s setup7777+tpt4607878+ Lenovo Thinkpad T460/560 setup7979+dual-codecs8080+ Lenovo laptops with dual codecs79818082ALC66x/67x/8928183==============···10797 Inverted internal mic workaround10898dell-headset-multi10999 Headset jack, which can also be used as mic-in100100+dual-codecs101101+ Lenovo laptops with dual codecs110102111103ALC680112104======···126114 Inverted internal mic workaround127115no-primary-hp128116 VAIO Z/VGC-LN51JGB workaround (for fixed speaker DAC)117117+dual-codecs118118+ ALC1220 dual codecs for Gaming mobos129119130120ALC861/660131121==========···220206221207Conexant 5045222208=============223223-laptop-hpsense224224- Laptop with HP sense (old model laptop)225225-laptop-micsense226226- Laptop with Mic sense (old model fujitsu)227227-laptop-hpmicsense228228- Laptop with HP and Mic senses229229-benq230230- Benq R55E231231-laptop-hp530232232- HP 530 laptop233233-test234234- for testing/debugging purpose, almost all controls can be235235- adjusted. Appearing only when compiled with $CONFIG_SND_DEBUG=y209209+cap-mix-amp210210+ Fix max input level on mixer widget211211+toshiba-p105212212+ Toshiba P105 quirk213213+hp-530214214+ HP 530 quirk236215237216Conexant 5047238217=============239239-laptop240240- Basic Laptop config 241241-laptop-hp242242- Laptop config for some HP models (subdevice 30A5)243243-laptop-eapd244244- Laptop config with EAPD support245245-test246246- for testing/debugging purpose, almost all controls can be247247- adjusted. Appearing only when compiled with $CONFIG_SND_DEBUG=y218218+cap-mix-amp219219+ Fix max input level on mixer widget248220249221Conexant 5051250222=============251251-laptop252252- Basic Laptop config (default)253253-hp254254- HP Spartan laptop255255-hp-dv6736256256- HP dv6736257257-hp-f700258258- HP Compaq Presario F700259259-ideapad260260- Lenovo IdeaPad laptop261261-toshiba262262- Toshiba Satellite M300223223+lenovo-x200224224+ Lenovo X200 quirk263225264226Conexant 5066265227=============266266-laptop267267- Basic Laptop config (default)268268-hp-laptop269269- HP laptops, e g G60270270-asus271271- Asus K52JU, Lenovo G560272272-dell-laptop273273- Dell laptops274274-dell-vostro275275- Dell Vostro276276-olpc-xo-1_5277277- OLPC XO 1.5278278-ideapad279279- Lenovo IdeaPad U150228228+stereo-dmic229229+ Workaround for inverted stereo digital mic230230+gpio1231231+ Enable GPIO1 pin232232+headphone-mic-pin233233+ Enable headphone mic NID 0x18 without detection234234+tp410235235+ Thinkpad T400 & co quirks280236thinkpad281281- Lenovo Thinkpad237237+ Thinkpad mute/mic LED quirk238238+lemote-a1004239239+ Lemote A1004 quirk240240+lemote-a1205241241+ Lemote A1205 quirk242242+olpc-xo243243+ OLPC XO quirk244244+mute-led-eapd245245+ Mute LED control via EAPD246246+hp-dock247247+ HP dock support248248+mute-led-gpio249249+ Mute LED control via GPIO282250283251STAC9200284252========···440444 Dell desktops/laptops441445alienware442446 Alienware M17x447447+asus-mobo448448+ Pin configs for ASUS mobo with 5.1/SPDIF out443449auto444450 BIOS setup (default)445451···475477 Pin fixup for HP Envy TS bass speaker (NID 0x10)476478hp-bnb13-eq477479 Hardware equalizer setup for HP laptops480480+hp-envy-ts-bass481481+ HP Envy TS bass support478482auto479483 BIOS setup (default)480484···496496497497Cirrus Logic CS4206/4207498498========================499499+mbp53500500+ MacBook Pro 5,3499501mbp55500502 MacBook Pro 5,5501503imac27502504 IMac 27 Inch505505+imac27_122506506+ iMac 12,2507507+apple508508+ Generic Apple quirk509509+mbp101510510+ MacBookPro 10,1511511+mbp81512512+ MacBookPro 8,1513513+mba42514514+ MacBookAir 4,2503515auto504516 BIOS setup (default)505517···521509 MacBook Air 6,1 and 6,2522510gpio0523511 Enable GPIO 0 amp512512+mbp11513513+ MacBookPro 11,2514514+macmini515515+ MacMini 7,1524516auto525517 BIOS setup (default)526518
+1-1
MAINTAINERS
···71437143F: drivers/media/platform/rcar_jpu.c7144714471457145JSM Neo PCI based serial card71467146-M: Gabriel Krisman Bertazi <krisman@linux.vnet.ibm.com>71467146+M: Guilherme G. Piccoli <gpiccoli@linux.vnet.ibm.com>71477147L: linux-serial@vger.kernel.org71487148S: Maintained71497149F: drivers/tty/serial/jsm/
···191191 return NULL;192192193193 root_ops = kzalloc_node(sizeof(*root_ops), GFP_KERNEL, node);194194- if (!root_ops)194194+ if (!root_ops) {195195+ kfree(ri);195196 return NULL;197197+ }196198197199 ri->cfg = pci_acpi_setup_ecam_mapping(root);198200 if (!ri->cfg) {
+6
arch/frv/include/asm/timex.h
···1616#define vxtime_lock() do {} while (0)1717#define vxtime_unlock() do {} while (0)18181919+/* This attribute is used in include/linux/jiffies.h alongside with2020+ * __cacheline_aligned_in_smp. It is assumed that __cacheline_aligned_in_smp2121+ * for frv does not contain another section specification.2222+ */2323+#define __jiffy_arch_data __attribute__((__section__(".data")))2424+1925#endif2026
···360360 Management" code will be disabled if you say Y here.361361362362 See also <file:Documentation/x86/i386/IO-APIC.txt>,363363- <file:Documentation/nmi_watchdog.txt> and the SMP-HOWTO available at363363+ <file:Documentation/lockup-watchdogs.txt> and the SMP-HOWTO available at364364 <http://www.tldp.org/docs.html#howto>.365365366366 If you don't know what to do here, say N.
+1-1
arch/x86/Makefile
···159159 # If '-Os' is enabled, disable it and print a warning.160160 ifdef CONFIG_CC_OPTIMIZE_FOR_SIZE161161 undefine CONFIG_CC_OPTIMIZE_FOR_SIZE162162- $(warning Disabling CONFIG_CC_OPTIMIZE_FOR_SIZE. Your compiler does not have -mfentry so you cannot optimize for size with CONFIG_FUNCTION_GRAPH_TRACER.)162162+ $(warning Disabling CONFIG_CC_OPTIMIZE_FOR_SIZE. Your compiler does not have -mfentry so you cannot optimize for size with CONFIG_FUNCTION_GRAPH_TRACER.)163163 endif164164165165 endif
+1-1
arch/x86/boot/compressed/Makefile
···9494quiet_cmd_check_data_rel = DATAREL $@9595define cmd_check_data_rel9696 for obj in $(filter %.o,$^); do \9797- readelf -S $$obj | grep -qF .rel.local && { \9797+ ${CROSS_COMPILE}readelf -S $$obj | grep -qF .rel.local && { \9898 echo "error: $$obj has data relocations!" >&2; \9999 exit 1; \100100 } || true; \
+19-11
arch/x86/entry/entry_32.S
···252252END(__switch_to_asm)253253254254/*255255+ * The unwinder expects the last frame on the stack to always be at the same256256+ * offset from the end of the page, which allows it to validate the stack.257257+ * Calling schedule_tail() directly would break that convention because its an258258+ * asmlinkage function so its argument has to be pushed on the stack. This259259+ * wrapper creates a proper "end of stack" frame header before the call.260260+ */261261+ENTRY(schedule_tail_wrapper)262262+ FRAME_BEGIN263263+264264+ pushl %eax265265+ call schedule_tail266266+ popl %eax267267+268268+ FRAME_END269269+ ret270270+ENDPROC(schedule_tail_wrapper)271271+/*255272 * A newly forked process directly context switches into this address.256273 *257274 * eax: prev task we switched from···276259 * edi: kernel thread arg277260 */278261ENTRY(ret_from_fork)279279- FRAME_BEGIN /* help unwinder find end of stack */280280-281281- /*282282- * schedule_tail() is asmlinkage so we have to put its 'prev' argument283283- * on the stack.284284- */285285- pushl %eax286286- call schedule_tail287287- popl %eax262262+ call schedule_tail_wrapper288263289264 testl %ebx, %ebx290265 jnz 1f /* kernel threads are uncommon */2912662922672:293268 /* When we fork, we trace the syscall return in the child, too. */294294- leal FRAME_OFFSET(%esp), %eax269269+ movl %esp, %eax295270 call syscall_return_slowpath296296- FRAME_END297271 jmp restore_all298272299273 /* kernel thread */
+4-7
arch/x86/entry/entry_64.S
···3636#include <asm/smap.h>3737#include <asm/pgtable_types.h>3838#include <asm/export.h>3939-#include <asm/frame.h>4039#include <linux/err.h>41404241.code64···405406 * r12: kernel thread arg406407 */407408ENTRY(ret_from_fork)408408- FRAME_BEGIN /* help unwinder find end of stack */409409 movq %rax, %rdi410410- call schedule_tail /* rdi: 'prev' task parameter */410410+ call schedule_tail /* rdi: 'prev' task parameter */411411412412- testq %rbx, %rbx /* from kernel_thread? */413413- jnz 1f /* kernel threads are uncommon */412412+ testq %rbx, %rbx /* from kernel_thread? */413413+ jnz 1f /* kernel threads are uncommon */4144144154152:416416- leaq FRAME_OFFSET(%rsp),%rdi /* pt_regs pointer */416416+ movq %rsp, %rdi417417 call syscall_return_slowpath /* returns with IRQs disabled */418418 TRACE_IRQS_ON /* user mode is traced as IRQS on */419419 SWAPGS420420- FRAME_END421420 jmp restore_regs_and_iret4224214234221:
···104104 return (unsigned long *)task_pt_regs(state->task) - 2;105105}106106107107+static bool is_last_frame(struct unwind_state *state)108108+{109109+ return state->bp == last_frame(state);110110+}111111+107112#ifdef CONFIG_X86_32108113#define GCC_REALIGN_WORDS 3109114#else···120115 return last_frame(state) - GCC_REALIGN_WORDS;121116}122117123123-static bool is_last_task_frame(struct unwind_state *state)118118+static bool is_last_aligned_frame(struct unwind_state *state)124119{125120 unsigned long *last_bp = last_frame(state);126121 unsigned long *aligned_bp = last_aligned_frame(state);127122128123 /*129129- * We have to check for the last task frame at two different locations130130- * because gcc can occasionally decide to realign the stack pointer and131131- * change the offset of the stack frame in the prologue of a function132132- * called by head/entry code. Examples:124124+ * GCC can occasionally decide to realign the stack pointer and change125125+ * the offset of the stack frame in the prologue of a function called126126+ * by head/entry code. Examples:133127 *134128 * <start_secondary>:135129 * push %edi···145141 * push %rbp146142 * mov %rsp,%rbp147143 *148148- * Note that after aligning the stack, it pushes a duplicate copy of149149- * the return address before pushing the frame pointer.144144+ * After aligning the stack, it pushes a duplicate copy of the return145145+ * address before pushing the frame pointer.150146 */151151- return (state->bp == last_bp ||152152- (state->bp == aligned_bp && *(aligned_bp+1) == *(last_bp+1)));147147+ return (state->bp == aligned_bp && *(aligned_bp + 1) == *(last_bp + 1));148148+}149149+150150+static bool is_last_ftrace_frame(struct unwind_state *state)151151+{152152+ unsigned long *last_bp = last_frame(state);153153+ unsigned long *last_ftrace_bp = last_bp - 3;154154+155155+ /*156156+ * When unwinding from an ftrace handler of a function called by entry157157+ * code, the stack layout of the last frame is:158158+ *159159+ * bp160160+ * parent ret addr161161+ * bp162162+ * function ret addr163163+ * parent ret addr164164+ * pt_regs165165+ * -----------------166166+ */167167+ return (state->bp == last_ftrace_bp &&168168+ *state->bp == *(state->bp + 2) &&169169+ *(state->bp + 1) == *(state->bp + 4));170170+}171171+172172+static bool is_last_task_frame(struct unwind_state *state)173173+{174174+ return is_last_frame(state) || is_last_aligned_frame(state) ||175175+ is_last_ftrace_frame(state);153176}154177155178/*
+4-1
arch/x86/kvm/lapic.c
···1495149514961496static void cancel_hv_timer(struct kvm_lapic *apic)14971497{14981498+ preempt_disable();14981499 kvm_x86_ops->cancel_hv_timer(apic->vcpu);14991500 apic->lapic_timer.hv_timer_in_use = false;15011501+ preempt_enable();15001502}1501150315021504static bool start_hv_timer(struct kvm_lapic *apic)···19361934 for (i = 0; i < KVM_APIC_LVT_NUM; i++)19371935 kvm_lapic_set_reg(apic, APIC_LVTT + 0x10 * i, APIC_LVT_MASKED);19381936 apic_update_lvtt(apic);19391939- if (kvm_check_has_quirk(vcpu->kvm, KVM_X86_QUIRK_LINT0_REENABLED))19371937+ if (kvm_vcpu_is_reset_bsp(vcpu) &&19381938+ kvm_check_has_quirk(vcpu->kvm, KVM_X86_QUIRK_LINT0_REENABLED))19401939 kvm_lapic_set_reg(apic, APIC_LVT0,19411940 SET_APIC_DELIVERY_MODE(0, APIC_MODE_EXTINT));19421941 apic_manage_nmi_watchdog(apic, kvm_lapic_get_reg(apic, APIC_LVT0));
+12-14
arch/x86/kvm/svm.c
···18071807 * AMD's VMCB does not have an explicit unusable field, so emulate it18081808 * for cross vendor migration purposes by "not present"18091809 */18101810- var->unusable = !var->present || (var->type == 0);18101810+ var->unusable = !var->present;1811181118121812 switch (seg) {18131813 case VCPU_SREG_TR:···18401840 */18411841 if (var->unusable)18421842 var->db = 0;18431843+ /* This is symmetric with svm_set_segment() */18431844 var->dpl = to_svm(vcpu)->vmcb->save.cpl;18441845 break;18451846 }···19811980 s->base = var->base;19821981 s->limit = var->limit;19831982 s->selector = var->selector;19841984- if (var->unusable)19851985- s->attrib = 0;19861986- else {19871987- s->attrib = (var->type & SVM_SELECTOR_TYPE_MASK);19881988- s->attrib |= (var->s & 1) << SVM_SELECTOR_S_SHIFT;19891989- s->attrib |= (var->dpl & 3) << SVM_SELECTOR_DPL_SHIFT;19901990- s->attrib |= (var->present & 1) << SVM_SELECTOR_P_SHIFT;19911991- s->attrib |= (var->avl & 1) << SVM_SELECTOR_AVL_SHIFT;19921992- s->attrib |= (var->l & 1) << SVM_SELECTOR_L_SHIFT;19931993- s->attrib |= (var->db & 1) << SVM_SELECTOR_DB_SHIFT;19941994- s->attrib |= (var->g & 1) << SVM_SELECTOR_G_SHIFT;19951995- }19831983+ s->attrib = (var->type & SVM_SELECTOR_TYPE_MASK);19841984+ s->attrib |= (var->s & 1) << SVM_SELECTOR_S_SHIFT;19851985+ s->attrib |= (var->dpl & 3) << SVM_SELECTOR_DPL_SHIFT;19861986+ s->attrib |= ((var->present & 1) && !var->unusable) << SVM_SELECTOR_P_SHIFT;19871987+ s->attrib |= (var->avl & 1) << SVM_SELECTOR_AVL_SHIFT;19881988+ s->attrib |= (var->l & 1) << SVM_SELECTOR_L_SHIFT;19891989+ s->attrib |= (var->db & 1) << SVM_SELECTOR_DB_SHIFT;19901990+ s->attrib |= (var->g & 1) << SVM_SELECTOR_G_SHIFT;1996199119971992 /*19981993 * This is always accurate, except if SYSRET returned to a segment···19972000 * would entail passing the CPL to userspace and back.19982001 */19992002 if (seg == VCPU_SREG_SS)20002000- svm->vmcb->save.cpl = (s->attrib >> SVM_SELECTOR_DPL_SHIFT) & 3;20032003+ /* This is symmetric with svm_get_segment() */20042004+ svm->vmcb->save.cpl = (var->dpl & 3);2001200520022006 mark_dirty(svm->vmcb, VMCB_SEG);20032007}
+62-85
arch/x86/kvm/vmx.c
···69146914 return 0;69156915}6916691669176917-/*69186918- * This function performs the various checks including69196919- * - if it's 4KB aligned69206920- * - No bits beyond the physical address width are set69216921- * - Returns 0 on success or else 169226922- * (Intel SDM Section 30.3)69236923- */69246924-static int nested_vmx_check_vmptr(struct kvm_vcpu *vcpu, int exit_reason,69256925- gpa_t *vmpointer)69176917+static int nested_vmx_get_vmptr(struct kvm_vcpu *vcpu, gpa_t *vmpointer)69266918{69276919 gva_t gva;69286928- gpa_t vmptr;69296920 struct x86_exception e;69306930- struct page *page;69316931- struct vcpu_vmx *vmx = to_vmx(vcpu);69326932- int maxphyaddr = cpuid_maxphyaddr(vcpu);6933692169346922 if (get_vmx_mem_address(vcpu, vmcs_readl(EXIT_QUALIFICATION),69356923 vmcs_read32(VMX_INSTRUCTION_INFO), false, &gva))69366924 return 1;6937692569386938- if (kvm_read_guest_virt(&vcpu->arch.emulate_ctxt, gva, &vmptr,69396939- sizeof(vmptr), &e)) {69266926+ if (kvm_read_guest_virt(&vcpu->arch.emulate_ctxt, gva, vmpointer,69276927+ sizeof(*vmpointer), &e)) {69406928 kvm_inject_page_fault(vcpu, &e);69416929 return 1;69426930 }6943693169446944- switch (exit_reason) {69456945- case EXIT_REASON_VMON:69466946- /*69476947- * SDM 3: 24.11.569486948- * The first 4 bytes of VMXON region contain the supported69496949- * VMCS revision identifier69506950- *69516951- * Note - IA32_VMX_BASIC[48] will never be 169526952- * for the nested case;69536953- * which replaces physical address width with 3269546954- *69556955- */69566956- if (!PAGE_ALIGNED(vmptr) || (vmptr >> maxphyaddr)) {69576957- nested_vmx_failInvalid(vcpu);69586958- return kvm_skip_emulated_instruction(vcpu);69596959- }69606960-69616961- page = nested_get_page(vcpu, vmptr);69626962- if (page == NULL) {69636963- nested_vmx_failInvalid(vcpu);69646964- return kvm_skip_emulated_instruction(vcpu);69656965- }69666966- if (*(u32 *)kmap(page) != VMCS12_REVISION) {69676967- kunmap(page);69686968- nested_release_page_clean(page);69696969- nested_vmx_failInvalid(vcpu);69706970- return kvm_skip_emulated_instruction(vcpu);69716971- }69726972- kunmap(page);69736973- nested_release_page_clean(page);69746974- vmx->nested.vmxon_ptr = vmptr;69756975- break;69766976- case EXIT_REASON_VMCLEAR:69776977- if (!PAGE_ALIGNED(vmptr) || (vmptr >> maxphyaddr)) {69786978- nested_vmx_failValid(vcpu,69796979- VMXERR_VMCLEAR_INVALID_ADDRESS);69806980- return kvm_skip_emulated_instruction(vcpu);69816981- }69826982-69836983- if (vmptr == vmx->nested.vmxon_ptr) {69846984- nested_vmx_failValid(vcpu,69856985- VMXERR_VMCLEAR_VMXON_POINTER);69866986- return kvm_skip_emulated_instruction(vcpu);69876987- }69886988- break;69896989- case EXIT_REASON_VMPTRLD:69906990- if (!PAGE_ALIGNED(vmptr) || (vmptr >> maxphyaddr)) {69916991- nested_vmx_failValid(vcpu,69926992- VMXERR_VMPTRLD_INVALID_ADDRESS);69936993- return kvm_skip_emulated_instruction(vcpu);69946994- }69956995-69966996- if (vmptr == vmx->nested.vmxon_ptr) {69976997- nested_vmx_failValid(vcpu,69986998- VMXERR_VMPTRLD_VMXON_POINTER);69996999- return kvm_skip_emulated_instruction(vcpu);70007000- }70017001- break;70027002- default:70037003- return 1; /* shouldn't happen */70047004- }70057005-70067006- if (vmpointer)70077007- *vmpointer = vmptr;70086932 return 0;70096933}70106934···69907066static int handle_vmon(struct kvm_vcpu *vcpu)69917067{69927068 int ret;70697069+ gpa_t vmptr;70707070+ struct page *page;69937071 struct vcpu_vmx *vmx = to_vmx(vcpu);69947072 const u64 VMXON_NEEDED_FEATURES = FEATURE_CONTROL_LOCKED69957073 | FEATURE_CONTROL_VMXON_ENABLED_OUTSIDE_SMX;···70217095 return 1;70227096 }7023709770247024- if (nested_vmx_check_vmptr(vcpu, EXIT_REASON_VMON, NULL))70987098+ if (nested_vmx_get_vmptr(vcpu, &vmptr))70257099 return 1;70267026-71007100+71017101+ /*71027102+ * SDM 3: 24.11.571037103+ * The first 4 bytes of VMXON region contain the supported71047104+ * VMCS revision identifier71057105+ *71067106+ * Note - IA32_VMX_BASIC[48] will never be 1 for the nested case;71077107+ * which replaces physical address width with 3271087108+ */71097109+ if (!PAGE_ALIGNED(vmptr) || (vmptr >> cpuid_maxphyaddr(vcpu))) {71107110+ nested_vmx_failInvalid(vcpu);71117111+ return kvm_skip_emulated_instruction(vcpu);71127112+ }71137113+71147114+ page = nested_get_page(vcpu, vmptr);71157115+ if (page == NULL) {71167116+ nested_vmx_failInvalid(vcpu);71177117+ return kvm_skip_emulated_instruction(vcpu);71187118+ }71197119+ if (*(u32 *)kmap(page) != VMCS12_REVISION) {71207120+ kunmap(page);71217121+ nested_release_page_clean(page);71227122+ nested_vmx_failInvalid(vcpu);71237123+ return kvm_skip_emulated_instruction(vcpu);71247124+ }71257125+ kunmap(page);71267126+ nested_release_page_clean(page);71277127+71287128+ vmx->nested.vmxon_ptr = vmptr;70277129 ret = enter_vmx_operation(vcpu);70287130 if (ret)70297131 return ret;···71677213 if (!nested_vmx_check_permission(vcpu))71687214 return 1;7169721571707170- if (nested_vmx_check_vmptr(vcpu, EXIT_REASON_VMCLEAR, &vmptr))72167216+ if (nested_vmx_get_vmptr(vcpu, &vmptr))71717217 return 1;72187218+72197219+ if (!PAGE_ALIGNED(vmptr) || (vmptr >> cpuid_maxphyaddr(vcpu))) {72207220+ nested_vmx_failValid(vcpu, VMXERR_VMCLEAR_INVALID_ADDRESS);72217221+ return kvm_skip_emulated_instruction(vcpu);72227222+ }72237223+72247224+ if (vmptr == vmx->nested.vmxon_ptr) {72257225+ nested_vmx_failValid(vcpu, VMXERR_VMCLEAR_VMXON_POINTER);72267226+ return kvm_skip_emulated_instruction(vcpu);72277227+ }7172722871737229 if (vmptr == vmx->nested.current_vmptr)71747230 nested_release_vmcs12(vmx);···75097545 if (!nested_vmx_check_permission(vcpu))75107546 return 1;7511754775127512- if (nested_vmx_check_vmptr(vcpu, EXIT_REASON_VMPTRLD, &vmptr))75487548+ if (nested_vmx_get_vmptr(vcpu, &vmptr))75137549 return 1;75507550+75517551+ if (!PAGE_ALIGNED(vmptr) || (vmptr >> cpuid_maxphyaddr(vcpu))) {75527552+ nested_vmx_failValid(vcpu, VMXERR_VMPTRLD_INVALID_ADDRESS);75537553+ return kvm_skip_emulated_instruction(vcpu);75547554+ }75557555+75567556+ if (vmptr == vmx->nested.vmxon_ptr) {75577557+ nested_vmx_failValid(vcpu, VMXERR_VMPTRLD_VMXON_POINTER);75587558+ return kvm_skip_emulated_instruction(vcpu);75597559+ }7514756075157561 if (vmx->nested.current_vmptr != vmptr) {75167562 struct vmcs12 *new_vmcs12;···78877913{78887914 unsigned long exit_qualification = vmcs_readl(EXIT_QUALIFICATION);78897915 int cr = exit_qualification & 15;78907890- int reg = (exit_qualification >> 8) & 15;78917891- unsigned long val = kvm_register_readl(vcpu, reg);79167916+ int reg;79177917+ unsigned long val;7892791878937919 switch ((exit_qualification >> 4) & 3) {78947920 case 0: /* mov to cr */79217921+ reg = (exit_qualification >> 8) & 15;79227922+ val = kvm_register_readl(vcpu, reg);78957923 switch (cr) {78967924 case 0:78977925 if (vmcs12->cr0_guest_host_mask &···79487972 * lmsw can change bits 1..3 of cr0, and only set bit 0 of79497973 * cr0. Other attempted changes are ignored, with no exit.79507974 */79757975+ val = (exit_qualification >> LMSW_SOURCE_DATA_SHIFT) & 0x0f;79517976 if (vmcs12->cr0_guest_host_mask & 0xe &79527977 (val ^ vmcs12->cr0_read_shadow))79537978 return true;
+5-2
arch/x86/kvm/x86.c
···83948394 if (vcpu->arch.pv.pv_unhalted)83958395 return true;8396839683978397- if (atomic_read(&vcpu->arch.nmi_queued))83978397+ if (kvm_test_request(KVM_REQ_NMI, vcpu) ||83988398+ (vcpu->arch.nmi_pending &&83998399+ kvm_x86_ops->nmi_allowed(vcpu)))83988400 return true;8399840184008400- if (kvm_test_request(KVM_REQ_SMI, vcpu))84028402+ if (kvm_test_request(KVM_REQ_SMI, vcpu) ||84038403+ (vcpu->arch.smi_pending && !is_smm(vcpu)))84018404 return true;8402840584038406 if (kvm_arch_interrupt_allowed(vcpu) &&
+1-1
arch/x86/mm/pageattr.c
···186186 unsigned int i, level;187187 unsigned long addr;188188189189- BUG_ON(irqs_disabled());189189+ BUG_ON(irqs_disabled() && !early_boot_irqs_disabled);190190 WARN_ON(PAGE_ALIGN(start) != start);191191192192 on_each_cpu(__cpa_flush_range, NULL, 1);
+4-2
arch/x86/platform/efi/efi.c
···828828829829 /*830830 * We don't do virtual mode, since we don't do runtime services, on831831- * non-native EFI831831+ * non-native EFI. With efi=old_map, we don't do runtime services in832832+ * kexec kernel because in the initial boot something else might833833+ * have been mapped at these virtual addresses.832834 */833833- if (!efi_is_native()) {835835+ if (!efi_is_native() || efi_enabled(EFI_OLD_MEMMAP)) {834836 efi_memmap_unmap();835837 clear_bit(EFI_RUNTIME_SERVICES, &efi.flags);836838 return;
+71-8
arch/x86/platform/efi/efi_64.c
···71717272pgd_t * __init efi_call_phys_prolog(void)7373{7474- unsigned long vaddress;7575- pgd_t *save_pgd;7474+ unsigned long vaddr, addr_pgd, addr_p4d, addr_pud;7575+ pgd_t *save_pgd, *pgd_k, *pgd_efi;7676+ p4d_t *p4d, *p4d_k, *p4d_efi;7777+ pud_t *pud;76787779 int pgd;7878- int n_pgds;8080+ int n_pgds, i, j;79818082 if (!efi_enabled(EFI_OLD_MEMMAP)) {8183 save_pgd = (pgd_t *)read_cr3();···9088 n_pgds = DIV_ROUND_UP((max_pfn << PAGE_SHIFT), PGDIR_SIZE);9189 save_pgd = kmalloc_array(n_pgds, sizeof(*save_pgd), GFP_KERNEL);92909191+ /*9292+ * Build 1:1 identity mapping for efi=old_map usage. Note that9393+ * PAGE_OFFSET is PGDIR_SIZE aligned when KASLR is disabled, while9494+ * it is PUD_SIZE ALIGNED with KASLR enabled. So for a given physical9595+ * address X, the pud_index(X) != pud_index(__va(X)), we can only copy9696+ * PUD entry of __va(X) to fill in pud entry of X to build 1:1 mapping.9797+ * This means here we can only reuse the PMD tables of the direct mapping.9898+ */9399 for (pgd = 0; pgd < n_pgds; pgd++) {9494- save_pgd[pgd] = *pgd_offset_k(pgd * PGDIR_SIZE);9595- vaddress = (unsigned long)__va(pgd * PGDIR_SIZE);9696- set_pgd(pgd_offset_k(pgd * PGDIR_SIZE), *pgd_offset_k(vaddress));100100+ addr_pgd = (unsigned long)(pgd * PGDIR_SIZE);101101+ vaddr = (unsigned long)__va(pgd * PGDIR_SIZE);102102+ pgd_efi = pgd_offset_k(addr_pgd);103103+ save_pgd[pgd] = *pgd_efi;104104+105105+ p4d = p4d_alloc(&init_mm, pgd_efi, addr_pgd);106106+ if (!p4d) {107107+ pr_err("Failed to allocate p4d table!\n");108108+ goto out;109109+ }110110+111111+ for (i = 0; i < PTRS_PER_P4D; i++) {112112+ addr_p4d = addr_pgd + i * P4D_SIZE;113113+ p4d_efi = p4d + p4d_index(addr_p4d);114114+115115+ pud = pud_alloc(&init_mm, p4d_efi, addr_p4d);116116+ if (!pud) {117117+ pr_err("Failed to allocate pud table!\n");118118+ goto out;119119+ }120120+121121+ for (j = 0; j < PTRS_PER_PUD; j++) {122122+ addr_pud = addr_p4d + j * PUD_SIZE;123123+124124+ if (addr_pud > (max_pfn << PAGE_SHIFT))125125+ break;126126+127127+ vaddr = (unsigned long)__va(addr_pud);128128+129129+ pgd_k = pgd_offset_k(vaddr);130130+ p4d_k = p4d_offset(pgd_k, vaddr);131131+ pud[j] = *pud_offset(p4d_k, vaddr);132132+ }133133+ }97134 }98135out:99136 __flush_tlb_all();···145104 /*146105 * After the lock is released, the original page table is restored.147106 */148148- int pgd_idx;107107+ int pgd_idx, i;149108 int nr_pgds;109109+ pgd_t *pgd;110110+ p4d_t *p4d;111111+ pud_t *pud;150112151113 if (!efi_enabled(EFI_OLD_MEMMAP)) {152114 write_cr3((unsigned long)save_pgd);···159115160116 nr_pgds = DIV_ROUND_UP((max_pfn << PAGE_SHIFT) , PGDIR_SIZE);161117162162- for (pgd_idx = 0; pgd_idx < nr_pgds; pgd_idx++)118118+ for (pgd_idx = 0; pgd_idx < nr_pgds; pgd_idx++) {119119+ pgd = pgd_offset_k(pgd_idx * PGDIR_SIZE);163120 set_pgd(pgd_offset_k(pgd_idx * PGDIR_SIZE), save_pgd[pgd_idx]);121121+122122+ if (!(pgd_val(*pgd) & _PAGE_PRESENT))123123+ continue;124124+125125+ for (i = 0; i < PTRS_PER_P4D; i++) {126126+ p4d = p4d_offset(pgd,127127+ pgd_idx * PGDIR_SIZE + i * P4D_SIZE);128128+129129+ if (!(p4d_val(*p4d) & _PAGE_PRESENT))130130+ continue;131131+132132+ pud = (pud_t *)p4d_page_vaddr(*p4d);133133+ pud_free(&init_mm, pud);134134+ }135135+136136+ p4d = (p4d_t *)pgd_page_vaddr(*pgd);137137+ p4d_free(&init_mm, p4d);138138+ }164139165140 kfree(save_pgd);166141
+3
arch/x86/platform/efi/quirks.c
···360360 free_bootmem_late(start, size);361361 }362362363363+ if (!num_entries)364364+ return;365365+363366 new_size = efi.memmap.desc_size * num_entries;364367 new_phys = efi_memmap_alloc(num_entries);365368 if (!new_phys) {
···3838static const int cfq_hist_divisor = 4;39394040/*4141- * offset from end of service tree4141+ * offset from end of queue service tree for idle class4242 */4343#define CFQ_IDLE_DELAY (NSEC_PER_SEC / 5)4444+/* offset from end of group service tree under time slice mode */4545+#define CFQ_SLICE_MODE_GROUP_DELAY (NSEC_PER_SEC / 5)4646+/* offset from end of group service under IOPS mode */4747+#define CFQ_IOPS_MODE_GROUP_DELAY (HZ / 5)44484549/*4650 * below this threshold, we consider thinktime immediate···13661362 cfqg->vfraction = max_t(unsigned, vfr, 1);13671363}1368136413651365+static inline u64 cfq_get_cfqg_vdisktime_delay(struct cfq_data *cfqd)13661366+{13671367+ if (!iops_mode(cfqd))13681368+ return CFQ_SLICE_MODE_GROUP_DELAY;13691369+ else13701370+ return CFQ_IOPS_MODE_GROUP_DELAY;13711371+}13721372+13691373static void13701374cfq_group_notify_queue_add(struct cfq_data *cfqd, struct cfq_group *cfqg)13711375{···13931381 n = rb_last(&st->rb);13941382 if (n) {13951383 __cfqg = rb_entry_cfqg(n);13961396- cfqg->vdisktime = __cfqg->vdisktime + CFQ_IDLE_DELAY;13841384+ cfqg->vdisktime = __cfqg->vdisktime +13851385+ cfq_get_cfqg_vdisktime_delay(cfqd);13971386 } else13981387 cfqg->vdisktime = st->min_vdisktime;13991388 cfq_group_service_tree_add(st, cfqg);
+3-1
block/partition-generic.c
···320320321321 if (info) {322322 struct partition_meta_info *pinfo = alloc_part_info(disk);323323- if (!pinfo)323323+ if (!pinfo) {324324+ err = -ENOMEM;324325 goto out_free_stats;326326+ }325327 memcpy(pinfo, info, sizeof(*info));326328 p->info = pinfo;327329 }
+2
block/partitions/msdos.c
···300300 continue;301301 bsd_start = le32_to_cpu(p->p_offset);302302 bsd_size = le32_to_cpu(p->p_size);303303+ if (memcmp(flavour, "bsd\0", 4) == 0)304304+ bsd_start += offset;303305 if (offset == bsd_start && size == bsd_size)304306 /* full parent partition, we have it already */305307 continue;
···418418419419 table_desc->validation_count++;420420 if (table_desc->validation_count == 0) {421421- ACPI_ERROR((AE_INFO,422422- "Table %p, Validation count is zero after increment\n",423423- table_desc));424421 table_desc->validation_count--;425425- return_ACPI_STATUS(AE_LIMIT);426422 }427423428424 *out_table = table_desc->pointer;
+10-1
drivers/acpi/button.c
···57575858#define ACPI_BUTTON_LID_INIT_IGNORE 0x005959#define ACPI_BUTTON_LID_INIT_OPEN 0x016060+#define ACPI_BUTTON_LID_INIT_METHOD 0x0260616162#define _COMPONENT ACPI_BUTTON_COMPONENT6263ACPI_MODULE_NAME("button");···113112114113static BLOCKING_NOTIFIER_HEAD(acpi_lid_notifier);115114static struct acpi_device *lid_device;116116-static u8 lid_init_state = ACPI_BUTTON_LID_INIT_OPEN;115115+static u8 lid_init_state = ACPI_BUTTON_LID_INIT_METHOD;117116118117static unsigned long lid_report_interval __read_mostly = 500;119118module_param(lid_report_interval, ulong, 0644);···377376 case ACPI_BUTTON_LID_INIT_OPEN:378377 (void)acpi_lid_notify_state(device, 1);379378 break;379379+ case ACPI_BUTTON_LID_INIT_METHOD:380380+ (void)acpi_lid_update_state(device);381381+ break;380382 case ACPI_BUTTON_LID_INIT_IGNORE:381383 default:382384 break;···564560 if (!strncmp(val, "open", sizeof("open") - 1)) {565561 lid_init_state = ACPI_BUTTON_LID_INIT_OPEN;566562 pr_info("Notify initial lid state as open\n");563563+ } else if (!strncmp(val, "method", sizeof("method") - 1)) {564564+ lid_init_state = ACPI_BUTTON_LID_INIT_METHOD;565565+ pr_info("Notify initial lid state with _LID return value\n");567566 } else if (!strncmp(val, "ignore", sizeof("ignore") - 1)) {568567 lid_init_state = ACPI_BUTTON_LID_INIT_IGNORE;569568 pr_info("Do not notify initial lid state\n");···580573 switch (lid_init_state) {581574 case ACPI_BUTTON_LID_INIT_OPEN:582575 return sprintf(buffer, "open");576576+ case ACPI_BUTTON_LID_INIT_METHOD:577577+ return sprintf(buffer, "method");583578 case ACPI_BUTTON_LID_INIT_IGNORE:584579 return sprintf(buffer, "ignore");585580 default:
+1-1
drivers/acpi/nfit/mce.c
···2626 struct nfit_spa *nfit_spa;27272828 /* We only care about memory errors */2929- if (!(mce->status & MCACOD))2929+ if (!mce_is_memory_error(mce))3030 return NOTIFY_DONE;31313232 /*
···512512/**513513 * wakup_source_activate - Mark given wakeup source as active.514514 * @ws: Wakeup source to handle.515515- * @hard: If set, abort suspends in progress and wake up from suspend-to-idle.516515 *517516 * Update the @ws' statistics and, if @ws has just been activated, notify the PM518517 * core of the event by incrementing the counter of of wakeup events being519518 * processed.520519 */521521-static void wakeup_source_activate(struct wakeup_source *ws, bool hard)520520+static void wakeup_source_activate(struct wakeup_source *ws)522521{523522 unsigned int cec;524523525524 if (WARN_ONCE(wakeup_source_not_registered(ws),526525 "unregistered wakeup source\n"))527526 return;528528-529529- if (hard)530530- pm_system_wakeup();531527532528 ws->active = true;533529 ws->active_count++;···550554 ws->wakeup_count++;551555552556 if (!ws->active)553553- wakeup_source_activate(ws, hard);557557+ wakeup_source_activate(ws);558558+559559+ if (hard)560560+ pm_system_wakeup();554561}555562556563/**
···71717272 If in doubt, say N.73737474+config ARM_DB8500_CPUFREQ7575+ tristate "ST-Ericsson DB8500 cpufreq" if COMPILE_TEST && !ARCH_U85007676+ default ARCH_U85007777+ depends on HAS_IOMEM7878+ depends on !CPU_THERMAL || THERMAL7979+ help8080+ This adds the CPUFreq driver for ST-Ericsson Ux500 (DB8500) SoC8181+ series.8282+7483config ARM_IMX6Q_CPUFREQ7584 tristate "Freescale i.MX6 cpufreq support"7685 depends on ARCH_MXC
···24682468 if (!(cpufreq_driver->flags & CPUFREQ_STICKY) &&24692469 list_empty(&cpufreq_policy_list)) {24702470 /* if all ->init() calls failed, unregister */24712471+ ret = -ENODEV;24712472 pr_debug("%s: No CPU initialized for driver %s\n", __func__,24722473 driver_data->name);24732474 goto err_if_unreg;
···709709710710static struct phm_master_table_item711711vega10_thermal_start_thermal_controller_master_list[] = {712712- {NULL, tf_vega10_thermal_initialize},713713- {NULL, tf_vega10_thermal_set_temperature_range},714714- {NULL, tf_vega10_thermal_enable_alert},712712+ { .tableFunction = tf_vega10_thermal_initialize },713713+ { .tableFunction = tf_vega10_thermal_set_temperature_range },714714+ { .tableFunction = tf_vega10_thermal_enable_alert },715715/* We should restrict performance levels to low before we halt the SMC.716716 * On the other hand we are still in boot state when we do this717717 * so it would be pointless.718718 * If this assumption changes we have to revisit this table.719719 */720720- {NULL, tf_vega10_thermal_setup_fan_table},721721- {NULL, tf_vega10_thermal_start_smc_fan_control},722722- {NULL, NULL}720720+ { .tableFunction = tf_vega10_thermal_setup_fan_table },721721+ { .tableFunction = tf_vega10_thermal_start_smc_fan_control },722722+ { }723723};724724725725static struct phm_master_table_header···731731732732static struct phm_master_table_item733733vega10_thermal_set_temperature_range_master_list[] = {734734- {NULL, tf_vega10_thermal_disable_alert},735735- {NULL, tf_vega10_thermal_set_temperature_range},736736- {NULL, tf_vega10_thermal_enable_alert},737737- {NULL, NULL}734734+ { .tableFunction = tf_vega10_thermal_disable_alert },735735+ { .tableFunction = tf_vega10_thermal_set_temperature_range },736736+ { .tableFunction = tf_vega10_thermal_enable_alert },737737+ { }738738};739739740740struct phm_master_table_header
+83
drivers/gpu/drm/drm_dp_helper.c
···12081208 return 0;12091209}12101210EXPORT_SYMBOL(drm_dp_stop_crc);12111211+12121212+struct dpcd_quirk {12131213+ u8 oui[3];12141214+ bool is_branch;12151215+ u32 quirks;12161216+};12171217+12181218+#define OUI(first, second, third) { (first), (second), (third) }12191219+12201220+static const struct dpcd_quirk dpcd_quirk_list[] = {12211221+ /* Analogix 7737 needs reduced M and N at HBR2 link rates */12221222+ { OUI(0x00, 0x22, 0xb9), true, BIT(DP_DPCD_QUIRK_LIMITED_M_N) },12231223+};12241224+12251225+#undef OUI12261226+12271227+/*12281228+ * Get a bit mask of DPCD quirks for the sink/branch device identified by12291229+ * ident. The quirk data is shared but it's up to the drivers to act on the12301230+ * data.12311231+ *12321232+ * For now, only the OUI (first three bytes) is used, but this may be extended12331233+ * to device identification string and hardware/firmware revisions later.12341234+ */12351235+static u3212361236+drm_dp_get_quirks(const struct drm_dp_dpcd_ident *ident, bool is_branch)12371237+{12381238+ const struct dpcd_quirk *quirk;12391239+ u32 quirks = 0;12401240+ int i;12411241+12421242+ for (i = 0; i < ARRAY_SIZE(dpcd_quirk_list); i++) {12431243+ quirk = &dpcd_quirk_list[i];12441244+12451245+ if (quirk->is_branch != is_branch)12461246+ continue;12471247+12481248+ if (memcmp(quirk->oui, ident->oui, sizeof(ident->oui)) != 0)12491249+ continue;12501250+12511251+ quirks |= quirk->quirks;12521252+ }12531253+12541254+ return quirks;12551255+}12561256+12571257+/**12581258+ * drm_dp_read_desc - read sink/branch descriptor from DPCD12591259+ * @aux: DisplayPort AUX channel12601260+ * @desc: Device decriptor to fill from DPCD12611261+ * @is_branch: true for branch devices, false for sink devices12621262+ *12631263+ * Read DPCD 0x400 (sink) or 0x500 (branch) into @desc. Also debug log the12641264+ * identification.12651265+ *12661266+ * Returns 0 on success or a negative error code on failure.12671267+ */12681268+int drm_dp_read_desc(struct drm_dp_aux *aux, struct drm_dp_desc *desc,12691269+ bool is_branch)12701270+{12711271+ struct drm_dp_dpcd_ident *ident = &desc->ident;12721272+ unsigned int offset = is_branch ? DP_BRANCH_OUI : DP_SINK_OUI;12731273+ int ret, dev_id_len;12741274+12751275+ ret = drm_dp_dpcd_read(aux, offset, ident, sizeof(*ident));12761276+ if (ret < 0)12771277+ return ret;12781278+12791279+ desc->quirks = drm_dp_get_quirks(ident, is_branch);12801280+12811281+ dev_id_len = strnlen(ident->device_id, sizeof(ident->device_id));12821282+12831283+ DRM_DEBUG_KMS("DP %s: OUI %*phD dev-ID %*pE HW-rev %d.%d SW-rev %d.%d quirks 0x%04x\n",12841284+ is_branch ? "branch" : "sink",12851285+ (int)sizeof(ident->oui), ident->oui,12861286+ dev_id_len, ident->device_id,12871287+ ident->hw_rev >> 4, ident->hw_rev & 0xf,12881288+ ident->sw_major_rev, ident->sw_minor_rev,12891289+ desc->quirks);12901290+12911291+ return 0;12921292+}12931293+EXPORT_SYMBOL(drm_dp_read_desc);
+3-2
drivers/gpu/drm/drm_plane.c
···948948 }949949950950out:951951- if (ret && crtc->funcs->page_flip_target)952952- drm_crtc_vblank_put(crtc);953951 if (fb)954952 drm_framebuffer_put(fb);955953 if (crtc->primary->old_fb)···961963962964 drm_modeset_drop_locks(&ctx);963965 drm_modeset_acquire_fini(&ctx);966966+967967+ if (ret && crtc->funcs->page_flip_target)968968+ drm_crtc_vblank_put(crtc);964969965970 return ret;966971}
···160160 * drm framework doesn't support multiple irq yet.161161 * we can refer to the crtc to current hardware interrupt occurred through162162 * this pipe value.163163- * @enabled: if the crtc is enabled or not164164- * @event: vblank event that is currently queued for flip165165- * @wait_update: wait all pending planes updates to finish166166- * @pending_update: number of pending plane updates in this crtc167163 * @ops: pointer to callbacks for exynos drm specific functionality168164 * @ctx: A pointer to the crtc's implementation specific context165165+ * @pipe_clk: A pointer to the crtc's pipeline clock.169166 */170167struct exynos_drm_crtc {171168 struct drm_crtc base;
+9-17
drivers/gpu/drm/exynos/exynos_drm_dsi.c
···16331633{16341634 struct device *dev = dsi->dev;16351635 struct device_node *node = dev->of_node;16361636- struct device_node *ep;16371636 int ret;1638163716391638 ret = exynos_dsi_of_read_u32(node, "samsung,pll-clock-frequency",···16401641 if (ret < 0)16411642 return ret;1642164316431643- ep = of_graph_get_endpoint_by_regs(node, DSI_PORT_OUT, 0);16441644- if (!ep) {16451645- dev_err(dev, "no output port with endpoint specified\n");16461646- return -EINVAL;16471647- }16481648-16491649- ret = exynos_dsi_of_read_u32(ep, "samsung,burst-clock-frequency",16441644+ ret = exynos_dsi_of_read_u32(node, "samsung,burst-clock-frequency",16501645 &dsi->burst_clk_rate);16511646 if (ret < 0)16521652- goto end;16471647+ return ret;1653164816541654- ret = exynos_dsi_of_read_u32(ep, "samsung,esc-clock-frequency",16491649+ ret = exynos_dsi_of_read_u32(node, "samsung,esc-clock-frequency",16551650 &dsi->esc_clk_rate);16561651 if (ret < 0)16571657- goto end;16581658-16591659- of_node_put(ep);16521652+ return ret;1660165316611654 dsi->bridge_node = of_graph_get_remote_node(node, DSI_PORT_OUT, 0);16621655 if (!dsi->bridge_node)16631656 return -EINVAL;1664165716651665-end:16661666- of_node_put(ep);16671667-16681668- return ret;16581658+ return 0;16691659}1670166016711661static int exynos_dsi_bind(struct device *dev, struct device *master,···1805181718061818static int exynos_dsi_remove(struct platform_device *pdev)18071819{18201820+ struct exynos_dsi *dsi = platform_get_drvdata(pdev);18211821+18221822+ of_node_put(dsi->bridge_node);18231823+18081824 pm_runtime_disable(&pdev->dev);1809182518101826 component_del(&pdev->dev, &exynos_dsi_component_ops);
+11-7
drivers/gpu/drm/gma500/psb_intel_lvds.c
···759759 if (scan->type & DRM_MODE_TYPE_PREFERRED) {760760 mode_dev->panel_fixed_mode =761761 drm_mode_duplicate(dev, scan);762762+ DRM_DEBUG_KMS("Using mode from DDC\n");762763 goto out; /* FIXME: check for quirks */763764 }764765 }765766766767 /* Failed to get EDID, what about VBT? do we need this? */767767- if (mode_dev->vbt_mode)768768+ if (dev_priv->lfp_lvds_vbt_mode) {768769 mode_dev->panel_fixed_mode =769769- drm_mode_duplicate(dev, mode_dev->vbt_mode);770770+ drm_mode_duplicate(dev, dev_priv->lfp_lvds_vbt_mode);770771771771- if (!mode_dev->panel_fixed_mode)772772- if (dev_priv->lfp_lvds_vbt_mode)773773- mode_dev->panel_fixed_mode =774774- drm_mode_duplicate(dev,775775- dev_priv->lfp_lvds_vbt_mode);772772+ if (mode_dev->panel_fixed_mode) {773773+ mode_dev->panel_fixed_mode->type |=774774+ DRM_MODE_TYPE_PREFERRED;775775+ DRM_DEBUG_KMS("Using mode from VBT\n");776776+ goto out;777777+ }778778+ }776779777780 /*778781 * If we didn't get EDID, try checking if the panel is already turned···792789 if (mode_dev->panel_fixed_mode) {793790 mode_dev->panel_fixed_mode->type |=794791 DRM_MODE_TYPE_PREFERRED;792792+ DRM_DEBUG_KMS("Using pre-programmed mode\n");795793 goto out; /* FIXME: check for quirks */796794 }797795 }
···1272127212731273 dev_priv->ipc_enabled = false;1274127412751275- /* Everything is in place, we can now relax! */12761276- DRM_INFO("Initialized %s %d.%d.%d %s for %s on minor %d\n",12771277- driver.name, driver.major, driver.minor, driver.patchlevel,12781278- driver.date, pci_name(pdev), dev_priv->drm.primary->index);12791275 if (IS_ENABLED(CONFIG_DRM_I915_DEBUG))12801276 DRM_INFO("DRM_I915_DEBUG enabled\n");12811277 if (IS_ENABLED(CONFIG_DRM_I915_DEBUG_GEM))
+2-1
drivers/gpu/drm/i915/i915_drv.h
···562562563563void intel_link_compute_m_n(int bpp, int nlanes,564564 int pixel_clock, int link_clock,565565- struct intel_link_m_n *m_n);565565+ struct intel_link_m_n *m_n,566566+ bool reduce_m_n);566567567568/* Interface history:568569 *
+1-1
drivers/gpu/drm/i915/i915_gem_gtt.c
···23132313 appgtt->base.allocate_va_range) {23142314 ret = appgtt->base.allocate_va_range(&appgtt->base,23152315 vma->node.start,23162316- vma->node.size);23162316+ vma->size);23172317 if (ret)23182318 goto err_pages;23192319 }
-5
drivers/gpu/drm/i915/i915_gem_shrinker.c
···5959 return;60606161 mutex_unlock(&dev->struct_mutex);6262-6363- /* expedite the RCU grace period to free some request slabs */6464- synchronize_rcu_expedited();6562}66636764static bool any_vma_pinned(struct drm_i915_gem_object *obj)···270273 I915_SHRINK_UNBOUND |271274 I915_SHRINK_ACTIVE);272275 intel_runtime_pm_put(dev_priv);273273-274274- synchronize_rcu(); /* wait for our earlier RCU delayed slab frees */275276276277 return freed;277278}
···8280828082818281/* MIPI DSI registers */8282828282838283-#define _MIPI_PORT(port, a, c) ((port) ? c : a) /* ports A and C only */82838283+#define _MIPI_PORT(port, a, c) (((port) == PORT_A) ? a : c) /* ports A and C only */82848284#define _MMIO_MIPI(port, a, c) _MMIO(_MIPI_PORT(port, a, c))8285828582868286#define MIPIO_TXESC_CLK_DIV1 _MMIO(0x160004)
+14-8
drivers/gpu/drm/i915/intel_display.c
···61016101 pipe_config->fdi_lanes = lane;6102610261036103 intel_link_compute_m_n(pipe_config->pipe_bpp, lane, fdi_dotclock,61046104- link_bw, &pipe_config->fdi_m_n);61046104+ link_bw, &pipe_config->fdi_m_n, false);6105610561066106 ret = ironlake_check_fdi_lanes(dev, intel_crtc->pipe, pipe_config);61076107 if (ret == -EINVAL && pipe_config->pipe_bpp > 6*3) {···62776277}6278627862796279static void compute_m_n(unsigned int m, unsigned int n,62806280- uint32_t *ret_m, uint32_t *ret_n)62806280+ uint32_t *ret_m, uint32_t *ret_n,62816281+ bool reduce_m_n)62816282{62826283 /*62836284 * Reduce M/N as much as possible without loss in precision. Several DP···62866285 * values. The passed in values are more likely to have the least62876286 * significant bits zero than M after rounding below, so do this first.62886287 */62896289- while ((m & 1) == 0 && (n & 1) == 0) {62906290- m >>= 1;62916291- n >>= 1;62886288+ if (reduce_m_n) {62896289+ while ((m & 1) == 0 && (n & 1) == 0) {62906290+ m >>= 1;62916291+ n >>= 1;62926292+ }62926293 }6293629462946295 *ret_n = min_t(unsigned int, roundup_pow_of_two(n), DATA_LINK_N_MAX);···63016298void63026299intel_link_compute_m_n(int bits_per_pixel, int nlanes,63036300 int pixel_clock, int link_clock,63046304- struct intel_link_m_n *m_n)63016301+ struct intel_link_m_n *m_n,63026302+ bool reduce_m_n)63056303{63066304 m_n->tu = 64;6307630563086306 compute_m_n(bits_per_pixel * pixel_clock,63096307 link_clock * nlanes * 8,63106310- &m_n->gmch_m, &m_n->gmch_n);63086308+ &m_n->gmch_m, &m_n->gmch_n,63096309+ reduce_m_n);6311631063126311 compute_m_n(pixel_clock, link_clock,63136313- &m_n->link_m, &m_n->link_n);63126312+ &m_n->link_m, &m_n->link_n,63136313+ reduce_m_n);63146314}6315631563166316static inline bool intel_panel_use_ssc(struct drm_i915_private *dev_priv)
···758758 struct msm_gem_object *msm_obj;759759 bool use_vram = false;760760761761+ WARN_ON(!mutex_is_locked(&dev->struct_mutex));762762+761763 switch (flags & MSM_BO_CACHE_MASK) {762764 case MSM_BO_UNCACHED:763765 case MSM_BO_CACHED:···855853856854 size = PAGE_ALIGN(dmabuf->size);857855856856+ /* Take mutex so we can modify the inactive list in msm_gem_new_impl */857857+ mutex_lock(&dev->struct_mutex);858858 ret = msm_gem_new_impl(dev, size, MSM_BO_WC, dmabuf->resv, &obj);859859+ mutex_unlock(&dev->struct_mutex);860860+859861 if (ret)860862 goto fail;861863
···410410 if (!in_fence)411411 return -EINVAL;412412413413- /* TODO if we get an array-fence due to userspace merging multiple414414- * fences, we need a way to determine if all the backing fences415415- * are from our own context..413413+ /*414414+ * Wait if the fence is from a foreign context, or if the fence415415+ * array contains any fence from a foreign context.416416 */417417-418418- if (in_fence->context != gpu->fctx->context) {417417+ if (!dma_fence_match_context(in_fence, gpu->fctx->context)) {419418 ret = dma_fence_wait(in_fence, true);420419 if (ret)421420 return ret;···495496 goto out;496497 }497498498498- if ((submit_cmd.size + submit_cmd.submit_offset) >=499499- msm_obj->base.size) {499499+ if (!submit_cmd.size ||500500+ ((submit_cmd.size + submit_cmd.submit_offset) >501501+ msm_obj->base.size)) {500502 DRM_ERROR("invalid cmdstream size: %u\n", submit_cmd.size);501503 ret = -EINVAL;502504 goto out;
+2-2
drivers/gpu/drm/msm/msm_gpu.c
···549549 gpu->grp_clks[i] = get_clock(dev, name);550550551551 /* Remember the key clocks that we need to control later */552552- if (!strcmp(name, "core"))552552+ if (!strcmp(name, "core") || !strcmp(name, "core_clk"))553553 gpu->core_clk = gpu->grp_clks[i];554554- else if (!strcmp(name, "rbbmtimer"))554554+ else if (!strcmp(name, "rbbmtimer") || !strcmp(name, "rbbmtimer_clk"))555555 gpu->rbbmtimer_clk = gpu->grp_clks[i];556556557557 ++i;
···776776 u32 vblank_time = r600_dpm_get_vblank_time(rdev);777777 u32 switch_limit = pi->mem_gddr5 ? 450 : 300;778778779779+ /* disable mclk switching if the refresh is >120Hz, even if the780780+ * blanking period would allow it781781+ */782782+ if (r600_dpm_get_vrefresh(rdev) > 120)783783+ return true;784784+779785 if (vblank_time < switch_limit)780786 return true;781787 else
···275275 - Trio Linker Plus II276276277277config HID_ELECOM278278- tristate "ELECOM BM084 bluetooth mouse"278278+ tristate "ELECOM HID devices"279279 depends on HID280280 ---help---281281- Support for the ELECOM BM084 (bluetooth mouse).281281+ Support for ELECOM devices:282282+ - BM084 Bluetooth Mouse283283+ - DEFT Trackball (Wired and wireless)282284283285config HID_ELO284286 tristate "ELO USB 4000/4500 touchscreen"
···15711571{15721572 unsigned char *data = wacom->data;1573157315741574- if (wacom->pen_input)15741574+ if (wacom->pen_input) {15751575 dev_dbg(wacom->pen_input->dev.parent,15761576 "%s: received report #%d\n", __func__, data[0]);15771577- else if (wacom->touch_input)15771577+15781578+ if (len == WACOM_PKGLEN_PENABLED ||15791579+ data[0] == WACOM_REPORT_PENABLED)15801580+ return wacom_tpc_pen(wacom);15811581+ }15821582+ else if (wacom->touch_input) {15781583 dev_dbg(wacom->touch_input->dev.parent,15791584 "%s: received report #%d\n", __func__, data[0]);1580158515811581- switch (len) {15821582- case WACOM_PKGLEN_TPC1FG:15831583- return wacom_tpc_single_touch(wacom, len);15841584-15851585- case WACOM_PKGLEN_TPC2FG:15861586- return wacom_tpc_mt_touch(wacom);15871587-15881588- case WACOM_PKGLEN_PENABLED:15891589- return wacom_tpc_pen(wacom);15901590-15911591- default:15921592- switch (data[0]) {15931593- case WACOM_REPORT_TPC1FG:15941594- case WACOM_REPORT_TPCHID:15951595- case WACOM_REPORT_TPCST:15961596- case WACOM_REPORT_TPC1FGE:15861586+ switch (len) {15871587+ case WACOM_PKGLEN_TPC1FG:15971588 return wacom_tpc_single_touch(wacom, len);1598158915991599- case WACOM_REPORT_TPCMT:16001600- case WACOM_REPORT_TPCMT2:16011601- return wacom_mt_touch(wacom);15901590+ case WACOM_PKGLEN_TPC2FG:15911591+ return wacom_tpc_mt_touch(wacom);1602159216031603- case WACOM_REPORT_PENABLED:16041604- return wacom_tpc_pen(wacom);15931593+ default:15941594+ switch (data[0]) {15951595+ case WACOM_REPORT_TPC1FG:15961596+ case WACOM_REPORT_TPCHID:15971597+ case WACOM_REPORT_TPCST:15981598+ case WACOM_REPORT_TPC1FGE:15991599+ return wacom_tpc_single_touch(wacom, len);16001600+16011601+ case WACOM_REPORT_TPCMT:16021602+ case WACOM_REPORT_TPCMT2:16031603+ return wacom_mt_touch(wacom);16041604+16051605+ }16051606 }16061607 }16071608
···178178 int value, int index, void *data, int len)179179{180180 struct i2c_tiny_usb *dev = (struct i2c_tiny_usb *)adapter->algo_data;181181+ void *dmadata = kmalloc(len, GFP_KERNEL);182182+ int ret;183183+184184+ if (!dmadata)185185+ return -ENOMEM;181186182187 /* do control transfer */183183- return usb_control_msg(dev->usb_dev, usb_rcvctrlpipe(dev->usb_dev, 0),188188+ ret = usb_control_msg(dev->usb_dev, usb_rcvctrlpipe(dev->usb_dev, 0),184189 cmd, USB_TYPE_VENDOR | USB_RECIP_INTERFACE |185185- USB_DIR_IN, value, index, data, len, 2000);190190+ USB_DIR_IN, value, index, dmadata, len, 2000);191191+192192+ memcpy(data, dmadata, len);193193+ kfree(dmadata);194194+ return ret;186195}187196188197static int usb_write(struct i2c_adapter *adapter, int cmd,189198 int value, int index, void *data, int len)190199{191200 struct i2c_tiny_usb *dev = (struct i2c_tiny_usb *)adapter->algo_data;201201+ void *dmadata = kmemdup(data, len, GFP_KERNEL);202202+ int ret;203203+204204+ if (!dmadata)205205+ return -ENOMEM;192206193207 /* do control transfer */194194- return usb_control_msg(dev->usb_dev, usb_sndctrlpipe(dev->usb_dev, 0),208208+ ret = usb_control_msg(dev->usb_dev, usb_sndctrlpipe(dev->usb_dev, 0),195209 cmd, USB_TYPE_VENDOR | USB_RECIP_INTERFACE,196196- value, index, data, len, 2000);210210+ value, index, dmadata, len, 2000);211211+212212+ kfree(dmadata);213213+ return ret;197214}198215199216static void i2c_tiny_usb_free(struct i2c_tiny_usb *dev)
+16-14
drivers/input/mouse/elan_i2c_i2c.c
···554554 struct completion *completion)555555{556556 struct device *dev = &client->dev;557557- long ret;558557 int error;559558 int len;560560- u8 buffer[ETP_I2C_INF_LENGTH];559559+ u8 buffer[ETP_I2C_REPORT_LEN];560560+561561+ len = i2c_master_recv(client, buffer, ETP_I2C_REPORT_LEN);562562+ if (len != ETP_I2C_REPORT_LEN) {563563+ error = len < 0 ? len : -EIO;564564+ dev_warn(dev, "failed to read I2C data after FW WDT reset: %d (%d)\n",565565+ error, len);566566+ }561567562568 reinit_completion(completion);563569 enable_irq(client->irq);564570565571 error = elan_i2c_write_cmd(client, ETP_I2C_STAND_CMD, ETP_I2C_RESET);566566- if (!error)567567- ret = wait_for_completion_interruptible_timeout(completion,568568- msecs_to_jiffies(300));569569- disable_irq(client->irq);570570-571572 if (error) {572573 dev_err(dev, "device reset failed: %d\n", error);573573- return error;574574- } else if (ret == 0) {574574+ } else if (!wait_for_completion_timeout(completion,575575+ msecs_to_jiffies(300))) {575576 dev_err(dev, "timeout waiting for device reset\n");576576- return -ETIMEDOUT;577577- } else if (ret < 0) {578578- error = ret;579579- dev_err(dev, "error waiting for device reset: %d\n", error);580580- return error;577577+ error = -ETIMEDOUT;581578 }579579+580580+ disable_irq(client->irq);581581+582582+ if (error)583583+ return error;582584583585 len = i2c_master_recv(client, buffer, ETP_I2C_INF_LENGTH);584586 if (len != ETP_I2C_INF_LENGTH) {
+1
drivers/input/touchscreen/atmel_mxt_ts.c
···350350 case MXT_TOUCH_KEYARRAY_T15:351351 case MXT_TOUCH_PROXIMITY_T23:352352 case MXT_TOUCH_PROXKEY_T52:353353+ case MXT_TOUCH_MULTITOUCHSCREEN_T100:353354 case MXT_PROCI_GRIPFACE_T20:354355 case MXT_PROCG_NOISE_T22:355356 case MXT_PROCI_ONETOUCH_T24:
···17101710 }1711171117121712 /*17131713- * Try to avoid low memory issues when a device is suspended.17131713+ * Use __GFP_HIGH to avoid low memory issues when a device is17141714+ * suspended and the ioctl is needed to resume it.17141715 * Use kmalloc() rather than vmalloc() when we can.17151716 */17161717 dmi = NULL;17171718 noio_flag = memalloc_noio_save();17181718- dmi = kvmalloc(param_kernel->data_size, GFP_KERNEL);17191719+ dmi = kvmalloc(param_kernel->data_size, GFP_KERNEL | __GFP_HIGH);17191720 memalloc_noio_restore(noio_flag);1720172117211722 if (!dmi) {
···108108static void octeon_mmc_int_enable(struct cvm_mmc_host *host, u64 val)109109{110110 writeq(val, host->base + MIO_EMM_INT(host));111111- if (!host->dma_active || (host->dma_active && !host->has_ciu3))111111+ if (!host->has_ciu3)112112 writeq(val, host->base + MIO_EMM_INT_EN(host));113113}114114···267267 }268268269269 host->global_pwr_gpiod = devm_gpiod_get_optional(&pdev->dev,270270- "power-gpios",270270+ "power",271271 GPIOD_OUT_HIGH);272272 if (IS_ERR(host->global_pwr_gpiod)) {273273 dev_err(&pdev->dev, "Invalid power GPIO\n");···288288 if (ret) {289289 dev_err(&pdev->dev, "Error populating slots\n");290290 octeon_mmc_set_shared_power(host, 0);291291- return ret;291291+ goto error;292292 }293293 i++;294294 }295295 return 0;296296+297297+error:298298+ for (i = 0; i < CAVIUM_MAX_MMC; i++) {299299+ if (host->slot[i])300300+ cvm_mmc_of_slot_remove(host->slot[i]);301301+ if (host->slot_pdev[i])302302+ of_platform_device_destroy(&host->slot_pdev[i]->dev, NULL);303303+ }304304+ return ret;296305}297306298307static int octeon_mmc_remove(struct platform_device *pdev)
+6
drivers/mmc/host/cavium-thunderx.c
···146146 return 0;147147148148error:149149+ for (i = 0; i < CAVIUM_MAX_MMC; i++) {150150+ if (host->slot[i])151151+ cvm_mmc_of_slot_remove(host->slot[i]);152152+ if (host->slot_pdev[i])153153+ of_platform_device_destroy(&host->slot_pdev[i]->dev, NULL);154154+ }149155 clk_disable_unprepare(host->clk);150156 return ret;151157}
+10-15
drivers/mmc/host/cavium.c
···839839 cvm_mmc_reset_bus(slot);840840 if (host->global_pwr_gpiod)841841 host->set_shared_power(host, 0);842842- else842842+ else if (!IS_ERR(mmc->supply.vmmc))843843 mmc_regulator_set_ocr(mmc, mmc->supply.vmmc, 0);844844 break;845845846846 case MMC_POWER_UP:847847 if (host->global_pwr_gpiod)848848 host->set_shared_power(host, 1);849849- else849849+ else if (!IS_ERR(mmc->supply.vmmc))850850 mmc_regulator_set_ocr(mmc, mmc->supply.vmmc, ios->vdd);851851 break;852852 }···968968 return -EINVAL;969969 }970970971971- mmc->supply.vmmc = devm_regulator_get_optional(dev, "vmmc");972972- if (IS_ERR(mmc->supply.vmmc)) {973973- if (PTR_ERR(mmc->supply.vmmc) == -EPROBE_DEFER)974974- return -EPROBE_DEFER;975975- /*976976- * Legacy Octeon firmware has no regulator entry, fall-back to977977- * a hard-coded voltage to get a sane OCR.978978- */971971+ ret = mmc_regulator_get_supply(mmc);972972+ if (ret == -EPROBE_DEFER)973973+ return ret;974974+ /*975975+ * Legacy Octeon firmware has no regulator entry, fall-back to976976+ * a hard-coded voltage to get a sane OCR.977977+ */978978+ if (IS_ERR(mmc->supply.vmmc))979979 mmc->ocr_avail = MMC_VDD_32_33 | MMC_VDD_33_34;980980- } else {981981- ret = mmc_regulator_get_ocrmask(mmc->supply.vmmc);982982- if (ret > 0)983983- mmc->ocr_avail = ret;984984- }985980986981 /* Common MMC bindings */987982 ret = mmc_of_parse(mmc);
···13531353 if (pci_set_dma_mask(pdev, DMA_BIT_MASK(32)) &&13541354 pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(32))) {13551355 printk(KERN_ERR "atl2: No usable DMA configuration, aborting\n");13561356+ err = -EIO;13561357 goto err_dma;13571358 }13581359···13671366 * pcibios_set_master to do the needed arch specific settings */13681367 pci_set_master(pdev);1369136813701370- err = -ENOMEM;13711369 netdev = alloc_etherdev(sizeof(struct atl2_adapter));13721372- if (!netdev)13701370+ if (!netdev) {13711371+ err = -ENOMEM;13731372 goto err_alloc_etherdev;13731373+ }1374137413751375 SET_NETDEV_DEV(netdev, &pdev->dev);13761376···14091407 err = atl2_sw_init(adapter);14101408 if (err)14111409 goto err_sw_init;14121412-14131413- err = -EIO;1414141014151411 netdev->hw_features = NETIF_F_HW_VLAN_CTAG_RX;14161412 netdev->features |= (NETIF_F_HW_VLAN_CTAG_TX | NETIF_F_HW_VLAN_CTAG_RX);
+3-1
drivers/net/ethernet/emulex/benet/be_main.c
···50785078 struct be_adapter *adapter = netdev_priv(dev);50795079 u8 l4_hdr = 0;5080508050815081- /* The code below restricts offload features for some tunneled packets.50815081+ /* The code below restricts offload features for some tunneled and50825082+ * Q-in-Q packets.50825083 * Offload features for normal (non tunnel) packets are unchanged.50835084 */50855085+ features = vlan_features_check(skb, features);50845086 if (!skb->encapsulation ||50855087 !(adapter->flags & BE_FLAGS_VXLAN_OFFLOADS))50865088 return features;
+15-1
drivers/net/ethernet/freescale/fec_main.c
···31923192{31933193 int err, phy_reset;31943194 bool active_high = false;31953195- int msec = 1;31953195+ int msec = 1, phy_post_delay = 0;31963196 struct device_node *np = pdev->dev.of_node;3197319731983198 if (!np)···32083208 return phy_reset;32093209 else if (!gpio_is_valid(phy_reset))32103210 return 0;32113211+32123212+ err = of_property_read_u32(np, "phy-reset-post-delay", &phy_post_delay);32133213+ /* valid reset duration should be less than 1s */32143214+ if (!err && phy_post_delay > 1000)32153215+ return -EINVAL;3211321632123217 active_high = of_property_read_bool(np, "phy-reset-active-high");32133218···32303225 usleep_range(msec * 1000, msec * 1000 + 1000);3231322632323227 gpio_set_value_cansleep(phy_reset, !active_high);32283228+32293229+ if (!phy_post_delay)32303230+ return 0;32313231+32323232+ if (phy_post_delay > 20)32333233+ msleep(phy_post_delay);32343234+ else32353235+ usleep_range(phy_post_delay * 1000,32363236+ phy_post_delay * 1000 + 1000);3233323732343238 return 0;32353239}
+36-5
drivers/net/ethernet/mellanox/mlx5/core/cmd.c
···774774 mlx5_core_warn(dev, "%s(0x%x) timeout. Will cause a leak of a command resource\n",775775 mlx5_command_str(msg_to_opcode(ent->in)),776776 msg_to_opcode(ent->in));777777- mlx5_cmd_comp_handler(dev, 1UL << ent->idx);777777+ mlx5_cmd_comp_handler(dev, 1UL << ent->idx, true);778778}779779780780static void cmd_work_handler(struct work_struct *work)···804804 }805805806806 cmd->ent_arr[ent->idx] = ent;807807+ set_bit(MLX5_CMD_ENT_STATE_PENDING_COMP, &ent->state);807808 lay = get_inst(cmd, ent->idx);808809 ent->lay = lay;809810 memset(lay, 0, sizeof(*lay));···826825 if (ent->callback)827826 schedule_delayed_work(&ent->cb_timeout_work, cb_timeout);828827828828+ /* Skip sending command to fw if internal error */829829+ if (pci_channel_offline(dev->pdev) ||830830+ dev->state == MLX5_DEVICE_STATE_INTERNAL_ERROR) {831831+ u8 status = 0;832832+ u32 drv_synd;833833+834834+ ent->ret = mlx5_internal_err_ret_value(dev, msg_to_opcode(ent->in), &drv_synd, &status);835835+ MLX5_SET(mbox_out, ent->out, status, status);836836+ MLX5_SET(mbox_out, ent->out, syndrome, drv_synd);837837+838838+ mlx5_cmd_comp_handler(dev, 1UL << ent->idx, true);839839+ return;840840+ }841841+829842 /* ring doorbell after the descriptor is valid */830843 mlx5_core_dbg(dev, "writing 0x%x to command doorbell\n", 1 << ent->idx);831844 wmb();···850835 poll_timeout(ent);851836 /* make sure we read the descriptor after ownership is SW */852837 rmb();853853- mlx5_cmd_comp_handler(dev, 1UL << ent->idx);838838+ mlx5_cmd_comp_handler(dev, 1UL << ent->idx, (ent->ret == -ETIMEDOUT));854839 }855840}856841···894879 wait_for_completion(&ent->done);895880 } else if (!wait_for_completion_timeout(&ent->done, timeout)) {896881 ent->ret = -ETIMEDOUT;897897- mlx5_cmd_comp_handler(dev, 1UL << ent->idx);882882+ mlx5_cmd_comp_handler(dev, 1UL << ent->idx, true);898883 }899884900885 err = ent->ret;···13901375 }13911376}1392137713931393-void mlx5_cmd_comp_handler(struct mlx5_core_dev *dev, u64 vec)13781378+void mlx5_cmd_comp_handler(struct mlx5_core_dev *dev, u64 vec, bool forced)13941379{13951380 struct mlx5_cmd *cmd = &dev->cmd;13961381 struct mlx5_cmd_work_ent *ent;···14101395 struct semaphore *sem;1411139614121397 ent = cmd->ent_arr[i];13981398+13991399+ /* if we already completed the command, ignore it */14001400+ if (!test_and_clear_bit(MLX5_CMD_ENT_STATE_PENDING_COMP,14011401+ &ent->state)) {14021402+ /* only real completion can free the cmd slot */14031403+ if (!forced) {14041404+ mlx5_core_err(dev, "Command completion arrived after timeout (entry idx = %d).\n",14051405+ ent->idx);14061406+ free_ent(cmd, ent->idx);14071407+ }14081408+ continue;14091409+ }14101410+14131411 if (ent->callback)14141412 cancel_delayed_work(&ent->cb_timeout_work);14151413 if (ent->page_queue)···14451417 mlx5_core_dbg(dev, "command completed. ret 0x%x, delivery status %s(0x%x)\n",14461418 ent->ret, deliv_status_to_str(ent->status), ent->status);14471419 }14481448- free_ent(cmd, ent->idx);14201420+14211421+ /* only real completion will free the entry slot */14221422+ if (!forced)14231423+ free_ent(cmd, ent->idx);1449142414501425 if (ent->callback) {14511426 ds = ent->ts2 - ent->ts1;
···12931293 if (nla_put_u32(skb, IFLA_GENEVE_ID, vni))12941294 goto nla_put_failure;1295129512961296- if (ip_tunnel_info_af(info) == AF_INET) {12961296+ if (rtnl_dereference(geneve->sock4)) {12971297 if (nla_put_in_addr(skb, IFLA_GENEVE_REMOTE,12981298 info->key.u.ipv4.dst))12991299 goto nla_put_failure;···13021302 !!(info->key.tun_flags & TUNNEL_CSUM)))13031303 goto nla_put_failure;1304130413051305+ }13061306+13051307#if IS_ENABLED(CONFIG_IPV6)13061306- } else {13081308+ if (rtnl_dereference(geneve->sock6)) {13071309 if (nla_put_in6_addr(skb, IFLA_GENEVE_REMOTE6,13081310 &info->key.u.ipv6.dst))13091311 goto nla_put_failure;···13171315 if (nla_put_u8(skb, IFLA_GENEVE_UDP_ZERO_CSUM6_RX,13181316 !geneve->use_udp6_rx_checksums))13191317 goto nla_put_failure;13201320-#endif13211318 }13191319+#endif1322132013231321 if (nla_put_u8(skb, IFLA_GENEVE_TTL, info->key.ttl) ||13241322 nla_put_u8(skb, IFLA_GENEVE_TOS, info->key.tos) ||
+1-1
drivers/net/gtp.c
···873873874874 /* Check if there's an existing gtpX device to configure */875875 dev = dev_get_by_index_rcu(net, nla_get_u32(nla[GTPA_LINK]));876876- if (dev->netdev_ops == >p_netdev_ops)876876+ if (dev && dev->netdev_ops == >p_netdev_ops)877877 gtp = netdev_priv(dev);878878879879 put_net(net);
+1-1
drivers/net/phy/Kconfig
···108108config MDIO_OCTEON109109 tristate "Octeon and some ThunderX SOCs MDIO buses"110110 depends on 64BIT111111- depends on HAS_IOMEM111111+ depends on HAS_IOMEM && OF_MDIO112112 select MDIO_CAVIUM113113 help114114 This module provides a driver for the Octeon and ThunderX MDIO
+37-29
drivers/net/phy/marvell.c
···255255{256256 int err;257257258258- /* The Marvell PHY has an errata which requires259259- * that certain registers get written in order260260- * to restart autonegotiation */261261- err = phy_write(phydev, MII_BMCR, BMCR_RESET);262262-263263- if (err < 0)264264- return err;265265-266266- err = phy_write(phydev, 0x1d, 0x1f);267267- if (err < 0)268268- return err;269269-270270- err = phy_write(phydev, 0x1e, 0x200c);271271- if (err < 0)272272- return err;273273-274274- err = phy_write(phydev, 0x1d, 0x5);275275- if (err < 0)276276- return err;277277-278278- err = phy_write(phydev, 0x1e, 0);279279- if (err < 0)280280- return err;281281-282282- err = phy_write(phydev, 0x1e, 0x100);283283- if (err < 0)284284- return err;285285-286258 err = marvell_set_polarity(phydev, phydev->mdix_ctrl);287259 if (err < 0)288260 return err;···286314 }287315288316 return 0;317317+}318318+319319+static int m88e1101_config_aneg(struct phy_device *phydev)320320+{321321+ int err;322322+323323+ /* This Marvell PHY has an errata which requires324324+ * that certain registers get written in order325325+ * to restart autonegotiation326326+ */327327+ err = phy_write(phydev, MII_BMCR, BMCR_RESET);328328+329329+ if (err < 0)330330+ return err;331331+332332+ err = phy_write(phydev, 0x1d, 0x1f);333333+ if (err < 0)334334+ return err;335335+336336+ err = phy_write(phydev, 0x1e, 0x200c);337337+ if (err < 0)338338+ return err;339339+340340+ err = phy_write(phydev, 0x1d, 0x5);341341+ if (err < 0)342342+ return err;343343+344344+ err = phy_write(phydev, 0x1e, 0);345345+ if (err < 0)346346+ return err;347347+348348+ err = phy_write(phydev, 0x1e, 0x100);349349+ if (err < 0)350350+ return err;351351+352352+ return marvell_config_aneg(phydev);289353}290354291355static int m88e1111_config_aneg(struct phy_device *phydev)···19001892 .flags = PHY_HAS_INTERRUPT,19011893 .probe = marvell_probe,19021894 .config_init = &marvell_config_init,19031903- .config_aneg = &marvell_config_aneg,18951895+ .config_aneg = &m88e1101_config_aneg,19041896 .read_status = &genphy_read_status,19051897 .ack_interrupt = &marvell_ack_interrupt,19061898 .config_intr = &marvell_config_intr,
+25-8
drivers/net/usb/cdc_ether.c
···310310 return -ENODEV;311311 }312312313313- /* Some devices don't initialise properly. In particular314314- * the packet filter is not reset. There are devices that315315- * don't do reset all the way. So the packet filter should316316- * be set to a sane initial value.317317- */318318- usbnet_cdc_update_filter(dev);319319-320313 return 0;321314322315bad_desc:···317324 return -ENODEV;318325}319326EXPORT_SYMBOL_GPL(usbnet_generic_cdc_bind);327327+328328+329329+/* like usbnet_generic_cdc_bind() but handles filter initialization330330+ * correctly331331+ */332332+int usbnet_ether_cdc_bind(struct usbnet *dev, struct usb_interface *intf)333333+{334334+ int rv;335335+336336+ rv = usbnet_generic_cdc_bind(dev, intf);337337+ if (rv < 0)338338+ goto bail_out;339339+340340+ /* Some devices don't initialise properly. In particular341341+ * the packet filter is not reset. There are devices that342342+ * don't do reset all the way. So the packet filter should343343+ * be set to a sane initial value.344344+ */345345+ usbnet_cdc_update_filter(dev);346346+347347+bail_out:348348+ return rv;349349+}350350+EXPORT_SYMBOL_GPL(usbnet_ether_cdc_bind);320351321352void usbnet_cdc_unbind(struct usbnet *dev, struct usb_interface *intf)322353{···434417 BUILD_BUG_ON((sizeof(((struct usbnet *)0)->data)435418 < sizeof(struct cdc_state)));436419437437- status = usbnet_generic_cdc_bind(dev, intf);420420+ status = usbnet_ether_cdc_bind(dev, intf);438421 if (status < 0)439422 return status;440423
+10-3
drivers/net/usb/smsc95xx.c
···681681 if (ret < 0)682682 return ret;683683684684- if (features & NETIF_F_HW_CSUM)684684+ if (features & NETIF_F_IP_CSUM)685685 read_buf |= Tx_COE_EN_;686686 else687687 read_buf &= ~Tx_COE_EN_;···1279127912801280 spin_lock_init(&pdata->mac_cr_lock);1281128112821282+ /* LAN95xx devices do not alter the computed checksum of 0 to 0xffff.12831283+ * RFC 2460, ipv6 UDP calculated checksum yields a result of zero must12841284+ * be changed to 0xffff. RFC 768, ipv4 UDP computed checksum is zero,12851285+ * it is transmitted as all ones. The zero transmitted checksum means12861286+ * transmitter generated no checksum. Hence, enable csum offload only12871287+ * for ipv4 packets.12881288+ */12821289 if (DEFAULT_TX_CSUM_ENABLE)12831283- dev->net->features |= NETIF_F_HW_CSUM;12901290+ dev->net->features |= NETIF_F_IP_CSUM;12841291 if (DEFAULT_RX_CSUM_ENABLE)12851292 dev->net->features |= NETIF_F_RXCSUM;1286129312871287- dev->net->hw_features = NETIF_F_HW_CSUM | NETIF_F_RXCSUM;12941294+ dev->net->hw_features = NETIF_F_IP_CSUM | NETIF_F_RXCSUM;1288129512891296 smsc95xx_init_mac_address(dev);12901297
···263263 c.dbbuf.prp2 = cpu_to_le64(dev->dbbuf_eis_dma_addr);264264265265 if (nvme_submit_sync_cmd(dev->ctrl.admin_q, &c, NULL, 0)) {266266- dev_warn(dev->dev, "unable to set dbbuf\n");266266+ dev_warn(dev->ctrl.device, "unable to set dbbuf\n");267267 /* Free memory and continue on */268268 nvme_dbbuf_dma_free(dev);269269 }···13941394 result = pci_read_config_word(to_pci_dev(dev->dev), PCI_STATUS,13951395 &pci_status);13961396 if (result == PCIBIOS_SUCCESSFUL)13971397- dev_warn(dev->dev,13971397+ dev_warn(dev->ctrl.device,13981398 "controller is down; will reset: CSTS=0x%x, PCI_STATUS=0x%hx\n",13991399 csts, pci_status);14001400 else14011401- dev_warn(dev->dev,14011401+ dev_warn(dev->ctrl.device,14021402 "controller is down; will reset: CSTS=0x%x, PCI_STATUS read failed (%d)\n",14031403 csts, result);14041404}···17401740 */17411741 if (pdev->vendor == PCI_VENDOR_ID_APPLE && pdev->device == 0x2001) {17421742 dev->q_depth = 2;17431743- dev_warn(dev->dev, "detected Apple NVMe controller, set "17441744- "queue depth=%u to work around controller resets\n",17431743+ dev_warn(dev->ctrl.device, "detected Apple NVMe controller, "17441744+ "set queue depth=%u to work around controller resets\n",17451745 dev->q_depth);17461746 }17471747···17591759 if (dev->cmbsz) {17601760 if (sysfs_add_file_to_group(&dev->ctrl.device->kobj,17611761 &dev_attr_cmb.attr, NULL))17621762- dev_warn(dev->dev,17621762+ dev_warn(dev->ctrl.device,17631763 "failed to add sysfs attribute for CMB\n");17641764 }17651765 }···20472047static const struct nvme_ctrl_ops nvme_pci_ctrl_ops = {20482048 .name = "pcie",20492049 .module = THIS_MODULE,20502050+ .flags = NVME_F_METADATA_SUPPORTED,20502051 .reg_read32 = nvme_pci_reg_read32,20512052 .reg_write32 = nvme_pci_reg_write32,20522053 .reg_read64 = nvme_pci_reg_read64,···22942293 { PCI_VDEVICE(INTEL, 0x0a54),22952294 .driver_data = NVME_QUIRK_STRIPE_SIZE |22962295 NVME_QUIRK_DEALLOCATE_ZEROES, },22962296+ { PCI_VDEVICE(INTEL, 0xf1a5), /* Intel 600P/P3100 */22972297+ .driver_data = NVME_QUIRK_NO_DEEPEST_PS },22972298 { PCI_VDEVICE(INTEL, 0x5845), /* Qemu emulated controller */22982299 .driver_data = NVME_QUIRK_IDENTIFY_CNS, },22992300 { PCI_DEVICE(0x1c58, 0x0003), /* HGST adapter */
+15-5
drivers/nvme/host/rdma.c
···10381038 nvme_rdma_wr_error(cq, wc, "SEND");10391039}1040104010411041+static inline int nvme_rdma_queue_sig_limit(struct nvme_rdma_queue *queue)10421042+{10431043+ int sig_limit;10441044+10451045+ /*10461046+ * We signal completion every queue depth/2 and also handle the10471047+ * degenerated case of a device with queue_depth=1, where we10481048+ * would need to signal every message.10491049+ */10501050+ sig_limit = max(queue->queue_size / 2, 1);10511051+ return (++queue->sig_count % sig_limit) == 0;10521052+}10531053+10411054static int nvme_rdma_post_send(struct nvme_rdma_queue *queue,10421055 struct nvme_rdma_qe *qe, struct ib_sge *sge, u32 num_sge,10431056 struct ib_send_wr *first, bool flush)···10781065 * Would have been way to obvious to handle this in hardware or10791066 * at least the RDMA stack..10801067 *10811081- * This messy and racy code sniplet is copy and pasted from the iSER10821082- * initiator, and the magic '32' comes from there as well.10831083- *10841068 * Always signal the flushes. The magic request used for the flush10851069 * sequencer is not allocated in our driver's tagset and it's10861070 * triggered to be freed by blk_cleanup_queue(). So we need to···10851075 * embedded in request's payload, is not freed when __ib_process_cq()10861076 * calls wr_cqe->done().10871077 */10881088- if ((++queue->sig_count % 32) == 0 || flush)10781078+ if (nvme_rdma_queue_sig_limit(queue) || flush)10891079 wr.send_flags |= IB_SEND_SIGNALED;1090108010911081 if (first)···17921782static const struct nvme_ctrl_ops nvme_rdma_ctrl_ops = {17931783 .name = "rdma",17941784 .module = THIS_MODULE,17951795- .is_fabrics = true,17851785+ .flags = NVME_F_FABRICS,17961786 .reg_read32 = nvmf_reg_read32,17971787 .reg_read64 = nvmf_reg_read64,17981788 .reg_write32 = nvmf_reg_write32,
···523523arch_initcall_sync(of_platform_default_populate_init);524524#endif525525526526-static int of_platform_device_destroy(struct device *dev, void *data)526526+int of_platform_device_destroy(struct device *dev, void *data)527527{528528 /* Do not touch devices not populated from the device tree */529529 if (!dev->of_node || !of_node_check_flag(dev->of_node, OF_POPULATED))···544544 of_node_clear_flag(dev->of_node, OF_POPULATED_BUS);545545 return 0;546546}547547+EXPORT_SYMBOL_GPL(of_platform_device_destroy);547548548549/**549550 * of_platform_depopulate() - Remove devices populated from device tree
+30-3
drivers/pci/dwc/pci-imx6.c
···252252static int imx6q_pcie_abort_handler(unsigned long addr,253253 unsigned int fsr, struct pt_regs *regs)254254{255255- return 0;255255+ unsigned long pc = instruction_pointer(regs);256256+ unsigned long instr = *(unsigned long *)pc;257257+ int reg = (instr >> 12) & 15;258258+259259+ /*260260+ * If the instruction being executed was a read,261261+ * make it look like it read all-ones.262262+ */263263+ if ((instr & 0x0c100000) == 0x04100000) {264264+ unsigned long val;265265+266266+ if (instr & 0x00400000)267267+ val = 255;268268+ else269269+ val = -1;270270+271271+ regs->uregs[reg] = val;272272+ regs->ARM_pc += 4;273273+ return 0;274274+ }275275+276276+ if ((instr & 0x0e100090) == 0x00100090) {277277+ regs->uregs[reg] = -1;278278+ regs->ARM_pc += 4;279279+ return 0;280280+ }281281+282282+ return 1;256283}257284258285static void imx6_pcie_assert_core_reset(struct imx6_pcie *imx6_pcie)···846819 * we can install the handler here without risking it847820 * accessing some uninitialized driver state.848821 */849849- hook_fault_code(16 + 6, imx6q_pcie_abort_handler, SIGBUS, 0,850850- "imprecise external abort");822822+ hook_fault_code(8, imx6q_pcie_abort_handler, SIGBUS, 0,823823+ "external abort on non-linefetch");851824852825 return platform_driver_register(&imx6_pcie_driver);853826}
+1
drivers/pci/endpoint/Kconfig
···6677config PCI_ENDPOINT88 bool "PCI Endpoint Support"99+ depends on HAS_DMA910 help1011 Enable this configuration option to support configurable PCI1112 endpoint. This should be enabled if the platform has a PCI
···2929 return -EINVAL;30303131 gsi = gicc->performance_interrupt;3232+3333+ /*3434+ * Per the ACPI spec, the MADT cannot describe a PMU that doesn't3535+ * have an interrupt. QEMU advertises this by using a GSI of zero,3636+ * which is not known to be valid on any hardware despite being3737+ * valid per the spec. Take the pragmatic approach and reject a3838+ * GSI of zero for now.3939+ */4040+ if (!gsi)4141+ return 0;4242+3243 if (gicc->flags & ACPI_MADT_PERFORMANCE_IRQ_MODE)3344 trigger = ACPI_EDGE_SENSITIVE;3445 else
+3-17
drivers/pinctrl/core.c
···680680 * pinctrl_generic_free_groups() - removes all pin groups681681 * @pctldev: pin controller device682682 *683683- * Note that the caller must take care of locking.683683+ * Note that the caller must take care of locking. The pinctrl groups684684+ * are allocated with devm_kzalloc() so no need to free them here.684685 */685686static void pinctrl_generic_free_groups(struct pinctrl_dev *pctldev)686687{687688 struct radix_tree_iter iter;688688- struct group_desc *group;689689- unsigned long *indices;690689 void **slot;691691- int i = 0;692692-693693- indices = devm_kzalloc(pctldev->dev, sizeof(*indices) *694694- pctldev->num_groups, GFP_KERNEL);695695- if (!indices)696696- return;697690698691 radix_tree_for_each_slot(slot, &pctldev->pin_group_tree, &iter, 0)699699- indices[i++] = iter.index;700700-701701- for (i = 0; i < pctldev->num_groups; i++) {702702- group = radix_tree_lookup(&pctldev->pin_group_tree,703703- indices[i]);704704- radix_tree_delete(&pctldev->pin_group_tree, indices[i]);705705- devm_kfree(pctldev->dev, group);706706- }692692+ radix_tree_delete(&pctldev->pin_group_tree, iter.index);707693708694 pctldev->num_groups = 0;709695}
···826826 * pinmux_generic_free_functions() - removes all functions827827 * @pctldev: pin controller device828828 *829829- * Note that the caller must take care of locking.829829+ * Note that the caller must take care of locking. The pinctrl830830+ * functions are allocated with devm_kzalloc() so no need to free831831+ * them here.830832 */831833void pinmux_generic_free_functions(struct pinctrl_dev *pctldev)832834{833835 struct radix_tree_iter iter;834834- struct function_desc *function;835835- unsigned long *indices;836836 void **slot;837837- int i = 0;838838-839839- indices = devm_kzalloc(pctldev->dev, sizeof(*indices) *840840- pctldev->num_functions, GFP_KERNEL);841841- if (!indices)842842- return;843837844838 radix_tree_for_each_slot(slot, &pctldev->pin_function_tree, &iter, 0)845845- indices[i++] = iter.index;846846-847847- for (i = 0; i < pctldev->num_functions; i++) {848848- function = radix_tree_lookup(&pctldev->pin_function_tree,849849- indices[i]);850850- radix_tree_delete(&pctldev->pin_function_tree, indices[i]);851851- devm_kfree(pctldev->dev, function);852852- }839839+ radix_tree_delete(&pctldev->pin_function_tree, iter.index);853840854841 pctldev->num_functions = 0;855842}
···17691769 goto bye;17701770 }1771177117721772- mempool_free(mbp, hw->mb_mempool);17731772 if (finicsum != cfcsum) {17741773 csio_warn(hw,17751774 "Config File checksum mismatch: csum=%#x, computed=%#x\n",···17791780 rv = csio_hw_validate_caps(hw, mbp);17801781 if (rv != 0)17811782 goto bye;17831783+17841784+ mempool_free(mbp, hw->mb_mempool);17851785+ mbp = NULL;17861786+17821787 /*17831788 * Note that we're operating with parameters17841789 * not supplied by the driver, rather than from hard-wired
+23-4
drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c
···11701170 cmd = list_first_entry_or_null(&vscsi->free_cmd,11711171 struct ibmvscsis_cmd, list);11721172 if (cmd) {11731173+ if (cmd->abort_cmd)11741174+ cmd->abort_cmd = NULL;11731175 cmd->flags &= ~(DELAY_SEND);11741176 list_del(&cmd->list);11751177 cmd->iue = iue;···17761774 if (cmd->abort_cmd) {17771775 retry = true;17781776 cmd->abort_cmd->flags &= ~(DELAY_SEND);17771777+ cmd->abort_cmd = NULL;17791778 }1780177917811780 /*···17911788 list_del(&cmd->list);17921789 ibmvscsis_free_cmd_resources(vscsi,17931790 cmd);17911791+ /*17921792+ * With a successfully aborted op17931793+ * through LIO we want to increment the17941794+ * the vscsi credit so that when we dont17951795+ * send a rsp to the original scsi abort17961796+ * op (h_send_crq), but the tm rsp to17971797+ * the abort is sent, the credit is17981798+ * correctly sent with the abort tm rsp.17991799+ * We would need 1 for the abort tm rsp18001800+ * and 1 credit for the aborted scsi op.18011801+ * Thus we need to increment here.18021802+ * Also we want to increment the credit18031803+ * here because we want to make sure18041804+ * cmd is actually released first18051805+ * otherwise the client will think it18061806+ * it can send a new cmd, and we could18071807+ * find ourselves short of cmd elements.18081808+ */18091809+ vscsi->credit += 1;17941810 } else {17951811 iue = cmd->iue;17961812···2984296229852963 rsp->opcode = SRP_RSP;2986296429872987- if (vscsi->credit > 0 && vscsi->state == SRP_PROCESSING)29882988- rsp->req_lim_delta = cpu_to_be32(vscsi->credit);29892989- else29902990- rsp->req_lim_delta = cpu_to_be32(1 + vscsi->credit);29652965+ rsp->req_lim_delta = cpu_to_be32(1 + vscsi->credit);29912966 rsp->tag = cmd->rsp.tag;29922967 rsp->flags = 0;29932968
···9090#define NLP_FCP_INITIATOR 0x10 /* entry is an FCP Initiator */9191#define NLP_NVME_TARGET 0x20 /* entry is a NVME Target */9292#define NLP_NVME_INITIATOR 0x40 /* entry is a NVME Initiator */9393+#define NLP_NVME_DISCOVERY 0x80 /* entry has NVME disc srvc */93949495 uint16_t nlp_fc4_type; /* FC types node supports. */9596 /* Assigned from GID_FF, only
+22-4
drivers/scsi/lpfc/lpfc_els.c
···10471047 irsp->ulpStatus, irsp->un.ulpWord[4],10481048 irsp->ulpTimeout);1049104910501050+10511051+ /* If this is not a loop open failure, bail out */10521052+ if (!(irsp->ulpStatus == IOSTAT_LOCAL_REJECT &&10531053+ ((irsp->un.ulpWord[4] & IOERR_PARAM_MASK) ==10541054+ IOERR_LOOP_OPEN_FAILURE)))10551055+ goto flogifail;10561056+10501057 /* FLOGI failed, so there is no fabric */10511058 spin_lock_irq(shost->host_lock);10521059 vport->fc_flag &= ~(FC_FABRIC | FC_PUBLIC_LOOP);···2084207720852078 if (irsp->ulpStatus) {20862079 /* Check for retry */20802080+ ndlp->fc4_prli_sent--;20872081 if (lpfc_els_retry(phba, cmdiocb, rspiocb)) {20882082 /* ELS command is being retried */20892089- ndlp->fc4_prli_sent--;20902083 goto out;20912084 }20852085+20922086 /* PRLI failed */20932087 lpfc_printf_vlog(vport, KERN_ERR, LOG_ELS,20942094- "2754 PRLI failure DID:%06X Status:x%x/x%x\n",20882088+ "2754 PRLI failure DID:%06X Status:x%x/x%x, "20892089+ "data: x%x\n",20952090 ndlp->nlp_DID, irsp->ulpStatus,20962096- irsp->un.ulpWord[4]);20912091+ irsp->un.ulpWord[4], ndlp->fc4_prli_sent);20922092+20972093 /* Do not call DSM for lpfc_els_abort'ed ELS cmds */20982094 if (lpfc_error_lost_link(irsp))20992095 goto out;···74517441 */74527442 spin_lock_irq(&phba->hbalock);74537443 pring = lpfc_phba_elsring(phba);74447444+74457445+ /* Bail out if we've no ELS wq, like in PCI error recovery case. */74467446+ if (unlikely(!pring)) {74477447+ spin_unlock_irq(&phba->hbalock);74487448+ return;74497449+ }74507450+74547451 if (phba->sli_rev == LPFC_SLI_REV4)74557452 spin_lock(&pring->ring_lock);74567453···86848667 lpfc_do_scr_ns_plogi(phba, vport);86858668 goto out;86868669fdisc_failed:86878687- if (vport->fc_vport->vport_state != FC_VPORT_NO_FABRIC_RSCS)86708670+ if (vport->fc_vport &&86718671+ (vport->fc_vport->vport_state != FC_VPORT_NO_FABRIC_RSCS))86888672 lpfc_vport_set_state(vport, FC_VPORT_FAILED);86898673 /* Cancel discovery timer */86908674 lpfc_can_disctmo(vport);
+5-4
drivers/scsi/lpfc/lpfc_hbadisc.c
···693693 pring = lpfc_phba_elsring(phba);694694 status = (ha_copy & (HA_RXMASK << (4*LPFC_ELS_RING)));695695 status >>= (4*LPFC_ELS_RING);696696- if ((status & HA_RXMASK) ||697697- (pring->flag & LPFC_DEFERRED_RING_EVENT) ||698698- (phba->hba_flag & HBA_SP_QUEUE_EVT)) {696696+ if (pring && (status & HA_RXMASK ||697697+ pring->flag & LPFC_DEFERRED_RING_EVENT ||698698+ phba->hba_flag & HBA_SP_QUEUE_EVT)) {699699 if (pring->flag & LPFC_STOP_IOCB_EVENT) {700700 pring->flag |= LPFC_DEFERRED_RING_EVENT;701701 /* Set the lpfc data pending flag */702702 set_bit(LPFC_DATA_READY, &phba->data_flags);703703 } else {704704- if (phba->link_state >= LPFC_LINK_UP) {704704+ if (phba->link_state >= LPFC_LINK_UP ||705705+ phba->link_flag & LS_MDS_LOOPBACK) {705706 pring->flag &= ~LPFC_DEFERRED_RING_EVENT;706707 lpfc_sli_handle_slow_ring_event(phba, pring,707708 (status &
+15-1
drivers/scsi/lpfc/lpfc_hw4.h
···1356135613571357#define LPFC_HDR_BUF_SIZE 12813581358#define LPFC_DATA_BUF_SIZE 204813591359+#define LPFC_NVMET_DATA_BUF_SIZE 12813591360struct rq_context {13601361 uint32_t word0;13611362#define lpfc_rq_context_rqe_count_SHIFT 16 /* Version 0 Only */···44214420};44224421#define TXRDY_PAYLOAD_LEN 124423442244234423+#define CMD_SEND_FRAME 0xE144244424+44254425+struct send_frame_wqe {44264426+ struct ulp_bde64 bde; /* words 0-2 */44274427+ uint32_t frame_len; /* word 3 */44284428+ uint32_t fc_hdr_wd0; /* word 4 */44294429+ uint32_t fc_hdr_wd1; /* word 5 */44304430+ struct wqe_common wqe_com; /* words 6-11 */44314431+ uint32_t fc_hdr_wd2; /* word 12 */44324432+ uint32_t fc_hdr_wd3; /* word 13 */44334433+ uint32_t fc_hdr_wd4; /* word 14 */44344434+ uint32_t fc_hdr_wd5; /* word 15 */44354435+};4424443644254437union lpfc_wqe {44264438 uint32_t words[16];···44524438 struct fcp_trsp64_wqe fcp_trsp;44534439 struct fcp_tsend64_wqe fcp_tsend;44544440 struct fcp_treceive64_wqe fcp_treceive;44554455-44414441+ struct send_frame_wqe send_frame;44564442};4457444344584444union lpfc_wqe128 {
+39-98
drivers/scsi/lpfc/lpfc_init.c
···1099109911001100 list_for_each_entry_safe(ctxp, ctxp_next, &nvmet_aborts, list) {11011101 ctxp->flag &= ~(LPFC_NVMET_XBUSY | LPFC_NVMET_ABORT_OP);11021102- lpfc_nvmet_rq_post(phba, ctxp, &ctxp->rqb_buffer->hbuf);11021102+ lpfc_nvmet_ctxbuf_post(phba, ctxp->ctxbuf);11031103 }11041104 }11051105···33813381{33823382 struct lpfc_sglq *sglq_entry = NULL, *sglq_entry_next = NULL;33833383 uint16_t i, lxri, xri_cnt, els_xri_cnt;33843384- uint16_t nvmet_xri_cnt, tot_cnt;33843384+ uint16_t nvmet_xri_cnt;33853385 LIST_HEAD(nvmet_sgl_list);33863386 int rc;33873387···33893389 * update on pci function's nvmet xri-sgl list33903390 */33913391 els_xri_cnt = lpfc_sli4_get_els_iocb_cnt(phba);33923392- nvmet_xri_cnt = phba->cfg_nvmet_mrq * phba->cfg_nvmet_mrq_post;33933393- tot_cnt = phba->sli4_hba.max_cfg_param.max_xri - els_xri_cnt;33943394- if (nvmet_xri_cnt > tot_cnt) {33953395- phba->cfg_nvmet_mrq_post = tot_cnt / phba->cfg_nvmet_mrq;33963396- nvmet_xri_cnt = phba->cfg_nvmet_mrq * phba->cfg_nvmet_mrq_post;33973397- lpfc_printf_log(phba, KERN_INFO, LOG_SLI,33983398- "6301 NVMET post-sgl count changed to %d\n",33993399- phba->cfg_nvmet_mrq_post);34003400- }33923392+33933393+ /* For NVMET, ALL remaining XRIs are dedicated for IO processing */33943394+ nvmet_xri_cnt = phba->sli4_hba.max_cfg_param.max_xri - els_xri_cnt;3401339534023396 if (nvmet_xri_cnt > phba->sli4_hba.nvmet_xri_cnt) {34033397 /* els xri-sgl expanded */···45404546 pmb->vport = phba->pport;4541454745424548 if (phba->sli4_hba.link_state.status != LPFC_FC_LA_TYPE_LINK_UP) {45494549+ phba->link_flag &= ~(LS_MDS_LINK_DOWN | LS_MDS_LOOPBACK);45504550+45514551+ switch (phba->sli4_hba.link_state.status) {45524552+ case LPFC_FC_LA_TYPE_MDS_LINK_DOWN:45534553+ phba->link_flag |= LS_MDS_LINK_DOWN;45544554+ break;45554555+ case LPFC_FC_LA_TYPE_MDS_LOOPBACK:45564556+ phba->link_flag |= LS_MDS_LOOPBACK;45574557+ break;45584558+ default:45594559+ break;45604560+ }45614561+45434562 /* Parse and translate status field */45444563 mb = &pmb->u.mb;45454564 mb->mbxStatus = lpfc_sli4_parse_latt_fault(phba,···58375830 spin_lock_init(&phba->sli4_hba.abts_nvme_buf_list_lock);58385831 INIT_LIST_HEAD(&phba->sli4_hba.lpfc_abts_nvme_buf_list);58395832 INIT_LIST_HEAD(&phba->sli4_hba.lpfc_abts_nvmet_ctx_list);58335833+ INIT_LIST_HEAD(&phba->sli4_hba.lpfc_nvmet_ctx_list);58345834+ INIT_LIST_HEAD(&phba->sli4_hba.lpfc_nvmet_io_wait_list);58355835+58405836 /* Fast-path XRI aborted CQ Event work queue list */58415837 INIT_LIST_HEAD(&phba->sli4_hba.sp_nvme_xri_aborted_work_queue);58425838 }···58475837 /* This abort list used by worker thread */58485838 spin_lock_init(&phba->sli4_hba.sgl_list_lock);58495839 spin_lock_init(&phba->sli4_hba.nvmet_io_lock);58405840+ spin_lock_init(&phba->sli4_hba.nvmet_io_wait_lock);5850584158515842 /*58525843 * Initialize driver internal slow-path work queues···59625951 for (i = 0; i < lpfc_enable_nvmet_cnt; i++) {59635952 if (wwn == lpfc_enable_nvmet[i]) {59645953#if (IS_ENABLED(CONFIG_NVME_TARGET_FC))59545954+ if (lpfc_nvmet_mem_alloc(phba))59555955+ break;59565956+59575957+ phba->nvmet_support = 1; /* a match */59585958+59655959 lpfc_printf_log(phba, KERN_ERR, LOG_INIT,59665960 "6017 NVME Target %016llx\n",59675961 wwn);59685968- phba->nvmet_support = 1; /* a match */59695962#else59705963 lpfc_printf_log(phba, KERN_ERR, LOG_INIT,59715964 "6021 Can't enable NVME Target."59725965 " NVME_TARGET_FC infrastructure"59735966 " is not in kernel\n");59745967#endif59685968+ break;59755969 }59765970 }59775971 }···62856269 *62866270 * This routine is invoked to free the driver's IOCB list and memory.62876271 **/62886288-static void62726272+void62896273lpfc_free_iocb_list(struct lpfc_hba *phba)62906274{62916275 struct lpfc_iocbq *iocbq_entry = NULL, *iocbq_next = NULL;···63136297 * 0 - successful63146298 * other values - error63156299 **/63166316-static int63006300+int63176301lpfc_init_iocb_list(struct lpfc_hba *phba, int iocb_count)63186302{63196303 struct lpfc_iocbq *iocbq_entry = NULL;···65416525 uint16_t rpi_limit, curr_rpi_range;65426526 struct lpfc_dmabuf *dmabuf;65436527 struct lpfc_rpi_hdr *rpi_hdr;65446544- uint32_t rpi_count;6545652865466529 /*65476530 * If the SLI4 port supports extents, posting the rpi header isn't···65536538 return NULL;6554653965556540 /* The limit on the logical index is just the max_rpi count. */65566556- rpi_limit = phba->sli4_hba.max_cfg_param.rpi_base +65576557- phba->sli4_hba.max_cfg_param.max_rpi - 1;65416541+ rpi_limit = phba->sli4_hba.max_cfg_param.max_rpi;6558654265596543 spin_lock_irq(&phba->hbalock);65606544 /*···65646550 curr_rpi_range = phba->sli4_hba.next_rpi;65656551 spin_unlock_irq(&phba->hbalock);6566655265676567- /*65686568- * The port has a limited number of rpis. The increment here65696569- * is LPFC_RPI_HDR_COUNT - 1 to account for the starting value65706570- * and to allow the full max_rpi range per port.65716571- */65726572- if ((curr_rpi_range + (LPFC_RPI_HDR_COUNT - 1)) > rpi_limit)65736573- rpi_count = rpi_limit - curr_rpi_range;65746574- else65756575- rpi_count = LPFC_RPI_HDR_COUNT;65766576-65776577- if (!rpi_count)65536553+ /* Reached full RPI range */65546554+ if (curr_rpi_range == rpi_limit)65786555 return NULL;65566556+65796557 /*65806558 * First allocate the protocol header region for the port. The65816559 * port expects a 4KB DMA-mapped memory region that is 4K aligned.···6601659566026596 /* The rpi_hdr stores the logical index only. */66036597 rpi_hdr->start_rpi = curr_rpi_range;65986598+ rpi_hdr->next_rpi = phba->sli4_hba.next_rpi + LPFC_RPI_HDR_COUNT;66046599 list_add_tail(&rpi_hdr->list, &phba->sli4_hba.lpfc_rpi_hdr_list);6605660066066606- /*66076607- * The next_rpi stores the next logical module-64 rpi value used66086608- * to post physical rpis in subsequent rpi postings.66096609- */66106610- phba->sli4_hba.next_rpi += rpi_count;66116601 spin_unlock_irq(&phba->hbalock);66126602 return rpi_hdr;66136603···81748172 /* Create NVMET Receive Queue for header */81758173 qdesc = lpfc_sli4_queue_alloc(phba,81768174 phba->sli4_hba.rq_esize,81778177- phba->sli4_hba.rq_ecount);81758175+ LPFC_NVMET_RQE_DEF_COUNT);81788176 if (!qdesc) {81798177 lpfc_printf_log(phba, KERN_ERR, LOG_INIT,81808178 "3146 Failed allocate "···81968194 /* Create NVMET Receive Queue for data */81978195 qdesc = lpfc_sli4_queue_alloc(phba,81988196 phba->sli4_hba.rq_esize,81998199- phba->sli4_hba.rq_ecount);81978197+ LPFC_NVMET_RQE_DEF_COUNT);82008198 if (!qdesc) {82018199 lpfc_printf_log(phba, KERN_ERR, LOG_INIT,82028200 "3156 Failed allocate "···8325832383268324 /* Everything on this list has been freed */83278325 INIT_LIST_HEAD(&phba->sli4_hba.lpfc_wq_list);83288328-}83298329-83308330-int83318331-lpfc_post_rq_buffer(struct lpfc_hba *phba, struct lpfc_queue *hrq,83328332- struct lpfc_queue *drq, int count)83338333-{83348334- int rc, i;83358335- struct lpfc_rqe hrqe;83368336- struct lpfc_rqe drqe;83378337- struct lpfc_rqb *rqbp;83388338- struct rqb_dmabuf *rqb_buffer;83398339- LIST_HEAD(rqb_buf_list);83408340-83418341- rqbp = hrq->rqbp;83428342- for (i = 0; i < count; i++) {83438343- rqb_buffer = (rqbp->rqb_alloc_buffer)(phba);83448344- if (!rqb_buffer)83458345- break;83468346- rqb_buffer->hrq = hrq;83478347- rqb_buffer->drq = drq;83488348- list_add_tail(&rqb_buffer->hbuf.list, &rqb_buf_list);83498349- }83508350- while (!list_empty(&rqb_buf_list)) {83518351- list_remove_head(&rqb_buf_list, rqb_buffer, struct rqb_dmabuf,83528352- hbuf.list);83538353-83548354- hrqe.address_lo = putPaddrLow(rqb_buffer->hbuf.phys);83558355- hrqe.address_hi = putPaddrHigh(rqb_buffer->hbuf.phys);83568356- drqe.address_lo = putPaddrLow(rqb_buffer->dbuf.phys);83578357- drqe.address_hi = putPaddrHigh(rqb_buffer->dbuf.phys);83588358- rc = lpfc_sli4_rq_put(hrq, drq, &hrqe, &drqe);83598359- if (rc < 0) {83608360- (rqbp->rqb_free_buffer)(phba, rqb_buffer);83618361- } else {83628362- list_add_tail(&rqb_buffer->hbuf.list,83638363- &rqbp->rqb_buffer_list);83648364- rqbp->buffer_count++;83658365- }83668366- }83678367- return 1;83688326}8369832783708328int···87458783 rc = -ENOMEM;87468784 goto out_destroy;87478785 }87488748-87498749- lpfc_rq_adjust_repost(phba, phba->sli4_hba.hdr_rq, LPFC_ELS_HBQ);87508750- lpfc_rq_adjust_repost(phba, phba->sli4_hba.dat_rq, LPFC_ELS_HBQ);8751878687528787 rc = lpfc_rq_create(phba, phba->sli4_hba.hdr_rq, phba->sli4_hba.dat_rq,87538788 phba->sli4_hba.els_cq, LPFC_USOL);···1106911110 struct lpfc_hba *phba;1107011111 struct lpfc_vport *vport = NULL;1107111112 struct Scsi_Host *shost = NULL;1107211072- int error, cnt;1111311113+ int error;1107311114 uint32_t cfg_mode, intr_mode;11074111151107511116 /* Allocate memory for HBA structure */···1110311144 goto out_unset_pci_mem_s4;1110411145 }11105111461110611106- cnt = phba->cfg_iocb_cnt * 1024;1110711107- if (phba->nvmet_support)1110811108- cnt += phba->cfg_nvmet_mrq_post * phba->cfg_nvmet_mrq;1110911109-1111011110- /* Initialize and populate the iocb list per host */1111111111- lpfc_printf_log(phba, KERN_INFO, LOG_INIT,1111211112- "2821 initialize iocb list %d total %d\n",1111311113- phba->cfg_iocb_cnt, cnt);1111411114- error = lpfc_init_iocb_list(phba, cnt);1111511115-1111611116- if (error) {1111711117- lpfc_printf_log(phba, KERN_ERR, LOG_INIT,1111811118- "1413 Failed to initialize iocb list.\n");1111911119- goto out_unset_driver_resource_s4;1112011120- }1112111121-1112211147 INIT_LIST_HEAD(&phba->active_rrq_list);1112311148 INIT_LIST_HEAD(&phba->fcf.fcf_pri_list);1112411149···1111111168 if (error) {1111211169 lpfc_printf_log(phba, KERN_ERR, LOG_INIT,1111311170 "1414 Failed to set up driver resource.\n");1111411114- goto out_free_iocb_list;1117111171+ goto out_unset_driver_resource_s4;1111511172 }11116111731111711174 /* Get the default values for Model Name and Description */···1121111268 lpfc_destroy_shost(phba);1121211269out_unset_driver_resource:1121311270 lpfc_unset_driver_resource_phase2(phba);1121411214-out_free_iocb_list:1121511215- lpfc_free_iocb_list(phba);1121611271out_unset_driver_resource_s4:1121711272 lpfc_sli4_driver_resource_unset(phba);1121811273out_unset_pci_mem_s4:
···7474 struct lpfc_iocbq *);7575static void lpfc_sli4_send_seq_to_ulp(struct lpfc_vport *,7676 struct hbq_dmabuf *);7777+static void lpfc_sli4_handle_mds_loopback(struct lpfc_vport *vport,7878+ struct hbq_dmabuf *dmabuf);7779static int lpfc_sli4_fp_handle_cqe(struct lpfc_hba *, struct lpfc_queue *,7880 struct lpfc_cqe *);7981static int lpfc_sli4_post_sgl_list(struct lpfc_hba *, struct list_head *,···481479 if (unlikely(!hq) || unlikely(!dq))482480 return -ENOMEM;483481 put_index = hq->host_index;484484- temp_hrqe = hq->qe[hq->host_index].rqe;482482+ temp_hrqe = hq->qe[put_index].rqe;485483 temp_drqe = dq->qe[dq->host_index].rqe;486484487485 if (hq->type != LPFC_HRQ || dq->type != LPFC_DRQ)488486 return -EINVAL;489489- if (hq->host_index != dq->host_index)487487+ if (put_index != dq->host_index)490488 return -EINVAL;491489 /* If the host has not yet processed the next entry then we are done */492492- if (((hq->host_index + 1) % hq->entry_count) == hq->hba_index)490490+ if (((put_index + 1) % hq->entry_count) == hq->hba_index)493491 return -EBUSY;494492 lpfc_sli_pcimem_bcopy(hrqe, temp_hrqe, hq->entry_size);495493 lpfc_sli_pcimem_bcopy(drqe, temp_drqe, dq->entry_size);496494497495 /* Update the host index to point to the next slot */498498- hq->host_index = ((hq->host_index + 1) % hq->entry_count);496496+ hq->host_index = ((put_index + 1) % hq->entry_count);499497 dq->host_index = ((dq->host_index + 1) % dq->entry_count);498498+ hq->RQ_buf_posted++;500499501500 /* Ring The Header Receive Queue Doorbell */502501 if (!(hq->host_index % hq->entry_repost)) {···59095906 bf_set(lpfc_mbx_set_feature_mds,59105907 &mbox->u.mqe.un.set_feature, 1);59115908 bf_set(lpfc_mbx_set_feature_mds_deep_loopbk,59125912- &mbox->u.mqe.un.set_feature, 0);59095909+ &mbox->u.mqe.un.set_feature, 1);59135910 mbox->u.mqe.un.set_feature.feature = LPFC_SET_MDS_DIAGS;59145911 mbox->u.mqe.un.set_feature.param_len = 8;59155912 break;···65156512 (phba->hba_flag & HBA_FCOE_MODE) ? "FCoE" : "FC");65166513}6517651465156515+int65166516+lpfc_post_rq_buffer(struct lpfc_hba *phba, struct lpfc_queue *hrq,65176517+ struct lpfc_queue *drq, int count, int idx)65186518+{65196519+ int rc, i;65206520+ struct lpfc_rqe hrqe;65216521+ struct lpfc_rqe drqe;65226522+ struct lpfc_rqb *rqbp;65236523+ struct rqb_dmabuf *rqb_buffer;65246524+ LIST_HEAD(rqb_buf_list);65256525+65266526+ rqbp = hrq->rqbp;65276527+ for (i = 0; i < count; i++) {65286528+ /* IF RQ is already full, don't bother */65296529+ if (rqbp->buffer_count + i >= rqbp->entry_count - 1)65306530+ break;65316531+ rqb_buffer = rqbp->rqb_alloc_buffer(phba);65326532+ if (!rqb_buffer)65336533+ break;65346534+ rqb_buffer->hrq = hrq;65356535+ rqb_buffer->drq = drq;65366536+ rqb_buffer->idx = idx;65376537+ list_add_tail(&rqb_buffer->hbuf.list, &rqb_buf_list);65386538+ }65396539+ while (!list_empty(&rqb_buf_list)) {65406540+ list_remove_head(&rqb_buf_list, rqb_buffer, struct rqb_dmabuf,65416541+ hbuf.list);65426542+65436543+ hrqe.address_lo = putPaddrLow(rqb_buffer->hbuf.phys);65446544+ hrqe.address_hi = putPaddrHigh(rqb_buffer->hbuf.phys);65456545+ drqe.address_lo = putPaddrLow(rqb_buffer->dbuf.phys);65466546+ drqe.address_hi = putPaddrHigh(rqb_buffer->dbuf.phys);65476547+ rc = lpfc_sli4_rq_put(hrq, drq, &hrqe, &drqe);65486548+ if (rc < 0) {65496549+ rqbp->rqb_free_buffer(phba, rqb_buffer);65506550+ } else {65516551+ list_add_tail(&rqb_buffer->hbuf.list,65526552+ &rqbp->rqb_buffer_list);65536553+ rqbp->buffer_count++;65546554+ }65556555+ }65566556+ return 1;65576557+}65586558+65186559/**65196560 * lpfc_sli4_hba_setup - SLI4 device initialization PCI function65206561 * @phba: Pointer to HBA context object.···65716524int65726525lpfc_sli4_hba_setup(struct lpfc_hba *phba)65736526{65746574- int rc, i;65276527+ int rc, i, cnt;65756528 LPFC_MBOXQ_t *mboxq;65766529 struct lpfc_mqe *mqe;65776530 uint8_t *vpd;···69226875 goto out_destroy_queue;69236876 }69246877 phba->sli4_hba.nvmet_xri_cnt = rc;68786878+68796879+ cnt = phba->cfg_iocb_cnt * 1024;68806880+ /* We need 1 iocbq for every SGL, for IO processing */68816881+ cnt += phba->sli4_hba.nvmet_xri_cnt;68826882+ /* Initialize and populate the iocb list per host */68836883+ lpfc_printf_log(phba, KERN_INFO, LOG_INIT,68846884+ "2821 initialize iocb list %d total %d\n",68856885+ phba->cfg_iocb_cnt, cnt);68866886+ rc = lpfc_init_iocb_list(phba, cnt);68876887+ if (rc) {68886888+ lpfc_printf_log(phba, KERN_ERR, LOG_INIT,68896889+ "1413 Failed to init iocb list.\n");68906890+ goto out_destroy_queue;68916891+ }68926892+69256893 lpfc_nvmet_create_targetport(phba);69266894 } else {69276895 /* update host scsi xri-sgl sizes and mappings */···69566894 "and mapping: %d\n", rc);69576895 goto out_destroy_queue;69586896 }68976897+68986898+ cnt = phba->cfg_iocb_cnt * 1024;68996899+ /* Initialize and populate the iocb list per host */69006900+ lpfc_printf_log(phba, KERN_INFO, LOG_INIT,69016901+ "2820 initialize iocb list %d total %d\n",69026902+ phba->cfg_iocb_cnt, cnt);69036903+ rc = lpfc_init_iocb_list(phba, cnt);69046904+ if (rc) {69056905+ lpfc_printf_log(phba, KERN_ERR, LOG_INIT,69066906+ "6301 Failed to init iocb list.\n");69076907+ goto out_destroy_queue;69086908+ }69596909 }6960691069616911 if (phba->nvmet_support && phba->cfg_nvmet_mrq) {69626962-69636912 /* Post initial buffers to all RQs created */69646913 for (i = 0; i < phba->cfg_nvmet_mrq; i++) {69656914 rqbp = phba->sli4_hba.nvmet_mrq_hdr[i]->rqbp;69666915 INIT_LIST_HEAD(&rqbp->rqb_buffer_list);69676916 rqbp->rqb_alloc_buffer = lpfc_sli4_nvmet_alloc;69686917 rqbp->rqb_free_buffer = lpfc_sli4_nvmet_free;69696969- rqbp->entry_count = 256;69186918+ rqbp->entry_count = LPFC_NVMET_RQE_DEF_COUNT;69706919 rqbp->buffer_count = 0;69716971-69726972- /* Divide by 4 and round down to multiple of 16 */69736973- rc = (phba->cfg_nvmet_mrq_post >> 2) & 0xfff8;69746974- phba->sli4_hba.nvmet_mrq_hdr[i]->entry_repost = rc;69756975- phba->sli4_hba.nvmet_mrq_data[i]->entry_repost = rc;6976692069776921 lpfc_post_rq_buffer(69786922 phba, phba->sli4_hba.nvmet_mrq_hdr[i],69796923 phba->sli4_hba.nvmet_mrq_data[i],69806980- phba->cfg_nvmet_mrq_post);69246924+ LPFC_NVMET_RQE_DEF_COUNT, i);69816925 }69826926 }69836927···71507082 /* Unset all the queues set up in this routine when error out */71517083 lpfc_sli4_queue_unset(phba);71527084out_destroy_queue:70857085+ lpfc_free_iocb_list(phba);71537086 lpfc_sli4_queue_destroy(phba);71547087out_stop_timers:71557088 lpfc_stop_hba_timers(phba);···86908621 memset(wqe, 0, sizeof(union lpfc_wqe128));86918622 /* Some of the fields are in the right position already */86928623 memcpy(wqe, &iocbq->iocb, sizeof(union lpfc_wqe));86938693- wqe->generic.wqe_com.word7 = 0; /* The ct field has moved so reset */86948694- wqe->generic.wqe_com.word10 = 0;86248624+ if (iocbq->iocb.ulpCommand != CMD_SEND_FRAME) {86258625+ /* The ct field has moved so reset */86268626+ wqe->generic.wqe_com.word7 = 0;86278627+ wqe->generic.wqe_com.word10 = 0;86288628+ }8695862986968630 abort_tag = (uint32_t) iocbq->iotag;86978631 xritag = iocbq->sli4_xritag;···91889116 }9189911791909118 break;91199119+ case CMD_SEND_FRAME:91209120+ bf_set(wqe_xri_tag, &wqe->generic.wqe_com, xritag);91219121+ bf_set(wqe_reqtag, &wqe->generic.wqe_com, iocbq->iotag);91229122+ return 0;91919123 case CMD_XRI_ABORTED_CX:91929124 case CMD_CREATE_XRI_CR: /* Do we expect to use this? */91939125 case CMD_IOCB_FCP_IBIDIR64_CR: /* bidirectional xfer */···1286412788 struct fc_frame_header *fc_hdr;1286512789 struct lpfc_queue *hrq = phba->sli4_hba.hdr_rq;1286612790 struct lpfc_queue *drq = phba->sli4_hba.dat_rq;1279112791+ struct lpfc_nvmet_tgtport *tgtp;1286712792 struct hbq_dmabuf *dma_buf;1286812793 uint32_t status, rq_id;1286912794 unsigned long iflags;···1288512808 case FC_STATUS_RQ_BUF_LEN_EXCEEDED:1288612809 lpfc_printf_log(phba, KERN_ERR, LOG_SLI,1288712810 "2537 Receive Frame Truncated!!\n");1288812888- hrq->RQ_buf_trunc++;1288912811 case FC_STATUS_RQ_SUCCESS:1289012812 lpfc_sli4_rq_release(hrq, drq);1289112813 spin_lock_irqsave(&phba->hbalock, iflags);···1289512819 goto out;1289612820 }1289712821 hrq->RQ_rcv_buf++;1282212822+ hrq->RQ_buf_posted--;1289812823 memcpy(&dma_buf->cq_event.cqe.rcqe_cmpl, rcqe, sizeof(*rcqe));12899128241290012825 /* If a NVME LS event (type 0x28), treat it as Fast path */···1290912832 spin_unlock_irqrestore(&phba->hbalock, iflags);1291012833 workposted = true;1291112834 break;1291212912- case FC_STATUS_INSUFF_BUF_NEED_BUF:1291312835 case FC_STATUS_INSUFF_BUF_FRM_DISC:1283612836+ if (phba->nvmet_support) {1283712837+ tgtp = phba->targetport->private;1283812838+ lpfc_printf_log(phba, KERN_ERR, LOG_SLI | LOG_NVME,1283912839+ "6402 RQE Error x%x, posted %d err_cnt "1284012840+ "%d: %x %x %x\n",1284112841+ status, hrq->RQ_buf_posted,1284212842+ hrq->RQ_no_posted_buf,1284312843+ atomic_read(&tgtp->rcv_fcp_cmd_in),1284412844+ atomic_read(&tgtp->rcv_fcp_cmd_out),1284512845+ atomic_read(&tgtp->xmt_fcp_release));1284612846+ }1284712847+ /* fallthrough */1284812848+1284912849+ case FC_STATUS_INSUFF_BUF_NEED_BUF:1291412850 hrq->RQ_no_posted_buf++;1291512851 /* Post more buffers if possible */1291612852 spin_lock_irqsave(&phba->hbalock, iflags);···1304112951 while ((cqe = lpfc_sli4_cq_get(cq))) {1304212952 workposted |= lpfc_sli4_sp_handle_mcqe(phba, cqe);1304312953 if (!(++ecount % cq->entry_repost))1304413044- lpfc_sli4_cq_release(cq, LPFC_QUEUE_NOARM);1295412954+ break;1304512955 cq->CQ_mbox++;1304612956 }1304712957 break;···1305512965 workposted |= lpfc_sli4_sp_handle_cqe(phba, cq,1305612966 cqe);1305712967 if (!(++ecount % cq->entry_repost))1305813058- lpfc_sli4_cq_release(cq, LPFC_QUEUE_NOARM);1296812968+ break;1305912969 }13060129701306112971 /* Track the max number of CQEs processed in 1 EQ */···1322513135 struct lpfc_queue *drq;1322613136 struct rqb_dmabuf *dma_buf;1322713137 struct fc_frame_header *fc_hdr;1313813138+ struct lpfc_nvmet_tgtport *tgtp;1322813139 uint32_t status, rq_id;1322913140 unsigned long iflags;1323013141 uint32_t fctl, idx;···1325613165 case FC_STATUS_RQ_BUF_LEN_EXCEEDED:1325713166 lpfc_printf_log(phba, KERN_ERR, LOG_SLI,1325813167 "6126 Receive Frame Truncated!!\n");1325913259- hrq->RQ_buf_trunc++;1326013260- break;1326113168 case FC_STATUS_RQ_SUCCESS:1326213169 lpfc_sli4_rq_release(hrq, drq);1326313170 spin_lock_irqsave(&phba->hbalock, iflags);···1326713178 }1326813179 spin_unlock_irqrestore(&phba->hbalock, iflags);1326913180 hrq->RQ_rcv_buf++;1318113181+ hrq->RQ_buf_posted--;1327013182 fc_hdr = (struct fc_frame_header *)dma_buf->hbuf.virt;13271131831327213184 /* Just some basic sanity checks on FCP Command frame */···1329013200drop:1329113201 lpfc_in_buf_free(phba, &dma_buf->dbuf);1329213202 break;1329313293- case FC_STATUS_INSUFF_BUF_NEED_BUF:1329413203 case FC_STATUS_INSUFF_BUF_FRM_DISC:1320413204+ if (phba->nvmet_support) {1320513205+ tgtp = phba->targetport->private;1320613206+ lpfc_printf_log(phba, KERN_ERR, LOG_SLI | LOG_NVME,1320713207+ "6401 RQE Error x%x, posted %d err_cnt "1320813208+ "%d: %x %x %x\n",1320913209+ status, hrq->RQ_buf_posted,1321013210+ hrq->RQ_no_posted_buf,1321113211+ atomic_read(&tgtp->rcv_fcp_cmd_in),1321213212+ atomic_read(&tgtp->rcv_fcp_cmd_out),1321313213+ atomic_read(&tgtp->xmt_fcp_release));1321413214+ }1321513215+ /* fallthrough */1321613216+1321713217+ case FC_STATUS_INSUFF_BUF_NEED_BUF:1329513218 hrq->RQ_no_posted_buf++;1329613219 /* Post more buffers if possible */1329713297- spin_lock_irqsave(&phba->hbalock, iflags);1329813298- phba->hba_flag |= HBA_POST_RECEIVE_BUFFER;1329913299- spin_unlock_irqrestore(&phba->hbalock, iflags);1330013300- workposted = true;1330113220 break;1330213221 }1330313222out:···1346013361 while ((cqe = lpfc_sli4_cq_get(cq))) {1346113362 workposted |= lpfc_sli4_fp_handle_cqe(phba, cq, cqe);1346213363 if (!(++ecount % cq->entry_repost))1346313463- lpfc_sli4_cq_release(cq, LPFC_QUEUE_NOARM);1336413364+ break;1346413365 }13465133661346613367 /* Track the max number of CQEs processed in 1 EQ */···1355113452 while ((cqe = lpfc_sli4_cq_get(cq))) {1355213453 workposted |= lpfc_sli4_fp_handle_cqe(phba, cq, cqe);1355313454 if (!(++ecount % cq->entry_repost))1355413554- lpfc_sli4_cq_release(cq, LPFC_QUEUE_NOARM);1345513455+ break;1355513456 }13556134571355713458 /* Track the max number of CQEs processed in 1 EQ */···1363313534 while ((eqe = lpfc_sli4_eq_get(eq))) {1363413535 lpfc_sli4_fof_handle_eqe(phba, eqe);1363513536 if (!(++ecount % eq->entry_repost))1363613636- lpfc_sli4_eq_release(eq, LPFC_QUEUE_NOARM);1353713537+ break;1363713538 eq->EQ_processed++;1363813539 }1363913540···13750136511375113652 lpfc_sli4_hba_handle_eqe(phba, eqe, hba_eqidx);1375213653 if (!(++ecount % fpeq->entry_repost))1375313753- lpfc_sli4_eq_release(fpeq, LPFC_QUEUE_NOARM);1365413654+ break;1375413655 fpeq->EQ_processed++;1375513656 }1375613657···1393113832 }1393213833 queue->entry_size = entry_size;1393313834 queue->entry_count = entry_count;1393413934-1393513935- /*1393613936- * entry_repost is calculated based on the number of entries in the1393713937- * queue. This works out except for RQs. If buffers are NOT initially1393813938- * posted for every RQE, entry_repost should be adjusted accordingly.1393913939- */1394013940- queue->entry_repost = (entry_count >> 3);1394113941- if (queue->entry_repost < LPFC_QUEUE_MIN_REPOST)1394213942- queue->entry_repost = LPFC_QUEUE_MIN_REPOST;1394313835 queue->phba = phba;1383613836+1383713837+ /* entry_repost will be set during q creation */13944138381394513839 return queue;1394613840out_fail:···1416514073 status = -ENXIO;1416614074 eq->host_index = 0;1416714075 eq->hba_index = 0;1407614076+ eq->entry_repost = LPFC_EQ_REPOST;14168140771416914078 mempool_free(mbox, phba->mbox_mem_pool);1417014079 return status;···1423914146 default:1424014147 lpfc_printf_log(phba, KERN_ERR, LOG_SLI,1424114148 "0361 Unsupported CQ count: "1424214242- "entry cnt %d sz %d pg cnt %d repost %d\n",1414914149+ "entry cnt %d sz %d pg cnt %d\n",1424314150 cq->entry_count, cq->entry_size,1424414244- cq->page_count, cq->entry_repost);1415114151+ cq->page_count);1424514152 if (cq->entry_count < 256) {1424614153 status = -EINVAL;1424714154 goto out;···1429414201 cq->assoc_qid = eq->queue_id;1429514202 cq->host_index = 0;1429614203 cq->hba_index = 0;1420414204+ cq->entry_repost = LPFC_CQ_REPOST;14297142051429814206out:1429914207 mempool_free(mbox, phba->mbox_mem_pool);···1448614392 cq->assoc_qid = eq->queue_id;1448714393 cq->host_index = 0;1448814394 cq->hba_index = 0;1439514395+ cq->entry_repost = LPFC_CQ_REPOST;14489143961449014397 rc = 0;1449114398 list_for_each_entry(dmabuf, &cq->page_list, list) {···1473514640 mq->subtype = subtype;1473614641 mq->host_index = 0;1473714642 mq->hba_index = 0;1464314643+ mq->entry_repost = LPFC_MQ_REPOST;14738146441473914645 /* link the mq onto the parent cq child list */1474014646 list_add_tail(&mq->list, &cq->child_list);···1496114865}14962148661496314867/**1496414964- * lpfc_rq_adjust_repost - Adjust entry_repost for an RQ1496514965- * @phba: HBA structure that indicates port to create a queue on.1496614966- * @rq: The queue structure to use for the receive queue.1496714967- * @qno: The associated HBQ number1496814968- *1496914969- *1497014970- * For SLI4 we need to adjust the RQ repost value based on1497114971- * the number of buffers that are initially posted to the RQ.1497214972- */1497314973-void1497414974-lpfc_rq_adjust_repost(struct lpfc_hba *phba, struct lpfc_queue *rq, int qno)1497514975-{1497614976- uint32_t cnt;1497714977-1497814978- /* sanity check on queue memory */1497914979- if (!rq)1498014980- return;1498114981- cnt = lpfc_hbq_defs[qno]->entry_count;1498214982-1498314983- /* Recalc repost for RQs based on buffers initially posted */1498414984- cnt = (cnt >> 3);1498514985- if (cnt < LPFC_QUEUE_MIN_REPOST)1498614986- cnt = LPFC_QUEUE_MIN_REPOST;1498714987-1498814988- rq->entry_repost = cnt;1498914989-}1499014990-1499114991-/**1499214868 * lpfc_rq_create - Create a Receive Queue on the HBA1499314869 * @phba: HBA structure that indicates port to create a queue on.1499414870 * @hrq: The queue structure to use to create the header receive queue.···1514515077 hrq->subtype = subtype;1514615078 hrq->host_index = 0;1514715079 hrq->hba_index = 0;1508015080+ hrq->entry_repost = LPFC_RQ_REPOST;15148150811514915082 /* now create the data queue */1515015083 lpfc_sli4_config(phba, mbox, LPFC_MBOX_SUBSYSTEM_FCOE,···1515615087 if (phba->sli4_hba.pc_sli4_params.rqv == LPFC_Q_CREATE_VERSION_1) {1515715088 bf_set(lpfc_rq_context_rqe_count_1,1515815089 &rq_create->u.request.context, hrq->entry_count);1515915159- rq_create->u.request.context.buffer_size = LPFC_DATA_BUF_SIZE;1509015090+ if (subtype == LPFC_NVMET)1509115091+ rq_create->u.request.context.buffer_size =1509215092+ LPFC_NVMET_DATA_BUF_SIZE;1509315093+ else1509415094+ rq_create->u.request.context.buffer_size =1509515095+ LPFC_DATA_BUF_SIZE;1516015096 bf_set(lpfc_rq_context_rqe_size, &rq_create->u.request.context,1516115097 LPFC_RQE_SIZE_8);1516215098 bf_set(lpfc_rq_context_page_size, &rq_create->u.request.context,···1519815124 LPFC_RQ_RING_SIZE_4096);1519915125 break;1520015126 }1520115201- bf_set(lpfc_rq_context_buf_size, &rq_create->u.request.context,1520215202- LPFC_DATA_BUF_SIZE);1512715127+ if (subtype == LPFC_NVMET)1512815128+ bf_set(lpfc_rq_context_buf_size,1512915129+ &rq_create->u.request.context,1513015130+ LPFC_NVMET_DATA_BUF_SIZE);1513115131+ else1513215132+ bf_set(lpfc_rq_context_buf_size,1513315133+ &rq_create->u.request.context,1513415134+ LPFC_DATA_BUF_SIZE);1520315135 }1520415136 bf_set(lpfc_rq_context_cq_id, &rq_create->u.request.context,1520515137 cq->queue_id);···1523815158 drq->subtype = subtype;1523915159 drq->host_index = 0;1524015160 drq->hba_index = 0;1516115161+ drq->entry_repost = LPFC_RQ_REPOST;15241151621524215163 /* link the header and data RQs onto the parent cq child list */1524315164 list_add_tail(&hrq->list, &cq->child_list);···1535115270 cq->queue_id);1535215271 bf_set(lpfc_rq_context_data_size,1535315272 &rq_create->u.request.context,1535415354- LPFC_DATA_BUF_SIZE);1527315273+ LPFC_NVMET_DATA_BUF_SIZE);1535515274 bf_set(lpfc_rq_context_hdr_size,1535615275 &rq_create->u.request.context,1535715276 LPFC_HDR_BUF_SIZE);···1539615315 hrq->subtype = subtype;1539715316 hrq->host_index = 0;1539815317 hrq->hba_index = 0;1531815318+ hrq->entry_repost = LPFC_RQ_REPOST;15399153191540015320 drq->db_format = LPFC_DB_RING_FORMAT;1540115321 drq->db_regaddr = phba->sli4_hba.RQDBregaddr;···1540515323 drq->subtype = subtype;1540615324 drq->host_index = 0;1540715325 drq->hba_index = 0;1532615326+ drq->entry_repost = LPFC_RQ_REPOST;15408153271540915328 list_add_tail(&hrq->list, &cq->child_list);1541015329 list_add_tail(&drq->list, &cq->child_list);···1614616063 struct fc_vft_header *fc_vft_hdr;1614716064 uint32_t *header = (uint32_t *) fc_hdr;16148160651606616066+#define FC_RCTL_MDS_DIAGS 0xF41606716067+1614916068 switch (fc_hdr->fh_r_ctl) {1615016069 case FC_RCTL_DD_UNCAT: /* uncategorized information */1615116070 case FC_RCTL_DD_SOL_DATA: /* solicited data */···1617516090 case FC_RCTL_F_BSY: /* fabric busy to data frame */1617616091 case FC_RCTL_F_BSYL: /* fabric busy to link control frame */1617716092 case FC_RCTL_LCR: /* link credit reset */1609316093+ case FC_RCTL_MDS_DIAGS: /* MDS Diagnostics */1617816094 case FC_RCTL_END: /* end */1617916095 break;1618016096 case FC_RCTL_VFTH: /* Virtual Fabric tagging Header */···1618516099 default:1618616100 goto drop;1618716101 }1610216102+1610316103+#define FC_TYPE_VENDOR_UNIQUE 0xFF1610416104+1618816105 switch (fc_hdr->fh_type) {1618916106 case FC_TYPE_BLS:1619016107 case FC_TYPE_ELS:1619116108 case FC_TYPE_FCP:1619216109 case FC_TYPE_CT:1619316110 case FC_TYPE_NVME:1611116111+ case FC_TYPE_VENDOR_UNIQUE:1619416112 break;1619516113 case FC_TYPE_IP:1619616114 case FC_TYPE_ILS:···1620516115 lpfc_printf_log(phba, KERN_INFO, LOG_ELS,1620616116 "2538 Received frame rctl:%s (x%x), type:%s (x%x), "1620716117 "frame Data:%08x %08x %08x %08x %08x %08x %08x\n",1611816118+ (fc_hdr->fh_r_ctl == FC_RCTL_MDS_DIAGS) ? "MDS Diags" :1620816119 lpfc_rctl_names[fc_hdr->fh_r_ctl], fc_hdr->fh_r_ctl,1620916209- lpfc_type_names[fc_hdr->fh_type], fc_hdr->fh_type,1621016210- be32_to_cpu(header[0]), be32_to_cpu(header[1]),1621116211- be32_to_cpu(header[2]), be32_to_cpu(header[3]),1621216212- be32_to_cpu(header[4]), be32_to_cpu(header[5]),1621316213- be32_to_cpu(header[6]));1612016120+ (fc_hdr->fh_type == FC_TYPE_VENDOR_UNIQUE) ?1612116121+ "Vendor Unique" : lpfc_type_names[fc_hdr->fh_type],1612216122+ fc_hdr->fh_type, be32_to_cpu(header[0]),1612316123+ be32_to_cpu(header[1]), be32_to_cpu(header[2]),1612416124+ be32_to_cpu(header[3]), be32_to_cpu(header[4]),1612516125+ be32_to_cpu(header[5]), be32_to_cpu(header[6]));1621416126 return 0;1621516127drop:1621616128 lpfc_printf_log(phba, KERN_WARNING, LOG_ELS,···1701816926 lpfc_sli_release_iocbq(phba, iocbq);1701916927}17020169281692916929+static void1693016930+lpfc_sli4_mds_loopback_cmpl(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb,1693116931+ struct lpfc_iocbq *rspiocb)1693216932+{1693316933+ struct lpfc_dmabuf *pcmd = cmdiocb->context2;1693416934+1693516935+ if (pcmd && pcmd->virt)1693616936+ pci_pool_free(phba->lpfc_drb_pool, pcmd->virt, pcmd->phys);1693716937+ kfree(pcmd);1693816938+ lpfc_sli_release_iocbq(phba, cmdiocb);1693916939+}1694016940+1694116941+static void1694216942+lpfc_sli4_handle_mds_loopback(struct lpfc_vport *vport,1694316943+ struct hbq_dmabuf *dmabuf)1694416944+{1694516945+ struct fc_frame_header *fc_hdr;1694616946+ struct lpfc_hba *phba = vport->phba;1694716947+ struct lpfc_iocbq *iocbq = NULL;1694816948+ union lpfc_wqe *wqe;1694916949+ struct lpfc_dmabuf *pcmd = NULL;1695016950+ uint32_t frame_len;1695116951+ int rc;1695216952+1695316953+ fc_hdr = (struct fc_frame_header *)dmabuf->hbuf.virt;1695416954+ frame_len = bf_get(lpfc_rcqe_length, &dmabuf->cq_event.cqe.rcqe_cmpl);1695516955+1695616956+ /* Send the received frame back */1695716957+ iocbq = lpfc_sli_get_iocbq(phba);1695816958+ if (!iocbq)1695916959+ goto exit;1696016960+1696116961+ /* Allocate buffer for command payload */1696216962+ pcmd = kmalloc(sizeof(struct lpfc_dmabuf), GFP_KERNEL);1696316963+ if (pcmd)1696416964+ pcmd->virt = pci_pool_alloc(phba->lpfc_drb_pool, GFP_KERNEL,1696516965+ &pcmd->phys);1696616966+ if (!pcmd || !pcmd->virt)1696716967+ goto exit;1696816968+1696916969+ INIT_LIST_HEAD(&pcmd->list);1697016970+1697116971+ /* copyin the payload */1697216972+ memcpy(pcmd->virt, dmabuf->dbuf.virt, frame_len);1697316973+1697416974+ /* fill in BDE's for command */1697516975+ iocbq->iocb.un.xseq64.bdl.addrHigh = putPaddrHigh(pcmd->phys);1697616976+ iocbq->iocb.un.xseq64.bdl.addrLow = putPaddrLow(pcmd->phys);1697716977+ iocbq->iocb.un.xseq64.bdl.bdeFlags = BUFF_TYPE_BDE_64;1697816978+ iocbq->iocb.un.xseq64.bdl.bdeSize = frame_len;1697916979+1698016980+ iocbq->context2 = pcmd;1698116981+ iocbq->vport = vport;1698216982+ iocbq->iocb_flag &= ~LPFC_FIP_ELS_ID_MASK;1698316983+ iocbq->iocb_flag |= LPFC_USE_FCPWQIDX;1698416984+1698516985+ /*1698616986+ * Setup rest of the iocb as though it were a WQE1698716987+ * Build the SEND_FRAME WQE1698816988+ */1698916989+ wqe = (union lpfc_wqe *)&iocbq->iocb;1699016990+1699116991+ wqe->send_frame.frame_len = frame_len;1699216992+ wqe->send_frame.fc_hdr_wd0 = be32_to_cpu(*((uint32_t *)fc_hdr));1699316993+ wqe->send_frame.fc_hdr_wd1 = be32_to_cpu(*((uint32_t *)fc_hdr + 1));1699416994+ wqe->send_frame.fc_hdr_wd2 = be32_to_cpu(*((uint32_t *)fc_hdr + 2));1699516995+ wqe->send_frame.fc_hdr_wd3 = be32_to_cpu(*((uint32_t *)fc_hdr + 3));1699616996+ wqe->send_frame.fc_hdr_wd4 = be32_to_cpu(*((uint32_t *)fc_hdr + 4));1699716997+ wqe->send_frame.fc_hdr_wd5 = be32_to_cpu(*((uint32_t *)fc_hdr + 5));1699816998+1699916999+ iocbq->iocb.ulpCommand = CMD_SEND_FRAME;1700017000+ iocbq->iocb.ulpLe = 1;1700117001+ iocbq->iocb_cmpl = lpfc_sli4_mds_loopback_cmpl;1700217002+ rc = lpfc_sli_issue_iocb(phba, LPFC_ELS_RING, iocbq, 0);1700317003+ if (rc == IOCB_ERROR)1700417004+ goto exit;1700517005+1700617006+ lpfc_in_buf_free(phba, &dmabuf->dbuf);1700717007+ return;1700817008+1700917009+exit:1701017010+ lpfc_printf_log(phba, KERN_WARNING, LOG_SLI,1701117011+ "2023 Unable to process MDS loopback frame\n");1701217012+ if (pcmd && pcmd->virt)1701317013+ pci_pool_free(phba->lpfc_drb_pool, pcmd->virt, pcmd->phys);1701417014+ kfree(pcmd);1701517015+ lpfc_sli_release_iocbq(phba, iocbq);1701617016+ lpfc_in_buf_free(phba, &dmabuf->dbuf);1701717017+}1701817018+1702117019/**1702217020 * lpfc_sli4_handle_received_buffer - Handle received buffers from firmware1702317021 * @phba: Pointer to HBA context object.···1714516963 else1714616964 fcfi = bf_get(lpfc_rcqe_fcf_id,1714716965 &dmabuf->cq_event.cqe.rcqe_cmpl);1696616966+1696716967+ if (fc_hdr->fh_r_ctl == 0xF4 && fc_hdr->fh_type == 0xFF) {1696816968+ vport = phba->pport;1696916969+ /* Handle MDS Loopback frames */1697016970+ lpfc_sli4_handle_mds_loopback(vport, dmabuf);1697116971+ return;1697216972+ }17148169731714916974 /* d_id this frame is directed to */1715016975 did = sli4_did_from_fc_hdr(fc_hdr);···1732617137 "status x%x add_status x%x, mbx status x%x\n",1732717138 shdr_status, shdr_add_status, rc);1732817139 rc = -ENXIO;1714017140+ } else {1714117141+ /*1714217142+ * The next_rpi stores the next logical module-64 rpi value used1714317143+ * to post physical rpis in subsequent rpi postings.1714417144+ */1714517145+ spin_lock_irq(&phba->hbalock);1714617146+ phba->sli4_hba.next_rpi = rpi_page->next_rpi;1714717147+ spin_unlock_irq(&phba->hbalock);1732917148 }1733017149 return rc;1733117150}···18914187171891518718 spin_lock_irqsave(&pring->ring_lock, iflags);1891618719 ctxp = pwqe->context2;1891718917- sglq = ctxp->rqb_buffer->sglq;1872018720+ sglq = ctxp->ctxbuf->sglq;1891818721 if (pwqe->sli4_xritag == NO_XRI) {1891918722 pwqe->sli4_lxritag = sglq->sli4_lxritag;1892018723 pwqe->sli4_xritag = sglq->sli4_xritag;
+13-6
drivers/scsi/lpfc/lpfc_sli4.h
···2424#define LPFC_XRI_EXCH_BUSY_WAIT_TMO 100002525#define LPFC_XRI_EXCH_BUSY_WAIT_T1 102626#define LPFC_XRI_EXCH_BUSY_WAIT_T2 300002727-#define LPFC_RELEASE_NOTIFICATION_INTERVAL 322827#define LPFC_RPI_LOW_WATER_MARK 1029283029#define LPFC_UNREG_FCF 1···154155 uint32_t entry_count; /* Number of entries to support on the queue */155156 uint32_t entry_size; /* Size of each queue entry. */156157 uint32_t entry_repost; /* Count of entries before doorbell is rung */157157-#define LPFC_QUEUE_MIN_REPOST 8158158+#define LPFC_EQ_REPOST 8159159+#define LPFC_MQ_REPOST 8160160+#define LPFC_CQ_REPOST 64161161+#define LPFC_RQ_REPOST 64162162+#define LPFC_RELEASE_NOTIFICATION_INTERVAL 32 /* For WQs */158163 uint32_t queue_id; /* Queue ID assigned by the hardware */159164 uint32_t assoc_qid; /* Queue ID associated with, for CQ/WQ/MQ */160165 uint32_t page_count; /* Number of pages allocated for this queue */···198195/* defines for RQ stats */199196#define RQ_no_posted_buf q_cnt_1200197#define RQ_no_buf_found q_cnt_2201201-#define RQ_buf_trunc q_cnt_3198198+#define RQ_buf_posted q_cnt_3202199#define RQ_rcv_buf q_cnt_4203200204201 uint64_t isr_timestamp;···620617 uint16_t scsi_xri_start;621618 uint16_t els_xri_cnt;622619 uint16_t nvmet_xri_cnt;620620+ uint16_t nvmet_ctx_cnt;621621+ uint16_t nvmet_io_wait_cnt;622622+ uint16_t nvmet_io_wait_total;623623 struct list_head lpfc_els_sgl_list;624624 struct list_head lpfc_abts_els_sgl_list;625625 struct list_head lpfc_nvmet_sgl_list;626626 struct list_head lpfc_abts_nvmet_ctx_list;627627 struct list_head lpfc_abts_scsi_buf_list;628628 struct list_head lpfc_abts_nvme_buf_list;629629+ struct list_head lpfc_nvmet_ctx_list;630630+ struct list_head lpfc_nvmet_io_wait_list;629631 struct lpfc_sglq **lpfc_sglq_active_list;630632 struct list_head lpfc_rpi_hdr_list;631633 unsigned long *rpi_bmask;···662654 spinlock_t abts_scsi_buf_list_lock; /* list of aborted SCSI IOs */663655 spinlock_t sgl_list_lock; /* list of aborted els IOs */664656 spinlock_t nvmet_io_lock;657657+ spinlock_t nvmet_io_wait_lock; /* IOs waiting for ctx resources */665658 uint32_t physical_port;666659667660 /* CPU to vector mapping information */···670661 uint16_t num_online_cpu;671662 uint16_t num_present_cpu;672663 uint16_t curr_disp_cpu;673673-674674- uint16_t nvmet_mrq_post_idx;675664};676665677666enum lpfc_sge_type {···705698 struct lpfc_dmabuf *dmabuf;706699 uint32_t page_count;707700 uint32_t start_rpi;701701+ uint16_t next_rpi;708702};709703710704struct lpfc_rsrc_blks {···770762int lpfc_mrq_create(struct lpfc_hba *phba, struct lpfc_queue **hrqp,771763 struct lpfc_queue **drqp, struct lpfc_queue **cqp,772764 uint32_t subtype);773773-void lpfc_rq_adjust_repost(struct lpfc_hba *, struct lpfc_queue *, int);774765int lpfc_eq_destroy(struct lpfc_hba *, struct lpfc_queue *);775766int lpfc_cq_destroy(struct lpfc_hba *, struct lpfc_queue *);776767int lpfc_mq_destroy(struct lpfc_hba *, struct lpfc_queue *);
+1-1
drivers/scsi/lpfc/lpfc_version.h
···2020 * included with this package. *2121 *******************************************************************/22222323-#define LPFC_DRIVER_VERSION "11.2.0.12"2323+#define LPFC_DRIVER_VERSION "11.2.0.14"2424#define LPFC_DRIVER_NAME "lpfc"25252626/* Used for SLI 2/3 */
+1-1
drivers/scsi/scsi_lib.c
···1851185118521852 /* zero out the cmd, except for the embedded scsi_request */18531853 memset((char *)cmd + sizeof(cmd->req), 0,18541854- sizeof(*cmd) - sizeof(cmd->req));18541854+ sizeof(*cmd) - sizeof(cmd->req) + shost->hostt->cmd_size);1855185518561856 req->special = cmd;18571857
+47-16
drivers/scsi/sd.c
···827827 struct scsi_disk *sdkp = scsi_disk(rq->rq_disk);828828 u64 sector = blk_rq_pos(rq) >> (ilog2(sdp->sector_size) - 9);829829 u32 nr_sectors = blk_rq_sectors(rq) >> (ilog2(sdp->sector_size) - 9);830830+ int ret;830831831832 if (!(rq->cmd_flags & REQ_NOUNMAP)) {832833 switch (sdkp->zeroing_mode) {833834 case SD_ZERO_WS16_UNMAP:834834- return sd_setup_write_same16_cmnd(cmd, true);835835+ ret = sd_setup_write_same16_cmnd(cmd, true);836836+ goto out;835837 case SD_ZERO_WS10_UNMAP:836836- return sd_setup_write_same10_cmnd(cmd, true);838838+ ret = sd_setup_write_same10_cmnd(cmd, true);839839+ goto out;837840 }838841 }839842840843 if (sdp->no_write_same)841844 return BLKPREP_INVALID;845845+842846 if (sdkp->ws16 || sector > 0xffffffff || nr_sectors > 0xffff)843843- return sd_setup_write_same16_cmnd(cmd, false);844844- return sd_setup_write_same10_cmnd(cmd, false);847847+ ret = sd_setup_write_same16_cmnd(cmd, false);848848+ else849849+ ret = sd_setup_write_same10_cmnd(cmd, false);850850+851851+out:852852+ if (sd_is_zoned(sdkp) && ret == BLKPREP_OK)853853+ return sd_zbc_write_lock_zone(cmd);854854+855855+ return ret;845856}846857847858static void sd_config_write_same(struct scsi_disk *sdkp)···959948 rq->__data_len = sdp->sector_size;960949 ret = scsi_init_io(cmd);961950 rq->__data_len = nr_bytes;951951+952952+ if (sd_is_zoned(sdkp) && ret != BLKPREP_OK)953953+ sd_zbc_write_unlock_zone(cmd);954954+962955 return ret;963956}964957···15821567 return retval;15831568}1584156915851585-static int sd_sync_cache(struct scsi_disk *sdkp)15701570+static int sd_sync_cache(struct scsi_disk *sdkp, struct scsi_sense_hdr *sshdr)15861571{15871572 int retries, res;15881573 struct scsi_device *sdp = sdkp->device;15891574 const int timeout = sdp->request_queue->rq_timeout15901575 * SD_FLUSH_TIMEOUT_MULTIPLIER;15911591- struct scsi_sense_hdr sshdr;15761576+ struct scsi_sense_hdr my_sshdr;1592157715931578 if (!scsi_device_online(sdp))15941579 return -ENODEV;15801580+15811581+ /* caller might not be interested in sense, but we need it */15821582+ if (!sshdr)15831583+ sshdr = &my_sshdr;1595158415961585 for (retries = 3; retries > 0; --retries) {15971586 unsigned char cmd[10] = { 0 };···16051586 * Leave the rest of the command zero to indicate16061587 * flush everything.16071588 */16081608- res = scsi_execute(sdp, cmd, DMA_NONE, NULL, 0, NULL, &sshdr,15891589+ res = scsi_execute(sdp, cmd, DMA_NONE, NULL, 0, NULL, sshdr,16091590 timeout, SD_MAX_RETRIES, 0, RQF_PM, NULL);16101591 if (res == 0)16111592 break;···16151596 sd_print_result(sdkp, "Synchronize Cache(10) failed", res);1616159716171598 if (driver_byte(res) & DRIVER_SENSE)16181618- sd_print_sense_hdr(sdkp, &sshdr);15991599+ sd_print_sense_hdr(sdkp, sshdr);16001600+16191601 /* we need to evaluate the error return */16201620- if (scsi_sense_valid(&sshdr) &&16211621- (sshdr.asc == 0x3a || /* medium not present */16221622- sshdr.asc == 0x20)) /* invalid command */16021602+ if (scsi_sense_valid(sshdr) &&16031603+ (sshdr->asc == 0x3a || /* medium not present */16041604+ sshdr->asc == 0x20)) /* invalid command */16231605 /* this is no error here */16241606 return 0;16251607···3464344434653445 if (sdkp->WCE && sdkp->media_present) {34663446 sd_printk(KERN_NOTICE, sdkp, "Synchronizing SCSI cache\n");34673467- sd_sync_cache(sdkp);34473447+ sd_sync_cache(sdkp, NULL);34683448 }3469344934703450 if (system_state != SYSTEM_RESTART && sdkp->device->manage_start_stop) {···34763456static int sd_suspend_common(struct device *dev, bool ignore_stop_errors)34773457{34783458 struct scsi_disk *sdkp = dev_get_drvdata(dev);34593459+ struct scsi_sense_hdr sshdr;34793460 int ret = 0;3480346134813462 if (!sdkp) /* E.g.: runtime suspend following sd_remove() */···3484346334853464 if (sdkp->WCE && sdkp->media_present) {34863465 sd_printk(KERN_NOTICE, sdkp, "Synchronizing SCSI cache\n");34873487- ret = sd_sync_cache(sdkp);34663466+ ret = sd_sync_cache(sdkp, &sshdr);34673467+34883468 if (ret) {34893469 /* ignore OFFLINE device */34903470 if (ret == -ENODEV)34913491- ret = 0;34923492- goto done;34713471+ return 0;34723472+34733473+ if (!scsi_sense_valid(&sshdr) ||34743474+ sshdr.sense_key != ILLEGAL_REQUEST)34753475+ return ret;34763476+34773477+ /*34783478+ * sshdr.sense_key == ILLEGAL_REQUEST means this drive34793479+ * doesn't support sync. There's not much to do and34803480+ * suspend shouldn't fail.34813481+ */34823482+ ret = 0;34933483 }34943484 }34953485···35123480 ret = 0;35133481 }3514348235153515-done:35163483 return ret;35173484}35183485
+3-2
drivers/scsi/sg.c
···20742074 if ((1 == resp->done) && (!resp->sg_io_owned) &&20752075 ((-1 == pack_id) || (resp->header.pack_id == pack_id))) {20762076 resp->done = 2; /* guard against other readers */20772077- break;20772077+ write_unlock_irqrestore(&sfp->rq_list_lock, iflags);20782078+ return resp;20782079 }20792080 }20802081 write_unlock_irqrestore(&sfp->rq_list_lock, iflags);20812081- return resp;20822082+ return NULL;20822083}2083208420842085/* always adds to end of list */
···493493494494static int iscsi_target_do_login(struct iscsi_conn *, struct iscsi_login *);495495496496-static bool iscsi_target_sk_state_check(struct sock *sk)496496+static bool __iscsi_target_sk_check_close(struct sock *sk)497497{498498 if (sk->sk_state == TCP_CLOSE_WAIT || sk->sk_state == TCP_CLOSE) {499499- pr_debug("iscsi_target_sk_state_check: TCP_CLOSE_WAIT|TCP_CLOSE,"499499+ pr_debug("__iscsi_target_sk_check_close: TCP_CLOSE_WAIT|TCP_CLOSE,"500500 "returning FALSE\n");501501- return false;501501+ return true;502502 }503503- return true;503503+ return false;504504+}505505+506506+static bool iscsi_target_sk_check_close(struct iscsi_conn *conn)507507+{508508+ bool state = false;509509+510510+ if (conn->sock) {511511+ struct sock *sk = conn->sock->sk;512512+513513+ read_lock_bh(&sk->sk_callback_lock);514514+ state = (__iscsi_target_sk_check_close(sk) ||515515+ test_bit(LOGIN_FLAGS_CLOSED, &conn->login_flags));516516+ read_unlock_bh(&sk->sk_callback_lock);517517+ }518518+ return state;519519+}520520+521521+static bool iscsi_target_sk_check_flag(struct iscsi_conn *conn, unsigned int flag)522522+{523523+ bool state = false;524524+525525+ if (conn->sock) {526526+ struct sock *sk = conn->sock->sk;527527+528528+ read_lock_bh(&sk->sk_callback_lock);529529+ state = test_bit(flag, &conn->login_flags);530530+ read_unlock_bh(&sk->sk_callback_lock);531531+ }532532+ return state;533533+}534534+535535+static bool iscsi_target_sk_check_and_clear(struct iscsi_conn *conn, unsigned int flag)536536+{537537+ bool state = false;538538+539539+ if (conn->sock) {540540+ struct sock *sk = conn->sock->sk;541541+542542+ write_lock_bh(&sk->sk_callback_lock);543543+ state = (__iscsi_target_sk_check_close(sk) ||544544+ test_bit(LOGIN_FLAGS_CLOSED, &conn->login_flags));545545+ if (!state)546546+ clear_bit(flag, &conn->login_flags);547547+ write_unlock_bh(&sk->sk_callback_lock);548548+ }549549+ return state;504550}505551506552static void iscsi_target_login_drop(struct iscsi_conn *conn, struct iscsi_login *login)···586540587541 pr_debug("entering iscsi_target_do_login_rx, conn: %p, %s:%d\n",588542 conn, current->comm, current->pid);543543+ /*544544+ * If iscsi_target_do_login_rx() has been invoked by ->sk_data_ready()545545+ * before initial PDU processing in iscsi_target_start_negotiation()546546+ * has completed, go ahead and retry until it's cleared.547547+ *548548+ * Otherwise if the TCP connection drops while this is occuring,549549+ * iscsi_target_start_negotiation() will detect the failure, call550550+ * cancel_delayed_work_sync(&conn->login_work), and cleanup the551551+ * remaining iscsi connection resources from iscsi_np process context.552552+ */553553+ if (iscsi_target_sk_check_flag(conn, LOGIN_FLAGS_INITIAL_PDU)) {554554+ schedule_delayed_work(&conn->login_work, msecs_to_jiffies(10));555555+ return;556556+ }589557590558 spin_lock(&tpg->tpg_state_lock);591559 state = (tpg->tpg_state == TPG_STATE_ACTIVE);···607547608548 if (!state) {609549 pr_debug("iscsi_target_do_login_rx: tpg_state != TPG_STATE_ACTIVE\n");610610- iscsi_target_restore_sock_callbacks(conn);611611- iscsi_target_login_drop(conn, login);612612- iscsit_deaccess_np(np, tpg, tpg_np);613613- return;550550+ goto err;614551 }615552616616- if (conn->sock) {617617- struct sock *sk = conn->sock->sk;618618-619619- read_lock_bh(&sk->sk_callback_lock);620620- state = iscsi_target_sk_state_check(sk);621621- read_unlock_bh(&sk->sk_callback_lock);622622-623623- if (!state) {624624- pr_debug("iscsi_target_do_login_rx, TCP state CLOSE\n");625625- iscsi_target_restore_sock_callbacks(conn);626626- iscsi_target_login_drop(conn, login);627627- iscsit_deaccess_np(np, tpg, tpg_np);628628- return;629629- }553553+ if (iscsi_target_sk_check_close(conn)) {554554+ pr_debug("iscsi_target_do_login_rx, TCP state CLOSE\n");555555+ goto err;630556 }631557632558 conn->login_kworker = current;···630584 flush_signals(current);631585 conn->login_kworker = NULL;632586633633- if (rc < 0) {634634- iscsi_target_restore_sock_callbacks(conn);635635- iscsi_target_login_drop(conn, login);636636- iscsit_deaccess_np(np, tpg, tpg_np);637637- return;638638- }587587+ if (rc < 0)588588+ goto err;639589640590 pr_debug("iscsi_target_do_login_rx after rx_login_io, %p, %s:%d\n",641591 conn, current->comm, current->pid);642592643593 rc = iscsi_target_do_login(conn, login);644594 if (rc < 0) {645645- iscsi_target_restore_sock_callbacks(conn);646646- iscsi_target_login_drop(conn, login);647647- iscsit_deaccess_np(np, tpg, tpg_np);595595+ goto err;648596 } else if (!rc) {649649- if (conn->sock) {650650- struct sock *sk = conn->sock->sk;651651-652652- write_lock_bh(&sk->sk_callback_lock);653653- clear_bit(LOGIN_FLAGS_READ_ACTIVE, &conn->login_flags);654654- write_unlock_bh(&sk->sk_callback_lock);655655- }597597+ if (iscsi_target_sk_check_and_clear(conn, LOGIN_FLAGS_READ_ACTIVE))598598+ goto err;656599 } else if (rc == 1) {657600 iscsi_target_nego_release(conn);658601 iscsi_post_login_handler(np, conn, zero_tsih);659602 iscsit_deaccess_np(np, tpg, tpg_np);660603 }604604+ return;605605+606606+err:607607+ iscsi_target_restore_sock_callbacks(conn);608608+ iscsi_target_login_drop(conn, login);609609+ iscsit_deaccess_np(np, tpg, tpg_np);661610}662611663612static void iscsi_target_do_cleanup(struct work_struct *work)···700659 orig_state_change(sk);701660 return;702661 }662662+ state = __iscsi_target_sk_check_close(sk);663663+ pr_debug("__iscsi_target_sk_close_change: state: %d\n", state);664664+703665 if (test_bit(LOGIN_FLAGS_READ_ACTIVE, &conn->login_flags)) {704666 pr_debug("Got LOGIN_FLAGS_READ_ACTIVE=1 sk_state_change"705667 " conn: %p\n", conn);668668+ if (state)669669+ set_bit(LOGIN_FLAGS_CLOSED, &conn->login_flags);706670 write_unlock_bh(&sk->sk_callback_lock);707671 orig_state_change(sk);708672 return;709673 }710710- if (test_and_set_bit(LOGIN_FLAGS_CLOSED, &conn->login_flags)) {674674+ if (test_bit(LOGIN_FLAGS_CLOSED, &conn->login_flags)) {711675 pr_debug("Got LOGIN_FLAGS_CLOSED=1 sk_state_change conn: %p\n",712676 conn);713677 write_unlock_bh(&sk->sk_callback_lock);714678 orig_state_change(sk);715679 return;716680 }717717-718718- state = iscsi_target_sk_state_check(sk);719719- write_unlock_bh(&sk->sk_callback_lock);720720-721721- pr_debug("iscsi_target_sk_state_change: state: %d\n", state);722722-723723- if (!state) {681681+ /*682682+ * If the TCP connection has dropped, go ahead and set LOGIN_FLAGS_CLOSED,683683+ * but only queue conn->login_work -> iscsi_target_do_login_rx()684684+ * processing if LOGIN_FLAGS_INITIAL_PDU has already been cleared.685685+ *686686+ * When iscsi_target_do_login_rx() runs, iscsi_target_sk_check_close()687687+ * will detect the dropped TCP connection from delayed workqueue context.688688+ *689689+ * If LOGIN_FLAGS_INITIAL_PDU is still set, which means the initial690690+ * iscsi_target_start_negotiation() is running, iscsi_target_do_login()691691+ * via iscsi_target_sk_check_close() or iscsi_target_start_negotiation()692692+ * via iscsi_target_sk_check_and_clear() is responsible for detecting the693693+ * dropped TCP connection in iscsi_np process context, and cleaning up694694+ * the remaining iscsi connection resources.695695+ */696696+ if (state) {724697 pr_debug("iscsi_target_sk_state_change got failed state\n");725725- schedule_delayed_work(&conn->login_cleanup_work, 0);698698+ set_bit(LOGIN_FLAGS_CLOSED, &conn->login_flags);699699+ state = test_bit(LOGIN_FLAGS_INITIAL_PDU, &conn->login_flags);700700+ write_unlock_bh(&sk->sk_callback_lock);701701+702702+ orig_state_change(sk);703703+704704+ if (!state)705705+ schedule_delayed_work(&conn->login_work, 0);726706 return;727707 }708708+ write_unlock_bh(&sk->sk_callback_lock);709709+728710 orig_state_change(sk);729711}730712···1010946 if (iscsi_target_handle_csg_one(conn, login) < 0)1011947 return -1;1012948 if (login_rsp->flags & ISCSI_FLAG_LOGIN_TRANSIT) {949949+ /*950950+ * Check to make sure the TCP connection has not951951+ * dropped asynchronously while session reinstatement952952+ * was occuring in this kthread context, before953953+ * transitioning to full feature phase operation.954954+ */955955+ if (iscsi_target_sk_check_close(conn))956956+ return -1;957957+1013958 login->tsih = conn->sess->tsih;1014959 login->login_complete = 1;1015960 iscsi_target_restore_sock_callbacks(conn);···1043970 login_rsp->flags &= ~ISCSI_FLAG_LOGIN_NEXT_STAGE_MASK;1044971 }1045972 break;10461046- }10471047-10481048- if (conn->sock) {10491049- struct sock *sk = conn->sock->sk;10501050- bool state;10511051-10521052- read_lock_bh(&sk->sk_callback_lock);10531053- state = iscsi_target_sk_state_check(sk);10541054- read_unlock_bh(&sk->sk_callback_lock);10551055-10561056- if (!state) {10571057- pr_debug("iscsi_target_do_login() failed state for"10581058- " conn: %p\n", conn);10591059- return -1;10601060- }1061973 }10629741063975 return 0;···1313125513141256 write_lock_bh(&sk->sk_callback_lock);13151257 set_bit(LOGIN_FLAGS_READY, &conn->login_flags);12581258+ set_bit(LOGIN_FLAGS_INITIAL_PDU, &conn->login_flags);13161259 write_unlock_bh(&sk->sk_callback_lock);13171260 }13181318-12611261+ /*12621262+ * If iscsi_target_do_login returns zero to signal more PDU12631263+ * exchanges are required to complete the login, go ahead and12641264+ * clear LOGIN_FLAGS_INITIAL_PDU but only if the TCP connection12651265+ * is still active.12661266+ *12671267+ * Otherwise if TCP connection dropped asynchronously, go ahead12681268+ * and perform connection cleanup now.12691269+ */13191270 ret = iscsi_target_do_login(conn, login);12711271+ if (!ret && iscsi_target_sk_check_and_clear(conn, LOGIN_FLAGS_INITIAL_PDU))12721272+ ret = -1;12731273+13201274 if (ret < 0) {13211275 cancel_delayed_work_sync(&conn->login_work);13221276 cancel_delayed_work_sync(&conn->login_cleanup_work);
+18-5
drivers/target/target_core_transport.c
···11601160 if (cmd->unknown_data_length) {11611161 cmd->data_length = size;11621162 } else if (size != cmd->data_length) {11631163- pr_warn("TARGET_CORE[%s]: Expected Transfer Length:"11631163+ pr_warn_ratelimited("TARGET_CORE[%s]: Expected Transfer Length:"11641164 " %u does not match SCSI CDB Length: %u for SAM Opcode:"11651165 " 0x%02x\n", cmd->se_tfo->get_fabric_name(),11661166 cmd->data_length, size, cmd->t_task_cdb[0]);1167116711681168- if (cmd->data_direction == DMA_TO_DEVICE &&11691169- cmd->se_cmd_flags & SCF_SCSI_DATA_CDB) {11701170- pr_err("Rejecting underflow/overflow WRITE data\n");11711171- return TCM_INVALID_CDB_FIELD;11681168+ if (cmd->data_direction == DMA_TO_DEVICE) {11691169+ if (cmd->se_cmd_flags & SCF_SCSI_DATA_CDB) {11701170+ pr_err_ratelimited("Rejecting underflow/overflow"11711171+ " for WRITE data CDB\n");11721172+ return TCM_INVALID_CDB_FIELD;11731173+ }11741174+ /*11751175+ * Some fabric drivers like iscsi-target still expect to11761176+ * always reject overflow writes. Reject this case until11771177+ * full fabric driver level support for overflow writes11781178+ * is introduced tree-wide.11791179+ */11801180+ if (size > cmd->data_length) {11811181+ pr_err_ratelimited("Rejecting overflow for"11821182+ " WRITE control CDB\n");11831183+ return TCM_INVALID_CDB_FIELD;11841184+ }11721185 }11731186 /*11741187 * Reject READ_* or WRITE_* with overflow/underflow for
···99config BCM_NS_THERMAL1010 tristate "Northstar thermal driver"1111 depends on ARCH_BCM_IPROC || COMPILE_TEST1212+ default y if ARCH_BCM_IPROC1213 help1313- Northstar is a family of SoCs that includes e.g. BCM4708, BCM47081,1414- BCM4709 and BCM47094. It contains DMU (Device Management Unit) block1515- with a thermal sensor that allows checking CPU temperature. This1616- driver provides support for it.1414+ Support for the Northstar and Northstar Plus family of SoCs (e.g.1515+ BCM4708, BCM4709, BCM5301x, BCM95852X, etc). It contains DMU (Device1616+ Management Unit) block with a thermal sensor that allows checking CPU1717+ temperature.
-3
drivers/thermal/qoriq_thermal.c
···195195static int qoriq_tmu_probe(struct platform_device *pdev)196196{197197 int ret;198198- const struct thermal_trip *trip;199198 struct qoriq_tmu_data *data;200199 struct device_node *np = pdev->dev.of_node;201200 u32 site = 0;···241242 "Failed to register thermal zone device %d\n", ret);242243 goto err_tmu;243244 }244244-245245- trip = of_thermal_get_trip_points(data->tz);246245247246 /* Enable monitoring */248247 site |= 0x1 << (15 - data->sensor_id);
+1-1
drivers/thermal/thermal_core.c
···359359 * This may be called from any critical situation to trigger a system shutdown360360 * after a known period of time. By default this is not scheduled.361361 */362362-void thermal_emergency_poweroff(void)362362+static void thermal_emergency_poweroff(void)363363{364364 int poweroff_delay_ms = CONFIG_THERMAL_EMERGENCY_POWEROFF_DELAY_MS;365365 /*
+5-9
drivers/thermal/ti-soc-thermal/ti-bandgap.c
···10101010}1011101110121012/**10131013- * ti_bandgap_set_continous_mode() - One time enabling of continuous mode10131013+ * ti_bandgap_set_continuous_mode() - One time enabling of continuous mode10141014 * @bgp: pointer to struct ti_bandgap10151015 *10161016 * Call this function only if HAS(MODE_CONFIG) is set. As this driver may···12141214 }1215121512161216 bgp = devm_kzalloc(&pdev->dev, sizeof(*bgp), GFP_KERNEL);12171217- if (!bgp) {12181218- dev_err(&pdev->dev, "Unable to allocate mem for driver ref\n");12171217+ if (!bgp)12191218 return ERR_PTR(-ENOMEM);12201220- }1221121912221220 of_id = of_match_device(of_ti_bandgap_match, &pdev->dev);12231221 if (of_id)12241222 bgp->conf = of_id->data;1225122312261224 /* register shadow for context save and restore */12271227- bgp->regval = devm_kzalloc(&pdev->dev, sizeof(*bgp->regval) *12281228- bgp->conf->sensor_count, GFP_KERNEL);12291229- if (!bgp->regval) {12301230- dev_err(&pdev->dev, "Unable to allocate mem for driver ref\n");12251225+ bgp->regval = devm_kcalloc(&pdev->dev, bgp->conf->sensor_count,12261226+ sizeof(*bgp->regval), GFP_KERNEL);12271227+ if (!bgp->regval)12311228 return ERR_PTR(-ENOMEM);12321232- }1233122912341230 i = 0;12351231 do {
+8-9
drivers/tty/ehv_bytechan.c
···764764 ehv_bc_driver = alloc_tty_driver(count);765765 if (!ehv_bc_driver) {766766 ret = -ENOMEM;767767- goto error;767767+ goto err_free_bcs;768768 }769769770770 ehv_bc_driver->driver_name = "ehv-bc";···778778 ret = tty_register_driver(ehv_bc_driver);779779 if (ret) {780780 pr_err("ehv-bc: could not register tty driver (ret=%i)\n", ret);781781- goto error;781781+ goto err_put_tty_driver;782782 }783783784784 ret = platform_driver_register(&ehv_bc_tty_driver);785785 if (ret) {786786 pr_err("ehv-bc: could not register platform driver (ret=%i)\n",787787 ret);788788- goto error;788788+ goto err_deregister_tty_driver;789789 }790790791791 return 0;792792793793-error:794794- if (ehv_bc_driver) {795795- tty_unregister_driver(ehv_bc_driver);796796- put_tty_driver(ehv_bc_driver);797797- }798798-793793+err_deregister_tty_driver:794794+ tty_unregister_driver(ehv_bc_driver);795795+err_put_tty_driver:796796+ put_tty_driver(ehv_bc_driver);797797+err_free_bcs:799798 kfree(bcs);800799801800 return ret;
···21842184 * and DCD (when they are outputs) or enables the respective21852185 * irqs. So set this bit early, i.e. before requesting irqs.21862186 */21872187- writel(UFCR_DCEDTE, sport->port.membase + UFCR);21872187+ reg = readl(sport->port.membase + UFCR);21882188+ if (!(reg & UFCR_DCEDTE))21892189+ writel(reg | UFCR_DCEDTE, sport->port.membase + UFCR);2188219021892191 /*21902192 * Disable UCR3_RI and UCR3_DCD irqs. They are also not···21972195 sport->port.membase + UCR3);2198219621992197 } else {22002200- writel(0, sport->port.membase + UFCR);21982198+ unsigned long ucr3 = UCR3_DSR;21992199+22002200+ reg = readl(sport->port.membase + UFCR);22012201+ if (reg & UFCR_DCEDTE)22022202+ writel(reg & ~UFCR_DCEDTE, sport->port.membase + UFCR);22032203+22042204+ if (!is_imx1_uart(sport))22052205+ ucr3 |= IMX21_UCR3_RXDMUXSEL | UCR3_ADNIMP;22062206+ writel(ucr3, sport->port.membase + UCR3);22012207 }2202220822032209 clk_disable_unprepare(sport->clk_ipg);
+3-3
drivers/tty/serial/serial_core.c
···20832083 mutex_lock(&port->mutex);2084208420852085 tty_dev = device_find_child(uport->dev, &match, serial_match_port);20862086- if (device_may_wakeup(tty_dev)) {20862086+ if (tty_dev && device_may_wakeup(tty_dev)) {20872087 if (!enable_irq_wake(uport->irq))20882088 uport->irq_wake = 1;20892089 put_device(tty_dev);···27822782 * Register the port whether it's detected or not. This allows27832783 * setserial to be used to alter this port's parameters.27842784 */27852785- tty_dev = tty_port_register_device_attr(port, drv->tty_driver,27852785+ tty_dev = tty_port_register_device_attr_serdev(port, drv->tty_driver,27862786 uport->line, uport->dev, port, uport->tty_groups);27872787 if (likely(!IS_ERR(tty_dev))) {27882788 device_set_wakeup_capable(tty_dev, 1);···28452845 /*28462846 * Remove the devices from the tty layer28472847 */28482848- tty_unregister_device(drv->tty_driver, uport->line);28482848+ tty_port_unregister_device(port, drv->tty_driver, uport->line);2849284928502850 tty = tty_port_tty_get(port);28512851 if (tty) {
+70-5
drivers/tty/tty_port.c
···3434 if (!disc)3535 return 0;36363737+ mutex_lock(&tty->atomic_write_lock);3738 ret = tty_ldisc_receive_buf(disc, p, (char *)f, count);3939+ mutex_unlock(&tty->atomic_write_lock);38403941 tty_ldisc_deref(disc);4042···131129 struct device *device, void *drvdata,132130 const struct attribute_group **attr_grp)133131{132132+ tty_port_link_device(port, driver, index);133133+ return tty_register_device_attr(driver, index, device, drvdata,134134+ attr_grp);135135+}136136+EXPORT_SYMBOL_GPL(tty_port_register_device_attr);137137+138138+/**139139+ * tty_port_register_device_attr_serdev - register tty or serdev device140140+ * @port: tty_port of the device141141+ * @driver: tty_driver for this device142142+ * @index: index of the tty143143+ * @device: parent if exists, otherwise NULL144144+ * @drvdata: driver data for the device145145+ * @attr_grp: attribute group for the device146146+ *147147+ * Register a serdev or tty device depending on if the parent device has any148148+ * defined serdev clients or not.149149+ */150150+struct device *tty_port_register_device_attr_serdev(struct tty_port *port,151151+ struct tty_driver *driver, unsigned index,152152+ struct device *device, void *drvdata,153153+ const struct attribute_group **attr_grp)154154+{134155 struct device *dev;135156136157 tty_port_link_device(port, driver, index);137158138159 dev = serdev_tty_port_register(port, device, driver, index);139139- if (PTR_ERR(dev) != -ENODEV)160160+ if (PTR_ERR(dev) != -ENODEV) {140161 /* Skip creating cdev if we registered a serdev device */141162 return dev;163163+ }142164143165 return tty_register_device_attr(driver, index, device, drvdata,144166 attr_grp);145167}146146-EXPORT_SYMBOL_GPL(tty_port_register_device_attr);168168+EXPORT_SYMBOL_GPL(tty_port_register_device_attr_serdev);169169+170170+/**171171+ * tty_port_register_device_serdev - register tty or serdev device172172+ * @port: tty_port of the device173173+ * @driver: tty_driver for this device174174+ * @index: index of the tty175175+ * @device: parent if exists, otherwise NULL176176+ *177177+ * Register a serdev or tty device depending on if the parent device has any178178+ * defined serdev clients or not.179179+ */180180+struct device *tty_port_register_device_serdev(struct tty_port *port,181181+ struct tty_driver *driver, unsigned index,182182+ struct device *device)183183+{184184+ return tty_port_register_device_attr_serdev(port, driver, index,185185+ device, NULL, NULL);186186+}187187+EXPORT_SYMBOL_GPL(tty_port_register_device_serdev);188188+189189+/**190190+ * tty_port_unregister_device - deregister a tty or serdev device191191+ * @port: tty_port of the device192192+ * @driver: tty_driver for this device193193+ * @index: index of the tty194194+ *195195+ * If a tty or serdev device is registered with a call to196196+ * tty_port_register_device_serdev() then this function must be called when197197+ * the device is gone.198198+ */199199+void tty_port_unregister_device(struct tty_port *port,200200+ struct tty_driver *driver, unsigned index)201201+{202202+ int ret;203203+204204+ ret = serdev_tty_port_unregister(port);205205+ if (ret == 0)206206+ return;207207+208208+ tty_unregister_device(driver, index);209209+}210210+EXPORT_SYMBOL_GPL(tty_port_unregister_device);147211148212int tty_port_alloc_xmit_buf(struct tty_port *port)149213{···257189 /* check if last port ref was dropped before tty release */258190 if (WARN_ON(port->itty))259191 return;260260-261261- serdev_tty_port_unregister(port);262262-263192 if (port->xmit_buf)264193 free_page((unsigned long)port->xmit_buf);265194 tty_port_destroy(port);
+5-1
fs/ceph/file.c
···16711671 }1672167216731673 size = i_size_read(inode);16741674- if (!(mode & FALLOC_FL_KEEP_SIZE))16741674+ if (!(mode & FALLOC_FL_KEEP_SIZE)) {16751675 endoff = offset + length;16761676+ ret = inode_newsize_ok(inode, endoff);16771677+ if (ret)16781678+ goto unlock;16791679+ }1676168016771681 if (fi->fmode & CEPH_FILE_MODE_LAZY)16781682 want = CEPH_CAP_FILE_BUFFER | CEPH_CAP_FILE_LAZYIO;
+23
fs/dax.c
···11551155 }1156115611571157 /*11581158+ * It is possible, particularly with mixed reads & writes to private11591159+ * mappings, that we have raced with a PMD fault that overlaps with11601160+ * the PTE we need to set up. If so just return and the fault will be11611161+ * retried.11621162+ */11631163+ if (pmd_trans_huge(*vmf->pmd) || pmd_devmap(*vmf->pmd)) {11641164+ vmf_ret = VM_FAULT_NOPAGE;11651165+ goto unlock_entry;11661166+ }11671167+11681168+ /*11581169 * Note that we don't bother to use iomap_apply here: DAX required11591170 * the file system block size to be equal the page size, which means11601171 * that we never have to deal with more than a single extent here.···14071396 entry = grab_mapping_entry(mapping, pgoff, RADIX_DAX_PMD);14081397 if (IS_ERR(entry))14091398 goto fallback;13991399+14001400+ /*14011401+ * It is possible, particularly with mixed reads & writes to private14021402+ * mappings, that we have raced with a PTE fault that overlaps with14031403+ * the PMD we need to set up. If so just return and the fault will be14041404+ * retried.14051405+ */14061406+ if (!pmd_none(*vmf->pmd) && !pmd_trans_huge(*vmf->pmd) &&14071407+ !pmd_devmap(*vmf->pmd)) {14081408+ result = 0;14091409+ goto unlock_entry;14101410+ }1410141114111412 /*14121413 * Note that we don't use iomap_apply here. We aren't doing I/O, only
···334334 if (!p)335335 return 0;336336 p = xdr_decode_hyper(p, &args->offset);337337+337338 args->count = ntohl(*p++);338338-339339- if (!xdr_argsize_check(rqstp, p))340340- return 0;341341-342339 len = min(args->count, max_blocksize);343340344341 /* set up the kvec */···349352 v++;350353 }351354 args->vlen = v;352352- return 1;355355+ return xdr_argsize_check(rqstp, p);353356}354357355358int···541544 p = decode_fh(p, &args->fh);542545 if (!p)543546 return 0;544544- if (!xdr_argsize_check(rqstp, p))545545- return 0;546547 args->buffer = page_address(*(rqstp->rq_next_page++));547548548548- return 1;549549+ return xdr_argsize_check(rqstp, p);549550}550551551552int···569574 args->verf = p; p += 2;570575 args->dircount = ~0;571576 args->count = ntohl(*p++);572572-573573- if (!xdr_argsize_check(rqstp, p))574574- return 0;575575-576577 args->count = min_t(u32, args->count, PAGE_SIZE);577578 args->buffer = page_address(*(rqstp->rq_next_page++));578579579579- return 1;580580+ return xdr_argsize_check(rqstp, p);580581}581582582583int···590599 args->dircount = ntohl(*p++);591600 args->count = ntohl(*p++);592601593593- if (!xdr_argsize_check(rqstp, p))594594- return 0;595595-596602 len = args->count = min(args->count, max_blocksize);597603 while (len > 0) {598604 struct page *p = *(rqstp->rq_next_page++);···597609 args->buffer = page_address(p);598610 len -= PAGE_SIZE;599611 }600600- return 1;612612+613613+ return xdr_argsize_check(rqstp, p);601614}602615603616int
+6-7
fs/nfsd/nfs4proc.c
···17691769 opdesc->op_get_currentstateid(cstate, &op->u);17701770 op->status = opdesc->op_func(rqstp, cstate, &op->u);1771177117721772+ /* Only from SEQUENCE */17731773+ if (cstate->status == nfserr_replay_cache) {17741774+ dprintk("%s NFS4.1 replay from cache\n", __func__);17751775+ status = op->status;17761776+ goto out;17771777+ }17721778 if (!op->status) {17731779 if (opdesc->op_set_currentstateid)17741780 opdesc->op_set_currentstateid(cstate, &op->u);···17851779 if (need_wrongsec_check(rqstp))17861780 op->status = check_nfsd_access(current_fh->fh_export, rqstp);17871781 }17881788-17891782encode_op:17901790- /* Only from SEQUENCE */17911791- if (cstate->status == nfserr_replay_cache) {17921792- dprintk("%s NFS4.1 replay from cache\n", __func__);17931793- status = op->status;17941794- goto out;17951795- }17961783 if (op->status == nfserr_replay_me) {17971784 op->replay = &cstate->replay_owner->so_replay;17981785 nfsd4_encode_replay(&resp->xdr, op);
+3-10
fs/nfsd/nfsxdr.c
···257257 len = args->count = ntohl(*p++);258258 p++; /* totalcount - unused */259259260260- if (!xdr_argsize_check(rqstp, p))261261- return 0;262262-263260 len = min_t(unsigned int, len, NFSSVC_MAXBLKSIZE_V2);264261265262 /* set up somewhere to store response.···272275 v++;273276 }274277 args->vlen = v;275275- return 1;278278+ return xdr_argsize_check(rqstp, p);276279}277280278281int···362365 p = decode_fh(p, &args->fh);363366 if (!p)364367 return 0;365365- if (!xdr_argsize_check(rqstp, p))366366- return 0;367368 args->buffer = page_address(*(rqstp->rq_next_page++));368369369369- return 1;370370+ return xdr_argsize_check(rqstp, p);370371}371372372373int···402407 args->cookie = ntohl(*p++);403408 args->count = ntohl(*p++);404409 args->count = min_t(u32, args->count, PAGE_SIZE);405405- if (!xdr_argsize_check(rqstp, p))406406- return 0;407410 args->buffer = page_address(*(rqstp->rq_next_page++));408411409409- return 1;412412+ return xdr_argsize_check(rqstp, p);410413}411414412415/*
+1-1
fs/ntfs/namei.c
···159159 PTR_ERR(dent_inode));160160 kfree(name);161161 /* Return the error code. */162162- return (struct dentry *)dent_inode;162162+ return ERR_CAST(dent_inode);163163 }164164 /* It is guaranteed that @name is no longer allocated at this point. */165165 if (MREF_ERR(mref) == -ENOENT) {
···11config OVERLAY_FS22 tristate "Overlay filesystem support"33+ select EXPORTFS34 help45 An overlay filesystem combines two filesystems - an 'upper' filesystem56 and a 'lower' filesystem. When a name exists in both filesystems, the
+17-7
fs/overlayfs/copy_up.c
···300300 return PTR_ERR(fh);301301 }302302303303- err = ovl_do_setxattr(upper, OVL_XATTR_ORIGIN, fh, fh ? fh->len : 0, 0);303303+ /*304304+ * Do not fail when upper doesn't support xattrs.305305+ */306306+ err = ovl_check_setxattr(dentry, upper, OVL_XATTR_ORIGIN, fh,307307+ fh ? fh->len : 0, 0);304308 kfree(fh);305309306310 return err;···346342 if (tmpfile)347343 temp = ovl_do_tmpfile(upperdir, stat->mode);348344 else349349- temp = ovl_lookup_temp(workdir, dentry);350350- err = PTR_ERR(temp);351351- if (IS_ERR(temp))352352- goto out1;353353-345345+ temp = ovl_lookup_temp(workdir);354346 err = 0;355355- if (!tmpfile)347347+ if (IS_ERR(temp)) {348348+ err = PTR_ERR(temp);349349+ temp = NULL;350350+ }351351+352352+ if (!err && !tmpfile)356353 err = ovl_create_real(wdir, temp, &cattr, NULL, true);357354358355 if (new_creds) {···458453459454 ovl_path_upper(parent, &parentpath);460455 upperdir = parentpath.dentry;456456+457457+ /* Mark parent "impure" because it may now contain non-pure upper */458458+ err = ovl_set_impure(parent, upperdir);459459+ if (err)460460+ return err;461461462462 err = vfs_getattr(&parentpath, &pstat,463463 STATX_ATIME | STATX_MTIME, AT_STATX_SYNC_AS_STAT);
+47-14
fs/overlayfs/dir.c
···4141 }4242}43434444-struct dentry *ovl_lookup_temp(struct dentry *workdir, struct dentry *dentry)4444+struct dentry *ovl_lookup_temp(struct dentry *workdir)4545{4646 struct dentry *temp;4747 char name[20];···6868 struct dentry *whiteout;6969 struct inode *wdir = workdir->d_inode;70707171- whiteout = ovl_lookup_temp(workdir, dentry);7171+ whiteout = ovl_lookup_temp(workdir);7272 if (IS_ERR(whiteout))7373 return whiteout;7474···127127 return err;128128}129129130130-static int ovl_set_opaque(struct dentry *dentry, struct dentry *upperdentry)130130+static int ovl_set_opaque_xerr(struct dentry *dentry, struct dentry *upper,131131+ int xerr)131132{132133 int err;133134134134- err = ovl_do_setxattr(upperdentry, OVL_XATTR_OPAQUE, "y", 1, 0);135135+ err = ovl_check_setxattr(dentry, upper, OVL_XATTR_OPAQUE, "y", 1, xerr);135136 if (!err)136137 ovl_dentry_set_opaque(dentry);137138138139 return err;140140+}141141+142142+static int ovl_set_opaque(struct dentry *dentry, struct dentry *upperdentry)143143+{144144+ /*145145+ * Fail with -EIO when trying to create opaque dir and upper doesn't146146+ * support xattrs. ovl_rename() calls ovl_set_opaque_xerr(-EXDEV) to147147+ * return a specific error for noxattr case.148148+ */149149+ return ovl_set_opaque_xerr(dentry, upperdentry, -EIO);139150}140151141152/* Common operations required to be done after creation of file on upper */···171160static bool ovl_type_merge(struct dentry *dentry)172161{173162 return OVL_TYPE_MERGE(ovl_path_type(dentry));163163+}164164+165165+static bool ovl_type_origin(struct dentry *dentry)166166+{167167+ return OVL_TYPE_ORIGIN(ovl_path_type(dentry));174168}175169176170static int ovl_create_upper(struct dentry *dentry, struct inode *inode,···266250 if (upper->d_parent->d_inode != udir)267251 goto out_unlock;268252269269- opaquedir = ovl_lookup_temp(workdir, dentry);253253+ opaquedir = ovl_lookup_temp(workdir);270254 err = PTR_ERR(opaquedir);271255 if (IS_ERR(opaquedir))272256 goto out_unlock;···398382 if (err)399383 goto out;400384401401- newdentry = ovl_lookup_temp(workdir, dentry);385385+ newdentry = ovl_lookup_temp(workdir);402386 err = PTR_ERR(newdentry);403387 if (IS_ERR(newdentry))404388 goto out_unlock;···862846 if (IS_ERR(redirect))863847 return PTR_ERR(redirect);864848865865- err = ovl_do_setxattr(ovl_dentry_upper(dentry), OVL_XATTR_REDIRECT,866866- redirect, strlen(redirect), 0);849849+ err = ovl_check_setxattr(dentry, ovl_dentry_upper(dentry),850850+ OVL_XATTR_REDIRECT,851851+ redirect, strlen(redirect), -EXDEV);867852 if (!err) {868853 spin_lock(&dentry->d_lock);869854 ovl_dentry_set_redirect(dentry, redirect);870855 spin_unlock(&dentry->d_lock);871856 } else {872857 kfree(redirect);873873- if (err == -EOPNOTSUPP)874874- ovl_clear_redirect_dir(dentry->d_sb);875875- else876876- pr_warn_ratelimited("overlay: failed to set redirect (%i)\n", err);858858+ pr_warn_ratelimited("overlay: failed to set redirect (%i)\n", err);877859 /* Fall back to userspace copy-up */878860 err = -EXDEV;879861 }···957943 old_upperdir = ovl_dentry_upper(old->d_parent);958944 new_upperdir = ovl_dentry_upper(new->d_parent);959945946946+ if (!samedir) {947947+ /*948948+ * When moving a merge dir or non-dir with copy up origin into949949+ * a new parent, we are marking the new parent dir "impure".950950+ * When ovl_iterate() iterates an "impure" upper dir, it will951951+ * lookup the origin inodes of the entries to fill d_ino.952952+ */953953+ if (ovl_type_origin(old)) {954954+ err = ovl_set_impure(new->d_parent, new_upperdir);955955+ if (err)956956+ goto out_revert_creds;957957+ }958958+ if (!overwrite && ovl_type_origin(new)) {959959+ err = ovl_set_impure(old->d_parent, old_upperdir);960960+ if (err)961961+ goto out_revert_creds;962962+ }963963+ }964964+960965 trap = lock_rename(new_upperdir, old_upperdir);961966962967 olddentry = lookup_one_len(old->d_name.name, old_upperdir,···1025992 if (ovl_type_merge_or_lower(old))1026993 err = ovl_set_redirect(old, samedir);1027994 else if (!old_opaque && ovl_type_merge(new->d_parent))10281028- err = ovl_set_opaque(old, olddentry);995995+ err = ovl_set_opaque_xerr(old, olddentry, -EXDEV);1029996 if (err)1030997 goto out_dput;1031998 }···10331000 if (ovl_type_merge_or_lower(new))10341001 err = ovl_set_redirect(new, samedir);10351002 else if (!new_opaque && ovl_type_merge(old->d_parent))10361036- err = ovl_set_opaque(new, newdentry);10031003+ err = ovl_set_opaque_xerr(new, newdentry, -EXDEV);10371004 if (err)10381005 goto out_dput;10391006 }
+11-1
fs/overlayfs/inode.c
···240240 return res;241241}242242243243+static bool ovl_can_list(const char *s)244244+{245245+ /* List all non-trusted xatts */246246+ if (strncmp(s, XATTR_TRUSTED_PREFIX, XATTR_TRUSTED_PREFIX_LEN) != 0)247247+ return true;248248+249249+ /* Never list trusted.overlay, list other trusted for superuser only */250250+ return !ovl_is_private_xattr(s) && capable(CAP_SYS_ADMIN);251251+}252252+243253ssize_t ovl_listxattr(struct dentry *dentry, char *list, size_t size)244254{245255 struct dentry *realdentry = ovl_dentry_real(dentry);···273263 return -EIO;274264275265 len -= slen;276276- if (ovl_is_private_xattr(s)) {266266+ if (!ovl_can_list(s)) {277267 res -= slen;278268 memmove(s, s + slen, len);279269 } else {
···43954395 xfs_btree_readahead_ptr(cur, ptr, 1);4396439643974397 /* save for the next iteration of the loop */43984398- lptr = *ptr;43984398+ xfs_btree_copy_ptrs(cur, &lptr, ptr, 1);43994399 }4400440044014401 /* for each buffer in the level */
+31-12
fs/xfs/libxfs/xfs_refcount.c
···16291629 if (mp->m_sb.sb_agblocks >= XFS_REFC_COW_START)16301630 return -EOPNOTSUPP;1631163116321632- error = xfs_alloc_read_agf(mp, NULL, agno, 0, &agbp);16321632+ INIT_LIST_HEAD(&debris);16331633+16341634+ /*16351635+ * In this first part, we use an empty transaction to gather up16361636+ * all the leftover CoW extents so that we can subsequently16371637+ * delete them. The empty transaction is used to avoid16381638+ * a buffer lock deadlock if there happens to be a loop in the16391639+ * refcountbt because we're allowed to re-grab a buffer that is16401640+ * already attached to our transaction. When we're done16411641+ * recording the CoW debris we cancel the (empty) transaction16421642+ * and everything goes away cleanly.16431643+ */16441644+ error = xfs_trans_alloc_empty(mp, &tp);16331645 if (error)16341646 return error;16351635- cur = xfs_refcountbt_init_cursor(mp, NULL, agbp, agno, NULL);16471647+16481648+ error = xfs_alloc_read_agf(mp, tp, agno, 0, &agbp);16491649+ if (error)16501650+ goto out_trans;16511651+ cur = xfs_refcountbt_init_cursor(mp, tp, agbp, agno, NULL);1636165216371653 /* Find all the leftover CoW staging extents. */16381638- INIT_LIST_HEAD(&debris);16391654 memset(&low, 0, sizeof(low));16401655 memset(&high, 0, sizeof(high));16411656 low.rc.rc_startblock = XFS_REFC_COW_START;···16601645 if (error)16611646 goto out_cursor;16621647 xfs_btree_del_cursor(cur, XFS_BTREE_NOERROR);16631663- xfs_buf_relse(agbp);16481648+ xfs_trans_brelse(tp, agbp);16491649+ xfs_trans_cancel(tp);1664165016651651 /* Now iterate the list to free the leftovers */16661666- list_for_each_entry(rr, &debris, rr_list) {16521652+ list_for_each_entry_safe(rr, n, &debris, rr_list) {16671653 /* Set up transaction. */16681654 error = xfs_trans_alloc(mp, &M_RES(mp)->tr_write, 0, 0, 0, &tp);16691655 if (error)···16921676 error = xfs_trans_commit(tp);16931677 if (error)16941678 goto out_free;16791679+16801680+ list_del(&rr->rr_list);16811681+ kmem_free(rr);16951682 }1696168316841684+ return error;16851685+out_defer:16861686+ xfs_defer_cancel(&dfops);16871687+out_trans:16881688+ xfs_trans_cancel(tp);16971689out_free:16981690 /* Free the leftover list */16991691 list_for_each_entry_safe(rr, n, &debris, rr_list) {···1712168817131689out_cursor:17141690 xfs_btree_del_cursor(cur, XFS_BTREE_ERROR);17151715- xfs_buf_relse(agbp);17161716- goto out_free;17171717-17181718-out_defer:17191719- xfs_defer_cancel(&dfops);17201720- xfs_trans_cancel(tp);17211721- goto out_free;16911691+ xfs_trans_brelse(tp, agbp);16921692+ goto out_trans;17221693}
+7-3
fs/xfs/xfs_bmap_util.c
···582582 }583583 break;584584 default:585585+ /* Local format data forks report no extents. */586586+ if (ip->i_d.di_format == XFS_DINODE_FMT_LOCAL) {587587+ bmv->bmv_entries = 0;588588+ return 0;589589+ }585590 if (ip->i_d.di_format != XFS_DINODE_FMT_EXTENTS &&586586- ip->i_d.di_format != XFS_DINODE_FMT_BTREE &&587587- ip->i_d.di_format != XFS_DINODE_FMT_LOCAL)591591+ ip->i_d.di_format != XFS_DINODE_FMT_BTREE)588592 return -EINVAL;589593590594 if (xfs_get_extsz_hint(ip) ||···716712 * extents.717713 */718714 if (map[i].br_startblock == DELAYSTARTBLOCK &&719719- map[i].br_startoff <= XFS_B_TO_FSB(mp, XFS_ISIZE(ip)))715715+ map[i].br_startoff < XFS_B_TO_FSB(mp, XFS_ISIZE(ip)))720716 ASSERT((iflags & BMV_IF_DELALLOC) != 0);721717722718 if (map[i].br_startblock == HOLESTARTBLOCK &&
+26-12
fs/xfs/xfs_buf.c
···9797xfs_buf_ioacct_inc(9898 struct xfs_buf *bp)9999{100100- if (bp->b_flags & (XBF_NO_IOACCT|_XBF_IN_FLIGHT))100100+ if (bp->b_flags & XBF_NO_IOACCT)101101 return;102102103103 ASSERT(bp->b_flags & XBF_ASYNC);104104- bp->b_flags |= _XBF_IN_FLIGHT;105105- percpu_counter_inc(&bp->b_target->bt_io_count);104104+ spin_lock(&bp->b_lock);105105+ if (!(bp->b_state & XFS_BSTATE_IN_FLIGHT)) {106106+ bp->b_state |= XFS_BSTATE_IN_FLIGHT;107107+ percpu_counter_inc(&bp->b_target->bt_io_count);108108+ }109109+ spin_unlock(&bp->b_lock);106110}107111108112/*···114110 * freed and unaccount from the buftarg.115111 */116112static inline void113113+__xfs_buf_ioacct_dec(114114+ struct xfs_buf *bp)115115+{116116+ ASSERT(spin_is_locked(&bp->b_lock));117117+118118+ if (bp->b_state & XFS_BSTATE_IN_FLIGHT) {119119+ bp->b_state &= ~XFS_BSTATE_IN_FLIGHT;120120+ percpu_counter_dec(&bp->b_target->bt_io_count);121121+ }122122+}123123+124124+static inline void117125xfs_buf_ioacct_dec(118126 struct xfs_buf *bp)119127{120120- if (!(bp->b_flags & _XBF_IN_FLIGHT))121121- return;122122-123123- bp->b_flags &= ~_XBF_IN_FLIGHT;124124- percpu_counter_dec(&bp->b_target->bt_io_count);128128+ spin_lock(&bp->b_lock);129129+ __xfs_buf_ioacct_dec(bp);130130+ spin_unlock(&bp->b_lock);125131}126132127133/*···163149 * unaccounted (released to LRU) before that occurs. Drop in-flight164150 * status now to preserve accounting consistency.165151 */166166- xfs_buf_ioacct_dec(bp);167167-168152 spin_lock(&bp->b_lock);153153+ __xfs_buf_ioacct_dec(bp);154154+169155 atomic_set(&bp->b_lru_ref, 0);170156 if (!(bp->b_state & XFS_BSTATE_DISPOSE) &&171157 (list_lru_del(&bp->b_target->bt_lru, &bp->b_lru)))···993979 * ensures the decrement occurs only once per-buf.994980 */995981 if ((atomic_read(&bp->b_hold) == 1) && !list_empty(&bp->b_lru))996996- xfs_buf_ioacct_dec(bp);982982+ __xfs_buf_ioacct_dec(bp);997983 goto out_unlock;998984 }9999851000986 /* the last reference has been dropped ... */10011001- xfs_buf_ioacct_dec(bp);987987+ __xfs_buf_ioacct_dec(bp);1002988 if (!(bp->b_flags & XBF_STALE) && atomic_read(&bp->b_lru_ref)) {1003989 /*1004990 * If the buffer is added to the LRU take a new reference to the
+2-3
fs/xfs/xfs_buf.h
···6363#define _XBF_KMEM (1 << 21)/* backed by heap memory */6464#define _XBF_DELWRI_Q (1 << 22)/* buffer on a delwri queue */6565#define _XBF_COMPOUND (1 << 23)/* compound buffer */6666-#define _XBF_IN_FLIGHT (1 << 25) /* I/O in flight, for accounting purposes */67666867typedef unsigned int xfs_buf_flags_t;6968···8384 { _XBF_PAGES, "PAGES" }, \8485 { _XBF_KMEM, "KMEM" }, \8586 { _XBF_DELWRI_Q, "DELWRI_Q" }, \8686- { _XBF_COMPOUND, "COMPOUND" }, \8787- { _XBF_IN_FLIGHT, "IN_FLIGHT" }8787+ { _XBF_COMPOUND, "COMPOUND" }888889899090/*9191 * Internal state flags.9292 */9393#define XFS_BSTATE_DISPOSE (1 << 0) /* buffer being discarded */9494+#define XFS_BSTATE_IN_FLIGHT (1 << 1) /* I/O in flight */94959596/*9697 * The xfs_buftarg contains 2 notions of "sector size" -
+19-52
fs/xfs/xfs_file.c
···1043104310441044 index = startoff >> PAGE_SHIFT;10451045 endoff = XFS_FSB_TO_B(mp, map->br_startoff + map->br_blockcount);10461046- end = endoff >> PAGE_SHIFT;10461046+ end = (endoff - 1) >> PAGE_SHIFT;10471047 do {10481048 int want;10491049 unsigned nr_pages;10501050 unsigned int i;1051105110521052- want = min_t(pgoff_t, end - index, PAGEVEC_SIZE);10521052+ want = min_t(pgoff_t, end - index, PAGEVEC_SIZE - 1) + 1;10531053 nr_pages = pagevec_lookup(&pvec, inode->i_mapping, index,10541054 want);10551055- /*10561056- * No page mapped into given range. If we are searching holes10571057- * and if this is the first time we got into the loop, it means10581058- * that the given offset is landed in a hole, return it.10591059- *10601060- * If we have already stepped through some block buffers to find10611061- * holes but they all contains data. In this case, the last10621062- * offset is already updated and pointed to the end of the last10631063- * mapped page, if it does not reach the endpoint to search,10641064- * that means there should be a hole between them.10651065- */10661066- if (nr_pages == 0) {10671067- /* Data search found nothing */10681068- if (type == DATA_OFF)10691069- break;10701070-10711071- ASSERT(type == HOLE_OFF);10721072- if (lastoff == startoff || lastoff < endoff) {10731073- found = true;10741074- *offset = lastoff;10751075- }10551055+ if (nr_pages == 0)10761056 break;10771077- }10781078-10791079- /*10801080- * At lease we found one page. If this is the first time we10811081- * step into the loop, and if the first page index offset is10821082- * greater than the given search offset, a hole was found.10831083- */10841084- if (type == HOLE_OFF && lastoff == startoff &&10851085- lastoff < page_offset(pvec.pages[0])) {10861086- found = true;10871087- break;10881088- }1089105710901058 for (i = 0; i < nr_pages; i++) {10911059 struct page *page = pvec.pages[i];···10661098 * file mapping. However, page->index will not change10671099 * because we have a reference on the page.10681100 *10691069- * Searching done if the page index is out of range.10701070- * If the current offset is not reaches the end of10711071- * the specified search range, there should be a hole10721072- * between them.11011101+ * If current page offset is beyond where we've ended,11021102+ * we've found a hole.10731103 */10741074- if (page->index > end) {10751075- if (type == HOLE_OFF && lastoff < endoff) {10761076- *offset = lastoff;10771077- found = true;10781078- }11041104+ if (type == HOLE_OFF && lastoff < endoff &&11051105+ lastoff < page_offset(pvec.pages[i])) {11061106+ found = true;11071107+ *offset = lastoff;10791108 goto out;10801109 }11101110+ /* Searching done if the page index is out of range. */11111111+ if (page->index > end)11121112+ goto out;1081111310821114 lock_page(page);10831115 /*···1119115111201152 /*11211153 * The number of returned pages less than our desired, search11221122- * done. In this case, nothing was found for searching data,11231123- * but we found a hole behind the last offset.11541154+ * done.11241155 */11251125- if (nr_pages < want) {11261126- if (type == HOLE_OFF) {11271127- *offset = lastoff;11281128- found = true;11291129- }11561156+ if (nr_pages < want)11301157 break;11311131- }1132115811331159 index = pvec.pages[i - 1]->index + 1;11341160 pagevec_release(&pvec);11351161 } while (index <= end);1136116211631163+ /* No page at lastoff and we are not done - we found a hole. */11641164+ if (type == HOLE_OFF && lastoff < endoff) {11651165+ *offset = lastoff;11661166+ found = true;11671167+ }11371168out:11381169 pagevec_release(&pvec);11391170 return found;
+4-1
fs/xfs/xfs_fsmap.c
···828828 struct xfs_fsmap dkeys[2]; /* per-dev keys */829829 struct xfs_getfsmap_dev handlers[XFS_GETFSMAP_DEVS];830830 struct xfs_getfsmap_info info = { NULL };831831+ bool use_rmap;831832 int i;832833 int error = 0;833834···838837 !xfs_getfsmap_is_valid_device(mp, &head->fmh_keys[1]))839838 return -EINVAL;840839840840+ use_rmap = capable(CAP_SYS_ADMIN) &&841841+ xfs_sb_version_hasrmapbt(&mp->m_sb);841842 head->fmh_entries = 0;842843843844 /* Set up our device handlers. */844845 memset(handlers, 0, sizeof(handlers));845846 handlers[0].dev = new_encode_dev(mp->m_ddev_targp->bt_dev);846846- if (xfs_sb_version_hasrmapbt(&mp->m_sb))847847+ if (use_rmap)847848 handlers[0].fn = xfs_getfsmap_datadev_rmapbt;848849 else849850 handlers[0].fn = xfs_getfsmap_datadev_bnobt;
+51
include/drm/drm_dp_helper.h
···913913int drm_dp_start_crc(struct drm_dp_aux *aux, struct drm_crtc *crtc);914914int drm_dp_stop_crc(struct drm_dp_aux *aux);915915916916+struct drm_dp_dpcd_ident {917917+ u8 oui[3];918918+ u8 device_id[6];919919+ u8 hw_rev;920920+ u8 sw_major_rev;921921+ u8 sw_minor_rev;922922+} __packed;923923+924924+/**925925+ * struct drm_dp_desc - DP branch/sink device descriptor926926+ * @ident: DP device identification from DPCD 0x400 (sink) or 0x500 (branch).927927+ * @quirks: Quirks; use drm_dp_has_quirk() to query for the quirks.928928+ */929929+struct drm_dp_desc {930930+ struct drm_dp_dpcd_ident ident;931931+ u32 quirks;932932+};933933+934934+int drm_dp_read_desc(struct drm_dp_aux *aux, struct drm_dp_desc *desc,935935+ bool is_branch);936936+937937+/**938938+ * enum drm_dp_quirk - Display Port sink/branch device specific quirks939939+ *940940+ * Display Port sink and branch devices in the wild have a variety of bugs, try941941+ * to collect them here. The quirks are shared, but it's up to the drivers to942942+ * implement workarounds for them.943943+ */944944+enum drm_dp_quirk {945945+ /**946946+ * @DP_DPCD_QUIRK_LIMITED_M_N:947947+ *948948+ * The device requires main link attributes Mvid and Nvid to be limited949949+ * to 16 bits.950950+ */951951+ DP_DPCD_QUIRK_LIMITED_M_N,952952+};953953+954954+/**955955+ * drm_dp_has_quirk() - does the DP device have a specific quirk956956+ * @desc: Device decriptor filled by drm_dp_read_desc()957957+ * @quirk: Quirk to query for958958+ *959959+ * Return true if DP device identified by @desc has @quirk.960960+ */961961+static inline bool962962+drm_dp_has_quirk(const struct drm_dp_desc *desc, enum drm_dp_quirk quirk)963963+{964964+ return desc->quirks & BIT(quirk);965965+}966966+916967#endif /* _DRM_DP_HELPER_H_ */
···614614static inline netdev_features_t vlan_features_check(const struct sk_buff *skb,615615 netdev_features_t features)616616{617617- if (skb_vlan_tagged_multi(skb))618618- features = netdev_intersect_features(features,619619- NETIF_F_SG |620620- NETIF_F_HIGHDMA |621621- NETIF_F_FRAGLIST |622622- NETIF_F_HW_CSUM |623623- NETIF_F_HW_VLAN_CTAG_TX |624624- NETIF_F_HW_VLAN_STAG_TX);617617+ if (skb_vlan_tagged_multi(skb)) {618618+ /* In the case of multi-tagged packets, use a direct mask619619+ * instead of using netdev_interesect_features(), to make620620+ * sure that only devices supporting NETIF_F_HW_CSUM will621621+ * have checksum offloading support.622622+ */623623+ features &= NETIF_F_SG | NETIF_F_HIGHDMA | NETIF_F_HW_CSUM |624624+ NETIF_F_FRAGLIST | NETIF_F_HW_VLAN_CTAG_TX |625625+ NETIF_F_HW_VLAN_STAG_TX;626626+ }625627626628 return features;627629}
+5-1
include/linux/jiffies.h
···6464/* TICK_USEC is the time between ticks in usec assuming fake USER_HZ */6565#define TICK_USEC ((1000000UL + USER_HZ/2) / USER_HZ)66666767+#ifndef __jiffy_arch_data6868+#define __jiffy_arch_data6969+#endif7070+6771/*6872 * The 64-bit value is not atomic - you MUST NOT read it6973 * without sampling the sequence number in jiffies_lock.7074 * get_jiffies_64() will do this for you as appropriate.7175 */7276extern u64 __cacheline_aligned_in_smp jiffies_64;7373-extern unsigned long volatile __cacheline_aligned_in_smp jiffies;7777+extern unsigned long volatile __cacheline_aligned_in_smp __jiffy_arch_data jiffies;74787579#if (BITS_PER_LONG < 64)7680u64 get_jiffies_64(void);
···23272327#define FOLL_REMOTE 0x2000 /* we are working on non-current tsk/mm */23282328#define FOLL_COW 0x4000 /* internal GUP flag */2329232923302330+static inline int vm_fault_to_errno(int vm_fault, int foll_flags)23312331+{23322332+ if (vm_fault & VM_FAULT_OOM)23332333+ return -ENOMEM;23342334+ if (vm_fault & (VM_FAULT_HWPOISON | VM_FAULT_HWPOISON_LARGE))23352335+ return (foll_flags & FOLL_HWPOISON) ? -EHWPOISON : -EFAULT;23362336+ if (vm_fault & (VM_FAULT_SIGBUS | VM_FAULT_SIGSEGV))23372337+ return -EFAULT;23382338+ return 0;23392339+}23402340+23302341typedef int (*pte_fn_t)(pte_t *pte, pgtable_t token, unsigned long addr,23312342 void *data);23322343extern int apply_to_page_range(struct mm_struct *mm, unsigned long address,
+1
include/linux/mmzone.h
···678678 * is the first PFN that needs to be initialised.679679 */680680 unsigned long first_deferred_pfn;681681+ unsigned long static_init_size;681682#endif /* CONFIG_DEFERRED_STRUCT_PAGE_INIT */682683683684#ifdef CONFIG_TRANSPARENT_HUGEPAGE
···183183 PCI_DEV_FLAGS_BRIDGE_XLATE_ROOT = (__force pci_dev_flags_t) (1 << 9),184184 /* Do not use FLR even if device advertises PCI_AF_CAP */185185 PCI_DEV_FLAGS_NO_FLR_RESET = (__force pci_dev_flags_t) (1 << 10),186186+ /*187187+ * Resume before calling the driver's system suspend hooks, disabling188188+ * the direct_complete optimization.189189+ */190190+ PCI_DEV_FLAGS_NEEDS_RESUME = (__force pci_dev_flags_t) (1 << 11),186191};187192188193enum pci_irq_reroute_variant {···13471342 unsigned int max_vecs, unsigned int flags,13481343 const struct irq_affinity *aff_desc)13491344{13501350- if (min_vecs > 1)13511351- return -EINVAL;13521352- return 1;13451345+ if ((flags & PCI_IRQ_LEGACY) && min_vecs == 1 && dev->irq)13461346+ return 1;13471347+ return -ENOSPC;13531348}1354134913551350static inline void pci_free_irq_vectors(struct pci_dev *dev)
-3
include/linux/pinctrl/pinconf-generic.h
···4242 * @PIN_CONFIG_BIAS_PULL_UP: the pin will be pulled up (usually with high4343 * impedance to VDD). If the argument is != 0 pull-up is enabled,4444 * if it is 0, pull-up is total, i.e. the pin is connected to VDD.4545- * @PIN_CONFIG_BIDIRECTIONAL: the pin will be configured to allow simultaneous4646- * input and output operations.4745 * @PIN_CONFIG_DRIVE_OPEN_DRAIN: the pin will be driven with open drain (open4846 * collector) which means it is usually wired with other output ports4947 * which are then pulled up with an external resistor. Setting this···9698 PIN_CONFIG_BIAS_PULL_DOWN,9799 PIN_CONFIG_BIAS_PULL_PIN_DEFAULT,98100 PIN_CONFIG_BIAS_PULL_UP,9999- PIN_CONFIG_BIDIRECTIONAL,100101 PIN_CONFIG_DRIVE_OPEN_DRAIN,101102 PIN_CONFIG_DRIVE_OPEN_SOURCE,102103 PIN_CONFIG_DRIVE_PUSH_PULL,
···463463 BPF_REG_0, BPF_REG_1, BPF_REG_2, BPF_REG_3, BPF_REG_4, BPF_REG_5464464};465465466466+static void mark_reg_not_init(struct bpf_reg_state *regs, u32 regno)467467+{468468+ BUG_ON(regno >= MAX_BPF_REG);469469+470470+ memset(®s[regno], 0, sizeof(regs[regno]));471471+ regs[regno].type = NOT_INIT;472472+ regs[regno].min_value = BPF_REGISTER_MIN_RANGE;473473+ regs[regno].max_value = BPF_REGISTER_MAX_RANGE;474474+}475475+466476static void init_reg_state(struct bpf_reg_state *regs)467477{468478 int i;469479470470- for (i = 0; i < MAX_BPF_REG; i++) {471471- regs[i].type = NOT_INIT;472472- regs[i].imm = 0;473473- regs[i].min_value = BPF_REGISTER_MIN_RANGE;474474- regs[i].max_value = BPF_REGISTER_MAX_RANGE;475475- regs[i].min_align = 0;476476- regs[i].aux_off = 0;477477- regs[i].aux_off_align = 0;478478- }480480+ for (i = 0; i < MAX_BPF_REG; i++)481481+ mark_reg_not_init(regs, i);479482480483 /* frame pointer */481484 regs[BPF_REG_FP].type = FRAME_PTR;···811808 reg_off += reg->aux_off;812809 }813810814814- /* skb->data is NET_IP_ALIGN-ed, but for strict alignment checking815815- * we force this to 2 which is universally what architectures use816816- * when they don't set CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS.811811+ /* For platforms that do not have a Kconfig enabling812812+ * CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS the value of813813+ * NET_IP_ALIGN is universally set to '2'. And on platforms814814+ * that do set CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS, we get815815+ * to this code only in strict mode where we want to emulate816816+ * the NET_IP_ALIGN==2 checking. Therefore use an817817+ * unconditional IP align value of '2'.817818 */818818- ip_align = strict ? 2 : NET_IP_ALIGN;819819+ ip_align = 2;819820 if ((ip_align + reg_off + off) % size != 0) {820821 verbose("misaligned packet access off %d+%d+%d size %d\n",821822 ip_align, reg_off, off, size);···845838 int off, int size)846839{847840 bool strict = env->strict_alignment;848848-849849- if (!IS_ENABLED(CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS))850850- strict = true;851841852842 switch (reg->type) {853843 case PTR_TO_PACKET:···13491345 struct bpf_verifier_state *state = &env->cur_state;13501346 const struct bpf_func_proto *fn = NULL;13511347 struct bpf_reg_state *regs = state->regs;13521352- struct bpf_reg_state *reg;13531348 struct bpf_call_arg_meta meta;13541349 bool changes_data;13551350 int i, err;···14151412 }1416141314171414 /* reset caller saved regs */14181418- for (i = 0; i < CALLER_SAVED_REGS; i++) {14191419- reg = regs + caller_saved[i];14201420- reg->type = NOT_INIT;14211421- reg->imm = 0;14221422- }14151415+ for (i = 0; i < CALLER_SAVED_REGS; i++)14161416+ mark_reg_not_init(regs, caller_saved[i]);1423141714241418 /* update return register */14251419 if (fn->ret_type == RET_INTEGER) {···24442444{24452445 struct bpf_reg_state *regs = env->cur_state.regs;24462446 u8 mode = BPF_MODE(insn->code);24472447- struct bpf_reg_state *reg;24482447 int i, err;2449244824502449 if (!may_access_skb(env->prog->type)) {···24762477 }2477247824782479 /* reset caller saved regs to unreadable */24792479- for (i = 0; i < CALLER_SAVED_REGS; i++) {24802480- reg = regs + caller_saved[i];24812481- reg->type = NOT_INIT;24822482- reg->imm = 0;24832483- }24802480+ for (i = 0; i < CALLER_SAVED_REGS; i++)24812481+ mark_reg_not_init(regs, caller_saved[i]);2484248224852483 /* mark destination R0 register as readable, since it contains24862484 * the value fetched from the packet···26882692/* the following conditions reduce the number of explored insns26892693 * from ~140k to ~80k for ultra large programs that use a lot of ptr_to_packet26902694 */26912691-static bool compare_ptrs_to_packet(struct bpf_reg_state *old,26952695+static bool compare_ptrs_to_packet(struct bpf_verifier_env *env,26962696+ struct bpf_reg_state *old,26922697 struct bpf_reg_state *cur)26932698{26942699 if (old->id != cur->id)···27322735 * 'if (R4 > data_end)' and all further insn were already good with r=20,27332736 * so they will be good with r=30 and we can prune the search.27342737 */27352735- if (old->off <= cur->off &&27382738+ if (!env->strict_alignment && old->off <= cur->off &&27362739 old->off >= old->range && cur->off >= cur->range)27372740 return true;27382741···28032806 continue;2804280728052808 if (rold->type == PTR_TO_PACKET && rcur->type == PTR_TO_PACKET &&28062806- compare_ptrs_to_packet(rold, rcur))28092809+ compare_ptrs_to_packet(env, rold, rcur))28072810 continue;2808281128092812 return false;···35813584 } else {35823585 log_level = 0;35833586 }35843584- if (attr->prog_flags & BPF_F_STRICT_ALIGNMENT)35873587+35883588+ env->strict_alignment = !!(attr->prog_flags & BPF_F_STRICT_ALIGNMENT);35893589+ if (!IS_ENABLED(CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS))35853590 env->strict_alignment = true;35863586- else35873587- env->strict_alignment = false;3588359135893592 ret = replace_map_fd_with_map_ptr(env);35903593 if (ret < 0)···36903693 mutex_lock(&bpf_verifier_lock);3691369436923695 log_level = 0;36963696+36933697 env->strict_alignment = false;36983698+ if (!IS_ENABLED(CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS))36993699+ env->strict_alignment = true;3694370036953701 env->explored_states = kcalloc(env->prog->len,36963702 sizeof(struct bpf_verifier_state_list *),
+12-5
kernel/fork.c
···15771577 if (!p)15781578 goto fork_out;1579157915801580+ /*15811581+ * This _must_ happen before we call free_task(), i.e. before we jump15821582+ * to any of the bad_fork_* labels. This is to avoid freeing15831583+ * p->set_child_tid which is (ab)used as a kthread's data pointer for15841584+ * kernel threads (PF_KTHREAD).15851585+ */15861586+ p->set_child_tid = (clone_flags & CLONE_CHILD_SETTID) ? child_tidptr : NULL;15871587+ /*15881588+ * Clear TID on mm_release()?15891589+ */15901590+ p->clear_child_tid = (clone_flags & CLONE_CHILD_CLEARTID) ? child_tidptr : NULL;15911591+15801592 ftrace_graph_init_task(p);1581159315821594 rt_mutex_init_task(p);···17551743 }17561744 }1757174517581758- p->set_child_tid = (clone_flags & CLONE_CHILD_SETTID) ? child_tidptr : NULL;17591759- /*17601760- * Clear TID on mm_release()?17611761- */17621762- p->clear_child_tid = (clone_flags & CLONE_CHILD_CLEARTID) ? child_tidptr : NULL;17631746#ifdef CONFIG_BLOCK17641747 p->plug = NULL;17651748#endif
···1010 depends on SYSFS1111 depends on KALLSYMS_ALL1212 depends on HAVE_LIVEPATCH1313+ depends on !TRIM_UNUSED_KSYMS1314 help1415 Say Y here if you want to support kernel live patching.1516 This option has no runtime impact until a kernel "patch"
+18-6
kernel/locking/rtmutex.c
···17851785 int ret;1786178617871787 raw_spin_lock_irq(&lock->wait_lock);17881788-17891789- set_current_state(TASK_INTERRUPTIBLE);17901790-17911788 /* sleep on the mutex */17891789+ set_current_state(TASK_INTERRUPTIBLE);17921790 ret = __rt_mutex_slowlock(lock, TASK_INTERRUPTIBLE, to, waiter);17931793-17911791+ /*17921792+ * try_to_take_rt_mutex() sets the waiter bit unconditionally. We might17931793+ * have to fix that up.17941794+ */17951795+ fixup_rt_mutex_waiters(lock);17941796 raw_spin_unlock_irq(&lock->wait_lock);1795179717961798 return ret;···1824182218251823 raw_spin_lock_irq(&lock->wait_lock);18261824 /*18251825+ * Do an unconditional try-lock, this deals with the lock stealing18261826+ * state where __rt_mutex_futex_unlock() -> mark_wakeup_next_waiter()18271827+ * sets a NULL owner.18281828+ *18291829+ * We're not interested in the return value, because the subsequent18301830+ * test on rt_mutex_owner() will infer that. If the trylock succeeded,18311831+ * we will own the lock and it will have removed the waiter. If we18321832+ * failed the trylock, we're still not owner and we need to remove18331833+ * ourselves.18341834+ */18351835+ try_to_take_rt_mutex(lock, current, waiter);18361836+ /*18271837 * Unless we're the owner; we're still enqueued on the wait_list.18281838 * So check if we became owner, if not, take us off the wait_list.18291839 */18301840 if (rt_mutex_owner(lock) != current) {18311841 remove_waiter(lock, waiter);18321832- fixup_rt_mutex_waiters(lock);18331842 cleanup = true;18341843 }18351835-18361844 /*18371845 * try_to_take_rt_mutex() sets the waiter bit unconditionally. We might18381846 * have to fix that up.
+1-1
kernel/power/snapshot.c
···14251425 * Numbers of normal and highmem page frames allocated for hibernation image14261426 * before suspending devices.14271427 */14281428-unsigned int alloc_normal, alloc_highmem;14281428+static unsigned int alloc_normal, alloc_highmem;14291429/*14301430 * Memory bitmap used for marking saveable pages (during hibernation) or14311431 * hibernation image pages (during restore)
+13-7
kernel/ptrace.c
···6060}616162626363+void __ptrace_link(struct task_struct *child, struct task_struct *new_parent,6464+ const struct cred *ptracer_cred)6565+{6666+ BUG_ON(!list_empty(&child->ptrace_entry));6767+ list_add(&child->ptrace_entry, &new_parent->ptraced);6868+ child->parent = new_parent;6969+ child->ptracer_cred = get_cred(ptracer_cred);7070+}7171+6372/*6473 * ptrace a task: make the debugger its new parent and6574 * move it to the ptrace list.6675 *6776 * Must be called with the tasklist lock write-held.6877 */6969-void __ptrace_link(struct task_struct *child, struct task_struct *new_parent)7878+static void ptrace_link(struct task_struct *child, struct task_struct *new_parent)7079{7171- BUG_ON(!list_empty(&child->ptrace_entry));7272- list_add(&child->ptrace_entry, &new_parent->ptraced);7373- child->parent = new_parent;7480 rcu_read_lock();7575- child->ptracer_cred = get_cred(__task_cred(new_parent));8181+ __ptrace_link(child, new_parent, __task_cred(new_parent));7682 rcu_read_unlock();7783}7884···392386 flags |= PT_SEIZED;393387 task->ptrace = flags;394388395395- __ptrace_link(task, current);389389+ ptrace_link(task, current);396390397391 /* SEIZE doesn't trap tracee on attach */398392 if (!seize)···465459 */466460 if (!ret && !(current->real_parent->flags & PF_EXITING)) {467461 current->ptrace = PT_PTRACED;468468- __ptrace_link(current, current->real_parent);462462+ ptrace_link(current, current->real_parent);469463 }470464 }471465 write_unlock_irq(&tasklist_lock);
+3-4
kernel/sched/cpufreq_schedutil.c
···245245 sugov_update_commit(sg_policy, time, next_f);246246}247247248248-static unsigned int sugov_next_freq_shared(struct sugov_cpu *sg_cpu)248248+static unsigned int sugov_next_freq_shared(struct sugov_cpu *sg_cpu, u64 time)249249{250250 struct sugov_policy *sg_policy = sg_cpu->sg_policy;251251 struct cpufreq_policy *policy = sg_policy->policy;252252- u64 last_freq_update_time = sg_policy->last_freq_update_time;253252 unsigned long util = 0, max = 1;254253 unsigned int j;255254···264265 * enough, don't take the CPU into account as it probably is265266 * idle now (and clear iowait_boost for it).266267 */267267- delta_ns = last_freq_update_time - j_sg_cpu->last_update;268268+ delta_ns = time - j_sg_cpu->last_update;268269 if (delta_ns > TICK_NSEC) {269270 j_sg_cpu->iowait_boost = 0;270271 continue;···308309 if (flags & SCHED_CPUFREQ_RT_DL)309310 next_f = sg_policy->policy->cpuinfo.max_freq;310311 else311311- next_f = sugov_next_freq_shared(sg_cpu);312312+ next_f = sugov_next_freq_shared(sg_cpu, time);312313313314 sugov_update_commit(sg_policy, time, next_f);314315 }
+11-3
kernel/time/alarmtimer.c
···357357{358358 struct alarm_base *base = &alarm_bases[alarm->type];359359360360- start = ktime_add(start, base->gettime());360360+ start = ktime_add_safe(start, base->gettime());361361 alarm_start(alarm, start);362362}363363EXPORT_SYMBOL_GPL(alarm_start_relative);···445445 overrun++;446446 }447447448448- alarm->node.expires = ktime_add(alarm->node.expires, interval);448448+ alarm->node.expires = ktime_add_safe(alarm->node.expires, interval);449449 return overrun;450450}451451EXPORT_SYMBOL_GPL(alarm_forward);···662662663663 /* start the timer */664664 timr->it.alarm.interval = timespec64_to_ktime(new_setting->it_interval);665665+666666+ /*667667+ * Rate limit to the tick as a hot fix to prevent DOS. Will be668668+ * mopped up later.669669+ */670670+ if (timr->it.alarm.interval < TICK_NSEC)671671+ timr->it.alarm.interval = TICK_NSEC;672672+665673 exp = timespec64_to_ktime(new_setting->it_value);666674 /* Convert (if necessary) to absolute time */667675 if (flags != TIMER_ABSTIME) {668676 ktime_t now;669677670678 now = alarm_bases[timr->it.alarm.alarmtimer.type].gettime();671671- exp = ktime_add(now, exp);679679+ exp = ktime_add_safe(now, exp);672680 }673681674682 alarm_start(&timr->it.alarm.alarmtimer, exp);
+16-8
kernel/time/posix-cpu-timers.c
···825825 * At the hard limit, we just die.826826 * No need to calculate anything else now.827827 */828828- pr_info("CPU Watchdog Timeout (hard): %s[%d]\n",829829- tsk->comm, task_pid_nr(tsk));828828+ if (print_fatal_signals) {829829+ pr_info("CPU Watchdog Timeout (hard): %s[%d]\n",830830+ tsk->comm, task_pid_nr(tsk));831831+ }830832 __group_send_sig_info(SIGKILL, SEND_SIG_PRIV, tsk);831833 return;832834 }···840838 soft += USEC_PER_SEC;841839 sig->rlim[RLIMIT_RTTIME].rlim_cur = soft;842840 }843843- pr_info("RT Watchdog Timeout (soft): %s[%d]\n",844844- tsk->comm, task_pid_nr(tsk));841841+ if (print_fatal_signals) {842842+ pr_info("RT Watchdog Timeout (soft): %s[%d]\n",843843+ tsk->comm, task_pid_nr(tsk));844844+ }845845 __group_send_sig_info(SIGXCPU, SEND_SIG_PRIV, tsk);846846 }847847 }···940936 * At the hard limit, we just die.941937 * No need to calculate anything else now.942938 */943943- pr_info("RT Watchdog Timeout (hard): %s[%d]\n",944944- tsk->comm, task_pid_nr(tsk));939939+ if (print_fatal_signals) {940940+ pr_info("RT Watchdog Timeout (hard): %s[%d]\n",941941+ tsk->comm, task_pid_nr(tsk));942942+ }945943 __group_send_sig_info(SIGKILL, SEND_SIG_PRIV, tsk);946944 return;947945 }···951945 /*952946 * At the soft limit, send a SIGXCPU every second.953947 */954954- pr_info("CPU Watchdog Timeout (soft): %s[%d]\n",955955- tsk->comm, task_pid_nr(tsk));948948+ if (print_fatal_signals) {949949+ pr_info("CPU Watchdog Timeout (soft): %s[%d]\n",950950+ tsk->comm, task_pid_nr(tsk));951951+ }956952 __group_send_sig_info(SIGXCPU, SEND_SIG_PRIV, tsk);957953 if (soft < hard) {958954 soft++;
···17391739 }17401740}1741174117421742+extern unsigned long __init_memblock17431743+memblock_reserved_memory_within(phys_addr_t start_addr, phys_addr_t end_addr)17441744+{17451745+ struct memblock_region *rgn;17461746+ unsigned long size = 0;17471747+ int idx;17481748+17491749+ for_each_memblock_type((&memblock.reserved), rgn) {17501750+ phys_addr_t start, end;17511751+17521752+ if (rgn->base + rgn->size < start_addr)17531753+ continue;17541754+ if (rgn->base > end_addr)17551755+ continue;17561756+17571757+ start = rgn->base;17581758+ end = start + rgn->size;17591759+ size += end - start;17601760+ }17611761+17621762+ return size;17631763+}17641764+17421765void __init_memblock __memblock_dump_all(void)17431766{17441767 pr_info("MEMBLOCK configuration:\n");
+2-6
mm/memory-failure.c
···15951595 if (ret) {15961596 pr_info("soft offline: %#lx: migration failed %d, type %lx (%pGp)\n",15971597 pfn, ret, page->flags, &page->flags);15981598- /*15991599- * We know that soft_offline_huge_page() tries to migrate16001600- * only one hugepage pointed to by hpage, so we need not16011601- * run through the pagelist here.16021602- */16031603- putback_active_hugepage(hpage);15981598+ if (!list_empty(&pagelist))15991599+ putback_movable_pages(&pagelist);16041600 if (ret > 0)16051601 ret = -EIO;16061602 } else {
+30-10
mm/memory.c
···30293029 return ret;30303030}3031303130323032+/*30333033+ * The ordering of these checks is important for pmds with _PAGE_DEVMAP set.30343034+ * If we check pmd_trans_unstable() first we will trip the bad_pmd() check30353035+ * inside of pmd_none_or_trans_huge_or_clear_bad(). This will end up correctly30363036+ * returning 1 but not before it spams dmesg with the pmd_clear_bad() output.30373037+ */30383038+static int pmd_devmap_trans_unstable(pmd_t *pmd)30393039+{30403040+ return pmd_devmap(*pmd) || pmd_trans_unstable(pmd);30413041+}30423042+30323043static int pte_alloc_one_map(struct vm_fault *vmf)30333044{30343045 struct vm_area_struct *vma = vmf->vma;···30633052map_pte:30643053 /*30653054 * If a huge pmd materialized under us just retry later. Use30663066- * pmd_trans_unstable() instead of pmd_trans_huge() to ensure the pmd30673067- * didn't become pmd_trans_huge under us and then back to pmd_none, as30683068- * a result of MADV_DONTNEED running immediately after a huge pmd fault30693069- * in a different thread of this mm, in turn leading to a misleading30703070- * pmd_trans_huge() retval. All we have to ensure is that it is a30713071- * regular pmd that we can walk with pte_offset_map() and we can do that30723072- * through an atomic read in C, which is what pmd_trans_unstable()30733073- * provides.30553055+ * pmd_trans_unstable() via pmd_devmap_trans_unstable() instead of30563056+ * pmd_trans_huge() to ensure the pmd didn't become pmd_trans_huge30573057+ * under us and then back to pmd_none, as a result of MADV_DONTNEED30583058+ * running immediately after a huge pmd fault in a different thread of30593059+ * this mm, in turn leading to a misleading pmd_trans_huge() retval.30603060+ * All we have to ensure is that it is a regular pmd that we can walk30613061+ * with pte_offset_map() and we can do that through an atomic read in30623062+ * C, which is what pmd_trans_unstable() provides.30743063 */30753075- if (pmd_trans_unstable(vmf->pmd) || pmd_devmap(*vmf->pmd))30643064+ if (pmd_devmap_trans_unstable(vmf->pmd))30763065 return VM_FAULT_NOPAGE;3077306630673067+ /*30683068+ * At this point we know that our vmf->pmd points to a page of ptes30693069+ * and it cannot become pmd_none(), pmd_devmap() or pmd_trans_huge()30703070+ * for the duration of the fault. If a racing MADV_DONTNEED runs and30713071+ * we zap the ptes pointed to by our vmf->pmd, the vmf->ptl will still30723072+ * be valid and we will re-check to make sure the vmf->pte isn't30733073+ * pte_none() under vmf->ptl protection when we return to30743074+ * alloc_set_pte().30753075+ */30783076 vmf->pte = pte_offset_map_lock(vma->vm_mm, vmf->pmd, vmf->address,30793077 &vmf->ptl);30803078 return 0;···37103690 vmf->pte = NULL;37113691 } else {37123692 /* See comment in pte_alloc_one_map() */37133713- if (pmd_trans_unstable(vmf->pmd) || pmd_devmap(*vmf->pmd))36933693+ if (pmd_devmap_trans_unstable(vmf->pmd))37143694 return 0;37153695 /*37163696 * A regular pmd is established and it can't morph into a huge
+3-2
mm/mlock.c
···284284{285285 int i;286286 int nr = pagevec_count(pvec);287287- int delta_munlocked;287287+ int delta_munlocked = -nr;288288 struct pagevec pvec_putback;289289 int pgrescued = 0;290290···304304 continue;305305 else306306 __munlock_isolation_failed(page);307307+ } else {308308+ delta_munlocked++;307309 }308310309311 /*···317315 pagevec_add(&pvec_putback, pvec->pages[i]);318316 pvec->pages[i] = NULL;319317 }320320- delta_munlocked = -nr + pagevec_count(&pvec_putback);321318 __mod_zone_page_state(zone, NR_MLOCK, delta_munlocked);322319 spin_unlock_irq(zone_lru_lock(zone));323320
+25-12
mm/page_alloc.c
···292292#ifdef CONFIG_DEFERRED_STRUCT_PAGE_INIT293293static inline void reset_deferred_meminit(pg_data_t *pgdat)294294{295295+ unsigned long max_initialise;296296+ unsigned long reserved_lowmem;297297+298298+ /*299299+ * Initialise at least 2G of a node but also take into account that300300+ * two large system hashes that can take up 1GB for 0.25TB/node.301301+ */302302+ max_initialise = max(2UL << (30 - PAGE_SHIFT),303303+ (pgdat->node_spanned_pages >> 8));304304+305305+ /*306306+ * Compensate the all the memblock reservations (e.g. crash kernel)307307+ * from the initial estimation to make sure we will initialize enough308308+ * memory to boot.309309+ */310310+ reserved_lowmem = memblock_reserved_memory_within(pgdat->node_start_pfn,311311+ pgdat->node_start_pfn + max_initialise);312312+ max_initialise += reserved_lowmem;313313+314314+ pgdat->static_init_size = min(max_initialise, pgdat->node_spanned_pages);295315 pgdat->first_deferred_pfn = ULONG_MAX;296316}297317···334314 unsigned long pfn, unsigned long zone_end,335315 unsigned long *nr_initialised)336316{337337- unsigned long max_initialise;338338-339317 /* Always populate low zones for address-contrained allocations */340318 if (zone_end < pgdat_end_pfn(pgdat))341319 return true;342342- /*343343- * Initialise at least 2G of a node but also take into account that344344- * two large system hashes that can take up 1GB for 0.25TB/node.345345- */346346- max_initialise = max(2UL << (30 - PAGE_SHIFT),347347- (pgdat->node_spanned_pages >> 8));348348-349320 (*nr_initialised)++;350350- if ((*nr_initialised > max_initialise) &&321321+ if ((*nr_initialised > pgdat->static_init_size) &&351322 (pfn & (PAGES_PER_SECTION - 1)) == 0) {352323 pgdat->first_deferred_pfn = pfn;353324 return false;···38813870 goto got_pg;3882387138833872 /* Avoid allocations with no watermarks from looping endlessly */38843884- if (test_thread_flag(TIF_MEMDIE))38733873+ if (test_thread_flag(TIF_MEMDIE) &&38743874+ (alloc_flags == ALLOC_NO_WATERMARKS ||38753875+ (gfp_mask & __GFP_NOMEMALLOC)))38853876 goto nopage;3886387738873878 /* Retry as long as the OOM killer is making progress */···61496136 /* pg_data_t should be reset to zero when it's allocated */61506137 WARN_ON(pgdat->nr_zones || pgdat->kswapd_classzone_idx);6151613861526152- reset_deferred_meminit(pgdat);61536139 pgdat->node_id = nid;61546140 pgdat->node_start_pfn = node_start_pfn;61556141 pgdat->per_cpu_nodestats = NULL;···61706158 (unsigned long)pgdat->node_mem_map);61716159#endif6172616061616161+ reset_deferred_meminit(pgdat);61736162 free_area_init_core(pgdat);61746163}61756164
···357357 WARN_ON_ONCE((flags & GFP_KERNEL) != GFP_KERNEL);358358359359 /*360360- * Make sure that larger requests are not too disruptive - no OOM361361- * killer and no allocation failure warnings as we have a fallback360360+ * We want to attempt a large physically contiguous block first because361361+ * it is less likely to fragment multiple larger blocks and therefore362362+ * contribute to a long term fragmentation less than vmalloc fallback.363363+ * However make sure that larger requests are not too disruptive - no364364+ * OOM killer and no allocation failure warnings as we have a fallback.362365 */363366 if (size > PAGE_SIZE) {364367 kmalloc_flags |= __GFP_NOWARN;
+1
net/bridge/br_stp_if.c
···179179 br_debug(br, "using kernel STP\n");180180181181 /* To start timers on any ports left in blocking */182182+ mod_timer(&br->hello_timer, jiffies + br->hello_time);182183 br_port_state_selection(br);183184 }184185
+1-1
net/bridge/br_stp_timer.c
···4040 if (br->dev->flags & IFF_UP) {4141 br_config_bpdu_generation(br);42424343- if (br->stp_enabled != BR_USER_STP)4343+ if (br->stp_enabled == BR_KERNEL_STP)4444 mod_timer(&br->hello_timer,4545 round_jiffies(jiffies + br->hello_time));4646 }
+3
net/bridge/netfilter/ebt_arpreply.c
···6868 if (e->ethproto != htons(ETH_P_ARP) ||6969 e->invflags & EBT_IPROTO)7070 return -EINVAL;7171+ if (ebt_invalid_target(info->target))7272+ return -EINVAL;7373+7174 return 0;7275}7376
···641641}642642EXPORT_SYMBOL(arp_xmit);643643644644+static bool arp_is_garp(struct net *net, struct net_device *dev,645645+ int *addr_type, __be16 ar_op,646646+ __be32 sip, __be32 tip,647647+ unsigned char *sha, unsigned char *tha)648648+{649649+ bool is_garp = tip == sip;650650+651651+ /* Gratuitous ARP _replies_ also require target hwaddr to be652652+ * the same as source.653653+ */654654+ if (is_garp && ar_op == htons(ARPOP_REPLY))655655+ is_garp =656656+ /* IPv4 over IEEE 1394 doesn't provide target657657+ * hardware address field in its ARP payload.658658+ */659659+ tha &&660660+ !memcmp(tha, sha, dev->addr_len);661661+662662+ if (is_garp) {663663+ *addr_type = inet_addr_type_dev_table(net, dev, sip);664664+ if (*addr_type != RTN_UNICAST)665665+ is_garp = false;666666+ }667667+ return is_garp;668668+}669669+644670/*645671 * Process an arp request.646672 */···863837864838 n = __neigh_lookup(&arp_tbl, &sip, dev, 0);865839866866- if (IN_DEV_ARP_ACCEPT(in_dev)) {867867- unsigned int addr_type = inet_addr_type_dev_table(net, dev, sip);840840+ addr_type = -1;841841+ if (n || IN_DEV_ARP_ACCEPT(in_dev)) {842842+ is_garp = arp_is_garp(net, dev, &addr_type, arp->ar_op,843843+ sip, tip, sha, tha);844844+ }868845846846+ if (IN_DEV_ARP_ACCEPT(in_dev)) {869847 /* Unsolicited ARP is not accepted by default.870848 It is possible, that this option should be enabled for some871849 devices (strip is candidate)872850 */873873- is_garp = tip == sip && addr_type == RTN_UNICAST;874874-875875- /* Unsolicited ARP _replies_ also require target hwaddr to be876876- * the same as source.877877- */878878- if (is_garp && arp->ar_op == htons(ARPOP_REPLY))879879- is_garp =880880- /* IPv4 over IEEE 1394 doesn't provide target881881- * hardware address field in its ARP payload.882882- */883883- tha &&884884- !memcmp(tha, sha, dev->addr_len);885885-886851 if (!n &&887887- ((arp->ar_op == htons(ARPOP_REPLY) &&888888- addr_type == RTN_UNICAST) || is_garp))852852+ (is_garp ||853853+ (arp->ar_op == htons(ARPOP_REPLY) &&854854+ (addr_type == RTN_UNICAST ||855855+ (addr_type < 0 &&856856+ /* postpone calculation to as late as possible */857857+ inet_addr_type_dev_table(net, dev, sip) ==858858+ RTN_UNICAST)))))889859 n = __neigh_lookup(&arp_tbl, &sip, dev, 1);890860 }891861
···24542454 * stream sequence number shall be set to 0.24552455 */2456245624572457- /* Allocate storage for the negotiated streams if it is not a temporary24582458- * association.24592459- */24602460- if (!asoc->temp) {24612461- if (sctp_stream_init(asoc, gfp))24622462- goto clean_up;24572457+ if (sctp_stream_init(asoc, gfp))24582458+ goto clean_up;2463245924642464- if (sctp_assoc_set_id(asoc, gfp))24652465- goto clean_up;24662466- }24602460+ if (!asoc->temp && sctp_assoc_set_id(asoc, gfp))24612461+ goto clean_up;2467246224682463 /* ADDIP Section 4.1 ASCONF Chunk Procedures24692464 *
+3
net/sctp/sm_statefuns.c
···20882088 }20892089 }2090209020912091+ /* Set temp so that it won't be added into hashtable */20922092+ new_asoc->temp = 1;20932093+20912094 /* Compare the tie_tag in cookie with the verification tag of20922095 * current association.20932096 */
+8-13
net/vmw_vsock/af_vsock.c
···15401540 long timeout;15411541 int err;15421542 struct vsock_transport_send_notify_data send_data;15431543-15441544- DEFINE_WAIT(wait);15431543+ DEFINE_WAIT_FUNC(wait, woken_wake_function);1545154415461545 sk = sock->sk;15471546 vsk = vsock_sk(sk);···15831584 if (err < 0)15841585 goto out;1585158615861586-15871587 while (total_written < len) {15881588 ssize_t written;1589158915901590- prepare_to_wait(sk_sleep(sk), &wait, TASK_INTERRUPTIBLE);15901590+ add_wait_queue(sk_sleep(sk), &wait);15911591 while (vsock_stream_has_space(vsk) == 0 &&15921592 sk->sk_err == 0 &&15931593 !(sk->sk_shutdown & SEND_SHUTDOWN) &&···15951597 /* Don't wait for non-blocking sockets. */15961598 if (timeout == 0) {15971599 err = -EAGAIN;15981598- finish_wait(sk_sleep(sk), &wait);16001600+ remove_wait_queue(sk_sleep(sk), &wait);15991601 goto out_err;16001602 }1601160316021604 err = transport->notify_send_pre_block(vsk, &send_data);16031605 if (err < 0) {16041604- finish_wait(sk_sleep(sk), &wait);16061606+ remove_wait_queue(sk_sleep(sk), &wait);16051607 goto out_err;16061608 }1607160916081610 release_sock(sk);16091609- timeout = schedule_timeout(timeout);16111611+ timeout = wait_woken(&wait, TASK_INTERRUPTIBLE, timeout);16101612 lock_sock(sk);16111613 if (signal_pending(current)) {16121614 err = sock_intr_errno(timeout);16131613- finish_wait(sk_sleep(sk), &wait);16151615+ remove_wait_queue(sk_sleep(sk), &wait);16141616 goto out_err;16151617 } else if (timeout == 0) {16161618 err = -EAGAIN;16171617- finish_wait(sk_sleep(sk), &wait);16191619+ remove_wait_queue(sk_sleep(sk), &wait);16181620 goto out_err;16191621 }16201620-16211621- prepare_to_wait(sk_sleep(sk), &wait,16221622- TASK_INTERRUPTIBLE);16231622 }16241624- finish_wait(sk_sleep(sk), &wait);16231623+ remove_wait_queue(sk_sleep(sk), &wait);1625162416261625 /* These checks occur both as part of and after the loop16271626 * conditional since we need to check before and after
···13641364 /* Amanero Combo384 USB interface with native DSD support */13651365 case USB_ID(0x16d0, 0x071a):13661366 if (fp->altsetting == 2) {13671367- switch (chip->dev->descriptor.bcdDevice) {13671367+ switch (le16_to_cpu(chip->dev->descriptor.bcdDevice)) {13681368 case 0x199:13691369 return SNDRV_PCM_FMTBIT_DSD_U32_LE;13701370 case 0x19b:
···2929#define __KVM_HAVE_IRQ_LINE3030#define __KVM_HAVE_GUEST_DEBUG31313232+/* Not always available, but if it is, this is the correct offset. */3333+#define KVM_COALESCED_MMIO_PAGE_OFFSET 13434+3235struct kvm_regs {3336 __u64 pc;3437 __u64 cr;
+24-2
tools/arch/s390/include/uapi/asm/kvm.h
···2626#define KVM_DEV_FLIC_ADAPTER_REGISTER 62727#define KVM_DEV_FLIC_ADAPTER_MODIFY 72828#define KVM_DEV_FLIC_CLEAR_IO_IRQ 82929+#define KVM_DEV_FLIC_AISM 93030+#define KVM_DEV_FLIC_AIRQ_INJECT 102931/*3032 * We can have up to 4*64k pending subchannels + 8 adapter interrupts,3133 * as well as up to ASYNC_PF_PER_VCPU*KVM_MAX_VCPUS pfault done interrupts.···4341 __u8 isc;4442 __u8 maskable;4543 __u8 swap;4646- __u8 pad;4444+ __u8 flags;4545+};4646+4747+#define KVM_S390_ADAPTER_SUPPRESSIBLE 0x014848+4949+struct kvm_s390_ais_req {5050+ __u8 isc;5151+ __u16 mode;4752};48534954#define KVM_S390_IO_ADAPTER_MASK 1···119110#define KVM_S390_VM_CPU_FEAT_CMMA 10120111#define KVM_S390_VM_CPU_FEAT_PFMFI 11121112#define KVM_S390_VM_CPU_FEAT_SIGPIF 12113113+#define KVM_S390_VM_CPU_FEAT_KSS 13122114struct kvm_s390_vm_cpu_feat {123115 __u64 feat[16];124116};···208198#define KVM_SYNC_VRS (1UL << 6)209199#define KVM_SYNC_RICCB (1UL << 7)210200#define KVM_SYNC_FPRS (1UL << 8)201201+#define KVM_SYNC_GSCB (1UL << 9)202202+/* length and alignment of the sdnx as a power of two */203203+#define SDNXC 8204204+#define SDNXL (1UL << SDNXC)211205/* definition of registers in kvm_run */212206struct kvm_sync_regs {213207 __u64 prefix; /* prefix register */···232218 };233219 __u8 reserved[512]; /* for future vector expansion */234220 __u32 fpc; /* valid on KVM_SYNC_VRS or KVM_SYNC_FPRS */235235- __u8 padding[52]; /* riccb needs to be 64byte aligned */221221+ __u8 padding1[52]; /* riccb needs to be 64byte aligned */236222 __u8 riccb[64]; /* runtime instrumentation controls block */223223+ __u8 padding2[192]; /* sdnx needs to be 256byte aligned */224224+ union {225225+ __u8 sdnx[SDNXL]; /* state description annex */226226+ struct {227227+ __u64 reserved1[2];228228+ __u64 gscb[4];229229+ };230230+ };237231};238232239233#define KVM_REG_S390_TODPR (KVM_REG_S390 | KVM_REG_SIZE_U32 | 0x1)
···4848 * tv_sec holds the number of seconds before (negative) or after (positive)4949 * 00:00:00 1st January 1970 UTC.5050 *5151- * tv_nsec holds a number of nanoseconds before (0..-999,999,999 if tv_sec is5252- * negative) or after (0..999,999,999 if tv_sec is positive) the tv_sec time.5353- *5454- * Note that if both tv_sec and tv_nsec are non-zero, then the two values must5555- * either be both positive or both negative.5151+ * tv_nsec holds a number of nanoseconds (0..999,999,999) after the tv_sec time.5652 *5753 * __reserved is held in case we need a yet finer resolution.5854 */5955struct statx_timestamp {6056 __s64 tv_sec;6161- __s32 tv_nsec;5757+ __u32 tv_nsec;6258 __s32 __reserved;6359};6460
+4
tools/perf/Documentation/perf-script.txt
···311311 Set the maximum number of program blocks to print with brstackasm for312312 each sample.313313314314+--inline::315315+ If a callgraph address belongs to an inlined function, the inline stack316316+ will be printed. Each entry has function name and file/line.317317+314318SEE ALSO315319--------316320linkperf:perf-record[1], linkperf:perf-script-perl[1],
···692692693693 while (!ret && (unw_step(&c) > 0) && i < max_stack) {694694 unw_get_reg(&c, UNW_REG_IP, &ips[i]);695695+696696+ /*697697+ * Decrement the IP for any non-activation frames.698698+ * this is required to properly find the srcline699699+ * for caller frames.700700+ * See also the documentation for dwfl_frame_pc(),701701+ * which this code tries to replicate.702702+ */703703+ if (unw_is_signal_frame(&c) <= 0)704704+ --ips[i];705705+695706 ++i;696707 }697708
···4242 printf("Check DSCR TM context switch: ");4343 fflush(stdout);4444 for (;;) {4545- rv = 1;4645 asm __volatile__ (4746 /* set a known value into the DSCR */4847 "ld 3, %[dscr1];"4948 "mtspr %[sprn_dscr], 3;"50495050+ "li %[rv], 1;"5151 /* start and suspend a transaction */5252 "tbegin.;"5353 "beq 1f;"
+1
usr/Kconfig
···220220endchoice221221222222config INITRAMFS_COMPRESSION223223+ depends on INITRAMFS_SOURCE!=""223224 string224225 default "" if INITRAMFS_COMPRESSION_NONE225226 default ".gz" if INITRAMFS_COMPRESSION_GZIP