···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
···11-Hi6220 SoC ION22-===================================================================33-Required properties:44-- compatible : "hisilicon,hi6220-ion"55-- list of the ION heaps66- - heap name : maybe heap_sys_user@077- - heap id : id should be unique in the system.88- - heap base : base ddr address of the heap,0 means that99- it is dynamic.1010- - heap size : memory size and 0 means it is dynamic.1111- - heap type : the heap type of the heap, please also1212- see the define in ion.h(drivers/staging/android/uapi/ion.h)1313--------------------------------------------------------------------1414-Example:1515- hi6220-ion {1616- compatible = "hisilicon,hi6220-ion";1717- heap_sys_user@0 {1818- heap-name = "sys_user";1919- heap-id = <0x0>;2020- heap-base = <0x0>;2121- heap-size = <0x0>;2222- heap-type = "ion_system";2323- };2424- heap_sys_contig@0 {2525- heap-name = "sys_contig";2626- heap-id = <0x1>;2727- heap-base = <0x0>;2828- heap-size = <0x0>;2929- heap-type = "ion_system_contig";3030- };3131- };
+2-4
Documentation/usb/typec.rst
···114114registering/unregistering cables and their plugs:115115116116.. kernel-doc:: drivers/usb/typec/typec.c117117- :functions: typec_register_cable typec_unregister_cable typec_register_plug118118- typec_unregister_plug117117+ :functions: typec_register_cable typec_unregister_cable typec_register_plug typec_unregister_plug119118120119The class will provide a handle to struct typec_cable and struct typec_plug if121120the registration is successful, or NULL if it isn't.···136137APIs to report it to the class:137138138139.. kernel-doc:: drivers/usb/typec/typec.c139139- :functions: typec_set_data_role typec_set_pwr_role typec_set_vconn_role140140- typec_set_pwr_opmode140140+ :functions: typec_set_data_role typec_set_pwr_role typec_set_vconn_role typec_set_pwr_opmode141141142142Alternate Modes143143~~~~~~~~~~~~~~~
+1-1
Documentation/watchdog/watchdog-parameters.txt
···117117-------------------------------------------------118118iTCO_wdt:119119heartbeat: Watchdog heartbeat in seconds.120120- (2<heartbeat<39 (TCO v1) or 613 (TCO v2), default=30)120120+ (5<=heartbeat<=74 (TCO v1) or 1226 (TCO v2), default=30)121121nowayout: Watchdog cannot be stopped once started122122 (default=kernel config parameter)123123-------------------------------------------------
···11+# CONFIG_LOCALVERSION_AUTO is not set22+CONFIG_SYSVIPC=y33+CONFIG_NO_HZ_IDLE=y44+CONFIG_BSD_PROCESS_ACCT=y55+CONFIG_USER_NS=y66+CONFIG_RELAY=y77+CONFIG_BLK_DEV_INITRD=y88+CONFIG_PARTITION_ADVANCED=y99+CONFIG_ARCH_MULTI_V4=y1010+# CONFIG_ARCH_MULTI_V7 is not set1111+CONFIG_ARCH_GEMINI=y1212+CONFIG_PCI=y1313+CONFIG_PREEMPT=y1414+CONFIG_AEABI=y1515+CONFIG_CMDLINE="console=ttyS0,115200n8"1616+CONFIG_KEXEC=y1717+CONFIG_BINFMT_MISC=y1818+CONFIG_PM=y1919+CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"2020+CONFIG_DEVTMPFS=y2121+CONFIG_MTD=y2222+CONFIG_MTD_BLOCK=y2323+CONFIG_MTD_CFI=y2424+CONFIG_MTD_CFI_INTELEXT=y2525+CONFIG_MTD_CFI_AMDSTD=y2626+CONFIG_MTD_CFI_STAA=y2727+CONFIG_MTD_PHYSMAP=y2828+CONFIG_MTD_PHYSMAP_OF=y2929+CONFIG_BLK_DEV_RAM=y3030+CONFIG_BLK_DEV_RAM_SIZE=163843131+# CONFIG_SCSI_PROC_FS is not set3232+CONFIG_BLK_DEV_SD=y3333+# CONFIG_SCSI_LOWLEVEL is not set3434+CONFIG_ATA=y3535+CONFIG_INPUT_EVDEV=y3636+CONFIG_KEYBOARD_GPIO=y3737+# CONFIG_INPUT_MOUSE is not set3838+# CONFIG_LEGACY_PTYS is not set3939+CONFIG_SERIAL_8250=y4040+CONFIG_SERIAL_8250_CONSOLE=y4141+CONFIG_SERIAL_8250_NR_UARTS=14242+CONFIG_SERIAL_8250_RUNTIME_UARTS=14343+CONFIG_SERIAL_OF_PLATFORM=y4444+# CONFIG_HW_RANDOM is not set4545+# CONFIG_HWMON is not set4646+CONFIG_WATCHDOG=y4747+CONFIG_GEMINI_WATCHDOG=y4848+CONFIG_USB=y4949+CONFIG_USB_MON=y5050+CONFIG_USB_FOTG210_HCD=y5151+CONFIG_USB_STORAGE=y5252+CONFIG_NEW_LEDS=y5353+CONFIG_LEDS_CLASS=y5454+CONFIG_LEDS_GPIO=y5555+CONFIG_LEDS_TRIGGERS=y5656+CONFIG_LEDS_TRIGGER_HEARTBEAT=y5757+CONFIG_RTC_CLASS=y5858+CONFIG_RTC_DRV_GEMINI=y5959+CONFIG_DMADEVICES=y6060+# CONFIG_DNOTIFY is not set6161+CONFIG_TMPFS=y6262+CONFIG_TMPFS_POSIX_ACL=y6363+CONFIG_ROMFS_FS=y6464+CONFIG_NLS_CODEPAGE_437=y6565+CONFIG_NLS_ISO8859_1=y6666+# CONFIG_ENABLE_WARN_DEPRECATED is not set6767+# CONFIG_ENABLE_MUST_CHECK is not set6868+CONFIG_DEBUG_FS=y
···266266extern const struct smp_operations omap4_smp_ops;267267#endif268268269269+extern u32 omap4_get_cpu1_ns_pa_addr(void);270270+269271#if defined(CONFIG_SMP) && defined(CONFIG_PM)270272extern int omap4_mpuss_init(void);271273extern int omap4_enter_lowpower(unsigned int cpu, unsigned int power_state);272274extern int omap4_hotplug_cpu(unsigned int cpu, unsigned int power_state);273273-extern u32 omap4_get_cpu1_ns_pa_addr(void);274275#else275276static inline int omap4_enter_lowpower(unsigned int cpu,276277 unsigned int power_state)
+5-5
arch/arm/mach-omap2/omap-mpuss-lowpower.c
···213213{}214214#endif215215216216-u32 omap4_get_cpu1_ns_pa_addr(void)217217-{218218- return old_cpu1_ns_pa_addr;219219-}220220-221216/**222217 * omap4_enter_lowpower: OMAP4 MPUSS Low Power Entry Function223218 * The purpose of this function is to manage low power programming···451456}452457453458#endif459459+460460+u32 omap4_get_cpu1_ns_pa_addr(void)461461+{462462+ return old_cpu1_ns_pa_addr;463463+}454464455465/*456466 * For kexec, we must set CPU1_WAKEUP_NS_PA_ADDR to point to
+7-4
arch/arm/mach-omap2/omap-smp.c
···306306307307 cpu1_startup_pa = readl_relaxed(cfg.wakeupgen_base +308308 OMAP_AUX_CORE_BOOT_1);309309- cpu1_ns_pa_addr = omap4_get_cpu1_ns_pa_addr();310309311310 /* Did the configured secondary_startup() get overwritten? */312311 if (!omap4_smp_cpu1_startup_valid(cpu1_startup_pa))···315316 * If omap4 or 5 has NS_PA_ADDR configured, CPU1 may be in a316317 * deeper idle state in WFI and will wake to an invalid address.317318 */318318- if ((soc_is_omap44xx() || soc_is_omap54xx()) &&319319- !omap4_smp_cpu1_startup_valid(cpu1_ns_pa_addr))320320- needs_reset = true;319319+ if ((soc_is_omap44xx() || soc_is_omap54xx())) {320320+ cpu1_ns_pa_addr = omap4_get_cpu1_ns_pa_addr();321321+ if (!omap4_smp_cpu1_startup_valid(cpu1_ns_pa_addr))322322+ needs_reset = true;323323+ } else {324324+ cpu1_ns_pa_addr = 0;325325+ }321326322327 if (!needs_reset || !c->cpu1_rstctrl_va)323328 return;
···44444545/dts-v1/;4646#include "rk3399-gru.dtsi"4747-#include <include/dt-bindings/input/linux-event-codes.h>4747+#include <dt-bindings/input/linux-event-codes.h>48484949/*5050 * Kevin-specific things
+50-62
arch/arm64/configs/defconfig
···3030CONFIG_JUMP_LABEL=y3131CONFIG_MODULES=y3232CONFIG_MODULE_UNLOAD=y3333-# CONFIG_BLK_DEV_BSG is not set3433# CONFIG_IOSCHED_DEADLINE is not set3534CONFIG_ARCH_SUNXI=y3635CONFIG_ARCH_ALPINE=y···6162CONFIG_ARCH_ZX=y6263CONFIG_ARCH_ZYNQMP=y6364CONFIG_PCI=y6464-CONFIG_PCI_MSI=y6565CONFIG_PCI_IOV=y6666-CONFIG_PCI_AARDVARK=y6767-CONFIG_PCIE_RCAR=y6868-CONFIG_PCI_HOST_GENERIC=y6969-CONFIG_PCI_XGENE=y7066CONFIG_PCI_LAYERSCAPE=y7167CONFIG_PCI_HISI=y7268CONFIG_PCIE_QCOM=y7369CONFIG_PCIE_ARMADA_8K=y7070+CONFIG_PCI_AARDVARK=y7171+CONFIG_PCIE_RCAR=y7272+CONFIG_PCI_HOST_GENERIC=y7373+CONFIG_PCI_XGENE=y7474CONFIG_ARM64_VA_BITS_48=y7575CONFIG_SCHED_MC=y7676CONFIG_NUMA=y···7880CONFIG_TRANSPARENT_HUGEPAGE=y7981CONFIG_CMA=y8082CONFIG_SECCOMP=y8181-CONFIG_XEN=y8283CONFIG_KEXEC=y8384CONFIG_CRASH_DUMP=y8585+CONFIG_XEN=y8486# CONFIG_CORE_DUMP_DEFAULT_ELF_HEADERS is not set8587CONFIG_COMPAT=y8686-CONFIG_CPU_IDLE=y8788CONFIG_HIBERNATION=y8889CONFIG_ARM_CPUIDLE=y8990CONFIG_CPU_FREQ=y···152155CONFIG_BLK_DEV_LOOP=y153156CONFIG_BLK_DEV_NBD=m154157CONFIG_VIRTIO_BLK=y155155-CONFIG_EEPROM_AT25=m156158CONFIG_SRAM=y159159+CONFIG_EEPROM_AT25=m157160# CONFIG_SCSI_PROC_FS is not set158161CONFIG_BLK_DEV_SD=y159162CONFIG_SCSI_SAS_ATA=y···165168CONFIG_AHCI_MVEBU=y166169CONFIG_AHCI_XGENE=y167170CONFIG_AHCI_QORIQ=y168168-CONFIG_SATA_RCAR=y169171CONFIG_SATA_SIL24=y172172+CONFIG_SATA_RCAR=y170173CONFIG_PATA_PLATFORM=y171174CONFIG_PATA_OF_PLATFORM=y172175CONFIG_NETDEVICES=y···183186CONFIG_E1000E=y184187CONFIG_IGB=y185188CONFIG_IGBVF=y186186-CONFIG_MVPP2=y187189CONFIG_MVNETA=y190190+CONFIG_MVPP2=y188191CONFIG_SKY2=y189192CONFIG_RAVB=y190193CONFIG_SMC91X=y191194CONFIG_SMSC911X=y192195CONFIG_STMMAC_ETH=m193193-CONFIG_REALTEK_PHY=m196196+CONFIG_MDIO_BUS_MUX_MMIOREG=y194197CONFIG_MESON_GXL_PHY=m195198CONFIG_MICREL_PHY=y196196-CONFIG_MDIO_BUS_MUX=y197197-CONFIG_MDIO_BUS_MUX_MMIOREG=y199199+CONFIG_REALTEK_PHY=m198200CONFIG_USB_PEGASUS=m199201CONFIG_USB_RTL8150=m200202CONFIG_USB_RTL8152=m···226230CONFIG_SERIAL_OF_PLATFORM=y227231CONFIG_SERIAL_AMBA_PL011=y228232CONFIG_SERIAL_AMBA_PL011_CONSOLE=y233233+CONFIG_SERIAL_MESON=y234234+CONFIG_SERIAL_MESON_CONSOLE=y229235CONFIG_SERIAL_SAMSUNG=y230236CONFIG_SERIAL_SAMSUNG_CONSOLE=y231237CONFIG_SERIAL_TEGRA=y232238CONFIG_SERIAL_SH_SCI=y233239CONFIG_SERIAL_SH_SCI_NR_UARTS=11234240CONFIG_SERIAL_SH_SCI_CONSOLE=y235235-CONFIG_SERIAL_MESON=y236236-CONFIG_SERIAL_MESON_CONSOLE=y237241CONFIG_SERIAL_MSM=y238242CONFIG_SERIAL_MSM_CONSOLE=y239243CONFIG_SERIAL_XILINX_PS_UART=y···257261CONFIG_I2C_RCAR=y258262CONFIG_I2C_CROS_EC_TUNNEL=y259263CONFIG_SPI=y260260-CONFIG_SPI_MESON_SPIFC=m261264CONFIG_SPI_BCM2835=m262265CONFIG_SPI_BCM2835AUX=m266266+CONFIG_SPI_MESON_SPIFC=m263267CONFIG_SPI_ORION=y264268CONFIG_SPI_PL022=y265269CONFIG_SPI_QUP=y266266-CONFIG_SPI_SPIDEV=m267270CONFIG_SPI_S3C64XX=y271271+CONFIG_SPI_SPIDEV=m268272CONFIG_SPMI=y269273CONFIG_PINCTRL_SINGLE=y270274CONFIG_PINCTRL_MAX77620=y···282286CONFIG_GPIO_PCA953X_IRQ=y283287CONFIG_GPIO_MAX77620=y284288CONFIG_POWER_RESET_MSM=y285285-CONFIG_BATTERY_BQ27XXX=y286289CONFIG_POWER_RESET_XGENE=y287290CONFIG_POWER_RESET_SYSCON=y291291+CONFIG_BATTERY_BQ27XXX=y292292+CONFIG_SENSORS_ARM_SCPI=y288293CONFIG_SENSORS_LM90=m289294CONFIG_SENSORS_INA2XX=m290290-CONFIG_SENSORS_ARM_SCPI=y291291-CONFIG_THERMAL=y292292-CONFIG_THERMAL_EMULATION=y293295CONFIG_THERMAL_GOV_POWER_ALLOCATOR=y294296CONFIG_CPU_THERMAL=y295295-CONFIG_BCM2835_THERMAL=y297297+CONFIG_THERMAL_EMULATION=y296298CONFIG_EXYNOS_THERMAL=y297299CONFIG_WATCHDOG=y298298-CONFIG_BCM2835_WDT=y299299-CONFIG_RENESAS_WDT=y300300CONFIG_S3C2410_WATCHDOG=y301301CONFIG_MESON_GXBB_WATCHDOG=m302302CONFIG_MESON_WATCHDOG=m303303-CONFIG_MFD_EXYNOS_LPASS=m304304-CONFIG_MFD_MAX77620=y305305-CONFIG_MFD_RK808=y306306-CONFIG_MFD_SPMI_PMIC=y307307-CONFIG_MFD_SEC_CORE=y308308-CONFIG_MFD_HI655X_PMIC=y309309-CONFIG_REGULATOR=y303303+CONFIG_RENESAS_WDT=y304304+CONFIG_BCM2835_WDT=y310305CONFIG_MFD_CROS_EC=y311306CONFIG_MFD_CROS_EC_I2C=y307307+CONFIG_MFD_EXYNOS_LPASS=m308308+CONFIG_MFD_HI655X_PMIC=y309309+CONFIG_MFD_MAX77620=y310310+CONFIG_MFD_SPMI_PMIC=y311311+CONFIG_MFD_RK808=y312312+CONFIG_MFD_SEC_CORE=y312313CONFIG_REGULATOR_FIXED_VOLTAGE=y313314CONFIG_REGULATOR_GPIO=y314315CONFIG_REGULATOR_HI655X=y···338345CONFIG_DRM_EXYNOS_HDMI=y339346CONFIG_DRM_EXYNOS_MIC=y340347CONFIG_DRM_RCAR_DU=m341341-CONFIG_DRM_RCAR_HDMI=y342348CONFIG_DRM_RCAR_LVDS=y343349CONFIG_DRM_RCAR_VSP=y344350CONFIG_DRM_TEGRA=m345345-CONFIG_DRM_VC4=m346351CONFIG_DRM_PANEL_SIMPLE=m347352CONFIG_DRM_I2C_ADV7511=m353353+CONFIG_DRM_VC4=m348354CONFIG_DRM_HISI_KIRIN=m349355CONFIG_DRM_MESON=m350356CONFIG_FB=y···358366CONFIG_SND=y359367CONFIG_SND_SOC=y360368CONFIG_SND_BCM2835_SOC_I2S=m361361-CONFIG_SND_SOC_RCAR=y362369CONFIG_SND_SOC_SAMSUNG=y370370+CONFIG_SND_SOC_RCAR=y363371CONFIG_SND_SOC_AK4613=y364372CONFIG_USB=y365373CONFIG_USB_OTG=y366374CONFIG_USB_XHCI_HCD=y367367-CONFIG_USB_XHCI_PLATFORM=y368368-CONFIG_USB_XHCI_RCAR=y369369-CONFIG_USB_EHCI_EXYNOS=y370375CONFIG_USB_XHCI_TEGRA=y371376CONFIG_USB_EHCI_HCD=y372377CONFIG_USB_EHCI_MSM=y378378+CONFIG_USB_EHCI_EXYNOS=y373379CONFIG_USB_EHCI_HCD_PLATFORM=y374374-CONFIG_USB_OHCI_EXYNOS=y375380CONFIG_USB_OHCI_HCD=y381381+CONFIG_USB_OHCI_EXYNOS=y376382CONFIG_USB_OHCI_HCD_PLATFORM=y377383CONFIG_USB_RENESAS_USBHS=m378384CONFIG_USB_STORAGE=y379379-CONFIG_USB_DWC2=y380385CONFIG_USB_DWC3=y386386+CONFIG_USB_DWC2=y381387CONFIG_USB_CHIPIDEA=y382388CONFIG_USB_CHIPIDEA_UDC=y383389CONFIG_USB_CHIPIDEA_HOST=y384390CONFIG_USB_ISP1760=y385391CONFIG_USB_HSIC_USB3503=y386392CONFIG_USB_MSM_OTG=y393393+CONFIG_USB_QCOM_8X16_PHY=y387394CONFIG_USB_ULPI=y388395CONFIG_USB_GADGET=y389396CONFIG_USB_RENESAS_USBHS_UDC=m390397CONFIG_MMC=y391398CONFIG_MMC_BLOCK_MINORS=32392399CONFIG_MMC_ARMMMCI=y393393-CONFIG_MMC_MESON_GX=y394400CONFIG_MMC_SDHCI=y395401CONFIG_MMC_SDHCI_ACPI=y396402CONFIG_MMC_SDHCI_PLTFM=y···396406CONFIG_MMC_SDHCI_OF_ESDHC=y397407CONFIG_MMC_SDHCI_CADENCE=y398408CONFIG_MMC_SDHCI_TEGRA=y409409+CONFIG_MMC_MESON_GX=y399410CONFIG_MMC_SDHCI_MSM=y400411CONFIG_MMC_SPI=y401412CONFIG_MMC_SDHI=y···405414CONFIG_MMC_DW_K3=y406415CONFIG_MMC_DW_ROCKCHIP=y407416CONFIG_MMC_SUNXI=y408408-CONFIG_MMC_SDHCI_XENON=y409417CONFIG_MMC_BCM2835=y418418+CONFIG_MMC_SDHCI_XENON=y410419CONFIG_NEW_LEDS=y411420CONFIG_LEDS_CLASS=y412421CONFIG_LEDS_GPIO=y413422CONFIG_LEDS_PWM=y414423CONFIG_LEDS_SYSCON=y415415-CONFIG_LEDS_TRIGGERS=y416416-CONFIG_LEDS_TRIGGER_DEFAULT_ON=y417424CONFIG_LEDS_TRIGGER_HEARTBEAT=y418425CONFIG_LEDS_TRIGGER_CPU=y426426+CONFIG_LEDS_TRIGGER_DEFAULT_ON=y419427CONFIG_RTC_CLASS=y420428CONFIG_RTC_DRV_MAX77686=y429429+CONFIG_RTC_DRV_RK808=m421430CONFIG_RTC_DRV_S5M=y422431CONFIG_RTC_DRV_DS3232=y423432CONFIG_RTC_DRV_EFI=y433433+CONFIG_RTC_DRV_S3C=y424434CONFIG_RTC_DRV_PL031=y425435CONFIG_RTC_DRV_SUN6I=y426426-CONFIG_RTC_DRV_RK808=m427436CONFIG_RTC_DRV_TEGRA=y428437CONFIG_RTC_DRV_XGENE=y429429-CONFIG_RTC_DRV_S3C=y430438CONFIG_DMADEVICES=y439439+CONFIG_DMA_BCM2835=m431440CONFIG_MV_XOR_V2=y432441CONFIG_PL330_DMA=y433433-CONFIG_DMA_BCM2835=m434442CONFIG_TEGRA20_APB_DMA=y435443CONFIG_QCOM_BAM_DMA=y436444CONFIG_QCOM_HIDMA_MGMT=y···442452CONFIG_VIRTIO_MMIO=y443453CONFIG_XEN_GNTDEV=y444454CONFIG_XEN_GRANT_DEV_ALLOC=y455455+CONFIG_COMMON_CLK_RK808=y445456CONFIG_COMMON_CLK_SCPI=y446457CONFIG_COMMON_CLK_CS2000_CP=y447458CONFIG_COMMON_CLK_S2MPS11=y448448-CONFIG_COMMON_CLK_PWM=y449449-CONFIG_COMMON_CLK_RK808=y450459CONFIG_CLK_QORIQ=y460460+CONFIG_COMMON_CLK_PWM=y451461CONFIG_COMMON_CLK_QCOM=y462462+CONFIG_QCOM_CLK_SMD_RPM=y452463CONFIG_MSM_GCC_8916=y453464CONFIG_MSM_GCC_8994=y454465CONFIG_MSM_MMCC_8996=y455466CONFIG_HWSPINLOCK_QCOM=y456456-CONFIG_MAILBOX=y457467CONFIG_ARM_MHU=y458468CONFIG_PLATFORM_MHU=y459469CONFIG_BCM2835_MBOX=y460470CONFIG_HI6220_MBOX=y461471CONFIG_ARM_SMMU=y462472CONFIG_ARM_SMMU_V3=y473473+CONFIG_RPMSG_QCOM_SMD=y463474CONFIG_RASPBERRYPI_POWER=y464475CONFIG_QCOM_SMEM=y465465-CONFIG_QCOM_SMD=y466476CONFIG_QCOM_SMD_RPM=y477477+CONFIG_QCOM_SMP2P=y478478+CONFIG_QCOM_SMSM=y467479CONFIG_ROCKCHIP_PM_DOMAINS=y468480CONFIG_ARCH_TEGRA_132_SOC=y469481CONFIG_ARCH_TEGRA_210_SOC=y470482CONFIG_ARCH_TEGRA_186_SOC=y471483CONFIG_EXTCON_USB_GPIO=y484484+CONFIG_IIO=y485485+CONFIG_EXYNOS_ADC=y472486CONFIG_PWM=y473487CONFIG_PWM_BCM2835=m474474-CONFIG_PWM_ROCKCHIP=y475475-CONFIG_PWM_TEGRA=m476488CONFIG_PWM_MESON=m477477-CONFIG_COMMON_RESET_HI6220=y489489+CONFIG_PWM_ROCKCHIP=y490490+CONFIG_PWM_SAMSUNG=y491491+CONFIG_PWM_TEGRA=m478492CONFIG_PHY_RCAR_GEN3_USB2=y479493CONFIG_PHY_HI6220_USB=y494494+CONFIG_PHY_SUN4I_USB=y480495CONFIG_PHY_ROCKCHIP_INNO_USB2=y481496CONFIG_PHY_ROCKCHIP_EMMC=y482482-CONFIG_PHY_SUN4I_USB=y483497CONFIG_PHY_XGENE=y484498CONFIG_PHY_TEGRA_XUSB=y485499CONFIG_ARM_SCPI_PROTOCOL=y486486-CONFIG_ACPI=y487487-CONFIG_IIO=y488488-CONFIG_EXYNOS_ADC=y489489-CONFIG_PWM_SAMSUNG=y490500CONFIG_RASPBERRYPI_FIRMWARE=y501501+CONFIG_ACPI=y491502CONFIG_EXT2_FS=y492503CONFIG_EXT3_FS=y493504CONFIG_EXT4_FS_POSIX_ACL=y···502511CONFIG_CUSE=m503512CONFIG_OVERLAY_FS=m504513CONFIG_VFAT_FS=y505505-CONFIG_TMPFS=y506514CONFIG_HUGETLBFS=y507515CONFIG_CONFIGFS_FS=y508516CONFIG_EFIVAR_FS=y···529539CONFIG_SECURITY=y530540CONFIG_CRYPTO_ECHAINIV=y531541CONFIG_CRYPTO_ANSI_CPRNG=y532532-CONFIG_CRYPTO_DEV_SAFEXCEL=m533542CONFIG_ARM64_CRYPTO=y534543CONFIG_CRYPTO_SHA1_ARM64_CE=y535544CONFIG_CRYPTO_SHA2_ARM64_CE=y536545CONFIG_CRYPTO_GHASH_ARM64_CE=y537546CONFIG_CRYPTO_AES_ARM64_CE_CCM=y538547CONFIG_CRYPTO_AES_ARM64_CE_BLK=y539539-# CONFIG_CRYPTO_AES_ARM64_NEON_BLK is not set
···115115116116extern DECLARE_BITMAP(cpu_hwcaps, ARM64_NCAPS);117117extern struct static_key_false cpu_hwcap_keys[ARM64_NCAPS];118118+extern struct static_key_false arm64_const_caps_ready;118119119120bool this_cpu_has_cap(unsigned int cap);120121···125124}126125127126/* System capability check for constant caps */128128-static inline bool cpus_have_const_cap(int num)127127+static inline bool __cpus_have_const_cap(int num)129128{130129 if (num >= ARM64_NCAPS)131130 return false;···139138 return test_bit(num, cpu_hwcaps);140139}141140141141+static inline bool cpus_have_const_cap(int num)142142+{143143+ if (static_branch_likely(&arm64_const_caps_ready))144144+ return __cpus_have_const_cap(num);145145+ else146146+ return cpus_have_cap(num);147147+}148148+142149static inline void cpus_set_cap(unsigned int num)143150{144151 if (num >= ARM64_NCAPS) {···154145 num, ARM64_NCAPS);155146 } else {156147 __set_bit(num, cpu_hwcaps);157157- static_branch_enable(&cpu_hwcap_keys[num]);158148 }159149}160150
+6-2
arch/arm64/include/asm/kvm_host.h
···24242525#include <linux/types.h>2626#include <linux/kvm_types.h>2727+#include <asm/cpufeature.h>2728#include <asm/kvm.h>2829#include <asm/kvm_asm.h>2930#include <asm/kvm_mmio.h>···356355 unsigned long vector_ptr)357356{358357 /*359359- * Call initialization code, and switch to the full blown360360- * HYP code.358358+ * Call initialization code, and switch to the full blown HYP code.359359+ * If the cpucaps haven't been finalized yet, something has gone very360360+ * wrong, and hyp will crash and burn when it uses any361361+ * cpus_have_const_cap() wrapper.361362 */363363+ BUG_ON(!static_branch_likely(&arm64_const_caps_ready));362364 __kvm_call_hyp((void *)pgd_ptr, hyp_stack_ptr, vector_ptr);363365}364366
+21-2
arch/arm64/kernel/cpufeature.c
···985985 */986986void __init enable_cpu_capabilities(const struct arm64_cpu_capabilities *caps)987987{988988- for (; caps->matches; caps++)989989- if (caps->enable && cpus_have_cap(caps->capability))988988+ for (; caps->matches; caps++) {989989+ unsigned int num = caps->capability;990990+991991+ if (!cpus_have_cap(num))992992+ continue;993993+994994+ /* Ensure cpus_have_const_cap(num) works */995995+ static_branch_enable(&cpu_hwcap_keys[num]);996996+997997+ if (caps->enable) {990998 /*991999 * Use stop_machine() as it schedules the work allowing9921000 * us to modify PSTATE, instead of on_each_cpu() which···1002994 * we return.1003995 */1004996 stop_machine(caps->enable, NULL, cpu_online_mask);997997+ }998998+ }1005999}1006100010071001/*···11061096 enable_cpu_capabilities(arm64_features);11071097}1108109810991099+DEFINE_STATIC_KEY_FALSE(arm64_const_caps_ready);11001100+EXPORT_SYMBOL(arm64_const_caps_ready);11011101+11021102+static void __init mark_const_caps_ready(void)11031103+{11041104+ static_branch_enable(&arm64_const_caps_ready);11051105+}11061106+11091107/*11101108 * Check if the current CPU has a given feature capability.11111109 * Should be called from non-preemptible context.···11491131 /* Set the CPU feature capabilies */11501132 setup_feature_capabilities();11511133 enable_errata_workarounds();11341134+ mark_const_caps_ready();11521135 setup_elf_hwcaps(arm64_elf_hwcaps);1153113611541137 if (system_supports_32bit_el0())
+16-7
arch/arm64/kernel/perf_event.c
···877877878878 if (attr->exclude_idle)879879 return -EPERM;880880- if (is_kernel_in_hyp_mode() &&881881- attr->exclude_kernel != attr->exclude_hv)882882- return -EINVAL;880880+881881+ /*882882+ * If we're running in hyp mode, then we *are* the hypervisor.883883+ * Therefore we ignore exclude_hv in this configuration, since884884+ * there's no hypervisor to sample anyway. This is consistent885885+ * with other architectures (x86 and Power).886886+ */887887+ if (is_kernel_in_hyp_mode()) {888888+ if (!attr->exclude_kernel)889889+ config_base |= ARMV8_PMU_INCLUDE_EL2;890890+ } else {891891+ if (attr->exclude_kernel)892892+ config_base |= ARMV8_PMU_EXCLUDE_EL1;893893+ if (!attr->exclude_hv)894894+ config_base |= ARMV8_PMU_INCLUDE_EL2;895895+ }883896 if (attr->exclude_user)884897 config_base |= ARMV8_PMU_EXCLUDE_EL0;885885- if (!is_kernel_in_hyp_mode() && attr->exclude_kernel)886886- config_base |= ARMV8_PMU_EXCLUDE_EL1;887887- if (!attr->exclude_hv)888888- config_base |= ARMV8_PMU_INCLUDE_EL2;889898890899 /*891900 * Install the filter into config_base as this is used to
···1414#include <asm-generic/module.h>151516161717+#ifdef CC_USING_MPROFILE_KERNEL1818+#define MODULE_ARCH_VERMAGIC "mprofile-kernel"1919+#endif2020+1721#ifndef __powerpc64__1822/*1923 * Thanks to Paul M for explaining this.
+12
arch/powerpc/include/asm/page.h
···132132#define virt_to_pfn(kaddr) (__pa(kaddr) >> PAGE_SHIFT)133133#define virt_to_page(kaddr) pfn_to_page(virt_to_pfn(kaddr))134134#define pfn_to_kaddr(pfn) __va((pfn) << PAGE_SHIFT)135135+136136+#ifdef CONFIG_PPC_BOOK3S_64137137+/*138138+ * On hash the vmalloc and other regions alias to the kernel region when passed139139+ * through __pa(), which virt_to_pfn() uses. That means virt_addr_valid() can140140+ * return true for some vmalloc addresses, which is incorrect. So explicitly141141+ * check that the address is in the kernel region.142142+ */143143+#define virt_addr_valid(kaddr) (REGION_ID(kaddr) == KERNEL_REGION_ID && \144144+ pfn_valid(virt_to_pfn(kaddr)))145145+#else135146#define virt_addr_valid(kaddr) pfn_valid(virt_to_pfn(kaddr))147147+#endif136148137149/*138150 * On Book-E parts we need __va to parse the device tree and we can't
+1-1
arch/powerpc/kernel/idle_book3s.S
···416416 * which needs to be restored from the stack.417417 */418418 li r3, 1419419- stb r0,PACA_NAPSTATELOST(r13)419419+ stb r3,PACA_NAPSTATELOST(r13)420420 blr421421422422/*
···864864 if (!MSR_TM_SUSPENDED(mfmsr()))865865 return;866866867867+ /*868868+ * If we are in a transaction and FP is off then we can't have869869+ * used FP inside that transaction. Hence the checkpointed870870+ * state is the same as the live state. We need to copy the871871+ * live state to the checkpointed state so that when the872872+ * transaction is restored, the checkpointed state is correct873873+ * and the aborted transaction sees the correct state. We use874874+ * ckpt_regs.msr here as that's what tm_reclaim will use to875875+ * determine if it's going to write the checkpointed state or876876+ * not. So either this will write the checkpointed registers,877877+ * or reclaim will. Similarly for VMX.878878+ */879879+ if ((thr->ckpt_regs.msr & MSR_FP) == 0)880880+ memcpy(&thr->ckfp_state, &thr->fp_state,881881+ sizeof(struct thread_fp_state));882882+ if ((thr->ckpt_regs.msr & MSR_VEC) == 0)883883+ memcpy(&thr->ckvr_state, &thr->vr_state,884884+ sizeof(struct thread_vr_state));885885+867886 giveup_all(container_of(thr, struct task_struct, thread));868887869888 tm_reclaim(thr, thr->ckpt_regs.msr, cause);
+1-1
arch/powerpc/kvm/Kconfig
···6767 select KVM_BOOK3S_64_HANDLER6868 select KVM6969 select KVM_BOOK3S_PR_POSSIBLE if !KVM_BOOK3S_HV_POSSIBLE7070- select SPAPR_TCE_IOMMU if IOMMU_SUPPORT7070+ select SPAPR_TCE_IOMMU if IOMMU_SUPPORT && (PPC_SERIES || PPC_POWERNV)7171 ---help---7272 Support running unmodified book3s_64 and book3s_32 guest kernels7373 in virtual machines on book3s_64 host processors.
···301301 /* udbg_printf("H_PUT_TCE(): liobn=0x%lx ioba=0x%lx, tce=0x%lx\n", */302302 /* liobn, ioba, tce); */303303304304+ /* For radix, we might be in virtual mode, so punt */305305+ if (kvm_is_radix(vcpu->kvm))306306+ return H_TOO_HARD;307307+304308 stt = kvmppc_find_table(vcpu->kvm, liobn);305309 if (!stt)306310 return H_TOO_HARD;···384380 unsigned long *rmap = NULL;385381 bool prereg = false;386382 struct kvmppc_spapr_tce_iommu_table *stit;383383+384384+ /* For radix, we might be in virtual mode, so punt */385385+ if (kvm_is_radix(vcpu->kvm))386386+ return H_TOO_HARD;387387388388 stt = kvmppc_find_table(vcpu->kvm, liobn);389389 if (!stt)···499491 long i, ret;500492 struct kvmppc_spapr_tce_iommu_table *stit;501493494494+ /* For radix, we might be in virtual mode, so punt */495495+ if (kvm_is_radix(vcpu->kvm))496496+ return H_TOO_HARD;497497+502498 stt = kvmppc_find_table(vcpu->kvm, liobn);503499 if (!stt)504500 return H_TOO_HARD;···539527 return H_SUCCESS;540528}541529530530+/* This can be called in either virtual mode or real mode */542531long kvmppc_h_get_tce(struct kvm_vcpu *vcpu, unsigned long liobn,543532 unsigned long ioba)544533{
+8-1
arch/powerpc/kvm/book3s_hv_builtin.c
···207207208208long kvmppc_h_random(struct kvm_vcpu *vcpu)209209{210210- if (powernv_get_random_real_mode(&vcpu->arch.gpr[4]))210210+ int r;211211+212212+ /* Only need to do the expensive mfmsr() on radix */213213+ if (kvm_is_radix(vcpu->kvm) && (mfmsr() & MSR_IR))214214+ r = powernv_get_random_long(&vcpu->arch.gpr[4]);215215+ else216216+ r = powernv_get_random_real_mode(&vcpu->arch.gpr[4]);217217+ if (r)211218 return H_SUCCESS;212219213220 return H_HARDWARE;
···17631763{17641764 struct kvm_arch *ka = &kvm->arch;17651765 struct pvclock_vcpu_time_info hv_clock;17661766+ u64 ret;1766176717671768 spin_lock(&ka->pvclock_gtod_sync_lock);17681769 if (!ka->use_master_clock) {···17751774 hv_clock.system_time = ka->master_kernel_ns + ka->kvmclock_offset;17761775 spin_unlock(&ka->pvclock_gtod_sync_lock);1777177617771777+ /* both __this_cpu_read() and rdtsc() should be on the same cpu */17781778+ get_cpu();17791779+17781780 kvm_get_time_scale(NSEC_PER_SEC, __this_cpu_read(cpu_tsc_khz) * 1000LL,17791781 &hv_clock.tsc_shift,17801782 &hv_clock.tsc_to_system_mul);17811781- return __pvclock_read_cycles(&hv_clock, rdtsc());17831783+ ret = __pvclock_read_cycles(&hv_clock, rdtsc());17841784+17851785+ put_cpu();17861786+17871787+ return ret;17821788}1783178917841790static void kvm_setup_pvclock_page(struct kvm_vcpu *v)···32963288 }32973289}3298329032913291+#define XSAVE_MXCSR_OFFSET 2432923292+32993293static int kvm_vcpu_ioctl_x86_set_xsave(struct kvm_vcpu *vcpu,33003294 struct kvm_xsave *guest_xsave)33013295{33023296 u64 xstate_bv =33033297 *(u64 *)&guest_xsave->region[XSAVE_HDR_OFFSET / sizeof(u32)];32983298+ u32 mxcsr = *(u32 *)&guest_xsave->region[XSAVE_MXCSR_OFFSET / sizeof(u32)];3304329933053300 if (boot_cpu_has(X86_FEATURE_XSAVE)) {33063301 /*···33113300 * CPUID leaf 0xD, index 0, EDX:EAX. This is for compatibility33123301 * with old userspace.33133302 */33143314- if (xstate_bv & ~kvm_supported_xcr0())33033303+ if (xstate_bv & ~kvm_supported_xcr0() ||33043304+ mxcsr & ~mxcsr_feature_mask)33153305 return -EINVAL;33163306 load_xsave(vcpu, (u8 *)guest_xsave->region);33173307 } else {33183318- if (xstate_bv & ~XFEATURE_MASK_FPSSE)33083308+ if (xstate_bv & ~XFEATURE_MASK_FPSSE ||33093309+ mxcsr & ~mxcsr_feature_mask)33193310 return -EINVAL;33203311 memcpy(&vcpu->arch.guest_fpu.state.fxsave,33213312 guest_xsave->region, sizeof(struct fxregs_state));···4831481848324819static int kernel_pio(struct kvm_vcpu *vcpu, void *pd)48334820{48344834- /* TODO: String I/O for in kernel device */48354835- int r;48214821+ int r = 0, i;4836482248374837- if (vcpu->arch.pio.in)48384838- r = kvm_io_bus_read(vcpu, KVM_PIO_BUS, vcpu->arch.pio.port,48394839- vcpu->arch.pio.size, pd);48404840- else48414841- r = kvm_io_bus_write(vcpu, KVM_PIO_BUS,48424842- vcpu->arch.pio.port, vcpu->arch.pio.size,48434843- pd);48234823+ for (i = 0; i < vcpu->arch.pio.count; i++) {48244824+ if (vcpu->arch.pio.in)48254825+ r = kvm_io_bus_read(vcpu, KVM_PIO_BUS, vcpu->arch.pio.port,48264826+ vcpu->arch.pio.size, pd);48274827+ else48284828+ r = kvm_io_bus_write(vcpu, KVM_PIO_BUS,48294829+ vcpu->arch.pio.port, vcpu->arch.pio.size,48304830+ pd);48314831+ if (r)48324832+ break;48334833+ pd += vcpu->arch.pio.size;48344834+ }48444835 return r;48454836}48464837···4881486448824865 if (vcpu->arch.pio.count)48834866 goto data_avail;48674867+48684868+ memset(vcpu->arch.pio_data, 0, size * count);4884486948854870 ret = emulator_pio_in_out(vcpu, size, port, val, count, true);48864871 if (ret) {···5067504850685049 if (var.unusable) {50695050 memset(desc, 0, sizeof(*desc));50515051+ if (base3)50525052+ *base3 = 0;50705053 return false;50715054 }50725055
+4-11
arch/x86/xen/enlighten_pv.c
···142142 struct xen_extraversion extra;143143 HYPERVISOR_xen_version(XENVER_extraversion, &extra);144144145145- pr_info("Booting paravirtualized kernel %son %s\n",146146- xen_feature(XENFEAT_auto_translated_physmap) ?147147- "with PVH extensions " : "", pv_info.name);145145+ pr_info("Booting paravirtualized kernel on %s\n", pv_info.name);148146 printk(KERN_INFO "Xen version: %d.%d%s%s\n",149147 version >> 16, version & 0xffff, extra.extraversion,150148 xen_feature(XENFEAT_mmu_pt_update_preserve_ad) ? " (preserve-AD)" : "");···955957956958void xen_setup_shared_info(void)957959{958958- if (!xen_feature(XENFEAT_auto_translated_physmap)) {959959- set_fixmap(FIX_PARAVIRT_BOOTMAP,960960- xen_start_info->shared_info);960960+ set_fixmap(FIX_PARAVIRT_BOOTMAP, xen_start_info->shared_info);961961962962- HYPERVISOR_shared_info =963963- (struct shared_info *)fix_to_virt(FIX_PARAVIRT_BOOTMAP);964964- } else965965- HYPERVISOR_shared_info =966966- (struct shared_info *)__va(xen_start_info->shared_info);962962+ HYPERVISOR_shared_info =963963+ (struct shared_info *)fix_to_virt(FIX_PARAVIRT_BOOTMAP);967964968965#ifndef CONFIG_SMP969966 /* In UP this is as good a place as any to set up shared info */
···355355 pteval_t flags = val & PTE_FLAGS_MASK;356356 unsigned long mfn;357357358358- if (!xen_feature(XENFEAT_auto_translated_physmap))359359- mfn = __pfn_to_mfn(pfn);360360- else361361- mfn = pfn;358358+ mfn = __pfn_to_mfn(pfn);359359+362360 /*363361 * If there's no mfn for the pfn, then just create an364362 * empty non-present pte. Unfortunately this loses···644646 /* The limit is the last byte to be touched */645647 limit--;646648 BUG_ON(limit >= FIXADDR_TOP);647647-648648- if (xen_feature(XENFEAT_auto_translated_physmap))649649- return 0;650649651650 /*652651 * 64-bit has a great big hole in the middle of the address···1284128912851290static void __init xen_pagetable_p2m_setup(void)12861291{12871287- if (xen_feature(XENFEAT_auto_translated_physmap))12881288- return;12891289-12901292 xen_vmalloc_p2m_tree();1291129312921294#ifdef CONFIG_X86_64···13061314 xen_build_mfn_list_list();1307131513081316 /* Remap memory freed due to conflicts with E820 map */13091309- if (!xen_feature(XENFEAT_auto_translated_physmap))13101310- xen_remap_memory();13171317+ xen_remap_memory();1311131813121319 xen_setup_shared_info();13131320}···19161925 /* Zap identity mapping */19171926 init_level4_pgt[0] = __pgd(0);1918192719191919- if (!xen_feature(XENFEAT_auto_translated_physmap)) {19201920- /* Pre-constructed entries are in pfn, so convert to mfn */19211921- /* L4[272] -> level3_ident_pgt19221922- * L4[511] -> level3_kernel_pgt */19231923- convert_pfn_mfn(init_level4_pgt);19281928+ /* Pre-constructed entries are in pfn, so convert to mfn */19291929+ /* L4[272] -> level3_ident_pgt */19301930+ /* L4[511] -> level3_kernel_pgt */19311931+ convert_pfn_mfn(init_level4_pgt);1924193219251925- /* L3_i[0] -> level2_ident_pgt */19261926- convert_pfn_mfn(level3_ident_pgt);19271927- /* L3_k[510] -> level2_kernel_pgt19281928- * L3_k[511] -> level2_fixmap_pgt */19291929- convert_pfn_mfn(level3_kernel_pgt);19331933+ /* L3_i[0] -> level2_ident_pgt */19341934+ convert_pfn_mfn(level3_ident_pgt);19351935+ /* L3_k[510] -> level2_kernel_pgt */19361936+ /* L3_k[511] -> level2_fixmap_pgt */19371937+ convert_pfn_mfn(level3_kernel_pgt);1930193819311931- /* L3_k[511][506] -> level1_fixmap_pgt */19321932- convert_pfn_mfn(level2_fixmap_pgt);19331933- }19391939+ /* L3_k[511][506] -> level1_fixmap_pgt */19401940+ convert_pfn_mfn(level2_fixmap_pgt);19411941+19341942 /* We get [511][511] and have Xen's version of level2_kernel_pgt */19351943 l3 = m2v(pgd[pgd_index(__START_KERNEL_map)].pgd);19361944 l2 = m2v(l3[pud_index(__START_KERNEL_map)].pud);···19521962 if (i && i < pgd_index(__START_KERNEL_map))19531963 init_level4_pgt[i] = ((pgd_t *)xen_start_info->pt_base)[i];1954196419551955- if (!xen_feature(XENFEAT_auto_translated_physmap)) {19561956- /* Make pagetable pieces RO */19571957- set_page_prot(init_level4_pgt, PAGE_KERNEL_RO);19581958- set_page_prot(level3_ident_pgt, PAGE_KERNEL_RO);19591959- set_page_prot(level3_kernel_pgt, PAGE_KERNEL_RO);19601960- set_page_prot(level3_user_vsyscall, PAGE_KERNEL_RO);19611961- set_page_prot(level2_ident_pgt, PAGE_KERNEL_RO);19621962- set_page_prot(level2_kernel_pgt, PAGE_KERNEL_RO);19631963- set_page_prot(level2_fixmap_pgt, PAGE_KERNEL_RO);19641964- set_page_prot(level1_fixmap_pgt, PAGE_KERNEL_RO);19651965+ /* Make pagetable pieces RO */19661966+ set_page_prot(init_level4_pgt, PAGE_KERNEL_RO);19671967+ set_page_prot(level3_ident_pgt, PAGE_KERNEL_RO);19681968+ set_page_prot(level3_kernel_pgt, PAGE_KERNEL_RO);19691969+ set_page_prot(level3_user_vsyscall, PAGE_KERNEL_RO);19701970+ set_page_prot(level2_ident_pgt, PAGE_KERNEL_RO);19711971+ set_page_prot(level2_kernel_pgt, PAGE_KERNEL_RO);19721972+ set_page_prot(level2_fixmap_pgt, PAGE_KERNEL_RO);19731973+ set_page_prot(level1_fixmap_pgt, PAGE_KERNEL_RO);1965197419661966- /* Pin down new L4 */19671967- pin_pagetable_pfn(MMUEXT_PIN_L4_TABLE,19681968- PFN_DOWN(__pa_symbol(init_level4_pgt)));19751975+ /* Pin down new L4 */19761976+ pin_pagetable_pfn(MMUEXT_PIN_L4_TABLE,19771977+ PFN_DOWN(__pa_symbol(init_level4_pgt)));1969197819701970- /* Unpin Xen-provided one */19711971- pin_pagetable_pfn(MMUEXT_UNPIN_TABLE, PFN_DOWN(__pa(pgd)));19791979+ /* Unpin Xen-provided one */19801980+ pin_pagetable_pfn(MMUEXT_UNPIN_TABLE, PFN_DOWN(__pa(pgd)));1972198119731973- /*19741974- * At this stage there can be no user pgd, and no page19751975- * structure to attach it to, so make sure we just set kernel19761976- * pgd.19771977- */19781978- xen_mc_batch();19791979- __xen_write_cr3(true, __pa(init_level4_pgt));19801980- xen_mc_issue(PARAVIRT_LAZY_CPU);19811981- } else19821982- native_write_cr3(__pa(init_level4_pgt));19821982+ /*19831983+ * At this stage there can be no user pgd, and no page structure to19841984+ * attach it to, so make sure we just set kernel pgd.19851985+ */19861986+ xen_mc_batch();19871987+ __xen_write_cr3(true, __pa(init_level4_pgt));19881988+ xen_mc_issue(PARAVIRT_LAZY_CPU);1983198919841990 /* We can't that easily rip out L3 and L2, as the Xen pagetables are19851991 * set out this way: [L4], [L1], [L2], [L3], [L1], [L1] ... for···2389240323902404static void __init xen_post_allocator_init(void)23912405{23922392- if (xen_feature(XENFEAT_auto_translated_physmap))23932393- return;23942394-23952406 pv_mmu_ops.set_pte = xen_set_pte;23962407 pv_mmu_ops.set_pmd = xen_set_pmd;23972408 pv_mmu_ops.set_pud = xen_set_pud;···24932510void __init xen_init_mmu_ops(void)24942511{24952512 x86_init.paging.pagetable_init = xen_pagetable_init;24962496-24972497- if (xen_feature(XENFEAT_auto_translated_physmap))24982498- return;2499251325002514 pv_mmu_ops = xen_mmu_ops;25012515···26302650 * this function are redundant and can be ignored.26312651 */2632265226332633- if (xen_feature(XENFEAT_auto_translated_physmap))26342634- return 0;26352635-26362653 if (unlikely(order > MAX_CONTIG_ORDER))26372654 return -ENOMEM;26382655···26652688 unsigned long flags;26662689 int success;26672690 unsigned long vstart;26682668-26692669- if (xen_feature(XENFEAT_auto_translated_physmap))26702670- return;2671269126722692 if (unlikely(order > MAX_CONTIG_ORDER))26732693 return;
+9
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");···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:
+5-6
drivers/base/power/wakeup.c
···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/**
+15-12
drivers/block/drbd/drbd_req.c
···315315}316316317317/* still holds resource->req_lock */318318-static int drbd_req_put_completion_ref(struct drbd_request *req, struct bio_and_error *m, int put)318318+static void drbd_req_put_completion_ref(struct drbd_request *req, struct bio_and_error *m, int put)319319{320320 struct drbd_device *device = req->device;321321 D_ASSERT(device, m || (req->rq_state & RQ_POSTPONED));322322323323+ if (!put)324324+ return;325325+323326 if (!atomic_sub_and_test(put, &req->completion_ref))324324- return 0;327327+ return;325328326329 drbd_req_complete(req, m);330330+331331+ /* local completion may still come in later,332332+ * we need to keep the req object around. */333333+ if (req->rq_state & RQ_LOCAL_ABORTED)334334+ return;327335328336 if (req->rq_state & RQ_POSTPONED) {329337 /* don't destroy the req object just yet,330338 * but queue it for retry */331339 drbd_restart_request(req);332332- return 0;340340+ return;333341 }334342335335- return 1;343343+ kref_put(&req->kref, drbd_req_destroy);336344}337345338346static void set_if_null_req_next(struct drbd_peer_device *peer_device, struct drbd_request *req)···527519 if (req->i.waiting)528520 wake_up(&device->misc_wait);529521530530- if (c_put) {531531- if (drbd_req_put_completion_ref(req, m, c_put))532532- kref_put(&req->kref, drbd_req_destroy);533533- } else {534534- kref_put(&req->kref, drbd_req_destroy);535535- }522522+ drbd_req_put_completion_ref(req, m, c_put);523523+ kref_put(&req->kref, drbd_req_destroy);536524}537525538526static void drbd_report_io_error(struct drbd_device *device, struct drbd_request *req)···13701366 }1371136713721368out:13731373- if (drbd_req_put_completion_ref(req, &m, 1))13741374- kref_put(&req->kref, drbd_req_destroy);13691369+ drbd_req_put_completion_ref(req, &m, 1);13751370 spin_unlock_irq(&resource->req_lock);1376137113771372 /* Even though above is a kref_put(), this is safe.
+5-3
drivers/block/xen-blkback/xenbus.c
···504504505505 dev_set_drvdata(&dev->dev, NULL);506506507507- if (be->blkif)507507+ if (be->blkif) {508508 xen_blkif_disconnect(be->blkif);509509510510- /* Put the reference we set in xen_blkif_alloc(). */511511- xen_blkif_put(be->blkif);510510+ /* Put the reference we set in xen_blkif_alloc(). */511511+ xen_blkif_put(be->blkif);512512+ }513513+512514 kfree(be->mode);513515 kfree(be);514516 return 0;
+5-1
drivers/char/lp.c
···859859 } else if (!strcmp(str, "auto")) {860860 parport_nr[0] = LP_PARPORT_AUTO;861861 } else if (!strcmp(str, "none")) {862862- parport_nr[parport_ptr++] = LP_PARPORT_NONE;862862+ if (parport_ptr < LP_NO)863863+ parport_nr[parport_ptr++] = LP_PARPORT_NONE;864864+ else865865+ printk(KERN_INFO "lp: too many ports, %s ignored.\n",866866+ str);863867 } else if (!strcmp(str, "reset")) {864868 reset = 1;865869 }
+5
drivers/char/mem.c
···340340static int mmap_mem(struct file *file, struct vm_area_struct *vma)341341{342342 size_t size = vma->vm_end - vma->vm_start;343343+ phys_addr_t offset = (phys_addr_t)vma->vm_pgoff << PAGE_SHIFT;344344+345345+ /* It's illegal to wrap around the end of the physical address space. */346346+ if (offset + (phys_addr_t)size < offset)347347+ return -EINVAL;343348344349 if (!valid_mmap_phys_addr_range(vma->vm_pgoff, size))345350 return -EINVAL;
+9
drivers/cpufreq/Kconfig.arm
···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
···129129 struct vgpu_sched_data *vgpu_data;130130 ktime_t cur_time;131131132132- /* no target to schedule */133133- if (!scheduler->next_vgpu)132132+ /* no need to schedule if next_vgpu is the same with current_vgpu,133133+ * let scheduler chose next_vgpu again by setting it to NULL.134134+ */135135+ if (scheduler->next_vgpu == scheduler->current_vgpu) {136136+ scheduler->next_vgpu = NULL;134137 return;138138+ }135139136140 /*137141 * after the flag is set, workload dispatch thread will
+8-4
drivers/gpu/drm/i915/i915_gem_gtt.c
···195195 u32 pte_flags;196196 int ret;197197198198- ret = vma->vm->allocate_va_range(vma->vm, vma->node.start, vma->size);199199- if (ret)200200- return ret;198198+ if (!(vma->flags & I915_VMA_LOCAL_BIND)) {199199+ ret = vma->vm->allocate_va_range(vma->vm, vma->node.start,200200+ vma->size);201201+ if (ret)202202+ return ret;203203+ }201204202205 vma->pages = vma->obj->mm.pages;203206···23092306 if (flags & I915_VMA_LOCAL_BIND) {23102307 struct i915_hw_ppgtt *appgtt = i915->mm.aliasing_ppgtt;2311230823122312- if (appgtt->base.allocate_va_range) {23092309+ if (!(vma->flags & I915_VMA_LOCAL_BIND) &&23102310+ appgtt->base.allocate_va_range) {23132311 ret = appgtt->base.allocate_va_range(&appgtt->base,23142312 vma->node.start,23152313 vma->node.size);
+7-3
drivers/gpu/drm/i915/i915_reg.h
···30513051#define CLKCFG_FSB_667 (3 << 0) /* hrawclk 166 */30523052#define CLKCFG_FSB_800 (2 << 0) /* hrawclk 200 */30533053#define CLKCFG_FSB_1067 (6 << 0) /* hrawclk 266 */30543054+#define CLKCFG_FSB_1067_ALT (0 << 0) /* hrawclk 266 */30543055#define CLKCFG_FSB_1333 (7 << 0) /* hrawclk 333 */30553055-/* Note, below two are guess */30563056-#define CLKCFG_FSB_1600 (4 << 0) /* hrawclk 400 */30573057-#define CLKCFG_FSB_1600_ALT (0 << 0) /* hrawclk 400 */30563056+/*30573057+ * Note that on at least on ELK the below value is reported for both30583058+ * 333 and 400 MHz BIOS FSB setting, but given that the gmch datasheet30593059+ * lists only 200/266/333 MHz FSB as supported let's decode it as 333 MHz.30603060+ */30613061+#define CLKCFG_FSB_1333_ALT (4 << 0) /* hrawclk 333 */30583062#define CLKCFG_FSB_MASK (7 << 0)30593063#define CLKCFG_MEM_533 (1 << 4)30603064#define CLKCFG_MEM_667 (2 << 4)
+2-4
drivers/gpu/drm/i915/intel_cdclk.c
···17981798 case CLKCFG_FSB_800:17991799 return 200000;18001800 case CLKCFG_FSB_1067:18011801+ case CLKCFG_FSB_1067_ALT:18011802 return 266667;18021803 case CLKCFG_FSB_1333:18041804+ case CLKCFG_FSB_1333_ALT:18031805 return 333333;18041804- /* these two are just a guess; one of them might be right */18051805- case CLKCFG_FSB_1600:18061806- case CLKCFG_FSB_1600_ALT:18071807- return 400000;18081806 default:18091807 return 133333;18101808 }
+3-4
drivers/gpu/drm/i915/intel_dsi.c
···410410 val |= (ULPS_STATE_ENTER | DEVICE_READY);411411 I915_WRITE(MIPI_DEVICE_READY(port), val);412412413413- /* Wait for ULPS Not active */413413+ /* Wait for ULPS active */414414 if (intel_wait_for_register(dev_priv,415415- MIPI_CTRL(port), GLK_ULPS_NOT_ACTIVE,416416- GLK_ULPS_NOT_ACTIVE, 20))417417- DRM_ERROR("ULPS is still active\n");415415+ MIPI_CTRL(port), GLK_ULPS_NOT_ACTIVE, 0, 20))416416+ DRM_ERROR("ULPS not active\n");418417419418 /* Exit ULPS */420419 val = I915_READ(MIPI_DEVICE_READY(port));
···492492493493config PCI_ENDPOINT_TEST494494 depends on PCI495495+ select CRC32495496 tristate "PCI Endpoint Test driver"496497 ---help---497498 Enable this configuration option to enable the host side test driver
···42714271 int arp_validate_value, fail_over_mac_value, primary_reselect_value, i;42724272 struct bond_opt_value newval;42734273 const struct bond_opt_value *valptr;42744274- int arp_all_targets_value;42744274+ int arp_all_targets_value = 0;42754275 u16 ad_actor_sys_prio = 0;42764276 u16 ad_user_port_key = 0;42774277- __be32 arp_target[BOND_MAX_ARP_TARGETS];42774277+ __be32 arp_target[BOND_MAX_ARP_TARGETS] = { 0 };42784278 int arp_ip_count;42794279 int bond_mode = BOND_MODE_ROUNDROBIN;42804280 int xmit_hashtype = BOND_XMIT_POLICY_LAYER2;···45014501 arp_validate_value = 0;45024502 }4503450345044504- arp_all_targets_value = 0;45054504 if (arp_all_targets) {45064505 bond_opt_initstr(&newval, arp_all_targets);45074506 valptr = bond_opt_parse(bond_opt_get(BOND_OPT_ARP_ALL_TARGETS),
+4-4
drivers/net/ethernet/atheros/atlx/atl2.c
···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);
+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
+10
drivers/nvme/host/fc.c
···17541754 dev_info(ctrl->ctrl.device,17551755 "NVME-FC{%d}: resetting controller\n", ctrl->cnum);1756175617571757+ /* stop the queues on error, cleanup is in reset thread */17581758+ if (ctrl->queue_count > 1)17591759+ nvme_stop_queues(&ctrl->ctrl);17601760+17571761 if (!nvme_change_ctrl_state(&ctrl->ctrl, NVME_CTRL_RECONNECTING)) {17581762 dev_err(ctrl->ctrl.device,17591763 "NVME-FC{%d}: error_recovery: Couldn't change state "···27232719 struct nvme_fc_ctrl *ctrl;27242720 unsigned long flags;27252721 int ret, idx;27222722+27232723+ if (!(rport->remoteport.port_role &27242724+ (FC_PORT_ROLE_NVME_DISCOVERY | FC_PORT_ROLE_NVME_TARGET))) {27252725+ ret = -EBADR;27262726+ goto out_fail;27272727+ }2726272827272729 ctrl = kzalloc(sizeof(*ctrl), GFP_KERNEL);27282730 if (!ctrl) {
···517517{518518 int cpu, idx, cnt;519519520520- if (!(tgtport->ops->target_features &521521- NVMET_FCTGTFEAT_NEEDS_CMD_CPUSCHED) ||522522- tgtport->ops->max_hw_queues == 1)520520+ if (tgtport->ops->max_hw_queues == 1)523521 return WORK_CPU_UNBOUND;524522525523 /* Simple cpu selection based on qid modulo active cpu count */
-1
drivers/nvme/target/fcloop.c
···698698 .dma_boundary = FCLOOP_DMABOUND_4G,699699 /* optional features */700700 .target_features = NVMET_FCTGTFEAT_CMD_IN_ISR |701701- NVMET_FCTGTFEAT_NEEDS_CMD_CPUSCHED |702701 NVMET_FCTGTFEAT_OPDONE_IN_ISR,703702 /* sizes of additional private data for data structures */704703 .target_priv_sz = sizeof(struct fcloop_tport),
···42044204 /* Reset HBA */42054205 lpfc_printf_log(phba, KERN_INFO, LOG_SLI,42064206 "0325 Reset HBA Data: x%x x%x\n",42074207- phba->pport->port_state, psli->sli_flag);42074207+ (phba->pport) ? phba->pport->port_state : 0,42084208+ psli->sli_flag);4208420942094210 /* perform board reset */42104211 phba->fc_eventTag = 0;42114212 phba->link_events = 0;42124212- phba->pport->fc_myDID = 0;42134213- phba->pport->fc_prevDID = 0;42134213+ if (phba->pport) {42144214+ phba->pport->fc_myDID = 0;42154215+ phba->pport->fc_prevDID = 0;42164216+ }4214421742154218 /* Turn off parity checking and serr during the physical reset */42164219 pci_read_config_word(phba->pcidev, PCI_COMMAND, &cfg_value);···43394336 /* Restart HBA */43404337 lpfc_printf_log(phba, KERN_INFO, LOG_SLI,43414338 "0337 Restart HBA Data: x%x x%x\n",43424342- phba->pport->port_state, psli->sli_flag);43394339+ (phba->pport) ? phba->pport->port_state : 0,43404340+ psli->sli_flag);4343434143444342 word0 = 0;43454343 mb = (MAILBOX_t *) &word0;···43544350 readl(to_slim); /* flush */4355435143564352 /* Only skip post after fc_ffinit is completed */43574357- if (phba->pport->port_state)43534353+ if (phba->pport && phba->pport->port_state)43584354 word0 = 1; /* This is really setting up word1 */43594355 else43604356 word0 = 0; /* This is really setting up word1 */···43634359 readl(to_slim); /* flush */4364436043654361 lpfc_sli_brdreset(phba);43664366- phba->pport->stopped = 0;43624362+ if (phba->pport)43634363+ phba->pport->stopped = 0;43674364 phba->link_state = LPFC_INIT_START;43684365 phba->hba_flag = 0;43694366 spin_unlock_irq(&phba->hbalock);···44514446 * iteration, the function will restart the HBA again. The function returns44524447 * zero if HBA successfully restarted else returns negative error code.44534448 **/44544454-static int44494449+int44554450lpfc_sli_chipset_init(struct lpfc_hba *phba)44564451{44574452 uint32_t status, i = 0;
-3
drivers/scsi/pmcraid.c
···37703770 pmcraid_err("couldn't build passthrough ioadls\n");37713771 goto out_free_cmd;37723772 }37733773- } else if (request_size < 0) {37743774- rc = -EINVAL;37753775- goto out_free_cmd;37763773 }3777377437783775 /* If data is being written into the device, copy the data from user
+1-1
drivers/scsi/qedf/qedf.h
···259259 uint16_t task_id;260260 uint32_t port_id; /* Remote port fabric ID */261261 int lun;262262- char op; /* SCSI CDB */262262+ unsigned char op; /* SCSI CDB */263263 uint8_t lba[4];264264 unsigned int bufflen; /* SCSI buffer length */265265 unsigned int sg_count; /* Number of SG elements */
···2233config IMX7_PM_DOMAINS44 bool "i.MX7 PM domains"55- select PM_GENERIC_DOMAINS65 depends on SOC_IMX7D || (COMPILE_TEST && OF)66+ depends on PM77+ select PM_GENERIC_DOMAINS78 default y if SOC_IMX7D89910endmenu
-51
drivers/staging/android/ion/devicetree.txt
···11-Ion Memory Manager22-33-Ion is a memory manager that allows for sharing of buffers via dma-buf.44-Ion allows for different types of allocation via an abstraction called55-a 'heap'. A heap represents a specific type of memory. Each heap has66-a different type. There can be multiple instances of the same heap77-type.88-99-Specific heap instances are tied to heap IDs. Heap IDs are not to be specified1010-in the devicetree.1111-1212-Required properties for Ion1313-1414-- compatible: "linux,ion" PLUS a compatible property for the device1515-1616-All child nodes of a linux,ion node are interpreted as heaps1717-1818-required properties for heaps1919-2020-- compatible: compatible string for a heap type PLUS a compatible property2121-for the specific instance of the heap. Current heap types2222--- linux,ion-heap-system2323--- linux,ion-heap-system-contig2424--- linux,ion-heap-carveout2525--- linux,ion-heap-chunk2626--- linux,ion-heap-dma2727--- linux,ion-heap-custom2828-2929-Optional properties3030-- memory-region: A phandle to a memory region. Required for DMA heap type3131-(see reserved-memory.txt for details on the reservation)3232-3333-Example:3434-3535- ion {3636- compatbile = "hisilicon,ion", "linux,ion";3737-3838- ion-system-heap {3939- compatbile = "hisilicon,system-heap", "linux,ion-heap-system"4040- };4141-4242- ion-camera-region {4343- compatible = "hisilicon,camera-heap", "linux,ion-heap-dma"4444- memory-region = <&camera_region>;4545- };4646-4747- ion-fb-region {4848- compatbile = "hisilicon,fb-heap", "linux,ion-heap-dma"4949- memory-region = <&fb_region>;5050- };5151- }
-1
drivers/staging/ccree/ssi_request_mgr.c
···376376 rc = ssi_power_mgr_runtime_get(&drvdata->plat_dev->dev);377377 if (rc != 0) {378378 SSI_LOG_ERR("ssi_power_mgr_runtime_get returned %x\n",rc);379379- spin_unlock_bh(&req_mgr_h->hw_lock);380379 return rc;381380 }382381#endif
+1
drivers/staging/fsl-dpaa2/Kconfig
···1212config FSL_DPAA2_ETH1313 tristate "Freescale DPAA2 Ethernet"1414 depends on FSL_DPAA2 && FSL_MC_DPIO1515+ depends on NETDEVICES && ETHERNET1516 ---help---1617 Ethernet driver for Freescale DPAA2 SoCs, using the1718 Freescale MC bus driver
···238238 unsigned int hard_reset_count;239239 bool pd_capable;240240 bool explicit_contract;241241+ unsigned int rx_msgid;241242242243 /* Partner capabilities/requests */243244 u32 sink_request;···252251 unsigned int nr_src_pdo;253252 u32 snk_pdo[PDO_MAX_OBJECTS];254253 unsigned int nr_snk_pdo;254254+ u32 snk_vdo[VDO_MAX_OBJECTS];255255+ unsigned int nr_snk_vdo;255256256257 unsigned int max_snk_mv;257258 unsigned int max_snk_ma;···1000997 struct pd_mode_data *modep;1001998 int rlen = 0;1002999 u16 svid;10001000+ int i;1003100110041002 tcpm_log(port, "Rx VDM cmd 0x%x type %d cmd %d len %d",10051003 p0, cmd_type, cmd, cnt);···10111007 case CMDT_INIT:10121008 switch (cmd) {10131009 case CMD_DISCOVER_IDENT:10101010+ /* 6.4.4.3.1: Only respond as UFP (device) */10111011+ if (port->data_role == TYPEC_DEVICE &&10121012+ port->nr_snk_vdo) {10131013+ for (i = 0; i < port->nr_snk_vdo; i++)10141014+ response[i + 1]10151015+ = cpu_to_le32(port->snk_vdo[i]);10161016+ rlen = port->nr_snk_vdo + 1;10171017+ }10141018 break;10151019 case CMD_DISCOVER_SVID:10161020 break;···14271415 break;14281416 case SOFT_RESET_SEND:14291417 port->message_id = 0;14181418+ port->rx_msgid = -1;14301419 if (port->pwr_role == TYPEC_SOURCE)14311420 next_state = SRC_SEND_CAPABILITIES;14321421 else···15161503 port->attached);1517150415181505 if (port->attached) {15061506+ enum pd_ctrl_msg_type type = pd_header_type_le(msg->header);15071507+ unsigned int msgid = pd_header_msgid_le(msg->header);15081508+15091509+ /*15101510+ * USB PD standard, 6.6.1.2:15111511+ * "... if MessageID value in a received Message is the15121512+ * same as the stored value, the receiver shall return a15131513+ * GoodCRC Message with that MessageID value and drop15141514+ * the Message (this is a retry of an already received15151515+ * Message). Note: this shall not apply to the Soft_Reset15161516+ * Message which always has a MessageID value of zero."15171517+ */15181518+ if (msgid == port->rx_msgid && type != PD_CTRL_SOFT_RESET)15191519+ goto done;15201520+ port->rx_msgid = msgid;15211521+15191522 /*15201523 * If both ends believe to be DFP/host, we have a data role15211524 * mismatch.···15491520 }15501521 }1551152215231523+done:15521524 mutex_unlock(&port->lock);15531525 kfree(event);15541526}···17491719 }17501720 ma = min(ma, port->max_snk_ma);1751172117521752- /* XXX: Any other flags need to be set? */17531753- flags = 0;17221722+ flags = RDO_USB_COMM | RDO_NO_SUSPEND;1754172317551724 /* Set mismatch bit if offered power is less than operating power */17561725 mw = ma * mv / 1000;···19861957 port->attached = false;19871958 port->pd_capable = false;1988195919601960+ /*19611961+ * First Rx ID should be 0; set this to a sentinel of -1 so that19621962+ * we can check tcpm_pd_rx_handler() if we had seen it before.19631963+ */19641964+ port->rx_msgid = -1;19651965+19891966 port->tcpc->set_pd_rx(port->tcpc, false);19901967 tcpm_init_vbus(port); /* also disables charging */19911968 tcpm_init_vconn(port);···22052170 port->pwr_opmode = TYPEC_PWR_MODE_USB;22062171 port->caps_count = 0;22072172 port->message_id = 0;21732173+ port->rx_msgid = -1;22082174 port->explicit_contract = false;22092175 tcpm_set_state(port, SRC_SEND_CAPABILITIES, 0);22102176 break;···23652329 typec_set_pwr_opmode(port->typec_port, TYPEC_PWR_MODE_USB);23662330 port->pwr_opmode = TYPEC_PWR_MODE_USB;23672331 port->message_id = 0;23322332+ port->rx_msgid = -1;23682333 port->explicit_contract = false;23692334 tcpm_set_state(port, SNK_DISCOVERY, 0);23702335 break;···25332496 /* Soft_Reset states */25342497 case SOFT_RESET:25352498 port->message_id = 0;24992499+ port->rx_msgid = -1;25362500 tcpm_pd_send_control(port, PD_CTRL_ACCEPT);25372501 if (port->pwr_role == TYPEC_SOURCE)25382502 tcpm_set_state(port, SRC_SEND_CAPABILITIES, 0);···25422504 break;25432505 case SOFT_RESET_SEND:25442506 port->message_id = 0;25072507+ port->rx_msgid = -1;25452508 if (tcpm_pd_send_control(port, PD_CTRL_SOFT_RESET))25462509 tcpm_set_state_cond(port, hard_reset_state(port), 0);25472510 else···26072568 break;26082569 case PR_SWAP_SRC_SNK_SOURCE_OFF:26092570 tcpm_set_cc(port, TYPEC_CC_RD);25712571+ /*25722572+ * USB-PD standard, 6.2.1.4, Port Power Role:25732573+ * "During the Power Role Swap Sequence, for the initial Source25742574+ * Port, the Port Power Role field shall be set to Sink in the25752575+ * PS_RDY Message indicating that the initial Source’s power25762576+ * supply is turned off"25772577+ */25782578+ tcpm_set_pwr_role(port, TYPEC_SINK);26102579 if (tcpm_pd_send_control(port, PD_CTRL_PS_RDY)) {26112580 tcpm_set_state(port, ERROR_RECOVERY, 0);26122581 break;···26222575 tcpm_set_state_cond(port, SNK_UNATTACHED, PD_T_PS_SOURCE_ON);26232576 break;26242577 case PR_SWAP_SRC_SNK_SINK_ON:26252625- tcpm_set_pwr_role(port, TYPEC_SINK);26262578 tcpm_swap_complete(port, 0);26272579 tcpm_set_state(port, SNK_STARTUP, 0);26282580 break;···26332587 case PR_SWAP_SNK_SRC_SOURCE_ON:26342588 tcpm_set_cc(port, tcpm_rp_cc(port));26352589 tcpm_set_vbus(port, true);26362636- tcpm_pd_send_control(port, PD_CTRL_PS_RDY);25902590+ /*25912591+ * USB PD standard, 6.2.1.4:25922592+ * "Subsequent Messages initiated by the Policy Engine,25932593+ * such as the PS_RDY Message sent to indicate that Vbus25942594+ * is ready, will have the Port Power Role field set to25952595+ * Source."25962596+ */26372597 tcpm_set_pwr_role(port, TYPEC_SOURCE);25982598+ tcpm_pd_send_control(port, PD_CTRL_PS_RDY);26382599 tcpm_swap_complete(port, 0);26392600 tcpm_set_state(port, SRC_STARTUP, 0);26402601 break;···33453292 return nr_pdo;33463293}3347329432953295+static int tcpm_copy_vdos(u32 *dest_vdo, const u32 *src_vdo,32963296+ unsigned int nr_vdo)32973297+{32983298+ unsigned int i;32993299+33003300+ if (nr_vdo > VDO_MAX_OBJECTS)33013301+ nr_vdo = VDO_MAX_OBJECTS;33023302+33033303+ for (i = 0; i < nr_vdo; i++)33043304+ dest_vdo[i] = src_vdo[i];33053305+33063306+ return nr_vdo;33073307+}33083308+33483309void tcpm_update_source_capabilities(struct tcpm_port *port, const u32 *pdo,33493310 unsigned int nr_pdo)33503311{···34493382 tcpc->config->nr_src_pdo);34503383 port->nr_snk_pdo = tcpm_copy_pdos(port->snk_pdo, tcpc->config->snk_pdo,34513384 tcpc->config->nr_snk_pdo);33853385+ port->nr_snk_vdo = tcpm_copy_vdos(port->snk_vdo, tcpc->config->snk_vdo,33863386+ tcpc->config->nr_snk_vdo);3452338734533388 port->max_snk_mv = tcpc->config->max_snk_mv;34543389 port->max_snk_ma = tcpc->config->max_snk_ma;
+3
drivers/staging/typec/tcpm.h
···6060 const u32 *snk_pdo;6161 unsigned int nr_snk_pdo;62626363+ const u32 *snk_vdo;6464+ unsigned int nr_snk_vdo;6565+6366 unsigned int max_snk_mv;6467 unsigned int max_snk_ma;6568 unsigned int max_snk_mw;
···362362}363363364364/* USB 2.0 spec Section 11.24.4.5 */365365-static int get_hub_descriptor(struct usb_device *hdev, void *data)365365+static int get_hub_descriptor(struct usb_device *hdev,366366+ struct usb_hub_descriptor *desc)366367{367368 int i, ret, size;368369 unsigned dtype;···379378 for (i = 0; i < 3; i++) {380379 ret = usb_control_msg(hdev, usb_rcvctrlpipe(hdev, 0),381380 USB_REQ_GET_DESCRIPTOR, USB_DIR_IN | USB_RT_HUB,382382- dtype << 8, 0, data, size,381381+ dtype << 8, 0, desc, size,383382 USB_CTRL_GET_TIMEOUT);384384- if (ret >= (USB_DT_HUB_NONVAR_SIZE + 2))383383+ if (hub_is_superspeed(hdev)) {384384+ if (ret == size)385385+ return ret;386386+ } else if (ret >= USB_DT_HUB_NONVAR_SIZE + 2) {387387+ /* Make sure we have the DeviceRemovable field. */388388+ size = USB_DT_HUB_NONVAR_SIZE + desc->bNbrPorts / 8 + 1;389389+ if (ret < size)390390+ return -EMSGSIZE;385391 return ret;392392+ }386393 }387394 return -EINVAL;388395}···13221313 }13231314 mutex_init(&hub->status_mutex);1324131513251325- hub->descriptor = kmalloc(sizeof(*hub->descriptor), GFP_KERNEL);13161316+ hub->descriptor = kzalloc(sizeof(*hub->descriptor), GFP_KERNEL);13261317 if (!hub->descriptor) {13271318 ret = -ENOMEM;13281319 goto fail;···1330132113311322 /* Request the entire hub descriptor.13321323 * hub->descriptor can handle USB_MAXCHILDREN ports,13331333- * but the hub can/will return fewer bytes here.13241324+ * but a (non-SS) hub can/will return fewer bytes here.13341325 */13351326 ret = get_hub_descriptor(hdev, hub->descriptor);13361327 if (ret < 0) {13371328 message = "can't read hub descriptor";13381329 goto fail;13391339- } else if (hub->descriptor->bNbrPorts > USB_MAXCHILDREN) {13301330+ }13311331+13321332+ maxchild = USB_MAXCHILDREN;13331333+ if (hub_is_superspeed(hdev))13341334+ maxchild = min_t(unsigned, maxchild, USB_SS_MAXPORTS);13351335+13361336+ if (hub->descriptor->bNbrPorts > maxchild) {13401337 message = "hub has too many ports!";13411338 ret = -ENODEV;13421339 goto fail;
+3
drivers/usb/core/of.c
···5353 *5454 * Find the companion device from platform bus.5555 *5656+ * Takes a reference to the returned struct device which needs to be dropped5757+ * after use.5858+ *5659 * Return: On success, a pointer to the companion device, %NULL on failure.5760 */5861struct device *usb_of_get_companion_dev(struct device *dev)
+1-1
drivers/usb/core/urb.c
···338338 if (!urb || !urb->complete)339339 return -EINVAL;340340 if (urb->hcpriv) {341341- WARN_ONCE(1, "URB %p submitted while active\n", urb);341341+ WARN_ONCE(1, "URB %pK submitted while active\n", urb);342342 return -EBUSY;343343 }344344
+4
drivers/usb/dwc3/dwc3-keystone.c
···107107 return PTR_ERR(kdwc->usbss);108108109109 kdwc->clk = devm_clk_get(kdwc->dev, "usb");110110+ if (IS_ERR(kdwc->clk)) {111111+ dev_err(kdwc->dev, "unable to get usb clock\n");112112+ return PTR_ERR(kdwc->clk);113113+ }110114111115 error = clk_prepare_enable(kdwc->clk);112116 if (error < 0) {
···419419 wait_for_completion(cmd->completion);420420421421 if (cmd->status == COMP_COMMAND_ABORTED ||422422- cmd->status == COMP_STOPPED) {422422+ cmd->status == COMP_COMMAND_RING_STOPPED) {423423 xhci_warn(xhci, "Timeout while waiting for stop endpoint command\n");424424 ret = -ETIME;425425 }
+6-5
drivers/usb/host/xhci-mem.c
···5656 }57575858 if (max_packet) {5959- seg->bounce_buf = kzalloc(max_packet, flags | GFP_DMA);5959+ seg->bounce_buf = kzalloc(max_packet, flags);6060 if (!seg->bounce_buf) {6161 dma_pool_free(xhci->segment_pool, seg->trbs, dma);6262 kfree(seg);···17241724 xhci->dcbaa->dev_context_ptrs[0] = cpu_to_le64(xhci->scratchpad->sp_dma);17251725 for (i = 0; i < num_sp; i++) {17261726 dma_addr_t dma;17271727- void *buf = dma_alloc_coherent(dev, xhci->page_size, &dma,17271727+ void *buf = dma_zalloc_coherent(dev, xhci->page_size, &dma,17281728 flags);17291729 if (!buf)17301730 goto fail_sp4;···23072307 /* Place limits on the number of roothub ports so that the hub23082308 * descriptors aren't longer than the USB core will allocate.23092309 */23102310- if (xhci->num_usb3_ports > 15) {23102310+ if (xhci->num_usb3_ports > USB_SS_MAXPORTS) {23112311 xhci_dbg_trace(xhci, trace_xhci_dbg_init,23122312- "Limiting USB 3.0 roothub ports to 15.");23132313- xhci->num_usb3_ports = 15;23122312+ "Limiting USB 3.0 roothub ports to %u.",23132313+ USB_SS_MAXPORTS);23142314+ xhci->num_usb3_ports = USB_SS_MAXPORTS;23142315 }23152316 if (xhci->num_usb2_ports > USB_MAXCHILDREN) {23162317 xhci_dbg_trace(xhci, trace_xhci_dbg_init,
···177177178178 irq = platform_get_irq(pdev, 0);179179 if (irq < 0)180180- return -ENODEV;180180+ return irq;181181182182 /*183183 * sysdev must point to a device that is known to the system firmware
+9-11
drivers/usb/host/xhci-ring.c
···323323 if (i_cmd->status != COMP_COMMAND_ABORTED)324324 continue;325325326326- i_cmd->status = COMP_STOPPED;326326+ i_cmd->status = COMP_COMMAND_RING_STOPPED;327327328328 xhci_dbg(xhci, "Turn aborted command %p to no-op\n",329329 i_cmd->command_trb);···641641 xhci_urb_free_priv(urb_priv);642642 usb_hcd_unlink_urb_from_ep(hcd, urb);643643 spin_unlock(&xhci->lock);644644- usb_hcd_giveback_urb(hcd, urb, status);645644 trace_xhci_urb_giveback(urb);645645+ usb_hcd_giveback_urb(hcd, urb, status);646646 spin_lock(&xhci->lock);647647}648648···13801380 cmd_comp_code = GET_COMP_CODE(le32_to_cpu(event->status));1381138113821382 /* If CMD ring stopped we own the trbs between enqueue and dequeue */13831383- if (cmd_comp_code == COMP_STOPPED) {13831383+ if (cmd_comp_code == COMP_COMMAND_RING_STOPPED) {13841384 complete_all(&xhci->cmd_ring_stop_completion);13851385 return;13861386 }···14361436 break;14371437 case TRB_CMD_NOOP:14381438 /* Is this an aborted command turned to NO-OP? */14391439- if (cmd->status == COMP_STOPPED)14401440- cmd_comp_code = COMP_STOPPED;14391439+ if (cmd->status == COMP_COMMAND_RING_STOPPED)14401440+ cmd_comp_code = COMP_COMMAND_RING_STOPPED;14411441 break;14421442 case TRB_RESET_EP:14431443 WARN_ON(slot_id != TRB_TO_SLOT_ID(···26772677 struct xhci_hcd *xhci = hcd_to_xhci(hcd);26782678 union xhci_trb *event_ring_deq;26792679 irqreturn_t ret = IRQ_NONE;26802680+ unsigned long flags;26802681 dma_addr_t deq;26812682 u64 temp_64;26822683 u32 status;2683268426842684- spin_lock(&xhci->lock);26852685+ spin_lock_irqsave(&xhci->lock, flags);26852686 /* Check if the xHC generated the interrupt, or the irq is shared */26862687 status = readl(&xhci->op_regs->status);26872688 if (status == ~(u32)0) {···27082707 */27092708 status |= STS_EINT;27102709 writel(status, &xhci->op_regs->status);27112711- /* FIXME when MSI-X is supported and there are multiple vectors */27122712- /* Clear the MSI-X event interrupt status */2713271027142714- if (hcd->irq) {27112711+ if (!hcd->msi_enabled) {27152712 u32 irq_pending;27162716- /* Acknowledge the PCI interrupt */27172713 irq_pending = readl(&xhci->ir_set->irq_pending);27182714 irq_pending |= IMAN_IP;27192715 writel(irq_pending, &xhci->ir_set->irq_pending);···27552757 ret = IRQ_HANDLED;2756275827572759out:27582758- spin_unlock(&xhci->lock);27602760+ spin_unlock_irqrestore(&xhci->lock, flags);2759276127602762 return ret;27612763}
+7-6
drivers/usb/host/xhci.c
···359359 /* fall back to msi*/360360 ret = xhci_setup_msi(xhci);361361362362- if (!ret)363363- /* hcd->irq is 0, we have MSI */362362+ if (!ret) {363363+ hcd->msi_enabled = 1;364364 return 0;365365+ }365366366367 if (!pdev->irq) {367368 xhci_err(xhci, "No msi-x/msi found and no IRQ in BIOS\n");···1764176317651764 switch (*cmd_status) {17661765 case COMP_COMMAND_ABORTED:17671767- case COMP_STOPPED:17661766+ case COMP_COMMAND_RING_STOPPED:17681767 xhci_warn(xhci, "Timeout while waiting for configure endpoint command\n");17691768 ret = -ETIME;17701769 break;···1814181318151814 switch (*cmd_status) {18161815 case COMP_COMMAND_ABORTED:18171817- case COMP_STOPPED:18161816+ case COMP_COMMAND_RING_STOPPED:18181817 xhci_warn(xhci, "Timeout while waiting for evaluate context command\n");18191818 ret = -ETIME;18201819 break;···34333432 ret = reset_device_cmd->status;34343433 switch (ret) {34353434 case COMP_COMMAND_ABORTED:34363436- case COMP_STOPPED:34353435+ case COMP_COMMAND_RING_STOPPED:34373436 xhci_warn(xhci, "Timeout waiting for reset device command\n");34383437 ret = -ETIME;34393438 goto command_cleanup;···38183817 */38193818 switch (command->status) {38203819 case COMP_COMMAND_ABORTED:38213821- case COMP_STOPPED:38203820+ case COMP_COMMAND_RING_STOPPED:38223821 xhci_warn(xhci, "Timeout while waiting for setup device command\n");38233822 ret = -ETIME;38243823 break;
+1-1
drivers/usb/misc/chaoskey.c
···192192193193 dev->in_ep = in_ep;194194195195- if (udev->descriptor.idVendor != ALEA_VENDOR_ID)195195+ if (le16_to_cpu(udev->descriptor.idVendor) != ALEA_VENDOR_ID)196196 dev->reads_started = 1;197197198198 dev->size = size;
···341341static342342int i1480_usb_probe(struct usb_interface *iface, const struct usb_device_id *id)343343{344344+ struct usb_device *udev = interface_to_usbdev(iface);344345 struct i1480_usb *i1480_usb;345346 struct i1480 *i1480;346347 struct device *dev = &iface->dev;···353352 iface->cur_altsetting->desc.bInterfaceNumber);354353 goto error;355354 }356356- if (iface->num_altsetting > 1357357- && interface_to_usbdev(iface)->descriptor.idProduct == 0xbabe) {355355+ if (iface->num_altsetting > 1 &&356356+ le16_to_cpu(udev->descriptor.idProduct) == 0xbabe) {358357 /* Need altsetting #1 [HW QUIRK] or EP1 won't work */359358 result = usb_set_interface(interface_to_usbdev(iface), 0, 1);360359 if (result < 0)
+1-1
drivers/watchdog/Kconfig
···452452453453config ORION_WATCHDOG454454 tristate "Orion watchdog"455455- depends on ARCH_ORION5X || ARCH_DOVE || MACH_DOVE || ARCH_MVEBU || COMPILE_TEST455455+ depends on ARCH_ORION5X || ARCH_DOVE || MACH_DOVE || ARCH_MVEBU || (COMPILE_TEST && !ARCH_EBSA110)456456 depends on ARM457457 select WATCHDOG_CORE458458 help
+2-1
drivers/watchdog/bcm_kona_wdt.c
···304304 if (!wdt)305305 return -ENOMEM;306306307307+ spin_lock_init(&wdt->lock);308308+307309 res = platform_get_resource(pdev, IORESOURCE_MEM, 0);308310 wdt->base = devm_ioremap_resource(dev, res);309311 if (IS_ERR(wdt->base))···318316 return ret;319317 }320318321321- spin_lock_init(&wdt->lock);322319 platform_set_drvdata(pdev, wdt);323320 watchdog_set_drvdata(&bcm_kona_wdt_wdd, wdt);324321 bcm_kona_wdt_wdd.parent = &pdev->dev;
+1-1
drivers/watchdog/cadence_wdt.c
···4949/* Counter maximum value */5050#define CDNS_WDT_COUNTER_MAX 0xFFF51515252-static int wdt_timeout = CDNS_WDT_DEFAULT_TIMEOUT;5252+static int wdt_timeout;5353static int nowayout = WATCHDOG_NOWAYOUT;54545555module_param(wdt_timeout, int, 0);
+11-13
drivers/watchdog/iTCO_wdt.c
···306306307307 iTCO_vendor_pre_keepalive(p->smi_res, wd_dev->timeout);308308309309- /* Reload the timer by writing to the TCO Timer Counter register */310310- if (p->iTCO_version >= 2) {311311- outw(0x01, TCO_RLD(p));312312- } else if (p->iTCO_version == 1) {313313- /* Reset the timeout status bit so that the timer314314- * needs to count down twice again before rebooting */315315- outw(0x0008, TCO1_STS(p)); /* write 1 to clear bit */309309+ /* Reset the timeout status bit so that the timer310310+ * needs to count down twice again before rebooting */311311+ outw(0x0008, TCO1_STS(p)); /* write 1 to clear bit */316312313313+ /* Reload the timer by writing to the TCO Timer Counter register */314314+ if (p->iTCO_version >= 2)315315+ outw(0x01, TCO_RLD(p));316316+ else if (p->iTCO_version == 1)317317 outb(0x01, TCO_RLD(p));318318- }319318320319 spin_unlock(&p->io_lock);321320 return 0;···327328 unsigned char val8;328329 unsigned int tmrval;329330330330- tmrval = seconds_to_ticks(p, t);331331-332332- /* For TCO v1 the timer counts down twice before rebooting */333333- if (p->iTCO_version == 1)334334- tmrval /= 2;331331+ /* The timer counts down twice before rebooting */332332+ tmrval = seconds_to_ticks(p, t) / 2;335333336334 /* from the specs: */337335 /* "Values of 0h-3h are ignored and should not be attempted" */···381385 spin_lock(&p->io_lock);382386 val16 = inw(TCO_RLD(p));383387 val16 &= 0x3ff;388388+ if (!(inw(TCO1_STS(p)) & 0x0008))389389+ val16 += (inw(TCOv2_TMR(p)) & 0x3ff);384390 spin_unlock(&p->io_lock);385391386392 time_left = ticks_to_seconds(p, val16);
+3
drivers/watchdog/pcwd_usb.c
···630630 return -ENODEV;631631 }632632633633+ if (iface_desc->desc.bNumEndpoints < 1)634634+ return -ENODEV;635635+633636 /* check out the endpoint: it has to be Interrupt & IN */634637 endpoint = &iface_desc->endpoint[0].desc;635638
+57-20
drivers/watchdog/sama5d4_wdt.c
···66 * Licensed under GPLv2.77 */8899+#include <linux/delay.h>910#include <linux/interrupt.h>1011#include <linux/io.h>1112#include <linux/kernel.h>···3029 struct watchdog_device wdd;3130 void __iomem *reg_base;3231 u32 mr;3232+ unsigned long last_ping;3333};34343535static int wdt_timeout = WDT_DEFAULT_TIMEOUT;···4644 "Watchdog cannot be stopped once started (default="4745 __MODULE_STRING(WATCHDOG_NOWAYOUT) ")");48464747+#define wdt_enabled (!(wdt->mr & AT91_WDT_WDDIS))4848+4949#define wdt_read(wdt, field) \5050 readl_relaxed((wdt)->reg_base + (field))51515252-#define wdt_write(wtd, field, val) \5353- writel_relaxed((val), (wdt)->reg_base + (field))5252+/* 4 slow clock periods is 4/32768 = 122.07µs*/5353+#define WDT_DELAY usecs_to_jiffies(123)5454+5555+static void wdt_write(struct sama5d4_wdt *wdt, u32 field, u32 val)5656+{5757+ /*5858+ * WDT_CR and WDT_MR must not be modified within three slow clock5959+ * periods following a restart of the watchdog performed by a write6060+ * access in WDT_CR.6161+ */6262+ while (time_before(jiffies, wdt->last_ping + WDT_DELAY))6363+ usleep_range(30, 125);6464+ writel_relaxed(val, wdt->reg_base + field);6565+ wdt->last_ping = jiffies;6666+}6767+6868+static void wdt_write_nosleep(struct sama5d4_wdt *wdt, u32 field, u32 val)6969+{7070+ if (time_before(jiffies, wdt->last_ping + WDT_DELAY))7171+ udelay(123);7272+ writel_relaxed(val, wdt->reg_base + field);7373+ wdt->last_ping = jiffies;7474+}54755576static int sama5d4_wdt_start(struct watchdog_device *wdd)5677{···11489 wdt->mr &= ~AT91_WDT_WDD;11590 wdt->mr |= AT91_WDT_SET_WDV(value);11691 wdt->mr |= AT91_WDT_SET_WDD(value);117117- wdt_write(wdt, AT91_WDT_MR, wdt->mr);9292+9393+ /*9494+ * WDDIS has to be 0 when updating WDD/WDV. The datasheet states: When9595+ * setting the WDDIS bit, and while it is set, the fields WDV and WDD9696+ * must not be modified.9797+ * If the watchdog is enabled, then the timeout can be updated. Else,9898+ * wait that the user enables it.9999+ */100100+ if (wdt_enabled)101101+ wdt_write(wdt, AT91_WDT_MR, wdt->mr & ~AT91_WDT_WDDIS);118102119103 wdd->timeout = timeout;120104···179145180146static int sama5d4_wdt_init(struct sama5d4_wdt *wdt)181147{182182- struct watchdog_device *wdd = &wdt->wdd;183183- u32 value = WDT_SEC2TICKS(wdd->timeout);184148 u32 reg;185185-186149 /*187187- * Because the fields WDV and WDD must not be modified when the WDDIS188188- * bit is set, so clear the WDDIS bit before writing the WDT_MR.150150+ * When booting and resuming, the bootloader may have changed the151151+ * watchdog configuration.152152+ * If the watchdog is already running, we can safely update it.153153+ * Else, we have to disable it properly.189154 */190190- reg = wdt_read(wdt, AT91_WDT_MR);191191- reg &= ~AT91_WDT_WDDIS;192192- wdt_write(wdt, AT91_WDT_MR, reg);193193-194194- wdt->mr |= AT91_WDT_SET_WDD(value);195195- wdt->mr |= AT91_WDT_SET_WDV(value);196196-197197- wdt_write(wdt, AT91_WDT_MR, wdt->mr);198198-155155+ if (wdt_enabled) {156156+ wdt_write_nosleep(wdt, AT91_WDT_MR, wdt->mr);157157+ } else {158158+ reg = wdt_read(wdt, AT91_WDT_MR);159159+ if (!(reg & AT91_WDT_WDDIS))160160+ wdt_write_nosleep(wdt, AT91_WDT_MR,161161+ reg | AT91_WDT_WDDIS);162162+ }199163 return 0;200164}201165···204172 struct resource *res;205173 void __iomem *regs;206174 u32 irq = 0;175175+ u32 timeout;207176 int ret;208177209178 wdt = devm_kzalloc(&pdev->dev, sizeof(*wdt), GFP_KERNEL);···217184 wdd->ops = &sama5d4_wdt_ops;218185 wdd->min_timeout = MIN_WDT_TIMEOUT;219186 wdd->max_timeout = MAX_WDT_TIMEOUT;187187+ wdt->last_ping = jiffies;220188221189 watchdog_set_drvdata(wdd, wdt);222190···254220 dev_err(&pdev->dev, "unable to set timeout value\n");255221 return ret;256222 }223223+224224+ timeout = WDT_SEC2TICKS(wdd->timeout);225225+226226+ wdt->mr |= AT91_WDT_SET_WDD(timeout);227227+ wdt->mr |= AT91_WDT_SET_WDV(timeout);257228258229 ret = sama5d4_wdt_init(wdt);259230 if (ret)···302263{303264 struct sama5d4_wdt *wdt = dev_get_drvdata(dev);304265305305- wdt_write(wdt, AT91_WDT_MR, wdt->mr & ~AT91_WDT_WDDIS);306306- if (wdt->mr & AT91_WDT_WDDIS)307307- wdt_write(wdt, AT91_WDT_MR, wdt->mr);266266+ sama5d4_wdt_init(wdt);308267309268 return 0;310269}
+1-1
drivers/watchdog/wdt_pci.c
···332332 pr_crit("Would Reboot\n");333333#else334334 pr_crit("Initiating system reboot\n");335335- emergency_restart(NULL);335335+ emergency_restart();336336#endif337337#else338338 pr_crit("Reset in 5ms\n");
+1-3
drivers/watchdog/zx2967_wdt.c
···211211212212 base = platform_get_resource(pdev, IORESOURCE_MEM, 0);213213 wdt->reg_base = devm_ioremap_resource(dev, base);214214- if (IS_ERR(wdt->reg_base)) {215215- dev_err(dev, "ioremap failed\n");214214+ if (IS_ERR(wdt->reg_base))216215 return PTR_ERR(wdt->reg_base);217217- }218216219217 zx2967_wdt_reset_sysctrl(dev);220218
···975975 int err;976976 char *suffix = "";977977978978- if (sb->s_bdev)978978+ if (sb->s_bdev) {979979 suffix = "-fuseblk";980980+ /*981981+ * sb->s_bdi points to blkdev's bdi however we want to redirect982982+ * it to our private bdi...983983+ */984984+ bdi_put(sb->s_bdi);985985+ sb->s_bdi = &noop_backing_dev_info;986986+ }980987 err = super_setup_bdi_name(sb, "%u:%u%s", MAJOR(fc->dev),981988 MINOR(fc->dev), suffix);982989 if (err)
+2-2
fs/xfs/xfs_iomap.c
···10681068 /* optionally associate a dax device with the iomap bdev */10691069 bdev = iomap->bdev;10701070 if (blk_queue_dax(bdev->bd_queue))10711071- iomap->dax_dev = dax_get_by_host(bdev->bd_disk->disk_name);10711071+ iomap->dax_dev = fs_dax_get_by_host(bdev->bd_disk->disk_name);10721072 else10731073 iomap->dax_dev = NULL;10741074···11491149 unsigned flags,11501150 struct iomap *iomap)11511151{11521152- put_dax(iomap->dax_dev);11521152+ fs_put_dax(iomap->dax_dev);11531153 if ((flags & IOMAP_WRITE) && iomap->type == IOMAP_DELALLOC)11541154 return xfs_file_iomap_end_delalloc(XFS_I(inode), offset,11551155 length, written, iomap);
+4-1
include/kvm/arm_vgic.h
···195195 /* either a GICv2 CPU interface */196196 gpa_t vgic_cpu_base;197197 /* or a number of GICv3 redistributor regions */198198- gpa_t vgic_redist_base;198198+ struct {199199+ gpa_t vgic_redist_base;200200+ gpa_t vgic_redist_free_offset;201201+ };199202 };200203201204 /* distributor enabled */
···349349 int write, void __user *buffer,350350 size_t *length, loff_t *ppos);351351#endif352352+extern void wait_for_kprobe_optimizer(void);353353+#else354354+static inline void wait_for_kprobe_optimizer(void) { }352355#endif /* CONFIG_OPTPROBES */353356#ifdef CONFIG_KPROBES_ON_FTRACE354357extern void kprobe_ftrace_handler(unsigned long ip, unsigned long parent_ip,
+1-1
include/linux/netfilter/x_tables.h
···294294int xt_target_to_user(const struct xt_entry_target *t,295295 struct xt_entry_target __user *u);296296int xt_data_to_user(void __user *dst, const void *src,297297- int usersize, int size);297297+ int usersize, int size, int aligned_size);298298299299void *xt_copy_counters_from_user(const void __user *user, unsigned int len,300300 struct xt_counters_info *info, bool compat);
+5
include/linux/netfilter_bridge/ebtables.h
···125125/* True if the target is not a standard target */126126#define INVALID_TARGET (info->target < -NUM_STANDARD_TARGETS || info->target >= 0)127127128128+static inline bool ebt_invalid_target(int target)129129+{130130+ return (target < -NUM_STANDARD_TARGETS || target >= 0);131131+}132132+128133#endif
+4-12
include/linux/nvme-fc-driver.h
···27272828/* FC Port role bitmask - can merge with FC Port Roles in fc transport */2929#define FC_PORT_ROLE_NVME_INITIATOR 0x103030-#define FC_PORT_ROLE_NVME_TARGET 0x113131-#define FC_PORT_ROLE_NVME_DISCOVERY 0x123030+#define FC_PORT_ROLE_NVME_TARGET 0x203131+#define FC_PORT_ROLE_NVME_DISCOVERY 0x40323233333434/**···642642 * sequence in one LLDD operation. Errors during Data643643 * sequence transmit must not allow RSP sequence to be sent.644644 */645645- NVMET_FCTGTFEAT_NEEDS_CMD_CPUSCHED = (1 << 1),646646- /* Bit 1: When 0, the LLDD will deliver FCP CMD647647- * on the CPU it should be affinitized to. Thus work will648648- * be scheduled on the cpu received on. When 1, the LLDD649649- * may not deliver the CMD on the CPU it should be worked650650- * on. The transport should pick a cpu to schedule the work651651- * on.652652- */653653- NVMET_FCTGTFEAT_CMD_IN_ISR = (1 << 2),645645+ NVMET_FCTGTFEAT_CMD_IN_ISR = (1 << 1),654646 /* Bit 2: When 0, the LLDD is calling the cmd rcv handler655647 * in a non-isr context, allowing the transport to finish656648 * op completion in the calling context. When 1, the LLDD···650658 * requiring the transport to transition to a workqueue651659 * for op completion.652660 */653653- NVMET_FCTGTFEAT_OPDONE_IN_ISR = (1 << 3),661661+ NVMET_FCTGTFEAT_OPDONE_IN_ISR = (1 << 2),654662 /* Bit 3: When 0, the LLDD is calling the op done handler655663 * in a non-isr context, allowing the transport to finish656664 * op completion in the calling context. When 1, the LLDD
+1-1
include/linux/of_irq.h
···88#include <linux/ioport.h>99#include <linux/of.h>10101111-typedef int const (*of_irq_init_cb_t)(struct device_node *, struct device_node *);1111+typedef int (*of_irq_init_cb_t)(struct device_node *, struct device_node *);12121313/*1414 * Workarounds only applied to 32bit powermac machines
···148148 unsigned rh_registered:1;/* is root hub registered? */149149 unsigned rh_pollable:1; /* may we poll the root hub? */150150 unsigned msix_enabled:1; /* driver has MSI-X enabled? */151151+ unsigned msi_enabled:1; /* driver has MSI enabled? */151152 unsigned remove_phy:1; /* auto-remove USB phy */152153153154 /* The next flag is a stopgap, to be removed when all the HCDs
···2222 */2323#define USB_MAXCHILDREN 3124242525+/* See USB 3.1 spec Table 10-5 */2626+#define USB_SS_MAXPORTS 152727+2528/*2629 * Hub request types2730 */
+8-4
kernel/bpf/verifier.c
···808808 reg_off += reg->aux_off;809809 }810810811811- /* skb->data is NET_IP_ALIGN-ed, but for strict alignment checking812812- * we force this to 2 which is universally what architectures use813813- * 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'.814818 */815815- ip_align = strict ? 2 : NET_IP_ALIGN;819819+ ip_align = 2;816820 if ((ip_align + reg_off + off) % size != 0) {817821 verbose("misaligned packet access off %d+%d+%d size %d\n",818822 ip_align, reg_off, off, size);
···595595}596596597597/* Wait for completing optimization and unoptimization */598598-static void wait_for_kprobe_optimizer(void)598598+void wait_for_kprobe_optimizer(void)599599{600600 mutex_lock(&kprobe_mutex);601601···21832183 * The vaddr this probe is installed will soon21842184 * be vfreed buy not synced to disk. Hence,21852185 * disarming the breakpoint isn't needed.21862186+ *21872187+ * Note, this will also move any optimized probes21882188+ * that are pending to be removed from their21892189+ * corresponding lists to the freeing_list and21902190+ * will not be touched by the delayed21912191+ * kprobe_optimizer work handler.21862192 */21872193 kill_kprobe(p);21882194 }
+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)
+25
kernel/sched/core.c
···35023502}35033503EXPORT_SYMBOL(schedule);3504350435053505+/*35063506+ * synchronize_rcu_tasks() makes sure that no task is stuck in preempted35073507+ * state (have scheduled out non-voluntarily) by making sure that all35083508+ * tasks have either left the run queue or have gone into user space.35093509+ * As idle tasks do not do either, they must not ever be preempted35103510+ * (schedule out non-voluntarily).35113511+ *35123512+ * schedule_idle() is similar to schedule_preempt_disable() except that it35133513+ * never enables preemption because it does not call sched_submit_work().35143514+ */35153515+void __sched schedule_idle(void)35163516+{35173517+ /*35183518+ * As this skips calling sched_submit_work(), which the idle task does35193519+ * regardless because that function is a nop when the task is in a35203520+ * TASK_RUNNING state, make sure this isn't used someplace that the35213521+ * current task can be in any other state. Note, idle is always in the35223522+ * TASK_RUNNING state.35233523+ */35243524+ WARN_ON_ONCE(current->state);35253525+ do {35263526+ __schedule(false);35273527+ } while (need_resched());35283528+}35293529+35053530#ifdef CONFIG_CONTEXT_TRACKING35063531asmlinkage __visible void __sched schedule_user(void)35073532{
+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 }
+1-1
kernel/sched/idle.c
···265265 smp_mb__after_atomic();266266267267 sched_ttwu_pending();268268- schedule_preempt_disabled();268268+ schedule_idle();269269270270 if (unlikely(klp_patch_pending(current)))271271 klp_update_patch_state(current);
···16621662 goto out;1663166316641664 if (attr == &dev_attr_act_mask) {16651665- if (sscanf(buf, "%llx", &value) != 1) {16651665+ if (kstrtoull(buf, 0, &value)) {16661666 /* Assume it is a list of trace category names */16671667 ret = blk_trace_str2mask(buf);16681668 if (ret < 0)16691669 goto out;16701670 value = ret;16711671 }16721672- } else if (sscanf(buf, "%llu", &value) != 1)16721672+ } else if (kstrtoull(buf, 0, &value))16731673 goto out;1674167416751675 ret = -ENXIO;
+10-2
kernel/trace/ftrace.c
···41444144 int i, ret = -ENODEV;41454145 int size;4146414641474147- if (glob && (strcmp(glob, "*") == 0 || !strlen(glob)))41474147+ if (!glob || !strlen(glob) || !strcmp(glob, "*"))41484148 func_g.search = NULL;41494149- else if (glob) {41494149+ else {41504150 int not;4151415141524152 func_g.type = filter_parse_regex(glob, strlen(glob),···42544254 err_unlock_ftrace:42554255 mutex_unlock(&ftrace_lock);42564256 return ret;42574257+}42584258+42594259+void clear_ftrace_function_probes(struct trace_array *tr)42604260+{42614261+ struct ftrace_func_probe *probe, *n;42624262+42634263+ list_for_each_entry_safe(probe, n, &tr->func_probes, list)42644264+ unregister_ftrace_function_probe_func(NULL, tr, probe->probe_ops);42574265}4258426642594267static LIST_HEAD(ftrace_commands);
+32-2
kernel/trace/trace.c
···1558155815591559 return 0;15601560}15611561-early_initcall(init_trace_selftests);15611561+core_initcall(init_trace_selftests);15621562#else15631563static inline int run_tracer_selftest(struct tracer *type)15641564{···25682568void __trace_stack(struct trace_array *tr, unsigned long flags, int skip,25692569 int pc)25702570{25712571- __ftrace_trace_stack(tr->trace_buffer.buffer, flags, skip, pc, NULL);25712571+ struct ring_buffer *buffer = tr->trace_buffer.buffer;25722572+25732573+ if (rcu_is_watching()) {25742574+ __ftrace_trace_stack(buffer, flags, skip, pc, NULL);25752575+ return;25762576+ }25772577+25782578+ /*25792579+ * When an NMI triggers, RCU is enabled via rcu_nmi_enter(),25802580+ * but if the above rcu_is_watching() failed, then the NMI25812581+ * triggered someplace critical, and rcu_irq_enter() should25822582+ * not be called from NMI.25832583+ */25842584+ if (unlikely(in_nmi()))25852585+ return;25862586+25872587+ /*25882588+ * It is possible that a function is being traced in a25892589+ * location that RCU is not watching. A call to25902590+ * rcu_irq_enter() will make sure that it is, but there's25912591+ * a few internal rcu functions that could be traced25922592+ * where that wont work either. In those cases, we just25932593+ * do nothing.25942594+ */25952595+ if (unlikely(rcu_irq_enter_disabled()))25962596+ return;25972597+25982598+ rcu_irq_enter_irqson();25992599+ __ftrace_trace_stack(buffer, flags, skip, pc, NULL);26002600+ rcu_irq_exit_irqson();25722601}2573260225742603/**···75797550 }7580755175817552 tracing_set_nop(tr);75537553+ clear_ftrace_function_probes(tr);75827554 event_trace_del_tracer(tr);75837555 ftrace_clear_pids(tr);75847556 ftrace_destroy_function_files(tr);
+5
kernel/trace/trace.h
···980980extern int981981unregister_ftrace_function_probe_func(char *glob, struct trace_array *tr,982982 struct ftrace_probe_ops *ops);983983+extern void clear_ftrace_function_probes(struct trace_array *tr);983984984985int register_ftrace_command(struct ftrace_func_command *cmd);985986int unregister_ftrace_command(struct ftrace_func_command *cmd);···999998{1000999 return -EINVAL;10011000}10011001+static inline void clear_ftrace_function_probes(struct trace_array *tr)10021002+{10031003+}10041004+10021005/*10031006 * The ops parameter passed in is usually undefined.10041007 * This must be a macro.
+5
kernel/trace/trace_kprobe.c
···1535153515361536end:15371537 release_all_trace_kprobes();15381538+ /*15391539+ * Wait for the optimizer work to finish. Otherwise it might fiddle15401540+ * with probes in already freed __init text.15411541+ */15421542+ wait_for_kprobe_optimizer();15381543 if (warn)15391544 pr_cont("NG: Some tests are failed. Please check them.\n");15401545 else
+4-4
net/9p/trans_xen.c
···454454 goto error_xenbus;455455 }456456 priv->tag = xenbus_read(xbt, dev->nodename, "tag", NULL);457457- if (!priv->tag) {458458- ret = -EINVAL;457457+ if (IS_ERR(priv->tag)) {458458+ ret = PTR_ERR(priv->tag);459459 goto error_xenbus;460460 }461461 ret = xenbus_transaction_end(xbt, 0);···525525 .otherend_changed = xen_9pfs_front_changed,526526};527527528528-int p9_trans_xen_init(void)528528+static int p9_trans_xen_init(void)529529{530530 if (!xen_domain())531531 return -ENODEV;···537537}538538module_init(p9_trans_xen_init);539539540540-void p9_trans_xen_exit(void)540540+static void p9_trans_xen_exit(void)541541{542542 v9fs_unregister_trans(&p9_xen_trans);543543 return xenbus_unregister_driver(&xen_9pfs_front_driver);
+1
net/bridge/br_stp_if.c
···173173 br_debug(br, "using kernel STP\n");174174175175 /* To start timers on any ports left in blocking */176176+ mod_timer(&br->hello_timer, jiffies + br->hello_time);176177 br_port_state_selection(br);177178 }178179
+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+ if (n || IN_DEV_ARP_ACCEPT(in_dev)) {841841+ addr_type = -1;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
+4
net/ipv4/tcp.c
···23202320 tcp_set_ca_state(sk, TCP_CA_Open);23212321 tcp_clear_retrans(tp);23222322 inet_csk_delack_init(sk);23232323+ /* Initialize rcv_mss to TCP_MIN_MSS to avoid division by 023242324+ * issue in __tcp_select_window()23252325+ */23262326+ icsk->icsk_ack.rcv_mss = TCP_MIN_MSS;23232327 tcp_init_send_head(sk);23242328 memset(&tp->rx_opt, 0, sizeof(tp->rx_opt));23252329 __sk_dst_reset(sk);
···873873 while (size--)874874 reg = (reg << 32) | fdt32_to_cpu(*(cells++));875875876876- snprintf(unit_addr, sizeof(unit_addr), "%lx", reg);876876+ snprintf(unit_addr, sizeof(unit_addr), "%zx", reg);877877 if (!streq(unitname, unit_addr))878878 FAIL(c, dti, "Node %s simple-bus unit address format error, expected \"%s\"",879879 node->fullpath, unit_addr);
-4
sound/x86/intel_hdmi_audio.c
···18091809 pdata->notify_pending = false;18101810 spin_unlock_irq(&pdata->lpe_audio_slock);1811181118121812- /* runtime PM isn't enabled as default, since it won't save much on18131813- * BYT/CHT devices; user who want the runtime PM should adjust the18141814- * power/ontrol and power/autosuspend_delay_ms sysfs entries instead18151815- */18161812 pm_runtime_use_autosuspend(&pdev->dev);18171813 pm_runtime_mark_last_busy(&pdev->dev);18181814 pm_runtime_set_active(&pdev->dev);
···295295 assert_spin_locked(&kvm->mmu_lock);296296 pgd = kvm->arch.pgd + stage2_pgd_index(addr);297297 do {298298+ /*299299+ * Make sure the page table is still active, as another thread300300+ * could have possibly freed the page table, while we released301301+ * the lock.302302+ */303303+ if (!READ_ONCE(kvm->arch.pgd))304304+ break;298305 next = stage2_pgd_addr_end(addr, end);299306 if (!stage2_pgd_none(*pgd))300307 unmap_stage2_puds(kvm, pgd, addr, next);···836829 * Walks the level-1 page table pointed to by kvm->arch.pgd and frees all837830 * underlying level-2 and level-3 tables before freeing the actual level-1 table838831 * and setting the struct pointer to NULL.839839- *840840- * Note we don't need locking here as this is only called when the VM is841841- * destroyed, which can only be done once.842832 */843833void kvm_free_stage2_pgd(struct kvm *kvm)844834{845845- if (kvm->arch.pgd == NULL)846846- return;835835+ void *pgd = NULL;847836848837 spin_lock(&kvm->mmu_lock);849849- unmap_stage2_range(kvm, 0, KVM_PHYS_SIZE);838838+ if (kvm->arch.pgd) {839839+ unmap_stage2_range(kvm, 0, KVM_PHYS_SIZE);840840+ pgd = READ_ONCE(kvm->arch.pgd);841841+ kvm->arch.pgd = NULL;842842+ }850843 spin_unlock(&kvm->mmu_lock);851844852845 /* Free the HW pgd, one page at a time */853853- free_pages_exact(kvm->arch.pgd, S2_PGD_SIZE);854854- kvm->arch.pgd = NULL;846846+ if (pgd)847847+ free_pages_exact(pgd, S2_PGD_SIZE);855848}856849857850static pud_t *stage2_get_pud(struct kvm *kvm, struct kvm_mmu_memory_cache *cache,···11771170 * large. Otherwise, we may see kernel panics with11781171 * CONFIG_DETECT_HUNG_TASK, CONFIG_LOCKUP_DETECTOR,11791172 * CONFIG_LOCKDEP. Additionally, holding the lock too long11801180- * will also starve other vCPUs.11731173+ * will also starve other vCPUs. We have to also make sure11741174+ * that the page tables are not freed while we released11751175+ * the lock.11811176 */11821182- if (need_resched() || spin_needbreak(&kvm->mmu_lock))11831183- cond_resched_lock(&kvm->mmu_lock);11841184-11771177+ cond_resched_lock(&kvm->mmu_lock);11781178+ if (!READ_ONCE(kvm->arch.pgd))11791179+ break;11851180 next = stage2_pgd_addr_end(addr, end);11861181 if (stage2_pgd_present(*pgd))11871182 stage2_wp_puds(pgd, addr, next);
+4-1
virt/kvm/arm/vgic/vgic-init.c
···242242 * If we are creating a VCPU with a GICv3 we must also register the243243 * KVM io device for the redistributor that belongs to this VCPU.244244 */245245- if (dist->vgic_model == KVM_DEV_TYPE_ARM_VGIC_V3)245245+ if (dist->vgic_model == KVM_DEV_TYPE_ARM_VGIC_V3) {246246+ mutex_lock(&vcpu->kvm->lock);246247 ret = vgic_register_redist_iodev(vcpu);248248+ mutex_unlock(&vcpu->kvm->lock);249249+ }247250 return ret;248251}249252
+9-3
virt/kvm/arm/vgic/vgic-mmio-v3.c
···586586 if (!vgic_v3_check_base(kvm))587587 return -EINVAL;588588589589- rd_base = vgic->vgic_redist_base + kvm_vcpu_get_idx(vcpu) * SZ_64K * 2;589589+ rd_base = vgic->vgic_redist_base + vgic->vgic_redist_free_offset;590590 sgi_base = rd_base + SZ_64K;591591592592 kvm_iodevice_init(&rd_dev->dev, &kvm_io_gic_ops);···614614 mutex_lock(&kvm->slots_lock);615615 ret = kvm_io_bus_register_dev(kvm, KVM_MMIO_BUS, sgi_base,616616 SZ_64K, &sgi_dev->dev);617617- mutex_unlock(&kvm->slots_lock);618618- if (ret)617617+ if (ret) {619618 kvm_io_bus_unregister_dev(kvm, KVM_MMIO_BUS,620619 &rd_dev->dev);620620+ goto out;621621+ }621622623623+ vgic->vgic_redist_free_offset += 2 * SZ_64K;624624+out:625625+ mutex_unlock(&kvm->slots_lock);622626 return ret;623627}624628···648644649645 if (ret) {650646 /* The current c failed, so we start with the previous one. */647647+ mutex_lock(&kvm->slots_lock);651648 for (c--; c >= 0; c--) {652649 vcpu = kvm_get_vcpu(kvm, c);653650 vgic_unregister_redist_iodev(vcpu);654651 }652652+ mutex_unlock(&kvm->slots_lock);655653 }656654657655 return ret;
+7
virt/kvm/arm/vgic/vgic-v2.c
···149149 if (irq->hw) {150150 val |= GICH_LR_HW;151151 val |= irq->hwintid << GICH_LR_PHYSID_CPUID_SHIFT;152152+ /*153153+ * Never set pending+active on a HW interrupt, as the154154+ * pending state is kept at the physical distributor155155+ * level.156156+ */157157+ if (irq->active && irq_is_pending(irq))158158+ val &= ~GICH_LR_PENDING_BIT;152159 } else {153160 if (irq->config == VGIC_CONFIG_LEVEL)154161 val |= GICH_LR_EOI;
+7
virt/kvm/arm/vgic/vgic-v3.c
···127127 if (irq->hw) {128128 val |= ICH_LR_HW;129129 val |= ((u64)irq->hwintid) << ICH_LR_PHYS_ID_SHIFT;130130+ /*131131+ * Never set pending+active on a HW interrupt, as the132132+ * pending state is kept at the physical distributor133133+ * level.134134+ */135135+ if (irq->active && irq_is_pending(irq))136136+ val &= ~ICH_LR_PENDING_BIT;130137 } else {131138 if (irq->config == VGIC_CONFIG_LEVEL)132139 val |= ICH_LR_EOI;