diff options
author | David S. Miller <davem@davemloft.net> | 2019-09-02 14:20:17 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2019-09-02 14:20:17 -0400 |
commit | 765b7590c92d849806e9a27ab3a5a17cfc6a47a9 (patch) | |
tree | 4387f5034f870accfd2bb56997c535159da45f06 | |
parent | 4bc61b0b16955322576265724ab0a0075a30dc84 (diff) | |
parent | 089cf7f6ecb266b6a4164919a2e69bd2f938374a (diff) |
Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net
r8152 conflicts are the NAPI fixes in 'net' overlapping with
some tasklet stuff in net-next
Signed-off-by: David S. Miller <davem@davemloft.net>
226 files changed, 2169 insertions, 1074 deletions
@@ -64,6 +64,9 @@ Dengcheng Zhu <dzhu@wavecomp.com> <dengcheng.zhu@imgtec.com> | |||
64 | Dengcheng Zhu <dzhu@wavecomp.com> <dczhu@mips.com> | 64 | Dengcheng Zhu <dzhu@wavecomp.com> <dczhu@mips.com> |
65 | Dengcheng Zhu <dzhu@wavecomp.com> <dengcheng.zhu@gmail.com> | 65 | Dengcheng Zhu <dzhu@wavecomp.com> <dengcheng.zhu@gmail.com> |
66 | Dmitry Eremin-Solenikov <dbaryshkov@gmail.com> | 66 | Dmitry Eremin-Solenikov <dbaryshkov@gmail.com> |
67 | Dmitry Safonov <0x7f454c46@gmail.com> <dsafonov@virtuozzo.com> | ||
68 | Dmitry Safonov <0x7f454c46@gmail.com> <d.safonov@partner.samsung.com> | ||
69 | Dmitry Safonov <0x7f454c46@gmail.com> <dima@arista.com> | ||
67 | Domen Puncer <domen@coderock.org> | 70 | Domen Puncer <domen@coderock.org> |
68 | Douglas Gilbert <dougg@torque.net> | 71 | Douglas Gilbert <dougg@torque.net> |
69 | Ed L. Cashin <ecashin@coraid.com> | 72 | Ed L. Cashin <ecashin@coraid.com> |
@@ -160,6 +163,8 @@ Matt Ranostay <mranostay@gmail.com> Matthew Ranostay <mranostay@embeddedalley.co | |||
160 | Matt Ranostay <mranostay@gmail.com> <matt.ranostay@intel.com> | 163 | Matt Ranostay <mranostay@gmail.com> <matt.ranostay@intel.com> |
161 | Matt Ranostay <matt.ranostay@konsulko.com> <matt@ranostay.consulting> | 164 | Matt Ranostay <matt.ranostay@konsulko.com> <matt@ranostay.consulting> |
162 | Matt Redfearn <matt.redfearn@mips.com> <matt.redfearn@imgtec.com> | 165 | Matt Redfearn <matt.redfearn@mips.com> <matt.redfearn@imgtec.com> |
166 | Maxime Ripard <mripard@kernel.org> <maxime.ripard@bootlin.com> | ||
167 | Maxime Ripard <mripard@kernel.org> <maxime.ripard@free-electrons.com> | ||
163 | Mayuresh Janorkar <mayur@ti.com> | 168 | Mayuresh Janorkar <mayur@ti.com> |
164 | Michael Buesch <m@bues.ch> | 169 | Michael Buesch <m@bues.ch> |
165 | Michel Dänzer <michel@tungstengraphics.com> | 170 | Michel Dänzer <michel@tungstengraphics.com> |
diff --git a/Documentation/devicetree/bindings/net/dsa/ksz.txt b/Documentation/devicetree/bindings/net/dsa/ksz.txt index 5e8429b6f9ca..95e91e84151c 100644 --- a/Documentation/devicetree/bindings/net/dsa/ksz.txt +++ b/Documentation/devicetree/bindings/net/dsa/ksz.txt | |||
@@ -15,6 +15,7 @@ Required properties: | |||
15 | - "microchip,ksz8565" | 15 | - "microchip,ksz8565" |
16 | - "microchip,ksz9893" | 16 | - "microchip,ksz9893" |
17 | - "microchip,ksz9563" | 17 | - "microchip,ksz9563" |
18 | - "microchip,ksz8563" | ||
18 | 19 | ||
19 | Optional properties: | 20 | Optional properties: |
20 | 21 | ||
diff --git a/Documentation/devicetree/bindings/net/macb.txt b/Documentation/devicetree/bindings/net/macb.txt index 63c73fafe26d..0b61a90f1592 100644 --- a/Documentation/devicetree/bindings/net/macb.txt +++ b/Documentation/devicetree/bindings/net/macb.txt | |||
@@ -15,10 +15,10 @@ Required properties: | |||
15 | Use "atmel,sama5d4-gem" for the GEM IP (10/100) available on Atmel sama5d4 SoCs. | 15 | Use "atmel,sama5d4-gem" for the GEM IP (10/100) available on Atmel sama5d4 SoCs. |
16 | Use "cdns,zynq-gem" Xilinx Zynq-7xxx SoC. | 16 | Use "cdns,zynq-gem" Xilinx Zynq-7xxx SoC. |
17 | Use "cdns,zynqmp-gem" for Zynq Ultrascale+ MPSoC. | 17 | Use "cdns,zynqmp-gem" for Zynq Ultrascale+ MPSoC. |
18 | Use "sifive,fu540-macb" for SiFive FU540-C000 SoC. | 18 | Use "sifive,fu540-c000-gem" for SiFive FU540-C000 SoC. |
19 | Or the generic form: "cdns,emac". | 19 | Or the generic form: "cdns,emac". |
20 | - reg: Address and length of the register set for the device | 20 | - reg: Address and length of the register set for the device |
21 | For "sifive,fu540-macb", second range is required to specify the | 21 | For "sifive,fu540-c000-gem", second range is required to specify the |
22 | address and length of the registers for GEMGXL Management block. | 22 | address and length of the registers for GEMGXL Management block. |
23 | - interrupts: Should contain macb interrupt | 23 | - interrupts: Should contain macb interrupt |
24 | - phy-mode: See ethernet.txt file in the same directory. | 24 | - phy-mode: See ethernet.txt file in the same directory. |
diff --git a/Documentation/process/embargoed-hardware-issues.rst b/Documentation/process/embargoed-hardware-issues.rst new file mode 100644 index 000000000000..d37cbc502936 --- /dev/null +++ b/Documentation/process/embargoed-hardware-issues.rst | |||
@@ -0,0 +1,279 @@ | |||
1 | Embargoed hardware issues | ||
2 | ========================= | ||
3 | |||
4 | Scope | ||
5 | ----- | ||
6 | |||
7 | Hardware issues which result in security problems are a different category | ||
8 | of security bugs than pure software bugs which only affect the Linux | ||
9 | kernel. | ||
10 | |||
11 | Hardware issues like Meltdown, Spectre, L1TF etc. must be treated | ||
12 | differently because they usually affect all Operating Systems ("OS") and | ||
13 | therefore need coordination across different OS vendors, distributions, | ||
14 | hardware vendors and other parties. For some of the issues, software | ||
15 | mitigations can depend on microcode or firmware updates, which need further | ||
16 | coordination. | ||
17 | |||
18 | .. _Contact: | ||
19 | |||
20 | Contact | ||
21 | ------- | ||
22 | |||
23 | The Linux kernel hardware security team is separate from the regular Linux | ||
24 | kernel security team. | ||
25 | |||
26 | The team only handles the coordination of embargoed hardware security | ||
27 | issues. Reports of pure software security bugs in the Linux kernel are not | ||
28 | handled by this team and the reporter will be guided to contact the regular | ||
29 | Linux kernel security team (:ref:`Documentation/admin-guide/ | ||
30 | <securitybugs>`) instead. | ||
31 | |||
32 | The team can be contacted by email at <hardware-security@kernel.org>. This | ||
33 | is a private list of security officers who will help you to coordinate an | ||
34 | issue according to our documented process. | ||
35 | |||
36 | The list is encrypted and email to the list can be sent by either PGP or | ||
37 | S/MIME encrypted and must be signed with the reporter's PGP key or S/MIME | ||
38 | certificate. The list's PGP key and S/MIME certificate are available from | ||
39 | https://www.kernel.org/.... | ||
40 | |||
41 | While hardware security issues are often handled by the affected hardware | ||
42 | vendor, we welcome contact from researchers or individuals who have | ||
43 | identified a potential hardware flaw. | ||
44 | |||
45 | Hardware security officers | ||
46 | ^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
47 | |||
48 | The current team of hardware security officers: | ||
49 | |||
50 | - Linus Torvalds (Linux Foundation Fellow) | ||
51 | - Greg Kroah-Hartman (Linux Foundation Fellow) | ||
52 | - Thomas Gleixner (Linux Foundation Fellow) | ||
53 | |||
54 | Operation of mailing-lists | ||
55 | ^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
56 | |||
57 | The encrypted mailing-lists which are used in our process are hosted on | ||
58 | Linux Foundation's IT infrastructure. By providing this service Linux | ||
59 | Foundation's director of IT Infrastructure security technically has the | ||
60 | ability to access the embargoed information, but is obliged to | ||
61 | confidentiality by his employment contract. Linux Foundation's director of | ||
62 | IT Infrastructure security is also responsible for the kernel.org | ||
63 | infrastructure. | ||
64 | |||
65 | The Linux Foundation's current director of IT Infrastructure security is | ||
66 | Konstantin Ryabitsev. | ||
67 | |||
68 | |||
69 | Non-disclosure agreements | ||
70 | ------------------------- | ||
71 | |||
72 | The Linux kernel hardware security team is not a formal body and therefore | ||
73 | unable to enter into any non-disclosure agreements. The kernel community | ||
74 | is aware of the sensitive nature of such issues and offers a Memorandum of | ||
75 | Understanding instead. | ||
76 | |||
77 | |||
78 | Memorandum of Understanding | ||
79 | --------------------------- | ||
80 | |||
81 | The Linux kernel community has a deep understanding of the requirement to | ||
82 | keep hardware security issues under embargo for coordination between | ||
83 | different OS vendors, distributors, hardware vendors and other parties. | ||
84 | |||
85 | The Linux kernel community has successfully handled hardware security | ||
86 | issues in the past and has the necessary mechanisms in place to allow | ||
87 | community compliant development under embargo restrictions. | ||
88 | |||
89 | The Linux kernel community has a dedicated hardware security team for | ||
90 | initial contact, which oversees the process of handling such issues under | ||
91 | embargo rules. | ||
92 | |||
93 | The hardware security team identifies the developers (domain experts) who | ||
94 | will form the initial response team for a particular issue. The initial | ||
95 | response team can bring in further developers (domain experts) to address | ||
96 | the issue in the best technical way. | ||
97 | |||
98 | All involved developers pledge to adhere to the embargo rules and to keep | ||
99 | the received information confidential. Violation of the pledge will lead to | ||
100 | immediate exclusion from the current issue and removal from all related | ||
101 | mailing-lists. In addition, the hardware security team will also exclude | ||
102 | the offender from future issues. The impact of this consequence is a highly | ||
103 | effective deterrent in our community. In case a violation happens the | ||
104 | hardware security team will inform the involved parties immediately. If you | ||
105 | or anyone becomes aware of a potential violation, please report it | ||
106 | immediately to the Hardware security officers. | ||
107 | |||
108 | |||
109 | Process | ||
110 | ^^^^^^^ | ||
111 | |||
112 | Due to the globally distributed nature of Linux kernel development, | ||
113 | face-to-face meetings are almost impossible to address hardware security | ||
114 | issues. Phone conferences are hard to coordinate due to time zones and | ||
115 | other factors and should be only used when absolutely necessary. Encrypted | ||
116 | email has been proven to be the most effective and secure communication | ||
117 | method for these types of issues. | ||
118 | |||
119 | Start of Disclosure | ||
120 | """"""""""""""""""" | ||
121 | |||
122 | Disclosure starts by contacting the Linux kernel hardware security team by | ||
123 | email. This initial contact should contain a description of the problem and | ||
124 | a list of any known affected hardware. If your organization builds or | ||
125 | distributes the affected hardware, we encourage you to also consider what | ||
126 | other hardware could be affected. | ||
127 | |||
128 | The hardware security team will provide an incident-specific encrypted | ||
129 | mailing-list which will be used for initial discussion with the reporter, | ||
130 | further disclosure and coordination. | ||
131 | |||
132 | The hardware security team will provide the disclosing party a list of | ||
133 | developers (domain experts) who should be informed initially about the | ||
134 | issue after confirming with the developers that they will adhere to this | ||
135 | Memorandum of Understanding and the documented process. These developers | ||
136 | form the initial response team and will be responsible for handling the | ||
137 | issue after initial contact. The hardware security team is supporting the | ||
138 | response team, but is not necessarily involved in the mitigation | ||
139 | development process. | ||
140 | |||
141 | While individual developers might be covered by a non-disclosure agreement | ||
142 | via their employer, they cannot enter individual non-disclosure agreements | ||
143 | in their role as Linux kernel developers. They will, however, agree to | ||
144 | adhere to this documented process and the Memorandum of Understanding. | ||
145 | |||
146 | |||
147 | Disclosure | ||
148 | """""""""" | ||
149 | |||
150 | The disclosing party provides detailed information to the initial response | ||
151 | team via the specific encrypted mailing-list. | ||
152 | |||
153 | From our experience the technical documentation of these issues is usually | ||
154 | a sufficient starting point and further technical clarification is best | ||
155 | done via email. | ||
156 | |||
157 | Mitigation development | ||
158 | """""""""""""""""""""" | ||
159 | |||
160 | The initial response team sets up an encrypted mailing-list or repurposes | ||
161 | an existing one if appropriate. The disclosing party should provide a list | ||
162 | of contacts for all other parties who have already been, or should be | ||
163 | informed about the issue. The response team contacts these parties so they | ||
164 | can name experts who should be subscribed to the mailing-list. | ||
165 | |||
166 | Using a mailing-list is close to the normal Linux development process and | ||
167 | has been successfully used in developing mitigations for various hardware | ||
168 | security issues in the past. | ||
169 | |||
170 | The mailing-list operates in the same way as normal Linux development. | ||
171 | Patches are posted, discussed and reviewed and if agreed on applied to a | ||
172 | non-public git repository which is only accessible to the participating | ||
173 | developers via a secure connection. The repository contains the main | ||
174 | development branch against the mainline kernel and backport branches for | ||
175 | stable kernel versions as necessary. | ||
176 | |||
177 | The initial response team will identify further experts from the Linux | ||
178 | kernel developer community as needed and inform the disclosing party about | ||
179 | their participation. Bringing in experts can happen at any time of the | ||
180 | development process and often needs to be handled in a timely manner. | ||
181 | |||
182 | Coordinated release | ||
183 | """"""""""""""""""" | ||
184 | |||
185 | The involved parties will negotiate the date and time where the embargo | ||
186 | ends. At that point the prepared mitigations are integrated into the | ||
187 | relevant kernel trees and published. | ||
188 | |||
189 | While we understand that hardware security issues need coordinated embargo | ||
190 | time, the embargo time should be constrained to the minimum time which is | ||
191 | required for all involved parties to develop, test and prepare the | ||
192 | mitigations. Extending embargo time artificially to meet conference talk | ||
193 | dates or other non-technical reasons is creating more work and burden for | ||
194 | the involved developers and response teams as the patches need to be kept | ||
195 | up to date in order to follow the ongoing upstream kernel development, | ||
196 | which might create conflicting changes. | ||
197 | |||
198 | CVE assignment | ||
199 | """""""""""""" | ||
200 | |||
201 | Neither the hardware security team nor the initial response team assign | ||
202 | CVEs, nor are CVEs required for the development process. If CVEs are | ||
203 | provided by the disclosing party they can be used for documentation | ||
204 | purposes. | ||
205 | |||
206 | Process ambassadors | ||
207 | ------------------- | ||
208 | |||
209 | For assistance with this process we have established ambassadors in various | ||
210 | organizations, who can answer questions about or provide guidance on the | ||
211 | reporting process and further handling. Ambassadors are not involved in the | ||
212 | disclosure of a particular issue, unless requested by a response team or by | ||
213 | an involved disclosed party. The current ambassadors list: | ||
214 | |||
215 | ============= ======================================================== | ||
216 | ARM | ||
217 | AMD | ||
218 | IBM | ||
219 | Intel | ||
220 | Qualcomm | ||
221 | |||
222 | Microsoft | ||
223 | VMware | ||
224 | XEN | ||
225 | |||
226 | Canonical Tyler Hicks <tyhicks@canonical.com> | ||
227 | Debian Ben Hutchings <ben@decadent.org.uk> | ||
228 | Oracle Konrad Rzeszutek Wilk <konrad.wilk@oracle.com> | ||
229 | Red Hat Josh Poimboeuf <jpoimboe@redhat.com> | ||
230 | SUSE Jiri Kosina <jkosina@suse.cz> | ||
231 | |||
232 | Amazon | ||
233 | |||
234 | ============== ======================================================== | ||
235 | |||
236 | If you want your organization to be added to the ambassadors list, please | ||
237 | contact the hardware security team. The nominated ambassador has to | ||
238 | understand and support our process fully and is ideally well connected in | ||
239 | the Linux kernel community. | ||
240 | |||
241 | Encrypted mailing-lists | ||
242 | ----------------------- | ||
243 | |||
244 | We use encrypted mailing-lists for communication. The operating principle | ||
245 | of these lists is that email sent to the list is encrypted either with the | ||
246 | list's PGP key or with the list's S/MIME certificate. The mailing-list | ||
247 | software decrypts the email and re-encrypts it individually for each | ||
248 | subscriber with the subscriber's PGP key or S/MIME certificate. Details | ||
249 | about the mailing-list software and the setup which is used to ensure the | ||
250 | security of the lists and protection of the data can be found here: | ||
251 | https://www.kernel.org/.... | ||
252 | |||
253 | List keys | ||
254 | ^^^^^^^^^ | ||
255 | |||
256 | For initial contact see :ref:`Contact`. For incident specific mailing-lists | ||
257 | the key and S/MIME certificate are conveyed to the subscribers by email | ||
258 | sent from the specific list. | ||
259 | |||
260 | Subscription to incident specific lists | ||
261 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
262 | |||
263 | Subscription is handled by the response teams. Disclosed parties who want | ||
264 | to participate in the communication send a list of potential subscribers to | ||
265 | the response team so the response team can validate subscription requests. | ||
266 | |||
267 | Each subscriber needs to send a subscription request to the response team | ||
268 | by email. The email must be signed with the subscriber's PGP key or S/MIME | ||
269 | certificate. If a PGP key is used, it must be available from a public key | ||
270 | server and is ideally connected to the Linux kernel's PGP web of trust. See | ||
271 | also: https://www.kernel.org/signature.html. | ||
272 | |||
273 | The response team verifies that the subscriber request is valid and adds | ||
274 | the subscriber to the list. After subscription the subscriber will receive | ||
275 | email from the mailing-list which is signed either with the list's PGP key | ||
276 | or the list's S/MIME certificate. The subscriber's email client can extract | ||
277 | the PGP key or the S/MIME certificate from the signature so the subscriber | ||
278 | can send encrypted email to the list. | ||
279 | |||
diff --git a/Documentation/process/index.rst b/Documentation/process/index.rst index 878ebfda7eef..e2c9ffc682c5 100644 --- a/Documentation/process/index.rst +++ b/Documentation/process/index.rst | |||
@@ -45,6 +45,7 @@ Other guides to the community that are of interest to most developers are: | |||
45 | submit-checklist | 45 | submit-checklist |
46 | kernel-docs | 46 | kernel-docs |
47 | deprecated | 47 | deprecated |
48 | embargoed-hardware-issues | ||
48 | 49 | ||
49 | These are some overall technical guides that have been put here for now for | 50 | These are some overall technical guides that have been put here for now for |
50 | lack of a better place. | 51 | lack of a better place. |
diff --git a/MAINTAINERS b/MAINTAINERS index 68b48de8765b..a081c477d1d1 100644 --- a/MAINTAINERS +++ b/MAINTAINERS | |||
@@ -683,7 +683,7 @@ S: Maintained | |||
683 | F: drivers/crypto/sunxi-ss/ | 683 | F: drivers/crypto/sunxi-ss/ |
684 | 684 | ||
685 | ALLWINNER VPU DRIVER | 685 | ALLWINNER VPU DRIVER |
686 | M: Maxime Ripard <maxime.ripard@bootlin.com> | 686 | M: Maxime Ripard <mripard@kernel.org> |
687 | M: Paul Kocialkowski <paul.kocialkowski@bootlin.com> | 687 | M: Paul Kocialkowski <paul.kocialkowski@bootlin.com> |
688 | L: linux-media@vger.kernel.org | 688 | L: linux-media@vger.kernel.org |
689 | S: Maintained | 689 | S: Maintained |
@@ -1416,7 +1416,7 @@ S: Maintained | |||
1416 | F: drivers/clk/sunxi/ | 1416 | F: drivers/clk/sunxi/ |
1417 | 1417 | ||
1418 | ARM/Allwinner sunXi SoC support | 1418 | ARM/Allwinner sunXi SoC support |
1419 | M: Maxime Ripard <maxime.ripard@bootlin.com> | 1419 | M: Maxime Ripard <mripard@kernel.org> |
1420 | M: Chen-Yu Tsai <wens@csie.org> | 1420 | M: Chen-Yu Tsai <wens@csie.org> |
1421 | L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers) | 1421 | L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers) |
1422 | S: Maintained | 1422 | S: Maintained |
@@ -3586,7 +3586,7 @@ F: Documentation/filesystems/caching/cachefiles.txt | |||
3586 | F: fs/cachefiles/ | 3586 | F: fs/cachefiles/ |
3587 | 3587 | ||
3588 | CADENCE MIPI-CSI2 BRIDGES | 3588 | CADENCE MIPI-CSI2 BRIDGES |
3589 | M: Maxime Ripard <maxime.ripard@bootlin.com> | 3589 | M: Maxime Ripard <mripard@kernel.org> |
3590 | L: linux-media@vger.kernel.org | 3590 | L: linux-media@vger.kernel.org |
3591 | S: Maintained | 3591 | S: Maintained |
3592 | F: Documentation/devicetree/bindings/media/cdns,*.txt | 3592 | F: Documentation/devicetree/bindings/media/cdns,*.txt |
@@ -5309,7 +5309,7 @@ F: include/linux/vga* | |||
5309 | 5309 | ||
5310 | DRM DRIVERS AND MISC GPU PATCHES | 5310 | DRM DRIVERS AND MISC GPU PATCHES |
5311 | M: Maarten Lankhorst <maarten.lankhorst@linux.intel.com> | 5311 | M: Maarten Lankhorst <maarten.lankhorst@linux.intel.com> |
5312 | M: Maxime Ripard <maxime.ripard@bootlin.com> | 5312 | M: Maxime Ripard <mripard@kernel.org> |
5313 | M: Sean Paul <sean@poorly.run> | 5313 | M: Sean Paul <sean@poorly.run> |
5314 | W: https://01.org/linuxgraphics/gfx-docs/maintainer-tools/drm-misc.html | 5314 | W: https://01.org/linuxgraphics/gfx-docs/maintainer-tools/drm-misc.html |
5315 | S: Maintained | 5315 | S: Maintained |
@@ -5322,7 +5322,7 @@ F: include/uapi/drm/drm* | |||
5322 | F: include/linux/vga* | 5322 | F: include/linux/vga* |
5323 | 5323 | ||
5324 | DRM DRIVERS FOR ALLWINNER A10 | 5324 | DRM DRIVERS FOR ALLWINNER A10 |
5325 | M: Maxime Ripard <maxime.ripard@bootlin.com> | 5325 | M: Maxime Ripard <mripard@kernel.org> |
5326 | L: dri-devel@lists.freedesktop.org | 5326 | L: dri-devel@lists.freedesktop.org |
5327 | S: Supported | 5327 | S: Supported |
5328 | F: drivers/gpu/drm/sun4i/ | 5328 | F: drivers/gpu/drm/sun4i/ |
@@ -7528,7 +7528,7 @@ I2C MV64XXX MARVELL AND ALLWINNER DRIVER | |||
7528 | M: Gregory CLEMENT <gregory.clement@bootlin.com> | 7528 | M: Gregory CLEMENT <gregory.clement@bootlin.com> |
7529 | L: linux-i2c@vger.kernel.org | 7529 | L: linux-i2c@vger.kernel.org |
7530 | S: Maintained | 7530 | S: Maintained |
7531 | F: Documentation/devicetree/bindings/i2c/i2c-mv64xxx.txt | 7531 | F: Documentation/devicetree/bindings/i2c/marvell,mv64xxx-i2c.yaml |
7532 | F: drivers/i2c/busses/i2c-mv64xxx.c | 7532 | F: drivers/i2c/busses/i2c-mv64xxx.c |
7533 | 7533 | ||
7534 | I2C OVER PARALLEL PORT | 7534 | I2C OVER PARALLEL PORT |
@@ -9244,6 +9244,18 @@ F: include/linux/nd.h | |||
9244 | F: include/linux/libnvdimm.h | 9244 | F: include/linux/libnvdimm.h |
9245 | F: include/uapi/linux/ndctl.h | 9245 | F: include/uapi/linux/ndctl.h |
9246 | 9246 | ||
9247 | LICENSES and SPDX stuff | ||
9248 | M: Thomas Gleixner <tglx@linutronix.de> | ||
9249 | M: Greg Kroah-Hartman <gregkh@linuxfoundation.org> | ||
9250 | L: linux-spdx@vger.kernel.org | ||
9251 | S: Maintained | ||
9252 | T: git git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/spdx.git | ||
9253 | F: COPYING | ||
9254 | F: Documentation/process/license-rules.rst | ||
9255 | F: LICENSES/ | ||
9256 | F: scripts/spdxcheck-test.sh | ||
9257 | F: scripts/spdxcheck.py | ||
9258 | |||
9247 | LIGHTNVM PLATFORM SUPPORT | 9259 | LIGHTNVM PLATFORM SUPPORT |
9248 | M: Matias Bjorling <mb@lightnvm.io> | 9260 | M: Matias Bjorling <mb@lightnvm.io> |
9249 | W: http://github/OpenChannelSSD | 9261 | W: http://github/OpenChannelSSD |
@@ -2,7 +2,7 @@ | |||
2 | VERSION = 5 | 2 | VERSION = 5 |
3 | PATCHLEVEL = 3 | 3 | PATCHLEVEL = 3 |
4 | SUBLEVEL = 0 | 4 | SUBLEVEL = 0 |
5 | EXTRAVERSION = -rc6 | 5 | EXTRAVERSION = -rc7 |
6 | NAME = Bobtail Squid | 6 | NAME = Bobtail Squid |
7 | 7 | ||
8 | # *DOCUMENTATION* | 8 | # *DOCUMENTATION* |
diff --git a/arch/arc/kernel/unwind.c b/arch/arc/kernel/unwind.c index 445e4d702f43..dc05a63516f5 100644 --- a/arch/arc/kernel/unwind.c +++ b/arch/arc/kernel/unwind.c | |||
@@ -572,6 +572,7 @@ static unsigned long read_pointer(const u8 **pLoc, const void *end, | |||
572 | #else | 572 | #else |
573 | BUILD_BUG_ON(sizeof(u32) != sizeof(value)); | 573 | BUILD_BUG_ON(sizeof(u32) != sizeof(value)); |
574 | #endif | 574 | #endif |
575 | /* Fall through */ | ||
575 | case DW_EH_PE_native: | 576 | case DW_EH_PE_native: |
576 | if (end < (const void *)(ptr.pul + 1)) | 577 | if (end < (const void *)(ptr.pul + 1)) |
577 | return 0; | 578 | return 0; |
diff --git a/arch/arm/boot/dts/am33xx-l4.dtsi b/arch/arm/boot/dts/am33xx-l4.dtsi index ced1a19d5f89..46849d6ecb3e 100644 --- a/arch/arm/boot/dts/am33xx-l4.dtsi +++ b/arch/arm/boot/dts/am33xx-l4.dtsi | |||
@@ -185,7 +185,7 @@ | |||
185 | uart0: serial@0 { | 185 | uart0: serial@0 { |
186 | compatible = "ti,am3352-uart", "ti,omap3-uart"; | 186 | compatible = "ti,am3352-uart", "ti,omap3-uart"; |
187 | clock-frequency = <48000000>; | 187 | clock-frequency = <48000000>; |
188 | reg = <0x0 0x2000>; | 188 | reg = <0x0 0x1000>; |
189 | interrupts = <72>; | 189 | interrupts = <72>; |
190 | status = "disabled"; | 190 | status = "disabled"; |
191 | dmas = <&edma 26 0>, <&edma 27 0>; | 191 | dmas = <&edma 26 0>, <&edma 27 0>; |
@@ -934,7 +934,7 @@ | |||
934 | uart1: serial@0 { | 934 | uart1: serial@0 { |
935 | compatible = "ti,am3352-uart", "ti,omap3-uart"; | 935 | compatible = "ti,am3352-uart", "ti,omap3-uart"; |
936 | clock-frequency = <48000000>; | 936 | clock-frequency = <48000000>; |
937 | reg = <0x0 0x2000>; | 937 | reg = <0x0 0x1000>; |
938 | interrupts = <73>; | 938 | interrupts = <73>; |
939 | status = "disabled"; | 939 | status = "disabled"; |
940 | dmas = <&edma 28 0>, <&edma 29 0>; | 940 | dmas = <&edma 28 0>, <&edma 29 0>; |
@@ -966,7 +966,7 @@ | |||
966 | uart2: serial@0 { | 966 | uart2: serial@0 { |
967 | compatible = "ti,am3352-uart", "ti,omap3-uart"; | 967 | compatible = "ti,am3352-uart", "ti,omap3-uart"; |
968 | clock-frequency = <48000000>; | 968 | clock-frequency = <48000000>; |
969 | reg = <0x0 0x2000>; | 969 | reg = <0x0 0x1000>; |
970 | interrupts = <74>; | 970 | interrupts = <74>; |
971 | status = "disabled"; | 971 | status = "disabled"; |
972 | dmas = <&edma 30 0>, <&edma 31 0>; | 972 | dmas = <&edma 30 0>, <&edma 31 0>; |
@@ -1614,7 +1614,7 @@ | |||
1614 | uart3: serial@0 { | 1614 | uart3: serial@0 { |
1615 | compatible = "ti,am3352-uart", "ti,omap3-uart"; | 1615 | compatible = "ti,am3352-uart", "ti,omap3-uart"; |
1616 | clock-frequency = <48000000>; | 1616 | clock-frequency = <48000000>; |
1617 | reg = <0x0 0x2000>; | 1617 | reg = <0x0 0x1000>; |
1618 | interrupts = <44>; | 1618 | interrupts = <44>; |
1619 | status = "disabled"; | 1619 | status = "disabled"; |
1620 | }; | 1620 | }; |
@@ -1644,7 +1644,7 @@ | |||
1644 | uart4: serial@0 { | 1644 | uart4: serial@0 { |
1645 | compatible = "ti,am3352-uart", "ti,omap3-uart"; | 1645 | compatible = "ti,am3352-uart", "ti,omap3-uart"; |
1646 | clock-frequency = <48000000>; | 1646 | clock-frequency = <48000000>; |
1647 | reg = <0x0 0x2000>; | 1647 | reg = <0x0 0x1000>; |
1648 | interrupts = <45>; | 1648 | interrupts = <45>; |
1649 | status = "disabled"; | 1649 | status = "disabled"; |
1650 | }; | 1650 | }; |
@@ -1674,7 +1674,7 @@ | |||
1674 | uart5: serial@0 { | 1674 | uart5: serial@0 { |
1675 | compatible = "ti,am3352-uart", "ti,omap3-uart"; | 1675 | compatible = "ti,am3352-uart", "ti,omap3-uart"; |
1676 | clock-frequency = <48000000>; | 1676 | clock-frequency = <48000000>; |
1677 | reg = <0x0 0x2000>; | 1677 | reg = <0x0 0x1000>; |
1678 | interrupts = <46>; | 1678 | interrupts = <46>; |
1679 | status = "disabled"; | 1679 | status = "disabled"; |
1680 | }; | 1680 | }; |
@@ -1758,6 +1758,8 @@ | |||
1758 | 1758 | ||
1759 | target-module@cc000 { /* 0x481cc000, ap 60 46.0 */ | 1759 | target-module@cc000 { /* 0x481cc000, ap 60 46.0 */ |
1760 | compatible = "ti,sysc-omap4", "ti,sysc"; | 1760 | compatible = "ti,sysc-omap4", "ti,sysc"; |
1761 | reg = <0xcc020 0x4>; | ||
1762 | reg-names = "rev"; | ||
1761 | ti,hwmods = "d_can0"; | 1763 | ti,hwmods = "d_can0"; |
1762 | /* Domains (P, C): per_pwrdm, l4ls_clkdm */ | 1764 | /* Domains (P, C): per_pwrdm, l4ls_clkdm */ |
1763 | clocks = <&l4ls_clkctrl AM3_L4LS_D_CAN0_CLKCTRL 0>, | 1765 | clocks = <&l4ls_clkctrl AM3_L4LS_D_CAN0_CLKCTRL 0>, |
@@ -1780,6 +1782,8 @@ | |||
1780 | 1782 | ||
1781 | target-module@d0000 { /* 0x481d0000, ap 62 42.0 */ | 1783 | target-module@d0000 { /* 0x481d0000, ap 62 42.0 */ |
1782 | compatible = "ti,sysc-omap4", "ti,sysc"; | 1784 | compatible = "ti,sysc-omap4", "ti,sysc"; |
1785 | reg = <0xd0020 0x4>; | ||
1786 | reg-names = "rev"; | ||
1783 | ti,hwmods = "d_can1"; | 1787 | ti,hwmods = "d_can1"; |
1784 | /* Domains (P, C): per_pwrdm, l4ls_clkdm */ | 1788 | /* Domains (P, C): per_pwrdm, l4ls_clkdm */ |
1785 | clocks = <&l4ls_clkctrl AM3_L4LS_D_CAN1_CLKCTRL 0>, | 1789 | clocks = <&l4ls_clkctrl AM3_L4LS_D_CAN1_CLKCTRL 0>, |
diff --git a/arch/arm/boot/dts/am33xx.dtsi b/arch/arm/boot/dts/am33xx.dtsi index e5c2f71a7c77..fb6b8aa12cc5 100644 --- a/arch/arm/boot/dts/am33xx.dtsi +++ b/arch/arm/boot/dts/am33xx.dtsi | |||
@@ -234,13 +234,33 @@ | |||
234 | interrupt-names = "edma3_tcerrint"; | 234 | interrupt-names = "edma3_tcerrint"; |
235 | }; | 235 | }; |
236 | 236 | ||
237 | mmc3: mmc@47810000 { | 237 | target-module@47810000 { |
238 | compatible = "ti,omap4-hsmmc"; | 238 | compatible = "ti,sysc-omap2", "ti,sysc"; |
239 | ti,hwmods = "mmc3"; | 239 | ti,hwmods = "mmc3"; |
240 | ti,needs-special-reset; | 240 | reg = <0x478102fc 0x4>, |
241 | interrupts = <29>; | 241 | <0x47810110 0x4>, |
242 | reg = <0x47810000 0x1000>; | 242 | <0x47810114 0x4>; |
243 | status = "disabled"; | 243 | reg-names = "rev", "sysc", "syss"; |
244 | ti,sysc-mask = <(SYSC_OMAP2_CLOCKACTIVITY | | ||
245 | SYSC_OMAP2_ENAWAKEUP | | ||
246 | SYSC_OMAP2_SOFTRESET | | ||
247 | SYSC_OMAP2_AUTOIDLE)>; | ||
248 | ti,sysc-sidle = <SYSC_IDLE_FORCE>, | ||
249 | <SYSC_IDLE_NO>, | ||
250 | <SYSC_IDLE_SMART>; | ||
251 | ti,syss-mask = <1>; | ||
252 | clocks = <&l3s_clkctrl AM3_L3S_MMC3_CLKCTRL 0>; | ||
253 | clock-names = "fck"; | ||
254 | #address-cells = <1>; | ||
255 | #size-cells = <1>; | ||
256 | ranges = <0x0 0x47810000 0x1000>; | ||
257 | |||
258 | mmc3: mmc@0 { | ||
259 | compatible = "ti,omap4-hsmmc"; | ||
260 | ti,needs-special-reset; | ||
261 | interrupts = <29>; | ||
262 | reg = <0x0 0x1000>; | ||
263 | }; | ||
244 | }; | 264 | }; |
245 | 265 | ||
246 | usb: usb@47400000 { | 266 | usb: usb@47400000 { |
diff --git a/arch/arm/boot/dts/am4372.dtsi b/arch/arm/boot/dts/am4372.dtsi index 55aff4db9c7c..848e2a8884e2 100644 --- a/arch/arm/boot/dts/am4372.dtsi +++ b/arch/arm/boot/dts/am4372.dtsi | |||
@@ -228,13 +228,33 @@ | |||
228 | interrupt-names = "edma3_tcerrint"; | 228 | interrupt-names = "edma3_tcerrint"; |
229 | }; | 229 | }; |
230 | 230 | ||
231 | mmc3: mmc@47810000 { | 231 | target-module@47810000 { |
232 | compatible = "ti,omap4-hsmmc"; | 232 | compatible = "ti,sysc-omap2", "ti,sysc"; |
233 | reg = <0x47810000 0x1000>; | ||
234 | ti,hwmods = "mmc3"; | 233 | ti,hwmods = "mmc3"; |
235 | ti,needs-special-reset; | 234 | reg = <0x478102fc 0x4>, |
236 | interrupts = <GIC_SPI 29 IRQ_TYPE_LEVEL_HIGH>; | 235 | <0x47810110 0x4>, |
237 | status = "disabled"; | 236 | <0x47810114 0x4>; |
237 | reg-names = "rev", "sysc", "syss"; | ||
238 | ti,sysc-mask = <(SYSC_OMAP2_CLOCKACTIVITY | | ||
239 | SYSC_OMAP2_ENAWAKEUP | | ||
240 | SYSC_OMAP2_SOFTRESET | | ||
241 | SYSC_OMAP2_AUTOIDLE)>; | ||
242 | ti,sysc-sidle = <SYSC_IDLE_FORCE>, | ||
243 | <SYSC_IDLE_NO>, | ||
244 | <SYSC_IDLE_SMART>; | ||
245 | ti,syss-mask = <1>; | ||
246 | clocks = <&l3s_clkctrl AM4_L3S_MMC3_CLKCTRL 0>; | ||
247 | clock-names = "fck"; | ||
248 | #address-cells = <1>; | ||
249 | #size-cells = <1>; | ||
250 | ranges = <0x0 0x47810000 0x1000>; | ||
251 | |||
252 | mmc3: mmc@0 { | ||
253 | compatible = "ti,omap4-hsmmc"; | ||
254 | ti,needs-special-reset; | ||
255 | interrupts = <GIC_SPI 29 IRQ_TYPE_LEVEL_HIGH>; | ||
256 | reg = <0x0 0x1000>; | ||
257 | }; | ||
238 | }; | 258 | }; |
239 | 259 | ||
240 | sham: sham@53100000 { | 260 | sham: sham@53100000 { |
diff --git a/arch/arm/boot/dts/am437x-l4.dtsi b/arch/arm/boot/dts/am437x-l4.dtsi index 989cb60b9029..04bee4ff9dcb 100644 --- a/arch/arm/boot/dts/am437x-l4.dtsi +++ b/arch/arm/boot/dts/am437x-l4.dtsi | |||
@@ -1574,6 +1574,8 @@ | |||
1574 | 1574 | ||
1575 | target-module@cc000 { /* 0x481cc000, ap 50 46.0 */ | 1575 | target-module@cc000 { /* 0x481cc000, ap 50 46.0 */ |
1576 | compatible = "ti,sysc-omap4", "ti,sysc"; | 1576 | compatible = "ti,sysc-omap4", "ti,sysc"; |
1577 | reg = <0xcc020 0x4>; | ||
1578 | reg-names = "rev"; | ||
1577 | ti,hwmods = "d_can0"; | 1579 | ti,hwmods = "d_can0"; |
1578 | /* Domains (P, C): per_pwrdm, l4ls_clkdm */ | 1580 | /* Domains (P, C): per_pwrdm, l4ls_clkdm */ |
1579 | clocks = <&l4ls_clkctrl AM4_L4LS_D_CAN0_CLKCTRL 0>; | 1581 | clocks = <&l4ls_clkctrl AM4_L4LS_D_CAN0_CLKCTRL 0>; |
@@ -1593,6 +1595,8 @@ | |||
1593 | 1595 | ||
1594 | target-module@d0000 { /* 0x481d0000, ap 52 3a.0 */ | 1596 | target-module@d0000 { /* 0x481d0000, ap 52 3a.0 */ |
1595 | compatible = "ti,sysc-omap4", "ti,sysc"; | 1597 | compatible = "ti,sysc-omap4", "ti,sysc"; |
1598 | reg = <0xd0020 0x4>; | ||
1599 | reg-names = "rev"; | ||
1596 | ti,hwmods = "d_can1"; | 1600 | ti,hwmods = "d_can1"; |
1597 | /* Domains (P, C): per_pwrdm, l4ls_clkdm */ | 1601 | /* Domains (P, C): per_pwrdm, l4ls_clkdm */ |
1598 | clocks = <&l4ls_clkctrl AM4_L4LS_D_CAN1_CLKCTRL 0>; | 1602 | clocks = <&l4ls_clkctrl AM4_L4LS_D_CAN1_CLKCTRL 0>; |
diff --git a/arch/arm/boot/dts/am571x-idk.dts b/arch/arm/boot/dts/am571x-idk.dts index 1d5e99964bbf..0aaacea1d887 100644 --- a/arch/arm/boot/dts/am571x-idk.dts +++ b/arch/arm/boot/dts/am571x-idk.dts | |||
@@ -175,14 +175,9 @@ | |||
175 | }; | 175 | }; |
176 | 176 | ||
177 | &mmc1 { | 177 | &mmc1 { |
178 | pinctrl-names = "default", "hs", "sdr12", "sdr25", "sdr50", "ddr50", "sdr104"; | 178 | pinctrl-names = "default", "hs"; |
179 | pinctrl-0 = <&mmc1_pins_default_no_clk_pu>; | 179 | pinctrl-0 = <&mmc1_pins_default_no_clk_pu>; |
180 | pinctrl-1 = <&mmc1_pins_hs>; | 180 | pinctrl-1 = <&mmc1_pins_hs>; |
181 | pinctrl-2 = <&mmc1_pins_sdr12>; | ||
182 | pinctrl-3 = <&mmc1_pins_sdr25>; | ||
183 | pinctrl-4 = <&mmc1_pins_sdr50>; | ||
184 | pinctrl-5 = <&mmc1_pins_ddr50_rev20 &mmc1_iodelay_ddr50_conf>; | ||
185 | pinctrl-6 = <&mmc1_pins_sdr104 &mmc1_iodelay_sdr104_rev20_conf>; | ||
186 | }; | 181 | }; |
187 | 182 | ||
188 | &mmc2 { | 183 | &mmc2 { |
diff --git a/arch/arm/boot/dts/am572x-idk.dts b/arch/arm/boot/dts/am572x-idk.dts index c65d7f6d3b5a..ea1c119feaa5 100644 --- a/arch/arm/boot/dts/am572x-idk.dts +++ b/arch/arm/boot/dts/am572x-idk.dts | |||
@@ -16,14 +16,9 @@ | |||
16 | }; | 16 | }; |
17 | 17 | ||
18 | &mmc1 { | 18 | &mmc1 { |
19 | pinctrl-names = "default", "hs", "sdr12", "sdr25", "sdr50", "ddr50", "sdr104"; | 19 | pinctrl-names = "default", "hs"; |
20 | pinctrl-0 = <&mmc1_pins_default_no_clk_pu>; | 20 | pinctrl-0 = <&mmc1_pins_default_no_clk_pu>; |
21 | pinctrl-1 = <&mmc1_pins_hs>; | 21 | pinctrl-1 = <&mmc1_pins_hs>; |
22 | pinctrl-2 = <&mmc1_pins_sdr12>; | ||
23 | pinctrl-3 = <&mmc1_pins_sdr25>; | ||
24 | pinctrl-4 = <&mmc1_pins_sdr50>; | ||
25 | pinctrl-5 = <&mmc1_pins_ddr50 &mmc1_iodelay_ddr_rev20_conf>; | ||
26 | pinctrl-6 = <&mmc1_pins_sdr104 &mmc1_iodelay_sdr104_rev20_conf>; | ||
27 | }; | 22 | }; |
28 | 23 | ||
29 | &mmc2 { | 24 | &mmc2 { |
diff --git a/arch/arm/boot/dts/am574x-idk.dts b/arch/arm/boot/dts/am574x-idk.dts index dc5141c35610..7935d70874ce 100644 --- a/arch/arm/boot/dts/am574x-idk.dts +++ b/arch/arm/boot/dts/am574x-idk.dts | |||
@@ -24,14 +24,9 @@ | |||
24 | }; | 24 | }; |
25 | 25 | ||
26 | &mmc1 { | 26 | &mmc1 { |
27 | pinctrl-names = "default", "hs", "sdr12", "sdr25", "sdr50", "ddr50", "sdr104"; | 27 | pinctrl-names = "default", "hs"; |
28 | pinctrl-0 = <&mmc1_pins_default_no_clk_pu>; | 28 | pinctrl-0 = <&mmc1_pins_default_no_clk_pu>; |
29 | pinctrl-1 = <&mmc1_pins_hs>; | 29 | pinctrl-1 = <&mmc1_pins_hs>; |
30 | pinctrl-2 = <&mmc1_pins_default>; | ||
31 | pinctrl-3 = <&mmc1_pins_hs>; | ||
32 | pinctrl-4 = <&mmc1_pins_sdr50>; | ||
33 | pinctrl-5 = <&mmc1_pins_ddr50 &mmc1_iodelay_ddr_conf>; | ||
34 | pinctrl-6 = <&mmc1_pins_ddr50 &mmc1_iodelay_sdr104_conf>; | ||
35 | }; | 30 | }; |
36 | 31 | ||
37 | &mmc2 { | 32 | &mmc2 { |
diff --git a/arch/arm/boot/dts/am57xx-beagle-x15-common.dtsi b/arch/arm/boot/dts/am57xx-beagle-x15-common.dtsi index d02f5fa61e5f..bc76f1705c0f 100644 --- a/arch/arm/boot/dts/am57xx-beagle-x15-common.dtsi +++ b/arch/arm/boot/dts/am57xx-beagle-x15-common.dtsi | |||
@@ -379,7 +379,7 @@ | |||
379 | }; | 379 | }; |
380 | }; | 380 | }; |
381 | 381 | ||
382 | &gpio7 { | 382 | &gpio7_target { |
383 | ti,no-reset-on-init; | 383 | ti,no-reset-on-init; |
384 | ti,no-idle-on-init; | 384 | ti,no-idle-on-init; |
385 | }; | 385 | }; |
@@ -430,6 +430,7 @@ | |||
430 | 430 | ||
431 | bus-width = <4>; | 431 | bus-width = <4>; |
432 | cd-gpios = <&gpio6 27 GPIO_ACTIVE_LOW>; /* gpio 219 */ | 432 | cd-gpios = <&gpio6 27 GPIO_ACTIVE_LOW>; /* gpio 219 */ |
433 | no-1-8-v; | ||
433 | }; | 434 | }; |
434 | 435 | ||
435 | &mmc2 { | 436 | &mmc2 { |
diff --git a/arch/arm/boot/dts/am57xx-beagle-x15-revb1.dts b/arch/arm/boot/dts/am57xx-beagle-x15-revb1.dts index a374b5cd6db0..7b113b52c3fb 100644 --- a/arch/arm/boot/dts/am57xx-beagle-x15-revb1.dts +++ b/arch/arm/boot/dts/am57xx-beagle-x15-revb1.dts | |||
@@ -16,14 +16,9 @@ | |||
16 | }; | 16 | }; |
17 | 17 | ||
18 | &mmc1 { | 18 | &mmc1 { |
19 | pinctrl-names = "default", "hs", "sdr12", "sdr25", "sdr50", "ddr50", "sdr104"; | 19 | pinctrl-names = "default", "hs"; |
20 | pinctrl-0 = <&mmc1_pins_default>; | 20 | pinctrl-0 = <&mmc1_pins_default>; |
21 | pinctrl-1 = <&mmc1_pins_hs>; | 21 | pinctrl-1 = <&mmc1_pins_hs>; |
22 | pinctrl-2 = <&mmc1_pins_sdr12>; | ||
23 | pinctrl-3 = <&mmc1_pins_sdr25>; | ||
24 | pinctrl-4 = <&mmc1_pins_sdr50>; | ||
25 | pinctrl-5 = <&mmc1_pins_ddr50 &mmc1_iodelay_ddr_rev11_conf>; | ||
26 | pinctrl-6 = <&mmc1_pins_sdr104 &mmc1_iodelay_sdr104_rev11_conf>; | ||
27 | vmmc-supply = <&vdd_3v3>; | 22 | vmmc-supply = <&vdd_3v3>; |
28 | vqmmc-supply = <&ldo1_reg>; | 23 | vqmmc-supply = <&ldo1_reg>; |
29 | }; | 24 | }; |
diff --git a/arch/arm/boot/dts/am57xx-beagle-x15-revc.dts b/arch/arm/boot/dts/am57xx-beagle-x15-revc.dts index 4badd2144db9..30c500b15b21 100644 --- a/arch/arm/boot/dts/am57xx-beagle-x15-revc.dts +++ b/arch/arm/boot/dts/am57xx-beagle-x15-revc.dts | |||
@@ -16,14 +16,9 @@ | |||
16 | }; | 16 | }; |
17 | 17 | ||
18 | &mmc1 { | 18 | &mmc1 { |
19 | pinctrl-names = "default", "hs", "sdr12", "sdr25", "sdr50", "ddr50", "sdr104"; | 19 | pinctrl-names = "default", "hs"; |
20 | pinctrl-0 = <&mmc1_pins_default>; | 20 | pinctrl-0 = <&mmc1_pins_default>; |
21 | pinctrl-1 = <&mmc1_pins_hs>; | 21 | pinctrl-1 = <&mmc1_pins_hs>; |
22 | pinctrl-2 = <&mmc1_pins_sdr12>; | ||
23 | pinctrl-3 = <&mmc1_pins_sdr25>; | ||
24 | pinctrl-4 = <&mmc1_pins_sdr50>; | ||
25 | pinctrl-5 = <&mmc1_pins_ddr50 &mmc1_iodelay_ddr_rev20_conf>; | ||
26 | pinctrl-6 = <&mmc1_pins_sdr104 &mmc1_iodelay_sdr104_rev20_conf>; | ||
27 | vmmc-supply = <&vdd_3v3>; | 22 | vmmc-supply = <&vdd_3v3>; |
28 | vqmmc-supply = <&ldo1_reg>; | 23 | vqmmc-supply = <&ldo1_reg>; |
29 | }; | 24 | }; |
diff --git a/arch/arm/boot/dts/dra7-evm.dts b/arch/arm/boot/dts/dra7-evm.dts index 714e971b912a..de7f85efaa51 100644 --- a/arch/arm/boot/dts/dra7-evm.dts +++ b/arch/arm/boot/dts/dra7-evm.dts | |||
@@ -498,7 +498,7 @@ | |||
498 | phy-supply = <&ldousb_reg>; | 498 | phy-supply = <&ldousb_reg>; |
499 | }; | 499 | }; |
500 | 500 | ||
501 | &gpio7 { | 501 | &gpio7_target { |
502 | ti,no-reset-on-init; | 502 | ti,no-reset-on-init; |
503 | ti,no-idle-on-init; | 503 | ti,no-idle-on-init; |
504 | }; | 504 | }; |
diff --git a/arch/arm/boot/dts/dra7-l4.dtsi b/arch/arm/boot/dts/dra7-l4.dtsi index 23faedec08ab..21e5914fdd62 100644 --- a/arch/arm/boot/dts/dra7-l4.dtsi +++ b/arch/arm/boot/dts/dra7-l4.dtsi | |||
@@ -1261,7 +1261,7 @@ | |||
1261 | }; | 1261 | }; |
1262 | }; | 1262 | }; |
1263 | 1263 | ||
1264 | target-module@51000 { /* 0x48051000, ap 45 2e.0 */ | 1264 | gpio7_target: target-module@51000 { /* 0x48051000, ap 45 2e.0 */ |
1265 | compatible = "ti,sysc-omap2", "ti,sysc"; | 1265 | compatible = "ti,sysc-omap2", "ti,sysc"; |
1266 | ti,hwmods = "gpio7"; | 1266 | ti,hwmods = "gpio7"; |
1267 | reg = <0x51000 0x4>, | 1267 | reg = <0x51000 0x4>, |
@@ -3025,7 +3025,7 @@ | |||
3025 | 3025 | ||
3026 | target-module@80000 { /* 0x48480000, ap 31 16.0 */ | 3026 | target-module@80000 { /* 0x48480000, ap 31 16.0 */ |
3027 | compatible = "ti,sysc-omap4", "ti,sysc"; | 3027 | compatible = "ti,sysc-omap4", "ti,sysc"; |
3028 | reg = <0x80000 0x4>; | 3028 | reg = <0x80020 0x4>; |
3029 | reg-names = "rev"; | 3029 | reg-names = "rev"; |
3030 | clocks = <&l4per2_clkctrl DRA7_L4PER2_DCAN2_CLKCTRL 0>; | 3030 | clocks = <&l4per2_clkctrl DRA7_L4PER2_DCAN2_CLKCTRL 0>; |
3031 | clock-names = "fck"; | 3031 | clock-names = "fck"; |
@@ -4577,7 +4577,7 @@ | |||
4577 | 4577 | ||
4578 | target-module@c000 { /* 0x4ae3c000, ap 30 04.0 */ | 4578 | target-module@c000 { /* 0x4ae3c000, ap 30 04.0 */ |
4579 | compatible = "ti,sysc-omap4", "ti,sysc"; | 4579 | compatible = "ti,sysc-omap4", "ti,sysc"; |
4580 | reg = <0xc000 0x4>; | 4580 | reg = <0xc020 0x4>; |
4581 | reg-names = "rev"; | 4581 | reg-names = "rev"; |
4582 | clocks = <&wkupaon_clkctrl DRA7_WKUPAON_DCAN1_CLKCTRL 0>; | 4582 | clocks = <&wkupaon_clkctrl DRA7_WKUPAON_DCAN1_CLKCTRL 0>; |
4583 | clock-names = "fck"; | 4583 | clock-names = "fck"; |
diff --git a/arch/arm/boot/dts/dra74x-mmc-iodelay.dtsi b/arch/arm/boot/dts/dra74x-mmc-iodelay.dtsi index 28ebb4eb884a..214b9e6de2c3 100644 --- a/arch/arm/boot/dts/dra74x-mmc-iodelay.dtsi +++ b/arch/arm/boot/dts/dra74x-mmc-iodelay.dtsi | |||
@@ -32,7 +32,7 @@ | |||
32 | * | 32 | * |
33 | * Datamanual Revisions: | 33 | * Datamanual Revisions: |
34 | * | 34 | * |
35 | * AM572x Silicon Revision 2.0: SPRS953B, Revised November 2016 | 35 | * AM572x Silicon Revision 2.0: SPRS953F, Revised May 2019 |
36 | * AM572x Silicon Revision 1.1: SPRS915R, Revised November 2016 | 36 | * AM572x Silicon Revision 1.1: SPRS915R, Revised November 2016 |
37 | * | 37 | * |
38 | */ | 38 | */ |
@@ -229,45 +229,45 @@ | |||
229 | 229 | ||
230 | mmc3_pins_default: mmc3_pins_default { | 230 | mmc3_pins_default: mmc3_pins_default { |
231 | pinctrl-single,pins = < | 231 | pinctrl-single,pins = < |
232 | DRA7XX_CORE_IOPAD(0x377c, (PIN_INPUT_PULLUP | MUX_MODE0)) /* mmc3_clk.mmc3_clk */ | 232 | DRA7XX_CORE_IOPAD(0x377c, (PIN_INPUT_PULLUP | MODE_SELECT | MUX_MODE0)) /* mmc3_clk.mmc3_clk */ |
233 | DRA7XX_CORE_IOPAD(0x3780, (PIN_INPUT_PULLUP | MUX_MODE0)) /* mmc3_cmd.mmc3_cmd */ | 233 | DRA7XX_CORE_IOPAD(0x3780, (PIN_INPUT_PULLUP | MODE_SELECT | MUX_MODE0)) /* mmc3_cmd.mmc3_cmd */ |
234 | DRA7XX_CORE_IOPAD(0x3784, (PIN_INPUT_PULLUP | MUX_MODE0)) /* mmc3_dat0.mmc3_dat0 */ | 234 | DRA7XX_CORE_IOPAD(0x3784, (PIN_INPUT_PULLUP | MODE_SELECT | MUX_MODE0)) /* mmc3_dat0.mmc3_dat0 */ |
235 | DRA7XX_CORE_IOPAD(0x3788, (PIN_INPUT_PULLUP | MUX_MODE0)) /* mmc3_dat1.mmc3_dat1 */ | 235 | DRA7XX_CORE_IOPAD(0x3788, (PIN_INPUT_PULLUP | MODE_SELECT | MUX_MODE0)) /* mmc3_dat1.mmc3_dat1 */ |
236 | DRA7XX_CORE_IOPAD(0x378c, (PIN_INPUT_PULLUP | MUX_MODE0)) /* mmc3_dat2.mmc3_dat2 */ | 236 | DRA7XX_CORE_IOPAD(0x378c, (PIN_INPUT_PULLUP | MODE_SELECT | MUX_MODE0)) /* mmc3_dat2.mmc3_dat2 */ |
237 | DRA7XX_CORE_IOPAD(0x3790, (PIN_INPUT_PULLUP | MUX_MODE0)) /* mmc3_dat3.mmc3_dat3 */ | 237 | DRA7XX_CORE_IOPAD(0x3790, (PIN_INPUT_PULLUP | MODE_SELECT | MUX_MODE0)) /* mmc3_dat3.mmc3_dat3 */ |
238 | >; | 238 | >; |
239 | }; | 239 | }; |
240 | 240 | ||
241 | mmc3_pins_hs: mmc3_pins_hs { | 241 | mmc3_pins_hs: mmc3_pins_hs { |
242 | pinctrl-single,pins = < | 242 | pinctrl-single,pins = < |
243 | DRA7XX_CORE_IOPAD(0x377c, (PIN_INPUT_PULLUP | MUX_MODE0)) /* mmc3_clk.mmc3_clk */ | 243 | DRA7XX_CORE_IOPAD(0x377c, (PIN_INPUT_PULLUP | MODE_SELECT | MUX_MODE0)) /* mmc3_clk.mmc3_clk */ |
244 | DRA7XX_CORE_IOPAD(0x3780, (PIN_INPUT_PULLUP | MUX_MODE0)) /* mmc3_cmd.mmc3_cmd */ | 244 | DRA7XX_CORE_IOPAD(0x3780, (PIN_INPUT_PULLUP | MODE_SELECT | MUX_MODE0)) /* mmc3_cmd.mmc3_cmd */ |
245 | DRA7XX_CORE_IOPAD(0x3784, (PIN_INPUT_PULLUP | MUX_MODE0)) /* mmc3_dat0.mmc3_dat0 */ | 245 | DRA7XX_CORE_IOPAD(0x3784, (PIN_INPUT_PULLUP | MODE_SELECT | MUX_MODE0)) /* mmc3_dat0.mmc3_dat0 */ |
246 | DRA7XX_CORE_IOPAD(0x3788, (PIN_INPUT_PULLUP | MUX_MODE0)) /* mmc3_dat1.mmc3_dat1 */ | 246 | DRA7XX_CORE_IOPAD(0x3788, (PIN_INPUT_PULLUP | MODE_SELECT | MUX_MODE0)) /* mmc3_dat1.mmc3_dat1 */ |
247 | DRA7XX_CORE_IOPAD(0x378c, (PIN_INPUT_PULLUP | MUX_MODE0)) /* mmc3_dat2.mmc3_dat2 */ | 247 | DRA7XX_CORE_IOPAD(0x378c, (PIN_INPUT_PULLUP | MODE_SELECT | MUX_MODE0)) /* mmc3_dat2.mmc3_dat2 */ |
248 | DRA7XX_CORE_IOPAD(0x3790, (PIN_INPUT_PULLUP | MUX_MODE0)) /* mmc3_dat3.mmc3_dat3 */ | 248 | DRA7XX_CORE_IOPAD(0x3790, (PIN_INPUT_PULLUP | MODE_SELECT | MUX_MODE0)) /* mmc3_dat3.mmc3_dat3 */ |
249 | >; | 249 | >; |
250 | }; | 250 | }; |
251 | 251 | ||
252 | mmc3_pins_sdr12: mmc3_pins_sdr12 { | 252 | mmc3_pins_sdr12: mmc3_pins_sdr12 { |
253 | pinctrl-single,pins = < | 253 | pinctrl-single,pins = < |
254 | DRA7XX_CORE_IOPAD(0x377c, (PIN_INPUT_PULLUP | MUX_MODE0)) /* mmc3_clk.mmc3_clk */ | 254 | DRA7XX_CORE_IOPAD(0x377c, (PIN_INPUT_PULLUP | MODE_SELECT | MUX_MODE0)) /* mmc3_clk.mmc3_clk */ |
255 | DRA7XX_CORE_IOPAD(0x3780, (PIN_INPUT_PULLUP | MUX_MODE0)) /* mmc3_cmd.mmc3_cmd */ | 255 | DRA7XX_CORE_IOPAD(0x3780, (PIN_INPUT_PULLUP | MODE_SELECT | MUX_MODE0)) /* mmc3_cmd.mmc3_cmd */ |
256 | DRA7XX_CORE_IOPAD(0x3784, (PIN_INPUT_PULLUP | MUX_MODE0)) /* mmc3_dat0.mmc3_dat0 */ | 256 | DRA7XX_CORE_IOPAD(0x3784, (PIN_INPUT_PULLUP | MODE_SELECT | MUX_MODE0)) /* mmc3_dat0.mmc3_dat0 */ |
257 | DRA7XX_CORE_IOPAD(0x3788, (PIN_INPUT_PULLUP | MUX_MODE0)) /* mmc3_dat1.mmc3_dat1 */ | 257 | DRA7XX_CORE_IOPAD(0x3788, (PIN_INPUT_PULLUP | MODE_SELECT | MUX_MODE0)) /* mmc3_dat1.mmc3_dat1 */ |
258 | DRA7XX_CORE_IOPAD(0x378c, (PIN_INPUT_PULLUP | MUX_MODE0)) /* mmc3_dat2.mmc3_dat2 */ | 258 | DRA7XX_CORE_IOPAD(0x378c, (PIN_INPUT_PULLUP | MODE_SELECT | MUX_MODE0)) /* mmc3_dat2.mmc3_dat2 */ |
259 | DRA7XX_CORE_IOPAD(0x3790, (PIN_INPUT_PULLUP | MUX_MODE0)) /* mmc3_dat3.mmc3_dat3 */ | 259 | DRA7XX_CORE_IOPAD(0x3790, (PIN_INPUT_PULLUP | MODE_SELECT | MUX_MODE0)) /* mmc3_dat3.mmc3_dat3 */ |
260 | >; | 260 | >; |
261 | }; | 261 | }; |
262 | 262 | ||
263 | mmc3_pins_sdr25: mmc3_pins_sdr25 { | 263 | mmc3_pins_sdr25: mmc3_pins_sdr25 { |
264 | pinctrl-single,pins = < | 264 | pinctrl-single,pins = < |
265 | DRA7XX_CORE_IOPAD(0x377c, (PIN_INPUT_PULLUP | MUX_MODE0)) /* mmc3_clk.mmc3_clk */ | 265 | DRA7XX_CORE_IOPAD(0x377c, (PIN_INPUT_PULLUP | MODE_SELECT | MUX_MODE0)) /* mmc3_clk.mmc3_clk */ |
266 | DRA7XX_CORE_IOPAD(0x3780, (PIN_INPUT_PULLUP | MUX_MODE0)) /* mmc3_cmd.mmc3_cmd */ | 266 | DRA7XX_CORE_IOPAD(0x3780, (PIN_INPUT_PULLUP | MODE_SELECT | MUX_MODE0)) /* mmc3_cmd.mmc3_cmd */ |
267 | DRA7XX_CORE_IOPAD(0x3784, (PIN_INPUT_PULLUP | MUX_MODE0)) /* mmc3_dat0.mmc3_dat0 */ | 267 | DRA7XX_CORE_IOPAD(0x3784, (PIN_INPUT_PULLUP | MODE_SELECT | MUX_MODE0)) /* mmc3_dat0.mmc3_dat0 */ |
268 | DRA7XX_CORE_IOPAD(0x3788, (PIN_INPUT_PULLUP | MUX_MODE0)) /* mmc3_dat1.mmc3_dat1 */ | 268 | DRA7XX_CORE_IOPAD(0x3788, (PIN_INPUT_PULLUP | MODE_SELECT | MUX_MODE0)) /* mmc3_dat1.mmc3_dat1 */ |
269 | DRA7XX_CORE_IOPAD(0x378c, (PIN_INPUT_PULLUP | MUX_MODE0)) /* mmc3_dat2.mmc3_dat2 */ | 269 | DRA7XX_CORE_IOPAD(0x378c, (PIN_INPUT_PULLUP | MODE_SELECT | MUX_MODE0)) /* mmc3_dat2.mmc3_dat2 */ |
270 | DRA7XX_CORE_IOPAD(0x3790, (PIN_INPUT_PULLUP | MUX_MODE0)) /* mmc3_dat3.mmc3_dat3 */ | 270 | DRA7XX_CORE_IOPAD(0x3790, (PIN_INPUT_PULLUP | MODE_SELECT | MUX_MODE0)) /* mmc3_dat3.mmc3_dat3 */ |
271 | >; | 271 | >; |
272 | }; | 272 | }; |
273 | 273 | ||
diff --git a/arch/arm/boot/dts/vf610-bk4.dts b/arch/arm/boot/dts/vf610-bk4.dts index 3fa0cbe456db..0f3870d3b099 100644 --- a/arch/arm/boot/dts/vf610-bk4.dts +++ b/arch/arm/boot/dts/vf610-bk4.dts | |||
@@ -246,13 +246,13 @@ | |||
246 | reg = <0>; | 246 | reg = <0>; |
247 | }; | 247 | }; |
248 | 248 | ||
249 | n25q128a13_2: flash@1 { | 249 | n25q128a13_2: flash@2 { |
250 | compatible = "n25q128a13", "jedec,spi-nor"; | 250 | compatible = "n25q128a13", "jedec,spi-nor"; |
251 | #address-cells = <1>; | 251 | #address-cells = <1>; |
252 | #size-cells = <1>; | 252 | #size-cells = <1>; |
253 | spi-max-frequency = <66000000>; | 253 | spi-max-frequency = <66000000>; |
254 | spi-rx-bus-width = <2>; | 254 | spi-rx-bus-width = <2>; |
255 | reg = <1>; | 255 | reg = <2>; |
256 | }; | 256 | }; |
257 | }; | 257 | }; |
258 | 258 | ||
diff --git a/arch/arm/lib/backtrace.S b/arch/arm/lib/backtrace.S index 1d5210eb4776..582925238d65 100644 --- a/arch/arm/lib/backtrace.S +++ b/arch/arm/lib/backtrace.S | |||
@@ -66,7 +66,7 @@ for_each_frame: tst frame, mask @ Check for address exceptions | |||
66 | 66 | ||
67 | 1003: ldr r2, [sv_pc, #-4] @ if stmfd sp!, {args} exists, | 67 | 1003: ldr r2, [sv_pc, #-4] @ if stmfd sp!, {args} exists, |
68 | ldr r3, .Ldsi+4 @ adjust saved 'pc' back one | 68 | ldr r3, .Ldsi+4 @ adjust saved 'pc' back one |
69 | teq r3, r2, lsr #10 @ instruction | 69 | teq r3, r2, lsr #11 @ instruction |
70 | subne r0, sv_pc, #4 @ allow for mov | 70 | subne r0, sv_pc, #4 @ allow for mov |
71 | subeq r0, sv_pc, #8 @ allow for mov + stmia | 71 | subeq r0, sv_pc, #8 @ allow for mov + stmia |
72 | 72 | ||
diff --git a/arch/arm/mach-omap1/ams-delta-fiq-handler.S b/arch/arm/mach-omap1/ams-delta-fiq-handler.S index 81159af44862..14a6c3eb3298 100644 --- a/arch/arm/mach-omap1/ams-delta-fiq-handler.S +++ b/arch/arm/mach-omap1/ams-delta-fiq-handler.S | |||
@@ -126,6 +126,8 @@ restart: | |||
126 | orr r11, r11, r13 @ mask all requested interrupts | 126 | orr r11, r11, r13 @ mask all requested interrupts |
127 | str r11, [r12, #OMAP1510_GPIO_INT_MASK] | 127 | str r11, [r12, #OMAP1510_GPIO_INT_MASK] |
128 | 128 | ||
129 | str r13, [r12, #OMAP1510_GPIO_INT_STATUS] @ ack all requested interrupts | ||
130 | |||
129 | ands r10, r13, #KEYBRD_CLK_MASK @ extract keyboard status - set? | 131 | ands r10, r13, #KEYBRD_CLK_MASK @ extract keyboard status - set? |
130 | beq hksw @ no - try next source | 132 | beq hksw @ no - try next source |
131 | 133 | ||
@@ -133,7 +135,6 @@ restart: | |||
133 | @@@@@@@@@@@@@@@@@@@@@@ | 135 | @@@@@@@@@@@@@@@@@@@@@@ |
134 | @ Keyboard clock FIQ mode interrupt handler | 136 | @ Keyboard clock FIQ mode interrupt handler |
135 | @ r10 now contains KEYBRD_CLK_MASK, use it | 137 | @ r10 now contains KEYBRD_CLK_MASK, use it |
136 | str r10, [r12, #OMAP1510_GPIO_INT_STATUS] @ ack the interrupt | ||
137 | bic r11, r11, r10 @ unmask it | 138 | bic r11, r11, r10 @ unmask it |
138 | str r11, [r12, #OMAP1510_GPIO_INT_MASK] | 139 | str r11, [r12, #OMAP1510_GPIO_INT_MASK] |
139 | 140 | ||
diff --git a/arch/arm/mach-omap1/ams-delta-fiq.c b/arch/arm/mach-omap1/ams-delta-fiq.c index 43899fa56674..0254eb9cf8c6 100644 --- a/arch/arm/mach-omap1/ams-delta-fiq.c +++ b/arch/arm/mach-omap1/ams-delta-fiq.c | |||
@@ -70,9 +70,7 @@ static irqreturn_t deferred_fiq(int irq, void *dev_id) | |||
70 | * interrupts default to since commit 80ac93c27441 | 70 | * interrupts default to since commit 80ac93c27441 |
71 | * requires interrupt already acked and unmasked. | 71 | * requires interrupt already acked and unmasked. |
72 | */ | 72 | */ |
73 | if (irq_chip->irq_ack) | 73 | if (!WARN_ON_ONCE(!irq_chip->irq_unmask)) |
74 | irq_chip->irq_ack(d); | ||
75 | if (irq_chip->irq_unmask) | ||
76 | irq_chip->irq_unmask(d); | 74 | irq_chip->irq_unmask(d); |
77 | } | 75 | } |
78 | for (; irq_counter[gpio] < fiq_count; irq_counter[gpio]++) | 76 | for (; irq_counter[gpio] < fiq_count; irq_counter[gpio]++) |
diff --git a/arch/arm/mach-omap2/omap4-common.c b/arch/arm/mach-omap2/omap4-common.c index f9c02f9f1c92..5c3845730dbf 100644 --- a/arch/arm/mach-omap2/omap4-common.c +++ b/arch/arm/mach-omap2/omap4-common.c | |||
@@ -127,6 +127,9 @@ static int __init omap4_sram_init(void) | |||
127 | struct device_node *np; | 127 | struct device_node *np; |
128 | struct gen_pool *sram_pool; | 128 | struct gen_pool *sram_pool; |
129 | 129 | ||
130 | if (!soc_is_omap44xx() && !soc_is_omap54xx()) | ||
131 | return 0; | ||
132 | |||
130 | np = of_find_compatible_node(NULL, NULL, "ti,omap4-mpu"); | 133 | np = of_find_compatible_node(NULL, NULL, "ti,omap4-mpu"); |
131 | if (!np) | 134 | if (!np) |
132 | pr_warn("%s:Unable to allocate sram needed to handle errata I688\n", | 135 | pr_warn("%s:Unable to allocate sram needed to handle errata I688\n", |
diff --git a/arch/arm/mach-omap2/omap_hwmod_7xx_data.c b/arch/arm/mach-omap2/omap_hwmod_7xx_data.c index 4a5b4aee6615..1ec21e9ba1e9 100644 --- a/arch/arm/mach-omap2/omap_hwmod_7xx_data.c +++ b/arch/arm/mach-omap2/omap_hwmod_7xx_data.c | |||
@@ -379,7 +379,8 @@ static struct omap_hwmod dra7xx_dcan2_hwmod = { | |||
379 | static struct omap_hwmod_class_sysconfig dra7xx_epwmss_sysc = { | 379 | static struct omap_hwmod_class_sysconfig dra7xx_epwmss_sysc = { |
380 | .rev_offs = 0x0, | 380 | .rev_offs = 0x0, |
381 | .sysc_offs = 0x4, | 381 | .sysc_offs = 0x4, |
382 | .sysc_flags = SYSC_HAS_SIDLEMODE | SYSC_HAS_SOFTRESET, | 382 | .sysc_flags = SYSC_HAS_SIDLEMODE | SYSC_HAS_SOFTRESET | |
383 | SYSC_HAS_RESET_STATUS, | ||
383 | .idlemodes = (SIDLE_FORCE | SIDLE_NO | SIDLE_SMART), | 384 | .idlemodes = (SIDLE_FORCE | SIDLE_NO | SIDLE_SMART), |
384 | .sysc_fields = &omap_hwmod_sysc_type2, | 385 | .sysc_fields = &omap_hwmod_sysc_type2, |
385 | }; | 386 | }; |
diff --git a/arch/arm/mm/init.c b/arch/arm/mm/init.c index 16d373d587c4..b4be3baa83d4 100644 --- a/arch/arm/mm/init.c +++ b/arch/arm/mm/init.c | |||
@@ -175,6 +175,11 @@ static void __init zone_sizes_init(unsigned long min, unsigned long max_low, | |||
175 | #ifdef CONFIG_HAVE_ARCH_PFN_VALID | 175 | #ifdef CONFIG_HAVE_ARCH_PFN_VALID |
176 | int pfn_valid(unsigned long pfn) | 176 | int pfn_valid(unsigned long pfn) |
177 | { | 177 | { |
178 | phys_addr_t addr = __pfn_to_phys(pfn); | ||
179 | |||
180 | if (__phys_to_pfn(addr) != pfn) | ||
181 | return 0; | ||
182 | |||
178 | return memblock_is_map_memory(__pfn_to_phys(pfn)); | 183 | return memblock_is_map_memory(__pfn_to_phys(pfn)); |
179 | } | 184 | } |
180 | EXPORT_SYMBOL(pfn_valid); | 185 | EXPORT_SYMBOL(pfn_valid); |
@@ -628,7 +633,8 @@ static void update_sections_early(struct section_perm perms[], int n) | |||
628 | if (t->flags & PF_KTHREAD) | 633 | if (t->flags & PF_KTHREAD) |
629 | continue; | 634 | continue; |
630 | for_each_thread(t, s) | 635 | for_each_thread(t, s) |
631 | set_section_perms(perms, n, true, s->mm); | 636 | if (s->mm) |
637 | set_section_perms(perms, n, true, s->mm); | ||
632 | } | 638 | } |
633 | set_section_perms(perms, n, true, current->active_mm); | 639 | set_section_perms(perms, n, true, current->active_mm); |
634 | set_section_perms(perms, n, true, &init_mm); | 640 | set_section_perms(perms, n, true, &init_mm); |
diff --git a/arch/arm64/boot/dts/amlogic/meson-g12a-sei510.dts b/arch/arm64/boot/dts/amlogic/meson-g12a-sei510.dts index c7a87368850b..12aa7eaeaf68 100644 --- a/arch/arm64/boot/dts/amlogic/meson-g12a-sei510.dts +++ b/arch/arm64/boot/dts/amlogic/meson-g12a-sei510.dts | |||
@@ -339,6 +339,12 @@ | |||
339 | pinctrl-names = "default"; | 339 | pinctrl-names = "default"; |
340 | }; | 340 | }; |
341 | 341 | ||
342 | &ir { | ||
343 | status = "okay"; | ||
344 | pinctrl-0 = <&remote_input_ao_pins>; | ||
345 | pinctrl-names = "default"; | ||
346 | }; | ||
347 | |||
342 | &pwm_ef { | 348 | &pwm_ef { |
343 | status = "okay"; | 349 | status = "okay"; |
344 | pinctrl-0 = <&pwm_e_pins>; | 350 | pinctrl-0 = <&pwm_e_pins>; |
diff --git a/arch/arm64/boot/dts/amlogic/meson-g12a.dtsi b/arch/arm64/boot/dts/amlogic/meson-g12a.dtsi index f8d43e3dcf20..1785552d450c 100644 --- a/arch/arm64/boot/dts/amlogic/meson-g12a.dtsi +++ b/arch/arm64/boot/dts/amlogic/meson-g12a.dtsi | |||
@@ -2386,6 +2386,7 @@ | |||
2386 | clocks = <&clkc CLKID_USB1_DDR_BRIDGE>; | 2386 | clocks = <&clkc CLKID_USB1_DDR_BRIDGE>; |
2387 | clock-names = "ddr"; | 2387 | clock-names = "ddr"; |
2388 | phys = <&usb2_phy1>; | 2388 | phys = <&usb2_phy1>; |
2389 | phy-names = "usb2-phy"; | ||
2389 | dr_mode = "peripheral"; | 2390 | dr_mode = "peripheral"; |
2390 | g-rx-fifo-size = <192>; | 2391 | g-rx-fifo-size = <192>; |
2391 | g-np-tx-fifo-size = <128>; | 2392 | g-np-tx-fifo-size = <128>; |
diff --git a/arch/arm64/boot/dts/amlogic/meson-g12b-odroid-n2.dts b/arch/arm64/boot/dts/amlogic/meson-g12b-odroid-n2.dts index 81780ffcc7f0..4e916e1f71f7 100644 --- a/arch/arm64/boot/dts/amlogic/meson-g12b-odroid-n2.dts +++ b/arch/arm64/boot/dts/amlogic/meson-g12b-odroid-n2.dts | |||
@@ -53,6 +53,7 @@ | |||
53 | 53 | ||
54 | gpio = <&gpio_ao GPIOAO_8 GPIO_ACTIVE_HIGH>; | 54 | gpio = <&gpio_ao GPIOAO_8 GPIO_ACTIVE_HIGH>; |
55 | enable-active-high; | 55 | enable-active-high; |
56 | regulator-always-on; | ||
56 | }; | 57 | }; |
57 | 58 | ||
58 | tf_io: gpio-regulator-tf_io { | 59 | tf_io: gpio-regulator-tf_io { |
diff --git a/arch/nds32/kernel/signal.c b/arch/nds32/kernel/signal.c index fe61513982b4..330b19fcd990 100644 --- a/arch/nds32/kernel/signal.c +++ b/arch/nds32/kernel/signal.c | |||
@@ -316,6 +316,7 @@ static void handle_signal(struct ksignal *ksig, struct pt_regs *regs) | |||
316 | regs->uregs[0] = -EINTR; | 316 | regs->uregs[0] = -EINTR; |
317 | break; | 317 | break; |
318 | } | 318 | } |
319 | /* Else, fall through */ | ||
319 | case -ERESTARTNOINTR: | 320 | case -ERESTARTNOINTR: |
320 | regs->uregs[0] = regs->orig_r0; | 321 | regs->uregs[0] = regs->orig_r0; |
321 | regs->ipc -= 4; | 322 | regs->ipc -= 4; |
@@ -360,6 +361,7 @@ static void do_signal(struct pt_regs *regs) | |||
360 | switch (regs->uregs[0]) { | 361 | switch (regs->uregs[0]) { |
361 | case -ERESTART_RESTARTBLOCK: | 362 | case -ERESTART_RESTARTBLOCK: |
362 | regs->uregs[15] = __NR_restart_syscall; | 363 | regs->uregs[15] = __NR_restart_syscall; |
364 | /* Fall through */ | ||
363 | case -ERESTARTNOHAND: | 365 | case -ERESTARTNOHAND: |
364 | case -ERESTARTSYS: | 366 | case -ERESTARTSYS: |
365 | case -ERESTARTNOINTR: | 367 | case -ERESTARTNOINTR: |
diff --git a/arch/powerpc/kvm/book3s_64_vio.c b/arch/powerpc/kvm/book3s_64_vio.c index e99a14798ab0..c4b606fe73eb 100644 --- a/arch/powerpc/kvm/book3s_64_vio.c +++ b/arch/powerpc/kvm/book3s_64_vio.c | |||
@@ -660,8 +660,10 @@ long kvmppc_h_put_tce_indirect(struct kvm_vcpu *vcpu, | |||
660 | } | 660 | } |
661 | tce = be64_to_cpu(tce); | 661 | tce = be64_to_cpu(tce); |
662 | 662 | ||
663 | if (kvmppc_tce_to_ua(vcpu->kvm, tce, &ua)) | 663 | if (kvmppc_tce_to_ua(vcpu->kvm, tce, &ua)) { |
664 | return H_PARAMETER; | 664 | ret = H_PARAMETER; |
665 | goto unlock_exit; | ||
666 | } | ||
665 | 667 | ||
666 | list_for_each_entry_lockless(stit, &stt->iommu_tables, next) { | 668 | list_for_each_entry_lockless(stit, &stt->iommu_tables, next) { |
667 | ret = kvmppc_tce_iommu_map(vcpu->kvm, stt, | 669 | ret = kvmppc_tce_iommu_map(vcpu->kvm, stt, |
diff --git a/arch/powerpc/kvm/book3s_64_vio_hv.c b/arch/powerpc/kvm/book3s_64_vio_hv.c index f50bbeedfc66..b4f20f13b860 100644 --- a/arch/powerpc/kvm/book3s_64_vio_hv.c +++ b/arch/powerpc/kvm/book3s_64_vio_hv.c | |||
@@ -556,8 +556,10 @@ long kvmppc_rm_h_put_tce_indirect(struct kvm_vcpu *vcpu, | |||
556 | unsigned long tce = be64_to_cpu(((u64 *)tces)[i]); | 556 | unsigned long tce = be64_to_cpu(((u64 *)tces)[i]); |
557 | 557 | ||
558 | ua = 0; | 558 | ua = 0; |
559 | if (kvmppc_rm_tce_to_ua(vcpu->kvm, tce, &ua, NULL)) | 559 | if (kvmppc_rm_tce_to_ua(vcpu->kvm, tce, &ua, NULL)) { |
560 | return H_PARAMETER; | 560 | ret = H_PARAMETER; |
561 | goto unlock_exit; | ||
562 | } | ||
561 | 563 | ||
562 | list_for_each_entry_lockless(stit, &stt->iommu_tables, next) { | 564 | list_for_each_entry_lockless(stit, &stt->iommu_tables, next) { |
563 | ret = kvmppc_rm_tce_iommu_map(vcpu->kvm, stt, | 565 | ret = kvmppc_rm_tce_iommu_map(vcpu->kvm, stt, |
diff --git a/arch/riscv/include/asm/fixmap.h b/arch/riscv/include/asm/fixmap.h index 9c66033c3a54..161f28d04a07 100644 --- a/arch/riscv/include/asm/fixmap.h +++ b/arch/riscv/include/asm/fixmap.h | |||
@@ -30,10 +30,6 @@ enum fixed_addresses { | |||
30 | __end_of_fixed_addresses | 30 | __end_of_fixed_addresses |
31 | }; | 31 | }; |
32 | 32 | ||
33 | #define FIXADDR_SIZE (__end_of_fixed_addresses * PAGE_SIZE) | ||
34 | #define FIXADDR_TOP (VMALLOC_START) | ||
35 | #define FIXADDR_START (FIXADDR_TOP - FIXADDR_SIZE) | ||
36 | |||
37 | #define FIXMAP_PAGE_IO PAGE_KERNEL | 33 | #define FIXMAP_PAGE_IO PAGE_KERNEL |
38 | 34 | ||
39 | #define __early_set_fixmap __set_fixmap | 35 | #define __early_set_fixmap __set_fixmap |
diff --git a/arch/riscv/include/asm/pgtable.h b/arch/riscv/include/asm/pgtable.h index a364aba23d55..c24a083b3e12 100644 --- a/arch/riscv/include/asm/pgtable.h +++ b/arch/riscv/include/asm/pgtable.h | |||
@@ -420,14 +420,22 @@ static inline void pgtable_cache_init(void) | |||
420 | #define VMALLOC_END (PAGE_OFFSET - 1) | 420 | #define VMALLOC_END (PAGE_OFFSET - 1) |
421 | #define VMALLOC_START (PAGE_OFFSET - VMALLOC_SIZE) | 421 | #define VMALLOC_START (PAGE_OFFSET - VMALLOC_SIZE) |
422 | 422 | ||
423 | #define FIXADDR_TOP VMALLOC_START | ||
424 | #ifdef CONFIG_64BIT | ||
425 | #define FIXADDR_SIZE PMD_SIZE | ||
426 | #else | ||
427 | #define FIXADDR_SIZE PGDIR_SIZE | ||
428 | #endif | ||
429 | #define FIXADDR_START (FIXADDR_TOP - FIXADDR_SIZE) | ||
430 | |||
423 | /* | 431 | /* |
424 | * Task size is 0x4000000000 for RV64 or 0xb800000 for RV32. | 432 | * Task size is 0x4000000000 for RV64 or 0x9fc00000 for RV32. |
425 | * Note that PGDIR_SIZE must evenly divide TASK_SIZE. | 433 | * Note that PGDIR_SIZE must evenly divide TASK_SIZE. |
426 | */ | 434 | */ |
427 | #ifdef CONFIG_64BIT | 435 | #ifdef CONFIG_64BIT |
428 | #define TASK_SIZE (PGDIR_SIZE * PTRS_PER_PGD / 2) | 436 | #define TASK_SIZE (PGDIR_SIZE * PTRS_PER_PGD / 2) |
429 | #else | 437 | #else |
430 | #define TASK_SIZE VMALLOC_START | 438 | #define TASK_SIZE FIXADDR_START |
431 | #endif | 439 | #endif |
432 | 440 | ||
433 | #include <asm-generic/pgtable.h> | 441 | #include <asm-generic/pgtable.h> |
diff --git a/arch/x86/Makefile b/arch/x86/Makefile index 56e748a7679f..94df0868804b 100644 --- a/arch/x86/Makefile +++ b/arch/x86/Makefile | |||
@@ -38,6 +38,7 @@ REALMODE_CFLAGS := $(M16_CFLAGS) -g -Os -DDISABLE_BRANCH_PROFILING \ | |||
38 | 38 | ||
39 | REALMODE_CFLAGS += $(call __cc-option, $(CC), $(REALMODE_CFLAGS), -ffreestanding) | 39 | REALMODE_CFLAGS += $(call __cc-option, $(CC), $(REALMODE_CFLAGS), -ffreestanding) |
40 | REALMODE_CFLAGS += $(call __cc-option, $(CC), $(REALMODE_CFLAGS), -fno-stack-protector) | 40 | REALMODE_CFLAGS += $(call __cc-option, $(CC), $(REALMODE_CFLAGS), -fno-stack-protector) |
41 | REALMODE_CFLAGS += $(call __cc-option, $(CC), $(REALMODE_CFLAGS), -Wno-address-of-packed-member) | ||
41 | REALMODE_CFLAGS += $(call __cc-option, $(CC), $(REALMODE_CFLAGS), $(cc_stack_align4)) | 42 | REALMODE_CFLAGS += $(call __cc-option, $(CC), $(REALMODE_CFLAGS), $(cc_stack_align4)) |
42 | export REALMODE_CFLAGS | 43 | export REALMODE_CFLAGS |
43 | 44 | ||
diff --git a/arch/x86/boot/compressed/pgtable_64.c b/arch/x86/boot/compressed/pgtable_64.c index 2faddeb0398a..c8862696a47b 100644 --- a/arch/x86/boot/compressed/pgtable_64.c +++ b/arch/x86/boot/compressed/pgtable_64.c | |||
@@ -72,7 +72,7 @@ static unsigned long find_trampoline_placement(void) | |||
72 | 72 | ||
73 | /* Find the first usable memory region under bios_start. */ | 73 | /* Find the first usable memory region under bios_start. */ |
74 | for (i = boot_params->e820_entries - 1; i >= 0; i--) { | 74 | for (i = boot_params->e820_entries - 1; i >= 0; i--) { |
75 | unsigned long new; | 75 | unsigned long new = bios_start; |
76 | 76 | ||
77 | entry = &boot_params->e820_table[i]; | 77 | entry = &boot_params->e820_table[i]; |
78 | 78 | ||
diff --git a/arch/x86/events/amd/ibs.c b/arch/x86/events/amd/ibs.c index 62f317c9113a..5b35b7ea5d72 100644 --- a/arch/x86/events/amd/ibs.c +++ b/arch/x86/events/amd/ibs.c | |||
@@ -661,10 +661,17 @@ fail: | |||
661 | 661 | ||
662 | throttle = perf_event_overflow(event, &data, ®s); | 662 | throttle = perf_event_overflow(event, &data, ®s); |
663 | out: | 663 | out: |
664 | if (throttle) | 664 | if (throttle) { |
665 | perf_ibs_stop(event, 0); | 665 | perf_ibs_stop(event, 0); |
666 | else | 666 | } else { |
667 | perf_ibs_enable_event(perf_ibs, hwc, period >> 4); | 667 | period >>= 4; |
668 | |||
669 | if ((ibs_caps & IBS_CAPS_RDWROPCNT) && | ||
670 | (*config & IBS_OP_CNT_CTL)) | ||
671 | period |= *config & IBS_OP_CUR_CNT_RAND; | ||
672 | |||
673 | perf_ibs_enable_event(perf_ibs, hwc, period); | ||
674 | } | ||
668 | 675 | ||
669 | perf_event_update_userpage(event); | 676 | perf_event_update_userpage(event); |
670 | 677 | ||
diff --git a/arch/x86/events/intel/core.c b/arch/x86/events/intel/core.c index 648260b5f367..e4c2cb65ea50 100644 --- a/arch/x86/events/intel/core.c +++ b/arch/x86/events/intel/core.c | |||
@@ -3572,6 +3572,11 @@ static u64 bdw_limit_period(struct perf_event *event, u64 left) | |||
3572 | return left; | 3572 | return left; |
3573 | } | 3573 | } |
3574 | 3574 | ||
3575 | static u64 nhm_limit_period(struct perf_event *event, u64 left) | ||
3576 | { | ||
3577 | return max(left, 32ULL); | ||
3578 | } | ||
3579 | |||
3575 | PMU_FORMAT_ATTR(event, "config:0-7" ); | 3580 | PMU_FORMAT_ATTR(event, "config:0-7" ); |
3576 | PMU_FORMAT_ATTR(umask, "config:8-15" ); | 3581 | PMU_FORMAT_ATTR(umask, "config:8-15" ); |
3577 | PMU_FORMAT_ATTR(edge, "config:18" ); | 3582 | PMU_FORMAT_ATTR(edge, "config:18" ); |
@@ -4606,6 +4611,7 @@ __init int intel_pmu_init(void) | |||
4606 | x86_pmu.pebs_constraints = intel_nehalem_pebs_event_constraints; | 4611 | x86_pmu.pebs_constraints = intel_nehalem_pebs_event_constraints; |
4607 | x86_pmu.enable_all = intel_pmu_nhm_enable_all; | 4612 | x86_pmu.enable_all = intel_pmu_nhm_enable_all; |
4608 | x86_pmu.extra_regs = intel_nehalem_extra_regs; | 4613 | x86_pmu.extra_regs = intel_nehalem_extra_regs; |
4614 | x86_pmu.limit_period = nhm_limit_period; | ||
4609 | 4615 | ||
4610 | mem_attr = nhm_mem_events_attrs; | 4616 | mem_attr = nhm_mem_events_attrs; |
4611 | 4617 | ||
diff --git a/arch/x86/include/asm/ftrace.h b/arch/x86/include/asm/ftrace.h index 287f1f7b2e52..c38a66661576 100644 --- a/arch/x86/include/asm/ftrace.h +++ b/arch/x86/include/asm/ftrace.h | |||
@@ -16,7 +16,6 @@ | |||
16 | #define HAVE_FUNCTION_GRAPH_RET_ADDR_PTR | 16 | #define HAVE_FUNCTION_GRAPH_RET_ADDR_PTR |
17 | 17 | ||
18 | #ifndef __ASSEMBLY__ | 18 | #ifndef __ASSEMBLY__ |
19 | extern void mcount(void); | ||
20 | extern atomic_t modifying_ftrace_code; | 19 | extern atomic_t modifying_ftrace_code; |
21 | extern void __fentry__(void); | 20 | extern void __fentry__(void); |
22 | 21 | ||
diff --git a/arch/x86/include/asm/perf_event.h b/arch/x86/include/asm/perf_event.h index 1392d5e6e8d6..ee26e9215f18 100644 --- a/arch/x86/include/asm/perf_event.h +++ b/arch/x86/include/asm/perf_event.h | |||
@@ -252,16 +252,20 @@ struct pebs_lbr { | |||
252 | #define IBSCTL_LVT_OFFSET_VALID (1ULL<<8) | 252 | #define IBSCTL_LVT_OFFSET_VALID (1ULL<<8) |
253 | #define IBSCTL_LVT_OFFSET_MASK 0x0F | 253 | #define IBSCTL_LVT_OFFSET_MASK 0x0F |
254 | 254 | ||
255 | /* ibs fetch bits/masks */ | 255 | /* IBS fetch bits/masks */ |
256 | #define IBS_FETCH_RAND_EN (1ULL<<57) | 256 | #define IBS_FETCH_RAND_EN (1ULL<<57) |
257 | #define IBS_FETCH_VAL (1ULL<<49) | 257 | #define IBS_FETCH_VAL (1ULL<<49) |
258 | #define IBS_FETCH_ENABLE (1ULL<<48) | 258 | #define IBS_FETCH_ENABLE (1ULL<<48) |
259 | #define IBS_FETCH_CNT 0xFFFF0000ULL | 259 | #define IBS_FETCH_CNT 0xFFFF0000ULL |
260 | #define IBS_FETCH_MAX_CNT 0x0000FFFFULL | 260 | #define IBS_FETCH_MAX_CNT 0x0000FFFFULL |
261 | 261 | ||
262 | /* ibs op bits/masks */ | 262 | /* |
263 | /* lower 4 bits of the current count are ignored: */ | 263 | * IBS op bits/masks |
264 | #define IBS_OP_CUR_CNT (0xFFFF0ULL<<32) | 264 | * The lower 7 bits of the current count are random bits |
265 | * preloaded by hardware and ignored in software | ||
266 | */ | ||
267 | #define IBS_OP_CUR_CNT (0xFFF80ULL<<32) | ||
268 | #define IBS_OP_CUR_CNT_RAND (0x0007FULL<<32) | ||
265 | #define IBS_OP_CNT_CTL (1ULL<<19) | 269 | #define IBS_OP_CNT_CTL (1ULL<<19) |
266 | #define IBS_OP_VAL (1ULL<<18) | 270 | #define IBS_OP_VAL (1ULL<<18) |
267 | #define IBS_OP_ENABLE (1ULL<<17) | 271 | #define IBS_OP_ENABLE (1ULL<<17) |
diff --git a/arch/x86/kernel/apic/apic.c b/arch/x86/kernel/apic/apic.c index aa5495d0f478..dba2828b779a 100644 --- a/arch/x86/kernel/apic/apic.c +++ b/arch/x86/kernel/apic/apic.c | |||
@@ -1179,6 +1179,10 @@ void clear_local_APIC(void) | |||
1179 | apic_write(APIC_LVT0, v | APIC_LVT_MASKED); | 1179 | apic_write(APIC_LVT0, v | APIC_LVT_MASKED); |
1180 | v = apic_read(APIC_LVT1); | 1180 | v = apic_read(APIC_LVT1); |
1181 | apic_write(APIC_LVT1, v | APIC_LVT_MASKED); | 1181 | apic_write(APIC_LVT1, v | APIC_LVT_MASKED); |
1182 | if (!x2apic_enabled()) { | ||
1183 | v = apic_read(APIC_LDR) & ~APIC_LDR_MASK; | ||
1184 | apic_write(APIC_LDR, v); | ||
1185 | } | ||
1182 | if (maxlvt >= 4) { | 1186 | if (maxlvt >= 4) { |
1183 | v = apic_read(APIC_LVTPC); | 1187 | v = apic_read(APIC_LVTPC); |
1184 | apic_write(APIC_LVTPC, v | APIC_LVT_MASKED); | 1188 | apic_write(APIC_LVTPC, v | APIC_LVT_MASKED); |
diff --git a/arch/x86/kernel/apic/bigsmp_32.c b/arch/x86/kernel/apic/bigsmp_32.c index afee386ff711..caedd8d60d36 100644 --- a/arch/x86/kernel/apic/bigsmp_32.c +++ b/arch/x86/kernel/apic/bigsmp_32.c | |||
@@ -38,32 +38,12 @@ static int bigsmp_early_logical_apicid(int cpu) | |||
38 | return early_per_cpu(x86_cpu_to_apicid, cpu); | 38 | return early_per_cpu(x86_cpu_to_apicid, cpu); |
39 | } | 39 | } |
40 | 40 | ||
41 | static inline unsigned long calculate_ldr(int cpu) | ||
42 | { | ||
43 | unsigned long val, id; | ||
44 | |||
45 | val = apic_read(APIC_LDR) & ~APIC_LDR_MASK; | ||
46 | id = per_cpu(x86_bios_cpu_apicid, cpu); | ||
47 | val |= SET_APIC_LOGICAL_ID(id); | ||
48 | |||
49 | return val; | ||
50 | } | ||
51 | |||
52 | /* | 41 | /* |
53 | * Set up the logical destination ID. | 42 | * bigsmp enables physical destination mode |
54 | * | 43 | * and doesn't use LDR and DFR |
55 | * Intel recommends to set DFR, LDR and TPR before enabling | ||
56 | * an APIC. See e.g. "AP-388 82489DX User's Manual" (Intel | ||
57 | * document number 292116). So here it goes... | ||
58 | */ | 44 | */ |
59 | static void bigsmp_init_apic_ldr(void) | 45 | static void bigsmp_init_apic_ldr(void) |
60 | { | 46 | { |
61 | unsigned long val; | ||
62 | int cpu = smp_processor_id(); | ||
63 | |||
64 | apic_write(APIC_DFR, APIC_DFR_FLAT); | ||
65 | val = calculate_ldr(cpu); | ||
66 | apic_write(APIC_LDR, val); | ||
67 | } | 47 | } |
68 | 48 | ||
69 | static void bigsmp_setup_apic_routing(void) | 49 | static void bigsmp_setup_apic_routing(void) |
diff --git a/arch/x86/kernel/apic/io_apic.c b/arch/x86/kernel/apic/io_apic.c index c7bb6c69f21c..d6af97fd170a 100644 --- a/arch/x86/kernel/apic/io_apic.c +++ b/arch/x86/kernel/apic/io_apic.c | |||
@@ -2438,7 +2438,13 @@ unsigned int arch_dynirq_lower_bound(unsigned int from) | |||
2438 | * dmar_alloc_hwirq() may be called before setup_IO_APIC(), so use | 2438 | * dmar_alloc_hwirq() may be called before setup_IO_APIC(), so use |
2439 | * gsi_top if ioapic_dynirq_base hasn't been initialized yet. | 2439 | * gsi_top if ioapic_dynirq_base hasn't been initialized yet. |
2440 | */ | 2440 | */ |
2441 | return ioapic_initialized ? ioapic_dynirq_base : gsi_top; | 2441 | if (!ioapic_initialized) |
2442 | return gsi_top; | ||
2443 | /* | ||
2444 | * For DT enabled machines ioapic_dynirq_base is irrelevant and not | ||
2445 | * updated. So simply return @from if ioapic_dynirq_base == 0. | ||
2446 | */ | ||
2447 | return ioapic_dynirq_base ? : from; | ||
2442 | } | 2448 | } |
2443 | 2449 | ||
2444 | #ifdef CONFIG_X86_32 | 2450 | #ifdef CONFIG_X86_32 |
diff --git a/arch/x86/kernel/uprobes.c b/arch/x86/kernel/uprobes.c index d8359ebeea70..8cd745ef8c7b 100644 --- a/arch/x86/kernel/uprobes.c +++ b/arch/x86/kernel/uprobes.c | |||
@@ -508,9 +508,12 @@ struct uprobe_xol_ops { | |||
508 | void (*abort)(struct arch_uprobe *, struct pt_regs *); | 508 | void (*abort)(struct arch_uprobe *, struct pt_regs *); |
509 | }; | 509 | }; |
510 | 510 | ||
511 | static inline int sizeof_long(void) | 511 | static inline int sizeof_long(struct pt_regs *regs) |
512 | { | 512 | { |
513 | return in_ia32_syscall() ? 4 : 8; | 513 | /* |
514 | * Check registers for mode as in_xxx_syscall() does not apply here. | ||
515 | */ | ||
516 | return user_64bit_mode(regs) ? 8 : 4; | ||
514 | } | 517 | } |
515 | 518 | ||
516 | static int default_pre_xol_op(struct arch_uprobe *auprobe, struct pt_regs *regs) | 519 | static int default_pre_xol_op(struct arch_uprobe *auprobe, struct pt_regs *regs) |
@@ -521,9 +524,9 @@ static int default_pre_xol_op(struct arch_uprobe *auprobe, struct pt_regs *regs) | |||
521 | 524 | ||
522 | static int emulate_push_stack(struct pt_regs *regs, unsigned long val) | 525 | static int emulate_push_stack(struct pt_regs *regs, unsigned long val) |
523 | { | 526 | { |
524 | unsigned long new_sp = regs->sp - sizeof_long(); | 527 | unsigned long new_sp = regs->sp - sizeof_long(regs); |
525 | 528 | ||
526 | if (copy_to_user((void __user *)new_sp, &val, sizeof_long())) | 529 | if (copy_to_user((void __user *)new_sp, &val, sizeof_long(regs))) |
527 | return -EFAULT; | 530 | return -EFAULT; |
528 | 531 | ||
529 | regs->sp = new_sp; | 532 | regs->sp = new_sp; |
@@ -556,7 +559,7 @@ static int default_post_xol_op(struct arch_uprobe *auprobe, struct pt_regs *regs | |||
556 | long correction = utask->vaddr - utask->xol_vaddr; | 559 | long correction = utask->vaddr - utask->xol_vaddr; |
557 | regs->ip += correction; | 560 | regs->ip += correction; |
558 | } else if (auprobe->defparam.fixups & UPROBE_FIX_CALL) { | 561 | } else if (auprobe->defparam.fixups & UPROBE_FIX_CALL) { |
559 | regs->sp += sizeof_long(); /* Pop incorrect return address */ | 562 | regs->sp += sizeof_long(regs); /* Pop incorrect return address */ |
560 | if (emulate_push_stack(regs, utask->vaddr + auprobe->defparam.ilen)) | 563 | if (emulate_push_stack(regs, utask->vaddr + auprobe->defparam.ilen)) |
561 | return -ERESTART; | 564 | return -ERESTART; |
562 | } | 565 | } |
@@ -675,7 +678,7 @@ static int branch_post_xol_op(struct arch_uprobe *auprobe, struct pt_regs *regs) | |||
675 | * "call" insn was executed out-of-line. Just restore ->sp and restart. | 678 | * "call" insn was executed out-of-line. Just restore ->sp and restart. |
676 | * We could also restore ->ip and try to call branch_emulate_op() again. | 679 | * We could also restore ->ip and try to call branch_emulate_op() again. |
677 | */ | 680 | */ |
678 | regs->sp += sizeof_long(); | 681 | regs->sp += sizeof_long(regs); |
679 | return -ERESTART; | 682 | return -ERESTART; |
680 | } | 683 | } |
681 | 684 | ||
@@ -1056,7 +1059,7 @@ bool arch_uprobe_skip_sstep(struct arch_uprobe *auprobe, struct pt_regs *regs) | |||
1056 | unsigned long | 1059 | unsigned long |
1057 | arch_uretprobe_hijack_return_addr(unsigned long trampoline_vaddr, struct pt_regs *regs) | 1060 | arch_uretprobe_hijack_return_addr(unsigned long trampoline_vaddr, struct pt_regs *regs) |
1058 | { | 1061 | { |
1059 | int rasize = sizeof_long(), nleft; | 1062 | int rasize = sizeof_long(regs), nleft; |
1060 | unsigned long orig_ret_vaddr = 0; /* clear high bits for 32-bit apps */ | 1063 | unsigned long orig_ret_vaddr = 0; /* clear high bits for 32-bit apps */ |
1061 | 1064 | ||
1062 | if (copy_from_user(&orig_ret_vaddr, (void __user *)regs->sp, rasize)) | 1065 | if (copy_from_user(&orig_ret_vaddr, (void __user *)regs->sp, rasize)) |
diff --git a/arch/x86/kvm/hyperv.c b/arch/x86/kvm/hyperv.c index c10a8b10b203..fff790a3f4ee 100644 --- a/arch/x86/kvm/hyperv.c +++ b/arch/x86/kvm/hyperv.c | |||
@@ -1781,7 +1781,7 @@ int kvm_vm_ioctl_hv_eventfd(struct kvm *kvm, struct kvm_hyperv_eventfd *args) | |||
1781 | int kvm_vcpu_ioctl_get_hv_cpuid(struct kvm_vcpu *vcpu, struct kvm_cpuid2 *cpuid, | 1781 | int kvm_vcpu_ioctl_get_hv_cpuid(struct kvm_vcpu *vcpu, struct kvm_cpuid2 *cpuid, |
1782 | struct kvm_cpuid_entry2 __user *entries) | 1782 | struct kvm_cpuid_entry2 __user *entries) |
1783 | { | 1783 | { |
1784 | uint16_t evmcs_ver = kvm_x86_ops->nested_get_evmcs_version(vcpu); | 1784 | uint16_t evmcs_ver = 0; |
1785 | struct kvm_cpuid_entry2 cpuid_entries[] = { | 1785 | struct kvm_cpuid_entry2 cpuid_entries[] = { |
1786 | { .function = HYPERV_CPUID_VENDOR_AND_MAX_FUNCTIONS }, | 1786 | { .function = HYPERV_CPUID_VENDOR_AND_MAX_FUNCTIONS }, |
1787 | { .function = HYPERV_CPUID_INTERFACE }, | 1787 | { .function = HYPERV_CPUID_INTERFACE }, |
@@ -1793,6 +1793,9 @@ int kvm_vcpu_ioctl_get_hv_cpuid(struct kvm_vcpu *vcpu, struct kvm_cpuid2 *cpuid, | |||
1793 | }; | 1793 | }; |
1794 | int i, nent = ARRAY_SIZE(cpuid_entries); | 1794 | int i, nent = ARRAY_SIZE(cpuid_entries); |
1795 | 1795 | ||
1796 | if (kvm_x86_ops->nested_get_evmcs_version) | ||
1797 | evmcs_ver = kvm_x86_ops->nested_get_evmcs_version(vcpu); | ||
1798 | |||
1796 | /* Skip NESTED_FEATURES if eVMCS is not supported */ | 1799 | /* Skip NESTED_FEATURES if eVMCS is not supported */ |
1797 | if (!evmcs_ver) | 1800 | if (!evmcs_ver) |
1798 | --nent; | 1801 | --nent; |
diff --git a/arch/x86/kvm/svm.c b/arch/x86/kvm/svm.c index e3d3b2128f2b..e0368076a1ef 100644 --- a/arch/x86/kvm/svm.c +++ b/arch/x86/kvm/svm.c | |||
@@ -7128,12 +7128,6 @@ failed: | |||
7128 | return ret; | 7128 | return ret; |
7129 | } | 7129 | } |
7130 | 7130 | ||
7131 | static uint16_t nested_get_evmcs_version(struct kvm_vcpu *vcpu) | ||
7132 | { | ||
7133 | /* Not supported */ | ||
7134 | return 0; | ||
7135 | } | ||
7136 | |||
7137 | static int nested_enable_evmcs(struct kvm_vcpu *vcpu, | 7131 | static int nested_enable_evmcs(struct kvm_vcpu *vcpu, |
7138 | uint16_t *vmcs_version) | 7132 | uint16_t *vmcs_version) |
7139 | { | 7133 | { |
@@ -7332,7 +7326,7 @@ static struct kvm_x86_ops svm_x86_ops __ro_after_init = { | |||
7332 | .mem_enc_unreg_region = svm_unregister_enc_region, | 7326 | .mem_enc_unreg_region = svm_unregister_enc_region, |
7333 | 7327 | ||
7334 | .nested_enable_evmcs = nested_enable_evmcs, | 7328 | .nested_enable_evmcs = nested_enable_evmcs, |
7335 | .nested_get_evmcs_version = nested_get_evmcs_version, | 7329 | .nested_get_evmcs_version = NULL, |
7336 | 7330 | ||
7337 | .need_emulation_on_page_fault = svm_need_emulation_on_page_fault, | 7331 | .need_emulation_on_page_fault = svm_need_emulation_on_page_fault, |
7338 | }; | 7332 | }; |
diff --git a/arch/x86/kvm/vmx/vmx.c b/arch/x86/kvm/vmx/vmx.c index 42ed3faa6af8..c030c96fc81a 100644 --- a/arch/x86/kvm/vmx/vmx.c +++ b/arch/x86/kvm/vmx/vmx.c | |||
@@ -7797,6 +7797,7 @@ static struct kvm_x86_ops vmx_x86_ops __ro_after_init = { | |||
7797 | .set_nested_state = NULL, | 7797 | .set_nested_state = NULL, |
7798 | .get_vmcs12_pages = NULL, | 7798 | .get_vmcs12_pages = NULL, |
7799 | .nested_enable_evmcs = NULL, | 7799 | .nested_enable_evmcs = NULL, |
7800 | .nested_get_evmcs_version = NULL, | ||
7800 | .need_emulation_on_page_fault = vmx_need_emulation_on_page_fault, | 7801 | .need_emulation_on_page_fault = vmx_need_emulation_on_page_fault, |
7801 | }; | 7802 | }; |
7802 | 7803 | ||
diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c index 93b0bd45ac73..290c3c3efb87 100644 --- a/arch/x86/kvm/x86.c +++ b/arch/x86/kvm/x86.c | |||
@@ -6594,12 +6594,13 @@ restart: | |||
6594 | unsigned long rflags = kvm_x86_ops->get_rflags(vcpu); | 6594 | unsigned long rflags = kvm_x86_ops->get_rflags(vcpu); |
6595 | toggle_interruptibility(vcpu, ctxt->interruptibility); | 6595 | toggle_interruptibility(vcpu, ctxt->interruptibility); |
6596 | vcpu->arch.emulate_regs_need_sync_to_vcpu = false; | 6596 | vcpu->arch.emulate_regs_need_sync_to_vcpu = false; |
6597 | kvm_rip_write(vcpu, ctxt->eip); | ||
6598 | if (r == EMULATE_DONE && ctxt->tf) | ||
6599 | kvm_vcpu_do_singlestep(vcpu, &r); | ||
6600 | if (!ctxt->have_exception || | 6597 | if (!ctxt->have_exception || |
6601 | exception_type(ctxt->exception.vector) == EXCPT_TRAP) | 6598 | exception_type(ctxt->exception.vector) == EXCPT_TRAP) { |
6599 | kvm_rip_write(vcpu, ctxt->eip); | ||
6600 | if (r == EMULATE_DONE && ctxt->tf) | ||
6601 | kvm_vcpu_do_singlestep(vcpu, &r); | ||
6602 | __kvm_set_rflags(vcpu, ctxt->eflags); | 6602 | __kvm_set_rflags(vcpu, ctxt->eflags); |
6603 | } | ||
6603 | 6604 | ||
6604 | /* | 6605 | /* |
6605 | * For STI, interrupts are shadowed; so KVM_REQ_EVENT will | 6606 | * For STI, interrupts are shadowed; so KVM_REQ_EVENT will |
diff --git a/arch/x86/mm/pageattr.c b/arch/x86/mm/pageattr.c index 6a9a77a403c9..e14e95ea7338 100644 --- a/arch/x86/mm/pageattr.c +++ b/arch/x86/mm/pageattr.c | |||
@@ -516,7 +516,7 @@ static inline void check_conflict(int warnlvl, pgprot_t prot, pgprotval_t val, | |||
516 | */ | 516 | */ |
517 | static inline pgprot_t static_protections(pgprot_t prot, unsigned long start, | 517 | static inline pgprot_t static_protections(pgprot_t prot, unsigned long start, |
518 | unsigned long pfn, unsigned long npg, | 518 | unsigned long pfn, unsigned long npg, |
519 | int warnlvl) | 519 | unsigned long lpsize, int warnlvl) |
520 | { | 520 | { |
521 | pgprotval_t forbidden, res; | 521 | pgprotval_t forbidden, res; |
522 | unsigned long end; | 522 | unsigned long end; |
@@ -535,9 +535,17 @@ static inline pgprot_t static_protections(pgprot_t prot, unsigned long start, | |||
535 | check_conflict(warnlvl, prot, res, start, end, pfn, "Text NX"); | 535 | check_conflict(warnlvl, prot, res, start, end, pfn, "Text NX"); |
536 | forbidden = res; | 536 | forbidden = res; |
537 | 537 | ||
538 | res = protect_kernel_text_ro(start, end); | 538 | /* |
539 | check_conflict(warnlvl, prot, res, start, end, pfn, "Text RO"); | 539 | * Special case to preserve a large page. If the change spawns the |
540 | forbidden |= res; | 540 | * full large page mapping then there is no point to split it |
541 | * up. Happens with ftrace and is going to be removed once ftrace | ||
542 | * switched to text_poke(). | ||
543 | */ | ||
544 | if (lpsize != (npg * PAGE_SIZE) || (start & (lpsize - 1))) { | ||
545 | res = protect_kernel_text_ro(start, end); | ||
546 | check_conflict(warnlvl, prot, res, start, end, pfn, "Text RO"); | ||
547 | forbidden |= res; | ||
548 | } | ||
541 | 549 | ||
542 | /* Check the PFN directly */ | 550 | /* Check the PFN directly */ |
543 | res = protect_pci_bios(pfn, pfn + npg - 1); | 551 | res = protect_pci_bios(pfn, pfn + npg - 1); |
@@ -819,7 +827,7 @@ static int __should_split_large_page(pte_t *kpte, unsigned long address, | |||
819 | * extra conditional required here. | 827 | * extra conditional required here. |
820 | */ | 828 | */ |
821 | chk_prot = static_protections(old_prot, lpaddr, old_pfn, numpages, | 829 | chk_prot = static_protections(old_prot, lpaddr, old_pfn, numpages, |
822 | CPA_CONFLICT); | 830 | psize, CPA_CONFLICT); |
823 | 831 | ||
824 | if (WARN_ON_ONCE(pgprot_val(chk_prot) != pgprot_val(old_prot))) { | 832 | if (WARN_ON_ONCE(pgprot_val(chk_prot) != pgprot_val(old_prot))) { |
825 | /* | 833 | /* |
@@ -855,7 +863,7 @@ static int __should_split_large_page(pte_t *kpte, unsigned long address, | |||
855 | * protection requirement in the large page. | 863 | * protection requirement in the large page. |
856 | */ | 864 | */ |
857 | new_prot = static_protections(req_prot, lpaddr, old_pfn, numpages, | 865 | new_prot = static_protections(req_prot, lpaddr, old_pfn, numpages, |
858 | CPA_DETECT); | 866 | psize, CPA_DETECT); |
859 | 867 | ||
860 | /* | 868 | /* |
861 | * If there is a conflict, split the large page. | 869 | * If there is a conflict, split the large page. |
@@ -906,7 +914,8 @@ static void split_set_pte(struct cpa_data *cpa, pte_t *pte, unsigned long pfn, | |||
906 | if (!cpa->force_static_prot) | 914 | if (!cpa->force_static_prot) |
907 | goto set; | 915 | goto set; |
908 | 916 | ||
909 | prot = static_protections(ref_prot, address, pfn, npg, CPA_PROTECT); | 917 | /* Hand in lpsize = 0 to enforce the protection mechanism */ |
918 | prot = static_protections(ref_prot, address, pfn, npg, 0, CPA_PROTECT); | ||
910 | 919 | ||
911 | if (pgprot_val(prot) == pgprot_val(ref_prot)) | 920 | if (pgprot_val(prot) == pgprot_val(ref_prot)) |
912 | goto set; | 921 | goto set; |
@@ -1503,7 +1512,8 @@ repeat: | |||
1503 | pgprot_val(new_prot) |= pgprot_val(cpa->mask_set); | 1512 | pgprot_val(new_prot) |= pgprot_val(cpa->mask_set); |
1504 | 1513 | ||
1505 | cpa_inc_4k_install(); | 1514 | cpa_inc_4k_install(); |
1506 | new_prot = static_protections(new_prot, address, pfn, 1, | 1515 | /* Hand in lpsize = 0 to enforce the protection mechanism */ |
1516 | new_prot = static_protections(new_prot, address, pfn, 1, 0, | ||
1507 | CPA_PROTECT); | 1517 | CPA_PROTECT); |
1508 | 1518 | ||
1509 | new_prot = pgprot_clear_protnone_bits(new_prot); | 1519 | new_prot = pgprot_clear_protnone_bits(new_prot); |
diff --git a/drivers/block/rbd.c b/drivers/block/rbd.c index 3327192bb71f..c8fb886aebd4 100644 --- a/drivers/block/rbd.c +++ b/drivers/block/rbd.c | |||
@@ -3038,6 +3038,17 @@ again: | |||
3038 | } | 3038 | } |
3039 | return true; | 3039 | return true; |
3040 | case RBD_OBJ_READ_PARENT: | 3040 | case RBD_OBJ_READ_PARENT: |
3041 | /* | ||
3042 | * The parent image is read only up to the overlap -- zero-fill | ||
3043 | * from the overlap to the end of the request. | ||
3044 | */ | ||
3045 | if (!*result) { | ||
3046 | u32 obj_overlap = rbd_obj_img_extents_bytes(obj_req); | ||
3047 | |||
3048 | if (obj_overlap < obj_req->ex.oe_len) | ||
3049 | rbd_obj_zero_range(obj_req, obj_overlap, | ||
3050 | obj_req->ex.oe_len - obj_overlap); | ||
3051 | } | ||
3041 | return true; | 3052 | return true; |
3042 | default: | 3053 | default: |
3043 | BUG(); | 3054 | BUG(); |
diff --git a/drivers/bus/hisi_lpc.c b/drivers/bus/hisi_lpc.c index 19d7b6ff2f17..20c957185af2 100644 --- a/drivers/bus/hisi_lpc.c +++ b/drivers/bus/hisi_lpc.c | |||
@@ -456,6 +456,17 @@ struct hisi_lpc_acpi_cell { | |||
456 | size_t pdata_size; | 456 | size_t pdata_size; |
457 | }; | 457 | }; |
458 | 458 | ||
459 | static void hisi_lpc_acpi_remove(struct device *hostdev) | ||
460 | { | ||
461 | struct acpi_device *adev = ACPI_COMPANION(hostdev); | ||
462 | struct acpi_device *child; | ||
463 | |||
464 | device_for_each_child(hostdev, NULL, hisi_lpc_acpi_remove_subdev); | ||
465 | |||
466 | list_for_each_entry(child, &adev->children, node) | ||
467 | acpi_device_clear_enumerated(child); | ||
468 | } | ||
469 | |||
459 | /* | 470 | /* |
460 | * hisi_lpc_acpi_probe - probe children for ACPI FW | 471 | * hisi_lpc_acpi_probe - probe children for ACPI FW |
461 | * @hostdev: LPC host device pointer | 472 | * @hostdev: LPC host device pointer |
@@ -555,8 +566,7 @@ static int hisi_lpc_acpi_probe(struct device *hostdev) | |||
555 | return 0; | 566 | return 0; |
556 | 567 | ||
557 | fail: | 568 | fail: |
558 | device_for_each_child(hostdev, NULL, | 569 | hisi_lpc_acpi_remove(hostdev); |
559 | hisi_lpc_acpi_remove_subdev); | ||
560 | return ret; | 570 | return ret; |
561 | } | 571 | } |
562 | 572 | ||
@@ -569,6 +579,10 @@ static int hisi_lpc_acpi_probe(struct device *dev) | |||
569 | { | 579 | { |
570 | return -ENODEV; | 580 | return -ENODEV; |
571 | } | 581 | } |
582 | |||
583 | static void hisi_lpc_acpi_remove(struct device *hostdev) | ||
584 | { | ||
585 | } | ||
572 | #endif // CONFIG_ACPI | 586 | #endif // CONFIG_ACPI |
573 | 587 | ||
574 | /* | 588 | /* |
@@ -606,24 +620,27 @@ static int hisi_lpc_probe(struct platform_device *pdev) | |||
606 | range->fwnode = dev->fwnode; | 620 | range->fwnode = dev->fwnode; |
607 | range->flags = LOGIC_PIO_INDIRECT; | 621 | range->flags = LOGIC_PIO_INDIRECT; |
608 | range->size = PIO_INDIRECT_SIZE; | 622 | range->size = PIO_INDIRECT_SIZE; |
623 | range->hostdata = lpcdev; | ||
624 | range->ops = &hisi_lpc_ops; | ||
625 | lpcdev->io_host = range; | ||
609 | 626 | ||
610 | ret = logic_pio_register_range(range); | 627 | ret = logic_pio_register_range(range); |
611 | if (ret) { | 628 | if (ret) { |
612 | dev_err(dev, "register IO range failed (%d)!\n", ret); | 629 | dev_err(dev, "register IO range failed (%d)!\n", ret); |
613 | return ret; | 630 | return ret; |
614 | } | 631 | } |
615 | lpcdev->io_host = range; | ||
616 | 632 | ||
617 | /* register the LPC host PIO resources */ | 633 | /* register the LPC host PIO resources */ |
618 | if (acpi_device) | 634 | if (acpi_device) |
619 | ret = hisi_lpc_acpi_probe(dev); | 635 | ret = hisi_lpc_acpi_probe(dev); |
620 | else | 636 | else |
621 | ret = of_platform_populate(dev->of_node, NULL, NULL, dev); | 637 | ret = of_platform_populate(dev->of_node, NULL, NULL, dev); |
622 | if (ret) | 638 | if (ret) { |
639 | logic_pio_unregister_range(range); | ||
623 | return ret; | 640 | return ret; |
641 | } | ||
624 | 642 | ||
625 | lpcdev->io_host->hostdata = lpcdev; | 643 | dev_set_drvdata(dev, lpcdev); |
626 | lpcdev->io_host->ops = &hisi_lpc_ops; | ||
627 | 644 | ||
628 | io_end = lpcdev->io_host->io_start + lpcdev->io_host->size; | 645 | io_end = lpcdev->io_host->io_start + lpcdev->io_host->size; |
629 | dev_info(dev, "registered range [%pa - %pa]\n", | 646 | dev_info(dev, "registered range [%pa - %pa]\n", |
@@ -632,6 +649,23 @@ static int hisi_lpc_probe(struct platform_device *pdev) | |||
632 | return ret; | 649 | return ret; |
633 | } | 650 | } |
634 | 651 | ||
652 | static int hisi_lpc_remove(struct platform_device *pdev) | ||
653 | { | ||
654 | struct device *dev = &pdev->dev; | ||
655 | struct acpi_device *acpi_device = ACPI_COMPANION(dev); | ||
656 | struct hisi_lpc_dev *lpcdev = dev_get_drvdata(dev); | ||
657 | struct logic_pio_hwaddr *range = lpcdev->io_host; | ||
658 | |||
659 | if (acpi_device) | ||
660 | hisi_lpc_acpi_remove(dev); | ||
661 | else | ||
662 | of_platform_depopulate(dev); | ||
663 | |||
664 | logic_pio_unregister_range(range); | ||
665 | |||
666 | return 0; | ||
667 | } | ||
668 | |||
635 | static const struct of_device_id hisi_lpc_of_match[] = { | 669 | static const struct of_device_id hisi_lpc_of_match[] = { |
636 | { .compatible = "hisilicon,hip06-lpc", }, | 670 | { .compatible = "hisilicon,hip06-lpc", }, |
637 | { .compatible = "hisilicon,hip07-lpc", }, | 671 | { .compatible = "hisilicon,hip07-lpc", }, |
@@ -645,5 +679,6 @@ static struct platform_driver hisi_lpc_driver = { | |||
645 | .acpi_match_table = ACPI_PTR(hisi_lpc_acpi_match), | 679 | .acpi_match_table = ACPI_PTR(hisi_lpc_acpi_match), |
646 | }, | 680 | }, |
647 | .probe = hisi_lpc_probe, | 681 | .probe = hisi_lpc_probe, |
682 | .remove = hisi_lpc_remove, | ||
648 | }; | 683 | }; |
649 | builtin_platform_driver(hisi_lpc_driver); | 684 | builtin_platform_driver(hisi_lpc_driver); |
diff --git a/drivers/bus/ti-sysc.c b/drivers/bus/ti-sysc.c index e6deabd8305d..2db474ab4c6b 100644 --- a/drivers/bus/ti-sysc.c +++ b/drivers/bus/ti-sysc.c | |||
@@ -949,7 +949,7 @@ static int sysc_best_idle_mode(u32 idlemodes, u32 *best_mode) | |||
949 | *best_mode = SYSC_IDLE_SMART_WKUP; | 949 | *best_mode = SYSC_IDLE_SMART_WKUP; |
950 | else if (idlemodes & BIT(SYSC_IDLE_SMART)) | 950 | else if (idlemodes & BIT(SYSC_IDLE_SMART)) |
951 | *best_mode = SYSC_IDLE_SMART; | 951 | *best_mode = SYSC_IDLE_SMART; |
952 | else if (idlemodes & SYSC_IDLE_FORCE) | 952 | else if (idlemodes & BIT(SYSC_IDLE_FORCE)) |
953 | *best_mode = SYSC_IDLE_FORCE; | 953 | *best_mode = SYSC_IDLE_FORCE; |
954 | else | 954 | else |
955 | return -EINVAL; | 955 | return -EINVAL; |
@@ -1267,7 +1267,8 @@ static const struct sysc_revision_quirk sysc_revision_quirks[] = { | |||
1267 | SYSC_QUIRK("control", 0, 0, 0x10, -1, 0x40000900, 0xffffffff, 0), | 1267 | SYSC_QUIRK("control", 0, 0, 0x10, -1, 0x40000900, 0xffffffff, 0), |
1268 | SYSC_QUIRK("cpgmac", 0, 0x1200, 0x1208, 0x1204, 0x4edb1902, | 1268 | SYSC_QUIRK("cpgmac", 0, 0x1200, 0x1208, 0x1204, 0x4edb1902, |
1269 | 0xffff00f0, 0), | 1269 | 0xffff00f0, 0), |
1270 | SYSC_QUIRK("dcan", 0, 0, -1, -1, 0xffffffff, 0xffffffff, 0), | 1270 | SYSC_QUIRK("dcan", 0, 0x20, -1, -1, 0xa3170504, 0xffffffff, 0), |
1271 | SYSC_QUIRK("dcan", 0, 0x20, -1, -1, 0x4edb1902, 0xffffffff, 0), | ||
1271 | SYSC_QUIRK("dmic", 0, 0, 0x10, -1, 0x50010000, 0xffffffff, 0), | 1272 | SYSC_QUIRK("dmic", 0, 0, 0x10, -1, 0x50010000, 0xffffffff, 0), |
1272 | SYSC_QUIRK("dwc3", 0, 0, 0x10, -1, 0x500a0200, 0xffffffff, 0), | 1273 | SYSC_QUIRK("dwc3", 0, 0, 0x10, -1, 0x500a0200, 0xffffffff, 0), |
1273 | SYSC_QUIRK("epwmss", 0, 0, 0x4, -1, 0x47400001, 0xffffffff, 0), | 1274 | SYSC_QUIRK("epwmss", 0, 0, 0x4, -1, 0x47400001, 0xffffffff, 0), |
@@ -1692,10 +1693,7 @@ static int sysc_init_sysc_mask(struct sysc *ddata) | |||
1692 | if (error) | 1693 | if (error) |
1693 | return 0; | 1694 | return 0; |
1694 | 1695 | ||
1695 | if (val) | 1696 | ddata->cfg.sysc_val = val & ddata->cap->sysc_mask; |
1696 | ddata->cfg.sysc_val = val & ddata->cap->sysc_mask; | ||
1697 | else | ||
1698 | ddata->cfg.sysc_val = ddata->cap->sysc_mask; | ||
1699 | 1697 | ||
1700 | return 0; | 1698 | return 0; |
1701 | } | 1699 | } |
@@ -2385,27 +2383,27 @@ static int sysc_probe(struct platform_device *pdev) | |||
2385 | 2383 | ||
2386 | error = sysc_init_dts_quirks(ddata); | 2384 | error = sysc_init_dts_quirks(ddata); |
2387 | if (error) | 2385 | if (error) |
2388 | goto unprepare; | 2386 | return error; |
2389 | 2387 | ||
2390 | error = sysc_map_and_check_registers(ddata); | 2388 | error = sysc_map_and_check_registers(ddata); |
2391 | if (error) | 2389 | if (error) |
2392 | goto unprepare; | 2390 | return error; |
2393 | 2391 | ||
2394 | error = sysc_init_sysc_mask(ddata); | 2392 | error = sysc_init_sysc_mask(ddata); |
2395 | if (error) | 2393 | if (error) |
2396 | goto unprepare; | 2394 | return error; |
2397 | 2395 | ||
2398 | error = sysc_init_idlemodes(ddata); | 2396 | error = sysc_init_idlemodes(ddata); |
2399 | if (error) | 2397 | if (error) |
2400 | goto unprepare; | 2398 | return error; |
2401 | 2399 | ||
2402 | error = sysc_init_syss_mask(ddata); | 2400 | error = sysc_init_syss_mask(ddata); |
2403 | if (error) | 2401 | if (error) |
2404 | goto unprepare; | 2402 | return error; |
2405 | 2403 | ||
2406 | error = sysc_init_pdata(ddata); | 2404 | error = sysc_init_pdata(ddata); |
2407 | if (error) | 2405 | if (error) |
2408 | goto unprepare; | 2406 | return error; |
2409 | 2407 | ||
2410 | sysc_init_early_quirks(ddata); | 2408 | sysc_init_early_quirks(ddata); |
2411 | 2409 | ||
@@ -2415,7 +2413,7 @@ static int sysc_probe(struct platform_device *pdev) | |||
2415 | 2413 | ||
2416 | error = sysc_init_resets(ddata); | 2414 | error = sysc_init_resets(ddata); |
2417 | if (error) | 2415 | if (error) |
2418 | return error; | 2416 | goto unprepare; |
2419 | 2417 | ||
2420 | error = sysc_init_module(ddata); | 2418 | error = sysc_init_module(ddata); |
2421 | if (error) | 2419 | if (error) |
diff --git a/drivers/crypto/ccp/ccp-dev.c b/drivers/crypto/ccp/ccp-dev.c index f79eede71c62..edefa669153f 100644 --- a/drivers/crypto/ccp/ccp-dev.c +++ b/drivers/crypto/ccp/ccp-dev.c | |||
@@ -540,6 +540,10 @@ int ccp_dev_suspend(struct sp_device *sp, pm_message_t state) | |||
540 | unsigned long flags; | 540 | unsigned long flags; |
541 | unsigned int i; | 541 | unsigned int i; |
542 | 542 | ||
543 | /* If there's no device there's nothing to do */ | ||
544 | if (!ccp) | ||
545 | return 0; | ||
546 | |||
543 | spin_lock_irqsave(&ccp->cmd_lock, flags); | 547 | spin_lock_irqsave(&ccp->cmd_lock, flags); |
544 | 548 | ||
545 | ccp->suspending = 1; | 549 | ccp->suspending = 1; |
@@ -564,6 +568,10 @@ int ccp_dev_resume(struct sp_device *sp) | |||
564 | unsigned long flags; | 568 | unsigned long flags; |
565 | unsigned int i; | 569 | unsigned int i; |
566 | 570 | ||
571 | /* If there's no device there's nothing to do */ | ||
572 | if (!ccp) | ||
573 | return 0; | ||
574 | |||
567 | spin_lock_irqsave(&ccp->cmd_lock, flags); | 575 | spin_lock_irqsave(&ccp->cmd_lock, flags); |
568 | 576 | ||
569 | ccp->suspending = 0; | 577 | ccp->suspending = 0; |
diff --git a/drivers/fpga/altera-ps-spi.c b/drivers/fpga/altera-ps-spi.c index a13f224303c6..0221dee8dd4c 100644 --- a/drivers/fpga/altera-ps-spi.c +++ b/drivers/fpga/altera-ps-spi.c | |||
@@ -210,7 +210,7 @@ static int altera_ps_write_complete(struct fpga_manager *mgr, | |||
210 | return -EIO; | 210 | return -EIO; |
211 | } | 211 | } |
212 | 212 | ||
213 | if (!IS_ERR(conf->confd)) { | 213 | if (conf->confd) { |
214 | if (!gpiod_get_raw_value_cansleep(conf->confd)) { | 214 | if (!gpiod_get_raw_value_cansleep(conf->confd)) { |
215 | dev_err(&mgr->dev, "CONF_DONE is inactive!\n"); | 215 | dev_err(&mgr->dev, "CONF_DONE is inactive!\n"); |
216 | return -EIO; | 216 | return -EIO; |
@@ -289,10 +289,13 @@ static int altera_ps_probe(struct spi_device *spi) | |||
289 | return PTR_ERR(conf->status); | 289 | return PTR_ERR(conf->status); |
290 | } | 290 | } |
291 | 291 | ||
292 | conf->confd = devm_gpiod_get(&spi->dev, "confd", GPIOD_IN); | 292 | conf->confd = devm_gpiod_get_optional(&spi->dev, "confd", GPIOD_IN); |
293 | if (IS_ERR(conf->confd)) { | 293 | if (IS_ERR(conf->confd)) { |
294 | dev_warn(&spi->dev, "Not using confd gpio: %ld\n", | 294 | dev_err(&spi->dev, "Failed to get confd gpio: %ld\n", |
295 | PTR_ERR(conf->confd)); | 295 | PTR_ERR(conf->confd)); |
296 | return PTR_ERR(conf->confd); | ||
297 | } else if (!conf->confd) { | ||
298 | dev_warn(&spi->dev, "Not using confd gpio"); | ||
296 | } | 299 | } |
297 | 300 | ||
298 | /* Register manager with unique name */ | 301 | /* Register manager with unique name */ |
diff --git a/drivers/fsi/fsi-scom.c b/drivers/fsi/fsi-scom.c index 343153d47e5b..004dc03ccf09 100644 --- a/drivers/fsi/fsi-scom.c +++ b/drivers/fsi/fsi-scom.c | |||
@@ -38,8 +38,7 @@ | |||
38 | #define SCOM_STATUS_PIB_RESP_MASK 0x00007000 | 38 | #define SCOM_STATUS_PIB_RESP_MASK 0x00007000 |
39 | #define SCOM_STATUS_PIB_RESP_SHIFT 12 | 39 | #define SCOM_STATUS_PIB_RESP_SHIFT 12 |
40 | 40 | ||
41 | #define SCOM_STATUS_ANY_ERR (SCOM_STATUS_ERR_SUMMARY | \ | 41 | #define SCOM_STATUS_ANY_ERR (SCOM_STATUS_PROTECTION | \ |
42 | SCOM_STATUS_PROTECTION | \ | ||
43 | SCOM_STATUS_PARITY | \ | 42 | SCOM_STATUS_PARITY | \ |
44 | SCOM_STATUS_PIB_ABORT | \ | 43 | SCOM_STATUS_PIB_ABORT | \ |
45 | SCOM_STATUS_PIB_RESP_MASK) | 44 | SCOM_STATUS_PIB_RESP_MASK) |
@@ -251,11 +250,6 @@ static int handle_fsi2pib_status(struct scom_device *scom, uint32_t status) | |||
251 | /* Return -EBUSY on PIB abort to force a retry */ | 250 | /* Return -EBUSY on PIB abort to force a retry */ |
252 | if (status & SCOM_STATUS_PIB_ABORT) | 251 | if (status & SCOM_STATUS_PIB_ABORT) |
253 | return -EBUSY; | 252 | return -EBUSY; |
254 | if (status & SCOM_STATUS_ERR_SUMMARY) { | ||
255 | fsi_device_write(scom->fsi_dev, SCOM_FSI2PIB_RESET_REG, &dummy, | ||
256 | sizeof(uint32_t)); | ||
257 | return -EIO; | ||
258 | } | ||
259 | return 0; | 253 | return 0; |
260 | } | 254 | } |
261 | 255 | ||
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_atpx_handler.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_atpx_handler.c index 9b384a94d2f3..3e35a8f2c5e5 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_atpx_handler.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_atpx_handler.c | |||
@@ -574,6 +574,7 @@ static const struct amdgpu_px_quirk amdgpu_px_quirk_list[] = { | |||
574 | { 0x1002, 0x6900, 0x1002, 0x0124, AMDGPU_PX_QUIRK_FORCE_ATPX }, | 574 | { 0x1002, 0x6900, 0x1002, 0x0124, AMDGPU_PX_QUIRK_FORCE_ATPX }, |
575 | { 0x1002, 0x6900, 0x1028, 0x0812, AMDGPU_PX_QUIRK_FORCE_ATPX }, | 575 | { 0x1002, 0x6900, 0x1028, 0x0812, AMDGPU_PX_QUIRK_FORCE_ATPX }, |
576 | { 0x1002, 0x6900, 0x1028, 0x0813, AMDGPU_PX_QUIRK_FORCE_ATPX }, | 576 | { 0x1002, 0x6900, 0x1028, 0x0813, AMDGPU_PX_QUIRK_FORCE_ATPX }, |
577 | { 0x1002, 0x699f, 0x1028, 0x0814, AMDGPU_PX_QUIRK_FORCE_ATPX }, | ||
577 | { 0x1002, 0x6900, 0x1025, 0x125A, AMDGPU_PX_QUIRK_FORCE_ATPX }, | 578 | { 0x1002, 0x6900, 0x1025, 0x125A, AMDGPU_PX_QUIRK_FORCE_ATPX }, |
578 | { 0x1002, 0x6900, 0x17AA, 0x3806, AMDGPU_PX_QUIRK_FORCE_ATPX }, | 579 | { 0x1002, 0x6900, 0x17AA, 0x3806, AMDGPU_PX_QUIRK_FORCE_ATPX }, |
579 | { 0, 0, 0, 0, 0 }, | 580 | { 0, 0, 0, 0, 0 }, |
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c index f539a2a92774..7398b4850649 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c | |||
@@ -534,21 +534,24 @@ int amdgpu_ctx_wait_prev_fence(struct amdgpu_ctx *ctx, | |||
534 | struct drm_sched_entity *entity) | 534 | struct drm_sched_entity *entity) |
535 | { | 535 | { |
536 | struct amdgpu_ctx_entity *centity = to_amdgpu_ctx_entity(entity); | 536 | struct amdgpu_ctx_entity *centity = to_amdgpu_ctx_entity(entity); |
537 | unsigned idx = centity->sequence & (amdgpu_sched_jobs - 1); | 537 | struct dma_fence *other; |
538 | struct dma_fence *other = centity->fences[idx]; | 538 | unsigned idx; |
539 | long r; | ||
539 | 540 | ||
540 | if (other) { | 541 | spin_lock(&ctx->ring_lock); |
541 | signed long r; | 542 | idx = centity->sequence & (amdgpu_sched_jobs - 1); |
542 | r = dma_fence_wait(other, true); | 543 | other = dma_fence_get(centity->fences[idx]); |
543 | if (r < 0) { | 544 | spin_unlock(&ctx->ring_lock); |
544 | if (r != -ERESTARTSYS) | ||
545 | DRM_ERROR("Error (%ld) waiting for fence!\n", r); | ||
546 | 545 | ||
547 | return r; | 546 | if (!other) |
548 | } | 547 | return 0; |
549 | } | ||
550 | 548 | ||
551 | return 0; | 549 | r = dma_fence_wait(other, true); |
550 | if (r < 0 && r != -ERESTARTSYS) | ||
551 | DRM_ERROR("Error (%ld) waiting for fence!\n", r); | ||
552 | |||
553 | dma_fence_put(other); | ||
554 | return r; | ||
552 | } | 555 | } |
553 | 556 | ||
554 | void amdgpu_ctx_mgr_init(struct amdgpu_ctx_mgr *mgr) | 557 | void amdgpu_ctx_mgr_init(struct amdgpu_ctx_mgr *mgr) |
diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c b/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c index 4ea67f94cae2..c066e1d3f981 100644 --- a/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +++ b/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c | |||
@@ -596,14 +596,14 @@ static void gfx_v9_0_check_if_need_gfxoff(struct amdgpu_device *adev) | |||
596 | case CHIP_VEGA20: | 596 | case CHIP_VEGA20: |
597 | break; | 597 | break; |
598 | case CHIP_RAVEN: | 598 | case CHIP_RAVEN: |
599 | if (adev->rev_id >= 0x8 || adev->pdev->device == 0x15d8) | 599 | if (!(adev->rev_id >= 0x8 || adev->pdev->device == 0x15d8) |
600 | break; | 600 | &&((adev->gfx.rlc_fw_version != 106 && |
601 | if ((adev->gfx.rlc_fw_version != 106 && | 601 | adev->gfx.rlc_fw_version < 531) || |
602 | adev->gfx.rlc_fw_version < 531) || | 602 | (adev->gfx.rlc_fw_version == 53815) || |
603 | (adev->gfx.rlc_fw_version == 53815) || | 603 | (adev->gfx.rlc_feature_version < 1) || |
604 | (adev->gfx.rlc_feature_version < 1) || | 604 | !adev->gfx.rlc.is_rlc_v2_1)) |
605 | !adev->gfx.rlc.is_rlc_v2_1) | ||
606 | adev->pm.pp_feature &= ~PP_GFXOFF_MASK; | 605 | adev->pm.pp_feature &= ~PP_GFXOFF_MASK; |
606 | |||
607 | if (adev->pm.pp_feature & PP_GFXOFF_MASK) | 607 | if (adev->pm.pp_feature & PP_GFXOFF_MASK) |
608 | adev->pg_flags |= AMD_PG_SUPPORT_GFX_PG | | 608 | adev->pg_flags |= AMD_PG_SUPPORT_GFX_PG | |
609 | AMD_PG_SUPPORT_CP | | 609 | AMD_PG_SUPPORT_CP | |
diff --git a/drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c b/drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c index f27c6fbb192e..90c4e87ac5ad 100644 --- a/drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c +++ b/drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c | |||
@@ -2101,7 +2101,11 @@ static int vega20_get_gpu_power(struct pp_hwmgr *hwmgr, | |||
2101 | if (ret) | 2101 | if (ret) |
2102 | return ret; | 2102 | return ret; |
2103 | 2103 | ||
2104 | *query = metrics_table.CurrSocketPower << 8; | 2104 | /* For the 40.46 release, they changed the value name */ |
2105 | if (hwmgr->smu_version == 0x282e00) | ||
2106 | *query = metrics_table.AverageSocketPower << 8; | ||
2107 | else | ||
2108 | *query = metrics_table.CurrSocketPower << 8; | ||
2105 | 2109 | ||
2106 | return ret; | 2110 | return ret; |
2107 | } | 2111 | } |
@@ -2349,12 +2353,16 @@ static int vega20_force_dpm_highest(struct pp_hwmgr *hwmgr) | |||
2349 | data->dpm_table.soc_table.dpm_state.soft_max_level = | 2353 | data->dpm_table.soc_table.dpm_state.soft_max_level = |
2350 | data->dpm_table.soc_table.dpm_levels[soft_level].value; | 2354 | data->dpm_table.soc_table.dpm_levels[soft_level].value; |
2351 | 2355 | ||
2352 | ret = vega20_upload_dpm_min_level(hwmgr, 0xFFFFFFFF); | 2356 | ret = vega20_upload_dpm_min_level(hwmgr, FEATURE_DPM_GFXCLK_MASK | |
2357 | FEATURE_DPM_UCLK_MASK | | ||
2358 | FEATURE_DPM_SOCCLK_MASK); | ||
2353 | PP_ASSERT_WITH_CODE(!ret, | 2359 | PP_ASSERT_WITH_CODE(!ret, |
2354 | "Failed to upload boot level to highest!", | 2360 | "Failed to upload boot level to highest!", |
2355 | return ret); | 2361 | return ret); |
2356 | 2362 | ||
2357 | ret = vega20_upload_dpm_max_level(hwmgr, 0xFFFFFFFF); | 2363 | ret = vega20_upload_dpm_max_level(hwmgr, FEATURE_DPM_GFXCLK_MASK | |
2364 | FEATURE_DPM_UCLK_MASK | | ||
2365 | FEATURE_DPM_SOCCLK_MASK); | ||
2358 | PP_ASSERT_WITH_CODE(!ret, | 2366 | PP_ASSERT_WITH_CODE(!ret, |
2359 | "Failed to upload dpm max level to highest!", | 2367 | "Failed to upload dpm max level to highest!", |
2360 | return ret); | 2368 | return ret); |
@@ -2387,12 +2395,16 @@ static int vega20_force_dpm_lowest(struct pp_hwmgr *hwmgr) | |||
2387 | data->dpm_table.soc_table.dpm_state.soft_max_level = | 2395 | data->dpm_table.soc_table.dpm_state.soft_max_level = |
2388 | data->dpm_table.soc_table.dpm_levels[soft_level].value; | 2396 | data->dpm_table.soc_table.dpm_levels[soft_level].value; |
2389 | 2397 | ||
2390 | ret = vega20_upload_dpm_min_level(hwmgr, 0xFFFFFFFF); | 2398 | ret = vega20_upload_dpm_min_level(hwmgr, FEATURE_DPM_GFXCLK_MASK | |
2399 | FEATURE_DPM_UCLK_MASK | | ||
2400 | FEATURE_DPM_SOCCLK_MASK); | ||
2391 | PP_ASSERT_WITH_CODE(!ret, | 2401 | PP_ASSERT_WITH_CODE(!ret, |
2392 | "Failed to upload boot level to highest!", | 2402 | "Failed to upload boot level to highest!", |
2393 | return ret); | 2403 | return ret); |
2394 | 2404 | ||
2395 | ret = vega20_upload_dpm_max_level(hwmgr, 0xFFFFFFFF); | 2405 | ret = vega20_upload_dpm_max_level(hwmgr, FEATURE_DPM_GFXCLK_MASK | |
2406 | FEATURE_DPM_UCLK_MASK | | ||
2407 | FEATURE_DPM_SOCCLK_MASK); | ||
2396 | PP_ASSERT_WITH_CODE(!ret, | 2408 | PP_ASSERT_WITH_CODE(!ret, |
2397 | "Failed to upload dpm max level to highest!", | 2409 | "Failed to upload dpm max level to highest!", |
2398 | return ret); | 2410 | return ret); |
@@ -2403,14 +2415,54 @@ static int vega20_force_dpm_lowest(struct pp_hwmgr *hwmgr) | |||
2403 | 2415 | ||
2404 | static int vega20_unforce_dpm_levels(struct pp_hwmgr *hwmgr) | 2416 | static int vega20_unforce_dpm_levels(struct pp_hwmgr *hwmgr) |
2405 | { | 2417 | { |
2418 | struct vega20_hwmgr *data = | ||
2419 | (struct vega20_hwmgr *)(hwmgr->backend); | ||
2420 | uint32_t soft_min_level, soft_max_level; | ||
2406 | int ret = 0; | 2421 | int ret = 0; |
2407 | 2422 | ||
2408 | ret = vega20_upload_dpm_min_level(hwmgr, 0xFFFFFFFF); | 2423 | /* gfxclk soft min/max settings */ |
2424 | soft_min_level = | ||
2425 | vega20_find_lowest_dpm_level(&(data->dpm_table.gfx_table)); | ||
2426 | soft_max_level = | ||
2427 | vega20_find_highest_dpm_level(&(data->dpm_table.gfx_table)); | ||
2428 | |||
2429 | data->dpm_table.gfx_table.dpm_state.soft_min_level = | ||
2430 | data->dpm_table.gfx_table.dpm_levels[soft_min_level].value; | ||
2431 | data->dpm_table.gfx_table.dpm_state.soft_max_level = | ||
2432 | data->dpm_table.gfx_table.dpm_levels[soft_max_level].value; | ||
2433 | |||
2434 | /* uclk soft min/max settings */ | ||
2435 | soft_min_level = | ||
2436 | vega20_find_lowest_dpm_level(&(data->dpm_table.mem_table)); | ||
2437 | soft_max_level = | ||
2438 | vega20_find_highest_dpm_level(&(data->dpm_table.mem_table)); | ||
2439 | |||
2440 | data->dpm_table.mem_table.dpm_state.soft_min_level = | ||
2441 | data->dpm_table.mem_table.dpm_levels[soft_min_level].value; | ||
2442 | data->dpm_table.mem_table.dpm_state.soft_max_level = | ||
2443 | data->dpm_table.mem_table.dpm_levels[soft_max_level].value; | ||
2444 | |||
2445 | /* socclk soft min/max settings */ | ||
2446 | soft_min_level = | ||
2447 | vega20_find_lowest_dpm_level(&(data->dpm_table.soc_table)); | ||
2448 | soft_max_level = | ||
2449 | vega20_find_highest_dpm_level(&(data->dpm_table.soc_table)); | ||
2450 | |||
2451 | data->dpm_table.soc_table.dpm_state.soft_min_level = | ||
2452 | data->dpm_table.soc_table.dpm_levels[soft_min_level].value; | ||
2453 | data->dpm_table.soc_table.dpm_state.soft_max_level = | ||
2454 | data->dpm_table.soc_table.dpm_levels[soft_max_level].value; | ||
2455 | |||
2456 | ret = vega20_upload_dpm_min_level(hwmgr, FEATURE_DPM_GFXCLK_MASK | | ||
2457 | FEATURE_DPM_UCLK_MASK | | ||
2458 | FEATURE_DPM_SOCCLK_MASK); | ||
2409 | PP_ASSERT_WITH_CODE(!ret, | 2459 | PP_ASSERT_WITH_CODE(!ret, |
2410 | "Failed to upload DPM Bootup Levels!", | 2460 | "Failed to upload DPM Bootup Levels!", |
2411 | return ret); | 2461 | return ret); |
2412 | 2462 | ||
2413 | ret = vega20_upload_dpm_max_level(hwmgr, 0xFFFFFFFF); | 2463 | ret = vega20_upload_dpm_max_level(hwmgr, FEATURE_DPM_GFXCLK_MASK | |
2464 | FEATURE_DPM_UCLK_MASK | | ||
2465 | FEATURE_DPM_SOCCLK_MASK); | ||
2414 | PP_ASSERT_WITH_CODE(!ret, | 2466 | PP_ASSERT_WITH_CODE(!ret, |
2415 | "Failed to upload DPM Max Levels!", | 2467 | "Failed to upload DPM Max Levels!", |
2416 | return ret); | 2468 | return ret); |
diff --git a/drivers/gpu/drm/amd/powerplay/vega20_ppt.c b/drivers/gpu/drm/amd/powerplay/vega20_ppt.c index dd6fd1c8bf24..6a14497257e4 100644 --- a/drivers/gpu/drm/amd/powerplay/vega20_ppt.c +++ b/drivers/gpu/drm/amd/powerplay/vega20_ppt.c | |||
@@ -3050,6 +3050,7 @@ static int vega20_get_fan_speed_percent(struct smu_context *smu, | |||
3050 | 3050 | ||
3051 | static int vega20_get_gpu_power(struct smu_context *smu, uint32_t *value) | 3051 | static int vega20_get_gpu_power(struct smu_context *smu, uint32_t *value) |
3052 | { | 3052 | { |
3053 | uint32_t smu_version; | ||
3053 | int ret = 0; | 3054 | int ret = 0; |
3054 | SmuMetrics_t metrics; | 3055 | SmuMetrics_t metrics; |
3055 | 3056 | ||
@@ -3060,7 +3061,15 @@ static int vega20_get_gpu_power(struct smu_context *smu, uint32_t *value) | |||
3060 | if (ret) | 3061 | if (ret) |
3061 | return ret; | 3062 | return ret; |
3062 | 3063 | ||
3063 | *value = metrics.CurrSocketPower << 8; | 3064 | ret = smu_get_smc_version(smu, NULL, &smu_version); |
3065 | if (ret) | ||
3066 | return ret; | ||
3067 | |||
3068 | /* For the 40.46 release, they changed the value name */ | ||
3069 | if (smu_version == 0x282e00) | ||
3070 | *value = metrics.AverageSocketPower << 8; | ||
3071 | else | ||
3072 | *value = metrics.CurrSocketPower << 8; | ||
3064 | 3073 | ||
3065 | return 0; | 3074 | return 0; |
3066 | } | 3075 | } |
diff --git a/drivers/gpu/drm/arm/display/komeda/komeda_dev.c b/drivers/gpu/drm/arm/display/komeda/komeda_dev.c index a0eabc134dd6..9d4d5075cc64 100644 --- a/drivers/gpu/drm/arm/display/komeda/komeda_dev.c +++ b/drivers/gpu/drm/arm/display/komeda/komeda_dev.c | |||
@@ -127,7 +127,7 @@ static int komeda_parse_pipe_dt(struct komeda_dev *mdev, struct device_node *np) | |||
127 | pipe->of_output_port = | 127 | pipe->of_output_port = |
128 | of_graph_get_port_by_id(np, KOMEDA_OF_PORT_OUTPUT); | 128 | of_graph_get_port_by_id(np, KOMEDA_OF_PORT_OUTPUT); |
129 | 129 | ||
130 | pipe->of_node = np; | 130 | pipe->of_node = of_node_get(np); |
131 | 131 | ||
132 | return 0; | 132 | return 0; |
133 | } | 133 | } |
diff --git a/drivers/gpu/drm/arm/display/komeda/komeda_kms.c b/drivers/gpu/drm/arm/display/komeda/komeda_kms.c index d50e75f0b2bd..69d9e26c60c8 100644 --- a/drivers/gpu/drm/arm/display/komeda/komeda_kms.c +++ b/drivers/gpu/drm/arm/display/komeda/komeda_kms.c | |||
@@ -14,8 +14,8 @@ | |||
14 | #include <drm/drm_gem_cma_helper.h> | 14 | #include <drm/drm_gem_cma_helper.h> |
15 | #include <drm/drm_gem_framebuffer_helper.h> | 15 | #include <drm/drm_gem_framebuffer_helper.h> |
16 | #include <drm/drm_irq.h> | 16 | #include <drm/drm_irq.h> |
17 | #include <drm/drm_vblank.h> | ||
18 | #include <drm/drm_probe_helper.h> | 17 | #include <drm/drm_probe_helper.h> |
18 | #include <drm/drm_vblank.h> | ||
19 | 19 | ||
20 | #include "komeda_dev.h" | 20 | #include "komeda_dev.h" |
21 | #include "komeda_framebuffer.h" | 21 | #include "komeda_framebuffer.h" |
@@ -147,7 +147,6 @@ static int komeda_crtc_normalize_zpos(struct drm_crtc *crtc, | |||
147 | struct komeda_crtc_state *kcrtc_st = to_kcrtc_st(crtc_st); | 147 | struct komeda_crtc_state *kcrtc_st = to_kcrtc_st(crtc_st); |
148 | struct komeda_plane_state *kplane_st; | 148 | struct komeda_plane_state *kplane_st; |
149 | struct drm_plane_state *plane_st; | 149 | struct drm_plane_state *plane_st; |
150 | struct drm_framebuffer *fb; | ||
151 | struct drm_plane *plane; | 150 | struct drm_plane *plane; |
152 | struct list_head zorder_list; | 151 | struct list_head zorder_list; |
153 | int order = 0, err; | 152 | int order = 0, err; |
@@ -173,7 +172,6 @@ static int komeda_crtc_normalize_zpos(struct drm_crtc *crtc, | |||
173 | 172 | ||
174 | list_for_each_entry(kplane_st, &zorder_list, zlist_node) { | 173 | list_for_each_entry(kplane_st, &zorder_list, zlist_node) { |
175 | plane_st = &kplane_st->base; | 174 | plane_st = &kplane_st->base; |
176 | fb = plane_st->fb; | ||
177 | plane = plane_st->plane; | 175 | plane = plane_st->plane; |
178 | 176 | ||
179 | plane_st->normalized_zpos = order++; | 177 | plane_st->normalized_zpos = order++; |
@@ -206,7 +204,7 @@ static int komeda_kms_check(struct drm_device *dev, | |||
206 | struct drm_atomic_state *state) | 204 | struct drm_atomic_state *state) |
207 | { | 205 | { |
208 | struct drm_crtc *crtc; | 206 | struct drm_crtc *crtc; |
209 | struct drm_crtc_state *old_crtc_st, *new_crtc_st; | 207 | struct drm_crtc_state *new_crtc_st; |
210 | int i, err; | 208 | int i, err; |
211 | 209 | ||
212 | err = drm_atomic_helper_check_modeset(dev, state); | 210 | err = drm_atomic_helper_check_modeset(dev, state); |
@@ -217,7 +215,7 @@ static int komeda_kms_check(struct drm_device *dev, | |||
217 | * so need to add all affected_planes (even unchanged) to | 215 | * so need to add all affected_planes (even unchanged) to |
218 | * drm_atomic_state. | 216 | * drm_atomic_state. |
219 | */ | 217 | */ |
220 | for_each_oldnew_crtc_in_state(state, crtc, old_crtc_st, new_crtc_st, i) { | 218 | for_each_new_crtc_in_state(state, crtc, new_crtc_st, i) { |
221 | err = drm_atomic_add_affected_planes(state, crtc); | 219 | err = drm_atomic_add_affected_planes(state, crtc); |
222 | if (err) | 220 | if (err) |
223 | return err; | 221 | return err; |
@@ -308,11 +306,11 @@ struct komeda_kms_dev *komeda_kms_attach(struct komeda_dev *mdev) | |||
308 | komeda_kms_irq_handler, IRQF_SHARED, | 306 | komeda_kms_irq_handler, IRQF_SHARED, |
309 | drm->driver->name, drm); | 307 | drm->driver->name, drm); |
310 | if (err) | 308 | if (err) |
311 | goto cleanup_mode_config; | 309 | goto free_component_binding; |
312 | 310 | ||
313 | err = mdev->funcs->enable_irq(mdev); | 311 | err = mdev->funcs->enable_irq(mdev); |
314 | if (err) | 312 | if (err) |
315 | goto cleanup_mode_config; | 313 | goto free_component_binding; |
316 | 314 | ||
317 | drm->irq_enabled = true; | 315 | drm->irq_enabled = true; |
318 | 316 | ||
@@ -320,15 +318,21 @@ struct komeda_kms_dev *komeda_kms_attach(struct komeda_dev *mdev) | |||
320 | 318 | ||
321 | err = drm_dev_register(drm, 0); | 319 | err = drm_dev_register(drm, 0); |
322 | if (err) | 320 | if (err) |
323 | goto cleanup_mode_config; | 321 | goto free_interrupts; |
324 | 322 | ||
325 | return kms; | 323 | return kms; |
326 | 324 | ||
327 | cleanup_mode_config: | 325 | free_interrupts: |
328 | drm_kms_helper_poll_fini(drm); | 326 | drm_kms_helper_poll_fini(drm); |
329 | drm->irq_enabled = false; | 327 | drm->irq_enabled = false; |
328 | mdev->funcs->disable_irq(mdev); | ||
329 | free_component_binding: | ||
330 | component_unbind_all(mdev->dev, drm); | ||
331 | cleanup_mode_config: | ||
330 | drm_mode_config_cleanup(drm); | 332 | drm_mode_config_cleanup(drm); |
331 | komeda_kms_cleanup_private_objs(kms); | 333 | komeda_kms_cleanup_private_objs(kms); |
334 | drm->dev_private = NULL; | ||
335 | drm_dev_put(drm); | ||
332 | free_kms: | 336 | free_kms: |
333 | kfree(kms); | 337 | kfree(kms); |
334 | return ERR_PTR(err); | 338 | return ERR_PTR(err); |
@@ -339,13 +343,14 @@ void komeda_kms_detach(struct komeda_kms_dev *kms) | |||
339 | struct drm_device *drm = &kms->base; | 343 | struct drm_device *drm = &kms->base; |
340 | struct komeda_dev *mdev = drm->dev_private; | 344 | struct komeda_dev *mdev = drm->dev_private; |
341 | 345 | ||
342 | drm->irq_enabled = false; | ||
343 | mdev->funcs->disable_irq(mdev); | ||
344 | drm_dev_unregister(drm); | 346 | drm_dev_unregister(drm); |
345 | drm_kms_helper_poll_fini(drm); | 347 | drm_kms_helper_poll_fini(drm); |
348 | drm_atomic_helper_shutdown(drm); | ||
349 | drm->irq_enabled = false; | ||
350 | mdev->funcs->disable_irq(mdev); | ||
346 | component_unbind_all(mdev->dev, drm); | 351 | component_unbind_all(mdev->dev, drm); |
347 | komeda_kms_cleanup_private_objs(kms); | ||
348 | drm_mode_config_cleanup(drm); | 352 | drm_mode_config_cleanup(drm); |
353 | komeda_kms_cleanup_private_objs(kms); | ||
349 | drm->dev_private = NULL; | 354 | drm->dev_private = NULL; |
350 | drm_dev_put(drm); | 355 | drm_dev_put(drm); |
351 | } | 356 | } |
diff --git a/drivers/gpu/drm/arm/display/komeda/komeda_pipeline.h b/drivers/gpu/drm/arm/display/komeda/komeda_pipeline.h index a90bcbb3cb23..14b683164544 100644 --- a/drivers/gpu/drm/arm/display/komeda/komeda_pipeline.h +++ b/drivers/gpu/drm/arm/display/komeda/komeda_pipeline.h | |||
@@ -480,6 +480,7 @@ void komeda_pipeline_dump_register(struct komeda_pipeline *pipe, | |||
480 | struct seq_file *sf); | 480 | struct seq_file *sf); |
481 | 481 | ||
482 | /* component APIs */ | 482 | /* component APIs */ |
483 | extern __printf(10, 11) | ||
483 | struct komeda_component * | 484 | struct komeda_component * |
484 | komeda_component_add(struct komeda_pipeline *pipe, | 485 | komeda_component_add(struct komeda_pipeline *pipe, |
485 | size_t comp_sz, u32 id, u32 hw_id, | 486 | size_t comp_sz, u32 id, u32 hw_id, |
diff --git a/drivers/gpu/drm/arm/display/komeda/komeda_wb_connector.c b/drivers/gpu/drm/arm/display/komeda/komeda_wb_connector.c index 617e1f7b8472..2851cac94d86 100644 --- a/drivers/gpu/drm/arm/display/komeda/komeda_wb_connector.c +++ b/drivers/gpu/drm/arm/display/komeda/komeda_wb_connector.c | |||
@@ -148,7 +148,7 @@ static int komeda_wb_connector_add(struct komeda_kms_dev *kms, | |||
148 | if (!kcrtc->master->wb_layer) | 148 | if (!kcrtc->master->wb_layer) |
149 | return 0; | 149 | return 0; |
150 | 150 | ||
151 | kwb_conn = kzalloc(sizeof(*wb_conn), GFP_KERNEL); | 151 | kwb_conn = kzalloc(sizeof(*kwb_conn), GFP_KERNEL); |
152 | if (!kwb_conn) | 152 | if (!kwb_conn) |
153 | return -ENOMEM; | 153 | return -ENOMEM; |
154 | 154 | ||
diff --git a/drivers/gpu/drm/i915/display/intel_dp_mst.c b/drivers/gpu/drm/i915/display/intel_dp_mst.c index 60652ebbdf61..18e4cba76720 100644 --- a/drivers/gpu/drm/i915/display/intel_dp_mst.c +++ b/drivers/gpu/drm/i915/display/intel_dp_mst.c | |||
@@ -539,7 +539,15 @@ static struct drm_connector *intel_dp_add_mst_connector(struct drm_dp_mst_topolo | |||
539 | 539 | ||
540 | intel_attach_force_audio_property(connector); | 540 | intel_attach_force_audio_property(connector); |
541 | intel_attach_broadcast_rgb_property(connector); | 541 | intel_attach_broadcast_rgb_property(connector); |
542 | drm_connector_attach_max_bpc_property(connector, 6, 12); | 542 | |
543 | /* | ||
544 | * Reuse the prop from the SST connector because we're | ||
545 | * not allowed to create new props after device registration. | ||
546 | */ | ||
547 | connector->max_bpc_property = | ||
548 | intel_dp->attached_connector->base.max_bpc_property; | ||
549 | if (connector->max_bpc_property) | ||
550 | drm_connector_attach_max_bpc_property(connector, 6, 12); | ||
543 | 551 | ||
544 | return connector; | 552 | return connector; |
545 | 553 | ||
diff --git a/drivers/gpu/drm/i915/display/intel_vdsc.c b/drivers/gpu/drm/i915/display/intel_vdsc.c index ffec807b8960..f413904a3e96 100644 --- a/drivers/gpu/drm/i915/display/intel_vdsc.c +++ b/drivers/gpu/drm/i915/display/intel_vdsc.c | |||
@@ -541,7 +541,7 @@ static void intel_configure_pps_for_dsc_encoder(struct intel_encoder *encoder, | |||
541 | pps_val |= DSC_PIC_HEIGHT(vdsc_cfg->pic_height) | | 541 | pps_val |= DSC_PIC_HEIGHT(vdsc_cfg->pic_height) | |
542 | DSC_PIC_WIDTH(vdsc_cfg->pic_width / num_vdsc_instances); | 542 | DSC_PIC_WIDTH(vdsc_cfg->pic_width / num_vdsc_instances); |
543 | DRM_INFO("PPS2 = 0x%08x\n", pps_val); | 543 | DRM_INFO("PPS2 = 0x%08x\n", pps_val); |
544 | if (encoder->type == INTEL_OUTPUT_EDP) { | 544 | if (cpu_transcoder == TRANSCODER_EDP) { |
545 | I915_WRITE(DSCA_PICTURE_PARAMETER_SET_2, pps_val); | 545 | I915_WRITE(DSCA_PICTURE_PARAMETER_SET_2, pps_val); |
546 | /* | 546 | /* |
547 | * If 2 VDSC instances are needed, configure PPS for second | 547 | * If 2 VDSC instances are needed, configure PPS for second |
diff --git a/drivers/gpu/drm/i915/i915_drv.c b/drivers/gpu/drm/i915/i915_drv.c index f62e3397d936..bac1ee94f63f 100644 --- a/drivers/gpu/drm/i915/i915_drv.c +++ b/drivers/gpu/drm/i915/i915_drv.c | |||
@@ -1598,6 +1598,12 @@ static int i915_driver_init_hw(struct drm_i915_private *dev_priv) | |||
1598 | 1598 | ||
1599 | pci_set_master(pdev); | 1599 | pci_set_master(pdev); |
1600 | 1600 | ||
1601 | /* | ||
1602 | * We don't have a max segment size, so set it to the max so sg's | ||
1603 | * debugging layer doesn't complain | ||
1604 | */ | ||
1605 | dma_set_max_seg_size(&pdev->dev, UINT_MAX); | ||
1606 | |||
1601 | /* overlay on gen2 is broken and can't address above 1G */ | 1607 | /* overlay on gen2 is broken and can't address above 1G */ |
1602 | if (IS_GEN(dev_priv, 2)) { | 1608 | if (IS_GEN(dev_priv, 2)) { |
1603 | ret = dma_set_coherent_mask(&pdev->dev, DMA_BIT_MASK(30)); | 1609 | ret = dma_set_coherent_mask(&pdev->dev, DMA_BIT_MASK(30)); |
diff --git a/drivers/gpu/drm/i915/i915_vgpu.c b/drivers/gpu/drm/i915/i915_vgpu.c index 94d3992b599d..724627afdedc 100644 --- a/drivers/gpu/drm/i915/i915_vgpu.c +++ b/drivers/gpu/drm/i915/i915_vgpu.c | |||
@@ -101,6 +101,9 @@ static struct _balloon_info_ bl_info; | |||
101 | static void vgt_deballoon_space(struct i915_ggtt *ggtt, | 101 | static void vgt_deballoon_space(struct i915_ggtt *ggtt, |
102 | struct drm_mm_node *node) | 102 | struct drm_mm_node *node) |
103 | { | 103 | { |
104 | if (!drm_mm_node_allocated(node)) | ||
105 | return; | ||
106 | |||
104 | DRM_DEBUG_DRIVER("deballoon space: range [0x%llx - 0x%llx] %llu KiB.\n", | 107 | DRM_DEBUG_DRIVER("deballoon space: range [0x%llx - 0x%llx] %llu KiB.\n", |
105 | node->start, | 108 | node->start, |
106 | node->start + node->size, | 109 | node->start + node->size, |
diff --git a/drivers/gpu/drm/omapdrm/dss/output.c b/drivers/gpu/drm/omapdrm/dss/output.c index de0f882f0f7b..14b41de44ebc 100644 --- a/drivers/gpu/drm/omapdrm/dss/output.c +++ b/drivers/gpu/drm/omapdrm/dss/output.c | |||
@@ -4,6 +4,7 @@ | |||
4 | * Author: Archit Taneja <archit@ti.com> | 4 | * Author: Archit Taneja <archit@ti.com> |
5 | */ | 5 | */ |
6 | 6 | ||
7 | #include <linux/bitops.h> | ||
7 | #include <linux/kernel.h> | 8 | #include <linux/kernel.h> |
8 | #include <linux/module.h> | 9 | #include <linux/module.h> |
9 | #include <linux/platform_device.h> | 10 | #include <linux/platform_device.h> |
@@ -20,7 +21,8 @@ int omapdss_device_init_output(struct omap_dss_device *out) | |||
20 | { | 21 | { |
21 | struct device_node *remote_node; | 22 | struct device_node *remote_node; |
22 | 23 | ||
23 | remote_node = of_graph_get_remote_node(out->dev->of_node, 0, 0); | 24 | remote_node = of_graph_get_remote_node(out->dev->of_node, |
25 | ffs(out->of_ports) - 1, 0); | ||
24 | if (!remote_node) { | 26 | if (!remote_node) { |
25 | dev_dbg(out->dev, "failed to find video sink\n"); | 27 | dev_dbg(out->dev, "failed to find video sink\n"); |
26 | return 0; | 28 | return 0; |
diff --git a/drivers/gpu/drm/qxl/qxl_drv.c b/drivers/gpu/drm/qxl/qxl_drv.c index f33e349c4ec5..952201c6d821 100644 --- a/drivers/gpu/drm/qxl/qxl_drv.c +++ b/drivers/gpu/drm/qxl/qxl_drv.c | |||
@@ -59,6 +59,11 @@ module_param_named(num_heads, qxl_num_crtc, int, 0400); | |||
59 | static struct drm_driver qxl_driver; | 59 | static struct drm_driver qxl_driver; |
60 | static struct pci_driver qxl_pci_driver; | 60 | static struct pci_driver qxl_pci_driver; |
61 | 61 | ||
62 | static bool is_vga(struct pci_dev *pdev) | ||
63 | { | ||
64 | return pdev->class == PCI_CLASS_DISPLAY_VGA << 8; | ||
65 | } | ||
66 | |||
62 | static int | 67 | static int |
63 | qxl_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent) | 68 | qxl_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent) |
64 | { | 69 | { |
@@ -83,9 +88,17 @@ qxl_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
83 | if (ret) | 88 | if (ret) |
84 | goto disable_pci; | 89 | goto disable_pci; |
85 | 90 | ||
91 | if (is_vga(pdev)) { | ||
92 | ret = vga_get_interruptible(pdev, VGA_RSRC_LEGACY_IO); | ||
93 | if (ret) { | ||
94 | DRM_ERROR("can't get legacy vga ioports\n"); | ||
95 | goto disable_pci; | ||
96 | } | ||
97 | } | ||
98 | |||
86 | ret = qxl_device_init(qdev, &qxl_driver, pdev); | 99 | ret = qxl_device_init(qdev, &qxl_driver, pdev); |
87 | if (ret) | 100 | if (ret) |
88 | goto disable_pci; | 101 | goto put_vga; |
89 | 102 | ||
90 | ret = qxl_modeset_init(qdev); | 103 | ret = qxl_modeset_init(qdev); |
91 | if (ret) | 104 | if (ret) |
@@ -105,6 +118,9 @@ modeset_cleanup: | |||
105 | qxl_modeset_fini(qdev); | 118 | qxl_modeset_fini(qdev); |
106 | unload: | 119 | unload: |
107 | qxl_device_fini(qdev); | 120 | qxl_device_fini(qdev); |
121 | put_vga: | ||
122 | if (is_vga(pdev)) | ||
123 | vga_put(pdev, VGA_RSRC_LEGACY_IO); | ||
108 | disable_pci: | 124 | disable_pci: |
109 | pci_disable_device(pdev); | 125 | pci_disable_device(pdev); |
110 | free_dev: | 126 | free_dev: |
@@ -122,6 +138,8 @@ qxl_pci_remove(struct pci_dev *pdev) | |||
122 | 138 | ||
123 | qxl_modeset_fini(qdev); | 139 | qxl_modeset_fini(qdev); |
124 | qxl_device_fini(qdev); | 140 | qxl_device_fini(qdev); |
141 | if (is_vga(pdev)) | ||
142 | vga_put(pdev, VGA_RSRC_LEGACY_IO); | ||
125 | 143 | ||
126 | dev->dev_private = NULL; | 144 | dev->dev_private = NULL; |
127 | kfree(qdev); | 145 | kfree(qdev); |
diff --git a/drivers/gpu/drm/virtio/virtgpu_object.c b/drivers/gpu/drm/virtio/virtgpu_object.c index b2da31310d24..09b526518f5a 100644 --- a/drivers/gpu/drm/virtio/virtgpu_object.c +++ b/drivers/gpu/drm/virtio/virtgpu_object.c | |||
@@ -204,6 +204,7 @@ int virtio_gpu_object_get_sg_table(struct virtio_gpu_device *qdev, | |||
204 | .interruptible = false, | 204 | .interruptible = false, |
205 | .no_wait_gpu = false | 205 | .no_wait_gpu = false |
206 | }; | 206 | }; |
207 | size_t max_segment; | ||
207 | 208 | ||
208 | /* wtf swapping */ | 209 | /* wtf swapping */ |
209 | if (bo->pages) | 210 | if (bo->pages) |
@@ -215,8 +216,13 @@ int virtio_gpu_object_get_sg_table(struct virtio_gpu_device *qdev, | |||
215 | if (!bo->pages) | 216 | if (!bo->pages) |
216 | goto out; | 217 | goto out; |
217 | 218 | ||
218 | ret = sg_alloc_table_from_pages(bo->pages, pages, nr_pages, 0, | 219 | max_segment = virtio_max_dma_size(qdev->vdev); |
219 | nr_pages << PAGE_SHIFT, GFP_KERNEL); | 220 | max_segment &= PAGE_MASK; |
221 | if (max_segment > SCATTERLIST_MAX_SEGMENT) | ||
222 | max_segment = SCATTERLIST_MAX_SEGMENT; | ||
223 | ret = __sg_alloc_table_from_pages(bo->pages, pages, nr_pages, 0, | ||
224 | nr_pages << PAGE_SHIFT, | ||
225 | max_segment, GFP_KERNEL); | ||
220 | if (ret) | 226 | if (ret) |
221 | goto out; | 227 | goto out; |
222 | return 0; | 228 | return 0; |
diff --git a/drivers/hwtracing/intel_th/pci.c b/drivers/hwtracing/intel_th/pci.c index c0378c3de9a4..91dfeba62485 100644 --- a/drivers/hwtracing/intel_th/pci.c +++ b/drivers/hwtracing/intel_th/pci.c | |||
@@ -165,6 +165,11 @@ static const struct pci_device_id intel_th_pci_id_table[] = { | |||
165 | .driver_data = (kernel_ulong_t)0, | 165 | .driver_data = (kernel_ulong_t)0, |
166 | }, | 166 | }, |
167 | { | 167 | { |
168 | /* Lewisburg PCH */ | ||
169 | PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0xa226), | ||
170 | .driver_data = (kernel_ulong_t)0, | ||
171 | }, | ||
172 | { | ||
168 | /* Gemini Lake */ | 173 | /* Gemini Lake */ |
169 | PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0x318e), | 174 | PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0x318e), |
170 | .driver_data = (kernel_ulong_t)&intel_th_2x, | 175 | .driver_data = (kernel_ulong_t)&intel_th_2x, |
@@ -199,6 +204,11 @@ static const struct pci_device_id intel_th_pci_id_table[] = { | |||
199 | PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0x45c5), | 204 | PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0x45c5), |
200 | .driver_data = (kernel_ulong_t)&intel_th_2x, | 205 | .driver_data = (kernel_ulong_t)&intel_th_2x, |
201 | }, | 206 | }, |
207 | { | ||
208 | /* Tiger Lake PCH */ | ||
209 | PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0xa0a6), | ||
210 | .driver_data = (kernel_ulong_t)&intel_th_2x, | ||
211 | }, | ||
202 | { 0 }, | 212 | { 0 }, |
203 | }; | 213 | }; |
204 | 214 | ||
diff --git a/drivers/hwtracing/stm/core.c b/drivers/hwtracing/stm/core.c index e55b902560de..181e7ff1ec4f 100644 --- a/drivers/hwtracing/stm/core.c +++ b/drivers/hwtracing/stm/core.c | |||
@@ -1276,7 +1276,6 @@ int stm_source_register_device(struct device *parent, | |||
1276 | 1276 | ||
1277 | err: | 1277 | err: |
1278 | put_device(&src->dev); | 1278 | put_device(&src->dev); |
1279 | kfree(src); | ||
1280 | 1279 | ||
1281 | return err; | 1280 | return err; |
1282 | } | 1281 | } |
diff --git a/drivers/i2c/busses/i2c-bcm-iproc.c b/drivers/i2c/busses/i2c-bcm-iproc.c index d7fd76baec92..19ef2b0c682a 100644 --- a/drivers/i2c/busses/i2c-bcm-iproc.c +++ b/drivers/i2c/busses/i2c-bcm-iproc.c | |||
@@ -790,7 +790,10 @@ static int bcm_iproc_i2c_xfer(struct i2c_adapter *adapter, | |||
790 | 790 | ||
791 | static uint32_t bcm_iproc_i2c_functionality(struct i2c_adapter *adap) | 791 | static uint32_t bcm_iproc_i2c_functionality(struct i2c_adapter *adap) |
792 | { | 792 | { |
793 | u32 val = I2C_FUNC_I2C | I2C_FUNC_SMBUS_EMUL; | 793 | u32 val; |
794 | |||
795 | /* We do not support the SMBUS Quick command */ | ||
796 | val = I2C_FUNC_I2C | (I2C_FUNC_SMBUS_EMUL & ~I2C_FUNC_SMBUS_QUICK); | ||
794 | 797 | ||
795 | if (adap->algo->reg_slave) | 798 | if (adap->algo->reg_slave) |
796 | val |= I2C_FUNC_SLAVE; | 799 | val |= I2C_FUNC_SLAVE; |
diff --git a/drivers/i2c/busses/i2c-designware-slave.c b/drivers/i2c/busses/i2c-designware-slave.c index e7f9305b2dd9..f5f001738df5 100644 --- a/drivers/i2c/busses/i2c-designware-slave.c +++ b/drivers/i2c/busses/i2c-designware-slave.c | |||
@@ -94,6 +94,7 @@ static int i2c_dw_unreg_slave(struct i2c_client *slave) | |||
94 | 94 | ||
95 | dev->disable_int(dev); | 95 | dev->disable_int(dev); |
96 | dev->disable(dev); | 96 | dev->disable(dev); |
97 | synchronize_irq(dev->irq); | ||
97 | dev->slave = NULL; | 98 | dev->slave = NULL; |
98 | pm_runtime_put(dev->dev); | 99 | pm_runtime_put(dev->dev); |
99 | 100 | ||
diff --git a/drivers/i2c/busses/i2c-i801.c b/drivers/i2c/busses/i2c-i801.c index f2956936c3f2..2e08b4722dc4 100644 --- a/drivers/i2c/busses/i2c-i801.c +++ b/drivers/i2c/busses/i2c-i801.c | |||
@@ -1194,19 +1194,28 @@ static acpi_status check_acpi_smo88xx_device(acpi_handle obj_handle, | |||
1194 | int i; | 1194 | int i; |
1195 | 1195 | ||
1196 | status = acpi_get_object_info(obj_handle, &info); | 1196 | status = acpi_get_object_info(obj_handle, &info); |
1197 | if (!ACPI_SUCCESS(status) || !(info->valid & ACPI_VALID_HID)) | 1197 | if (ACPI_FAILURE(status)) |
1198 | return AE_OK; | 1198 | return AE_OK; |
1199 | 1199 | ||
1200 | if (!(info->valid & ACPI_VALID_HID)) | ||
1201 | goto smo88xx_not_found; | ||
1202 | |||
1200 | hid = info->hardware_id.string; | 1203 | hid = info->hardware_id.string; |
1201 | if (!hid) | 1204 | if (!hid) |
1202 | return AE_OK; | 1205 | goto smo88xx_not_found; |
1203 | 1206 | ||
1204 | i = match_string(acpi_smo8800_ids, ARRAY_SIZE(acpi_smo8800_ids), hid); | 1207 | i = match_string(acpi_smo8800_ids, ARRAY_SIZE(acpi_smo8800_ids), hid); |
1205 | if (i < 0) | 1208 | if (i < 0) |
1206 | return AE_OK; | 1209 | goto smo88xx_not_found; |
1210 | |||
1211 | kfree(info); | ||
1207 | 1212 | ||
1208 | *((bool *)return_value) = true; | 1213 | *((bool *)return_value) = true; |
1209 | return AE_CTRL_TERMINATE; | 1214 | return AE_CTRL_TERMINATE; |
1215 | |||
1216 | smo88xx_not_found: | ||
1217 | kfree(info); | ||
1218 | return AE_OK; | ||
1210 | } | 1219 | } |
1211 | 1220 | ||
1212 | static bool is_dell_system_with_lis3lv02d(void) | 1221 | static bool is_dell_system_with_lis3lv02d(void) |
diff --git a/drivers/i2c/busses/i2c-mt65xx.c b/drivers/i2c/busses/i2c-mt65xx.c index 252edb433fdf..29eae1bf4f86 100644 --- a/drivers/i2c/busses/i2c-mt65xx.c +++ b/drivers/i2c/busses/i2c-mt65xx.c | |||
@@ -234,6 +234,10 @@ static const struct i2c_adapter_quirks mt7622_i2c_quirks = { | |||
234 | .max_num_msgs = 255, | 234 | .max_num_msgs = 255, |
235 | }; | 235 | }; |
236 | 236 | ||
237 | static const struct i2c_adapter_quirks mt8183_i2c_quirks = { | ||
238 | .flags = I2C_AQ_NO_ZERO_LEN, | ||
239 | }; | ||
240 | |||
237 | static const struct mtk_i2c_compatible mt2712_compat = { | 241 | static const struct mtk_i2c_compatible mt2712_compat = { |
238 | .regs = mt_i2c_regs_v1, | 242 | .regs = mt_i2c_regs_v1, |
239 | .pmic_i2c = 0, | 243 | .pmic_i2c = 0, |
@@ -298,6 +302,7 @@ static const struct mtk_i2c_compatible mt8173_compat = { | |||
298 | }; | 302 | }; |
299 | 303 | ||
300 | static const struct mtk_i2c_compatible mt8183_compat = { | 304 | static const struct mtk_i2c_compatible mt8183_compat = { |
305 | .quirks = &mt8183_i2c_quirks, | ||
301 | .regs = mt_i2c_regs_v2, | 306 | .regs = mt_i2c_regs_v2, |
302 | .pmic_i2c = 0, | 307 | .pmic_i2c = 0, |
303 | .dcm = 0, | 308 | .dcm = 0, |
@@ -870,7 +875,11 @@ static irqreturn_t mtk_i2c_irq(int irqno, void *dev_id) | |||
870 | 875 | ||
871 | static u32 mtk_i2c_functionality(struct i2c_adapter *adap) | 876 | static u32 mtk_i2c_functionality(struct i2c_adapter *adap) |
872 | { | 877 | { |
873 | return I2C_FUNC_I2C | I2C_FUNC_SMBUS_EMUL; | 878 | if (adap->quirks->flags & I2C_AQ_NO_ZERO_LEN) |
879 | return I2C_FUNC_I2C | | ||
880 | (I2C_FUNC_SMBUS_EMUL & ~I2C_FUNC_SMBUS_QUICK); | ||
881 | else | ||
882 | return I2C_FUNC_I2C | I2C_FUNC_SMBUS_EMUL; | ||
874 | } | 883 | } |
875 | 884 | ||
876 | static const struct i2c_algorithm mtk_i2c_algorithm = { | 885 | static const struct i2c_algorithm mtk_i2c_algorithm = { |
diff --git a/drivers/i2c/busses/i2c-piix4.c b/drivers/i2c/busses/i2c-piix4.c index c46c4bddc7ca..cba325eb852f 100644 --- a/drivers/i2c/busses/i2c-piix4.c +++ b/drivers/i2c/busses/i2c-piix4.c | |||
@@ -91,7 +91,7 @@ | |||
91 | #define SB800_PIIX4_PORT_IDX_MASK 0x06 | 91 | #define SB800_PIIX4_PORT_IDX_MASK 0x06 |
92 | #define SB800_PIIX4_PORT_IDX_SHIFT 1 | 92 | #define SB800_PIIX4_PORT_IDX_SHIFT 1 |
93 | 93 | ||
94 | /* On kerncz, SmBus0Sel is at bit 20:19 of PMx00 DecodeEn */ | 94 | /* On kerncz and Hudson2, SmBus0Sel is at bit 20:19 of PMx00 DecodeEn */ |
95 | #define SB800_PIIX4_PORT_IDX_KERNCZ 0x02 | 95 | #define SB800_PIIX4_PORT_IDX_KERNCZ 0x02 |
96 | #define SB800_PIIX4_PORT_IDX_MASK_KERNCZ 0x18 | 96 | #define SB800_PIIX4_PORT_IDX_MASK_KERNCZ 0x18 |
97 | #define SB800_PIIX4_PORT_IDX_SHIFT_KERNCZ 3 | 97 | #define SB800_PIIX4_PORT_IDX_SHIFT_KERNCZ 3 |
@@ -358,18 +358,16 @@ static int piix4_setup_sb800(struct pci_dev *PIIX4_dev, | |||
358 | /* Find which register is used for port selection */ | 358 | /* Find which register is used for port selection */ |
359 | if (PIIX4_dev->vendor == PCI_VENDOR_ID_AMD || | 359 | if (PIIX4_dev->vendor == PCI_VENDOR_ID_AMD || |
360 | PIIX4_dev->vendor == PCI_VENDOR_ID_HYGON) { | 360 | PIIX4_dev->vendor == PCI_VENDOR_ID_HYGON) { |
361 | switch (PIIX4_dev->device) { | 361 | if (PIIX4_dev->device == PCI_DEVICE_ID_AMD_KERNCZ_SMBUS || |
362 | case PCI_DEVICE_ID_AMD_KERNCZ_SMBUS: | 362 | (PIIX4_dev->device == PCI_DEVICE_ID_AMD_HUDSON2_SMBUS && |
363 | PIIX4_dev->revision >= 0x1F)) { | ||
363 | piix4_port_sel_sb800 = SB800_PIIX4_PORT_IDX_KERNCZ; | 364 | piix4_port_sel_sb800 = SB800_PIIX4_PORT_IDX_KERNCZ; |
364 | piix4_port_mask_sb800 = SB800_PIIX4_PORT_IDX_MASK_KERNCZ; | 365 | piix4_port_mask_sb800 = SB800_PIIX4_PORT_IDX_MASK_KERNCZ; |
365 | piix4_port_shift_sb800 = SB800_PIIX4_PORT_IDX_SHIFT_KERNCZ; | 366 | piix4_port_shift_sb800 = SB800_PIIX4_PORT_IDX_SHIFT_KERNCZ; |
366 | break; | 367 | } else { |
367 | case PCI_DEVICE_ID_AMD_HUDSON2_SMBUS: | ||
368 | default: | ||
369 | piix4_port_sel_sb800 = SB800_PIIX4_PORT_IDX_ALT; | 368 | piix4_port_sel_sb800 = SB800_PIIX4_PORT_IDX_ALT; |
370 | piix4_port_mask_sb800 = SB800_PIIX4_PORT_IDX_MASK; | 369 | piix4_port_mask_sb800 = SB800_PIIX4_PORT_IDX_MASK; |
371 | piix4_port_shift_sb800 = SB800_PIIX4_PORT_IDX_SHIFT; | 370 | piix4_port_shift_sb800 = SB800_PIIX4_PORT_IDX_SHIFT; |
372 | break; | ||
373 | } | 371 | } |
374 | } else { | 372 | } else { |
375 | if (!request_muxed_region(SB800_PIIX4_SMB_IDX, 2, | 373 | if (!request_muxed_region(SB800_PIIX4_SMB_IDX, 2, |
diff --git a/drivers/i2c/i2c-core-base.c b/drivers/i2c/i2c-core-base.c index f26ed495d384..9c440fa6a3dd 100644 --- a/drivers/i2c/i2c-core-base.c +++ b/drivers/i2c/i2c-core-base.c | |||
@@ -832,7 +832,7 @@ EXPORT_SYMBOL_GPL(i2c_new_device); | |||
832 | */ | 832 | */ |
833 | void i2c_unregister_device(struct i2c_client *client) | 833 | void i2c_unregister_device(struct i2c_client *client) |
834 | { | 834 | { |
835 | if (!client) | 835 | if (IS_ERR_OR_NULL(client)) |
836 | return; | 836 | return; |
837 | 837 | ||
838 | if (client->dev.of_node) { | 838 | if (client->dev.of_node) { |
diff --git a/drivers/infiniband/sw/siw/siw_cm.c b/drivers/infiniband/sw/siw/siw_cm.c index 1db5ad3d9580..8c1931a57f4a 100644 --- a/drivers/infiniband/sw/siw/siw_cm.c +++ b/drivers/infiniband/sw/siw/siw_cm.c | |||
@@ -1962,6 +1962,10 @@ int siw_create_listen(struct iw_cm_id *id, int backlog) | |||
1962 | struct sockaddr_in s_laddr, *s_raddr; | 1962 | struct sockaddr_in s_laddr, *s_raddr; |
1963 | const struct in_ifaddr *ifa; | 1963 | const struct in_ifaddr *ifa; |
1964 | 1964 | ||
1965 | if (!in_dev) { | ||
1966 | rv = -ENODEV; | ||
1967 | goto out; | ||
1968 | } | ||
1965 | memcpy(&s_laddr, &id->local_addr, sizeof(s_laddr)); | 1969 | memcpy(&s_laddr, &id->local_addr, sizeof(s_laddr)); |
1966 | s_raddr = (struct sockaddr_in *)&id->remote_addr; | 1970 | s_raddr = (struct sockaddr_in *)&id->remote_addr; |
1967 | 1971 | ||
@@ -1991,22 +1995,27 @@ int siw_create_listen(struct iw_cm_id *id, int backlog) | |||
1991 | struct sockaddr_in6 *s_laddr = &to_sockaddr_in6(id->local_addr), | 1995 | struct sockaddr_in6 *s_laddr = &to_sockaddr_in6(id->local_addr), |
1992 | *s_raddr = &to_sockaddr_in6(id->remote_addr); | 1996 | *s_raddr = &to_sockaddr_in6(id->remote_addr); |
1993 | 1997 | ||
1998 | if (!in6_dev) { | ||
1999 | rv = -ENODEV; | ||
2000 | goto out; | ||
2001 | } | ||
1994 | siw_dbg(id->device, | 2002 | siw_dbg(id->device, |
1995 | "laddr %pI6:%d, raddr %pI6:%d\n", | 2003 | "laddr %pI6:%d, raddr %pI6:%d\n", |
1996 | &s_laddr->sin6_addr, ntohs(s_laddr->sin6_port), | 2004 | &s_laddr->sin6_addr, ntohs(s_laddr->sin6_port), |
1997 | &s_raddr->sin6_addr, ntohs(s_raddr->sin6_port)); | 2005 | &s_raddr->sin6_addr, ntohs(s_raddr->sin6_port)); |
1998 | 2006 | ||
1999 | read_lock_bh(&in6_dev->lock); | 2007 | rtnl_lock(); |
2000 | list_for_each_entry(ifp, &in6_dev->addr_list, if_list) { | 2008 | list_for_each_entry(ifp, &in6_dev->addr_list, if_list) { |
2001 | struct sockaddr_in6 bind_addr; | 2009 | if (ifp->flags & (IFA_F_TENTATIVE | IFA_F_DEPRECATED)) |
2002 | 2010 | continue; | |
2003 | if (ipv6_addr_any(&s_laddr->sin6_addr) || | 2011 | if (ipv6_addr_any(&s_laddr->sin6_addr) || |
2004 | ipv6_addr_equal(&s_laddr->sin6_addr, &ifp->addr)) { | 2012 | ipv6_addr_equal(&s_laddr->sin6_addr, &ifp->addr)) { |
2005 | bind_addr.sin6_family = AF_INET6; | 2013 | struct sockaddr_in6 bind_addr = { |
2006 | bind_addr.sin6_port = s_laddr->sin6_port; | 2014 | .sin6_family = AF_INET6, |
2007 | bind_addr.sin6_flowinfo = 0; | 2015 | .sin6_port = s_laddr->sin6_port, |
2008 | bind_addr.sin6_addr = ifp->addr; | 2016 | .sin6_flowinfo = 0, |
2009 | bind_addr.sin6_scope_id = dev->ifindex; | 2017 | .sin6_addr = ifp->addr, |
2018 | .sin6_scope_id = dev->ifindex }; | ||
2010 | 2019 | ||
2011 | rv = siw_listen_address(id, backlog, | 2020 | rv = siw_listen_address(id, backlog, |
2012 | (struct sockaddr *)&bind_addr, | 2021 | (struct sockaddr *)&bind_addr, |
@@ -2015,12 +2024,12 @@ int siw_create_listen(struct iw_cm_id *id, int backlog) | |||
2015 | listeners++; | 2024 | listeners++; |
2016 | } | 2025 | } |
2017 | } | 2026 | } |
2018 | read_unlock_bh(&in6_dev->lock); | 2027 | rtnl_unlock(); |
2019 | |||
2020 | in6_dev_put(in6_dev); | 2028 | in6_dev_put(in6_dev); |
2021 | } else { | 2029 | } else { |
2022 | return -EAFNOSUPPORT; | 2030 | rv = -EAFNOSUPPORT; |
2023 | } | 2031 | } |
2032 | out: | ||
2024 | if (listeners) | 2033 | if (listeners) |
2025 | rv = 0; | 2034 | rv = 0; |
2026 | else if (!rv) | 2035 | else if (!rv) |
diff --git a/drivers/misc/lkdtm/bugs.c b/drivers/misc/lkdtm/bugs.c index 1606658b9b7e..24245ccdba72 100644 --- a/drivers/misc/lkdtm/bugs.c +++ b/drivers/misc/lkdtm/bugs.c | |||
@@ -22,7 +22,7 @@ struct lkdtm_list { | |||
22 | * recurse past the end of THREAD_SIZE by default. | 22 | * recurse past the end of THREAD_SIZE by default. |
23 | */ | 23 | */ |
24 | #if defined(CONFIG_FRAME_WARN) && (CONFIG_FRAME_WARN > 0) | 24 | #if defined(CONFIG_FRAME_WARN) && (CONFIG_FRAME_WARN > 0) |
25 | #define REC_STACK_SIZE (CONFIG_FRAME_WARN / 2) | 25 | #define REC_STACK_SIZE (_AC(CONFIG_FRAME_WARN, UL) / 2) |
26 | #else | 26 | #else |
27 | #define REC_STACK_SIZE (THREAD_SIZE / 8) | 27 | #define REC_STACK_SIZE (THREAD_SIZE / 8) |
28 | #endif | 28 | #endif |
@@ -91,7 +91,7 @@ void lkdtm_LOOP(void) | |||
91 | 91 | ||
92 | void lkdtm_EXHAUST_STACK(void) | 92 | void lkdtm_EXHAUST_STACK(void) |
93 | { | 93 | { |
94 | pr_info("Calling function with %d frame size to depth %d ...\n", | 94 | pr_info("Calling function with %lu frame size to depth %d ...\n", |
95 | REC_STACK_SIZE, recur_count); | 95 | REC_STACK_SIZE, recur_count); |
96 | recursive_loop(recur_count); | 96 | recursive_loop(recur_count); |
97 | pr_info("FAIL: survived without exhausting stack?!\n"); | 97 | pr_info("FAIL: survived without exhausting stack?!\n"); |
diff --git a/drivers/misc/mei/hw-me-regs.h b/drivers/misc/mei/hw-me-regs.h index 6c0173772162..77f7dff7098d 100644 --- a/drivers/misc/mei/hw-me-regs.h +++ b/drivers/misc/mei/hw-me-regs.h | |||
@@ -81,6 +81,8 @@ | |||
81 | 81 | ||
82 | #define MEI_DEV_ID_ICP_LP 0x34E0 /* Ice Lake Point LP */ | 82 | #define MEI_DEV_ID_ICP_LP 0x34E0 /* Ice Lake Point LP */ |
83 | 83 | ||
84 | #define MEI_DEV_ID_TGP_LP 0xA0E0 /* Tiger Lake Point LP */ | ||
85 | |||
84 | #define MEI_DEV_ID_MCC 0x4B70 /* Mule Creek Canyon (EHL) */ | 86 | #define MEI_DEV_ID_MCC 0x4B70 /* Mule Creek Canyon (EHL) */ |
85 | #define MEI_DEV_ID_MCC_4 0x4B75 /* Mule Creek Canyon 4 (EHL) */ | 87 | #define MEI_DEV_ID_MCC_4 0x4B75 /* Mule Creek Canyon 4 (EHL) */ |
86 | 88 | ||
diff --git a/drivers/misc/mei/pci-me.c b/drivers/misc/mei/pci-me.c index 57cb68f5cc64..541538eff8b1 100644 --- a/drivers/misc/mei/pci-me.c +++ b/drivers/misc/mei/pci-me.c | |||
@@ -98,6 +98,8 @@ static const struct pci_device_id mei_me_pci_tbl[] = { | |||
98 | 98 | ||
99 | {MEI_PCI_DEVICE(MEI_DEV_ID_ICP_LP, MEI_ME_PCH12_CFG)}, | 99 | {MEI_PCI_DEVICE(MEI_DEV_ID_ICP_LP, MEI_ME_PCH12_CFG)}, |
100 | 100 | ||
101 | {MEI_PCI_DEVICE(MEI_DEV_ID_TGP_LP, MEI_ME_PCH12_CFG)}, | ||
102 | |||
101 | {MEI_PCI_DEVICE(MEI_DEV_ID_MCC, MEI_ME_PCH12_CFG)}, | 103 | {MEI_PCI_DEVICE(MEI_DEV_ID_MCC, MEI_ME_PCH12_CFG)}, |
102 | {MEI_PCI_DEVICE(MEI_DEV_ID_MCC_4, MEI_ME_PCH8_CFG)}, | 104 | {MEI_PCI_DEVICE(MEI_DEV_ID_MCC_4, MEI_ME_PCH8_CFG)}, |
103 | 105 | ||
diff --git a/drivers/misc/vmw_balloon.c b/drivers/misc/vmw_balloon.c index 8840299420e0..5e6be1527571 100644 --- a/drivers/misc/vmw_balloon.c +++ b/drivers/misc/vmw_balloon.c | |||
@@ -691,7 +691,6 @@ static int vmballoon_alloc_page_list(struct vmballoon *b, | |||
691 | } | 691 | } |
692 | 692 | ||
693 | if (page) { | 693 | if (page) { |
694 | vmballoon_mark_page_offline(page, ctl->page_size); | ||
695 | /* Success. Add the page to the list and continue. */ | 694 | /* Success. Add the page to the list and continue. */ |
696 | list_add(&page->lru, &ctl->pages); | 695 | list_add(&page->lru, &ctl->pages); |
697 | continue; | 696 | continue; |
@@ -930,7 +929,6 @@ static void vmballoon_release_page_list(struct list_head *page_list, | |||
930 | 929 | ||
931 | list_for_each_entry_safe(page, tmp, page_list, lru) { | 930 | list_for_each_entry_safe(page, tmp, page_list, lru) { |
932 | list_del(&page->lru); | 931 | list_del(&page->lru); |
933 | vmballoon_mark_page_online(page, page_size); | ||
934 | __free_pages(page, vmballoon_page_order(page_size)); | 932 | __free_pages(page, vmballoon_page_order(page_size)); |
935 | } | 933 | } |
936 | 934 | ||
@@ -1005,6 +1003,7 @@ static void vmballoon_enqueue_page_list(struct vmballoon *b, | |||
1005 | enum vmballoon_page_size_type page_size) | 1003 | enum vmballoon_page_size_type page_size) |
1006 | { | 1004 | { |
1007 | unsigned long flags; | 1005 | unsigned long flags; |
1006 | struct page *page; | ||
1008 | 1007 | ||
1009 | if (page_size == VMW_BALLOON_4K_PAGE) { | 1008 | if (page_size == VMW_BALLOON_4K_PAGE) { |
1010 | balloon_page_list_enqueue(&b->b_dev_info, pages); | 1009 | balloon_page_list_enqueue(&b->b_dev_info, pages); |
@@ -1014,6 +1013,11 @@ static void vmballoon_enqueue_page_list(struct vmballoon *b, | |||
1014 | * for the balloon compaction mechanism. | 1013 | * for the balloon compaction mechanism. |
1015 | */ | 1014 | */ |
1016 | spin_lock_irqsave(&b->b_dev_info.pages_lock, flags); | 1015 | spin_lock_irqsave(&b->b_dev_info.pages_lock, flags); |
1016 | |||
1017 | list_for_each_entry(page, pages, lru) { | ||
1018 | vmballoon_mark_page_offline(page, VMW_BALLOON_2M_PAGE); | ||
1019 | } | ||
1020 | |||
1017 | list_splice_init(pages, &b->huge_pages); | 1021 | list_splice_init(pages, &b->huge_pages); |
1018 | __count_vm_events(BALLOON_INFLATE, *n_pages * | 1022 | __count_vm_events(BALLOON_INFLATE, *n_pages * |
1019 | vmballoon_page_in_frames(VMW_BALLOON_2M_PAGE)); | 1023 | vmballoon_page_in_frames(VMW_BALLOON_2M_PAGE)); |
@@ -1056,6 +1060,8 @@ static void vmballoon_dequeue_page_list(struct vmballoon *b, | |||
1056 | /* 2MB pages */ | 1060 | /* 2MB pages */ |
1057 | spin_lock_irqsave(&b->b_dev_info.pages_lock, flags); | 1061 | spin_lock_irqsave(&b->b_dev_info.pages_lock, flags); |
1058 | list_for_each_entry_safe(page, tmp, &b->huge_pages, lru) { | 1062 | list_for_each_entry_safe(page, tmp, &b->huge_pages, lru) { |
1063 | vmballoon_mark_page_online(page, VMW_BALLOON_2M_PAGE); | ||
1064 | |||
1059 | list_move(&page->lru, pages); | 1065 | list_move(&page->lru, pages); |
1060 | if (++i == n_req_pages) | 1066 | if (++i == n_req_pages) |
1061 | break; | 1067 | break; |
diff --git a/drivers/misc/vmw_vmci/vmci_doorbell.c b/drivers/misc/vmw_vmci/vmci_doorbell.c index bad89b6e0802..345addd9306d 100644 --- a/drivers/misc/vmw_vmci/vmci_doorbell.c +++ b/drivers/misc/vmw_vmci/vmci_doorbell.c | |||
@@ -310,7 +310,8 @@ int vmci_dbell_host_context_notify(u32 src_cid, struct vmci_handle handle) | |||
310 | 310 | ||
311 | entry = container_of(resource, struct dbell_entry, resource); | 311 | entry = container_of(resource, struct dbell_entry, resource); |
312 | if (entry->run_delayed) { | 312 | if (entry->run_delayed) { |
313 | schedule_work(&entry->work); | 313 | if (!schedule_work(&entry->work)) |
314 | vmci_resource_put(resource); | ||
314 | } else { | 315 | } else { |
315 | entry->notify_cb(entry->client_data); | 316 | entry->notify_cb(entry->client_data); |
316 | vmci_resource_put(resource); | 317 | vmci_resource_put(resource); |
@@ -361,7 +362,8 @@ static void dbell_fire_entries(u32 notify_idx) | |||
361 | atomic_read(&dbell->active) == 1) { | 362 | atomic_read(&dbell->active) == 1) { |
362 | if (dbell->run_delayed) { | 363 | if (dbell->run_delayed) { |
363 | vmci_resource_get(&dbell->resource); | 364 | vmci_resource_get(&dbell->resource); |
364 | schedule_work(&dbell->work); | 365 | if (!schedule_work(&dbell->work)) |
366 | vmci_resource_put(&dbell->resource); | ||
365 | } else { | 367 | } else { |
366 | dbell->notify_cb(dbell->client_data); | 368 | dbell->notify_cb(dbell->client_data); |
367 | } | 369 | } |
diff --git a/drivers/mmc/core/sd.c b/drivers/mmc/core/sd.c index d681e8aaca83..fe914ff5f5d6 100644 --- a/drivers/mmc/core/sd.c +++ b/drivers/mmc/core/sd.c | |||
@@ -1292,6 +1292,12 @@ int mmc_attach_sd(struct mmc_host *host) | |||
1292 | goto err; | 1292 | goto err; |
1293 | } | 1293 | } |
1294 | 1294 | ||
1295 | /* | ||
1296 | * Some SD cards claims an out of spec VDD voltage range. Let's treat | ||
1297 | * these bits as being in-valid and especially also bit7. | ||
1298 | */ | ||
1299 | ocr &= ~0x7FFF; | ||
1300 | |||
1295 | rocr = mmc_select_voltage(host, ocr); | 1301 | rocr = mmc_select_voltage(host, ocr); |
1296 | 1302 | ||
1297 | /* | 1303 | /* |
diff --git a/drivers/mmc/host/sdhci-cadence.c b/drivers/mmc/host/sdhci-cadence.c index 163d1cf4367e..44139fceac24 100644 --- a/drivers/mmc/host/sdhci-cadence.c +++ b/drivers/mmc/host/sdhci-cadence.c | |||
@@ -369,6 +369,7 @@ static int sdhci_cdns_probe(struct platform_device *pdev) | |||
369 | host->mmc_host_ops.execute_tuning = sdhci_cdns_execute_tuning; | 369 | host->mmc_host_ops.execute_tuning = sdhci_cdns_execute_tuning; |
370 | host->mmc_host_ops.hs400_enhanced_strobe = | 370 | host->mmc_host_ops.hs400_enhanced_strobe = |
371 | sdhci_cdns_hs400_enhanced_strobe; | 371 | sdhci_cdns_hs400_enhanced_strobe; |
372 | sdhci_enable_v4_mode(host); | ||
372 | 373 | ||
373 | sdhci_get_of_property(pdev); | 374 | sdhci_get_of_property(pdev); |
374 | 375 | ||
diff --git a/drivers/mmc/host/sdhci-of-at91.c b/drivers/mmc/host/sdhci-of-at91.c index d4e7e8b7be77..e7d1920729fb 100644 --- a/drivers/mmc/host/sdhci-of-at91.c +++ b/drivers/mmc/host/sdhci-of-at91.c | |||
@@ -357,6 +357,9 @@ static int sdhci_at91_probe(struct platform_device *pdev) | |||
357 | pm_runtime_set_autosuspend_delay(&pdev->dev, 50); | 357 | pm_runtime_set_autosuspend_delay(&pdev->dev, 50); |
358 | pm_runtime_use_autosuspend(&pdev->dev); | 358 | pm_runtime_use_autosuspend(&pdev->dev); |
359 | 359 | ||
360 | /* HS200 is broken at this moment */ | ||
361 | host->quirks2 = SDHCI_QUIRK2_BROKEN_HS200; | ||
362 | |||
360 | ret = sdhci_add_host(host); | 363 | ret = sdhci_add_host(host); |
361 | if (ret) | 364 | if (ret) |
362 | goto pm_runtime_disable; | 365 | goto pm_runtime_disable; |
diff --git a/drivers/mmc/host/sdhci-sprd.c b/drivers/mmc/host/sdhci-sprd.c index 83a4767ca680..d07b9793380f 100644 --- a/drivers/mmc/host/sdhci-sprd.c +++ b/drivers/mmc/host/sdhci-sprd.c | |||
@@ -217,10 +217,11 @@ static inline void _sdhci_sprd_set_clock(struct sdhci_host *host, | |||
217 | struct sdhci_sprd_host *sprd_host = TO_SPRD_HOST(host); | 217 | struct sdhci_sprd_host *sprd_host = TO_SPRD_HOST(host); |
218 | u32 div, val, mask; | 218 | u32 div, val, mask; |
219 | 219 | ||
220 | div = sdhci_sprd_calc_div(sprd_host->base_rate, clk); | 220 | sdhci_writew(host, 0, SDHCI_CLOCK_CONTROL); |
221 | 221 | ||
222 | clk |= ((div & 0x300) >> 2) | ((div & 0xFF) << 8); | 222 | div = sdhci_sprd_calc_div(sprd_host->base_rate, clk); |
223 | sdhci_enable_clk(host, clk); | 223 | div = ((div & 0x300) >> 2) | ((div & 0xFF) << 8); |
224 | sdhci_enable_clk(host, div); | ||
224 | 225 | ||
225 | /* enable auto gate sdhc_enable_auto_gate */ | 226 | /* enable auto gate sdhc_enable_auto_gate */ |
226 | val = sdhci_readl(host, SDHCI_SPRD_REG_32_BUSY_POSI); | 227 | val = sdhci_readl(host, SDHCI_SPRD_REG_32_BUSY_POSI); |
@@ -373,6 +374,11 @@ static unsigned int sdhci_sprd_get_max_timeout_count(struct sdhci_host *host) | |||
373 | return 1 << 31; | 374 | return 1 << 31; |
374 | } | 375 | } |
375 | 376 | ||
377 | static unsigned int sdhci_sprd_get_ro(struct sdhci_host *host) | ||
378 | { | ||
379 | return 0; | ||
380 | } | ||
381 | |||
376 | static struct sdhci_ops sdhci_sprd_ops = { | 382 | static struct sdhci_ops sdhci_sprd_ops = { |
377 | .read_l = sdhci_sprd_readl, | 383 | .read_l = sdhci_sprd_readl, |
378 | .write_l = sdhci_sprd_writel, | 384 | .write_l = sdhci_sprd_writel, |
@@ -385,6 +391,7 @@ static struct sdhci_ops sdhci_sprd_ops = { | |||
385 | .set_uhs_signaling = sdhci_sprd_set_uhs_signaling, | 391 | .set_uhs_signaling = sdhci_sprd_set_uhs_signaling, |
386 | .hw_reset = sdhci_sprd_hw_reset, | 392 | .hw_reset = sdhci_sprd_hw_reset, |
387 | .get_max_timeout_count = sdhci_sprd_get_max_timeout_count, | 393 | .get_max_timeout_count = sdhci_sprd_get_max_timeout_count, |
394 | .get_ro = sdhci_sprd_get_ro, | ||
388 | }; | 395 | }; |
389 | 396 | ||
390 | static void sdhci_sprd_request(struct mmc_host *mmc, struct mmc_request *mrq) | 397 | static void sdhci_sprd_request(struct mmc_host *mmc, struct mmc_request *mrq) |
@@ -501,9 +508,12 @@ static void sdhci_sprd_phy_param_parse(struct sdhci_sprd_host *sprd_host, | |||
501 | } | 508 | } |
502 | 509 | ||
503 | static const struct sdhci_pltfm_data sdhci_sprd_pdata = { | 510 | static const struct sdhci_pltfm_data sdhci_sprd_pdata = { |
504 | .quirks = SDHCI_QUIRK_DATA_TIMEOUT_USES_SDCLK, | 511 | .quirks = SDHCI_QUIRK_BROKEN_CARD_DETECTION | |
512 | SDHCI_QUIRK_DATA_TIMEOUT_USES_SDCLK | | ||
513 | SDHCI_QUIRK_MISSING_CAPS, | ||
505 | .quirks2 = SDHCI_QUIRK2_BROKEN_HS200 | | 514 | .quirks2 = SDHCI_QUIRK2_BROKEN_HS200 | |
506 | SDHCI_QUIRK2_USE_32BIT_BLK_CNT, | 515 | SDHCI_QUIRK2_USE_32BIT_BLK_CNT | |
516 | SDHCI_QUIRK2_PRESET_VALUE_BROKEN, | ||
507 | .ops = &sdhci_sprd_ops, | 517 | .ops = &sdhci_sprd_ops, |
508 | }; | 518 | }; |
509 | 519 | ||
@@ -605,6 +615,16 @@ static int sdhci_sprd_probe(struct platform_device *pdev) | |||
605 | 615 | ||
606 | sdhci_enable_v4_mode(host); | 616 | sdhci_enable_v4_mode(host); |
607 | 617 | ||
618 | /* | ||
619 | * Supply the existing CAPS, but clear the UHS-I modes. This | ||
620 | * will allow these modes to be specified only by device | ||
621 | * tree properties through mmc_of_parse(). | ||
622 | */ | ||
623 | host->caps = sdhci_readl(host, SDHCI_CAPABILITIES); | ||
624 | host->caps1 = sdhci_readl(host, SDHCI_CAPABILITIES_1); | ||
625 | host->caps1 &= ~(SDHCI_SUPPORT_SDR50 | SDHCI_SUPPORT_SDR104 | | ||
626 | SDHCI_SUPPORT_DDR50); | ||
627 | |||
608 | ret = sdhci_setup_host(host); | 628 | ret = sdhci_setup_host(host); |
609 | if (ret) | 629 | if (ret) |
610 | goto pm_runtime_disable; | 630 | goto pm_runtime_disable; |
diff --git a/drivers/mmc/host/sdhci-tegra.c b/drivers/mmc/host/sdhci-tegra.c index f4d4761cf20a..02d8f524bb9e 100644 --- a/drivers/mmc/host/sdhci-tegra.c +++ b/drivers/mmc/host/sdhci-tegra.c | |||
@@ -258,6 +258,16 @@ static void tegra210_sdhci_writew(struct sdhci_host *host, u16 val, int reg) | |||
258 | } | 258 | } |
259 | } | 259 | } |
260 | 260 | ||
261 | static unsigned int tegra_sdhci_get_ro(struct sdhci_host *host) | ||
262 | { | ||
263 | /* | ||
264 | * Write-enable shall be assumed if GPIO is missing in a board's | ||
265 | * device-tree because SDHCI's WRITE_PROTECT bit doesn't work on | ||
266 | * Tegra. | ||
267 | */ | ||
268 | return mmc_gpio_get_ro(host->mmc); | ||
269 | } | ||
270 | |||
261 | static bool tegra_sdhci_is_pad_and_regulator_valid(struct sdhci_host *host) | 271 | static bool tegra_sdhci_is_pad_and_regulator_valid(struct sdhci_host *host) |
262 | { | 272 | { |
263 | struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host); | 273 | struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host); |
@@ -1224,6 +1234,7 @@ static const struct cqhci_host_ops sdhci_tegra_cqhci_ops = { | |||
1224 | }; | 1234 | }; |
1225 | 1235 | ||
1226 | static const struct sdhci_ops tegra_sdhci_ops = { | 1236 | static const struct sdhci_ops tegra_sdhci_ops = { |
1237 | .get_ro = tegra_sdhci_get_ro, | ||
1227 | .read_w = tegra_sdhci_readw, | 1238 | .read_w = tegra_sdhci_readw, |
1228 | .write_l = tegra_sdhci_writel, | 1239 | .write_l = tegra_sdhci_writel, |
1229 | .set_clock = tegra_sdhci_set_clock, | 1240 | .set_clock = tegra_sdhci_set_clock, |
@@ -1279,6 +1290,7 @@ static const struct sdhci_tegra_soc_data soc_data_tegra30 = { | |||
1279 | }; | 1290 | }; |
1280 | 1291 | ||
1281 | static const struct sdhci_ops tegra114_sdhci_ops = { | 1292 | static const struct sdhci_ops tegra114_sdhci_ops = { |
1293 | .get_ro = tegra_sdhci_get_ro, | ||
1282 | .read_w = tegra_sdhci_readw, | 1294 | .read_w = tegra_sdhci_readw, |
1283 | .write_w = tegra_sdhci_writew, | 1295 | .write_w = tegra_sdhci_writew, |
1284 | .write_l = tegra_sdhci_writel, | 1296 | .write_l = tegra_sdhci_writel, |
@@ -1332,6 +1344,7 @@ static const struct sdhci_tegra_soc_data soc_data_tegra124 = { | |||
1332 | }; | 1344 | }; |
1333 | 1345 | ||
1334 | static const struct sdhci_ops tegra210_sdhci_ops = { | 1346 | static const struct sdhci_ops tegra210_sdhci_ops = { |
1347 | .get_ro = tegra_sdhci_get_ro, | ||
1335 | .read_w = tegra_sdhci_readw, | 1348 | .read_w = tegra_sdhci_readw, |
1336 | .write_w = tegra210_sdhci_writew, | 1349 | .write_w = tegra210_sdhci_writew, |
1337 | .write_l = tegra_sdhci_writel, | 1350 | .write_l = tegra_sdhci_writel, |
@@ -1366,6 +1379,7 @@ static const struct sdhci_tegra_soc_data soc_data_tegra210 = { | |||
1366 | }; | 1379 | }; |
1367 | 1380 | ||
1368 | static const struct sdhci_ops tegra186_sdhci_ops = { | 1381 | static const struct sdhci_ops tegra186_sdhci_ops = { |
1382 | .get_ro = tegra_sdhci_get_ro, | ||
1369 | .read_w = tegra_sdhci_readw, | 1383 | .read_w = tegra_sdhci_readw, |
1370 | .write_l = tegra_sdhci_writel, | 1384 | .write_l = tegra_sdhci_writel, |
1371 | .set_clock = tegra_sdhci_set_clock, | 1385 | .set_clock = tegra_sdhci_set_clock, |
diff --git a/drivers/mtd/hyperbus/Kconfig b/drivers/mtd/hyperbus/Kconfig index b4e3caf7d799..a4d8968d133d 100644 --- a/drivers/mtd/hyperbus/Kconfig +++ b/drivers/mtd/hyperbus/Kconfig | |||
@@ -1,5 +1,6 @@ | |||
1 | menuconfig MTD_HYPERBUS | 1 | menuconfig MTD_HYPERBUS |
2 | tristate "HyperBus support" | 2 | tristate "HyperBus support" |
3 | depends on HAS_IOMEM | ||
3 | select MTD_CFI | 4 | select MTD_CFI |
4 | select MTD_MAP_BANK_WIDTH_2 | 5 | select MTD_MAP_BANK_WIDTH_2 |
5 | select MTD_CFI_AMDSTD | 6 | select MTD_CFI_AMDSTD |
diff --git a/drivers/net/dsa/microchip/ksz9477_spi.c b/drivers/net/dsa/microchip/ksz9477_spi.c index a226b389e12d..2e402e4d866f 100644 --- a/drivers/net/dsa/microchip/ksz9477_spi.c +++ b/drivers/net/dsa/microchip/ksz9477_spi.c | |||
@@ -80,6 +80,7 @@ static const struct of_device_id ksz9477_dt_ids[] = { | |||
80 | { .compatible = "microchip,ksz9897" }, | 80 | { .compatible = "microchip,ksz9897" }, |
81 | { .compatible = "microchip,ksz9893" }, | 81 | { .compatible = "microchip,ksz9893" }, |
82 | { .compatible = "microchip,ksz9563" }, | 82 | { .compatible = "microchip,ksz9563" }, |
83 | { .compatible = "microchip,ksz8563" }, | ||
83 | {}, | 84 | {}, |
84 | }; | 85 | }; |
85 | MODULE_DEVICE_TABLE(of, ksz9477_dt_ids); | 86 | MODULE_DEVICE_TABLE(of, ksz9477_dt_ids); |
diff --git a/drivers/net/dsa/microchip/ksz_common.h b/drivers/net/dsa/microchip/ksz_common.h index c44a8d23d973..13d027baaa8b 100644 --- a/drivers/net/dsa/microchip/ksz_common.h +++ b/drivers/net/dsa/microchip/ksz_common.h | |||
@@ -299,6 +299,7 @@ static inline void ksz_pwrite32(struct ksz_device *dev, int port, int offset, | |||
299 | 299 | ||
300 | #define KSZ_REGMAP_ENTRY(width, swp, regbits, regpad, regalign) \ | 300 | #define KSZ_REGMAP_ENTRY(width, swp, regbits, regpad, regalign) \ |
301 | { \ | 301 | { \ |
302 | .name = #width, \ | ||
302 | .val_bits = (width), \ | 303 | .val_bits = (width), \ |
303 | .reg_stride = (width) / 8, \ | 304 | .reg_stride = (width) / 8, \ |
304 | .reg_bits = (regbits) + (regalign), \ | 305 | .reg_bits = (regbits) + (regalign), \ |
diff --git a/drivers/net/ethernet/amd/xgbe/xgbe-main.c b/drivers/net/ethernet/amd/xgbe/xgbe-main.c index b41f23679a08..7ce9c69e9c44 100644 --- a/drivers/net/ethernet/amd/xgbe/xgbe-main.c +++ b/drivers/net/ethernet/amd/xgbe/xgbe-main.c | |||
@@ -469,13 +469,19 @@ static int __init xgbe_mod_init(void) | |||
469 | 469 | ||
470 | ret = xgbe_platform_init(); | 470 | ret = xgbe_platform_init(); |
471 | if (ret) | 471 | if (ret) |
472 | return ret; | 472 | goto err_platform_init; |
473 | 473 | ||
474 | ret = xgbe_pci_init(); | 474 | ret = xgbe_pci_init(); |
475 | if (ret) | 475 | if (ret) |
476 | return ret; | 476 | goto err_pci_init; |
477 | 477 | ||
478 | return 0; | 478 | return 0; |
479 | |||
480 | err_pci_init: | ||
481 | xgbe_platform_exit(); | ||
482 | err_platform_init: | ||
483 | unregister_netdevice_notifier(&xgbe_netdev_notifier); | ||
484 | return ret; | ||
479 | } | 485 | } |
480 | 486 | ||
481 | static void __exit xgbe_mod_exit(void) | 487 | static void __exit xgbe_mod_exit(void) |
diff --git a/drivers/net/ethernet/aquantia/atlantic/aq_filters.c b/drivers/net/ethernet/aquantia/atlantic/aq_filters.c index 440690b18734..aee827f07c16 100644 --- a/drivers/net/ethernet/aquantia/atlantic/aq_filters.c +++ b/drivers/net/ethernet/aquantia/atlantic/aq_filters.c | |||
@@ -431,7 +431,8 @@ int aq_del_fvlan_by_vlan(struct aq_nic_s *aq_nic, u16 vlan_id) | |||
431 | if (be16_to_cpu(rule->aq_fsp.h_ext.vlan_tci) == vlan_id) | 431 | if (be16_to_cpu(rule->aq_fsp.h_ext.vlan_tci) == vlan_id) |
432 | break; | 432 | break; |
433 | } | 433 | } |
434 | if (rule && be16_to_cpu(rule->aq_fsp.h_ext.vlan_tci) == vlan_id) { | 434 | if (rule && rule->type == aq_rx_filter_vlan && |
435 | be16_to_cpu(rule->aq_fsp.h_ext.vlan_tci) == vlan_id) { | ||
435 | struct ethtool_rxnfc cmd; | 436 | struct ethtool_rxnfc cmd; |
436 | 437 | ||
437 | cmd.fs.location = rule->aq_fsp.location; | 438 | cmd.fs.location = rule->aq_fsp.location; |
@@ -843,7 +844,7 @@ int aq_filters_vlans_update(struct aq_nic_s *aq_nic) | |||
843 | return err; | 844 | return err; |
844 | 845 | ||
845 | if (aq_nic->ndev->features & NETIF_F_HW_VLAN_CTAG_FILTER) { | 846 | if (aq_nic->ndev->features & NETIF_F_HW_VLAN_CTAG_FILTER) { |
846 | if (hweight < AQ_VLAN_MAX_FILTERS && hweight > 0) { | 847 | if (hweight <= AQ_VLAN_MAX_FILTERS && hweight > 0) { |
847 | err = aq_hw_ops->hw_filter_vlan_ctrl(aq_hw, | 848 | err = aq_hw_ops->hw_filter_vlan_ctrl(aq_hw, |
848 | !(aq_nic->packet_filter & IFF_PROMISC)); | 849 | !(aq_nic->packet_filter & IFF_PROMISC)); |
849 | aq_nic->aq_nic_cfg.is_vlan_force_promisc = false; | 850 | aq_nic->aq_nic_cfg.is_vlan_force_promisc = false; |
diff --git a/drivers/net/ethernet/aquantia/atlantic/aq_main.c b/drivers/net/ethernet/aquantia/atlantic/aq_main.c index 100722ad5c2d..b4a0fb281e69 100644 --- a/drivers/net/ethernet/aquantia/atlantic/aq_main.c +++ b/drivers/net/ethernet/aquantia/atlantic/aq_main.c | |||
@@ -61,6 +61,10 @@ static int aq_ndev_open(struct net_device *ndev) | |||
61 | if (err < 0) | 61 | if (err < 0) |
62 | goto err_exit; | 62 | goto err_exit; |
63 | 63 | ||
64 | err = aq_filters_vlans_update(aq_nic); | ||
65 | if (err < 0) | ||
66 | goto err_exit; | ||
67 | |||
64 | err = aq_nic_start(aq_nic); | 68 | err = aq_nic_start(aq_nic); |
65 | if (err < 0) | 69 | if (err < 0) |
66 | goto err_exit; | 70 | goto err_exit; |
diff --git a/drivers/net/ethernet/aquantia/atlantic/aq_nic.c b/drivers/net/ethernet/aquantia/atlantic/aq_nic.c index e1392766e21e..8f66e7817811 100644 --- a/drivers/net/ethernet/aquantia/atlantic/aq_nic.c +++ b/drivers/net/ethernet/aquantia/atlantic/aq_nic.c | |||
@@ -393,7 +393,7 @@ int aq_nic_start(struct aq_nic_s *self) | |||
393 | self->aq_nic_cfg.link_irq_vec); | 393 | self->aq_nic_cfg.link_irq_vec); |
394 | err = request_threaded_irq(irqvec, NULL, | 394 | err = request_threaded_irq(irqvec, NULL, |
395 | aq_linkstate_threaded_isr, | 395 | aq_linkstate_threaded_isr, |
396 | IRQF_SHARED, | 396 | IRQF_SHARED | IRQF_ONESHOT, |
397 | self->ndev->name, self); | 397 | self->ndev->name, self); |
398 | if (err < 0) | 398 | if (err < 0) |
399 | goto err_exit; | 399 | goto err_exit; |
diff --git a/drivers/net/ethernet/aquantia/atlantic/aq_vec.c b/drivers/net/ethernet/aquantia/atlantic/aq_vec.c index 715685aa48c3..28892b8acd0e 100644 --- a/drivers/net/ethernet/aquantia/atlantic/aq_vec.c +++ b/drivers/net/ethernet/aquantia/atlantic/aq_vec.c | |||
@@ -86,6 +86,7 @@ static int aq_vec_poll(struct napi_struct *napi, int budget) | |||
86 | } | 86 | } |
87 | } | 87 | } |
88 | 88 | ||
89 | err_exit: | ||
89 | if (!was_tx_cleaned) | 90 | if (!was_tx_cleaned) |
90 | work_done = budget; | 91 | work_done = budget; |
91 | 92 | ||
@@ -95,7 +96,7 @@ static int aq_vec_poll(struct napi_struct *napi, int budget) | |||
95 | 1U << self->aq_ring_param.vec_idx); | 96 | 1U << self->aq_ring_param.vec_idx); |
96 | } | 97 | } |
97 | } | 98 | } |
98 | err_exit: | 99 | |
99 | return work_done; | 100 | return work_done; |
100 | } | 101 | } |
101 | 102 | ||
diff --git a/drivers/net/ethernet/broadcom/genet/bcmgenet.c b/drivers/net/ethernet/broadcom/genet/bcmgenet.c index 1586316eb6f1..12cb77ef1081 100644 --- a/drivers/net/ethernet/broadcom/genet/bcmgenet.c +++ b/drivers/net/ethernet/broadcom/genet/bcmgenet.c | |||
@@ -1124,6 +1124,7 @@ static const struct ethtool_ops bcmgenet_ethtool_ops = { | |||
1124 | .set_coalesce = bcmgenet_set_coalesce, | 1124 | .set_coalesce = bcmgenet_set_coalesce, |
1125 | .get_link_ksettings = bcmgenet_get_link_ksettings, | 1125 | .get_link_ksettings = bcmgenet_get_link_ksettings, |
1126 | .set_link_ksettings = bcmgenet_set_link_ksettings, | 1126 | .set_link_ksettings = bcmgenet_set_link_ksettings, |
1127 | .get_ts_info = ethtool_op_get_ts_info, | ||
1127 | }; | 1128 | }; |
1128 | 1129 | ||
1129 | /* Power down the unimac, based on mode. */ | 1130 | /* Power down the unimac, based on mode. */ |
diff --git a/drivers/net/ethernet/cadence/macb_main.c b/drivers/net/ethernet/cadence/macb_main.c index 5ca17e62dc3e..35b59b5edf0f 100644 --- a/drivers/net/ethernet/cadence/macb_main.c +++ b/drivers/net/ethernet/cadence/macb_main.c | |||
@@ -4154,7 +4154,7 @@ static const struct of_device_id macb_dt_ids[] = { | |||
4154 | { .compatible = "cdns,emac", .data = &emac_config }, | 4154 | { .compatible = "cdns,emac", .data = &emac_config }, |
4155 | { .compatible = "cdns,zynqmp-gem", .data = &zynqmp_config}, | 4155 | { .compatible = "cdns,zynqmp-gem", .data = &zynqmp_config}, |
4156 | { .compatible = "cdns,zynq-gem", .data = &zynq_config }, | 4156 | { .compatible = "cdns,zynq-gem", .data = &zynq_config }, |
4157 | { .compatible = "sifive,fu540-macb", .data = &fu540_c000_config }, | 4157 | { .compatible = "sifive,fu540-c000-gem", .data = &fu540_c000_config }, |
4158 | { /* sentinel */ } | 4158 | { /* sentinel */ } |
4159 | }; | 4159 | }; |
4160 | MODULE_DEVICE_TABLE(of, macb_dt_ids); | 4160 | MODULE_DEVICE_TABLE(of, macb_dt_ids); |
diff --git a/drivers/net/ethernet/freescale/enetc/enetc_ptp.c b/drivers/net/ethernet/freescale/enetc/enetc_ptp.c index 2fd2586e42bf..bc594892507a 100644 --- a/drivers/net/ethernet/freescale/enetc/enetc_ptp.c +++ b/drivers/net/ethernet/freescale/enetc/enetc_ptp.c | |||
@@ -82,7 +82,7 @@ static int enetc_ptp_probe(struct pci_dev *pdev, | |||
82 | n = pci_alloc_irq_vectors(pdev, 1, 1, PCI_IRQ_MSIX); | 82 | n = pci_alloc_irq_vectors(pdev, 1, 1, PCI_IRQ_MSIX); |
83 | if (n != 1) { | 83 | if (n != 1) { |
84 | err = -EPERM; | 84 | err = -EPERM; |
85 | goto err_irq; | 85 | goto err_irq_vectors; |
86 | } | 86 | } |
87 | 87 | ||
88 | ptp_qoriq->irq = pci_irq_vector(pdev, 0); | 88 | ptp_qoriq->irq = pci_irq_vector(pdev, 0); |
@@ -107,6 +107,8 @@ static int enetc_ptp_probe(struct pci_dev *pdev, | |||
107 | err_no_clock: | 107 | err_no_clock: |
108 | free_irq(ptp_qoriq->irq, ptp_qoriq); | 108 | free_irq(ptp_qoriq->irq, ptp_qoriq); |
109 | err_irq: | 109 | err_irq: |
110 | pci_free_irq_vectors(pdev); | ||
111 | err_irq_vectors: | ||
110 | iounmap(base); | 112 | iounmap(base); |
111 | err_ioremap: | 113 | err_ioremap: |
112 | kfree(ptp_qoriq); | 114 | kfree(ptp_qoriq); |
@@ -125,6 +127,7 @@ static void enetc_ptp_remove(struct pci_dev *pdev) | |||
125 | 127 | ||
126 | enetc_phc_index = -1; | 128 | enetc_phc_index = -1; |
127 | ptp_qoriq_free(ptp_qoriq); | 129 | ptp_qoriq_free(ptp_qoriq); |
130 | pci_free_irq_vectors(pdev); | ||
128 | kfree(ptp_qoriq); | 131 | kfree(ptp_qoriq); |
129 | 132 | ||
130 | pci_release_mem_regions(pdev); | 133 | pci_release_mem_regions(pdev); |
diff --git a/drivers/net/ethernet/ibm/ibmvnic.c b/drivers/net/ethernet/ibm/ibmvnic.c index 07efa2b40003..4f83f97ffe8b 100644 --- a/drivers/net/ethernet/ibm/ibmvnic.c +++ b/drivers/net/ethernet/ibm/ibmvnic.c | |||
@@ -1983,6 +1983,10 @@ static void __ibmvnic_reset(struct work_struct *work) | |||
1983 | 1983 | ||
1984 | rwi = get_next_rwi(adapter); | 1984 | rwi = get_next_rwi(adapter); |
1985 | while (rwi) { | 1985 | while (rwi) { |
1986 | if (adapter->state == VNIC_REMOVING || | ||
1987 | adapter->state == VNIC_REMOVED) | ||
1988 | goto out; | ||
1989 | |||
1986 | if (adapter->force_reset_recovery) { | 1990 | if (adapter->force_reset_recovery) { |
1987 | adapter->force_reset_recovery = false; | 1991 | adapter->force_reset_recovery = false; |
1988 | rc = do_hard_reset(adapter, rwi, reset_state); | 1992 | rc = do_hard_reset(adapter, rwi, reset_state); |
@@ -2007,7 +2011,7 @@ static void __ibmvnic_reset(struct work_struct *work) | |||
2007 | netdev_dbg(adapter->netdev, "Reset failed\n"); | 2011 | netdev_dbg(adapter->netdev, "Reset failed\n"); |
2008 | free_all_rwi(adapter); | 2012 | free_all_rwi(adapter); |
2009 | } | 2013 | } |
2010 | 2014 | out: | |
2011 | adapter->resetting = false; | 2015 | adapter->resetting = false; |
2012 | if (we_lock_rtnl) | 2016 | if (we_lock_rtnl) |
2013 | rtnl_unlock(); | 2017 | rtnl_unlock(); |
diff --git a/drivers/net/ethernet/marvell/sky2.c b/drivers/net/ethernet/marvell/sky2.c index c2e00bb587cd..5f56ee83e3b1 100644 --- a/drivers/net/ethernet/marvell/sky2.c +++ b/drivers/net/ethernet/marvell/sky2.c | |||
@@ -4931,6 +4931,13 @@ static const struct dmi_system_id msi_blacklist[] = { | |||
4931 | DMI_MATCH(DMI_BOARD_NAME, "P6T"), | 4931 | DMI_MATCH(DMI_BOARD_NAME, "P6T"), |
4932 | }, | 4932 | }, |
4933 | }, | 4933 | }, |
4934 | { | ||
4935 | .ident = "ASUS P6X", | ||
4936 | .matches = { | ||
4937 | DMI_MATCH(DMI_BOARD_VENDOR, "ASUSTeK Computer INC."), | ||
4938 | DMI_MATCH(DMI_BOARD_NAME, "P6X"), | ||
4939 | }, | ||
4940 | }, | ||
4934 | {} | 4941 | {} |
4935 | }; | 4942 | }; |
4936 | 4943 | ||
diff --git a/drivers/net/ethernet/netronome/nfp/bpf/jit.c b/drivers/net/ethernet/netronome/nfp/bpf/jit.c index 4054b70d7719..5afcb3c4c2ef 100644 --- a/drivers/net/ethernet/netronome/nfp/bpf/jit.c +++ b/drivers/net/ethernet/netronome/nfp/bpf/jit.c | |||
@@ -1163,7 +1163,7 @@ mem_op_stack(struct nfp_prog *nfp_prog, struct nfp_insn_meta *meta, | |||
1163 | bool clr_gpr, lmem_step step) | 1163 | bool clr_gpr, lmem_step step) |
1164 | { | 1164 | { |
1165 | s32 off = nfp_prog->stack_frame_depth + meta->insn.off + ptr_off; | 1165 | s32 off = nfp_prog->stack_frame_depth + meta->insn.off + ptr_off; |
1166 | bool first = true, last; | 1166 | bool first = true, narrow_ld, last; |
1167 | bool needs_inc = false; | 1167 | bool needs_inc = false; |
1168 | swreg stack_off_reg; | 1168 | swreg stack_off_reg; |
1169 | u8 prev_gpr = 255; | 1169 | u8 prev_gpr = 255; |
@@ -1209,13 +1209,22 @@ mem_op_stack(struct nfp_prog *nfp_prog, struct nfp_insn_meta *meta, | |||
1209 | 1209 | ||
1210 | needs_inc = true; | 1210 | needs_inc = true; |
1211 | } | 1211 | } |
1212 | |||
1213 | narrow_ld = clr_gpr && size < 8; | ||
1214 | |||
1212 | if (lm3) { | 1215 | if (lm3) { |
1216 | unsigned int nop_cnt; | ||
1217 | |||
1213 | emit_csr_wr(nfp_prog, imm_b(nfp_prog), NFP_CSR_ACT_LM_ADDR3); | 1218 | emit_csr_wr(nfp_prog, imm_b(nfp_prog), NFP_CSR_ACT_LM_ADDR3); |
1214 | /* For size < 4 one slot will be filled by zeroing of upper. */ | 1219 | /* For size < 4 one slot will be filled by zeroing of upper, |
1215 | wrp_nops(nfp_prog, clr_gpr && size < 8 ? 2 : 3); | 1220 | * but be careful, that zeroing could be eliminated by zext |
1221 | * optimization. | ||
1222 | */ | ||
1223 | nop_cnt = narrow_ld && meta->flags & FLAG_INSN_DO_ZEXT ? 2 : 3; | ||
1224 | wrp_nops(nfp_prog, nop_cnt); | ||
1216 | } | 1225 | } |
1217 | 1226 | ||
1218 | if (clr_gpr && size < 8) | 1227 | if (narrow_ld) |
1219 | wrp_zext(nfp_prog, meta, gpr); | 1228 | wrp_zext(nfp_prog, meta, gpr); |
1220 | 1229 | ||
1221 | while (size) { | 1230 | while (size) { |
diff --git a/drivers/net/ethernet/netronome/nfp/flower/offload.c b/drivers/net/ethernet/netronome/nfp/flower/offload.c index b0708460e342..987ae221f6be 100644 --- a/drivers/net/ethernet/netronome/nfp/flower/offload.c +++ b/drivers/net/ethernet/netronome/nfp/flower/offload.c | |||
@@ -1579,9 +1579,10 @@ nfp_flower_setup_indr_tc_block(struct net_device *netdev, struct nfp_app *app, | |||
1579 | struct nfp_flower_priv *priv = app->priv; | 1579 | struct nfp_flower_priv *priv = app->priv; |
1580 | struct flow_block_cb *block_cb; | 1580 | struct flow_block_cb *block_cb; |
1581 | 1581 | ||
1582 | if (f->binder_type != FLOW_BLOCK_BINDER_TYPE_CLSACT_INGRESS && | 1582 | if ((f->binder_type != FLOW_BLOCK_BINDER_TYPE_CLSACT_INGRESS && |
1583 | !(f->binder_type == FLOW_BLOCK_BINDER_TYPE_CLSACT_EGRESS && | 1583 | !nfp_flower_internal_port_can_offload(app, netdev)) || |
1584 | nfp_flower_internal_port_can_offload(app, netdev))) | 1584 | (f->binder_type != FLOW_BLOCK_BINDER_TYPE_CLSACT_EGRESS && |
1585 | nfp_flower_internal_port_can_offload(app, netdev))) | ||
1585 | return -EOPNOTSUPP; | 1586 | return -EOPNOTSUPP; |
1586 | 1587 | ||
1587 | switch (f->command) { | 1588 | switch (f->command) { |
diff --git a/drivers/net/ethernet/netronome/nfp/flower/tunnel_conf.c b/drivers/net/ethernet/netronome/nfp/flower/tunnel_conf.c index def8c198b016..2600ce476d6b 100644 --- a/drivers/net/ethernet/netronome/nfp/flower/tunnel_conf.c +++ b/drivers/net/ethernet/netronome/nfp/flower/tunnel_conf.c | |||
@@ -348,13 +348,13 @@ nfp_tun_neigh_event_handler(struct notifier_block *nb, unsigned long event, | |||
348 | 348 | ||
349 | flow.daddr = *(__be32 *)n->primary_key; | 349 | flow.daddr = *(__be32 *)n->primary_key; |
350 | 350 | ||
351 | /* Only concerned with route changes for representors. */ | ||
352 | if (!nfp_netdev_is_nfp_repr(n->dev)) | ||
353 | return NOTIFY_DONE; | ||
354 | |||
355 | app_priv = container_of(nb, struct nfp_flower_priv, tun.neigh_nb); | 351 | app_priv = container_of(nb, struct nfp_flower_priv, tun.neigh_nb); |
356 | app = app_priv->app; | 352 | app = app_priv->app; |
357 | 353 | ||
354 | if (!nfp_netdev_is_nfp_repr(n->dev) && | ||
355 | !nfp_flower_internal_port_can_offload(app, n->dev)) | ||
356 | return NOTIFY_DONE; | ||
357 | |||
358 | /* Only concerned with changes to routes already added to NFP. */ | 358 | /* Only concerned with changes to routes already added to NFP. */ |
359 | if (!nfp_tun_has_route(app, flow.daddr)) | 359 | if (!nfp_tun_has_route(app, flow.daddr)) |
360 | return NOTIFY_DONE; | 360 | return NOTIFY_DONE; |
diff --git a/drivers/net/ethernet/seeq/sgiseeq.c b/drivers/net/ethernet/seeq/sgiseeq.c index 7a5e6c5abb57..276c7cae7cee 100644 --- a/drivers/net/ethernet/seeq/sgiseeq.c +++ b/drivers/net/ethernet/seeq/sgiseeq.c | |||
@@ -794,15 +794,16 @@ static int sgiseeq_probe(struct platform_device *pdev) | |||
794 | printk(KERN_ERR "Sgiseeq: Cannot register net device, " | 794 | printk(KERN_ERR "Sgiseeq: Cannot register net device, " |
795 | "aborting.\n"); | 795 | "aborting.\n"); |
796 | err = -ENODEV; | 796 | err = -ENODEV; |
797 | goto err_out_free_page; | 797 | goto err_out_free_attrs; |
798 | } | 798 | } |
799 | 799 | ||
800 | printk(KERN_INFO "%s: %s %pM\n", dev->name, sgiseeqstr, dev->dev_addr); | 800 | printk(KERN_INFO "%s: %s %pM\n", dev->name, sgiseeqstr, dev->dev_addr); |
801 | 801 | ||
802 | return 0; | 802 | return 0; |
803 | 803 | ||
804 | err_out_free_page: | 804 | err_out_free_attrs: |
805 | free_page((unsigned long) sp->srings); | 805 | dma_free_attrs(&pdev->dev, sizeof(*sp->srings), sp->srings, |
806 | sp->srings_dma, DMA_ATTR_NON_CONSISTENT); | ||
806 | err_out_free_dev: | 807 | err_out_free_dev: |
807 | free_netdev(dev); | 808 | free_netdev(dev); |
808 | 809 | ||
diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c index 4644b2aeeba1..e2e469c37a4d 100644 --- a/drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c | |||
@@ -1194,10 +1194,8 @@ static int phy_power_on(struct rk_priv_data *bsp_priv, bool enable) | |||
1194 | int ret; | 1194 | int ret; |
1195 | struct device *dev = &bsp_priv->pdev->dev; | 1195 | struct device *dev = &bsp_priv->pdev->dev; |
1196 | 1196 | ||
1197 | if (!ldo) { | 1197 | if (!ldo) |
1198 | dev_err(dev, "no regulator found\n"); | 1198 | return 0; |
1199 | return -1; | ||
1200 | } | ||
1201 | 1199 | ||
1202 | if (enable) { | 1200 | if (enable) { |
1203 | ret = regulator_enable(ldo); | 1201 | ret = regulator_enable(ldo); |
diff --git a/drivers/net/phy/phy-c45.c b/drivers/net/phy/phy-c45.c index 58bb25e4af10..7935593debb1 100644 --- a/drivers/net/phy/phy-c45.c +++ b/drivers/net/phy/phy-c45.c | |||
@@ -523,6 +523,32 @@ int genphy_c45_read_status(struct phy_device *phydev) | |||
523 | } | 523 | } |
524 | EXPORT_SYMBOL_GPL(genphy_c45_read_status); | 524 | EXPORT_SYMBOL_GPL(genphy_c45_read_status); |
525 | 525 | ||
526 | /** | ||
527 | * genphy_c45_config_aneg - restart auto-negotiation or forced setup | ||
528 | * @phydev: target phy_device struct | ||
529 | * | ||
530 | * Description: If auto-negotiation is enabled, we configure the | ||
531 | * advertising, and then restart auto-negotiation. If it is not | ||
532 | * enabled, then we force a configuration. | ||
533 | */ | ||
534 | int genphy_c45_config_aneg(struct phy_device *phydev) | ||
535 | { | ||
536 | bool changed = false; | ||
537 | int ret; | ||
538 | |||
539 | if (phydev->autoneg == AUTONEG_DISABLE) | ||
540 | return genphy_c45_pma_setup_forced(phydev); | ||
541 | |||
542 | ret = genphy_c45_an_config_aneg(phydev); | ||
543 | if (ret < 0) | ||
544 | return ret; | ||
545 | if (ret > 0) | ||
546 | changed = true; | ||
547 | |||
548 | return genphy_c45_check_and_restart_aneg(phydev, changed); | ||
549 | } | ||
550 | EXPORT_SYMBOL_GPL(genphy_c45_config_aneg); | ||
551 | |||
526 | /* The gen10g_* functions are the old Clause 45 stub */ | 552 | /* The gen10g_* functions are the old Clause 45 stub */ |
527 | 553 | ||
528 | int gen10g_config_aneg(struct phy_device *phydev) | 554 | int gen10g_config_aneg(struct phy_device *phydev) |
diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c index 0acd5b49f450..35d29a823af8 100644 --- a/drivers/net/phy/phy.c +++ b/drivers/net/phy/phy.c | |||
@@ -507,7 +507,7 @@ static int phy_config_aneg(struct phy_device *phydev) | |||
507 | * allowed to call genphy_config_aneg() | 507 | * allowed to call genphy_config_aneg() |
508 | */ | 508 | */ |
509 | if (phydev->is_c45 && !(phydev->c45_ids.devices_in_package & BIT(0))) | 509 | if (phydev->is_c45 && !(phydev->c45_ids.devices_in_package & BIT(0))) |
510 | return -EOPNOTSUPP; | 510 | return genphy_c45_config_aneg(phydev); |
511 | 511 | ||
512 | return genphy_config_aneg(phydev); | 512 | return genphy_config_aneg(phydev); |
513 | } | 513 | } |
diff --git a/drivers/net/usb/r8152.c b/drivers/net/usb/r8152.c index c6fa0c17c13d..778d27d1fb15 100644 --- a/drivers/net/usb/r8152.c +++ b/drivers/net/usb/r8152.c | |||
@@ -4215,8 +4215,7 @@ static int rtl8152_close(struct net_device *netdev) | |||
4215 | unregister_pm_notifier(&tp->pm_notifier); | 4215 | unregister_pm_notifier(&tp->pm_notifier); |
4216 | #endif | 4216 | #endif |
4217 | tasklet_disable(&tp->tx_tl); | 4217 | tasklet_disable(&tp->tx_tl); |
4218 | if (!test_bit(RTL8152_UNPLUG, &tp->flags)) | 4218 | napi_disable(&tp->napi); |
4219 | napi_disable(&tp->napi); | ||
4220 | clear_bit(WORK_ENABLE, &tp->flags); | 4219 | clear_bit(WORK_ENABLE, &tp->flags); |
4221 | usb_kill_urb(tp->intr_urb); | 4220 | usb_kill_urb(tp->intr_urb); |
4222 | cancel_delayed_work_sync(&tp->schedule); | 4221 | cancel_delayed_work_sync(&tp->schedule); |
@@ -5604,7 +5603,6 @@ static int rtl8152_probe(struct usb_interface *intf, | |||
5604 | return 0; | 5603 | return 0; |
5605 | 5604 | ||
5606 | out1: | 5605 | out1: |
5607 | netif_napi_del(&tp->napi); | ||
5608 | tasklet_kill(&tp->tx_tl); | 5606 | tasklet_kill(&tp->tx_tl); |
5609 | usb_set_intfdata(intf, NULL); | 5607 | usb_set_intfdata(intf, NULL); |
5610 | out: | 5608 | out: |
@@ -5620,7 +5618,6 @@ static void rtl8152_disconnect(struct usb_interface *intf) | |||
5620 | if (tp) { | 5618 | if (tp) { |
5621 | rtl_set_unplug(tp); | 5619 | rtl_set_unplug(tp); |
5622 | 5620 | ||
5623 | netif_napi_del(&tp->napi); | ||
5624 | unregister_netdev(tp->netdev); | 5621 | unregister_netdev(tp->netdev); |
5625 | tasklet_kill(&tp->tx_tl); | 5622 | tasklet_kill(&tp->tx_tl); |
5626 | cancel_delayed_work_sync(&tp->hw_phy_work); | 5623 | cancel_delayed_work_sync(&tp->hw_phy_work); |
diff --git a/drivers/net/wireless/intel/iwlwifi/cfg/22000.c b/drivers/net/wireless/intel/iwlwifi/cfg/22000.c index 1f500cddb3a7..55b713255b8e 100644 --- a/drivers/net/wireless/intel/iwlwifi/cfg/22000.c +++ b/drivers/net/wireless/intel/iwlwifi/cfg/22000.c | |||
@@ -556,6 +556,30 @@ const struct iwl_cfg killer1650i_2ax_cfg_qu_b0_hr_b0 = { | |||
556 | .max_tx_agg_size = IEEE80211_MAX_AMPDU_BUF_HT, | 556 | .max_tx_agg_size = IEEE80211_MAX_AMPDU_BUF_HT, |
557 | }; | 557 | }; |
558 | 558 | ||
559 | const struct iwl_cfg killer1650s_2ax_cfg_qu_c0_hr_b0 = { | ||
560 | .name = "Killer(R) Wi-Fi 6 AX1650i 160MHz Wireless Network Adapter (201NGW)", | ||
561 | .fw_name_pre = IWL_QU_C_HR_B_FW_PRE, | ||
562 | IWL_DEVICE_22500, | ||
563 | /* | ||
564 | * This device doesn't support receiving BlockAck with a large bitmap | ||
565 | * so we need to restrict the size of transmitted aggregation to the | ||
566 | * HT size; mac80211 would otherwise pick the HE max (256) by default. | ||
567 | */ | ||
568 | .max_tx_agg_size = IEEE80211_MAX_AMPDU_BUF_HT, | ||
569 | }; | ||
570 | |||
571 | const struct iwl_cfg killer1650i_2ax_cfg_qu_c0_hr_b0 = { | ||
572 | .name = "Killer(R) Wi-Fi 6 AX1650s 160MHz Wireless Network Adapter (201D2W)", | ||
573 | .fw_name_pre = IWL_QU_C_HR_B_FW_PRE, | ||
574 | IWL_DEVICE_22500, | ||
575 | /* | ||
576 | * This device doesn't support receiving BlockAck with a large bitmap | ||
577 | * so we need to restrict the size of transmitted aggregation to the | ||
578 | * HT size; mac80211 would otherwise pick the HE max (256) by default. | ||
579 | */ | ||
580 | .max_tx_agg_size = IEEE80211_MAX_AMPDU_BUF_HT, | ||
581 | }; | ||
582 | |||
559 | const struct iwl_cfg iwl22000_2ax_cfg_jf = { | 583 | const struct iwl_cfg iwl22000_2ax_cfg_jf = { |
560 | .name = "Intel(R) Dual Band Wireless AX 22000", | 584 | .name = "Intel(R) Dual Band Wireless AX 22000", |
561 | .fw_name_pre = IWL_QU_B_JF_B_FW_PRE, | 585 | .fw_name_pre = IWL_QU_B_JF_B_FW_PRE, |
diff --git a/drivers/net/wireless/intel/iwlwifi/iwl-config.h b/drivers/net/wireless/intel/iwlwifi/iwl-config.h index 1c1bf1b281cd..6c04f8223aff 100644 --- a/drivers/net/wireless/intel/iwlwifi/iwl-config.h +++ b/drivers/net/wireless/intel/iwlwifi/iwl-config.h | |||
@@ -577,6 +577,8 @@ extern const struct iwl_cfg iwl_ax1650i_cfg_quz_hr; | |||
577 | extern const struct iwl_cfg iwl_ax1650s_cfg_quz_hr; | 577 | extern const struct iwl_cfg iwl_ax1650s_cfg_quz_hr; |
578 | extern const struct iwl_cfg killer1650s_2ax_cfg_qu_b0_hr_b0; | 578 | extern const struct iwl_cfg killer1650s_2ax_cfg_qu_b0_hr_b0; |
579 | extern const struct iwl_cfg killer1650i_2ax_cfg_qu_b0_hr_b0; | 579 | extern const struct iwl_cfg killer1650i_2ax_cfg_qu_b0_hr_b0; |
580 | extern const struct iwl_cfg killer1650s_2ax_cfg_qu_c0_hr_b0; | ||
581 | extern const struct iwl_cfg killer1650i_2ax_cfg_qu_c0_hr_b0; | ||
580 | extern const struct iwl_cfg killer1650x_2ax_cfg; | 582 | extern const struct iwl_cfg killer1650x_2ax_cfg; |
581 | extern const struct iwl_cfg killer1650w_2ax_cfg; | 583 | extern const struct iwl_cfg killer1650w_2ax_cfg; |
582 | extern const struct iwl_cfg iwl9461_2ac_cfg_qu_b0_jf_b0; | 584 | extern const struct iwl_cfg iwl9461_2ac_cfg_qu_b0_jf_b0; |
diff --git a/drivers/net/wireless/intel/iwlwifi/pcie/drv.c b/drivers/net/wireless/intel/iwlwifi/pcie/drv.c index 7c5aaeaf7fe5..d9ed53b7c768 100644 --- a/drivers/net/wireless/intel/iwlwifi/pcie/drv.c +++ b/drivers/net/wireless/intel/iwlwifi/pcie/drv.c | |||
@@ -1062,6 +1062,10 @@ static int iwl_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
1062 | iwl_trans->cfg = &iwl9560_2ac_cfg_qu_c0_jf_b0; | 1062 | iwl_trans->cfg = &iwl9560_2ac_cfg_qu_c0_jf_b0; |
1063 | else if (iwl_trans->cfg == &iwl9560_2ac_160_cfg_qu_b0_jf_b0) | 1063 | else if (iwl_trans->cfg == &iwl9560_2ac_160_cfg_qu_b0_jf_b0) |
1064 | iwl_trans->cfg = &iwl9560_2ac_160_cfg_qu_c0_jf_b0; | 1064 | iwl_trans->cfg = &iwl9560_2ac_160_cfg_qu_c0_jf_b0; |
1065 | else if (iwl_trans->cfg == &killer1650s_2ax_cfg_qu_b0_hr_b0) | ||
1066 | iwl_trans->cfg = &killer1650s_2ax_cfg_qu_c0_hr_b0; | ||
1067 | else if (iwl_trans->cfg == &killer1650i_2ax_cfg_qu_b0_hr_b0) | ||
1068 | iwl_trans->cfg = &killer1650i_2ax_cfg_qu_c0_hr_b0; | ||
1065 | } | 1069 | } |
1066 | 1070 | ||
1067 | /* same thing for QuZ... */ | 1071 | /* same thing for QuZ... */ |
diff --git a/drivers/net/wireless/intel/iwlwifi/pcie/trans.c b/drivers/net/wireless/intel/iwlwifi/pcie/trans.c index 935e35dafce5..db62c8314603 100644 --- a/drivers/net/wireless/intel/iwlwifi/pcie/trans.c +++ b/drivers/net/wireless/intel/iwlwifi/pcie/trans.c | |||
@@ -3602,12 +3602,7 @@ struct iwl_trans *iwl_trans_pcie_alloc(struct pci_dev *pdev, | |||
3602 | } | 3602 | } |
3603 | } else if (CSR_HW_RF_ID_TYPE_CHIP_ID(trans->hw_rf_id) == | 3603 | } else if (CSR_HW_RF_ID_TYPE_CHIP_ID(trans->hw_rf_id) == |
3604 | CSR_HW_RF_ID_TYPE_CHIP_ID(CSR_HW_RF_ID_TYPE_HR) && | 3604 | CSR_HW_RF_ID_TYPE_CHIP_ID(CSR_HW_RF_ID_TYPE_HR) && |
3605 | ((trans->cfg != &iwl_ax200_cfg_cc && | 3605 | trans->hw_rev == CSR_HW_REV_TYPE_QNJ_B0) { |
3606 | trans->cfg != &iwl_ax201_cfg_qu_hr && | ||
3607 | trans->cfg != &killer1650x_2ax_cfg && | ||
3608 | trans->cfg != &killer1650w_2ax_cfg && | ||
3609 | trans->cfg != &iwl_ax201_cfg_quz_hr) || | ||
3610 | trans->hw_rev == CSR_HW_REV_TYPE_QNJ_B0)) { | ||
3611 | u32 hw_status; | 3606 | u32 hw_status; |
3612 | 3607 | ||
3613 | hw_status = iwl_read_prph(trans, UMAG_GEN_HW_STATUS); | 3608 | hw_status = iwl_read_prph(trans, UMAG_GEN_HW_STATUS); |
diff --git a/drivers/soc/ixp4xx/Kconfig b/drivers/soc/ixp4xx/Kconfig index de2e62c3310a..e3eb19b85fa4 100644 --- a/drivers/soc/ixp4xx/Kconfig +++ b/drivers/soc/ixp4xx/Kconfig | |||
@@ -1,4 +1,6 @@ | |||
1 | # SPDX-License-Identifier: GPL-2.0-only | 1 | # SPDX-License-Identifier: GPL-2.0-only |
2 | if ARCH_IXP4XX || COMPILE_TEST | ||
3 | |||
2 | menu "IXP4xx SoC drivers" | 4 | menu "IXP4xx SoC drivers" |
3 | 5 | ||
4 | config IXP4XX_QMGR | 6 | config IXP4XX_QMGR |
@@ -15,3 +17,5 @@ config IXP4XX_NPE | |||
15 | and is automatically selected by Ethernet and HSS drivers. | 17 | and is automatically selected by Ethernet and HSS drivers. |
16 | 18 | ||
17 | endmenu | 19 | endmenu |
20 | |||
21 | endif | ||
diff --git a/drivers/soc/ti/pm33xx.c b/drivers/soc/ti/pm33xx.c index bb77c220b6f8..ccc6d53fe788 100644 --- a/drivers/soc/ti/pm33xx.c +++ b/drivers/soc/ti/pm33xx.c | |||
@@ -141,7 +141,7 @@ static int __init am43xx_map_gic(void) | |||
141 | } | 141 | } |
142 | 142 | ||
143 | #ifdef CONFIG_SUSPEND | 143 | #ifdef CONFIG_SUSPEND |
144 | struct wkup_m3_wakeup_src rtc_wake_src(void) | 144 | static struct wkup_m3_wakeup_src rtc_wake_src(void) |
145 | { | 145 | { |
146 | u32 i; | 146 | u32 i; |
147 | 147 | ||
@@ -157,7 +157,7 @@ struct wkup_m3_wakeup_src rtc_wake_src(void) | |||
157 | return rtc_ext_wakeup; | 157 | return rtc_ext_wakeup; |
158 | } | 158 | } |
159 | 159 | ||
160 | int am33xx_rtc_only_idle(unsigned long wfi_flags) | 160 | static int am33xx_rtc_only_idle(unsigned long wfi_flags) |
161 | { | 161 | { |
162 | omap_rtc_power_off_program(&omap_rtc->dev); | 162 | omap_rtc_power_off_program(&omap_rtc->dev); |
163 | am33xx_do_wfi_sram(wfi_flags); | 163 | am33xx_do_wfi_sram(wfi_flags); |
@@ -252,7 +252,7 @@ static int am33xx_pm_begin(suspend_state_t state) | |||
252 | if (state == PM_SUSPEND_MEM && pm_ops->check_off_mode_enable()) { | 252 | if (state == PM_SUSPEND_MEM && pm_ops->check_off_mode_enable()) { |
253 | nvmem = devm_nvmem_device_get(&omap_rtc->dev, | 253 | nvmem = devm_nvmem_device_get(&omap_rtc->dev, |
254 | "omap_rtc_scratch0"); | 254 | "omap_rtc_scratch0"); |
255 | if (nvmem) | 255 | if (!IS_ERR(nvmem)) |
256 | nvmem_device_write(nvmem, RTC_SCRATCH_MAGIC_REG * 4, 4, | 256 | nvmem_device_write(nvmem, RTC_SCRATCH_MAGIC_REG * 4, 4, |
257 | (void *)&rtc_magic_val); | 257 | (void *)&rtc_magic_val); |
258 | rtc_only_idle = 1; | 258 | rtc_only_idle = 1; |
@@ -278,9 +278,12 @@ static void am33xx_pm_end(void) | |||
278 | struct nvmem_device *nvmem; | 278 | struct nvmem_device *nvmem; |
279 | 279 | ||
280 | nvmem = devm_nvmem_device_get(&omap_rtc->dev, "omap_rtc_scratch0"); | 280 | nvmem = devm_nvmem_device_get(&omap_rtc->dev, "omap_rtc_scratch0"); |
281 | if (IS_ERR(nvmem)) | ||
282 | return; | ||
283 | |||
281 | m3_ipc->ops->finish_low_power(m3_ipc); | 284 | m3_ipc->ops->finish_low_power(m3_ipc); |
282 | if (rtc_only_idle) { | 285 | if (rtc_only_idle) { |
283 | if (retrigger_irq) | 286 | if (retrigger_irq) { |
284 | /* | 287 | /* |
285 | * 32 bits of Interrupt Set-Pending correspond to 32 | 288 | * 32 bits of Interrupt Set-Pending correspond to 32 |
286 | * 32 interrupts. Compute the bit offset of the | 289 | * 32 interrupts. Compute the bit offset of the |
@@ -291,8 +294,10 @@ static void am33xx_pm_end(void) | |||
291 | writel_relaxed(1 << (retrigger_irq & 31), | 294 | writel_relaxed(1 << (retrigger_irq & 31), |
292 | gic_dist_base + GIC_INT_SET_PENDING_BASE | 295 | gic_dist_base + GIC_INT_SET_PENDING_BASE |
293 | + retrigger_irq / 32 * 4); | 296 | + retrigger_irq / 32 * 4); |
294 | nvmem_device_write(nvmem, RTC_SCRATCH_MAGIC_REG * 4, 4, | 297 | } |
295 | (void *)&val); | 298 | |
299 | nvmem_device_write(nvmem, RTC_SCRATCH_MAGIC_REG * 4, 4, | ||
300 | (void *)&val); | ||
296 | } | 301 | } |
297 | 302 | ||
298 | rtc_only_idle = 0; | 303 | rtc_only_idle = 0; |
@@ -415,7 +420,7 @@ static int am33xx_pm_rtc_setup(void) | |||
415 | 420 | ||
416 | nvmem = devm_nvmem_device_get(&omap_rtc->dev, | 421 | nvmem = devm_nvmem_device_get(&omap_rtc->dev, |
417 | "omap_rtc_scratch0"); | 422 | "omap_rtc_scratch0"); |
418 | if (nvmem) { | 423 | if (!IS_ERR(nvmem)) { |
419 | nvmem_device_read(nvmem, RTC_SCRATCH_MAGIC_REG * 4, | 424 | nvmem_device_read(nvmem, RTC_SCRATCH_MAGIC_REG * 4, |
420 | 4, (void *)&rtc_magic_val); | 425 | 4, (void *)&rtc_magic_val); |
421 | if ((rtc_magic_val & 0xffff) != RTC_REG_BOOT_MAGIC) | 426 | if ((rtc_magic_val & 0xffff) != RTC_REG_BOOT_MAGIC) |
diff --git a/drivers/usb/chipidea/udc.c b/drivers/usb/chipidea/udc.c index 6a5ee8e6da10..67ad40b0a05b 100644 --- a/drivers/usb/chipidea/udc.c +++ b/drivers/usb/chipidea/udc.c | |||
@@ -709,12 +709,6 @@ static int _gadget_stop_activity(struct usb_gadget *gadget) | |||
709 | struct ci_hdrc *ci = container_of(gadget, struct ci_hdrc, gadget); | 709 | struct ci_hdrc *ci = container_of(gadget, struct ci_hdrc, gadget); |
710 | unsigned long flags; | 710 | unsigned long flags; |
711 | 711 | ||
712 | spin_lock_irqsave(&ci->lock, flags); | ||
713 | ci->gadget.speed = USB_SPEED_UNKNOWN; | ||
714 | ci->remote_wakeup = 0; | ||
715 | ci->suspended = 0; | ||
716 | spin_unlock_irqrestore(&ci->lock, flags); | ||
717 | |||
718 | /* flush all endpoints */ | 712 | /* flush all endpoints */ |
719 | gadget_for_each_ep(ep, gadget) { | 713 | gadget_for_each_ep(ep, gadget) { |
720 | usb_ep_fifo_flush(ep); | 714 | usb_ep_fifo_flush(ep); |
@@ -732,6 +726,12 @@ static int _gadget_stop_activity(struct usb_gadget *gadget) | |||
732 | ci->status = NULL; | 726 | ci->status = NULL; |
733 | } | 727 | } |
734 | 728 | ||
729 | spin_lock_irqsave(&ci->lock, flags); | ||
730 | ci->gadget.speed = USB_SPEED_UNKNOWN; | ||
731 | ci->remote_wakeup = 0; | ||
732 | ci->suspended = 0; | ||
733 | spin_unlock_irqrestore(&ci->lock, flags); | ||
734 | |||
735 | return 0; | 735 | return 0; |
736 | } | 736 | } |
737 | 737 | ||
@@ -1303,6 +1303,10 @@ static int ep_disable(struct usb_ep *ep) | |||
1303 | return -EBUSY; | 1303 | return -EBUSY; |
1304 | 1304 | ||
1305 | spin_lock_irqsave(hwep->lock, flags); | 1305 | spin_lock_irqsave(hwep->lock, flags); |
1306 | if (hwep->ci->gadget.speed == USB_SPEED_UNKNOWN) { | ||
1307 | spin_unlock_irqrestore(hwep->lock, flags); | ||
1308 | return 0; | ||
1309 | } | ||
1306 | 1310 | ||
1307 | /* only internal SW should disable ctrl endpts */ | 1311 | /* only internal SW should disable ctrl endpts */ |
1308 | 1312 | ||
@@ -1392,6 +1396,10 @@ static int ep_queue(struct usb_ep *ep, struct usb_request *req, | |||
1392 | return -EINVAL; | 1396 | return -EINVAL; |
1393 | 1397 | ||
1394 | spin_lock_irqsave(hwep->lock, flags); | 1398 | spin_lock_irqsave(hwep->lock, flags); |
1399 | if (hwep->ci->gadget.speed == USB_SPEED_UNKNOWN) { | ||
1400 | spin_unlock_irqrestore(hwep->lock, flags); | ||
1401 | return 0; | ||
1402 | } | ||
1395 | retval = _ep_queue(ep, req, gfp_flags); | 1403 | retval = _ep_queue(ep, req, gfp_flags); |
1396 | spin_unlock_irqrestore(hwep->lock, flags); | 1404 | spin_unlock_irqrestore(hwep->lock, flags); |
1397 | return retval; | 1405 | return retval; |
@@ -1415,8 +1423,8 @@ static int ep_dequeue(struct usb_ep *ep, struct usb_request *req) | |||
1415 | return -EINVAL; | 1423 | return -EINVAL; |
1416 | 1424 | ||
1417 | spin_lock_irqsave(hwep->lock, flags); | 1425 | spin_lock_irqsave(hwep->lock, flags); |
1418 | 1426 | if (hwep->ci->gadget.speed != USB_SPEED_UNKNOWN) | |
1419 | hw_ep_flush(hwep->ci, hwep->num, hwep->dir); | 1427 | hw_ep_flush(hwep->ci, hwep->num, hwep->dir); |
1420 | 1428 | ||
1421 | list_for_each_entry_safe(node, tmpnode, &hwreq->tds, td) { | 1429 | list_for_each_entry_safe(node, tmpnode, &hwreq->tds, td) { |
1422 | dma_pool_free(hwep->td_pool, node->ptr, node->dma); | 1430 | dma_pool_free(hwep->td_pool, node->ptr, node->dma); |
@@ -1487,6 +1495,10 @@ static void ep_fifo_flush(struct usb_ep *ep) | |||
1487 | } | 1495 | } |
1488 | 1496 | ||
1489 | spin_lock_irqsave(hwep->lock, flags); | 1497 | spin_lock_irqsave(hwep->lock, flags); |
1498 | if (hwep->ci->gadget.speed == USB_SPEED_UNKNOWN) { | ||
1499 | spin_unlock_irqrestore(hwep->lock, flags); | ||
1500 | return; | ||
1501 | } | ||
1490 | 1502 | ||
1491 | hw_ep_flush(hwep->ci, hwep->num, hwep->dir); | 1503 | hw_ep_flush(hwep->ci, hwep->num, hwep->dir); |
1492 | 1504 | ||
@@ -1559,6 +1571,10 @@ static int ci_udc_wakeup(struct usb_gadget *_gadget) | |||
1559 | int ret = 0; | 1571 | int ret = 0; |
1560 | 1572 | ||
1561 | spin_lock_irqsave(&ci->lock, flags); | 1573 | spin_lock_irqsave(&ci->lock, flags); |
1574 | if (ci->gadget.speed == USB_SPEED_UNKNOWN) { | ||
1575 | spin_unlock_irqrestore(&ci->lock, flags); | ||
1576 | return 0; | ||
1577 | } | ||
1562 | if (!ci->remote_wakeup) { | 1578 | if (!ci->remote_wakeup) { |
1563 | ret = -EOPNOTSUPP; | 1579 | ret = -EOPNOTSUPP; |
1564 | goto out; | 1580 | goto out; |
diff --git a/drivers/usb/class/cdc-wdm.c b/drivers/usb/class/cdc-wdm.c index a7824a51f86d..70afb2ca1eab 100644 --- a/drivers/usb/class/cdc-wdm.c +++ b/drivers/usb/class/cdc-wdm.c | |||
@@ -587,10 +587,20 @@ static int wdm_flush(struct file *file, fl_owner_t id) | |||
587 | { | 587 | { |
588 | struct wdm_device *desc = file->private_data; | 588 | struct wdm_device *desc = file->private_data; |
589 | 589 | ||
590 | wait_event(desc->wait, !test_bit(WDM_IN_USE, &desc->flags)); | 590 | wait_event(desc->wait, |
591 | /* | ||
592 | * needs both flags. We cannot do with one | ||
593 | * because resetting it would cause a race | ||
594 | * with write() yet we need to signal | ||
595 | * a disconnect | ||
596 | */ | ||
597 | !test_bit(WDM_IN_USE, &desc->flags) || | ||
598 | test_bit(WDM_DISCONNECTING, &desc->flags)); | ||
591 | 599 | ||
592 | /* cannot dereference desc->intf if WDM_DISCONNECTING */ | 600 | /* cannot dereference desc->intf if WDM_DISCONNECTING */ |
593 | if (desc->werr < 0 && !test_bit(WDM_DISCONNECTING, &desc->flags)) | 601 | if (test_bit(WDM_DISCONNECTING, &desc->flags)) |
602 | return -ENODEV; | ||
603 | if (desc->werr < 0) | ||
594 | dev_err(&desc->intf->dev, "Error in flush path: %d\n", | 604 | dev_err(&desc->intf->dev, "Error in flush path: %d\n", |
595 | desc->werr); | 605 | desc->werr); |
596 | 606 | ||
@@ -974,8 +984,6 @@ static void wdm_disconnect(struct usb_interface *intf) | |||
974 | spin_lock_irqsave(&desc->iuspin, flags); | 984 | spin_lock_irqsave(&desc->iuspin, flags); |
975 | set_bit(WDM_DISCONNECTING, &desc->flags); | 985 | set_bit(WDM_DISCONNECTING, &desc->flags); |
976 | set_bit(WDM_READ, &desc->flags); | 986 | set_bit(WDM_READ, &desc->flags); |
977 | /* to terminate pending flushes */ | ||
978 | clear_bit(WDM_IN_USE, &desc->flags); | ||
979 | spin_unlock_irqrestore(&desc->iuspin, flags); | 987 | spin_unlock_irqrestore(&desc->iuspin, flags); |
980 | wake_up_all(&desc->wait); | 988 | wake_up_all(&desc->wait); |
981 | mutex_lock(&desc->rlock); | 989 | mutex_lock(&desc->rlock); |
diff --git a/drivers/usb/class/usbtmc.c b/drivers/usb/class/usbtmc.c index 4942122b2346..36858ddd8d9b 100644 --- a/drivers/usb/class/usbtmc.c +++ b/drivers/usb/class/usbtmc.c | |||
@@ -2362,8 +2362,11 @@ static int usbtmc_probe(struct usb_interface *intf, | |||
2362 | goto err_put; | 2362 | goto err_put; |
2363 | } | 2363 | } |
2364 | 2364 | ||
2365 | retcode = -EINVAL; | ||
2365 | data->bulk_in = bulk_in->bEndpointAddress; | 2366 | data->bulk_in = bulk_in->bEndpointAddress; |
2366 | data->wMaxPacketSize = usb_endpoint_maxp(bulk_in); | 2367 | data->wMaxPacketSize = usb_endpoint_maxp(bulk_in); |
2368 | if (!data->wMaxPacketSize) | ||
2369 | goto err_put; | ||
2367 | dev_dbg(&intf->dev, "Found bulk in endpoint at %u\n", data->bulk_in); | 2370 | dev_dbg(&intf->dev, "Found bulk in endpoint at %u\n", data->bulk_in); |
2368 | 2371 | ||
2369 | data->bulk_out = bulk_out->bEndpointAddress; | 2372 | data->bulk_out = bulk_out->bEndpointAddress; |
diff --git a/drivers/usb/core/hcd-pci.c b/drivers/usb/core/hcd-pci.c index 03432467b05f..7537681355f6 100644 --- a/drivers/usb/core/hcd-pci.c +++ b/drivers/usb/core/hcd-pci.c | |||
@@ -216,17 +216,18 @@ int usb_hcd_pci_probe(struct pci_dev *dev, const struct pci_device_id *id) | |||
216 | /* EHCI, OHCI */ | 216 | /* EHCI, OHCI */ |
217 | hcd->rsrc_start = pci_resource_start(dev, 0); | 217 | hcd->rsrc_start = pci_resource_start(dev, 0); |
218 | hcd->rsrc_len = pci_resource_len(dev, 0); | 218 | hcd->rsrc_len = pci_resource_len(dev, 0); |
219 | if (!request_mem_region(hcd->rsrc_start, hcd->rsrc_len, | 219 | if (!devm_request_mem_region(&dev->dev, hcd->rsrc_start, |
220 | driver->description)) { | 220 | hcd->rsrc_len, driver->description)) { |
221 | dev_dbg(&dev->dev, "controller already in use\n"); | 221 | dev_dbg(&dev->dev, "controller already in use\n"); |
222 | retval = -EBUSY; | 222 | retval = -EBUSY; |
223 | goto put_hcd; | 223 | goto put_hcd; |
224 | } | 224 | } |
225 | hcd->regs = ioremap_nocache(hcd->rsrc_start, hcd->rsrc_len); | 225 | hcd->regs = devm_ioremap_nocache(&dev->dev, hcd->rsrc_start, |
226 | hcd->rsrc_len); | ||
226 | if (hcd->regs == NULL) { | 227 | if (hcd->regs == NULL) { |
227 | dev_dbg(&dev->dev, "error mapping memory\n"); | 228 | dev_dbg(&dev->dev, "error mapping memory\n"); |
228 | retval = -EFAULT; | 229 | retval = -EFAULT; |
229 | goto release_mem_region; | 230 | goto put_hcd; |
230 | } | 231 | } |
231 | 232 | ||
232 | } else { | 233 | } else { |
@@ -240,8 +241,8 @@ int usb_hcd_pci_probe(struct pci_dev *dev, const struct pci_device_id *id) | |||
240 | 241 | ||
241 | hcd->rsrc_start = pci_resource_start(dev, region); | 242 | hcd->rsrc_start = pci_resource_start(dev, region); |
242 | hcd->rsrc_len = pci_resource_len(dev, region); | 243 | hcd->rsrc_len = pci_resource_len(dev, region); |
243 | if (request_region(hcd->rsrc_start, hcd->rsrc_len, | 244 | if (devm_request_region(&dev->dev, hcd->rsrc_start, |
244 | driver->description)) | 245 | hcd->rsrc_len, driver->description)) |
245 | break; | 246 | break; |
246 | } | 247 | } |
247 | if (region == PCI_ROM_RESOURCE) { | 248 | if (region == PCI_ROM_RESOURCE) { |
@@ -275,20 +276,13 @@ int usb_hcd_pci_probe(struct pci_dev *dev, const struct pci_device_id *id) | |||
275 | } | 276 | } |
276 | 277 | ||
277 | if (retval != 0) | 278 | if (retval != 0) |
278 | goto unmap_registers; | 279 | goto put_hcd; |
279 | device_wakeup_enable(hcd->self.controller); | 280 | device_wakeup_enable(hcd->self.controller); |
280 | 281 | ||
281 | if (pci_dev_run_wake(dev)) | 282 | if (pci_dev_run_wake(dev)) |
282 | pm_runtime_put_noidle(&dev->dev); | 283 | pm_runtime_put_noidle(&dev->dev); |
283 | return retval; | 284 | return retval; |
284 | 285 | ||
285 | unmap_registers: | ||
286 | if (driver->flags & HCD_MEMORY) { | ||
287 | iounmap(hcd->regs); | ||
288 | release_mem_region: | ||
289 | release_mem_region(hcd->rsrc_start, hcd->rsrc_len); | ||
290 | } else | ||
291 | release_region(hcd->rsrc_start, hcd->rsrc_len); | ||
292 | put_hcd: | 286 | put_hcd: |
293 | usb_put_hcd(hcd); | 287 | usb_put_hcd(hcd); |
294 | disable_pci: | 288 | disable_pci: |
@@ -347,14 +341,6 @@ void usb_hcd_pci_remove(struct pci_dev *dev) | |||
347 | dev_set_drvdata(&dev->dev, NULL); | 341 | dev_set_drvdata(&dev->dev, NULL); |
348 | up_read(&companions_rwsem); | 342 | up_read(&companions_rwsem); |
349 | } | 343 | } |
350 | |||
351 | if (hcd->driver->flags & HCD_MEMORY) { | ||
352 | iounmap(hcd->regs); | ||
353 | release_mem_region(hcd->rsrc_start, hcd->rsrc_len); | ||
354 | } else { | ||
355 | release_region(hcd->rsrc_start, hcd->rsrc_len); | ||
356 | } | ||
357 | |||
358 | usb_put_hcd(hcd); | 344 | usb_put_hcd(hcd); |
359 | pci_disable_device(dev); | 345 | pci_disable_device(dev); |
360 | } | 346 | } |
diff --git a/drivers/usb/gadget/udc/lpc32xx_udc.c b/drivers/usb/gadget/udc/lpc32xx_udc.c index 5f1b14f3e5a0..bb6af6b5ac97 100644 --- a/drivers/usb/gadget/udc/lpc32xx_udc.c +++ b/drivers/usb/gadget/udc/lpc32xx_udc.c | |||
@@ -2265,7 +2265,7 @@ static void udc_handle_ep0_setup(struct lpc32xx_udc *udc) | |||
2265 | default: | 2265 | default: |
2266 | break; | 2266 | break; |
2267 | } | 2267 | } |
2268 | 2268 | break; | |
2269 | 2269 | ||
2270 | case USB_REQ_SET_ADDRESS: | 2270 | case USB_REQ_SET_ADDRESS: |
2271 | if (reqtype == (USB_TYPE_STANDARD | USB_RECIP_DEVICE)) { | 2271 | if (reqtype == (USB_TYPE_STANDARD | USB_RECIP_DEVICE)) { |
diff --git a/drivers/usb/host/ohci-hcd.c b/drivers/usb/host/ohci-hcd.c index b457fdaff297..1fe3deec35cf 100644 --- a/drivers/usb/host/ohci-hcd.c +++ b/drivers/usb/host/ohci-hcd.c | |||
@@ -419,8 +419,7 @@ static void ohci_usb_reset (struct ohci_hcd *ohci) | |||
419 | * other cases where the next software may expect clean state from the | 419 | * other cases where the next software may expect clean state from the |
420 | * "firmware". this is bus-neutral, unlike shutdown() methods. | 420 | * "firmware". this is bus-neutral, unlike shutdown() methods. |
421 | */ | 421 | */ |
422 | static void | 422 | static void _ohci_shutdown(struct usb_hcd *hcd) |
423 | ohci_shutdown (struct usb_hcd *hcd) | ||
424 | { | 423 | { |
425 | struct ohci_hcd *ohci; | 424 | struct ohci_hcd *ohci; |
426 | 425 | ||
@@ -436,6 +435,16 @@ ohci_shutdown (struct usb_hcd *hcd) | |||
436 | ohci->rh_state = OHCI_RH_HALTED; | 435 | ohci->rh_state = OHCI_RH_HALTED; |
437 | } | 436 | } |
438 | 437 | ||
438 | static void ohci_shutdown(struct usb_hcd *hcd) | ||
439 | { | ||
440 | struct ohci_hcd *ohci = hcd_to_ohci(hcd); | ||
441 | unsigned long flags; | ||
442 | |||
443 | spin_lock_irqsave(&ohci->lock, flags); | ||
444 | _ohci_shutdown(hcd); | ||
445 | spin_unlock_irqrestore(&ohci->lock, flags); | ||
446 | } | ||
447 | |||
439 | /*-------------------------------------------------------------------------* | 448 | /*-------------------------------------------------------------------------* |
440 | * HC functions | 449 | * HC functions |
441 | *-------------------------------------------------------------------------*/ | 450 | *-------------------------------------------------------------------------*/ |
@@ -760,7 +769,7 @@ static void io_watchdog_func(struct timer_list *t) | |||
760 | died: | 769 | died: |
761 | usb_hc_died(ohci_to_hcd(ohci)); | 770 | usb_hc_died(ohci_to_hcd(ohci)); |
762 | ohci_dump(ohci); | 771 | ohci_dump(ohci); |
763 | ohci_shutdown(ohci_to_hcd(ohci)); | 772 | _ohci_shutdown(ohci_to_hcd(ohci)); |
764 | goto done; | 773 | goto done; |
765 | } else { | 774 | } else { |
766 | /* No write back because the done queue was empty */ | 775 | /* No write back because the done queue was empty */ |
diff --git a/drivers/usb/host/xhci-rcar.c b/drivers/usb/host/xhci-rcar.c index 8616c52849c6..2b0ccd150209 100644 --- a/drivers/usb/host/xhci-rcar.c +++ b/drivers/usb/host/xhci-rcar.c | |||
@@ -104,7 +104,7 @@ static int xhci_rcar_is_gen2(struct device *dev) | |||
104 | return of_device_is_compatible(node, "renesas,xhci-r8a7790") || | 104 | return of_device_is_compatible(node, "renesas,xhci-r8a7790") || |
105 | of_device_is_compatible(node, "renesas,xhci-r8a7791") || | 105 | of_device_is_compatible(node, "renesas,xhci-r8a7791") || |
106 | of_device_is_compatible(node, "renesas,xhci-r8a7793") || | 106 | of_device_is_compatible(node, "renesas,xhci-r8a7793") || |
107 | of_device_is_compatible(node, "renensas,rcar-gen2-xhci"); | 107 | of_device_is_compatible(node, "renesas,rcar-gen2-xhci"); |
108 | } | 108 | } |
109 | 109 | ||
110 | static int xhci_rcar_is_gen3(struct device *dev) | 110 | static int xhci_rcar_is_gen3(struct device *dev) |
diff --git a/drivers/usb/host/xhci-tegra.c b/drivers/usb/host/xhci-tegra.c index dafc65911fc0..2ff7c911fbd0 100644 --- a/drivers/usb/host/xhci-tegra.c +++ b/drivers/usb/host/xhci-tegra.c | |||
@@ -1194,6 +1194,16 @@ static int tegra_xusb_probe(struct platform_device *pdev) | |||
1194 | 1194 | ||
1195 | tegra_xusb_config(tegra, regs); | 1195 | tegra_xusb_config(tegra, regs); |
1196 | 1196 | ||
1197 | /* | ||
1198 | * The XUSB Falcon microcontroller can only address 40 bits, so set | ||
1199 | * the DMA mask accordingly. | ||
1200 | */ | ||
1201 | err = dma_set_mask_and_coherent(tegra->dev, DMA_BIT_MASK(40)); | ||
1202 | if (err < 0) { | ||
1203 | dev_err(&pdev->dev, "failed to set DMA mask: %d\n", err); | ||
1204 | goto put_rpm; | ||
1205 | } | ||
1206 | |||
1197 | err = tegra_xusb_load_firmware(tegra); | 1207 | err = tegra_xusb_load_firmware(tegra); |
1198 | if (err < 0) { | 1208 | if (err < 0) { |
1199 | dev_err(&pdev->dev, "failed to load firmware: %d\n", err); | 1209 | dev_err(&pdev->dev, "failed to load firmware: %d\n", err); |
diff --git a/drivers/usb/storage/realtek_cr.c b/drivers/usb/storage/realtek_cr.c index cc794e25a0b6..1d9ce9cbc831 100644 --- a/drivers/usb/storage/realtek_cr.c +++ b/drivers/usb/storage/realtek_cr.c | |||
@@ -38,7 +38,7 @@ MODULE_LICENSE("GPL"); | |||
38 | 38 | ||
39 | static int auto_delink_en = 1; | 39 | static int auto_delink_en = 1; |
40 | module_param(auto_delink_en, int, S_IRUGO | S_IWUSR); | 40 | module_param(auto_delink_en, int, S_IRUGO | S_IWUSR); |
41 | MODULE_PARM_DESC(auto_delink_en, "enable auto delink"); | 41 | MODULE_PARM_DESC(auto_delink_en, "auto delink mode (0=firmware, 1=software [default])"); |
42 | 42 | ||
43 | #ifdef CONFIG_REALTEK_AUTOPM | 43 | #ifdef CONFIG_REALTEK_AUTOPM |
44 | static int ss_en = 1; | 44 | static int ss_en = 1; |
@@ -996,12 +996,15 @@ static int init_realtek_cr(struct us_data *us) | |||
996 | goto INIT_FAIL; | 996 | goto INIT_FAIL; |
997 | } | 997 | } |
998 | 998 | ||
999 | if (CHECK_FW_VER(chip, 0x5888) || CHECK_FW_VER(chip, 0x5889) || | 999 | if (CHECK_PID(chip, 0x0138) || CHECK_PID(chip, 0x0158) || |
1000 | CHECK_FW_VER(chip, 0x5901)) | 1000 | CHECK_PID(chip, 0x0159)) { |
1001 | SET_AUTO_DELINK(chip); | 1001 | if (CHECK_FW_VER(chip, 0x5888) || CHECK_FW_VER(chip, 0x5889) || |
1002 | if (STATUS_LEN(chip) == 16) { | 1002 | CHECK_FW_VER(chip, 0x5901)) |
1003 | if (SUPPORT_AUTO_DELINK(chip)) | ||
1004 | SET_AUTO_DELINK(chip); | 1003 | SET_AUTO_DELINK(chip); |
1004 | if (STATUS_LEN(chip) == 16) { | ||
1005 | if (SUPPORT_AUTO_DELINK(chip)) | ||
1006 | SET_AUTO_DELINK(chip); | ||
1007 | } | ||
1005 | } | 1008 | } |
1006 | #ifdef CONFIG_REALTEK_AUTOPM | 1009 | #ifdef CONFIG_REALTEK_AUTOPM |
1007 | if (ss_en) | 1010 | if (ss_en) |
diff --git a/drivers/usb/storage/unusual_devs.h b/drivers/usb/storage/unusual_devs.h index ea0d27a94afe..1cd9b6305b06 100644 --- a/drivers/usb/storage/unusual_devs.h +++ b/drivers/usb/storage/unusual_devs.h | |||
@@ -2100,7 +2100,7 @@ UNUSUAL_DEV( 0x14cd, 0x6600, 0x0201, 0x0201, | |||
2100 | US_FL_IGNORE_RESIDUE ), | 2100 | US_FL_IGNORE_RESIDUE ), |
2101 | 2101 | ||
2102 | /* Reported by Michael Büsch <m@bues.ch> */ | 2102 | /* Reported by Michael Büsch <m@bues.ch> */ |
2103 | UNUSUAL_DEV( 0x152d, 0x0567, 0x0114, 0x0116, | 2103 | UNUSUAL_DEV( 0x152d, 0x0567, 0x0114, 0x0117, |
2104 | "JMicron", | 2104 | "JMicron", |
2105 | "USB to ATA/ATAPI Bridge", | 2105 | "USB to ATA/ATAPI Bridge", |
2106 | USB_SC_DEVICE, USB_PR_DEVICE, NULL, | 2106 | USB_SC_DEVICE, USB_PR_DEVICE, NULL, |
diff --git a/drivers/usb/typec/tcpm/tcpm.c b/drivers/usb/typec/tcpm/tcpm.c index 15abe1d9958f..bcfdb55fd198 100644 --- a/drivers/usb/typec/tcpm/tcpm.c +++ b/drivers/usb/typec/tcpm/tcpm.c | |||
@@ -1446,7 +1446,7 @@ static enum pdo_err tcpm_caps_err(struct tcpm_port *port, const u32 *pdo, | |||
1446 | else if ((pdo_min_voltage(pdo[i]) == | 1446 | else if ((pdo_min_voltage(pdo[i]) == |
1447 | pdo_min_voltage(pdo[i - 1])) && | 1447 | pdo_min_voltage(pdo[i - 1])) && |
1448 | (pdo_max_voltage(pdo[i]) == | 1448 | (pdo_max_voltage(pdo[i]) == |
1449 | pdo_min_voltage(pdo[i - 1]))) | 1449 | pdo_max_voltage(pdo[i - 1]))) |
1450 | return PDO_ERR_DUPE_PDO; | 1450 | return PDO_ERR_DUPE_PDO; |
1451 | break; | 1451 | break; |
1452 | /* | 1452 | /* |
diff --git a/fs/cifs/cifsfs.h b/fs/cifs/cifsfs.h index 4b21a90015a9..99caf77df4a2 100644 --- a/fs/cifs/cifsfs.h +++ b/fs/cifs/cifsfs.h | |||
@@ -152,5 +152,5 @@ extern long cifs_ioctl(struct file *filep, unsigned int cmd, unsigned long arg); | |||
152 | extern const struct export_operations cifs_export_ops; | 152 | extern const struct export_operations cifs_export_ops; |
153 | #endif /* CONFIG_CIFS_NFSD_EXPORT */ | 153 | #endif /* CONFIG_CIFS_NFSD_EXPORT */ |
154 | 154 | ||
155 | #define CIFS_VERSION "2.21" | 155 | #define CIFS_VERSION "2.22" |
156 | #endif /* _CIFSFS_H */ | 156 | #endif /* _CIFSFS_H */ |
diff --git a/fs/cifs/cifsproto.h b/fs/cifs/cifsproto.h index e23234207fc2..592a6cea2b79 100644 --- a/fs/cifs/cifsproto.h +++ b/fs/cifs/cifsproto.h | |||
@@ -579,6 +579,7 @@ extern void rqst_page_get_length(struct smb_rqst *rqst, unsigned int page, | |||
579 | unsigned int *len, unsigned int *offset); | 579 | unsigned int *len, unsigned int *offset); |
580 | 580 | ||
581 | void extract_unc_hostname(const char *unc, const char **h, size_t *len); | 581 | void extract_unc_hostname(const char *unc, const char **h, size_t *len); |
582 | int copy_path_name(char *dst, const char *src); | ||
582 | 583 | ||
583 | #ifdef CONFIG_CIFS_DFS_UPCALL | 584 | #ifdef CONFIG_CIFS_DFS_UPCALL |
584 | static inline int get_dfs_path(const unsigned int xid, struct cifs_ses *ses, | 585 | static inline int get_dfs_path(const unsigned int xid, struct cifs_ses *ses, |
diff --git a/fs/cifs/cifssmb.c b/fs/cifs/cifssmb.c index e2f95965065d..3907653e63c7 100644 --- a/fs/cifs/cifssmb.c +++ b/fs/cifs/cifssmb.c | |||
@@ -942,10 +942,8 @@ PsxDelete: | |||
942 | PATH_MAX, nls_codepage, remap); | 942 | PATH_MAX, nls_codepage, remap); |
943 | name_len++; /* trailing null */ | 943 | name_len++; /* trailing null */ |
944 | name_len *= 2; | 944 | name_len *= 2; |
945 | } else { /* BB add path length overrun check */ | 945 | } else { |
946 | name_len = strnlen(fileName, PATH_MAX); | 946 | name_len = copy_path_name(pSMB->FileName, fileName); |
947 | name_len++; /* trailing null */ | ||
948 | strncpy(pSMB->FileName, fileName, name_len); | ||
949 | } | 947 | } |
950 | 948 | ||
951 | params = 6 + name_len; | 949 | params = 6 + name_len; |
@@ -1015,10 +1013,8 @@ DelFileRetry: | |||
1015 | remap); | 1013 | remap); |
1016 | name_len++; /* trailing null */ | 1014 | name_len++; /* trailing null */ |
1017 | name_len *= 2; | 1015 | name_len *= 2; |
1018 | } else { /* BB improve check for buffer overruns BB */ | 1016 | } else { |
1019 | name_len = strnlen(name, PATH_MAX); | 1017 | name_len = copy_path_name(pSMB->fileName, name); |
1020 | name_len++; /* trailing null */ | ||
1021 | strncpy(pSMB->fileName, name, name_len); | ||
1022 | } | 1018 | } |
1023 | pSMB->SearchAttributes = | 1019 | pSMB->SearchAttributes = |
1024 | cpu_to_le16(ATTR_READONLY | ATTR_HIDDEN | ATTR_SYSTEM); | 1020 | cpu_to_le16(ATTR_READONLY | ATTR_HIDDEN | ATTR_SYSTEM); |
@@ -1062,10 +1058,8 @@ RmDirRetry: | |||
1062 | remap); | 1058 | remap); |
1063 | name_len++; /* trailing null */ | 1059 | name_len++; /* trailing null */ |
1064 | name_len *= 2; | 1060 | name_len *= 2; |
1065 | } else { /* BB improve check for buffer overruns BB */ | 1061 | } else { |
1066 | name_len = strnlen(name, PATH_MAX); | 1062 | name_len = copy_path_name(pSMB->DirName, name); |
1067 | name_len++; /* trailing null */ | ||
1068 | strncpy(pSMB->DirName, name, name_len); | ||
1069 | } | 1063 | } |
1070 | 1064 | ||
1071 | pSMB->BufferFormat = 0x04; | 1065 | pSMB->BufferFormat = 0x04; |
@@ -1107,10 +1101,8 @@ MkDirRetry: | |||
1107 | remap); | 1101 | remap); |
1108 | name_len++; /* trailing null */ | 1102 | name_len++; /* trailing null */ |
1109 | name_len *= 2; | 1103 | name_len *= 2; |
1110 | } else { /* BB improve check for buffer overruns BB */ | 1104 | } else { |
1111 | name_len = strnlen(name, PATH_MAX); | 1105 | name_len = copy_path_name(pSMB->DirName, name); |
1112 | name_len++; /* trailing null */ | ||
1113 | strncpy(pSMB->DirName, name, name_len); | ||
1114 | } | 1106 | } |
1115 | 1107 | ||
1116 | pSMB->BufferFormat = 0x04; | 1108 | pSMB->BufferFormat = 0x04; |
@@ -1157,10 +1149,8 @@ PsxCreat: | |||
1157 | PATH_MAX, nls_codepage, remap); | 1149 | PATH_MAX, nls_codepage, remap); |
1158 | name_len++; /* trailing null */ | 1150 | name_len++; /* trailing null */ |
1159 | name_len *= 2; | 1151 | name_len *= 2; |
1160 | } else { /* BB improve the check for buffer overruns BB */ | 1152 | } else { |
1161 | name_len = strnlen(name, PATH_MAX); | 1153 | name_len = copy_path_name(pSMB->FileName, name); |
1162 | name_len++; /* trailing null */ | ||
1163 | strncpy(pSMB->FileName, name, name_len); | ||
1164 | } | 1154 | } |
1165 | 1155 | ||
1166 | params = 6 + name_len; | 1156 | params = 6 + name_len; |
@@ -1324,11 +1314,9 @@ OldOpenRetry: | |||
1324 | fileName, PATH_MAX, nls_codepage, remap); | 1314 | fileName, PATH_MAX, nls_codepage, remap); |
1325 | name_len++; /* trailing null */ | 1315 | name_len++; /* trailing null */ |
1326 | name_len *= 2; | 1316 | name_len *= 2; |
1327 | } else { /* BB improve check for buffer overruns BB */ | 1317 | } else { |
1328 | count = 0; /* no pad */ | 1318 | count = 0; /* no pad */ |
1329 | name_len = strnlen(fileName, PATH_MAX); | 1319 | name_len = copy_path_name(pSMB->fileName, fileName); |
1330 | name_len++; /* trailing null */ | ||
1331 | strncpy(pSMB->fileName, fileName, name_len); | ||
1332 | } | 1320 | } |
1333 | if (*pOplock & REQ_OPLOCK) | 1321 | if (*pOplock & REQ_OPLOCK) |
1334 | pSMB->OpenFlags = cpu_to_le16(REQ_OPLOCK); | 1322 | pSMB->OpenFlags = cpu_to_le16(REQ_OPLOCK); |
@@ -1442,11 +1430,8 @@ openRetry: | |||
1442 | /* BB improve check for buffer overruns BB */ | 1430 | /* BB improve check for buffer overruns BB */ |
1443 | /* no pad */ | 1431 | /* no pad */ |
1444 | count = 0; | 1432 | count = 0; |
1445 | name_len = strnlen(path, PATH_MAX); | 1433 | name_len = copy_path_name(req->fileName, path); |
1446 | /* trailing null */ | ||
1447 | name_len++; | ||
1448 | req->NameLength = cpu_to_le16(name_len); | 1434 | req->NameLength = cpu_to_le16(name_len); |
1449 | strncpy(req->fileName, path, name_len); | ||
1450 | } | 1435 | } |
1451 | 1436 | ||
1452 | if (*oplock & REQ_OPLOCK) | 1437 | if (*oplock & REQ_OPLOCK) |
@@ -2812,15 +2797,10 @@ renameRetry: | |||
2812 | remap); | 2797 | remap); |
2813 | name_len2 += 1 /* trailing null */ + 1 /* Signature word */ ; | 2798 | name_len2 += 1 /* trailing null */ + 1 /* Signature word */ ; |
2814 | name_len2 *= 2; /* convert to bytes */ | 2799 | name_len2 *= 2; /* convert to bytes */ |
2815 | } else { /* BB improve the check for buffer overruns BB */ | 2800 | } else { |
2816 | name_len = strnlen(from_name, PATH_MAX); | 2801 | name_len = copy_path_name(pSMB->OldFileName, from_name); |
2817 | name_len++; /* trailing null */ | 2802 | name_len2 = copy_path_name(pSMB->OldFileName+name_len+1, to_name); |
2818 | strncpy(pSMB->OldFileName, from_name, name_len); | ||
2819 | name_len2 = strnlen(to_name, PATH_MAX); | ||
2820 | name_len2++; /* trailing null */ | ||
2821 | pSMB->OldFileName[name_len] = 0x04; /* 2nd buffer format */ | 2803 | pSMB->OldFileName[name_len] = 0x04; /* 2nd buffer format */ |
2822 | strncpy(&pSMB->OldFileName[name_len + 1], to_name, name_len2); | ||
2823 | name_len2++; /* trailing null */ | ||
2824 | name_len2++; /* signature byte */ | 2804 | name_len2++; /* signature byte */ |
2825 | } | 2805 | } |
2826 | 2806 | ||
@@ -2962,15 +2942,10 @@ copyRetry: | |||
2962 | toName, PATH_MAX, nls_codepage, remap); | 2942 | toName, PATH_MAX, nls_codepage, remap); |
2963 | name_len2 += 1 /* trailing null */ + 1 /* Signature word */ ; | 2943 | name_len2 += 1 /* trailing null */ + 1 /* Signature word */ ; |
2964 | name_len2 *= 2; /* convert to bytes */ | 2944 | name_len2 *= 2; /* convert to bytes */ |
2965 | } else { /* BB improve the check for buffer overruns BB */ | 2945 | } else { |
2966 | name_len = strnlen(fromName, PATH_MAX); | 2946 | name_len = copy_path_name(pSMB->OldFileName, fromName); |
2967 | name_len++; /* trailing null */ | ||
2968 | strncpy(pSMB->OldFileName, fromName, name_len); | ||
2969 | name_len2 = strnlen(toName, PATH_MAX); | ||
2970 | name_len2++; /* trailing null */ | ||
2971 | pSMB->OldFileName[name_len] = 0x04; /* 2nd buffer format */ | 2947 | pSMB->OldFileName[name_len] = 0x04; /* 2nd buffer format */ |
2972 | strncpy(&pSMB->OldFileName[name_len + 1], toName, name_len2); | 2948 | name_len2 = copy_path_name(pSMB->OldFileName+name_len+1, toName); |
2973 | name_len2++; /* trailing null */ | ||
2974 | name_len2++; /* signature byte */ | 2949 | name_len2++; /* signature byte */ |
2975 | } | 2950 | } |
2976 | 2951 | ||
@@ -3021,10 +2996,8 @@ createSymLinkRetry: | |||
3021 | name_len++; /* trailing null */ | 2996 | name_len++; /* trailing null */ |
3022 | name_len *= 2; | 2997 | name_len *= 2; |
3023 | 2998 | ||
3024 | } else { /* BB improve the check for buffer overruns BB */ | 2999 | } else { |
3025 | name_len = strnlen(fromName, PATH_MAX); | 3000 | name_len = copy_path_name(pSMB->FileName, fromName); |
3026 | name_len++; /* trailing null */ | ||
3027 | strncpy(pSMB->FileName, fromName, name_len); | ||
3028 | } | 3001 | } |
3029 | params = 6 + name_len; | 3002 | params = 6 + name_len; |
3030 | pSMB->MaxSetupCount = 0; | 3003 | pSMB->MaxSetupCount = 0; |
@@ -3044,10 +3017,8 @@ createSymLinkRetry: | |||
3044 | PATH_MAX, nls_codepage, remap); | 3017 | PATH_MAX, nls_codepage, remap); |
3045 | name_len_target++; /* trailing null */ | 3018 | name_len_target++; /* trailing null */ |
3046 | name_len_target *= 2; | 3019 | name_len_target *= 2; |
3047 | } else { /* BB improve the check for buffer overruns BB */ | 3020 | } else { |
3048 | name_len_target = strnlen(toName, PATH_MAX); | 3021 | name_len_target = copy_path_name(data_offset, toName); |
3049 | name_len_target++; /* trailing null */ | ||
3050 | strncpy(data_offset, toName, name_len_target); | ||
3051 | } | 3022 | } |
3052 | 3023 | ||
3053 | pSMB->MaxParameterCount = cpu_to_le16(2); | 3024 | pSMB->MaxParameterCount = cpu_to_le16(2); |
@@ -3109,10 +3080,8 @@ createHardLinkRetry: | |||
3109 | name_len++; /* trailing null */ | 3080 | name_len++; /* trailing null */ |
3110 | name_len *= 2; | 3081 | name_len *= 2; |
3111 | 3082 | ||
3112 | } else { /* BB improve the check for buffer overruns BB */ | 3083 | } else { |
3113 | name_len = strnlen(toName, PATH_MAX); | 3084 | name_len = copy_path_name(pSMB->FileName, toName); |
3114 | name_len++; /* trailing null */ | ||
3115 | strncpy(pSMB->FileName, toName, name_len); | ||
3116 | } | 3085 | } |
3117 | params = 6 + name_len; | 3086 | params = 6 + name_len; |
3118 | pSMB->MaxSetupCount = 0; | 3087 | pSMB->MaxSetupCount = 0; |
@@ -3131,10 +3100,8 @@ createHardLinkRetry: | |||
3131 | PATH_MAX, nls_codepage, remap); | 3100 | PATH_MAX, nls_codepage, remap); |
3132 | name_len_target++; /* trailing null */ | 3101 | name_len_target++; /* trailing null */ |
3133 | name_len_target *= 2; | 3102 | name_len_target *= 2; |
3134 | } else { /* BB improve the check for buffer overruns BB */ | 3103 | } else { |
3135 | name_len_target = strnlen(fromName, PATH_MAX); | 3104 | name_len_target = copy_path_name(data_offset, fromName); |
3136 | name_len_target++; /* trailing null */ | ||
3137 | strncpy(data_offset, fromName, name_len_target); | ||
3138 | } | 3105 | } |
3139 | 3106 | ||
3140 | pSMB->MaxParameterCount = cpu_to_le16(2); | 3107 | pSMB->MaxParameterCount = cpu_to_le16(2); |
@@ -3213,15 +3180,10 @@ winCreateHardLinkRetry: | |||
3213 | remap); | 3180 | remap); |
3214 | name_len2 += 1 /* trailing null */ + 1 /* Signature word */ ; | 3181 | name_len2 += 1 /* trailing null */ + 1 /* Signature word */ ; |
3215 | name_len2 *= 2; /* convert to bytes */ | 3182 | name_len2 *= 2; /* convert to bytes */ |
3216 | } else { /* BB improve the check for buffer overruns BB */ | 3183 | } else { |
3217 | name_len = strnlen(from_name, PATH_MAX); | 3184 | name_len = copy_path_name(pSMB->OldFileName, from_name); |
3218 | name_len++; /* trailing null */ | ||
3219 | strncpy(pSMB->OldFileName, from_name, name_len); | ||
3220 | name_len2 = strnlen(to_name, PATH_MAX); | ||
3221 | name_len2++; /* trailing null */ | ||
3222 | pSMB->OldFileName[name_len] = 0x04; /* 2nd buffer format */ | 3185 | pSMB->OldFileName[name_len] = 0x04; /* 2nd buffer format */ |
3223 | strncpy(&pSMB->OldFileName[name_len + 1], to_name, name_len2); | 3186 | name_len2 = copy_path_name(pSMB->OldFileName+name_len+1, to_name); |
3224 | name_len2++; /* trailing null */ | ||
3225 | name_len2++; /* signature byte */ | 3187 | name_len2++; /* signature byte */ |
3226 | } | 3188 | } |
3227 | 3189 | ||
@@ -3271,10 +3233,8 @@ querySymLinkRetry: | |||
3271 | remap); | 3233 | remap); |
3272 | name_len++; /* trailing null */ | 3234 | name_len++; /* trailing null */ |
3273 | name_len *= 2; | 3235 | name_len *= 2; |
3274 | } else { /* BB improve the check for buffer overruns BB */ | 3236 | } else { |
3275 | name_len = strnlen(searchName, PATH_MAX); | 3237 | name_len = copy_path_name(pSMB->FileName, searchName); |
3276 | name_len++; /* trailing null */ | ||
3277 | strncpy(pSMB->FileName, searchName, name_len); | ||
3278 | } | 3238 | } |
3279 | 3239 | ||
3280 | params = 2 /* level */ + 4 /* rsrvd */ + name_len /* incl null */ ; | 3240 | params = 2 /* level */ + 4 /* rsrvd */ + name_len /* incl null */ ; |
@@ -3691,10 +3651,8 @@ queryAclRetry: | |||
3691 | name_len *= 2; | 3651 | name_len *= 2; |
3692 | pSMB->FileName[name_len] = 0; | 3652 | pSMB->FileName[name_len] = 0; |
3693 | pSMB->FileName[name_len+1] = 0; | 3653 | pSMB->FileName[name_len+1] = 0; |
3694 | } else { /* BB improve the check for buffer overruns BB */ | 3654 | } else { |
3695 | name_len = strnlen(searchName, PATH_MAX); | 3655 | name_len = copy_path_name(pSMB->FileName, searchName); |
3696 | name_len++; /* trailing null */ | ||
3697 | strncpy(pSMB->FileName, searchName, name_len); | ||
3698 | } | 3656 | } |
3699 | 3657 | ||
3700 | params = 2 /* level */ + 4 /* rsrvd */ + name_len /* incl null */ ; | 3658 | params = 2 /* level */ + 4 /* rsrvd */ + name_len /* incl null */ ; |
@@ -3776,10 +3734,8 @@ setAclRetry: | |||
3776 | PATH_MAX, nls_codepage, remap); | 3734 | PATH_MAX, nls_codepage, remap); |
3777 | name_len++; /* trailing null */ | 3735 | name_len++; /* trailing null */ |
3778 | name_len *= 2; | 3736 | name_len *= 2; |
3779 | } else { /* BB improve the check for buffer overruns BB */ | 3737 | } else { |
3780 | name_len = strnlen(fileName, PATH_MAX); | 3738 | name_len = copy_path_name(pSMB->FileName, fileName); |
3781 | name_len++; /* trailing null */ | ||
3782 | strncpy(pSMB->FileName, fileName, name_len); | ||
3783 | } | 3739 | } |
3784 | params = 6 + name_len; | 3740 | params = 6 + name_len; |
3785 | pSMB->MaxParameterCount = cpu_to_le16(2); | 3741 | pSMB->MaxParameterCount = cpu_to_le16(2); |
@@ -4184,9 +4140,7 @@ QInfRetry: | |||
4184 | name_len++; /* trailing null */ | 4140 | name_len++; /* trailing null */ |
4185 | name_len *= 2; | 4141 | name_len *= 2; |
4186 | } else { | 4142 | } else { |
4187 | name_len = strnlen(search_name, PATH_MAX); | 4143 | name_len = copy_path_name(pSMB->FileName, search_name); |
4188 | name_len++; /* trailing null */ | ||
4189 | strncpy(pSMB->FileName, search_name, name_len); | ||
4190 | } | 4144 | } |
4191 | pSMB->BufferFormat = 0x04; | 4145 | pSMB->BufferFormat = 0x04; |
4192 | name_len++; /* account for buffer type byte */ | 4146 | name_len++; /* account for buffer type byte */ |
@@ -4321,10 +4275,8 @@ QPathInfoRetry: | |||
4321 | PATH_MAX, nls_codepage, remap); | 4275 | PATH_MAX, nls_codepage, remap); |
4322 | name_len++; /* trailing null */ | 4276 | name_len++; /* trailing null */ |
4323 | name_len *= 2; | 4277 | name_len *= 2; |
4324 | } else { /* BB improve the check for buffer overruns BB */ | 4278 | } else { |
4325 | name_len = strnlen(search_name, PATH_MAX); | 4279 | name_len = copy_path_name(pSMB->FileName, search_name); |
4326 | name_len++; /* trailing null */ | ||
4327 | strncpy(pSMB->FileName, search_name, name_len); | ||
4328 | } | 4280 | } |
4329 | 4281 | ||
4330 | params = 2 /* level */ + 4 /* reserved */ + name_len /* includes NUL */; | 4282 | params = 2 /* level */ + 4 /* reserved */ + name_len /* includes NUL */; |
@@ -4490,10 +4442,8 @@ UnixQPathInfoRetry: | |||
4490 | PATH_MAX, nls_codepage, remap); | 4442 | PATH_MAX, nls_codepage, remap); |
4491 | name_len++; /* trailing null */ | 4443 | name_len++; /* trailing null */ |
4492 | name_len *= 2; | 4444 | name_len *= 2; |
4493 | } else { /* BB improve the check for buffer overruns BB */ | 4445 | } else { |
4494 | name_len = strnlen(searchName, PATH_MAX); | 4446 | name_len = copy_path_name(pSMB->FileName, searchName); |
4495 | name_len++; /* trailing null */ | ||
4496 | strncpy(pSMB->FileName, searchName, name_len); | ||
4497 | } | 4447 | } |
4498 | 4448 | ||
4499 | params = 2 /* level */ + 4 /* reserved */ + name_len /* includes NUL */; | 4449 | params = 2 /* level */ + 4 /* reserved */ + name_len /* includes NUL */; |
@@ -4593,17 +4543,16 @@ findFirstRetry: | |||
4593 | pSMB->FileName[name_len+1] = 0; | 4543 | pSMB->FileName[name_len+1] = 0; |
4594 | name_len += 2; | 4544 | name_len += 2; |
4595 | } | 4545 | } |
4596 | } else { /* BB add check for overrun of SMB buf BB */ | 4546 | } else { |
4597 | name_len = strnlen(searchName, PATH_MAX); | 4547 | name_len = copy_path_name(pSMB->FileName, searchName); |
4598 | /* BB fix here and in unicode clause above ie | ||
4599 | if (name_len > buffersize-header) | ||
4600 | free buffer exit; BB */ | ||
4601 | strncpy(pSMB->FileName, searchName, name_len); | ||
4602 | if (msearch) { | 4548 | if (msearch) { |
4603 | pSMB->FileName[name_len] = CIFS_DIR_SEP(cifs_sb); | 4549 | if (WARN_ON_ONCE(name_len > PATH_MAX-2)) |
4604 | pSMB->FileName[name_len+1] = '*'; | 4550 | name_len = PATH_MAX-2; |
4605 | pSMB->FileName[name_len+2] = 0; | 4551 | /* overwrite nul byte */ |
4606 | name_len += 3; | 4552 | pSMB->FileName[name_len-1] = CIFS_DIR_SEP(cifs_sb); |
4553 | pSMB->FileName[name_len] = '*'; | ||
4554 | pSMB->FileName[name_len+1] = 0; | ||
4555 | name_len += 2; | ||
4607 | } | 4556 | } |
4608 | } | 4557 | } |
4609 | 4558 | ||
@@ -4898,10 +4847,8 @@ GetInodeNumberRetry: | |||
4898 | remap); | 4847 | remap); |
4899 | name_len++; /* trailing null */ | 4848 | name_len++; /* trailing null */ |
4900 | name_len *= 2; | 4849 | name_len *= 2; |
4901 | } else { /* BB improve the check for buffer overruns BB */ | 4850 | } else { |
4902 | name_len = strnlen(search_name, PATH_MAX); | 4851 | name_len = copy_path_name(pSMB->FileName, search_name); |
4903 | name_len++; /* trailing null */ | ||
4904 | strncpy(pSMB->FileName, search_name, name_len); | ||
4905 | } | 4852 | } |
4906 | 4853 | ||
4907 | params = 2 /* level */ + 4 /* rsrvd */ + name_len /* incl null */ ; | 4854 | params = 2 /* level */ + 4 /* rsrvd */ + name_len /* incl null */ ; |
@@ -5008,9 +4955,7 @@ getDFSRetry: | |||
5008 | name_len++; /* trailing null */ | 4955 | name_len++; /* trailing null */ |
5009 | name_len *= 2; | 4956 | name_len *= 2; |
5010 | } else { /* BB improve the check for buffer overruns BB */ | 4957 | } else { /* BB improve the check for buffer overruns BB */ |
5011 | name_len = strnlen(search_name, PATH_MAX); | 4958 | name_len = copy_path_name(pSMB->RequestFileName, search_name); |
5012 | name_len++; /* trailing null */ | ||
5013 | strncpy(pSMB->RequestFileName, search_name, name_len); | ||
5014 | } | 4959 | } |
5015 | 4960 | ||
5016 | if (ses->server->sign) | 4961 | if (ses->server->sign) |
@@ -5663,10 +5608,8 @@ SetEOFRetry: | |||
5663 | PATH_MAX, cifs_sb->local_nls, remap); | 5608 | PATH_MAX, cifs_sb->local_nls, remap); |
5664 | name_len++; /* trailing null */ | 5609 | name_len++; /* trailing null */ |
5665 | name_len *= 2; | 5610 | name_len *= 2; |
5666 | } else { /* BB improve the check for buffer overruns BB */ | 5611 | } else { |
5667 | name_len = strnlen(file_name, PATH_MAX); | 5612 | name_len = copy_path_name(pSMB->FileName, file_name); |
5668 | name_len++; /* trailing null */ | ||
5669 | strncpy(pSMB->FileName, file_name, name_len); | ||
5670 | } | 5613 | } |
5671 | params = 6 + name_len; | 5614 | params = 6 + name_len; |
5672 | data_count = sizeof(struct file_end_of_file_info); | 5615 | data_count = sizeof(struct file_end_of_file_info); |
@@ -5959,10 +5902,8 @@ SetTimesRetry: | |||
5959 | PATH_MAX, nls_codepage, remap); | 5902 | PATH_MAX, nls_codepage, remap); |
5960 | name_len++; /* trailing null */ | 5903 | name_len++; /* trailing null */ |
5961 | name_len *= 2; | 5904 | name_len *= 2; |
5962 | } else { /* BB improve the check for buffer overruns BB */ | 5905 | } else { |
5963 | name_len = strnlen(fileName, PATH_MAX); | 5906 | name_len = copy_path_name(pSMB->FileName, fileName); |
5964 | name_len++; /* trailing null */ | ||
5965 | strncpy(pSMB->FileName, fileName, name_len); | ||
5966 | } | 5907 | } |
5967 | 5908 | ||
5968 | params = 6 + name_len; | 5909 | params = 6 + name_len; |
@@ -6040,10 +5981,8 @@ SetAttrLgcyRetry: | |||
6040 | PATH_MAX, nls_codepage); | 5981 | PATH_MAX, nls_codepage); |
6041 | name_len++; /* trailing null */ | 5982 | name_len++; /* trailing null */ |
6042 | name_len *= 2; | 5983 | name_len *= 2; |
6043 | } else { /* BB improve the check for buffer overruns BB */ | 5984 | } else { |
6044 | name_len = strnlen(fileName, PATH_MAX); | 5985 | name_len = copy_path_name(pSMB->fileName, fileName); |
6045 | name_len++; /* trailing null */ | ||
6046 | strncpy(pSMB->fileName, fileName, name_len); | ||
6047 | } | 5986 | } |
6048 | pSMB->attr = cpu_to_le16(dos_attrs); | 5987 | pSMB->attr = cpu_to_le16(dos_attrs); |
6049 | pSMB->BufferFormat = 0x04; | 5988 | pSMB->BufferFormat = 0x04; |
@@ -6203,10 +6142,8 @@ setPermsRetry: | |||
6203 | PATH_MAX, nls_codepage, remap); | 6142 | PATH_MAX, nls_codepage, remap); |
6204 | name_len++; /* trailing null */ | 6143 | name_len++; /* trailing null */ |
6205 | name_len *= 2; | 6144 | name_len *= 2; |
6206 | } else { /* BB improve the check for buffer overruns BB */ | 6145 | } else { |
6207 | name_len = strnlen(file_name, PATH_MAX); | 6146 | name_len = copy_path_name(pSMB->FileName, file_name); |
6208 | name_len++; /* trailing null */ | ||
6209 | strncpy(pSMB->FileName, file_name, name_len); | ||
6210 | } | 6147 | } |
6211 | 6148 | ||
6212 | params = 6 + name_len; | 6149 | params = 6 + name_len; |
@@ -6298,10 +6235,8 @@ QAllEAsRetry: | |||
6298 | PATH_MAX, nls_codepage, remap); | 6235 | PATH_MAX, nls_codepage, remap); |
6299 | list_len++; /* trailing null */ | 6236 | list_len++; /* trailing null */ |
6300 | list_len *= 2; | 6237 | list_len *= 2; |
6301 | } else { /* BB improve the check for buffer overruns BB */ | 6238 | } else { |
6302 | list_len = strnlen(searchName, PATH_MAX); | 6239 | list_len = copy_path_name(pSMB->FileName, searchName); |
6303 | list_len++; /* trailing null */ | ||
6304 | strncpy(pSMB->FileName, searchName, list_len); | ||
6305 | } | 6240 | } |
6306 | 6241 | ||
6307 | params = 2 /* level */ + 4 /* reserved */ + list_len /* includes NUL */; | 6242 | params = 2 /* level */ + 4 /* reserved */ + list_len /* includes NUL */; |
@@ -6480,10 +6415,8 @@ SetEARetry: | |||
6480 | PATH_MAX, nls_codepage, remap); | 6415 | PATH_MAX, nls_codepage, remap); |
6481 | name_len++; /* trailing null */ | 6416 | name_len++; /* trailing null */ |
6482 | name_len *= 2; | 6417 | name_len *= 2; |
6483 | } else { /* BB improve the check for buffer overruns BB */ | 6418 | } else { |
6484 | name_len = strnlen(fileName, PATH_MAX); | 6419 | name_len = copy_path_name(pSMB->FileName, fileName); |
6485 | name_len++; /* trailing null */ | ||
6486 | strncpy(pSMB->FileName, fileName, name_len); | ||
6487 | } | 6420 | } |
6488 | 6421 | ||
6489 | params = 6 + name_len; | 6422 | params = 6 + name_len; |
diff --git a/fs/cifs/connect.c b/fs/cifs/connect.c index 1795e80cbdf7..5299effa6f7d 100644 --- a/fs/cifs/connect.c +++ b/fs/cifs/connect.c | |||
@@ -2981,6 +2981,7 @@ static int | |||
2981 | cifs_set_cifscreds(struct smb_vol *vol, struct cifs_ses *ses) | 2981 | cifs_set_cifscreds(struct smb_vol *vol, struct cifs_ses *ses) |
2982 | { | 2982 | { |
2983 | int rc = 0; | 2983 | int rc = 0; |
2984 | int is_domain = 0; | ||
2984 | const char *delim, *payload; | 2985 | const char *delim, *payload; |
2985 | char *desc; | 2986 | char *desc; |
2986 | ssize_t len; | 2987 | ssize_t len; |
@@ -3028,6 +3029,7 @@ cifs_set_cifscreds(struct smb_vol *vol, struct cifs_ses *ses) | |||
3028 | rc = PTR_ERR(key); | 3029 | rc = PTR_ERR(key); |
3029 | goto out_err; | 3030 | goto out_err; |
3030 | } | 3031 | } |
3032 | is_domain = 1; | ||
3031 | } | 3033 | } |
3032 | 3034 | ||
3033 | down_read(&key->sem); | 3035 | down_read(&key->sem); |
@@ -3085,6 +3087,26 @@ cifs_set_cifscreds(struct smb_vol *vol, struct cifs_ses *ses) | |||
3085 | goto out_key_put; | 3087 | goto out_key_put; |
3086 | } | 3088 | } |
3087 | 3089 | ||
3090 | /* | ||
3091 | * If we have a domain key then we must set the domainName in the | ||
3092 | * for the request. | ||
3093 | */ | ||
3094 | if (is_domain && ses->domainName) { | ||
3095 | vol->domainname = kstrndup(ses->domainName, | ||
3096 | strlen(ses->domainName), | ||
3097 | GFP_KERNEL); | ||
3098 | if (!vol->domainname) { | ||
3099 | cifs_dbg(FYI, "Unable to allocate %zd bytes for " | ||
3100 | "domain\n", len); | ||
3101 | rc = -ENOMEM; | ||
3102 | kfree(vol->username); | ||
3103 | vol->username = NULL; | ||
3104 | kzfree(vol->password); | ||
3105 | vol->password = NULL; | ||
3106 | goto out_key_put; | ||
3107 | } | ||
3108 | } | ||
3109 | |||
3088 | out_key_put: | 3110 | out_key_put: |
3089 | up_read(&key->sem); | 3111 | up_read(&key->sem); |
3090 | key_put(key); | 3112 | key_put(key); |
@@ -4209,16 +4231,19 @@ build_unc_path_to_root(const struct smb_vol *vol, | |||
4209 | strlen(vol->prepath) + 1 : 0; | 4231 | strlen(vol->prepath) + 1 : 0; |
4210 | unsigned int unc_len = strnlen(vol->UNC, MAX_TREE_SIZE + 1); | 4232 | unsigned int unc_len = strnlen(vol->UNC, MAX_TREE_SIZE + 1); |
4211 | 4233 | ||
4234 | if (unc_len > MAX_TREE_SIZE) | ||
4235 | return ERR_PTR(-EINVAL); | ||
4236 | |||
4212 | full_path = kmalloc(unc_len + pplen + 1, GFP_KERNEL); | 4237 | full_path = kmalloc(unc_len + pplen + 1, GFP_KERNEL); |
4213 | if (full_path == NULL) | 4238 | if (full_path == NULL) |
4214 | return ERR_PTR(-ENOMEM); | 4239 | return ERR_PTR(-ENOMEM); |
4215 | 4240 | ||
4216 | strncpy(full_path, vol->UNC, unc_len); | 4241 | memcpy(full_path, vol->UNC, unc_len); |
4217 | pos = full_path + unc_len; | 4242 | pos = full_path + unc_len; |
4218 | 4243 | ||
4219 | if (pplen) { | 4244 | if (pplen) { |
4220 | *pos = CIFS_DIR_SEP(cifs_sb); | 4245 | *pos = CIFS_DIR_SEP(cifs_sb); |
4221 | strncpy(pos + 1, vol->prepath, pplen); | 4246 | memcpy(pos + 1, vol->prepath, pplen); |
4222 | pos += pplen; | 4247 | pos += pplen; |
4223 | } | 4248 | } |
4224 | 4249 | ||
diff --git a/fs/cifs/dir.c b/fs/cifs/dir.c index f26a48dd2e39..be424e81e3ad 100644 --- a/fs/cifs/dir.c +++ b/fs/cifs/dir.c | |||
@@ -69,11 +69,10 @@ cifs_build_path_to_root(struct smb_vol *vol, struct cifs_sb_info *cifs_sb, | |||
69 | return full_path; | 69 | return full_path; |
70 | 70 | ||
71 | if (dfsplen) | 71 | if (dfsplen) |
72 | strncpy(full_path, tcon->treeName, dfsplen); | 72 | memcpy(full_path, tcon->treeName, dfsplen); |
73 | full_path[dfsplen] = CIFS_DIR_SEP(cifs_sb); | 73 | full_path[dfsplen] = CIFS_DIR_SEP(cifs_sb); |
74 | strncpy(full_path + dfsplen + 1, vol->prepath, pplen); | 74 | memcpy(full_path + dfsplen + 1, vol->prepath, pplen); |
75 | convert_delimiter(full_path, CIFS_DIR_SEP(cifs_sb)); | 75 | convert_delimiter(full_path, CIFS_DIR_SEP(cifs_sb)); |
76 | full_path[dfsplen + pplen] = 0; /* add trailing null */ | ||
77 | return full_path; | 76 | return full_path; |
78 | } | 77 | } |
79 | 78 | ||
diff --git a/fs/cifs/misc.c b/fs/cifs/misc.c index f383877a6511..5ad83bdb9bea 100644 --- a/fs/cifs/misc.c +++ b/fs/cifs/misc.c | |||
@@ -1011,3 +1011,25 @@ void extract_unc_hostname(const char *unc, const char **h, size_t *len) | |||
1011 | *h = unc; | 1011 | *h = unc; |
1012 | *len = end - unc; | 1012 | *len = end - unc; |
1013 | } | 1013 | } |
1014 | |||
1015 | /** | ||
1016 | * copy_path_name - copy src path to dst, possibly truncating | ||
1017 | * | ||
1018 | * returns number of bytes written (including trailing nul) | ||
1019 | */ | ||
1020 | int copy_path_name(char *dst, const char *src) | ||
1021 | { | ||
1022 | int name_len; | ||
1023 | |||
1024 | /* | ||
1025 | * PATH_MAX includes nul, so if strlen(src) >= PATH_MAX it | ||
1026 | * will truncate and strlen(dst) will be PATH_MAX-1 | ||
1027 | */ | ||
1028 | name_len = strscpy(dst, src, PATH_MAX); | ||
1029 | if (WARN_ON_ONCE(name_len < 0)) | ||
1030 | name_len = PATH_MAX-1; | ||
1031 | |||
1032 | /* we count the trailing nul */ | ||
1033 | name_len++; | ||
1034 | return name_len; | ||
1035 | } | ||
diff --git a/fs/cifs/sess.c b/fs/cifs/sess.c index dcd49ad60c83..4c764ff7edd2 100644 --- a/fs/cifs/sess.c +++ b/fs/cifs/sess.c | |||
@@ -159,13 +159,16 @@ static void ascii_ssetup_strings(char **pbcc_area, struct cifs_ses *ses, | |||
159 | const struct nls_table *nls_cp) | 159 | const struct nls_table *nls_cp) |
160 | { | 160 | { |
161 | char *bcc_ptr = *pbcc_area; | 161 | char *bcc_ptr = *pbcc_area; |
162 | int len; | ||
162 | 163 | ||
163 | /* copy user */ | 164 | /* copy user */ |
164 | /* BB what about null user mounts - check that we do this BB */ | 165 | /* BB what about null user mounts - check that we do this BB */ |
165 | /* copy user */ | 166 | /* copy user */ |
166 | if (ses->user_name != NULL) { | 167 | if (ses->user_name != NULL) { |
167 | strncpy(bcc_ptr, ses->user_name, CIFS_MAX_USERNAME_LEN); | 168 | len = strscpy(bcc_ptr, ses->user_name, CIFS_MAX_USERNAME_LEN); |
168 | bcc_ptr += strnlen(ses->user_name, CIFS_MAX_USERNAME_LEN); | 169 | if (WARN_ON_ONCE(len < 0)) |
170 | len = CIFS_MAX_USERNAME_LEN - 1; | ||
171 | bcc_ptr += len; | ||
169 | } | 172 | } |
170 | /* else null user mount */ | 173 | /* else null user mount */ |
171 | *bcc_ptr = 0; | 174 | *bcc_ptr = 0; |
@@ -173,8 +176,10 @@ static void ascii_ssetup_strings(char **pbcc_area, struct cifs_ses *ses, | |||
173 | 176 | ||
174 | /* copy domain */ | 177 | /* copy domain */ |
175 | if (ses->domainName != NULL) { | 178 | if (ses->domainName != NULL) { |
176 | strncpy(bcc_ptr, ses->domainName, CIFS_MAX_DOMAINNAME_LEN); | 179 | len = strscpy(bcc_ptr, ses->domainName, CIFS_MAX_DOMAINNAME_LEN); |
177 | bcc_ptr += strnlen(ses->domainName, CIFS_MAX_DOMAINNAME_LEN); | 180 | if (WARN_ON_ONCE(len < 0)) |
181 | len = CIFS_MAX_DOMAINNAME_LEN - 1; | ||
182 | bcc_ptr += len; | ||
178 | } /* else we will send a null domain name | 183 | } /* else we will send a null domain name |
179 | so the server will default to its own domain */ | 184 | so the server will default to its own domain */ |
180 | *bcc_ptr = 0; | 185 | *bcc_ptr = 0; |
@@ -242,9 +247,10 @@ static void decode_ascii_ssetup(char **pbcc_area, __u16 bleft, | |||
242 | 247 | ||
243 | kfree(ses->serverOS); | 248 | kfree(ses->serverOS); |
244 | 249 | ||
245 | ses->serverOS = kzalloc(len + 1, GFP_KERNEL); | 250 | ses->serverOS = kmalloc(len + 1, GFP_KERNEL); |
246 | if (ses->serverOS) { | 251 | if (ses->serverOS) { |
247 | strncpy(ses->serverOS, bcc_ptr, len); | 252 | memcpy(ses->serverOS, bcc_ptr, len); |
253 | ses->serverOS[len] = 0; | ||
248 | if (strncmp(ses->serverOS, "OS/2", 4) == 0) | 254 | if (strncmp(ses->serverOS, "OS/2", 4) == 0) |
249 | cifs_dbg(FYI, "OS/2 server\n"); | 255 | cifs_dbg(FYI, "OS/2 server\n"); |
250 | } | 256 | } |
@@ -258,9 +264,11 @@ static void decode_ascii_ssetup(char **pbcc_area, __u16 bleft, | |||
258 | 264 | ||
259 | kfree(ses->serverNOS); | 265 | kfree(ses->serverNOS); |
260 | 266 | ||
261 | ses->serverNOS = kzalloc(len + 1, GFP_KERNEL); | 267 | ses->serverNOS = kmalloc(len + 1, GFP_KERNEL); |
262 | if (ses->serverNOS) | 268 | if (ses->serverNOS) { |
263 | strncpy(ses->serverNOS, bcc_ptr, len); | 269 | memcpy(ses->serverNOS, bcc_ptr, len); |
270 | ses->serverNOS[len] = 0; | ||
271 | } | ||
264 | 272 | ||
265 | bcc_ptr += len + 1; | 273 | bcc_ptr += len + 1; |
266 | bleft -= len + 1; | 274 | bleft -= len + 1; |
diff --git a/include/linux/logic_pio.h b/include/linux/logic_pio.h index cbd9d8495690..88e1e6304a71 100644 --- a/include/linux/logic_pio.h +++ b/include/linux/logic_pio.h | |||
@@ -117,6 +117,7 @@ struct logic_pio_hwaddr *find_io_range_by_fwnode(struct fwnode_handle *fwnode); | |||
117 | unsigned long logic_pio_trans_hwaddr(struct fwnode_handle *fwnode, | 117 | unsigned long logic_pio_trans_hwaddr(struct fwnode_handle *fwnode, |
118 | resource_size_t hw_addr, resource_size_t size); | 118 | resource_size_t hw_addr, resource_size_t size); |
119 | int logic_pio_register_range(struct logic_pio_hwaddr *newrange); | 119 | int logic_pio_register_range(struct logic_pio_hwaddr *newrange); |
120 | void logic_pio_unregister_range(struct logic_pio_hwaddr *range); | ||
120 | resource_size_t logic_pio_to_hwaddr(unsigned long pio); | 121 | resource_size_t logic_pio_to_hwaddr(unsigned long pio); |
121 | unsigned long logic_pio_trans_cpuaddr(resource_size_t hw_addr); | 122 | unsigned long logic_pio_trans_cpuaddr(resource_size_t hw_addr); |
122 | 123 | ||
diff --git a/include/linux/mmzone.h b/include/linux/mmzone.h index d77d717c620c..3f38c30d2f13 100644 --- a/include/linux/mmzone.h +++ b/include/linux/mmzone.h | |||
@@ -215,8 +215,9 @@ enum node_stat_item { | |||
215 | NR_INACTIVE_FILE, /* " " " " " */ | 215 | NR_INACTIVE_FILE, /* " " " " " */ |
216 | NR_ACTIVE_FILE, /* " " " " " */ | 216 | NR_ACTIVE_FILE, /* " " " " " */ |
217 | NR_UNEVICTABLE, /* " " " " " */ | 217 | NR_UNEVICTABLE, /* " " " " " */ |
218 | NR_SLAB_RECLAIMABLE, | 218 | NR_SLAB_RECLAIMABLE, /* Please do not reorder this item */ |
219 | NR_SLAB_UNRECLAIMABLE, | 219 | NR_SLAB_UNRECLAIMABLE, /* and this one without looking at |
220 | * memcg_flush_percpu_vmstats() first. */ | ||
220 | NR_ISOLATED_ANON, /* Temporary isolated pages from anon lru */ | 221 | NR_ISOLATED_ANON, /* Temporary isolated pages from anon lru */ |
221 | NR_ISOLATED_FILE, /* Temporary isolated pages from file lru */ | 222 | NR_ISOLATED_FILE, /* Temporary isolated pages from file lru */ |
222 | WORKINGSET_NODES, | 223 | WORKINGSET_NODES, |
diff --git a/include/linux/phy.h b/include/linux/phy.h index d26779f1fb6b..a7ecbe0e55aa 100644 --- a/include/linux/phy.h +++ b/include/linux/phy.h | |||
@@ -1117,6 +1117,7 @@ int genphy_c45_an_disable_aneg(struct phy_device *phydev); | |||
1117 | int genphy_c45_read_mdix(struct phy_device *phydev); | 1117 | int genphy_c45_read_mdix(struct phy_device *phydev); |
1118 | int genphy_c45_pma_read_abilities(struct phy_device *phydev); | 1118 | int genphy_c45_pma_read_abilities(struct phy_device *phydev); |
1119 | int genphy_c45_read_status(struct phy_device *phydev); | 1119 | int genphy_c45_read_status(struct phy_device *phydev); |
1120 | int genphy_c45_config_aneg(struct phy_device *phydev); | ||
1120 | 1121 | ||
1121 | /* The gen10g_* functions are the old Clause 45 stub */ | 1122 | /* The gen10g_* functions are the old Clause 45 stub */ |
1122 | int gen10g_config_aneg(struct phy_device *phydev); | 1123 | int gen10g_config_aneg(struct phy_device *phydev); |
diff --git a/include/linux/trace_events.h b/include/linux/trace_events.h index 5150436783e8..30a8cdcfd4a4 100644 --- a/include/linux/trace_events.h +++ b/include/linux/trace_events.h | |||
@@ -548,6 +548,7 @@ extern int trace_event_get_offsets(struct trace_event_call *call); | |||
548 | 548 | ||
549 | #define is_signed_type(type) (((type)(-1)) < (type)1) | 549 | #define is_signed_type(type) (((type)(-1)) < (type)1) |
550 | 550 | ||
551 | int ftrace_set_clr_event(struct trace_array *tr, char *buf, int set); | ||
551 | int trace_set_clr_event(const char *system, const char *event, int set); | 552 | int trace_set_clr_event(const char *system, const char *event, int set); |
552 | 553 | ||
553 | /* | 554 | /* |
diff --git a/include/math-emu/op-common.h b/include/math-emu/op-common.h index f37d12877754..adcc6a97db61 100644 --- a/include/math-emu/op-common.h +++ b/include/math-emu/op-common.h | |||
@@ -308,6 +308,7 @@ do { \ | |||
308 | \ | 308 | \ |
309 | case _FP_CLS_COMBINE(FP_CLS_NORMAL,FP_CLS_ZERO): \ | 309 | case _FP_CLS_COMBINE(FP_CLS_NORMAL,FP_CLS_ZERO): \ |
310 | R##_e = X##_e; \ | 310 | R##_e = X##_e; \ |
311 | /* Fall through */ \ | ||
311 | case _FP_CLS_COMBINE(FP_CLS_NAN,FP_CLS_NORMAL): \ | 312 | case _FP_CLS_COMBINE(FP_CLS_NAN,FP_CLS_NORMAL): \ |
312 | case _FP_CLS_COMBINE(FP_CLS_NAN,FP_CLS_INF): \ | 313 | case _FP_CLS_COMBINE(FP_CLS_NAN,FP_CLS_INF): \ |
313 | case _FP_CLS_COMBINE(FP_CLS_NAN,FP_CLS_ZERO): \ | 314 | case _FP_CLS_COMBINE(FP_CLS_NAN,FP_CLS_ZERO): \ |
@@ -318,6 +319,7 @@ do { \ | |||
318 | \ | 319 | \ |
319 | case _FP_CLS_COMBINE(FP_CLS_ZERO,FP_CLS_NORMAL): \ | 320 | case _FP_CLS_COMBINE(FP_CLS_ZERO,FP_CLS_NORMAL): \ |
320 | R##_e = Y##_e; \ | 321 | R##_e = Y##_e; \ |
322 | /* Fall through */ \ | ||
321 | case _FP_CLS_COMBINE(FP_CLS_NORMAL,FP_CLS_NAN): \ | 323 | case _FP_CLS_COMBINE(FP_CLS_NORMAL,FP_CLS_NAN): \ |
322 | case _FP_CLS_COMBINE(FP_CLS_INF,FP_CLS_NAN): \ | 324 | case _FP_CLS_COMBINE(FP_CLS_INF,FP_CLS_NAN): \ |
323 | case _FP_CLS_COMBINE(FP_CLS_ZERO,FP_CLS_NAN): \ | 325 | case _FP_CLS_COMBINE(FP_CLS_ZERO,FP_CLS_NAN): \ |
@@ -415,6 +417,7 @@ do { \ | |||
415 | case _FP_CLS_COMBINE(FP_CLS_NAN,FP_CLS_INF): \ | 417 | case _FP_CLS_COMBINE(FP_CLS_NAN,FP_CLS_INF): \ |
416 | case _FP_CLS_COMBINE(FP_CLS_NAN,FP_CLS_ZERO): \ | 418 | case _FP_CLS_COMBINE(FP_CLS_NAN,FP_CLS_ZERO): \ |
417 | R##_s = X##_s; \ | 419 | R##_s = X##_s; \ |
420 | /* Fall through */ \ | ||
418 | \ | 421 | \ |
419 | case _FP_CLS_COMBINE(FP_CLS_INF,FP_CLS_INF): \ | 422 | case _FP_CLS_COMBINE(FP_CLS_INF,FP_CLS_INF): \ |
420 | case _FP_CLS_COMBINE(FP_CLS_INF,FP_CLS_NORMAL): \ | 423 | case _FP_CLS_COMBINE(FP_CLS_INF,FP_CLS_NORMAL): \ |
@@ -428,6 +431,7 @@ do { \ | |||
428 | case _FP_CLS_COMBINE(FP_CLS_INF,FP_CLS_NAN): \ | 431 | case _FP_CLS_COMBINE(FP_CLS_INF,FP_CLS_NAN): \ |
429 | case _FP_CLS_COMBINE(FP_CLS_ZERO,FP_CLS_NAN): \ | 432 | case _FP_CLS_COMBINE(FP_CLS_ZERO,FP_CLS_NAN): \ |
430 | R##_s = Y##_s; \ | 433 | R##_s = Y##_s; \ |
434 | /* Fall through */ \ | ||
431 | \ | 435 | \ |
432 | case _FP_CLS_COMBINE(FP_CLS_NORMAL,FP_CLS_INF): \ | 436 | case _FP_CLS_COMBINE(FP_CLS_NORMAL,FP_CLS_INF): \ |
433 | case _FP_CLS_COMBINE(FP_CLS_NORMAL,FP_CLS_ZERO): \ | 437 | case _FP_CLS_COMBINE(FP_CLS_NORMAL,FP_CLS_ZERO): \ |
@@ -493,6 +497,7 @@ do { \ | |||
493 | \ | 497 | \ |
494 | case _FP_CLS_COMBINE(FP_CLS_NORMAL,FP_CLS_ZERO): \ | 498 | case _FP_CLS_COMBINE(FP_CLS_NORMAL,FP_CLS_ZERO): \ |
495 | FP_SET_EXCEPTION(FP_EX_DIVZERO); \ | 499 | FP_SET_EXCEPTION(FP_EX_DIVZERO); \ |
500 | /* Fall through */ \ | ||
496 | case _FP_CLS_COMBINE(FP_CLS_INF,FP_CLS_ZERO): \ | 501 | case _FP_CLS_COMBINE(FP_CLS_INF,FP_CLS_ZERO): \ |
497 | case _FP_CLS_COMBINE(FP_CLS_INF,FP_CLS_NORMAL): \ | 502 | case _FP_CLS_COMBINE(FP_CLS_INF,FP_CLS_NORMAL): \ |
498 | R##_c = FP_CLS_INF; \ | 503 | R##_c = FP_CLS_INF; \ |
diff --git a/include/net/act_api.h b/include/net/act_api.h index c61a1bf4e3de..3a1a72990fce 100644 --- a/include/net/act_api.h +++ b/include/net/act_api.h | |||
@@ -15,6 +15,7 @@ | |||
15 | struct tcf_idrinfo { | 15 | struct tcf_idrinfo { |
16 | struct mutex lock; | 16 | struct mutex lock; |
17 | struct idr action_idr; | 17 | struct idr action_idr; |
18 | struct net *net; | ||
18 | }; | 19 | }; |
19 | 20 | ||
20 | struct tc_action_ops; | 21 | struct tc_action_ops; |
@@ -108,7 +109,7 @@ struct tc_action_net { | |||
108 | }; | 109 | }; |
109 | 110 | ||
110 | static inline | 111 | static inline |
111 | int tc_action_net_init(struct tc_action_net *tn, | 112 | int tc_action_net_init(struct net *net, struct tc_action_net *tn, |
112 | const struct tc_action_ops *ops) | 113 | const struct tc_action_ops *ops) |
113 | { | 114 | { |
114 | int err = 0; | 115 | int err = 0; |
@@ -117,6 +118,7 @@ int tc_action_net_init(struct tc_action_net *tn, | |||
117 | if (!tn->idrinfo) | 118 | if (!tn->idrinfo) |
118 | return -ENOMEM; | 119 | return -ENOMEM; |
119 | tn->ops = ops; | 120 | tn->ops = ops; |
121 | tn->idrinfo->net = net; | ||
120 | mutex_init(&tn->idrinfo->lock); | 122 | mutex_init(&tn->idrinfo->lock); |
121 | idr_init(&tn->idrinfo->action_idr); | 123 | idr_init(&tn->idrinfo->action_idr); |
122 | return err; | 124 | return err; |
diff --git a/include/net/psample.h b/include/net/psample.h index 37a4df2325b2..6b578ce69cd8 100644 --- a/include/net/psample.h +++ b/include/net/psample.h | |||
@@ -11,6 +11,7 @@ struct psample_group { | |||
11 | u32 group_num; | 11 | u32 group_num; |
12 | u32 refcount; | 12 | u32 refcount; |
13 | u32 seq; | 13 | u32 seq; |
14 | struct rcu_head rcu; | ||
14 | }; | 15 | }; |
15 | 16 | ||
16 | struct psample_group *psample_group_get(struct net *net, u32 group_num); | 17 | struct psample_group *psample_group_get(struct net *net, u32 group_num); |
diff --git a/include/trace/events/rxrpc.h b/include/trace/events/rxrpc.h index fa06b528c73c..a13a62db3565 100644 --- a/include/trace/events/rxrpc.h +++ b/include/trace/events/rxrpc.h | |||
@@ -23,20 +23,17 @@ | |||
23 | #define __RXRPC_DECLARE_TRACE_ENUMS_ONCE_ONLY | 23 | #define __RXRPC_DECLARE_TRACE_ENUMS_ONCE_ONLY |
24 | 24 | ||
25 | enum rxrpc_skb_trace { | 25 | enum rxrpc_skb_trace { |
26 | rxrpc_skb_rx_cleaned, | 26 | rxrpc_skb_cleaned, |
27 | rxrpc_skb_rx_freed, | 27 | rxrpc_skb_freed, |
28 | rxrpc_skb_rx_got, | 28 | rxrpc_skb_got, |
29 | rxrpc_skb_rx_lost, | 29 | rxrpc_skb_lost, |
30 | rxrpc_skb_rx_purged, | 30 | rxrpc_skb_new, |
31 | rxrpc_skb_rx_received, | 31 | rxrpc_skb_purged, |
32 | rxrpc_skb_rx_rotated, | 32 | rxrpc_skb_received, |
33 | rxrpc_skb_rx_seen, | 33 | rxrpc_skb_rotated, |
34 | rxrpc_skb_tx_cleaned, | 34 | rxrpc_skb_seen, |
35 | rxrpc_skb_tx_freed, | 35 | rxrpc_skb_unshared, |
36 | rxrpc_skb_tx_got, | 36 | rxrpc_skb_unshared_nomem, |
37 | rxrpc_skb_tx_new, | ||
38 | rxrpc_skb_tx_rotated, | ||
39 | rxrpc_skb_tx_seen, | ||
40 | }; | 37 | }; |
41 | 38 | ||
42 | enum rxrpc_local_trace { | 39 | enum rxrpc_local_trace { |
@@ -228,20 +225,17 @@ enum rxrpc_tx_point { | |||
228 | * Declare tracing information enums and their string mappings for display. | 225 | * Declare tracing information enums and their string mappings for display. |
229 | */ | 226 | */ |
230 | #define rxrpc_skb_traces \ | 227 | #define rxrpc_skb_traces \ |
231 | EM(rxrpc_skb_rx_cleaned, "Rx CLN") \ | 228 | EM(rxrpc_skb_cleaned, "CLN") \ |
232 | EM(rxrpc_skb_rx_freed, "Rx FRE") \ | 229 | EM(rxrpc_skb_freed, "FRE") \ |
233 | EM(rxrpc_skb_rx_got, "Rx GOT") \ | 230 | EM(rxrpc_skb_got, "GOT") \ |
234 | EM(rxrpc_skb_rx_lost, "Rx *L*") \ | 231 | EM(rxrpc_skb_lost, "*L*") \ |
235 | EM(rxrpc_skb_rx_purged, "Rx PUR") \ | 232 | EM(rxrpc_skb_new, "NEW") \ |
236 | EM(rxrpc_skb_rx_received, "Rx RCV") \ | 233 | EM(rxrpc_skb_purged, "PUR") \ |
237 | EM(rxrpc_skb_rx_rotated, "Rx ROT") \ | 234 | EM(rxrpc_skb_received, "RCV") \ |
238 | EM(rxrpc_skb_rx_seen, "Rx SEE") \ | 235 | EM(rxrpc_skb_rotated, "ROT") \ |
239 | EM(rxrpc_skb_tx_cleaned, "Tx CLN") \ | 236 | EM(rxrpc_skb_seen, "SEE") \ |
240 | EM(rxrpc_skb_tx_freed, "Tx FRE") \ | 237 | EM(rxrpc_skb_unshared, "UNS") \ |
241 | EM(rxrpc_skb_tx_got, "Tx GOT") \ | 238 | E_(rxrpc_skb_unshared_nomem, "US0") |
242 | EM(rxrpc_skb_tx_new, "Tx NEW") \ | ||
243 | EM(rxrpc_skb_tx_rotated, "Tx ROT") \ | ||
244 | E_(rxrpc_skb_tx_seen, "Tx SEE") | ||
245 | 239 | ||
246 | #define rxrpc_local_traces \ | 240 | #define rxrpc_local_traces \ |
247 | EM(rxrpc_local_got, "GOT") \ | 241 | EM(rxrpc_local_got, "GOT") \ |
@@ -643,13 +637,14 @@ TRACE_EVENT(rxrpc_call, | |||
643 | 637 | ||
644 | TRACE_EVENT(rxrpc_skb, | 638 | TRACE_EVENT(rxrpc_skb, |
645 | TP_PROTO(struct sk_buff *skb, enum rxrpc_skb_trace op, | 639 | TP_PROTO(struct sk_buff *skb, enum rxrpc_skb_trace op, |
646 | int usage, int mod_count, const void *where), | 640 | int usage, int mod_count, u8 flags, const void *where), |
647 | 641 | ||
648 | TP_ARGS(skb, op, usage, mod_count, where), | 642 | TP_ARGS(skb, op, usage, mod_count, flags, where), |
649 | 643 | ||
650 | TP_STRUCT__entry( | 644 | TP_STRUCT__entry( |
651 | __field(struct sk_buff *, skb ) | 645 | __field(struct sk_buff *, skb ) |
652 | __field(enum rxrpc_skb_trace, op ) | 646 | __field(enum rxrpc_skb_trace, op ) |
647 | __field(u8, flags ) | ||
653 | __field(int, usage ) | 648 | __field(int, usage ) |
654 | __field(int, mod_count ) | 649 | __field(int, mod_count ) |
655 | __field(const void *, where ) | 650 | __field(const void *, where ) |
@@ -657,14 +652,16 @@ TRACE_EVENT(rxrpc_skb, | |||
657 | 652 | ||
658 | TP_fast_assign( | 653 | TP_fast_assign( |
659 | __entry->skb = skb; | 654 | __entry->skb = skb; |
655 | __entry->flags = flags; | ||
660 | __entry->op = op; | 656 | __entry->op = op; |
661 | __entry->usage = usage; | 657 | __entry->usage = usage; |
662 | __entry->mod_count = mod_count; | 658 | __entry->mod_count = mod_count; |
663 | __entry->where = where; | 659 | __entry->where = where; |
664 | ), | 660 | ), |
665 | 661 | ||
666 | TP_printk("s=%p %s u=%d m=%d p=%pSR", | 662 | TP_printk("s=%p %cx %s u=%d m=%d p=%pSR", |
667 | __entry->skb, | 663 | __entry->skb, |
664 | __entry->flags & RXRPC_SKB_TX_BUFFER ? 'T' : 'R', | ||
668 | __print_symbolic(__entry->op, rxrpc_skb_traces), | 665 | __print_symbolic(__entry->op, rxrpc_skb_traces), |
669 | __entry->usage, | 666 | __entry->usage, |
670 | __entry->mod_count, | 667 | __entry->mod_count, |
diff --git a/kernel/bpf/core.c b/kernel/bpf/core.c index 8191a7db2777..66088a9e9b9e 100644 --- a/kernel/bpf/core.c +++ b/kernel/bpf/core.c | |||
@@ -890,7 +890,8 @@ int bpf_jit_get_func_addr(const struct bpf_prog *prog, | |||
890 | 890 | ||
891 | static int bpf_jit_blind_insn(const struct bpf_insn *from, | 891 | static int bpf_jit_blind_insn(const struct bpf_insn *from, |
892 | const struct bpf_insn *aux, | 892 | const struct bpf_insn *aux, |
893 | struct bpf_insn *to_buff) | 893 | struct bpf_insn *to_buff, |
894 | bool emit_zext) | ||
894 | { | 895 | { |
895 | struct bpf_insn *to = to_buff; | 896 | struct bpf_insn *to = to_buff; |
896 | u32 imm_rnd = get_random_int(); | 897 | u32 imm_rnd = get_random_int(); |
@@ -1005,6 +1006,8 @@ static int bpf_jit_blind_insn(const struct bpf_insn *from, | |||
1005 | case 0: /* Part 2 of BPF_LD | BPF_IMM | BPF_DW. */ | 1006 | case 0: /* Part 2 of BPF_LD | BPF_IMM | BPF_DW. */ |
1006 | *to++ = BPF_ALU32_IMM(BPF_MOV, BPF_REG_AX, imm_rnd ^ aux[0].imm); | 1007 | *to++ = BPF_ALU32_IMM(BPF_MOV, BPF_REG_AX, imm_rnd ^ aux[0].imm); |
1007 | *to++ = BPF_ALU32_IMM(BPF_XOR, BPF_REG_AX, imm_rnd); | 1008 | *to++ = BPF_ALU32_IMM(BPF_XOR, BPF_REG_AX, imm_rnd); |
1009 | if (emit_zext) | ||
1010 | *to++ = BPF_ZEXT_REG(BPF_REG_AX); | ||
1008 | *to++ = BPF_ALU64_REG(BPF_OR, aux[0].dst_reg, BPF_REG_AX); | 1011 | *to++ = BPF_ALU64_REG(BPF_OR, aux[0].dst_reg, BPF_REG_AX); |
1009 | break; | 1012 | break; |
1010 | 1013 | ||
@@ -1088,7 +1091,8 @@ struct bpf_prog *bpf_jit_blind_constants(struct bpf_prog *prog) | |||
1088 | insn[1].code == 0) | 1091 | insn[1].code == 0) |
1089 | memcpy(aux, insn, sizeof(aux)); | 1092 | memcpy(aux, insn, sizeof(aux)); |
1090 | 1093 | ||
1091 | rewritten = bpf_jit_blind_insn(insn, aux, insn_buff); | 1094 | rewritten = bpf_jit_blind_insn(insn, aux, insn_buff, |
1095 | clone->aux->verifier_zext); | ||
1092 | if (!rewritten) | 1096 | if (!rewritten) |
1093 | continue; | 1097 | continue; |
1094 | 1098 | ||
diff --git a/kernel/kallsyms.c b/kernel/kallsyms.c index 95a260f9214b..136ce049c4ad 100644 --- a/kernel/kallsyms.c +++ b/kernel/kallsyms.c | |||
@@ -263,8 +263,10 @@ int kallsyms_lookup_size_offset(unsigned long addr, unsigned long *symbolsize, | |||
263 | { | 263 | { |
264 | char namebuf[KSYM_NAME_LEN]; | 264 | char namebuf[KSYM_NAME_LEN]; |
265 | 265 | ||
266 | if (is_ksym_addr(addr)) | 266 | if (is_ksym_addr(addr)) { |
267 | return !!get_symbol_pos(addr, symbolsize, offset); | 267 | get_symbol_pos(addr, symbolsize, offset); |
268 | return 1; | ||
269 | } | ||
268 | return !!module_address_lookup(addr, symbolsize, offset, NULL, namebuf) || | 270 | return !!module_address_lookup(addr, symbolsize, offset, NULL, namebuf) || |
269 | !!__bpf_address_lookup(addr, symbolsize, offset, namebuf); | 271 | !!__bpf_address_lookup(addr, symbolsize, offset, namebuf); |
270 | } | 272 | } |
diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c index eca34503f178..f9821a3374e9 100644 --- a/kernel/trace/ftrace.c +++ b/kernel/trace/ftrace.c | |||
@@ -3095,6 +3095,14 @@ t_probe_next(struct seq_file *m, loff_t *pos) | |||
3095 | hnd = &iter->probe_entry->hlist; | 3095 | hnd = &iter->probe_entry->hlist; |
3096 | 3096 | ||
3097 | hash = iter->probe->ops.func_hash->filter_hash; | 3097 | hash = iter->probe->ops.func_hash->filter_hash; |
3098 | |||
3099 | /* | ||
3100 | * A probe being registered may temporarily have an empty hash | ||
3101 | * and it's at the end of the func_probes list. | ||
3102 | */ | ||
3103 | if (!hash || hash == EMPTY_HASH) | ||
3104 | return NULL; | ||
3105 | |||
3098 | size = 1 << hash->size_bits; | 3106 | size = 1 << hash->size_bits; |
3099 | 3107 | ||
3100 | retry: | 3108 | retry: |
@@ -4320,12 +4328,21 @@ register_ftrace_function_probe(char *glob, struct trace_array *tr, | |||
4320 | 4328 | ||
4321 | mutex_unlock(&ftrace_lock); | 4329 | mutex_unlock(&ftrace_lock); |
4322 | 4330 | ||
4331 | /* | ||
4332 | * Note, there's a small window here that the func_hash->filter_hash | ||
4333 | * may be NULL or empty. Need to be carefule when reading the loop. | ||
4334 | */ | ||
4323 | mutex_lock(&probe->ops.func_hash->regex_lock); | 4335 | mutex_lock(&probe->ops.func_hash->regex_lock); |
4324 | 4336 | ||
4325 | orig_hash = &probe->ops.func_hash->filter_hash; | 4337 | orig_hash = &probe->ops.func_hash->filter_hash; |
4326 | old_hash = *orig_hash; | 4338 | old_hash = *orig_hash; |
4327 | hash = alloc_and_copy_ftrace_hash(FTRACE_HASH_DEFAULT_BITS, old_hash); | 4339 | hash = alloc_and_copy_ftrace_hash(FTRACE_HASH_DEFAULT_BITS, old_hash); |
4328 | 4340 | ||
4341 | if (!hash) { | ||
4342 | ret = -ENOMEM; | ||
4343 | goto out; | ||
4344 | } | ||
4345 | |||
4329 | ret = ftrace_match_records(hash, glob, strlen(glob)); | 4346 | ret = ftrace_match_records(hash, glob, strlen(glob)); |
4330 | 4347 | ||
4331 | /* Nothing found? */ | 4348 | /* Nothing found? */ |
diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c index 525a97fbbc60..563e80f9006a 100644 --- a/kernel/trace/trace.c +++ b/kernel/trace/trace.c | |||
@@ -1567,9 +1567,9 @@ update_max_tr(struct trace_array *tr, struct task_struct *tsk, int cpu, | |||
1567 | 1567 | ||
1568 | /** | 1568 | /** |
1569 | * update_max_tr_single - only copy one trace over, and reset the rest | 1569 | * update_max_tr_single - only copy one trace over, and reset the rest |
1570 | * @tr - tracer | 1570 | * @tr: tracer |
1571 | * @tsk - task with the latency | 1571 | * @tsk: task with the latency |
1572 | * @cpu - the cpu of the buffer to copy. | 1572 | * @cpu: the cpu of the buffer to copy. |
1573 | * | 1573 | * |
1574 | * Flip the trace of a single CPU buffer between the @tr and the max_tr. | 1574 | * Flip the trace of a single CPU buffer between the @tr and the max_tr. |
1575 | */ | 1575 | */ |
@@ -1767,7 +1767,7 @@ static void __init apply_trace_boot_options(void); | |||
1767 | 1767 | ||
1768 | /** | 1768 | /** |
1769 | * register_tracer - register a tracer with the ftrace system. | 1769 | * register_tracer - register a tracer with the ftrace system. |
1770 | * @type - the plugin for the tracer | 1770 | * @type: the plugin for the tracer |
1771 | * | 1771 | * |
1772 | * Register a new plugin tracer. | 1772 | * Register a new plugin tracer. |
1773 | */ | 1773 | */ |
@@ -2230,9 +2230,9 @@ static bool tracing_record_taskinfo_skip(int flags) | |||
2230 | /** | 2230 | /** |
2231 | * tracing_record_taskinfo - record the task info of a task | 2231 | * tracing_record_taskinfo - record the task info of a task |
2232 | * | 2232 | * |
2233 | * @task - task to record | 2233 | * @task: task to record |
2234 | * @flags - TRACE_RECORD_CMDLINE for recording comm | 2234 | * @flags: TRACE_RECORD_CMDLINE for recording comm |
2235 | * - TRACE_RECORD_TGID for recording tgid | 2235 | * TRACE_RECORD_TGID for recording tgid |
2236 | */ | 2236 | */ |
2237 | void tracing_record_taskinfo(struct task_struct *task, int flags) | 2237 | void tracing_record_taskinfo(struct task_struct *task, int flags) |
2238 | { | 2238 | { |
@@ -2258,10 +2258,10 @@ void tracing_record_taskinfo(struct task_struct *task, int flags) | |||
2258 | /** | 2258 | /** |
2259 | * tracing_record_taskinfo_sched_switch - record task info for sched_switch | 2259 | * tracing_record_taskinfo_sched_switch - record task info for sched_switch |
2260 | * | 2260 | * |
2261 | * @prev - previous task during sched_switch | 2261 | * @prev: previous task during sched_switch |
2262 | * @next - next task during sched_switch | 2262 | * @next: next task during sched_switch |
2263 | * @flags - TRACE_RECORD_CMDLINE for recording comm | 2263 | * @flags: TRACE_RECORD_CMDLINE for recording comm |
2264 | * TRACE_RECORD_TGID for recording tgid | 2264 | * TRACE_RECORD_TGID for recording tgid |
2265 | */ | 2265 | */ |
2266 | void tracing_record_taskinfo_sched_switch(struct task_struct *prev, | 2266 | void tracing_record_taskinfo_sched_switch(struct task_struct *prev, |
2267 | struct task_struct *next, int flags) | 2267 | struct task_struct *next, int flags) |
@@ -3072,7 +3072,9 @@ static void trace_printk_start_stop_comm(int enabled) | |||
3072 | 3072 | ||
3073 | /** | 3073 | /** |
3074 | * trace_vbprintk - write binary msg to tracing buffer | 3074 | * trace_vbprintk - write binary msg to tracing buffer |
3075 | * | 3075 | * @ip: The address of the caller |
3076 | * @fmt: The string format to write to the buffer | ||
3077 | * @args: Arguments for @fmt | ||
3076 | */ | 3078 | */ |
3077 | int trace_vbprintk(unsigned long ip, const char *fmt, va_list args) | 3079 | int trace_vbprintk(unsigned long ip, const char *fmt, va_list args) |
3078 | { | 3080 | { |
diff --git a/kernel/trace/trace_events.c b/kernel/trace/trace_events.c index c7506bc81b75..648930823b57 100644 --- a/kernel/trace/trace_events.c +++ b/kernel/trace/trace_events.c | |||
@@ -787,7 +787,7 @@ static int __ftrace_set_clr_event(struct trace_array *tr, const char *match, | |||
787 | return ret; | 787 | return ret; |
788 | } | 788 | } |
789 | 789 | ||
790 | static int ftrace_set_clr_event(struct trace_array *tr, char *buf, int set) | 790 | int ftrace_set_clr_event(struct trace_array *tr, char *buf, int set) |
791 | { | 791 | { |
792 | char *event = NULL, *sub = NULL, *match; | 792 | char *event = NULL, *sub = NULL, *match; |
793 | int ret; | 793 | int ret; |
diff --git a/kernel/trace/trace_probe.c b/kernel/trace/trace_probe.c index dbef0d135075..fb6bfbc5bf86 100644 --- a/kernel/trace/trace_probe.c +++ b/kernel/trace/trace_probe.c | |||
@@ -895,7 +895,8 @@ void trace_probe_cleanup(struct trace_probe *tp) | |||
895 | for (i = 0; i < tp->nr_args; i++) | 895 | for (i = 0; i < tp->nr_args; i++) |
896 | traceprobe_free_probe_arg(&tp->args[i]); | 896 | traceprobe_free_probe_arg(&tp->args[i]); |
897 | 897 | ||
898 | kfree(call->class->system); | 898 | if (call->class) |
899 | kfree(call->class->system); | ||
899 | kfree(call->name); | 900 | kfree(call->name); |
900 | kfree(call->print_fmt); | 901 | kfree(call->print_fmt); |
901 | } | 902 | } |
diff --git a/lib/kfifo.c b/lib/kfifo.c index 117ad0e7fbf4..70dab9ac7827 100644 --- a/lib/kfifo.c +++ b/lib/kfifo.c | |||
@@ -68,7 +68,8 @@ int __kfifo_init(struct __kfifo *fifo, void *buffer, | |||
68 | { | 68 | { |
69 | size /= esize; | 69 | size /= esize; |
70 | 70 | ||
71 | size = roundup_pow_of_two(size); | 71 | if (!is_power_of_2(size)) |
72 | size = rounddown_pow_of_two(size); | ||
72 | 73 | ||
73 | fifo->in = 0; | 74 | fifo->in = 0; |
74 | fifo->out = 0; | 75 | fifo->out = 0; |
diff --git a/lib/logic_pio.c b/lib/logic_pio.c index feea48fd1a0d..905027574e5d 100644 --- a/lib/logic_pio.c +++ b/lib/logic_pio.c | |||
@@ -35,7 +35,7 @@ int logic_pio_register_range(struct logic_pio_hwaddr *new_range) | |||
35 | struct logic_pio_hwaddr *range; | 35 | struct logic_pio_hwaddr *range; |
36 | resource_size_t start; | 36 | resource_size_t start; |
37 | resource_size_t end; | 37 | resource_size_t end; |
38 | resource_size_t mmio_sz = 0; | 38 | resource_size_t mmio_end = 0; |
39 | resource_size_t iio_sz = MMIO_UPPER_LIMIT; | 39 | resource_size_t iio_sz = MMIO_UPPER_LIMIT; |
40 | int ret = 0; | 40 | int ret = 0; |
41 | 41 | ||
@@ -46,7 +46,7 @@ int logic_pio_register_range(struct logic_pio_hwaddr *new_range) | |||
46 | end = new_range->hw_start + new_range->size; | 46 | end = new_range->hw_start + new_range->size; |
47 | 47 | ||
48 | mutex_lock(&io_range_mutex); | 48 | mutex_lock(&io_range_mutex); |
49 | list_for_each_entry_rcu(range, &io_range_list, list) { | 49 | list_for_each_entry(range, &io_range_list, list) { |
50 | if (range->fwnode == new_range->fwnode) { | 50 | if (range->fwnode == new_range->fwnode) { |
51 | /* range already there */ | 51 | /* range already there */ |
52 | goto end_register; | 52 | goto end_register; |
@@ -56,7 +56,7 @@ int logic_pio_register_range(struct logic_pio_hwaddr *new_range) | |||
56 | /* for MMIO ranges we need to check for overlap */ | 56 | /* for MMIO ranges we need to check for overlap */ |
57 | if (start >= range->hw_start + range->size || | 57 | if (start >= range->hw_start + range->size || |
58 | end < range->hw_start) { | 58 | end < range->hw_start) { |
59 | mmio_sz += range->size; | 59 | mmio_end = range->io_start + range->size; |
60 | } else { | 60 | } else { |
61 | ret = -EFAULT; | 61 | ret = -EFAULT; |
62 | goto end_register; | 62 | goto end_register; |
@@ -69,16 +69,16 @@ int logic_pio_register_range(struct logic_pio_hwaddr *new_range) | |||
69 | 69 | ||
70 | /* range not registered yet, check for available space */ | 70 | /* range not registered yet, check for available space */ |
71 | if (new_range->flags == LOGIC_PIO_CPU_MMIO) { | 71 | if (new_range->flags == LOGIC_PIO_CPU_MMIO) { |
72 | if (mmio_sz + new_range->size - 1 > MMIO_UPPER_LIMIT) { | 72 | if (mmio_end + new_range->size - 1 > MMIO_UPPER_LIMIT) { |
73 | /* if it's too big check if 64K space can be reserved */ | 73 | /* if it's too big check if 64K space can be reserved */ |
74 | if (mmio_sz + SZ_64K - 1 > MMIO_UPPER_LIMIT) { | 74 | if (mmio_end + SZ_64K - 1 > MMIO_UPPER_LIMIT) { |
75 | ret = -E2BIG; | 75 | ret = -E2BIG; |
76 | goto end_register; | 76 | goto end_register; |
77 | } | 77 | } |
78 | new_range->size = SZ_64K; | 78 | new_range->size = SZ_64K; |
79 | pr_warn("Requested IO range too big, new size set to 64K\n"); | 79 | pr_warn("Requested IO range too big, new size set to 64K\n"); |
80 | } | 80 | } |
81 | new_range->io_start = mmio_sz; | 81 | new_range->io_start = mmio_end; |
82 | } else if (new_range->flags == LOGIC_PIO_INDIRECT) { | 82 | } else if (new_range->flags == LOGIC_PIO_INDIRECT) { |
83 | if (iio_sz + new_range->size - 1 > IO_SPACE_LIMIT) { | 83 | if (iio_sz + new_range->size - 1 > IO_SPACE_LIMIT) { |
84 | ret = -E2BIG; | 84 | ret = -E2BIG; |
@@ -99,6 +99,20 @@ end_register: | |||
99 | } | 99 | } |
100 | 100 | ||
101 | /** | 101 | /** |
102 | * logic_pio_unregister_range - unregister a logical PIO range for a host | ||
103 | * @range: pointer to the IO range which has been already registered. | ||
104 | * | ||
105 | * Unregister a previously-registered IO range node. | ||
106 | */ | ||
107 | void logic_pio_unregister_range(struct logic_pio_hwaddr *range) | ||
108 | { | ||
109 | mutex_lock(&io_range_mutex); | ||
110 | list_del_rcu(&range->list); | ||
111 | mutex_unlock(&io_range_mutex); | ||
112 | synchronize_rcu(); | ||
113 | } | ||
114 | |||
115 | /** | ||
102 | * find_io_range_by_fwnode - find logical PIO range for given FW node | 116 | * find_io_range_by_fwnode - find logical PIO range for given FW node |
103 | * @fwnode: FW node handle associated with logical PIO range | 117 | * @fwnode: FW node handle associated with logical PIO range |
104 | * | 118 | * |
@@ -108,26 +122,38 @@ end_register: | |||
108 | */ | 122 | */ |
109 | struct logic_pio_hwaddr *find_io_range_by_fwnode(struct fwnode_handle *fwnode) | 123 | struct logic_pio_hwaddr *find_io_range_by_fwnode(struct fwnode_handle *fwnode) |
110 | { | 124 | { |
111 | struct logic_pio_hwaddr *range; | 125 | struct logic_pio_hwaddr *range, *found_range = NULL; |
112 | 126 | ||
127 | rcu_read_lock(); | ||
113 | list_for_each_entry_rcu(range, &io_range_list, list) { | 128 | list_for_each_entry_rcu(range, &io_range_list, list) { |
114 | if (range->fwnode == fwnode) | 129 | if (range->fwnode == fwnode) { |
115 | return range; | 130 | found_range = range; |
131 | break; | ||
132 | } | ||
116 | } | 133 | } |
117 | return NULL; | 134 | rcu_read_unlock(); |
135 | |||
136 | return found_range; | ||
118 | } | 137 | } |
119 | 138 | ||
120 | /* Return a registered range given an input PIO token */ | 139 | /* Return a registered range given an input PIO token */ |
121 | static struct logic_pio_hwaddr *find_io_range(unsigned long pio) | 140 | static struct logic_pio_hwaddr *find_io_range(unsigned long pio) |
122 | { | 141 | { |
123 | struct logic_pio_hwaddr *range; | 142 | struct logic_pio_hwaddr *range, *found_range = NULL; |
124 | 143 | ||
144 | rcu_read_lock(); | ||
125 | list_for_each_entry_rcu(range, &io_range_list, list) { | 145 | list_for_each_entry_rcu(range, &io_range_list, list) { |
126 | if (in_range(pio, range->io_start, range->size)) | 146 | if (in_range(pio, range->io_start, range->size)) { |
127 | return range; | 147 | found_range = range; |
148 | break; | ||
149 | } | ||
128 | } | 150 | } |
129 | pr_err("PIO entry token %lx invalid\n", pio); | 151 | rcu_read_unlock(); |
130 | return NULL; | 152 | |
153 | if (!found_range) | ||
154 | pr_err("PIO entry token 0x%lx invalid\n", pio); | ||
155 | |||
156 | return found_range; | ||
131 | } | 157 | } |
132 | 158 | ||
133 | /** | 159 | /** |
@@ -180,14 +206,23 @@ unsigned long logic_pio_trans_cpuaddr(resource_size_t addr) | |||
180 | { | 206 | { |
181 | struct logic_pio_hwaddr *range; | 207 | struct logic_pio_hwaddr *range; |
182 | 208 | ||
209 | rcu_read_lock(); | ||
183 | list_for_each_entry_rcu(range, &io_range_list, list) { | 210 | list_for_each_entry_rcu(range, &io_range_list, list) { |
184 | if (range->flags != LOGIC_PIO_CPU_MMIO) | 211 | if (range->flags != LOGIC_PIO_CPU_MMIO) |
185 | continue; | 212 | continue; |
186 | if (in_range(addr, range->hw_start, range->size)) | 213 | if (in_range(addr, range->hw_start, range->size)) { |
187 | return addr - range->hw_start + range->io_start; | 214 | unsigned long cpuaddr; |
215 | |||
216 | cpuaddr = addr - range->hw_start + range->io_start; | ||
217 | |||
218 | rcu_read_unlock(); | ||
219 | return cpuaddr; | ||
220 | } | ||
188 | } | 221 | } |
189 | pr_err("addr %llx not registered in io_range_list\n", | 222 | rcu_read_unlock(); |
190 | (unsigned long long) addr); | 223 | |
224 | pr_err("addr %pa not registered in io_range_list\n", &addr); | ||
225 | |||
191 | return ~0UL; | 226 | return ~0UL; |
192 | } | 227 | } |
193 | 228 | ||
diff --git a/mm/memcontrol.c b/mm/memcontrol.c index 26e2999af608..9ec5e12486a7 100644 --- a/mm/memcontrol.c +++ b/mm/memcontrol.c | |||
@@ -752,15 +752,13 @@ void __mod_lruvec_state(struct lruvec *lruvec, enum node_stat_item idx, | |||
752 | /* Update memcg */ | 752 | /* Update memcg */ |
753 | __mod_memcg_state(memcg, idx, val); | 753 | __mod_memcg_state(memcg, idx, val); |
754 | 754 | ||
755 | /* Update lruvec */ | ||
756 | __this_cpu_add(pn->lruvec_stat_local->count[idx], val); | ||
757 | |||
755 | x = val + __this_cpu_read(pn->lruvec_stat_cpu->count[idx]); | 758 | x = val + __this_cpu_read(pn->lruvec_stat_cpu->count[idx]); |
756 | if (unlikely(abs(x) > MEMCG_CHARGE_BATCH)) { | 759 | if (unlikely(abs(x) > MEMCG_CHARGE_BATCH)) { |
757 | struct mem_cgroup_per_node *pi; | 760 | struct mem_cgroup_per_node *pi; |
758 | 761 | ||
759 | /* | ||
760 | * Batch local counters to keep them in sync with | ||
761 | * the hierarchical ones. | ||
762 | */ | ||
763 | __this_cpu_add(pn->lruvec_stat_local->count[idx], x); | ||
764 | for (pi = pn; pi; pi = parent_nodeinfo(pi, pgdat->node_id)) | 762 | for (pi = pn; pi; pi = parent_nodeinfo(pi, pgdat->node_id)) |
765 | atomic_long_add(x, &pi->lruvec_stat[idx]); | 763 | atomic_long_add(x, &pi->lruvec_stat[idx]); |
766 | x = 0; | 764 | x = 0; |
@@ -3260,37 +3258,49 @@ static u64 mem_cgroup_read_u64(struct cgroup_subsys_state *css, | |||
3260 | } | 3258 | } |
3261 | } | 3259 | } |
3262 | 3260 | ||
3263 | static void memcg_flush_percpu_vmstats(struct mem_cgroup *memcg) | 3261 | static void memcg_flush_percpu_vmstats(struct mem_cgroup *memcg, bool slab_only) |
3264 | { | 3262 | { |
3265 | unsigned long stat[MEMCG_NR_STAT]; | 3263 | unsigned long stat[MEMCG_NR_STAT]; |
3266 | struct mem_cgroup *mi; | 3264 | struct mem_cgroup *mi; |
3267 | int node, cpu, i; | 3265 | int node, cpu, i; |
3266 | int min_idx, max_idx; | ||
3268 | 3267 | ||
3269 | for (i = 0; i < MEMCG_NR_STAT; i++) | 3268 | if (slab_only) { |
3269 | min_idx = NR_SLAB_RECLAIMABLE; | ||
3270 | max_idx = NR_SLAB_UNRECLAIMABLE; | ||
3271 | } else { | ||
3272 | min_idx = 0; | ||
3273 | max_idx = MEMCG_NR_STAT; | ||
3274 | } | ||
3275 | |||
3276 | for (i = min_idx; i < max_idx; i++) | ||
3270 | stat[i] = 0; | 3277 | stat[i] = 0; |
3271 | 3278 | ||
3272 | for_each_online_cpu(cpu) | 3279 | for_each_online_cpu(cpu) |
3273 | for (i = 0; i < MEMCG_NR_STAT; i++) | 3280 | for (i = min_idx; i < max_idx; i++) |
3274 | stat[i] += raw_cpu_read(memcg->vmstats_percpu->stat[i]); | 3281 | stat[i] += per_cpu(memcg->vmstats_percpu->stat[i], cpu); |
3275 | 3282 | ||
3276 | for (mi = memcg; mi; mi = parent_mem_cgroup(mi)) | 3283 | for (mi = memcg; mi; mi = parent_mem_cgroup(mi)) |
3277 | for (i = 0; i < MEMCG_NR_STAT; i++) | 3284 | for (i = min_idx; i < max_idx; i++) |
3278 | atomic_long_add(stat[i], &mi->vmstats[i]); | 3285 | atomic_long_add(stat[i], &mi->vmstats[i]); |
3279 | 3286 | ||
3287 | if (!slab_only) | ||
3288 | max_idx = NR_VM_NODE_STAT_ITEMS; | ||
3289 | |||
3280 | for_each_node(node) { | 3290 | for_each_node(node) { |
3281 | struct mem_cgroup_per_node *pn = memcg->nodeinfo[node]; | 3291 | struct mem_cgroup_per_node *pn = memcg->nodeinfo[node]; |
3282 | struct mem_cgroup_per_node *pi; | 3292 | struct mem_cgroup_per_node *pi; |
3283 | 3293 | ||
3284 | for (i = 0; i < NR_VM_NODE_STAT_ITEMS; i++) | 3294 | for (i = min_idx; i < max_idx; i++) |
3285 | stat[i] = 0; | 3295 | stat[i] = 0; |
3286 | 3296 | ||
3287 | for_each_online_cpu(cpu) | 3297 | for_each_online_cpu(cpu) |
3288 | for (i = 0; i < NR_VM_NODE_STAT_ITEMS; i++) | 3298 | for (i = min_idx; i < max_idx; i++) |
3289 | stat[i] += raw_cpu_read( | 3299 | stat[i] += per_cpu( |
3290 | pn->lruvec_stat_cpu->count[i]); | 3300 | pn->lruvec_stat_cpu->count[i], cpu); |
3291 | 3301 | ||
3292 | for (pi = pn; pi; pi = parent_nodeinfo(pi, node)) | 3302 | for (pi = pn; pi; pi = parent_nodeinfo(pi, node)) |
3293 | for (i = 0; i < NR_VM_NODE_STAT_ITEMS; i++) | 3303 | for (i = min_idx; i < max_idx; i++) |
3294 | atomic_long_add(stat[i], &pi->lruvec_stat[i]); | 3304 | atomic_long_add(stat[i], &pi->lruvec_stat[i]); |
3295 | } | 3305 | } |
3296 | } | 3306 | } |
@@ -3306,8 +3316,8 @@ static void memcg_flush_percpu_vmevents(struct mem_cgroup *memcg) | |||
3306 | 3316 | ||
3307 | for_each_online_cpu(cpu) | 3317 | for_each_online_cpu(cpu) |
3308 | for (i = 0; i < NR_VM_EVENT_ITEMS; i++) | 3318 | for (i = 0; i < NR_VM_EVENT_ITEMS; i++) |
3309 | events[i] += raw_cpu_read( | 3319 | events[i] += per_cpu(memcg->vmstats_percpu->events[i], |
3310 | memcg->vmstats_percpu->events[i]); | 3320 | cpu); |
3311 | 3321 | ||
3312 | for (mi = memcg; mi; mi = parent_mem_cgroup(mi)) | 3322 | for (mi = memcg; mi; mi = parent_mem_cgroup(mi)) |
3313 | for (i = 0; i < NR_VM_EVENT_ITEMS; i++) | 3323 | for (i = 0; i < NR_VM_EVENT_ITEMS; i++) |
@@ -3363,7 +3373,14 @@ static void memcg_offline_kmem(struct mem_cgroup *memcg) | |||
3363 | if (!parent) | 3373 | if (!parent) |
3364 | parent = root_mem_cgroup; | 3374 | parent = root_mem_cgroup; |
3365 | 3375 | ||
3376 | /* | ||
3377 | * Deactivate and reparent kmem_caches. Then flush percpu | ||
3378 | * slab statistics to have precise values at the parent and | ||
3379 | * all ancestor levels. It's required to keep slab stats | ||
3380 | * accurate after the reparenting of kmem_caches. | ||
3381 | */ | ||
3366 | memcg_deactivate_kmem_caches(memcg, parent); | 3382 | memcg_deactivate_kmem_caches(memcg, parent); |
3383 | memcg_flush_percpu_vmstats(memcg, true); | ||
3367 | 3384 | ||
3368 | kmemcg_id = memcg->kmemcg_id; | 3385 | kmemcg_id = memcg->kmemcg_id; |
3369 | BUG_ON(kmemcg_id < 0); | 3386 | BUG_ON(kmemcg_id < 0); |
@@ -4740,7 +4757,7 @@ static void __mem_cgroup_free(struct mem_cgroup *memcg) | |||
4740 | * Flush percpu vmstats and vmevents to guarantee the value correctness | 4757 | * Flush percpu vmstats and vmevents to guarantee the value correctness |
4741 | * on parent's and all ancestor levels. | 4758 | * on parent's and all ancestor levels. |
4742 | */ | 4759 | */ |
4743 | memcg_flush_percpu_vmstats(memcg); | 4760 | memcg_flush_percpu_vmstats(memcg, false); |
4744 | memcg_flush_percpu_vmevents(memcg); | 4761 | memcg_flush_percpu_vmevents(memcg); |
4745 | for_each_node(node) | 4762 | for_each_node(node) |
4746 | free_mem_cgroup_per_node_info(memcg, node); | 4763 | free_mem_cgroup_per_node_info(memcg, node); |
diff --git a/mm/vmscan.c b/mm/vmscan.c index c77d1e3761a7..a6c5d0b28321 100644 --- a/mm/vmscan.c +++ b/mm/vmscan.c | |||
@@ -3220,6 +3220,7 @@ unsigned long try_to_free_pages(struct zonelist *zonelist, int order, | |||
3220 | 3220 | ||
3221 | #ifdef CONFIG_MEMCG | 3221 | #ifdef CONFIG_MEMCG |
3222 | 3222 | ||
3223 | /* Only used by soft limit reclaim. Do not reuse for anything else. */ | ||
3223 | unsigned long mem_cgroup_shrink_node(struct mem_cgroup *memcg, | 3224 | unsigned long mem_cgroup_shrink_node(struct mem_cgroup *memcg, |
3224 | gfp_t gfp_mask, bool noswap, | 3225 | gfp_t gfp_mask, bool noswap, |
3225 | pg_data_t *pgdat, | 3226 | pg_data_t *pgdat, |
@@ -3235,7 +3236,8 @@ unsigned long mem_cgroup_shrink_node(struct mem_cgroup *memcg, | |||
3235 | }; | 3236 | }; |
3236 | unsigned long lru_pages; | 3237 | unsigned long lru_pages; |
3237 | 3238 | ||
3238 | set_task_reclaim_state(current, &sc.reclaim_state); | 3239 | WARN_ON_ONCE(!current->reclaim_state); |
3240 | |||
3239 | sc.gfp_mask = (gfp_mask & GFP_RECLAIM_MASK) | | 3241 | sc.gfp_mask = (gfp_mask & GFP_RECLAIM_MASK) | |
3240 | (GFP_HIGHUSER_MOVABLE & ~GFP_RECLAIM_MASK); | 3242 | (GFP_HIGHUSER_MOVABLE & ~GFP_RECLAIM_MASK); |
3241 | 3243 | ||
@@ -3253,7 +3255,6 @@ unsigned long mem_cgroup_shrink_node(struct mem_cgroup *memcg, | |||
3253 | 3255 | ||
3254 | trace_mm_vmscan_memcg_softlimit_reclaim_end(sc.nr_reclaimed); | 3256 | trace_mm_vmscan_memcg_softlimit_reclaim_end(sc.nr_reclaimed); |
3255 | 3257 | ||
3256 | set_task_reclaim_state(current, NULL); | ||
3257 | *nr_scanned = sc.nr_scanned; | 3258 | *nr_scanned = sc.nr_scanned; |
3258 | 3259 | ||
3259 | return sc.nr_reclaimed; | 3260 | return sc.nr_reclaimed; |
diff --git a/mm/z3fold.c b/mm/z3fold.c index e31cd9bd4ed5..75b7962439ff 100644 --- a/mm/z3fold.c +++ b/mm/z3fold.c | |||
@@ -1406,6 +1406,7 @@ static bool z3fold_page_isolate(struct page *page, isolate_mode_t mode) | |||
1406 | * should freak out. | 1406 | * should freak out. |
1407 | */ | 1407 | */ |
1408 | WARN(1, "Z3fold is experiencing kref problems\n"); | 1408 | WARN(1, "Z3fold is experiencing kref problems\n"); |
1409 | z3fold_page_unlock(zhdr); | ||
1409 | return false; | 1410 | return false; |
1410 | } | 1411 | } |
1411 | z3fold_page_unlock(zhdr); | 1412 | z3fold_page_unlock(zhdr); |
diff --git a/mm/zsmalloc.c b/mm/zsmalloc.c index 08def3a0d200..e98bb6ab4f7e 100644 --- a/mm/zsmalloc.c +++ b/mm/zsmalloc.c | |||
@@ -2412,7 +2412,9 @@ struct zs_pool *zs_create_pool(const char *name) | |||
2412 | if (!pool->name) | 2412 | if (!pool->name) |
2413 | goto err; | 2413 | goto err; |
2414 | 2414 | ||
2415 | #ifdef CONFIG_COMPACTION | ||
2415 | init_waitqueue_head(&pool->migration_wait); | 2416 | init_waitqueue_head(&pool->migration_wait); |
2417 | #endif | ||
2416 | 2418 | ||
2417 | if (create_cache(pool)) | 2419 | if (create_cache(pool)) |
2418 | goto err; | 2420 | goto err; |
diff --git a/net/batman-adv/bat_iv_ogm.c b/net/batman-adv/bat_iv_ogm.c index 240ed70912d6..d78938e3e008 100644 --- a/net/batman-adv/bat_iv_ogm.c +++ b/net/batman-adv/bat_iv_ogm.c | |||
@@ -277,17 +277,23 @@ static u8 batadv_hop_penalty(u8 tq, const struct batadv_priv *bat_priv) | |||
277 | * batadv_iv_ogm_aggr_packet() - checks if there is another OGM attached | 277 | * batadv_iv_ogm_aggr_packet() - checks if there is another OGM attached |
278 | * @buff_pos: current position in the skb | 278 | * @buff_pos: current position in the skb |
279 | * @packet_len: total length of the skb | 279 | * @packet_len: total length of the skb |
280 | * @tvlv_len: tvlv length of the previously considered OGM | 280 | * @ogm_packet: potential OGM in buffer |
281 | * | 281 | * |
282 | * Return: true if there is enough space for another OGM, false otherwise. | 282 | * Return: true if there is enough space for another OGM, false otherwise. |
283 | */ | 283 | */ |
284 | static bool batadv_iv_ogm_aggr_packet(int buff_pos, int packet_len, | 284 | static bool |
285 | __be16 tvlv_len) | 285 | batadv_iv_ogm_aggr_packet(int buff_pos, int packet_len, |
286 | const struct batadv_ogm_packet *ogm_packet) | ||
286 | { | 287 | { |
287 | int next_buff_pos = 0; | 288 | int next_buff_pos = 0; |
288 | 289 | ||
289 | next_buff_pos += buff_pos + BATADV_OGM_HLEN; | 290 | /* check if there is enough space for the header */ |
290 | next_buff_pos += ntohs(tvlv_len); | 291 | next_buff_pos += buff_pos + sizeof(*ogm_packet); |
292 | if (next_buff_pos > packet_len) | ||
293 | return false; | ||
294 | |||
295 | /* check if there is enough space for the optional TVLV */ | ||
296 | next_buff_pos += ntohs(ogm_packet->tvlv_len); | ||
291 | 297 | ||
292 | return (next_buff_pos <= packet_len) && | 298 | return (next_buff_pos <= packet_len) && |
293 | (next_buff_pos <= BATADV_MAX_AGGREGATION_BYTES); | 299 | (next_buff_pos <= BATADV_MAX_AGGREGATION_BYTES); |
@@ -315,7 +321,7 @@ static void batadv_iv_ogm_send_to_if(struct batadv_forw_packet *forw_packet, | |||
315 | 321 | ||
316 | /* adjust all flags and log packets */ | 322 | /* adjust all flags and log packets */ |
317 | while (batadv_iv_ogm_aggr_packet(buff_pos, forw_packet->packet_len, | 323 | while (batadv_iv_ogm_aggr_packet(buff_pos, forw_packet->packet_len, |
318 | batadv_ogm_packet->tvlv_len)) { | 324 | batadv_ogm_packet)) { |
319 | /* we might have aggregated direct link packets with an | 325 | /* we might have aggregated direct link packets with an |
320 | * ordinary base packet | 326 | * ordinary base packet |
321 | */ | 327 | */ |
@@ -1704,7 +1710,7 @@ static int batadv_iv_ogm_receive(struct sk_buff *skb, | |||
1704 | 1710 | ||
1705 | /* unpack the aggregated packets and process them one by one */ | 1711 | /* unpack the aggregated packets and process them one by one */ |
1706 | while (batadv_iv_ogm_aggr_packet(ogm_offset, skb_headlen(skb), | 1712 | while (batadv_iv_ogm_aggr_packet(ogm_offset, skb_headlen(skb), |
1707 | ogm_packet->tvlv_len)) { | 1713 | ogm_packet)) { |
1708 | batadv_iv_ogm_process(skb, ogm_offset, if_incoming); | 1714 | batadv_iv_ogm_process(skb, ogm_offset, if_incoming); |
1709 | 1715 | ||
1710 | ogm_offset += BATADV_OGM_HLEN; | 1716 | ogm_offset += BATADV_OGM_HLEN; |
diff --git a/net/batman-adv/bat_v_ogm.c b/net/batman-adv/bat_v_ogm.c index 319249f0f85f..dc4f7430cb5a 100644 --- a/net/batman-adv/bat_v_ogm.c +++ b/net/batman-adv/bat_v_ogm.c | |||
@@ -806,17 +806,23 @@ batadv_v_ogm_process_per_outif(struct batadv_priv *bat_priv, | |||
806 | * batadv_v_ogm_aggr_packet() - checks if there is another OGM aggregated | 806 | * batadv_v_ogm_aggr_packet() - checks if there is another OGM aggregated |
807 | * @buff_pos: current position in the skb | 807 | * @buff_pos: current position in the skb |
808 | * @packet_len: total length of the skb | 808 | * @packet_len: total length of the skb |
809 | * @tvlv_len: tvlv length of the previously considered OGM | 809 | * @ogm2_packet: potential OGM2 in buffer |
810 | * | 810 | * |
811 | * Return: true if there is enough space for another OGM, false otherwise. | 811 | * Return: true if there is enough space for another OGM, false otherwise. |
812 | */ | 812 | */ |
813 | static bool batadv_v_ogm_aggr_packet(int buff_pos, int packet_len, | 813 | static bool |
814 | __be16 tvlv_len) | 814 | batadv_v_ogm_aggr_packet(int buff_pos, int packet_len, |
815 | const struct batadv_ogm2_packet *ogm2_packet) | ||
815 | { | 816 | { |
816 | int next_buff_pos = 0; | 817 | int next_buff_pos = 0; |
817 | 818 | ||
818 | next_buff_pos += buff_pos + BATADV_OGM2_HLEN; | 819 | /* check if there is enough space for the header */ |
819 | next_buff_pos += ntohs(tvlv_len); | 820 | next_buff_pos += buff_pos + sizeof(*ogm2_packet); |
821 | if (next_buff_pos > packet_len) | ||
822 | return false; | ||
823 | |||
824 | /* check if there is enough space for the optional TVLV */ | ||
825 | next_buff_pos += ntohs(ogm2_packet->tvlv_len); | ||
820 | 826 | ||
821 | return (next_buff_pos <= packet_len) && | 827 | return (next_buff_pos <= packet_len) && |
822 | (next_buff_pos <= BATADV_MAX_AGGREGATION_BYTES); | 828 | (next_buff_pos <= BATADV_MAX_AGGREGATION_BYTES); |
@@ -993,7 +999,7 @@ int batadv_v_ogm_packet_recv(struct sk_buff *skb, | |||
993 | ogm_packet = (struct batadv_ogm2_packet *)skb->data; | 999 | ogm_packet = (struct batadv_ogm2_packet *)skb->data; |
994 | 1000 | ||
995 | while (batadv_v_ogm_aggr_packet(ogm_offset, skb_headlen(skb), | 1001 | while (batadv_v_ogm_aggr_packet(ogm_offset, skb_headlen(skb), |
996 | ogm_packet->tvlv_len)) { | 1002 | ogm_packet)) { |
997 | batadv_v_ogm_process(skb, ogm_offset, if_incoming); | 1003 | batadv_v_ogm_process(skb, ogm_offset, if_incoming); |
998 | 1004 | ||
999 | ogm_offset += BATADV_OGM2_HLEN; | 1005 | ogm_offset += BATADV_OGM2_HLEN; |
diff --git a/net/bridge/netfilter/nft_meta_bridge.c b/net/bridge/netfilter/nft_meta_bridge.c index 1804e867f715..7c9e92b2f806 100644 --- a/net/bridge/netfilter/nft_meta_bridge.c +++ b/net/bridge/netfilter/nft_meta_bridge.c | |||
@@ -53,7 +53,7 @@ static void nft_meta_bridge_get_eval(const struct nft_expr *expr, | |||
53 | goto err; | 53 | goto err; |
54 | 54 | ||
55 | br_vlan_get_proto(br_dev, &p_proto); | 55 | br_vlan_get_proto(br_dev, &p_proto); |
56 | nft_reg_store16(dest, p_proto); | 56 | nft_reg_store16(dest, htons(p_proto)); |
57 | return; | 57 | return; |
58 | } | 58 | } |
59 | default: | 59 | default: |
diff --git a/net/ceph/crypto.c b/net/ceph/crypto.c index 5d6724cee38f..4f75df40fb12 100644 --- a/net/ceph/crypto.c +++ b/net/ceph/crypto.c | |||
@@ -136,8 +136,10 @@ void ceph_crypto_key_destroy(struct ceph_crypto_key *key) | |||
136 | if (key) { | 136 | if (key) { |
137 | kfree(key->key); | 137 | kfree(key->key); |
138 | key->key = NULL; | 138 | key->key = NULL; |
139 | crypto_free_sync_skcipher(key->tfm); | 139 | if (key->tfm) { |
140 | key->tfm = NULL; | 140 | crypto_free_sync_skcipher(key->tfm); |
141 | key->tfm = NULL; | ||
142 | } | ||
141 | } | 143 | } |
142 | } | 144 | } |
143 | 145 | ||
diff --git a/net/core/netpoll.c b/net/core/netpoll.c index 2cf27da1baeb..849380a622ef 100644 --- a/net/core/netpoll.c +++ b/net/core/netpoll.c | |||
@@ -122,7 +122,7 @@ static void queue_process(struct work_struct *work) | |||
122 | txq = netdev_get_tx_queue(dev, q_index); | 122 | txq = netdev_get_tx_queue(dev, q_index); |
123 | HARD_TX_LOCK(dev, txq, smp_processor_id()); | 123 | HARD_TX_LOCK(dev, txq, smp_processor_id()); |
124 | if (netif_xmit_frozen_or_stopped(txq) || | 124 | if (netif_xmit_frozen_or_stopped(txq) || |
125 | netpoll_start_xmit(skb, dev, txq) != NETDEV_TX_OK) { | 125 | !dev_xmit_complete(netpoll_start_xmit(skb, dev, txq))) { |
126 | skb_queue_head(&npinfo->txq, skb); | 126 | skb_queue_head(&npinfo->txq, skb); |
127 | HARD_TX_UNLOCK(dev, txq); | 127 | HARD_TX_UNLOCK(dev, txq); |
128 | local_irq_restore(flags); | 128 | local_irq_restore(flags); |
@@ -335,7 +335,7 @@ void netpoll_send_skb_on_dev(struct netpoll *np, struct sk_buff *skb, | |||
335 | 335 | ||
336 | HARD_TX_UNLOCK(dev, txq); | 336 | HARD_TX_UNLOCK(dev, txq); |
337 | 337 | ||
338 | if (status == NETDEV_TX_OK) | 338 | if (dev_xmit_complete(status)) |
339 | break; | 339 | break; |
340 | 340 | ||
341 | } | 341 | } |
@@ -352,7 +352,7 @@ void netpoll_send_skb_on_dev(struct netpoll *np, struct sk_buff *skb, | |||
352 | 352 | ||
353 | } | 353 | } |
354 | 354 | ||
355 | if (status != NETDEV_TX_OK) { | 355 | if (!dev_xmit_complete(status)) { |
356 | skb_queue_tail(&npinfo->txq, skb); | 356 | skb_queue_tail(&npinfo->txq, skb); |
357 | schedule_delayed_work(&npinfo->tx_work,0); | 357 | schedule_delayed_work(&npinfo->tx_work,0); |
358 | } | 358 | } |
diff --git a/net/dsa/tag_8021q.c b/net/dsa/tag_8021q.c index e44e6275b0a1..9c1cc2482b68 100644 --- a/net/dsa/tag_8021q.c +++ b/net/dsa/tag_8021q.c | |||
@@ -28,6 +28,7 @@ | |||
28 | * | 28 | * |
29 | * RSV - VID[9]: | 29 | * RSV - VID[9]: |
30 | * To be used for further expansion of SWITCH_ID or for other purposes. | 30 | * To be used for further expansion of SWITCH_ID or for other purposes. |
31 | * Must be transmitted as zero and ignored on receive. | ||
31 | * | 32 | * |
32 | * SWITCH_ID - VID[8:6]: | 33 | * SWITCH_ID - VID[8:6]: |
33 | * Index of switch within DSA tree. Must be between 0 and | 34 | * Index of switch within DSA tree. Must be between 0 and |
@@ -35,6 +36,7 @@ | |||
35 | * | 36 | * |
36 | * RSV - VID[5:4]: | 37 | * RSV - VID[5:4]: |
37 | * To be used for further expansion of PORT or for other purposes. | 38 | * To be used for further expansion of PORT or for other purposes. |
39 | * Must be transmitted as zero and ignored on receive. | ||
38 | * | 40 | * |
39 | * PORT - VID[3:0]: | 41 | * PORT - VID[3:0]: |
40 | * Index of switch port. Must be between 0 and DSA_MAX_PORTS - 1. | 42 | * Index of switch port. Must be between 0 and DSA_MAX_PORTS - 1. |
diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c index 051ef10374f6..94df48bcecc2 100644 --- a/net/ipv4/tcp.c +++ b/net/ipv4/tcp.c | |||
@@ -935,6 +935,22 @@ static int tcp_send_mss(struct sock *sk, int *size_goal, int flags) | |||
935 | return mss_now; | 935 | return mss_now; |
936 | } | 936 | } |
937 | 937 | ||
938 | /* In some cases, both sendpage() and sendmsg() could have added | ||
939 | * an skb to the write queue, but failed adding payload on it. | ||
940 | * We need to remove it to consume less memory, but more | ||
941 | * importantly be able to generate EPOLLOUT for Edge Trigger epoll() | ||
942 | * users. | ||
943 | */ | ||
944 | static void tcp_remove_empty_skb(struct sock *sk, struct sk_buff *skb) | ||
945 | { | ||
946 | if (skb && !skb->len) { | ||
947 | tcp_unlink_write_queue(skb, sk); | ||
948 | if (tcp_write_queue_empty(sk)) | ||
949 | tcp_chrono_stop(sk, TCP_CHRONO_BUSY); | ||
950 | sk_wmem_free_skb(sk, skb); | ||
951 | } | ||
952 | } | ||
953 | |||
938 | ssize_t do_tcp_sendpages(struct sock *sk, struct page *page, int offset, | 954 | ssize_t do_tcp_sendpages(struct sock *sk, struct page *page, int offset, |
939 | size_t size, int flags) | 955 | size_t size, int flags) |
940 | { | 956 | { |
@@ -1064,6 +1080,7 @@ out: | |||
1064 | return copied; | 1080 | return copied; |
1065 | 1081 | ||
1066 | do_error: | 1082 | do_error: |
1083 | tcp_remove_empty_skb(sk, tcp_write_queue_tail(sk)); | ||
1067 | if (copied) | 1084 | if (copied) |
1068 | goto out; | 1085 | goto out; |
1069 | out_err: | 1086 | out_err: |
@@ -1389,18 +1406,11 @@ out_nopush: | |||
1389 | sock_zerocopy_put(uarg); | 1406 | sock_zerocopy_put(uarg); |
1390 | return copied + copied_syn; | 1407 | return copied + copied_syn; |
1391 | 1408 | ||
1409 | do_error: | ||
1410 | skb = tcp_write_queue_tail(sk); | ||
1392 | do_fault: | 1411 | do_fault: |
1393 | if (!skb->len) { | 1412 | tcp_remove_empty_skb(sk, skb); |
1394 | tcp_unlink_write_queue(skb, sk); | ||
1395 | /* It is the one place in all of TCP, except connection | ||
1396 | * reset, where we can be unlinking the send_head. | ||
1397 | */ | ||
1398 | if (tcp_write_queue_empty(sk)) | ||
1399 | tcp_chrono_stop(sk, TCP_CHRONO_BUSY); | ||
1400 | sk_wmem_free_skb(sk, skb); | ||
1401 | } | ||
1402 | 1413 | ||
1403 | do_error: | ||
1404 | if (copied + copied_syn) | 1414 | if (copied + copied_syn) |
1405 | goto out; | 1415 | goto out; |
1406 | out_err: | 1416 | out_err: |
diff --git a/net/ipv4/tcp_output.c b/net/ipv4/tcp_output.c index 5c46bc4c7e8d..42abc9bd687a 100644 --- a/net/ipv4/tcp_output.c +++ b/net/ipv4/tcp_output.c | |||
@@ -2053,7 +2053,7 @@ static bool tcp_can_coalesce_send_queue_head(struct sock *sk, int len) | |||
2053 | if (len <= skb->len) | 2053 | if (len <= skb->len) |
2054 | break; | 2054 | break; |
2055 | 2055 | ||
2056 | if (unlikely(TCP_SKB_CB(skb)->eor)) | 2056 | if (unlikely(TCP_SKB_CB(skb)->eor) || tcp_has_tx_tstamp(skb)) |
2057 | return false; | 2057 | return false; |
2058 | 2058 | ||
2059 | len -= skb->len; | 2059 | len -= skb->len; |
@@ -2170,6 +2170,7 @@ static int tcp_mtu_probe(struct sock *sk) | |||
2170 | * we need to propagate it to the new skb. | 2170 | * we need to propagate it to the new skb. |
2171 | */ | 2171 | */ |
2172 | TCP_SKB_CB(nskb)->eor = TCP_SKB_CB(skb)->eor; | 2172 | TCP_SKB_CB(nskb)->eor = TCP_SKB_CB(skb)->eor; |
2173 | tcp_skb_collapse_tstamp(nskb, skb); | ||
2173 | tcp_unlink_write_queue(skb, sk); | 2174 | tcp_unlink_write_queue(skb, sk); |
2174 | sk_wmem_free_skb(sk, skb); | 2175 | sk_wmem_free_skb(sk, skb); |
2175 | } else { | 2176 | } else { |
diff --git a/net/ipv6/mcast.c b/net/ipv6/mcast.c index 7f3f13c37916..eaa4c2cc2fbb 100644 --- a/net/ipv6/mcast.c +++ b/net/ipv6/mcast.c | |||
@@ -787,14 +787,15 @@ static void mld_del_delrec(struct inet6_dev *idev, struct ifmcaddr6 *im) | |||
787 | if (pmc) { | 787 | if (pmc) { |
788 | im->idev = pmc->idev; | 788 | im->idev = pmc->idev; |
789 | if (im->mca_sfmode == MCAST_INCLUDE) { | 789 | if (im->mca_sfmode == MCAST_INCLUDE) { |
790 | im->mca_tomb = pmc->mca_tomb; | 790 | swap(im->mca_tomb, pmc->mca_tomb); |
791 | im->mca_sources = pmc->mca_sources; | 791 | swap(im->mca_sources, pmc->mca_sources); |
792 | for (psf = im->mca_sources; psf; psf = psf->sf_next) | 792 | for (psf = im->mca_sources; psf; psf = psf->sf_next) |
793 | psf->sf_crcount = idev->mc_qrv; | 793 | psf->sf_crcount = idev->mc_qrv; |
794 | } else { | 794 | } else { |
795 | im->mca_crcount = idev->mc_qrv; | 795 | im->mca_crcount = idev->mc_qrv; |
796 | } | 796 | } |
797 | in6_dev_put(pmc->idev); | 797 | in6_dev_put(pmc->idev); |
798 | ip6_mc_clear_src(pmc); | ||
798 | kfree(pmc); | 799 | kfree(pmc); |
799 | } | 800 | } |
800 | spin_unlock_bh(&im->mca_lock); | 801 | spin_unlock_bh(&im->mca_lock); |
diff --git a/net/mac80211/rx.c b/net/mac80211/rx.c index 3c1ab870fefe..768d14c9a716 100644 --- a/net/mac80211/rx.c +++ b/net/mac80211/rx.c | |||
@@ -2447,11 +2447,13 @@ static void ieee80211_deliver_skb_to_local_stack(struct sk_buff *skb, | |||
2447 | skb->protocol == cpu_to_be16(ETH_P_PREAUTH)) && | 2447 | skb->protocol == cpu_to_be16(ETH_P_PREAUTH)) && |
2448 | sdata->control_port_over_nl80211)) { | 2448 | sdata->control_port_over_nl80211)) { |
2449 | struct ieee80211_rx_status *status = IEEE80211_SKB_RXCB(skb); | 2449 | struct ieee80211_rx_status *status = IEEE80211_SKB_RXCB(skb); |
2450 | bool noencrypt = status->flag & RX_FLAG_DECRYPTED; | 2450 | bool noencrypt = !(status->flag & RX_FLAG_DECRYPTED); |
2451 | 2451 | ||
2452 | cfg80211_rx_control_port(dev, skb, noencrypt); | 2452 | cfg80211_rx_control_port(dev, skb, noencrypt); |
2453 | dev_kfree_skb(skb); | 2453 | dev_kfree_skb(skb); |
2454 | } else { | 2454 | } else { |
2455 | memset(skb->cb, 0, sizeof(skb->cb)); | ||
2456 | |||
2455 | /* deliver to local stack */ | 2457 | /* deliver to local stack */ |
2456 | if (rx->napi) | 2458 | if (rx->napi) |
2457 | napi_gro_receive(rx->napi, skb); | 2459 | napi_gro_receive(rx->napi, skb); |
@@ -2546,8 +2548,6 @@ ieee80211_deliver_skb(struct ieee80211_rx_data *rx) | |||
2546 | 2548 | ||
2547 | if (skb) { | 2549 | if (skb) { |
2548 | skb->protocol = eth_type_trans(skb, dev); | 2550 | skb->protocol = eth_type_trans(skb, dev); |
2549 | memset(skb->cb, 0, sizeof(skb->cb)); | ||
2550 | |||
2551 | ieee80211_deliver_skb_to_local_stack(skb, rx); | 2551 | ieee80211_deliver_skb_to_local_stack(skb, rx); |
2552 | } | 2552 | } |
2553 | 2553 | ||
diff --git a/net/netfilter/nf_conntrack_ftp.c b/net/netfilter/nf_conntrack_ftp.c index c57d2348c505..9eca90414bb7 100644 --- a/net/netfilter/nf_conntrack_ftp.c +++ b/net/netfilter/nf_conntrack_ftp.c | |||
@@ -322,7 +322,7 @@ static int find_pattern(const char *data, size_t dlen, | |||
322 | i++; | 322 | i++; |
323 | } | 323 | } |
324 | 324 | ||
325 | pr_debug("Skipped up to `%c'!\n", skip); | 325 | pr_debug("Skipped up to 0x%hhx delimiter!\n", skip); |
326 | 326 | ||
327 | *numoff = i; | 327 | *numoff = i; |
328 | *numlen = getnum(data + i, dlen - i, cmd, term, numoff); | 328 | *numlen = getnum(data + i, dlen - i, cmd, term, numoff); |
diff --git a/net/netfilter/nf_conntrack_standalone.c b/net/netfilter/nf_conntrack_standalone.c index d97f4ea47cf3..88d4127df863 100644 --- a/net/netfilter/nf_conntrack_standalone.c +++ b/net/netfilter/nf_conntrack_standalone.c | |||
@@ -1035,9 +1035,14 @@ static int nf_conntrack_standalone_init_sysctl(struct net *net) | |||
1035 | table[NF_SYSCTL_CT_COUNT].data = &net->ct.count; | 1035 | table[NF_SYSCTL_CT_COUNT].data = &net->ct.count; |
1036 | table[NF_SYSCTL_CT_CHECKSUM].data = &net->ct.sysctl_checksum; | 1036 | table[NF_SYSCTL_CT_CHECKSUM].data = &net->ct.sysctl_checksum; |
1037 | table[NF_SYSCTL_CT_LOG_INVALID].data = &net->ct.sysctl_log_invalid; | 1037 | table[NF_SYSCTL_CT_LOG_INVALID].data = &net->ct.sysctl_log_invalid; |
1038 | table[NF_SYSCTL_CT_ACCT].data = &net->ct.sysctl_acct; | ||
1039 | table[NF_SYSCTL_CT_HELPER].data = &net->ct.sysctl_auto_assign_helper; | ||
1038 | #ifdef CONFIG_NF_CONNTRACK_EVENTS | 1040 | #ifdef CONFIG_NF_CONNTRACK_EVENTS |
1039 | table[NF_SYSCTL_CT_EVENTS].data = &net->ct.sysctl_events; | 1041 | table[NF_SYSCTL_CT_EVENTS].data = &net->ct.sysctl_events; |
1040 | #endif | 1042 | #endif |
1043 | #ifdef CONFIG_NF_CONNTRACK_TIMESTAMP | ||
1044 | table[NF_SYSCTL_CT_TIMESTAMP].data = &net->ct.sysctl_tstamp; | ||
1045 | #endif | ||
1041 | table[NF_SYSCTL_CT_PROTO_TIMEOUT_GENERIC].data = &nf_generic_pernet(net)->timeout; | 1046 | table[NF_SYSCTL_CT_PROTO_TIMEOUT_GENERIC].data = &nf_generic_pernet(net)->timeout; |
1042 | table[NF_SYSCTL_CT_PROTO_TIMEOUT_ICMP].data = &nf_icmp_pernet(net)->timeout; | 1047 | table[NF_SYSCTL_CT_PROTO_TIMEOUT_ICMP].data = &nf_icmp_pernet(net)->timeout; |
1043 | table[NF_SYSCTL_CT_PROTO_TIMEOUT_ICMPV6].data = &nf_icmpv6_pernet(net)->timeout; | 1048 | table[NF_SYSCTL_CT_PROTO_TIMEOUT_ICMPV6].data = &nf_icmpv6_pernet(net)->timeout; |
diff --git a/net/netfilter/nf_flow_table_ip.c b/net/netfilter/nf_flow_table_ip.c index d68c801dd614..b9e7dd6e60ce 100644 --- a/net/netfilter/nf_flow_table_ip.c +++ b/net/netfilter/nf_flow_table_ip.c | |||
@@ -228,7 +228,6 @@ static unsigned int nf_flow_xmit_xfrm(struct sk_buff *skb, | |||
228 | { | 228 | { |
229 | skb_orphan(skb); | 229 | skb_orphan(skb); |
230 | skb_dst_set_noref(skb, dst); | 230 | skb_dst_set_noref(skb, dst); |
231 | skb->tstamp = 0; | ||
232 | dst_output(state->net, state->sk, skb); | 231 | dst_output(state->net, state->sk, skb); |
233 | return NF_STOLEN; | 232 | return NF_STOLEN; |
234 | } | 233 | } |
@@ -284,6 +283,7 @@ nf_flow_offload_ip_hook(void *priv, struct sk_buff *skb, | |||
284 | flow->timeout = (u32)jiffies + NF_FLOW_TIMEOUT; | 283 | flow->timeout = (u32)jiffies + NF_FLOW_TIMEOUT; |
285 | iph = ip_hdr(skb); | 284 | iph = ip_hdr(skb); |
286 | ip_decrease_ttl(iph); | 285 | ip_decrease_ttl(iph); |
286 | skb->tstamp = 0; | ||
287 | 287 | ||
288 | if (unlikely(dst_xfrm(&rt->dst))) { | 288 | if (unlikely(dst_xfrm(&rt->dst))) { |
289 | memset(skb->cb, 0, sizeof(struct inet_skb_parm)); | 289 | memset(skb->cb, 0, sizeof(struct inet_skb_parm)); |
@@ -512,6 +512,7 @@ nf_flow_offload_ipv6_hook(void *priv, struct sk_buff *skb, | |||
512 | flow->timeout = (u32)jiffies + NF_FLOW_TIMEOUT; | 512 | flow->timeout = (u32)jiffies + NF_FLOW_TIMEOUT; |
513 | ip6h = ipv6_hdr(skb); | 513 | ip6h = ipv6_hdr(skb); |
514 | ip6h->hop_limit--; | 514 | ip6h->hop_limit--; |
515 | skb->tstamp = 0; | ||
515 | 516 | ||
516 | if (unlikely(dst_xfrm(&rt->dst))) { | 517 | if (unlikely(dst_xfrm(&rt->dst))) { |
517 | memset(skb->cb, 0, sizeof(struct inet6_skb_parm)); | 518 | memset(skb->cb, 0, sizeof(struct inet6_skb_parm)); |
diff --git a/net/netfilter/xt_physdev.c b/net/netfilter/xt_physdev.c index ead7c6022208..b92b22ce8abd 100644 --- a/net/netfilter/xt_physdev.c +++ b/net/netfilter/xt_physdev.c | |||
@@ -101,11 +101,9 @@ static int physdev_mt_check(const struct xt_mtchk_param *par) | |||
101 | if (info->bitmask & (XT_PHYSDEV_OP_OUT | XT_PHYSDEV_OP_ISOUT) && | 101 | if (info->bitmask & (XT_PHYSDEV_OP_OUT | XT_PHYSDEV_OP_ISOUT) && |
102 | (!(info->bitmask & XT_PHYSDEV_OP_BRIDGED) || | 102 | (!(info->bitmask & XT_PHYSDEV_OP_BRIDGED) || |
103 | info->invert & XT_PHYSDEV_OP_BRIDGED) && | 103 | info->invert & XT_PHYSDEV_OP_BRIDGED) && |
104 | par->hook_mask & ((1 << NF_INET_LOCAL_OUT) | | 104 | par->hook_mask & (1 << NF_INET_LOCAL_OUT)) { |
105 | (1 << NF_INET_FORWARD) | (1 << NF_INET_POST_ROUTING))) { | ||
106 | pr_info_ratelimited("--physdev-out and --physdev-is-out only supported in the FORWARD and POSTROUTING chains with bridged traffic\n"); | 105 | pr_info_ratelimited("--physdev-out and --physdev-is-out only supported in the FORWARD and POSTROUTING chains with bridged traffic\n"); |
107 | if (par->hook_mask & (1 << NF_INET_LOCAL_OUT)) | 106 | return -EINVAL; |
108 | return -EINVAL; | ||
109 | } | 107 | } |
110 | 108 | ||
111 | if (!brnf_probed) { | 109 | if (!brnf_probed) { |
diff --git a/net/openvswitch/conntrack.c b/net/openvswitch/conntrack.c index d8da6477d6be..05249eb45082 100644 --- a/net/openvswitch/conntrack.c +++ b/net/openvswitch/conntrack.c | |||
@@ -525,6 +525,11 @@ static int handle_fragments(struct net *net, struct sw_flow_key *key, | |||
525 | return -EPFNOSUPPORT; | 525 | return -EPFNOSUPPORT; |
526 | } | 526 | } |
527 | 527 | ||
528 | /* The key extracted from the fragment that completed this datagram | ||
529 | * likely didn't have an L4 header, so regenerate it. | ||
530 | */ | ||
531 | ovs_flow_key_update_l3l4(skb, key); | ||
532 | |||
528 | key->ip.frag = OVS_FRAG_TYPE_NONE; | 533 | key->ip.frag = OVS_FRAG_TYPE_NONE; |
529 | skb_clear_hash(skb); | 534 | skb_clear_hash(skb); |
530 | skb->ignore_df = 1; | 535 | skb->ignore_df = 1; |
diff --git a/net/openvswitch/flow.c b/net/openvswitch/flow.c index bc89e16e0505..9d81d2c7bf82 100644 --- a/net/openvswitch/flow.c +++ b/net/openvswitch/flow.c | |||
@@ -523,78 +523,15 @@ static int parse_nsh(struct sk_buff *skb, struct sw_flow_key *key) | |||
523 | } | 523 | } |
524 | 524 | ||
525 | /** | 525 | /** |
526 | * key_extract - extracts a flow key from an Ethernet frame. | 526 | * key_extract_l3l4 - extracts L3/L4 header information. |
527 | * @skb: sk_buff that contains the frame, with skb->data pointing to the | 527 | * @skb: sk_buff that contains the frame, with skb->data pointing to the |
528 | * Ethernet header | 528 | * L3 header |
529 | * @key: output flow key | 529 | * @key: output flow key |
530 | * | 530 | * |
531 | * The caller must ensure that skb->len >= ETH_HLEN. | ||
532 | * | ||
533 | * Returns 0 if successful, otherwise a negative errno value. | ||
534 | * | ||
535 | * Initializes @skb header fields as follows: | ||
536 | * | ||
537 | * - skb->mac_header: the L2 header. | ||
538 | * | ||
539 | * - skb->network_header: just past the L2 header, or just past the | ||
540 | * VLAN header, to the first byte of the L2 payload. | ||
541 | * | ||
542 | * - skb->transport_header: If key->eth.type is ETH_P_IP or ETH_P_IPV6 | ||
543 | * on output, then just past the IP header, if one is present and | ||
544 | * of a correct length, otherwise the same as skb->network_header. | ||
545 | * For other key->eth.type values it is left untouched. | ||
546 | * | ||
547 | * - skb->protocol: the type of the data starting at skb->network_header. | ||
548 | * Equals to key->eth.type. | ||
549 | */ | 531 | */ |
550 | static int key_extract(struct sk_buff *skb, struct sw_flow_key *key) | 532 | static int key_extract_l3l4(struct sk_buff *skb, struct sw_flow_key *key) |
551 | { | 533 | { |
552 | int error; | 534 | int error; |
553 | struct ethhdr *eth; | ||
554 | |||
555 | /* Flags are always used as part of stats */ | ||
556 | key->tp.flags = 0; | ||
557 | |||
558 | skb_reset_mac_header(skb); | ||
559 | |||
560 | /* Link layer. */ | ||
561 | clear_vlan(key); | ||
562 | if (ovs_key_mac_proto(key) == MAC_PROTO_NONE) { | ||
563 | if (unlikely(eth_type_vlan(skb->protocol))) | ||
564 | return -EINVAL; | ||
565 | |||
566 | skb_reset_network_header(skb); | ||
567 | key->eth.type = skb->protocol; | ||
568 | } else { | ||
569 | eth = eth_hdr(skb); | ||
570 | ether_addr_copy(key->eth.src, eth->h_source); | ||
571 | ether_addr_copy(key->eth.dst, eth->h_dest); | ||
572 | |||
573 | __skb_pull(skb, 2 * ETH_ALEN); | ||
574 | /* We are going to push all headers that we pull, so no need to | ||
575 | * update skb->csum here. | ||
576 | */ | ||
577 | |||
578 | if (unlikely(parse_vlan(skb, key))) | ||
579 | return -ENOMEM; | ||
580 | |||
581 | key->eth.type = parse_ethertype(skb); | ||
582 | if (unlikely(key->eth.type == htons(0))) | ||
583 | return -ENOMEM; | ||
584 | |||
585 | /* Multiple tagged packets need to retain TPID to satisfy | ||
586 | * skb_vlan_pop(), which will later shift the ethertype into | ||
587 | * skb->protocol. | ||
588 | */ | ||
589 | if (key->eth.cvlan.tci & htons(VLAN_CFI_MASK)) | ||
590 | skb->protocol = key->eth.cvlan.tpid; | ||
591 | else | ||
592 | skb->protocol = key->eth.type; | ||
593 | |||
594 | skb_reset_network_header(skb); | ||
595 | __skb_push(skb, skb->data - skb_mac_header(skb)); | ||
596 | } | ||
597 | skb_reset_mac_len(skb); | ||
598 | 535 | ||
599 | /* Network layer. */ | 536 | /* Network layer. */ |
600 | if (key->eth.type == htons(ETH_P_IP)) { | 537 | if (key->eth.type == htons(ETH_P_IP)) { |
@@ -623,6 +560,7 @@ static int key_extract(struct sk_buff *skb, struct sw_flow_key *key) | |||
623 | offset = nh->frag_off & htons(IP_OFFSET); | 560 | offset = nh->frag_off & htons(IP_OFFSET); |
624 | if (offset) { | 561 | if (offset) { |
625 | key->ip.frag = OVS_FRAG_TYPE_LATER; | 562 | key->ip.frag = OVS_FRAG_TYPE_LATER; |
563 | memset(&key->tp, 0, sizeof(key->tp)); | ||
626 | return 0; | 564 | return 0; |
627 | } | 565 | } |
628 | if (nh->frag_off & htons(IP_MF) || | 566 | if (nh->frag_off & htons(IP_MF) || |
@@ -740,8 +678,10 @@ static int key_extract(struct sk_buff *skb, struct sw_flow_key *key) | |||
740 | return error; | 678 | return error; |
741 | } | 679 | } |
742 | 680 | ||
743 | if (key->ip.frag == OVS_FRAG_TYPE_LATER) | 681 | if (key->ip.frag == OVS_FRAG_TYPE_LATER) { |
682 | memset(&key->tp, 0, sizeof(key->tp)); | ||
744 | return 0; | 683 | return 0; |
684 | } | ||
745 | if (skb_shinfo(skb)->gso_type & SKB_GSO_UDP) | 685 | if (skb_shinfo(skb)->gso_type & SKB_GSO_UDP) |
746 | key->ip.frag = OVS_FRAG_TYPE_FIRST; | 686 | key->ip.frag = OVS_FRAG_TYPE_FIRST; |
747 | 687 | ||
@@ -788,6 +728,92 @@ static int key_extract(struct sk_buff *skb, struct sw_flow_key *key) | |||
788 | return 0; | 728 | return 0; |
789 | } | 729 | } |
790 | 730 | ||
731 | /** | ||
732 | * key_extract - extracts a flow key from an Ethernet frame. | ||
733 | * @skb: sk_buff that contains the frame, with skb->data pointing to the | ||
734 | * Ethernet header | ||
735 | * @key: output flow key | ||
736 | * | ||
737 | * The caller must ensure that skb->len >= ETH_HLEN. | ||
738 | * | ||
739 | * Returns 0 if successful, otherwise a negative errno value. | ||
740 | * | ||
741 | * Initializes @skb header fields as follows: | ||
742 | * | ||
743 | * - skb->mac_header: the L2 header. | ||
744 | * | ||
745 | * - skb->network_header: just past the L2 header, or just past the | ||
746 | * VLAN header, to the first byte of the L2 payload. | ||
747 | * | ||
748 | * - skb->transport_header: If key->eth.type is ETH_P_IP or ETH_P_IPV6 | ||
749 | * on output, then just past the IP header, if one is present and | ||
750 | * of a correct length, otherwise the same as skb->network_header. | ||
751 | * For other key->eth.type values it is left untouched. | ||
752 | * | ||
753 | * - skb->protocol: the type of the data starting at skb->network_header. | ||
754 | * Equals to key->eth.type. | ||
755 | */ | ||
756 | static int key_extract(struct sk_buff *skb, struct sw_flow_key *key) | ||
757 | { | ||
758 | struct ethhdr *eth; | ||
759 | |||
760 | /* Flags are always used as part of stats */ | ||
761 | key->tp.flags = 0; | ||
762 | |||
763 | skb_reset_mac_header(skb); | ||
764 | |||
765 | /* Link layer. */ | ||
766 | clear_vlan(key); | ||
767 | if (ovs_key_mac_proto(key) == MAC_PROTO_NONE) { | ||
768 | if (unlikely(eth_type_vlan(skb->protocol))) | ||
769 | return -EINVAL; | ||
770 | |||
771 | skb_reset_network_header(skb); | ||
772 | key->eth.type = skb->protocol; | ||
773 | } else { | ||
774 | eth = eth_hdr(skb); | ||
775 | ether_addr_copy(key->eth.src, eth->h_source); | ||
776 | ether_addr_copy(key->eth.dst, eth->h_dest); | ||
777 | |||
778 | __skb_pull(skb, 2 * ETH_ALEN); | ||
779 | /* We are going to push all headers that we pull, so no need to | ||
780 | * update skb->csum here. | ||
781 | */ | ||
782 | |||
783 | if (unlikely(parse_vlan(skb, key))) | ||
784 | return -ENOMEM; | ||
785 | |||
786 | key->eth.type = parse_ethertype(skb); | ||
787 | if (unlikely(key->eth.type == htons(0))) | ||
788 | return -ENOMEM; | ||
789 | |||
790 | /* Multiple tagged packets need to retain TPID to satisfy | ||
791 | * skb_vlan_pop(), which will later shift the ethertype into | ||
792 | * skb->protocol. | ||
793 | */ | ||
794 | if (key->eth.cvlan.tci & htons(VLAN_CFI_MASK)) | ||
795 | skb->protocol = key->eth.cvlan.tpid; | ||
796 | else | ||
797 | skb->protocol = key->eth.type; | ||
798 | |||
799 | skb_reset_network_header(skb); | ||
800 | __skb_push(skb, skb->data - skb_mac_header(skb)); | ||
801 | } | ||
802 | |||
803 | skb_reset_mac_len(skb); | ||
804 | |||
805 | /* Fill out L3/L4 key info, if any */ | ||
806 | return key_extract_l3l4(skb, key); | ||
807 | } | ||
808 | |||
809 | /* In the case of conntrack fragment handling it expects L3 headers, | ||
810 | * add a helper. | ||
811 | */ | ||
812 | int ovs_flow_key_update_l3l4(struct sk_buff *skb, struct sw_flow_key *key) | ||
813 | { | ||
814 | return key_extract_l3l4(skb, key); | ||
815 | } | ||
816 | |||
791 | int ovs_flow_key_update(struct sk_buff *skb, struct sw_flow_key *key) | 817 | int ovs_flow_key_update(struct sk_buff *skb, struct sw_flow_key *key) |
792 | { | 818 | { |
793 | int res; | 819 | int res; |
diff --git a/net/openvswitch/flow.h b/net/openvswitch/flow.h index a5506e2d4b7a..b830d5ff7af4 100644 --- a/net/openvswitch/flow.h +++ b/net/openvswitch/flow.h | |||
@@ -270,6 +270,7 @@ void ovs_flow_stats_clear(struct sw_flow *); | |||
270 | u64 ovs_flow_used_time(unsigned long flow_jiffies); | 270 | u64 ovs_flow_used_time(unsigned long flow_jiffies); |
271 | 271 | ||
272 | int ovs_flow_key_update(struct sk_buff *skb, struct sw_flow_key *key); | 272 | int ovs_flow_key_update(struct sk_buff *skb, struct sw_flow_key *key); |
273 | int ovs_flow_key_update_l3l4(struct sk_buff *skb, struct sw_flow_key *key); | ||
273 | int ovs_flow_key_extract(const struct ip_tunnel_info *tun_info, | 274 | int ovs_flow_key_extract(const struct ip_tunnel_info *tun_info, |
274 | struct sk_buff *skb, | 275 | struct sk_buff *skb, |
275 | struct sw_flow_key *key); | 276 | struct sw_flow_key *key); |
diff --git a/net/psample/psample.c b/net/psample/psample.c index 841f198ea1a8..66e4b61a350d 100644 --- a/net/psample/psample.c +++ b/net/psample/psample.c | |||
@@ -154,7 +154,7 @@ static void psample_group_destroy(struct psample_group *group) | |||
154 | { | 154 | { |
155 | psample_group_notify(group, PSAMPLE_CMD_DEL_GROUP); | 155 | psample_group_notify(group, PSAMPLE_CMD_DEL_GROUP); |
156 | list_del(&group->list); | 156 | list_del(&group->list); |
157 | kfree(group); | 157 | kfree_rcu(group, rcu); |
158 | } | 158 | } |
159 | 159 | ||
160 | static struct psample_group * | 160 | static struct psample_group * |
diff --git a/net/rds/recv.c b/net/rds/recv.c index 7e451c82595b..c8404971d5ab 100644 --- a/net/rds/recv.c +++ b/net/rds/recv.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (c) 2006, 2018 Oracle and/or its affiliates. All rights reserved. | 2 | * Copyright (c) 2006, 2019 Oracle and/or its affiliates. All rights reserved. |
3 | * | 3 | * |
4 | * This software is available to you under a choice of one of two | 4 | * This software is available to you under a choice of one of two |
5 | * licenses. You may choose to be licensed under the terms of the GNU | 5 | * licenses. You may choose to be licensed under the terms of the GNU |
@@ -813,6 +813,7 @@ void rds6_inc_info_copy(struct rds_incoming *inc, | |||
813 | 813 | ||
814 | minfo6.seq = be64_to_cpu(inc->i_hdr.h_sequence); | 814 | minfo6.seq = be64_to_cpu(inc->i_hdr.h_sequence); |
815 | minfo6.len = be32_to_cpu(inc->i_hdr.h_len); | 815 | minfo6.len = be32_to_cpu(inc->i_hdr.h_len); |
816 | minfo6.tos = inc->i_conn->c_tos; | ||
816 | 817 | ||
817 | if (flip) { | 818 | if (flip) { |
818 | minfo6.laddr = *daddr; | 819 | minfo6.laddr = *daddr; |
@@ -826,6 +827,8 @@ void rds6_inc_info_copy(struct rds_incoming *inc, | |||
826 | minfo6.fport = inc->i_hdr.h_dport; | 827 | minfo6.fport = inc->i_hdr.h_dport; |
827 | } | 828 | } |
828 | 829 | ||
830 | minfo6.flags = 0; | ||
831 | |||
829 | rds_info_copy(iter, &minfo6, sizeof(minfo6)); | 832 | rds_info_copy(iter, &minfo6, sizeof(minfo6)); |
830 | } | 833 | } |
831 | #endif | 834 | #endif |
diff --git a/net/rxrpc/af_rxrpc.c b/net/rxrpc/af_rxrpc.c index 0dbbfd1b6487..d72ddb67bb74 100644 --- a/net/rxrpc/af_rxrpc.c +++ b/net/rxrpc/af_rxrpc.c | |||
@@ -862,7 +862,6 @@ static void rxrpc_sock_destructor(struct sock *sk) | |||
862 | static int rxrpc_release_sock(struct sock *sk) | 862 | static int rxrpc_release_sock(struct sock *sk) |
863 | { | 863 | { |
864 | struct rxrpc_sock *rx = rxrpc_sk(sk); | 864 | struct rxrpc_sock *rx = rxrpc_sk(sk); |
865 | struct rxrpc_net *rxnet = rxrpc_net(sock_net(&rx->sk)); | ||
866 | 865 | ||
867 | _enter("%p{%d,%d}", sk, sk->sk_state, refcount_read(&sk->sk_refcnt)); | 866 | _enter("%p{%d,%d}", sk, sk->sk_state, refcount_read(&sk->sk_refcnt)); |
868 | 867 | ||
@@ -898,8 +897,6 @@ static int rxrpc_release_sock(struct sock *sk) | |||
898 | rxrpc_release_calls_on_socket(rx); | 897 | rxrpc_release_calls_on_socket(rx); |
899 | flush_workqueue(rxrpc_workqueue); | 898 | flush_workqueue(rxrpc_workqueue); |
900 | rxrpc_purge_queue(&sk->sk_receive_queue); | 899 | rxrpc_purge_queue(&sk->sk_receive_queue); |
901 | rxrpc_queue_work(&rxnet->service_conn_reaper); | ||
902 | rxrpc_queue_work(&rxnet->client_conn_reaper); | ||
903 | 900 | ||
904 | rxrpc_unuse_local(rx->local); | 901 | rxrpc_unuse_local(rx->local); |
905 | rx->local = NULL; | 902 | rx->local = NULL; |
diff --git a/net/rxrpc/ar-internal.h b/net/rxrpc/ar-internal.h index fa5b030acaa8..1091bf35a199 100644 --- a/net/rxrpc/ar-internal.h +++ b/net/rxrpc/ar-internal.h | |||
@@ -185,11 +185,17 @@ struct rxrpc_host_header { | |||
185 | * - max 48 bytes (struct sk_buff::cb) | 185 | * - max 48 bytes (struct sk_buff::cb) |
186 | */ | 186 | */ |
187 | struct rxrpc_skb_priv { | 187 | struct rxrpc_skb_priv { |
188 | union { | 188 | atomic_t nr_ring_pins; /* Number of rxtx ring pins */ |
189 | u8 nr_jumbo; /* Number of jumbo subpackets */ | 189 | u8 nr_subpackets; /* Number of subpackets */ |
190 | }; | 190 | u8 rx_flags; /* Received packet flags */ |
191 | #define RXRPC_SKB_INCL_LAST 0x01 /* - Includes last packet */ | ||
192 | #define RXRPC_SKB_TX_BUFFER 0x02 /* - Is transmit buffer */ | ||
191 | union { | 193 | union { |
192 | int remain; /* amount of space remaining for next write */ | 194 | int remain; /* amount of space remaining for next write */ |
195 | |||
196 | /* List of requested ACKs on subpackets */ | ||
197 | unsigned long rx_req_ack[(RXRPC_MAX_NR_JUMBO + BITS_PER_LONG - 1) / | ||
198 | BITS_PER_LONG]; | ||
193 | }; | 199 | }; |
194 | 200 | ||
195 | struct rxrpc_host_header hdr; /* RxRPC packet header from this packet */ | 201 | struct rxrpc_host_header hdr; /* RxRPC packet header from this packet */ |
@@ -617,8 +623,7 @@ struct rxrpc_call { | |||
617 | #define RXRPC_TX_ANNO_LAST 0x04 | 623 | #define RXRPC_TX_ANNO_LAST 0x04 |
618 | #define RXRPC_TX_ANNO_RESENT 0x08 | 624 | #define RXRPC_TX_ANNO_RESENT 0x08 |
619 | 625 | ||
620 | #define RXRPC_RX_ANNO_JUMBO 0x3f /* Jumbo subpacket number + 1 if not zero */ | 626 | #define RXRPC_RX_ANNO_SUBPACKET 0x3f /* Subpacket number in jumbogram */ |
621 | #define RXRPC_RX_ANNO_JLAST 0x40 /* Set if last element of a jumbo packet */ | ||
622 | #define RXRPC_RX_ANNO_VERIFIED 0x80 /* Set if verified and decrypted */ | 627 | #define RXRPC_RX_ANNO_VERIFIED 0x80 /* Set if verified and decrypted */ |
623 | rxrpc_seq_t tx_hard_ack; /* Dead slot in buffer; the first transmitted but | 628 | rxrpc_seq_t tx_hard_ack; /* Dead slot in buffer; the first transmitted but |
624 | * not hard-ACK'd packet follows this. | 629 | * not hard-ACK'd packet follows this. |
@@ -909,6 +914,7 @@ void rxrpc_disconnect_client_call(struct rxrpc_call *); | |||
909 | void rxrpc_put_client_conn(struct rxrpc_connection *); | 914 | void rxrpc_put_client_conn(struct rxrpc_connection *); |
910 | void rxrpc_discard_expired_client_conns(struct work_struct *); | 915 | void rxrpc_discard_expired_client_conns(struct work_struct *); |
911 | void rxrpc_destroy_all_client_connections(struct rxrpc_net *); | 916 | void rxrpc_destroy_all_client_connections(struct rxrpc_net *); |
917 | void rxrpc_clean_up_local_conns(struct rxrpc_local *); | ||
912 | 918 | ||
913 | /* | 919 | /* |
914 | * conn_event.c | 920 | * conn_event.c |
@@ -1109,6 +1115,7 @@ void rxrpc_kernel_data_consumed(struct rxrpc_call *, struct sk_buff *); | |||
1109 | void rxrpc_packet_destructor(struct sk_buff *); | 1115 | void rxrpc_packet_destructor(struct sk_buff *); |
1110 | void rxrpc_new_skb(struct sk_buff *, enum rxrpc_skb_trace); | 1116 | void rxrpc_new_skb(struct sk_buff *, enum rxrpc_skb_trace); |
1111 | void rxrpc_see_skb(struct sk_buff *, enum rxrpc_skb_trace); | 1117 | void rxrpc_see_skb(struct sk_buff *, enum rxrpc_skb_trace); |
1118 | void rxrpc_eaten_skb(struct sk_buff *, enum rxrpc_skb_trace); | ||
1112 | void rxrpc_get_skb(struct sk_buff *, enum rxrpc_skb_trace); | 1119 | void rxrpc_get_skb(struct sk_buff *, enum rxrpc_skb_trace); |
1113 | void rxrpc_free_skb(struct sk_buff *, enum rxrpc_skb_trace); | 1120 | void rxrpc_free_skb(struct sk_buff *, enum rxrpc_skb_trace); |
1114 | void rxrpc_purge_queue(struct sk_buff_head *); | 1121 | void rxrpc_purge_queue(struct sk_buff_head *); |
diff --git a/net/rxrpc/call_event.c b/net/rxrpc/call_event.c index c767679bfa5d..cedbbb3a7c2e 100644 --- a/net/rxrpc/call_event.c +++ b/net/rxrpc/call_event.c | |||
@@ -199,7 +199,7 @@ static void rxrpc_resend(struct rxrpc_call *call, unsigned long now_j) | |||
199 | continue; | 199 | continue; |
200 | 200 | ||
201 | skb = call->rxtx_buffer[ix]; | 201 | skb = call->rxtx_buffer[ix]; |
202 | rxrpc_see_skb(skb, rxrpc_skb_tx_seen); | 202 | rxrpc_see_skb(skb, rxrpc_skb_seen); |
203 | 203 | ||
204 | if (anno_type == RXRPC_TX_ANNO_UNACK) { | 204 | if (anno_type == RXRPC_TX_ANNO_UNACK) { |
205 | if (ktime_after(skb->tstamp, max_age)) { | 205 | if (ktime_after(skb->tstamp, max_age)) { |
@@ -255,18 +255,18 @@ static void rxrpc_resend(struct rxrpc_call *call, unsigned long now_j) | |||
255 | continue; | 255 | continue; |
256 | 256 | ||
257 | skb = call->rxtx_buffer[ix]; | 257 | skb = call->rxtx_buffer[ix]; |
258 | rxrpc_get_skb(skb, rxrpc_skb_tx_got); | 258 | rxrpc_get_skb(skb, rxrpc_skb_got); |
259 | spin_unlock_bh(&call->lock); | 259 | spin_unlock_bh(&call->lock); |
260 | 260 | ||
261 | if (rxrpc_send_data_packet(call, skb, true) < 0) { | 261 | if (rxrpc_send_data_packet(call, skb, true) < 0) { |
262 | rxrpc_free_skb(skb, rxrpc_skb_tx_freed); | 262 | rxrpc_free_skb(skb, rxrpc_skb_freed); |
263 | return; | 263 | return; |
264 | } | 264 | } |
265 | 265 | ||
266 | if (rxrpc_is_client_call(call)) | 266 | if (rxrpc_is_client_call(call)) |
267 | rxrpc_expose_client_call(call); | 267 | rxrpc_expose_client_call(call); |
268 | 268 | ||
269 | rxrpc_free_skb(skb, rxrpc_skb_tx_freed); | 269 | rxrpc_free_skb(skb, rxrpc_skb_freed); |
270 | spin_lock_bh(&call->lock); | 270 | spin_lock_bh(&call->lock); |
271 | 271 | ||
272 | /* We need to clear the retransmit state, but there are two | 272 | /* We need to clear the retransmit state, but there are two |
diff --git a/net/rxrpc/call_object.c b/net/rxrpc/call_object.c index 60cbc81dc461..32d8dc677142 100644 --- a/net/rxrpc/call_object.c +++ b/net/rxrpc/call_object.c | |||
@@ -422,6 +422,19 @@ void rxrpc_get_call(struct rxrpc_call *call, enum rxrpc_call_trace op) | |||
422 | } | 422 | } |
423 | 423 | ||
424 | /* | 424 | /* |
425 | * Clean up the RxTx skb ring. | ||
426 | */ | ||
427 | static void rxrpc_cleanup_ring(struct rxrpc_call *call) | ||
428 | { | ||
429 | int i; | ||
430 | |||
431 | for (i = 0; i < RXRPC_RXTX_BUFF_SIZE; i++) { | ||
432 | rxrpc_free_skb(call->rxtx_buffer[i], rxrpc_skb_cleaned); | ||
433 | call->rxtx_buffer[i] = NULL; | ||
434 | } | ||
435 | } | ||
436 | |||
437 | /* | ||
425 | * Detach a call from its owning socket. | 438 | * Detach a call from its owning socket. |
426 | */ | 439 | */ |
427 | void rxrpc_release_call(struct rxrpc_sock *rx, struct rxrpc_call *call) | 440 | void rxrpc_release_call(struct rxrpc_sock *rx, struct rxrpc_call *call) |
@@ -429,7 +442,6 @@ void rxrpc_release_call(struct rxrpc_sock *rx, struct rxrpc_call *call) | |||
429 | const void *here = __builtin_return_address(0); | 442 | const void *here = __builtin_return_address(0); |
430 | struct rxrpc_connection *conn = call->conn; | 443 | struct rxrpc_connection *conn = call->conn; |
431 | bool put = false; | 444 | bool put = false; |
432 | int i; | ||
433 | 445 | ||
434 | _enter("{%d,%d}", call->debug_id, atomic_read(&call->usage)); | 446 | _enter("{%d,%d}", call->debug_id, atomic_read(&call->usage)); |
435 | 447 | ||
@@ -481,13 +493,7 @@ void rxrpc_release_call(struct rxrpc_sock *rx, struct rxrpc_call *call) | |||
481 | conn->security->free_call_crypto(call); | 493 | conn->security->free_call_crypto(call); |
482 | } | 494 | } |
483 | 495 | ||
484 | for (i = 0; i < RXRPC_RXTX_BUFF_SIZE; i++) { | 496 | rxrpc_cleanup_ring(call); |
485 | rxrpc_free_skb(call->rxtx_buffer[i], | ||
486 | (call->tx_phase ? rxrpc_skb_tx_cleaned : | ||
487 | rxrpc_skb_rx_cleaned)); | ||
488 | call->rxtx_buffer[i] = NULL; | ||
489 | } | ||
490 | |||
491 | _leave(""); | 497 | _leave(""); |
492 | } | 498 | } |
493 | 499 | ||
@@ -570,8 +576,6 @@ static void rxrpc_rcu_destroy_call(struct rcu_head *rcu) | |||
570 | */ | 576 | */ |
571 | void rxrpc_cleanup_call(struct rxrpc_call *call) | 577 | void rxrpc_cleanup_call(struct rxrpc_call *call) |
572 | { | 578 | { |
573 | int i; | ||
574 | |||
575 | _net("DESTROY CALL %d", call->debug_id); | 579 | _net("DESTROY CALL %d", call->debug_id); |
576 | 580 | ||
577 | memset(&call->sock_node, 0xcd, sizeof(call->sock_node)); | 581 | memset(&call->sock_node, 0xcd, sizeof(call->sock_node)); |
@@ -582,13 +586,8 @@ void rxrpc_cleanup_call(struct rxrpc_call *call) | |||
582 | ASSERT(test_bit(RXRPC_CALL_RELEASED, &call->flags)); | 586 | ASSERT(test_bit(RXRPC_CALL_RELEASED, &call->flags)); |
583 | ASSERTCMP(call->conn, ==, NULL); | 587 | ASSERTCMP(call->conn, ==, NULL); |
584 | 588 | ||
585 | /* Clean up the Rx/Tx buffer */ | 589 | rxrpc_cleanup_ring(call); |
586 | for (i = 0; i < RXRPC_RXTX_BUFF_SIZE; i++) | 590 | rxrpc_free_skb(call->tx_pending, rxrpc_skb_cleaned); |
587 | rxrpc_free_skb(call->rxtx_buffer[i], | ||
588 | (call->tx_phase ? rxrpc_skb_tx_cleaned : | ||
589 | rxrpc_skb_rx_cleaned)); | ||
590 | |||
591 | rxrpc_free_skb(call->tx_pending, rxrpc_skb_tx_cleaned); | ||
592 | 591 | ||
593 | call_rcu(&call->rcu, rxrpc_rcu_destroy_call); | 592 | call_rcu(&call->rcu, rxrpc_rcu_destroy_call); |
594 | } | 593 | } |
diff --git a/net/rxrpc/conn_client.c b/net/rxrpc/conn_client.c index aea82f909c60..3f1da1b49f69 100644 --- a/net/rxrpc/conn_client.c +++ b/net/rxrpc/conn_client.c | |||
@@ -1162,3 +1162,47 @@ void rxrpc_destroy_all_client_connections(struct rxrpc_net *rxnet) | |||
1162 | 1162 | ||
1163 | _leave(""); | 1163 | _leave(""); |
1164 | } | 1164 | } |
1165 | |||
1166 | /* | ||
1167 | * Clean up the client connections on a local endpoint. | ||
1168 | */ | ||
1169 | void rxrpc_clean_up_local_conns(struct rxrpc_local *local) | ||
1170 | { | ||
1171 | struct rxrpc_connection *conn, *tmp; | ||
1172 | struct rxrpc_net *rxnet = local->rxnet; | ||
1173 | unsigned int nr_active; | ||
1174 | LIST_HEAD(graveyard); | ||
1175 | |||
1176 | _enter(""); | ||
1177 | |||
1178 | spin_lock(&rxnet->client_conn_cache_lock); | ||
1179 | nr_active = rxnet->nr_active_client_conns; | ||
1180 | |||
1181 | list_for_each_entry_safe(conn, tmp, &rxnet->idle_client_conns, | ||
1182 | cache_link) { | ||
1183 | if (conn->params.local == local) { | ||
1184 | ASSERTCMP(conn->cache_state, ==, RXRPC_CONN_CLIENT_IDLE); | ||
1185 | |||
1186 | trace_rxrpc_client(conn, -1, rxrpc_client_discard); | ||
1187 | if (!test_and_clear_bit(RXRPC_CONN_EXPOSED, &conn->flags)) | ||
1188 | BUG(); | ||
1189 | conn->cache_state = RXRPC_CONN_CLIENT_INACTIVE; | ||
1190 | list_move(&conn->cache_link, &graveyard); | ||
1191 | nr_active--; | ||
1192 | } | ||
1193 | } | ||
1194 | |||
1195 | rxnet->nr_active_client_conns = nr_active; | ||
1196 | spin_unlock(&rxnet->client_conn_cache_lock); | ||
1197 | ASSERTCMP(nr_active, >=, 0); | ||
1198 | |||
1199 | while (!list_empty(&graveyard)) { | ||
1200 | conn = list_entry(graveyard.next, | ||
1201 | struct rxrpc_connection, cache_link); | ||
1202 | list_del_init(&conn->cache_link); | ||
1203 | |||
1204 | rxrpc_put_connection(conn); | ||
1205 | } | ||
1206 | |||
1207 | _leave(" [culled]"); | ||
1208 | } | ||
diff --git a/net/rxrpc/conn_event.c b/net/rxrpc/conn_event.c index df6624c140be..a1ceef4f5cd0 100644 --- a/net/rxrpc/conn_event.c +++ b/net/rxrpc/conn_event.c | |||
@@ -472,7 +472,7 @@ void rxrpc_process_connection(struct work_struct *work) | |||
472 | /* go through the conn-level event packets, releasing the ref on this | 472 | /* go through the conn-level event packets, releasing the ref on this |
473 | * connection that each one has when we've finished with it */ | 473 | * connection that each one has when we've finished with it */ |
474 | while ((skb = skb_dequeue(&conn->rx_queue))) { | 474 | while ((skb = skb_dequeue(&conn->rx_queue))) { |
475 | rxrpc_see_skb(skb, rxrpc_skb_rx_seen); | 475 | rxrpc_see_skb(skb, rxrpc_skb_seen); |
476 | ret = rxrpc_process_event(conn, skb, &abort_code); | 476 | ret = rxrpc_process_event(conn, skb, &abort_code); |
477 | switch (ret) { | 477 | switch (ret) { |
478 | case -EPROTO: | 478 | case -EPROTO: |
@@ -484,7 +484,7 @@ void rxrpc_process_connection(struct work_struct *work) | |||
484 | goto requeue_and_leave; | 484 | goto requeue_and_leave; |
485 | case -ECONNABORTED: | 485 | case -ECONNABORTED: |
486 | default: | 486 | default: |
487 | rxrpc_free_skb(skb, rxrpc_skb_rx_freed); | 487 | rxrpc_free_skb(skb, rxrpc_skb_freed); |
488 | break; | 488 | break; |
489 | } | 489 | } |
490 | } | 490 | } |
@@ -501,6 +501,6 @@ requeue_and_leave: | |||
501 | protocol_error: | 501 | protocol_error: |
502 | if (rxrpc_abort_connection(conn, ret, abort_code) < 0) | 502 | if (rxrpc_abort_connection(conn, ret, abort_code) < 0) |
503 | goto requeue_and_leave; | 503 | goto requeue_and_leave; |
504 | rxrpc_free_skb(skb, rxrpc_skb_rx_freed); | 504 | rxrpc_free_skb(skb, rxrpc_skb_freed); |
505 | goto out; | 505 | goto out; |
506 | } | 506 | } |
diff --git a/net/rxrpc/conn_object.c b/net/rxrpc/conn_object.c index 434ef392212b..ed05b6922132 100644 --- a/net/rxrpc/conn_object.c +++ b/net/rxrpc/conn_object.c | |||
@@ -398,7 +398,7 @@ void rxrpc_service_connection_reaper(struct work_struct *work) | |||
398 | if (conn->state == RXRPC_CONN_SERVICE_PREALLOC) | 398 | if (conn->state == RXRPC_CONN_SERVICE_PREALLOC) |
399 | continue; | 399 | continue; |
400 | 400 | ||
401 | if (rxnet->live) { | 401 | if (rxnet->live && !conn->params.local->dead) { |
402 | idle_timestamp = READ_ONCE(conn->idle_timestamp); | 402 | idle_timestamp = READ_ONCE(conn->idle_timestamp); |
403 | expire_at = idle_timestamp + rxrpc_connection_expiry * HZ; | 403 | expire_at = idle_timestamp + rxrpc_connection_expiry * HZ; |
404 | if (conn->params.local->service_closed) | 404 | if (conn->params.local->service_closed) |
diff --git a/net/rxrpc/input.c b/net/rxrpc/input.c index dd47d465d1d3..d122c53c8697 100644 --- a/net/rxrpc/input.c +++ b/net/rxrpc/input.c | |||
@@ -233,7 +233,7 @@ static bool rxrpc_rotate_tx_window(struct rxrpc_call *call, rxrpc_seq_t to, | |||
233 | ix = call->tx_hard_ack & RXRPC_RXTX_BUFF_MASK; | 233 | ix = call->tx_hard_ack & RXRPC_RXTX_BUFF_MASK; |
234 | skb = call->rxtx_buffer[ix]; | 234 | skb = call->rxtx_buffer[ix]; |
235 | annotation = call->rxtx_annotations[ix]; | 235 | annotation = call->rxtx_annotations[ix]; |
236 | rxrpc_see_skb(skb, rxrpc_skb_tx_rotated); | 236 | rxrpc_see_skb(skb, rxrpc_skb_rotated); |
237 | call->rxtx_buffer[ix] = NULL; | 237 | call->rxtx_buffer[ix] = NULL; |
238 | call->rxtx_annotations[ix] = 0; | 238 | call->rxtx_annotations[ix] = 0; |
239 | skb->next = list; | 239 | skb->next = list; |
@@ -258,7 +258,7 @@ static bool rxrpc_rotate_tx_window(struct rxrpc_call *call, rxrpc_seq_t to, | |||
258 | skb = list; | 258 | skb = list; |
259 | list = skb->next; | 259 | list = skb->next; |
260 | skb_mark_not_on_list(skb); | 260 | skb_mark_not_on_list(skb); |
261 | rxrpc_free_skb(skb, rxrpc_skb_tx_freed); | 261 | rxrpc_free_skb(skb, rxrpc_skb_freed); |
262 | } | 262 | } |
263 | 263 | ||
264 | return rot_last; | 264 | return rot_last; |
@@ -347,7 +347,7 @@ static bool rxrpc_receiving_reply(struct rxrpc_call *call) | |||
347 | } | 347 | } |
348 | 348 | ||
349 | /* | 349 | /* |
350 | * Scan a jumbo packet to validate its structure and to work out how many | 350 | * Scan a data packet to validate its structure and to work out how many |
351 | * subpackets it contains. | 351 | * subpackets it contains. |
352 | * | 352 | * |
353 | * A jumbo packet is a collection of consecutive packets glued together with | 353 | * A jumbo packet is a collection of consecutive packets glued together with |
@@ -358,16 +358,21 @@ static bool rxrpc_receiving_reply(struct rxrpc_call *call) | |||
358 | * the last are RXRPC_JUMBO_DATALEN in size. The last subpacket may be of any | 358 | * the last are RXRPC_JUMBO_DATALEN in size. The last subpacket may be of any |
359 | * size. | 359 | * size. |
360 | */ | 360 | */ |
361 | static bool rxrpc_validate_jumbo(struct sk_buff *skb) | 361 | static bool rxrpc_validate_data(struct sk_buff *skb) |
362 | { | 362 | { |
363 | struct rxrpc_skb_priv *sp = rxrpc_skb(skb); | 363 | struct rxrpc_skb_priv *sp = rxrpc_skb(skb); |
364 | unsigned int offset = sizeof(struct rxrpc_wire_header); | 364 | unsigned int offset = sizeof(struct rxrpc_wire_header); |
365 | unsigned int len = skb->len; | 365 | unsigned int len = skb->len; |
366 | int nr_jumbo = 1; | ||
367 | u8 flags = sp->hdr.flags; | 366 | u8 flags = sp->hdr.flags; |
368 | 367 | ||
369 | do { | 368 | for (;;) { |
370 | nr_jumbo++; | 369 | if (flags & RXRPC_REQUEST_ACK) |
370 | __set_bit(sp->nr_subpackets, sp->rx_req_ack); | ||
371 | sp->nr_subpackets++; | ||
372 | |||
373 | if (!(flags & RXRPC_JUMBO_PACKET)) | ||
374 | break; | ||
375 | |||
371 | if (len - offset < RXRPC_JUMBO_SUBPKTLEN) | 376 | if (len - offset < RXRPC_JUMBO_SUBPKTLEN) |
372 | goto protocol_error; | 377 | goto protocol_error; |
373 | if (flags & RXRPC_LAST_PACKET) | 378 | if (flags & RXRPC_LAST_PACKET) |
@@ -376,9 +381,10 @@ static bool rxrpc_validate_jumbo(struct sk_buff *skb) | |||
376 | if (skb_copy_bits(skb, offset, &flags, 1) < 0) | 381 | if (skb_copy_bits(skb, offset, &flags, 1) < 0) |
377 | goto protocol_error; | 382 | goto protocol_error; |
378 | offset += sizeof(struct rxrpc_jumbo_header); | 383 | offset += sizeof(struct rxrpc_jumbo_header); |
379 | } while (flags & RXRPC_JUMBO_PACKET); | 384 | } |
380 | 385 | ||
381 | sp->nr_jumbo = nr_jumbo; | 386 | if (flags & RXRPC_LAST_PACKET) |
387 | sp->rx_flags |= RXRPC_SKB_INCL_LAST; | ||
382 | return true; | 388 | return true; |
383 | 389 | ||
384 | protocol_error: | 390 | protocol_error: |
@@ -399,10 +405,10 @@ protocol_error: | |||
399 | * (that information is encoded in the ACK packet). | 405 | * (that information is encoded in the ACK packet). |
400 | */ | 406 | */ |
401 | static void rxrpc_input_dup_data(struct rxrpc_call *call, rxrpc_seq_t seq, | 407 | static void rxrpc_input_dup_data(struct rxrpc_call *call, rxrpc_seq_t seq, |
402 | u8 annotation, bool *_jumbo_bad) | 408 | bool is_jumbo, bool *_jumbo_bad) |
403 | { | 409 | { |
404 | /* Discard normal packets that are duplicates. */ | 410 | /* Discard normal packets that are duplicates. */ |
405 | if (annotation == 0) | 411 | if (is_jumbo) |
406 | return; | 412 | return; |
407 | 413 | ||
408 | /* Skip jumbo subpackets that are duplicates. When we've had three or | 414 | /* Skip jumbo subpackets that are duplicates. When we've had three or |
@@ -416,29 +422,30 @@ static void rxrpc_input_dup_data(struct rxrpc_call *call, rxrpc_seq_t seq, | |||
416 | } | 422 | } |
417 | 423 | ||
418 | /* | 424 | /* |
419 | * Process a DATA packet, adding the packet to the Rx ring. | 425 | * Process a DATA packet, adding the packet to the Rx ring. The caller's |
426 | * packet ref must be passed on or discarded. | ||
420 | */ | 427 | */ |
421 | static void rxrpc_input_data(struct rxrpc_call *call, struct sk_buff *skb) | 428 | static void rxrpc_input_data(struct rxrpc_call *call, struct sk_buff *skb) |
422 | { | 429 | { |
423 | struct rxrpc_skb_priv *sp = rxrpc_skb(skb); | 430 | struct rxrpc_skb_priv *sp = rxrpc_skb(skb); |
424 | enum rxrpc_call_state state; | 431 | enum rxrpc_call_state state; |
425 | unsigned int offset = sizeof(struct rxrpc_wire_header); | 432 | unsigned int j; |
426 | unsigned int ix; | ||
427 | rxrpc_serial_t serial = sp->hdr.serial, ack_serial = 0; | 433 | rxrpc_serial_t serial = sp->hdr.serial, ack_serial = 0; |
428 | rxrpc_seq_t seq = sp->hdr.seq, hard_ack; | 434 | rxrpc_seq_t seq0 = sp->hdr.seq, hard_ack; |
429 | bool immediate_ack = false, jumbo_bad = false, queued; | 435 | bool immediate_ack = false, jumbo_bad = false; |
430 | u16 len; | 436 | u8 ack = 0; |
431 | u8 ack = 0, flags, annotation = 0; | ||
432 | 437 | ||
433 | _enter("{%u,%u},{%u,%u}", | 438 | _enter("{%u,%u},{%u,%u}", |
434 | call->rx_hard_ack, call->rx_top, skb->len, seq); | 439 | call->rx_hard_ack, call->rx_top, skb->len, seq0); |
435 | 440 | ||
436 | _proto("Rx DATA %%%u { #%u f=%02x }", | 441 | _proto("Rx DATA %%%u { #%u f=%02x n=%u }", |
437 | sp->hdr.serial, seq, sp->hdr.flags); | 442 | sp->hdr.serial, seq0, sp->hdr.flags, sp->nr_subpackets); |
438 | 443 | ||
439 | state = READ_ONCE(call->state); | 444 | state = READ_ONCE(call->state); |
440 | if (state >= RXRPC_CALL_COMPLETE) | 445 | if (state >= RXRPC_CALL_COMPLETE) { |
446 | rxrpc_free_skb(skb, rxrpc_skb_freed); | ||
441 | return; | 447 | return; |
448 | } | ||
442 | 449 | ||
443 | if (call->state == RXRPC_CALL_SERVER_RECV_REQUEST) { | 450 | if (call->state == RXRPC_CALL_SERVER_RECV_REQUEST) { |
444 | unsigned long timo = READ_ONCE(call->next_req_timo); | 451 | unsigned long timo = READ_ONCE(call->next_req_timo); |
@@ -463,137 +470,137 @@ static void rxrpc_input_data(struct rxrpc_call *call, struct sk_buff *skb) | |||
463 | !rxrpc_receiving_reply(call)) | 470 | !rxrpc_receiving_reply(call)) |
464 | goto unlock; | 471 | goto unlock; |
465 | 472 | ||
466 | call->ackr_prev_seq = seq; | 473 | call->ackr_prev_seq = seq0; |
467 | |||
468 | hard_ack = READ_ONCE(call->rx_hard_ack); | 474 | hard_ack = READ_ONCE(call->rx_hard_ack); |
469 | if (after(seq, hard_ack + call->rx_winsize)) { | ||
470 | ack = RXRPC_ACK_EXCEEDS_WINDOW; | ||
471 | ack_serial = serial; | ||
472 | goto ack; | ||
473 | } | ||
474 | 475 | ||
475 | flags = sp->hdr.flags; | 476 | if (sp->nr_subpackets > 1) { |
476 | if (flags & RXRPC_JUMBO_PACKET) { | ||
477 | if (call->nr_jumbo_bad > 3) { | 477 | if (call->nr_jumbo_bad > 3) { |
478 | ack = RXRPC_ACK_NOSPACE; | 478 | ack = RXRPC_ACK_NOSPACE; |
479 | ack_serial = serial; | 479 | ack_serial = serial; |
480 | goto ack; | 480 | goto ack; |
481 | } | 481 | } |
482 | annotation = 1; | ||
483 | } | 482 | } |
484 | 483 | ||
485 | next_subpacket: | 484 | for (j = 0; j < sp->nr_subpackets; j++) { |
486 | queued = false; | 485 | rxrpc_serial_t serial = sp->hdr.serial + j; |
487 | ix = seq & RXRPC_RXTX_BUFF_MASK; | 486 | rxrpc_seq_t seq = seq0 + j; |
488 | len = skb->len; | 487 | unsigned int ix = seq & RXRPC_RXTX_BUFF_MASK; |
489 | if (flags & RXRPC_JUMBO_PACKET) | 488 | bool terminal = (j == sp->nr_subpackets - 1); |
490 | len = RXRPC_JUMBO_DATALEN; | 489 | bool last = terminal && (sp->rx_flags & RXRPC_SKB_INCL_LAST); |
491 | 490 | u8 flags, annotation = j; | |
492 | if (flags & RXRPC_LAST_PACKET) { | 491 | |
493 | if (test_bit(RXRPC_CALL_RX_LAST, &call->flags) && | 492 | _proto("Rx DATA+%u %%%u { #%x t=%u l=%u }", |
494 | seq != call->rx_top) { | 493 | j, serial, seq, terminal, last); |
495 | rxrpc_proto_abort("LSN", call, seq); | 494 | |
496 | goto unlock; | 495 | if (last) { |
497 | } | 496 | if (test_bit(RXRPC_CALL_RX_LAST, &call->flags) && |
498 | } else { | 497 | seq != call->rx_top) { |
499 | if (test_bit(RXRPC_CALL_RX_LAST, &call->flags) && | 498 | rxrpc_proto_abort("LSN", call, seq); |
500 | after_eq(seq, call->rx_top)) { | 499 | goto unlock; |
501 | rxrpc_proto_abort("LSA", call, seq); | 500 | } |
502 | goto unlock; | 501 | } else { |
502 | if (test_bit(RXRPC_CALL_RX_LAST, &call->flags) && | ||
503 | after_eq(seq, call->rx_top)) { | ||
504 | rxrpc_proto_abort("LSA", call, seq); | ||
505 | goto unlock; | ||
506 | } | ||
503 | } | 507 | } |
504 | } | ||
505 | 508 | ||
506 | trace_rxrpc_rx_data(call->debug_id, seq, serial, flags, annotation); | 509 | flags = 0; |
507 | if (before_eq(seq, hard_ack)) { | 510 | if (last) |
508 | ack = RXRPC_ACK_DUPLICATE; | 511 | flags |= RXRPC_LAST_PACKET; |
509 | ack_serial = serial; | 512 | if (!terminal) |
510 | goto skip; | 513 | flags |= RXRPC_JUMBO_PACKET; |
511 | } | 514 | if (test_bit(j, sp->rx_req_ack)) |
515 | flags |= RXRPC_REQUEST_ACK; | ||
516 | trace_rxrpc_rx_data(call->debug_id, seq, serial, flags, annotation); | ||
512 | 517 | ||
513 | if (flags & RXRPC_REQUEST_ACK && !ack) { | 518 | if (before_eq(seq, hard_ack)) { |
514 | ack = RXRPC_ACK_REQUESTED; | ||
515 | ack_serial = serial; | ||
516 | } | ||
517 | |||
518 | if (call->rxtx_buffer[ix]) { | ||
519 | rxrpc_input_dup_data(call, seq, annotation, &jumbo_bad); | ||
520 | if (ack != RXRPC_ACK_DUPLICATE) { | ||
521 | ack = RXRPC_ACK_DUPLICATE; | 519 | ack = RXRPC_ACK_DUPLICATE; |
522 | ack_serial = serial; | 520 | ack_serial = serial; |
521 | continue; | ||
523 | } | 522 | } |
524 | immediate_ack = true; | ||
525 | goto skip; | ||
526 | } | ||
527 | 523 | ||
528 | /* Queue the packet. We use a couple of memory barriers here as need | 524 | if (call->rxtx_buffer[ix]) { |
529 | * to make sure that rx_top is perceived to be set after the buffer | 525 | rxrpc_input_dup_data(call, seq, sp->nr_subpackets > 1, |
530 | * pointer and that the buffer pointer is set after the annotation and | 526 | &jumbo_bad); |
531 | * the skb data. | 527 | if (ack != RXRPC_ACK_DUPLICATE) { |
532 | * | 528 | ack = RXRPC_ACK_DUPLICATE; |
533 | * Barriers against rxrpc_recvmsg_data() and rxrpc_rotate_rx_window() | 529 | ack_serial = serial; |
534 | * and also rxrpc_fill_out_ack(). | 530 | } |
535 | */ | 531 | immediate_ack = true; |
536 | rxrpc_get_skb(skb, rxrpc_skb_rx_got); | 532 | continue; |
537 | call->rxtx_annotations[ix] = annotation; | ||
538 | smp_wmb(); | ||
539 | call->rxtx_buffer[ix] = skb; | ||
540 | if (after(seq, call->rx_top)) { | ||
541 | smp_store_release(&call->rx_top, seq); | ||
542 | } else if (before(seq, call->rx_top)) { | ||
543 | /* Send an immediate ACK if we fill in a hole */ | ||
544 | if (!ack) { | ||
545 | ack = RXRPC_ACK_DELAY; | ||
546 | ack_serial = serial; | ||
547 | } | 533 | } |
548 | immediate_ack = true; | ||
549 | } | ||
550 | if (flags & RXRPC_LAST_PACKET) { | ||
551 | set_bit(RXRPC_CALL_RX_LAST, &call->flags); | ||
552 | trace_rxrpc_receive(call, rxrpc_receive_queue_last, serial, seq); | ||
553 | } else { | ||
554 | trace_rxrpc_receive(call, rxrpc_receive_queue, serial, seq); | ||
555 | } | ||
556 | queued = true; | ||
557 | 534 | ||
558 | if (after_eq(seq, call->rx_expect_next)) { | ||
559 | if (after(seq, call->rx_expect_next)) { | ||
560 | _net("OOS %u > %u", seq, call->rx_expect_next); | ||
561 | ack = RXRPC_ACK_OUT_OF_SEQUENCE; | ||
562 | ack_serial = serial; | ||
563 | } | ||
564 | call->rx_expect_next = seq + 1; | ||
565 | } | ||
566 | |||
567 | skip: | ||
568 | offset += len; | ||
569 | if (flags & RXRPC_JUMBO_PACKET) { | ||
570 | if (skb_copy_bits(skb, offset, &flags, 1) < 0) { | ||
571 | rxrpc_proto_abort("XJF", call, seq); | ||
572 | goto unlock; | ||
573 | } | ||
574 | offset += sizeof(struct rxrpc_jumbo_header); | ||
575 | seq++; | ||
576 | serial++; | ||
577 | annotation++; | ||
578 | if (flags & RXRPC_JUMBO_PACKET) | ||
579 | annotation |= RXRPC_RX_ANNO_JLAST; | ||
580 | if (after(seq, hard_ack + call->rx_winsize)) { | 535 | if (after(seq, hard_ack + call->rx_winsize)) { |
581 | ack = RXRPC_ACK_EXCEEDS_WINDOW; | 536 | ack = RXRPC_ACK_EXCEEDS_WINDOW; |
582 | ack_serial = serial; | 537 | ack_serial = serial; |
583 | if (!jumbo_bad) { | 538 | if (flags & RXRPC_JUMBO_PACKET) { |
584 | call->nr_jumbo_bad++; | 539 | if (!jumbo_bad) { |
585 | jumbo_bad = true; | 540 | call->nr_jumbo_bad++; |
541 | jumbo_bad = true; | ||
542 | } | ||
586 | } | 543 | } |
544 | |||
587 | goto ack; | 545 | goto ack; |
588 | } | 546 | } |
589 | 547 | ||
590 | _proto("Rx DATA Jumbo %%%u", serial); | 548 | if (flags & RXRPC_REQUEST_ACK && !ack) { |
591 | goto next_subpacket; | 549 | ack = RXRPC_ACK_REQUESTED; |
592 | } | 550 | ack_serial = serial; |
551 | } | ||
552 | |||
553 | /* Queue the packet. We use a couple of memory barriers here as need | ||
554 | * to make sure that rx_top is perceived to be set after the buffer | ||
555 | * pointer and that the buffer pointer is set after the annotation and | ||
556 | * the skb data. | ||
557 | * | ||
558 | * Barriers against rxrpc_recvmsg_data() and rxrpc_rotate_rx_window() | ||
559 | * and also rxrpc_fill_out_ack(). | ||
560 | */ | ||
561 | if (!terminal) | ||
562 | rxrpc_get_skb(skb, rxrpc_skb_got); | ||
563 | call->rxtx_annotations[ix] = annotation; | ||
564 | smp_wmb(); | ||
565 | call->rxtx_buffer[ix] = skb; | ||
566 | if (after(seq, call->rx_top)) { | ||
567 | smp_store_release(&call->rx_top, seq); | ||
568 | } else if (before(seq, call->rx_top)) { | ||
569 | /* Send an immediate ACK if we fill in a hole */ | ||
570 | if (!ack) { | ||
571 | ack = RXRPC_ACK_DELAY; | ||
572 | ack_serial = serial; | ||
573 | } | ||
574 | immediate_ack = true; | ||
575 | } | ||
576 | |||
577 | if (terminal) { | ||
578 | /* From this point on, we're not allowed to touch the | ||
579 | * packet any longer as its ref now belongs to the Rx | ||
580 | * ring. | ||
581 | */ | ||
582 | skb = NULL; | ||
583 | } | ||
593 | 584 | ||
594 | if (queued && flags & RXRPC_LAST_PACKET && !ack) { | 585 | if (last) { |
595 | ack = RXRPC_ACK_DELAY; | 586 | set_bit(RXRPC_CALL_RX_LAST, &call->flags); |
596 | ack_serial = serial; | 587 | if (!ack) { |
588 | ack = RXRPC_ACK_DELAY; | ||
589 | ack_serial = serial; | ||
590 | } | ||
591 | trace_rxrpc_receive(call, rxrpc_receive_queue_last, serial, seq); | ||
592 | } else { | ||
593 | trace_rxrpc_receive(call, rxrpc_receive_queue, serial, seq); | ||
594 | } | ||
595 | |||
596 | if (after_eq(seq, call->rx_expect_next)) { | ||
597 | if (after(seq, call->rx_expect_next)) { | ||
598 | _net("OOS %u > %u", seq, call->rx_expect_next); | ||
599 | ack = RXRPC_ACK_OUT_OF_SEQUENCE; | ||
600 | ack_serial = serial; | ||
601 | } | ||
602 | call->rx_expect_next = seq + 1; | ||
603 | } | ||
597 | } | 604 | } |
598 | 605 | ||
599 | ack: | 606 | ack: |
@@ -606,13 +613,14 @@ ack: | |||
606 | false, true, | 613 | false, true, |
607 | rxrpc_propose_ack_input_data); | 614 | rxrpc_propose_ack_input_data); |
608 | 615 | ||
609 | if (sp->hdr.seq == READ_ONCE(call->rx_hard_ack) + 1) { | 616 | if (seq0 == READ_ONCE(call->rx_hard_ack) + 1) { |
610 | trace_rxrpc_notify_socket(call->debug_id, serial); | 617 | trace_rxrpc_notify_socket(call->debug_id, serial); |
611 | rxrpc_notify_socket(call); | 618 | rxrpc_notify_socket(call); |
612 | } | 619 | } |
613 | 620 | ||
614 | unlock: | 621 | unlock: |
615 | spin_unlock(&call->input_lock); | 622 | spin_unlock(&call->input_lock); |
623 | rxrpc_free_skb(skb, rxrpc_skb_freed); | ||
616 | _leave(" [queued]"); | 624 | _leave(" [queued]"); |
617 | } | 625 | } |
618 | 626 | ||
@@ -1021,7 +1029,7 @@ static void rxrpc_input_call_packet(struct rxrpc_call *call, | |||
1021 | switch (sp->hdr.type) { | 1029 | switch (sp->hdr.type) { |
1022 | case RXRPC_PACKET_TYPE_DATA: | 1030 | case RXRPC_PACKET_TYPE_DATA: |
1023 | rxrpc_input_data(call, skb); | 1031 | rxrpc_input_data(call, skb); |
1024 | break; | 1032 | goto no_free; |
1025 | 1033 | ||
1026 | case RXRPC_PACKET_TYPE_ACK: | 1034 | case RXRPC_PACKET_TYPE_ACK: |
1027 | rxrpc_input_ack(call, skb); | 1035 | rxrpc_input_ack(call, skb); |
@@ -1048,6 +1056,8 @@ static void rxrpc_input_call_packet(struct rxrpc_call *call, | |||
1048 | break; | 1056 | break; |
1049 | } | 1057 | } |
1050 | 1058 | ||
1059 | rxrpc_free_skb(skb, rxrpc_skb_freed); | ||
1060 | no_free: | ||
1051 | _leave(""); | 1061 | _leave(""); |
1052 | } | 1062 | } |
1053 | 1063 | ||
@@ -1109,7 +1119,7 @@ static void rxrpc_post_packet_to_local(struct rxrpc_local *local, | |||
1109 | skb_queue_tail(&local->event_queue, skb); | 1119 | skb_queue_tail(&local->event_queue, skb); |
1110 | rxrpc_queue_local(local); | 1120 | rxrpc_queue_local(local); |
1111 | } else { | 1121 | } else { |
1112 | rxrpc_free_skb(skb, rxrpc_skb_rx_freed); | 1122 | rxrpc_free_skb(skb, rxrpc_skb_freed); |
1113 | } | 1123 | } |
1114 | } | 1124 | } |
1115 | 1125 | ||
@@ -1124,7 +1134,7 @@ static void rxrpc_reject_packet(struct rxrpc_local *local, struct sk_buff *skb) | |||
1124 | skb_queue_tail(&local->reject_queue, skb); | 1134 | skb_queue_tail(&local->reject_queue, skb); |
1125 | rxrpc_queue_local(local); | 1135 | rxrpc_queue_local(local); |
1126 | } else { | 1136 | } else { |
1127 | rxrpc_free_skb(skb, rxrpc_skb_rx_freed); | 1137 | rxrpc_free_skb(skb, rxrpc_skb_freed); |
1128 | } | 1138 | } |
1129 | } | 1139 | } |
1130 | 1140 | ||
@@ -1188,7 +1198,7 @@ int rxrpc_input_packet(struct sock *udp_sk, struct sk_buff *skb) | |||
1188 | if (skb->tstamp == 0) | 1198 | if (skb->tstamp == 0) |
1189 | skb->tstamp = ktime_get_real(); | 1199 | skb->tstamp = ktime_get_real(); |
1190 | 1200 | ||
1191 | rxrpc_new_skb(skb, rxrpc_skb_rx_received); | 1201 | rxrpc_new_skb(skb, rxrpc_skb_received); |
1192 | 1202 | ||
1193 | skb_pull(skb, sizeof(struct udphdr)); | 1203 | skb_pull(skb, sizeof(struct udphdr)); |
1194 | 1204 | ||
@@ -1205,7 +1215,7 @@ int rxrpc_input_packet(struct sock *udp_sk, struct sk_buff *skb) | |||
1205 | static int lose; | 1215 | static int lose; |
1206 | if ((lose++ & 7) == 7) { | 1216 | if ((lose++ & 7) == 7) { |
1207 | trace_rxrpc_rx_lose(sp); | 1217 | trace_rxrpc_rx_lose(sp); |
1208 | rxrpc_free_skb(skb, rxrpc_skb_rx_lost); | 1218 | rxrpc_free_skb(skb, rxrpc_skb_lost); |
1209 | return 0; | 1219 | return 0; |
1210 | } | 1220 | } |
1211 | } | 1221 | } |
@@ -1237,9 +1247,26 @@ int rxrpc_input_packet(struct sock *udp_sk, struct sk_buff *skb) | |||
1237 | if (sp->hdr.callNumber == 0 || | 1247 | if (sp->hdr.callNumber == 0 || |
1238 | sp->hdr.seq == 0) | 1248 | sp->hdr.seq == 0) |
1239 | goto bad_message; | 1249 | goto bad_message; |
1240 | if (sp->hdr.flags & RXRPC_JUMBO_PACKET && | 1250 | if (!rxrpc_validate_data(skb)) |
1241 | !rxrpc_validate_jumbo(skb)) | ||
1242 | goto bad_message; | 1251 | goto bad_message; |
1252 | |||
1253 | /* Unshare the packet so that it can be modified for in-place | ||
1254 | * decryption. | ||
1255 | */ | ||
1256 | if (sp->hdr.securityIndex != 0) { | ||
1257 | struct sk_buff *nskb = skb_unshare(skb, GFP_ATOMIC); | ||
1258 | if (!nskb) { | ||
1259 | rxrpc_eaten_skb(skb, rxrpc_skb_unshared_nomem); | ||
1260 | goto out; | ||
1261 | } | ||
1262 | |||
1263 | if (nskb != skb) { | ||
1264 | rxrpc_eaten_skb(skb, rxrpc_skb_received); | ||
1265 | rxrpc_new_skb(skb, rxrpc_skb_unshared); | ||
1266 | skb = nskb; | ||
1267 | sp = rxrpc_skb(skb); | ||
1268 | } | ||
1269 | } | ||
1243 | break; | 1270 | break; |
1244 | 1271 | ||
1245 | case RXRPC_PACKET_TYPE_CHALLENGE: | 1272 | case RXRPC_PACKET_TYPE_CHALLENGE: |
@@ -1373,11 +1400,14 @@ int rxrpc_input_packet(struct sock *udp_sk, struct sk_buff *skb) | |||
1373 | mutex_unlock(&call->user_mutex); | 1400 | mutex_unlock(&call->user_mutex); |
1374 | } | 1401 | } |
1375 | 1402 | ||
1403 | /* Process a call packet; this either discards or passes on the ref | ||
1404 | * elsewhere. | ||
1405 | */ | ||
1376 | rxrpc_input_call_packet(call, skb); | 1406 | rxrpc_input_call_packet(call, skb); |
1377 | goto discard; | 1407 | goto out; |
1378 | 1408 | ||
1379 | discard: | 1409 | discard: |
1380 | rxrpc_free_skb(skb, rxrpc_skb_rx_freed); | 1410 | rxrpc_free_skb(skb, rxrpc_skb_freed); |
1381 | out: | 1411 | out: |
1382 | trace_rxrpc_rx_done(0, 0); | 1412 | trace_rxrpc_rx_done(0, 0); |
1383 | return 0; | 1413 | return 0; |
diff --git a/net/rxrpc/local_event.c b/net/rxrpc/local_event.c index e93a78f7c05e..3ce6d628cd75 100644 --- a/net/rxrpc/local_event.c +++ b/net/rxrpc/local_event.c | |||
@@ -90,7 +90,7 @@ void rxrpc_process_local_events(struct rxrpc_local *local) | |||
90 | if (skb) { | 90 | if (skb) { |
91 | struct rxrpc_skb_priv *sp = rxrpc_skb(skb); | 91 | struct rxrpc_skb_priv *sp = rxrpc_skb(skb); |
92 | 92 | ||
93 | rxrpc_see_skb(skb, rxrpc_skb_rx_seen); | 93 | rxrpc_see_skb(skb, rxrpc_skb_seen); |
94 | _debug("{%d},{%u}", local->debug_id, sp->hdr.type); | 94 | _debug("{%d},{%u}", local->debug_id, sp->hdr.type); |
95 | 95 | ||
96 | switch (sp->hdr.type) { | 96 | switch (sp->hdr.type) { |
@@ -108,7 +108,7 @@ void rxrpc_process_local_events(struct rxrpc_local *local) | |||
108 | break; | 108 | break; |
109 | } | 109 | } |
110 | 110 | ||
111 | rxrpc_free_skb(skb, rxrpc_skb_rx_freed); | 111 | rxrpc_free_skb(skb, rxrpc_skb_freed); |
112 | } | 112 | } |
113 | 113 | ||
114 | _leave(""); | 114 | _leave(""); |
diff --git a/net/rxrpc/local_object.c b/net/rxrpc/local_object.c index 72a6e12a9304..36587260cabd 100644 --- a/net/rxrpc/local_object.c +++ b/net/rxrpc/local_object.c | |||
@@ -426,11 +426,14 @@ static void rxrpc_local_destroyer(struct rxrpc_local *local) | |||
426 | 426 | ||
427 | _enter("%d", local->debug_id); | 427 | _enter("%d", local->debug_id); |
428 | 428 | ||
429 | local->dead = true; | ||
430 | |||
429 | mutex_lock(&rxnet->local_mutex); | 431 | mutex_lock(&rxnet->local_mutex); |
430 | list_del_init(&local->link); | 432 | list_del_init(&local->link); |
431 | mutex_unlock(&rxnet->local_mutex); | 433 | mutex_unlock(&rxnet->local_mutex); |
432 | 434 | ||
433 | ASSERT(RB_EMPTY_ROOT(&local->client_conns)); | 435 | rxrpc_clean_up_local_conns(local); |
436 | rxrpc_service_connection_reaper(&rxnet->service_conn_reaper); | ||
434 | ASSERT(!local->service); | 437 | ASSERT(!local->service); |
435 | 438 | ||
436 | if (socket) { | 439 | if (socket) { |
diff --git a/net/rxrpc/output.c b/net/rxrpc/output.c index 369e516c4bdf..935bb60fff56 100644 --- a/net/rxrpc/output.c +++ b/net/rxrpc/output.c | |||
@@ -565,7 +565,7 @@ void rxrpc_reject_packets(struct rxrpc_local *local) | |||
565 | memset(&whdr, 0, sizeof(whdr)); | 565 | memset(&whdr, 0, sizeof(whdr)); |
566 | 566 | ||
567 | while ((skb = skb_dequeue(&local->reject_queue))) { | 567 | while ((skb = skb_dequeue(&local->reject_queue))) { |
568 | rxrpc_see_skb(skb, rxrpc_skb_rx_seen); | 568 | rxrpc_see_skb(skb, rxrpc_skb_seen); |
569 | sp = rxrpc_skb(skb); | 569 | sp = rxrpc_skb(skb); |
570 | 570 | ||
571 | switch (skb->mark) { | 571 | switch (skb->mark) { |
@@ -581,7 +581,7 @@ void rxrpc_reject_packets(struct rxrpc_local *local) | |||
581 | ioc = 2; | 581 | ioc = 2; |
582 | break; | 582 | break; |
583 | default: | 583 | default: |
584 | rxrpc_free_skb(skb, rxrpc_skb_rx_freed); | 584 | rxrpc_free_skb(skb, rxrpc_skb_freed); |
585 | continue; | 585 | continue; |
586 | } | 586 | } |
587 | 587 | ||
@@ -606,7 +606,7 @@ void rxrpc_reject_packets(struct rxrpc_local *local) | |||
606 | rxrpc_tx_point_reject); | 606 | rxrpc_tx_point_reject); |
607 | } | 607 | } |
608 | 608 | ||
609 | rxrpc_free_skb(skb, rxrpc_skb_rx_freed); | 609 | rxrpc_free_skb(skb, rxrpc_skb_freed); |
610 | } | 610 | } |
611 | 611 | ||
612 | _leave(""); | 612 | _leave(""); |
diff --git a/net/rxrpc/peer_event.c b/net/rxrpc/peer_event.c index 7666ec72d37e..c97ebdc043e4 100644 --- a/net/rxrpc/peer_event.c +++ b/net/rxrpc/peer_event.c | |||
@@ -163,11 +163,11 @@ void rxrpc_error_report(struct sock *sk) | |||
163 | _leave("UDP socket errqueue empty"); | 163 | _leave("UDP socket errqueue empty"); |
164 | return; | 164 | return; |
165 | } | 165 | } |
166 | rxrpc_new_skb(skb, rxrpc_skb_rx_received); | 166 | rxrpc_new_skb(skb, rxrpc_skb_received); |
167 | serr = SKB_EXT_ERR(skb); | 167 | serr = SKB_EXT_ERR(skb); |
168 | if (!skb->len && serr->ee.ee_origin == SO_EE_ORIGIN_TIMESTAMPING) { | 168 | if (!skb->len && serr->ee.ee_origin == SO_EE_ORIGIN_TIMESTAMPING) { |
169 | _leave("UDP empty message"); | 169 | _leave("UDP empty message"); |
170 | rxrpc_free_skb(skb, rxrpc_skb_rx_freed); | 170 | rxrpc_free_skb(skb, rxrpc_skb_freed); |
171 | return; | 171 | return; |
172 | } | 172 | } |
173 | 173 | ||
@@ -177,7 +177,7 @@ void rxrpc_error_report(struct sock *sk) | |||
177 | peer = NULL; | 177 | peer = NULL; |
178 | if (!peer) { | 178 | if (!peer) { |
179 | rcu_read_unlock(); | 179 | rcu_read_unlock(); |
180 | rxrpc_free_skb(skb, rxrpc_skb_rx_freed); | 180 | rxrpc_free_skb(skb, rxrpc_skb_freed); |
181 | _leave(" [no peer]"); | 181 | _leave(" [no peer]"); |
182 | return; | 182 | return; |
183 | } | 183 | } |
@@ -189,7 +189,7 @@ void rxrpc_error_report(struct sock *sk) | |||
189 | serr->ee.ee_code == ICMP_FRAG_NEEDED)) { | 189 | serr->ee.ee_code == ICMP_FRAG_NEEDED)) { |
190 | rxrpc_adjust_mtu(peer, serr); | 190 | rxrpc_adjust_mtu(peer, serr); |
191 | rcu_read_unlock(); | 191 | rcu_read_unlock(); |
192 | rxrpc_free_skb(skb, rxrpc_skb_rx_freed); | 192 | rxrpc_free_skb(skb, rxrpc_skb_freed); |
193 | rxrpc_put_peer(peer); | 193 | rxrpc_put_peer(peer); |
194 | _leave(" [MTU update]"); | 194 | _leave(" [MTU update]"); |
195 | return; | 195 | return; |
@@ -197,7 +197,7 @@ void rxrpc_error_report(struct sock *sk) | |||
197 | 197 | ||
198 | rxrpc_store_error(peer, serr); | 198 | rxrpc_store_error(peer, serr); |
199 | rcu_read_unlock(); | 199 | rcu_read_unlock(); |
200 | rxrpc_free_skb(skb, rxrpc_skb_rx_freed); | 200 | rxrpc_free_skb(skb, rxrpc_skb_freed); |
201 | rxrpc_put_peer(peer); | 201 | rxrpc_put_peer(peer); |
202 | 202 | ||
203 | _leave(""); | 203 | _leave(""); |
diff --git a/net/rxrpc/protocol.h b/net/rxrpc/protocol.h index 99ce322d7caa..49bb972539aa 100644 --- a/net/rxrpc/protocol.h +++ b/net/rxrpc/protocol.h | |||
@@ -89,6 +89,15 @@ struct rxrpc_jumbo_header { | |||
89 | #define RXRPC_JUMBO_DATALEN 1412 /* non-terminal jumbo packet data length */ | 89 | #define RXRPC_JUMBO_DATALEN 1412 /* non-terminal jumbo packet data length */ |
90 | #define RXRPC_JUMBO_SUBPKTLEN (RXRPC_JUMBO_DATALEN + sizeof(struct rxrpc_jumbo_header)) | 90 | #define RXRPC_JUMBO_SUBPKTLEN (RXRPC_JUMBO_DATALEN + sizeof(struct rxrpc_jumbo_header)) |
91 | 91 | ||
92 | /* | ||
93 | * The maximum number of subpackets that can possibly fit in a UDP packet is: | ||
94 | * | ||
95 | * ((max_IP - IP_hdr - UDP_hdr) / RXRPC_JUMBO_SUBPKTLEN) + 1 | ||
96 | * = ((65535 - 28 - 28) / 1416) + 1 | ||
97 | * = 46 non-terminal packets and 1 terminal packet. | ||
98 | */ | ||
99 | #define RXRPC_MAX_NR_JUMBO 47 | ||
100 | |||
92 | /*****************************************************************************/ | 101 | /*****************************************************************************/ |
93 | /* | 102 | /* |
94 | * on-the-wire Rx ACK packet data payload | 103 | * on-the-wire Rx ACK packet data payload |
diff --git a/net/rxrpc/recvmsg.c b/net/rxrpc/recvmsg.c index 9a7e1bc9791d..3b0becb12041 100644 --- a/net/rxrpc/recvmsg.c +++ b/net/rxrpc/recvmsg.c | |||
@@ -177,7 +177,8 @@ static void rxrpc_rotate_rx_window(struct rxrpc_call *call) | |||
177 | struct sk_buff *skb; | 177 | struct sk_buff *skb; |
178 | rxrpc_serial_t serial; | 178 | rxrpc_serial_t serial; |
179 | rxrpc_seq_t hard_ack, top; | 179 | rxrpc_seq_t hard_ack, top; |
180 | u8 flags; | 180 | bool last = false; |
181 | u8 subpacket; | ||
181 | int ix; | 182 | int ix; |
182 | 183 | ||
183 | _enter("%d", call->debug_id); | 184 | _enter("%d", call->debug_id); |
@@ -189,23 +190,25 @@ static void rxrpc_rotate_rx_window(struct rxrpc_call *call) | |||
189 | hard_ack++; | 190 | hard_ack++; |
190 | ix = hard_ack & RXRPC_RXTX_BUFF_MASK; | 191 | ix = hard_ack & RXRPC_RXTX_BUFF_MASK; |
191 | skb = call->rxtx_buffer[ix]; | 192 | skb = call->rxtx_buffer[ix]; |
192 | rxrpc_see_skb(skb, rxrpc_skb_rx_rotated); | 193 | rxrpc_see_skb(skb, rxrpc_skb_rotated); |
193 | sp = rxrpc_skb(skb); | 194 | sp = rxrpc_skb(skb); |
194 | flags = sp->hdr.flags; | 195 | |
195 | serial = sp->hdr.serial; | 196 | subpacket = call->rxtx_annotations[ix] & RXRPC_RX_ANNO_SUBPACKET; |
196 | if (call->rxtx_annotations[ix] & RXRPC_RX_ANNO_JUMBO) | 197 | serial = sp->hdr.serial + subpacket; |
197 | serial += (call->rxtx_annotations[ix] & RXRPC_RX_ANNO_JUMBO) - 1; | 198 | |
199 | if (subpacket == sp->nr_subpackets - 1 && | ||
200 | sp->rx_flags & RXRPC_SKB_INCL_LAST) | ||
201 | last = true; | ||
198 | 202 | ||
199 | call->rxtx_buffer[ix] = NULL; | 203 | call->rxtx_buffer[ix] = NULL; |
200 | call->rxtx_annotations[ix] = 0; | 204 | call->rxtx_annotations[ix] = 0; |
201 | /* Barrier against rxrpc_input_data(). */ | 205 | /* Barrier against rxrpc_input_data(). */ |
202 | smp_store_release(&call->rx_hard_ack, hard_ack); | 206 | smp_store_release(&call->rx_hard_ack, hard_ack); |
203 | 207 | ||
204 | rxrpc_free_skb(skb, rxrpc_skb_rx_freed); | 208 | rxrpc_free_skb(skb, rxrpc_skb_freed); |
205 | 209 | ||
206 | _debug("%u,%u,%02x", hard_ack, top, flags); | ||
207 | trace_rxrpc_receive(call, rxrpc_receive_rotate, serial, hard_ack); | 210 | trace_rxrpc_receive(call, rxrpc_receive_rotate, serial, hard_ack); |
208 | if (flags & RXRPC_LAST_PACKET) { | 211 | if (last) { |
209 | rxrpc_end_rx_phase(call, serial); | 212 | rxrpc_end_rx_phase(call, serial); |
210 | } else { | 213 | } else { |
211 | /* Check to see if there's an ACK that needs sending. */ | 214 | /* Check to see if there's an ACK that needs sending. */ |
@@ -233,18 +236,19 @@ static int rxrpc_verify_packet(struct rxrpc_call *call, struct sk_buff *skb, | |||
233 | struct rxrpc_skb_priv *sp = rxrpc_skb(skb); | 236 | struct rxrpc_skb_priv *sp = rxrpc_skb(skb); |
234 | rxrpc_seq_t seq = sp->hdr.seq; | 237 | rxrpc_seq_t seq = sp->hdr.seq; |
235 | u16 cksum = sp->hdr.cksum; | 238 | u16 cksum = sp->hdr.cksum; |
239 | u8 subpacket = annotation & RXRPC_RX_ANNO_SUBPACKET; | ||
236 | 240 | ||
237 | _enter(""); | 241 | _enter(""); |
238 | 242 | ||
239 | /* For all but the head jumbo subpacket, the security checksum is in a | 243 | /* For all but the head jumbo subpacket, the security checksum is in a |
240 | * jumbo header immediately prior to the data. | 244 | * jumbo header immediately prior to the data. |
241 | */ | 245 | */ |
242 | if ((annotation & RXRPC_RX_ANNO_JUMBO) > 1) { | 246 | if (subpacket > 0) { |
243 | __be16 tmp; | 247 | __be16 tmp; |
244 | if (skb_copy_bits(skb, offset - 2, &tmp, 2) < 0) | 248 | if (skb_copy_bits(skb, offset - 2, &tmp, 2) < 0) |
245 | BUG(); | 249 | BUG(); |
246 | cksum = ntohs(tmp); | 250 | cksum = ntohs(tmp); |
247 | seq += (annotation & RXRPC_RX_ANNO_JUMBO) - 1; | 251 | seq += subpacket; |
248 | } | 252 | } |
249 | 253 | ||
250 | return call->conn->security->verify_packet(call, skb, offset, len, | 254 | return call->conn->security->verify_packet(call, skb, offset, len, |
@@ -265,19 +269,18 @@ static int rxrpc_locate_data(struct rxrpc_call *call, struct sk_buff *skb, | |||
265 | u8 *_annotation, | 269 | u8 *_annotation, |
266 | unsigned int *_offset, unsigned int *_len) | 270 | unsigned int *_offset, unsigned int *_len) |
267 | { | 271 | { |
272 | struct rxrpc_skb_priv *sp = rxrpc_skb(skb); | ||
268 | unsigned int offset = sizeof(struct rxrpc_wire_header); | 273 | unsigned int offset = sizeof(struct rxrpc_wire_header); |
269 | unsigned int len; | 274 | unsigned int len; |
270 | int ret; | 275 | int ret; |
271 | u8 annotation = *_annotation; | 276 | u8 annotation = *_annotation; |
277 | u8 subpacket = annotation & RXRPC_RX_ANNO_SUBPACKET; | ||
272 | 278 | ||
273 | /* Locate the subpacket */ | 279 | /* Locate the subpacket */ |
280 | offset += subpacket * RXRPC_JUMBO_SUBPKTLEN; | ||
274 | len = skb->len - offset; | 281 | len = skb->len - offset; |
275 | if ((annotation & RXRPC_RX_ANNO_JUMBO) > 0) { | 282 | if (subpacket < sp->nr_subpackets - 1) |
276 | offset += (((annotation & RXRPC_RX_ANNO_JUMBO) - 1) * | 283 | len = RXRPC_JUMBO_DATALEN; |
277 | RXRPC_JUMBO_SUBPKTLEN); | ||
278 | len = (annotation & RXRPC_RX_ANNO_JLAST) ? | ||
279 | skb->len - offset : RXRPC_JUMBO_SUBPKTLEN; | ||
280 | } | ||
281 | 284 | ||
282 | if (!(annotation & RXRPC_RX_ANNO_VERIFIED)) { | 285 | if (!(annotation & RXRPC_RX_ANNO_VERIFIED)) { |
283 | ret = rxrpc_verify_packet(call, skb, annotation, offset, len); | 286 | ret = rxrpc_verify_packet(call, skb, annotation, offset, len); |
@@ -303,6 +306,7 @@ static int rxrpc_recvmsg_data(struct socket *sock, struct rxrpc_call *call, | |||
303 | { | 306 | { |
304 | struct rxrpc_skb_priv *sp; | 307 | struct rxrpc_skb_priv *sp; |
305 | struct sk_buff *skb; | 308 | struct sk_buff *skb; |
309 | rxrpc_serial_t serial; | ||
306 | rxrpc_seq_t hard_ack, top, seq; | 310 | rxrpc_seq_t hard_ack, top, seq; |
307 | size_t remain; | 311 | size_t remain; |
308 | bool last; | 312 | bool last; |
@@ -336,12 +340,15 @@ static int rxrpc_recvmsg_data(struct socket *sock, struct rxrpc_call *call, | |||
336 | break; | 340 | break; |
337 | } | 341 | } |
338 | smp_rmb(); | 342 | smp_rmb(); |
339 | rxrpc_see_skb(skb, rxrpc_skb_rx_seen); | 343 | rxrpc_see_skb(skb, rxrpc_skb_seen); |
340 | sp = rxrpc_skb(skb); | 344 | sp = rxrpc_skb(skb); |
341 | 345 | ||
342 | if (!(flags & MSG_PEEK)) | 346 | if (!(flags & MSG_PEEK)) { |
347 | serial = sp->hdr.serial; | ||
348 | serial += call->rxtx_annotations[ix] & RXRPC_RX_ANNO_SUBPACKET; | ||
343 | trace_rxrpc_receive(call, rxrpc_receive_front, | 349 | trace_rxrpc_receive(call, rxrpc_receive_front, |
344 | sp->hdr.serial, seq); | 350 | serial, seq); |
351 | } | ||
345 | 352 | ||
346 | if (msg) | 353 | if (msg) |
347 | sock_recv_timestamp(msg, sock->sk, skb); | 354 | sock_recv_timestamp(msg, sock->sk, skb); |
diff --git a/net/rxrpc/rxkad.c b/net/rxrpc/rxkad.c index dbb109da1835..8d8aa3c230b5 100644 --- a/net/rxrpc/rxkad.c +++ b/net/rxrpc/rxkad.c | |||
@@ -223,10 +223,8 @@ static int rxkad_secure_packet_encrypt(const struct rxrpc_call *call, | |||
223 | struct rxrpc_skb_priv *sp; | 223 | struct rxrpc_skb_priv *sp; |
224 | struct rxrpc_crypt iv; | 224 | struct rxrpc_crypt iv; |
225 | struct scatterlist sg[16]; | 225 | struct scatterlist sg[16]; |
226 | struct sk_buff *trailer; | ||
227 | unsigned int len; | 226 | unsigned int len; |
228 | u16 check; | 227 | u16 check; |
229 | int nsg; | ||
230 | int err; | 228 | int err; |
231 | 229 | ||
232 | sp = rxrpc_skb(skb); | 230 | sp = rxrpc_skb(skb); |
@@ -250,15 +248,14 @@ static int rxkad_secure_packet_encrypt(const struct rxrpc_call *call, | |||
250 | crypto_skcipher_encrypt(req); | 248 | crypto_skcipher_encrypt(req); |
251 | 249 | ||
252 | /* we want to encrypt the skbuff in-place */ | 250 | /* we want to encrypt the skbuff in-place */ |
253 | nsg = skb_cow_data(skb, 0, &trailer); | 251 | err = -EMSGSIZE; |
254 | err = -ENOMEM; | 252 | if (skb_shinfo(skb)->nr_frags > 16) |
255 | if (nsg < 0 || nsg > 16) | ||
256 | goto out; | 253 | goto out; |
257 | 254 | ||
258 | len = data_size + call->conn->size_align - 1; | 255 | len = data_size + call->conn->size_align - 1; |
259 | len &= ~(call->conn->size_align - 1); | 256 | len &= ~(call->conn->size_align - 1); |
260 | 257 | ||
261 | sg_init_table(sg, nsg); | 258 | sg_init_table(sg, ARRAY_SIZE(sg)); |
262 | err = skb_to_sgvec(skb, sg, 0, len); | 259 | err = skb_to_sgvec(skb, sg, 0, len); |
263 | if (unlikely(err < 0)) | 260 | if (unlikely(err < 0)) |
264 | goto out; | 261 | goto out; |
@@ -359,11 +356,10 @@ static int rxkad_verify_packet_1(struct rxrpc_call *call, struct sk_buff *skb, | |||
359 | struct rxkad_level1_hdr sechdr; | 356 | struct rxkad_level1_hdr sechdr; |
360 | struct rxrpc_crypt iv; | 357 | struct rxrpc_crypt iv; |
361 | struct scatterlist sg[16]; | 358 | struct scatterlist sg[16]; |
362 | struct sk_buff *trailer; | ||
363 | bool aborted; | 359 | bool aborted; |
364 | u32 data_size, buf; | 360 | u32 data_size, buf; |
365 | u16 check; | 361 | u16 check; |
366 | int nsg, ret; | 362 | int ret; |
367 | 363 | ||
368 | _enter(""); | 364 | _enter(""); |
369 | 365 | ||
@@ -376,11 +372,7 @@ static int rxkad_verify_packet_1(struct rxrpc_call *call, struct sk_buff *skb, | |||
376 | /* Decrypt the skbuff in-place. TODO: We really want to decrypt | 372 | /* Decrypt the skbuff in-place. TODO: We really want to decrypt |
377 | * directly into the target buffer. | 373 | * directly into the target buffer. |
378 | */ | 374 | */ |
379 | nsg = skb_cow_data(skb, 0, &trailer); | 375 | sg_init_table(sg, ARRAY_SIZE(sg)); |
380 | if (nsg < 0 || nsg > 16) | ||
381 | goto nomem; | ||
382 | |||
383 | sg_init_table(sg, nsg); | ||
384 | ret = skb_to_sgvec(skb, sg, offset, 8); | 376 | ret = skb_to_sgvec(skb, sg, offset, 8); |
385 | if (unlikely(ret < 0)) | 377 | if (unlikely(ret < 0)) |
386 | return ret; | 378 | return ret; |
@@ -428,10 +420,6 @@ protocol_error: | |||
428 | if (aborted) | 420 | if (aborted) |
429 | rxrpc_send_abort_packet(call); | 421 | rxrpc_send_abort_packet(call); |
430 | return -EPROTO; | 422 | return -EPROTO; |
431 | |||
432 | nomem: | ||
433 | _leave(" = -ENOMEM"); | ||
434 | return -ENOMEM; | ||
435 | } | 423 | } |
436 | 424 | ||
437 | /* | 425 | /* |
@@ -446,7 +434,6 @@ static int rxkad_verify_packet_2(struct rxrpc_call *call, struct sk_buff *skb, | |||
446 | struct rxkad_level2_hdr sechdr; | 434 | struct rxkad_level2_hdr sechdr; |
447 | struct rxrpc_crypt iv; | 435 | struct rxrpc_crypt iv; |
448 | struct scatterlist _sg[4], *sg; | 436 | struct scatterlist _sg[4], *sg; |
449 | struct sk_buff *trailer; | ||
450 | bool aborted; | 437 | bool aborted; |
451 | u32 data_size, buf; | 438 | u32 data_size, buf; |
452 | u16 check; | 439 | u16 check; |
@@ -463,12 +450,11 @@ static int rxkad_verify_packet_2(struct rxrpc_call *call, struct sk_buff *skb, | |||
463 | /* Decrypt the skbuff in-place. TODO: We really want to decrypt | 450 | /* Decrypt the skbuff in-place. TODO: We really want to decrypt |
464 | * directly into the target buffer. | 451 | * directly into the target buffer. |
465 | */ | 452 | */ |
466 | nsg = skb_cow_data(skb, 0, &trailer); | ||
467 | if (nsg < 0) | ||
468 | goto nomem; | ||
469 | |||
470 | sg = _sg; | 453 | sg = _sg; |
471 | if (unlikely(nsg > 4)) { | 454 | nsg = skb_shinfo(skb)->nr_frags; |
455 | if (nsg <= 4) { | ||
456 | nsg = 4; | ||
457 | } else { | ||
472 | sg = kmalloc_array(nsg, sizeof(*sg), GFP_NOIO); | 458 | sg = kmalloc_array(nsg, sizeof(*sg), GFP_NOIO); |
473 | if (!sg) | 459 | if (!sg) |
474 | goto nomem; | 460 | goto nomem; |
diff --git a/net/rxrpc/sendmsg.c b/net/rxrpc/sendmsg.c index bae14438f869..6a1547b270fe 100644 --- a/net/rxrpc/sendmsg.c +++ b/net/rxrpc/sendmsg.c | |||
@@ -176,7 +176,7 @@ static int rxrpc_queue_packet(struct rxrpc_sock *rx, struct rxrpc_call *call, | |||
176 | skb->tstamp = ktime_get_real(); | 176 | skb->tstamp = ktime_get_real(); |
177 | 177 | ||
178 | ix = seq & RXRPC_RXTX_BUFF_MASK; | 178 | ix = seq & RXRPC_RXTX_BUFF_MASK; |
179 | rxrpc_get_skb(skb, rxrpc_skb_tx_got); | 179 | rxrpc_get_skb(skb, rxrpc_skb_got); |
180 | call->rxtx_annotations[ix] = annotation; | 180 | call->rxtx_annotations[ix] = annotation; |
181 | smp_wmb(); | 181 | smp_wmb(); |
182 | call->rxtx_buffer[ix] = skb; | 182 | call->rxtx_buffer[ix] = skb; |
@@ -248,7 +248,7 @@ static int rxrpc_queue_packet(struct rxrpc_sock *rx, struct rxrpc_call *call, | |||
248 | } | 248 | } |
249 | 249 | ||
250 | out: | 250 | out: |
251 | rxrpc_free_skb(skb, rxrpc_skb_tx_freed); | 251 | rxrpc_free_skb(skb, rxrpc_skb_freed); |
252 | _leave(" = %d", ret); | 252 | _leave(" = %d", ret); |
253 | return ret; | 253 | return ret; |
254 | } | 254 | } |
@@ -289,7 +289,7 @@ static int rxrpc_send_data(struct rxrpc_sock *rx, | |||
289 | 289 | ||
290 | skb = call->tx_pending; | 290 | skb = call->tx_pending; |
291 | call->tx_pending = NULL; | 291 | call->tx_pending = NULL; |
292 | rxrpc_see_skb(skb, rxrpc_skb_tx_seen); | 292 | rxrpc_see_skb(skb, rxrpc_skb_seen); |
293 | 293 | ||
294 | copied = 0; | 294 | copied = 0; |
295 | do { | 295 | do { |
@@ -336,7 +336,9 @@ static int rxrpc_send_data(struct rxrpc_sock *rx, | |||
336 | if (!skb) | 336 | if (!skb) |
337 | goto maybe_error; | 337 | goto maybe_error; |
338 | 338 | ||
339 | rxrpc_new_skb(skb, rxrpc_skb_tx_new); | 339 | sp = rxrpc_skb(skb); |
340 | sp->rx_flags |= RXRPC_SKB_TX_BUFFER; | ||
341 | rxrpc_new_skb(skb, rxrpc_skb_new); | ||
340 | 342 | ||
341 | _debug("ALLOC SEND %p", skb); | 343 | _debug("ALLOC SEND %p", skb); |
342 | 344 | ||
@@ -346,7 +348,6 @@ static int rxrpc_send_data(struct rxrpc_sock *rx, | |||
346 | skb_reserve(skb, call->conn->security_size); | 348 | skb_reserve(skb, call->conn->security_size); |
347 | skb->len += call->conn->security_size; | 349 | skb->len += call->conn->security_size; |
348 | 350 | ||
349 | sp = rxrpc_skb(skb); | ||
350 | sp->remain = chunk; | 351 | sp->remain = chunk; |
351 | if (sp->remain > skb_tailroom(skb)) | 352 | if (sp->remain > skb_tailroom(skb)) |
352 | sp->remain = skb_tailroom(skb); | 353 | sp->remain = skb_tailroom(skb); |
@@ -439,7 +440,7 @@ out: | |||
439 | return ret; | 440 | return ret; |
440 | 441 | ||
441 | call_terminated: | 442 | call_terminated: |
442 | rxrpc_free_skb(skb, rxrpc_skb_tx_freed); | 443 | rxrpc_free_skb(skb, rxrpc_skb_freed); |
443 | _leave(" = %d", call->error); | 444 | _leave(" = %d", call->error); |
444 | return call->error; | 445 | return call->error; |
445 | 446 | ||
diff --git a/net/rxrpc/skbuff.c b/net/rxrpc/skbuff.c index 9ad5045b7c2f..0348d2bf6f7d 100644 --- a/net/rxrpc/skbuff.c +++ b/net/rxrpc/skbuff.c | |||
@@ -14,7 +14,8 @@ | |||
14 | #include <net/af_rxrpc.h> | 14 | #include <net/af_rxrpc.h> |
15 | #include "ar-internal.h" | 15 | #include "ar-internal.h" |
16 | 16 | ||
17 | #define select_skb_count(op) (op >= rxrpc_skb_tx_cleaned ? &rxrpc_n_tx_skbs : &rxrpc_n_rx_skbs) | 17 | #define is_tx_skb(skb) (rxrpc_skb(skb)->rx_flags & RXRPC_SKB_TX_BUFFER) |
18 | #define select_skb_count(skb) (is_tx_skb(skb) ? &rxrpc_n_tx_skbs : &rxrpc_n_rx_skbs) | ||
18 | 19 | ||
19 | /* | 20 | /* |
20 | * Note the allocation or reception of a socket buffer. | 21 | * Note the allocation or reception of a socket buffer. |
@@ -22,8 +23,9 @@ | |||
22 | void rxrpc_new_skb(struct sk_buff *skb, enum rxrpc_skb_trace op) | 23 | void rxrpc_new_skb(struct sk_buff *skb, enum rxrpc_skb_trace op) |
23 | { | 24 | { |
24 | const void *here = __builtin_return_address(0); | 25 | const void *here = __builtin_return_address(0); |
25 | int n = atomic_inc_return(select_skb_count(op)); | 26 | int n = atomic_inc_return(select_skb_count(skb)); |
26 | trace_rxrpc_skb(skb, op, refcount_read(&skb->users), n, here); | 27 | trace_rxrpc_skb(skb, op, refcount_read(&skb->users), n, |
28 | rxrpc_skb(skb)->rx_flags, here); | ||
27 | } | 29 | } |
28 | 30 | ||
29 | /* | 31 | /* |
@@ -33,8 +35,9 @@ void rxrpc_see_skb(struct sk_buff *skb, enum rxrpc_skb_trace op) | |||
33 | { | 35 | { |
34 | const void *here = __builtin_return_address(0); | 36 | const void *here = __builtin_return_address(0); |
35 | if (skb) { | 37 | if (skb) { |
36 | int n = atomic_read(select_skb_count(op)); | 38 | int n = atomic_read(select_skb_count(skb)); |
37 | trace_rxrpc_skb(skb, op, refcount_read(&skb->users), n, here); | 39 | trace_rxrpc_skb(skb, op, refcount_read(&skb->users), n, |
40 | rxrpc_skb(skb)->rx_flags, here); | ||
38 | } | 41 | } |
39 | } | 42 | } |
40 | 43 | ||
@@ -44,12 +47,23 @@ void rxrpc_see_skb(struct sk_buff *skb, enum rxrpc_skb_trace op) | |||
44 | void rxrpc_get_skb(struct sk_buff *skb, enum rxrpc_skb_trace op) | 47 | void rxrpc_get_skb(struct sk_buff *skb, enum rxrpc_skb_trace op) |
45 | { | 48 | { |
46 | const void *here = __builtin_return_address(0); | 49 | const void *here = __builtin_return_address(0); |
47 | int n = atomic_inc_return(select_skb_count(op)); | 50 | int n = atomic_inc_return(select_skb_count(skb)); |
48 | trace_rxrpc_skb(skb, op, refcount_read(&skb->users), n, here); | 51 | trace_rxrpc_skb(skb, op, refcount_read(&skb->users), n, |
52 | rxrpc_skb(skb)->rx_flags, here); | ||
49 | skb_get(skb); | 53 | skb_get(skb); |
50 | } | 54 | } |
51 | 55 | ||
52 | /* | 56 | /* |
57 | * Note the dropping of a ref on a socket buffer by the core. | ||
58 | */ | ||
59 | void rxrpc_eaten_skb(struct sk_buff *skb, enum rxrpc_skb_trace op) | ||
60 | { | ||
61 | const void *here = __builtin_return_address(0); | ||
62 | int n = atomic_inc_return(&rxrpc_n_rx_skbs); | ||
63 | trace_rxrpc_skb(skb, op, 0, n, 0, here); | ||
64 | } | ||
65 | |||
66 | /* | ||
53 | * Note the destruction of a socket buffer. | 67 | * Note the destruction of a socket buffer. |
54 | */ | 68 | */ |
55 | void rxrpc_free_skb(struct sk_buff *skb, enum rxrpc_skb_trace op) | 69 | void rxrpc_free_skb(struct sk_buff *skb, enum rxrpc_skb_trace op) |
@@ -58,8 +72,9 @@ void rxrpc_free_skb(struct sk_buff *skb, enum rxrpc_skb_trace op) | |||
58 | if (skb) { | 72 | if (skb) { |
59 | int n; | 73 | int n; |
60 | CHECK_SLAB_OKAY(&skb->users); | 74 | CHECK_SLAB_OKAY(&skb->users); |
61 | n = atomic_dec_return(select_skb_count(op)); | 75 | n = atomic_dec_return(select_skb_count(skb)); |
62 | trace_rxrpc_skb(skb, op, refcount_read(&skb->users), n, here); | 76 | trace_rxrpc_skb(skb, op, refcount_read(&skb->users), n, |
77 | rxrpc_skb(skb)->rx_flags, here); | ||
63 | kfree_skb(skb); | 78 | kfree_skb(skb); |
64 | } | 79 | } |
65 | } | 80 | } |
@@ -72,9 +87,10 @@ void rxrpc_purge_queue(struct sk_buff_head *list) | |||
72 | const void *here = __builtin_return_address(0); | 87 | const void *here = __builtin_return_address(0); |
73 | struct sk_buff *skb; | 88 | struct sk_buff *skb; |
74 | while ((skb = skb_dequeue((list))) != NULL) { | 89 | while ((skb = skb_dequeue((list))) != NULL) { |
75 | int n = atomic_dec_return(select_skb_count(rxrpc_skb_rx_purged)); | 90 | int n = atomic_dec_return(select_skb_count(skb)); |
76 | trace_rxrpc_skb(skb, rxrpc_skb_rx_purged, | 91 | trace_rxrpc_skb(skb, rxrpc_skb_purged, |
77 | refcount_read(&skb->users), n, here); | 92 | refcount_read(&skb->users), n, |
93 | rxrpc_skb(skb)->rx_flags, here); | ||
78 | kfree_skb(skb); | 94 | kfree_skb(skb); |
79 | } | 95 | } |
80 | } | 96 | } |
diff --git a/net/sched/act_bpf.c b/net/sched/act_bpf.c index fd1f7e799e23..04b7bd4ec751 100644 --- a/net/sched/act_bpf.c +++ b/net/sched/act_bpf.c | |||
@@ -422,7 +422,7 @@ static __net_init int bpf_init_net(struct net *net) | |||
422 | { | 422 | { |
423 | struct tc_action_net *tn = net_generic(net, bpf_net_id); | 423 | struct tc_action_net *tn = net_generic(net, bpf_net_id); |
424 | 424 | ||
425 | return tc_action_net_init(tn, &act_bpf_ops); | 425 | return tc_action_net_init(net, tn, &act_bpf_ops); |
426 | } | 426 | } |
427 | 427 | ||
428 | static void __net_exit bpf_exit_net(struct list_head *net_list) | 428 | static void __net_exit bpf_exit_net(struct list_head *net_list) |
diff --git a/net/sched/act_connmark.c b/net/sched/act_connmark.c index 32ac04d77a45..2b43cacf82af 100644 --- a/net/sched/act_connmark.c +++ b/net/sched/act_connmark.c | |||
@@ -231,7 +231,7 @@ static __net_init int connmark_init_net(struct net *net) | |||
231 | { | 231 | { |
232 | struct tc_action_net *tn = net_generic(net, connmark_net_id); | 232 | struct tc_action_net *tn = net_generic(net, connmark_net_id); |
233 | 233 | ||
234 | return tc_action_net_init(tn, &act_connmark_ops); | 234 | return tc_action_net_init(net, tn, &act_connmark_ops); |
235 | } | 235 | } |
236 | 236 | ||
237 | static void __net_exit connmark_exit_net(struct list_head *net_list) | 237 | static void __net_exit connmark_exit_net(struct list_head *net_list) |
diff --git a/net/sched/act_csum.c b/net/sched/act_csum.c index 9b9288267a54..d3cfad88dc3a 100644 --- a/net/sched/act_csum.c +++ b/net/sched/act_csum.c | |||
@@ -714,7 +714,7 @@ static __net_init int csum_init_net(struct net *net) | |||
714 | { | 714 | { |
715 | struct tc_action_net *tn = net_generic(net, csum_net_id); | 715 | struct tc_action_net *tn = net_generic(net, csum_net_id); |
716 | 716 | ||
717 | return tc_action_net_init(tn, &act_csum_ops); | 717 | return tc_action_net_init(net, tn, &act_csum_ops); |
718 | } | 718 | } |
719 | 719 | ||
720 | static void __net_exit csum_exit_net(struct list_head *net_list) | 720 | static void __net_exit csum_exit_net(struct list_head *net_list) |
diff --git a/net/sched/act_ct.c b/net/sched/act_ct.c index 33a1a7406e87..cdd6f3818097 100644 --- a/net/sched/act_ct.c +++ b/net/sched/act_ct.c | |||
@@ -939,7 +939,7 @@ static __net_init int ct_init_net(struct net *net) | |||
939 | tn->labels = true; | 939 | tn->labels = true; |
940 | } | 940 | } |
941 | 941 | ||
942 | return tc_action_net_init(&tn->tn, &act_ct_ops); | 942 | return tc_action_net_init(net, &tn->tn, &act_ct_ops); |
943 | } | 943 | } |
944 | 944 | ||
945 | static void __net_exit ct_exit_net(struct list_head *net_list) | 945 | static void __net_exit ct_exit_net(struct list_head *net_list) |
diff --git a/net/sched/act_ctinfo.c b/net/sched/act_ctinfo.c index 06ef74b74911..0dbcfd1dca7b 100644 --- a/net/sched/act_ctinfo.c +++ b/net/sched/act_ctinfo.c | |||
@@ -376,7 +376,7 @@ static __net_init int ctinfo_init_net(struct net *net) | |||
376 | { | 376 | { |
377 | struct tc_action_net *tn = net_generic(net, ctinfo_net_id); | 377 | struct tc_action_net *tn = net_generic(net, ctinfo_net_id); |
378 | 378 | ||
379 | return tc_action_net_init(tn, &act_ctinfo_ops); | 379 | return tc_action_net_init(net, tn, &act_ctinfo_ops); |
380 | } | 380 | } |
381 | 381 | ||
382 | static void __net_exit ctinfo_exit_net(struct list_head *net_list) | 382 | static void __net_exit ctinfo_exit_net(struct list_head *net_list) |
diff --git a/net/sched/act_gact.c b/net/sched/act_gact.c index 8f0140c6ca58..324f1d1f6d47 100644 --- a/net/sched/act_gact.c +++ b/net/sched/act_gact.c | |||
@@ -278,7 +278,7 @@ static __net_init int gact_init_net(struct net *net) | |||
278 | { | 278 | { |
279 | struct tc_action_net *tn = net_generic(net, gact_net_id); | 279 | struct tc_action_net *tn = net_generic(net, gact_net_id); |
280 | 280 | ||
281 | return tc_action_net_init(tn, &act_gact_ops); | 281 | return tc_action_net_init(net, tn, &act_gact_ops); |
282 | } | 282 | } |
283 | 283 | ||
284 | static void __net_exit gact_exit_net(struct list_head *net_list) | 284 | static void __net_exit gact_exit_net(struct list_head *net_list) |
diff --git a/net/sched/act_ife.c b/net/sched/act_ife.c index 92ee853d43e6..3a31e241c647 100644 --- a/net/sched/act_ife.c +++ b/net/sched/act_ife.c | |||
@@ -890,7 +890,7 @@ static __net_init int ife_init_net(struct net *net) | |||
890 | { | 890 | { |
891 | struct tc_action_net *tn = net_generic(net, ife_net_id); | 891 | struct tc_action_net *tn = net_generic(net, ife_net_id); |
892 | 892 | ||
893 | return tc_action_net_init(tn, &act_ife_ops); | 893 | return tc_action_net_init(net, tn, &act_ife_ops); |
894 | } | 894 | } |
895 | 895 | ||
896 | static void __net_exit ife_exit_net(struct list_head *net_list) | 896 | static void __net_exit ife_exit_net(struct list_head *net_list) |
diff --git a/net/sched/act_ipt.c b/net/sched/act_ipt.c index ce2c30a591d2..214a03d405cf 100644 --- a/net/sched/act_ipt.c +++ b/net/sched/act_ipt.c | |||
@@ -61,12 +61,13 @@ static int ipt_init_target(struct net *net, struct xt_entry_target *t, | |||
61 | return 0; | 61 | return 0; |
62 | } | 62 | } |
63 | 63 | ||
64 | static void ipt_destroy_target(struct xt_entry_target *t) | 64 | static void ipt_destroy_target(struct xt_entry_target *t, struct net *net) |
65 | { | 65 | { |
66 | struct xt_tgdtor_param par = { | 66 | struct xt_tgdtor_param par = { |
67 | .target = t->u.kernel.target, | 67 | .target = t->u.kernel.target, |
68 | .targinfo = t->data, | 68 | .targinfo = t->data, |
69 | .family = NFPROTO_IPV4, | 69 | .family = NFPROTO_IPV4, |
70 | .net = net, | ||
70 | }; | 71 | }; |
71 | if (par.target->destroy != NULL) | 72 | if (par.target->destroy != NULL) |
72 | par.target->destroy(&par); | 73 | par.target->destroy(&par); |
@@ -78,7 +79,7 @@ static void tcf_ipt_release(struct tc_action *a) | |||
78 | struct tcf_ipt *ipt = to_ipt(a); | 79 | struct tcf_ipt *ipt = to_ipt(a); |
79 | 80 | ||
80 | if (ipt->tcfi_t) { | 81 | if (ipt->tcfi_t) { |
81 | ipt_destroy_target(ipt->tcfi_t); | 82 | ipt_destroy_target(ipt->tcfi_t, a->idrinfo->net); |
82 | kfree(ipt->tcfi_t); | 83 | kfree(ipt->tcfi_t); |
83 | } | 84 | } |
84 | kfree(ipt->tcfi_tname); | 85 | kfree(ipt->tcfi_tname); |
@@ -180,7 +181,7 @@ static int __tcf_ipt_init(struct net *net, unsigned int id, struct nlattr *nla, | |||
180 | 181 | ||
181 | spin_lock_bh(&ipt->tcf_lock); | 182 | spin_lock_bh(&ipt->tcf_lock); |
182 | if (ret != ACT_P_CREATED) { | 183 | if (ret != ACT_P_CREATED) { |
183 | ipt_destroy_target(ipt->tcfi_t); | 184 | ipt_destroy_target(ipt->tcfi_t, net); |
184 | kfree(ipt->tcfi_tname); | 185 | kfree(ipt->tcfi_tname); |
185 | kfree(ipt->tcfi_t); | 186 | kfree(ipt->tcfi_t); |
186 | } | 187 | } |
@@ -350,7 +351,7 @@ static __net_init int ipt_init_net(struct net *net) | |||
350 | { | 351 | { |
351 | struct tc_action_net *tn = net_generic(net, ipt_net_id); | 352 | struct tc_action_net *tn = net_generic(net, ipt_net_id); |
352 | 353 | ||
353 | return tc_action_net_init(tn, &act_ipt_ops); | 354 | return tc_action_net_init(net, tn, &act_ipt_ops); |
354 | } | 355 | } |
355 | 356 | ||
356 | static void __net_exit ipt_exit_net(struct list_head *net_list) | 357 | static void __net_exit ipt_exit_net(struct list_head *net_list) |
@@ -399,7 +400,7 @@ static __net_init int xt_init_net(struct net *net) | |||
399 | { | 400 | { |
400 | struct tc_action_net *tn = net_generic(net, xt_net_id); | 401 | struct tc_action_net *tn = net_generic(net, xt_net_id); |
401 | 402 | ||
402 | return tc_action_net_init(tn, &act_xt_ops); | 403 | return tc_action_net_init(net, tn, &act_xt_ops); |
403 | } | 404 | } |
404 | 405 | ||
405 | static void __net_exit xt_exit_net(struct list_head *net_list) | 406 | static void __net_exit xt_exit_net(struct list_head *net_list) |
diff --git a/net/sched/act_mirred.c b/net/sched/act_mirred.c index be3f88dfc37e..9d1bf508075a 100644 --- a/net/sched/act_mirred.c +++ b/net/sched/act_mirred.c | |||
@@ -453,7 +453,7 @@ static __net_init int mirred_init_net(struct net *net) | |||
453 | { | 453 | { |
454 | struct tc_action_net *tn = net_generic(net, mirred_net_id); | 454 | struct tc_action_net *tn = net_generic(net, mirred_net_id); |
455 | 455 | ||
456 | return tc_action_net_init(tn, &act_mirred_ops); | 456 | return tc_action_net_init(net, tn, &act_mirred_ops); |
457 | } | 457 | } |
458 | 458 | ||
459 | static void __net_exit mirred_exit_net(struct list_head *net_list) | 459 | static void __net_exit mirred_exit_net(struct list_head *net_list) |
diff --git a/net/sched/act_mpls.c b/net/sched/act_mpls.c index 0f299e3b618c..e168df0e008a 100644 --- a/net/sched/act_mpls.c +++ b/net/sched/act_mpls.c | |||
@@ -375,7 +375,7 @@ static __net_init int mpls_init_net(struct net *net) | |||
375 | { | 375 | { |
376 | struct tc_action_net *tn = net_generic(net, mpls_net_id); | 376 | struct tc_action_net *tn = net_generic(net, mpls_net_id); |
377 | 377 | ||
378 | return tc_action_net_init(tn, &act_mpls_ops); | 378 | return tc_action_net_init(net, tn, &act_mpls_ops); |
379 | } | 379 | } |
380 | 380 | ||
381 | static void __net_exit mpls_exit_net(struct list_head *net_list) | 381 | static void __net_exit mpls_exit_net(struct list_head *net_list) |
diff --git a/net/sched/act_nat.c b/net/sched/act_nat.c index 7b858c11b1b5..ea4c5359e7df 100644 --- a/net/sched/act_nat.c +++ b/net/sched/act_nat.c | |||
@@ -327,7 +327,7 @@ static __net_init int nat_init_net(struct net *net) | |||
327 | { | 327 | { |
328 | struct tc_action_net *tn = net_generic(net, nat_net_id); | 328 | struct tc_action_net *tn = net_generic(net, nat_net_id); |
329 | 329 | ||
330 | return tc_action_net_init(tn, &act_nat_ops); | 330 | return tc_action_net_init(net, tn, &act_nat_ops); |
331 | } | 331 | } |
332 | 332 | ||
333 | static void __net_exit nat_exit_net(struct list_head *net_list) | 333 | static void __net_exit nat_exit_net(struct list_head *net_list) |
diff --git a/net/sched/act_pedit.c b/net/sched/act_pedit.c index 17360c6faeaa..cdfaa79382a2 100644 --- a/net/sched/act_pedit.c +++ b/net/sched/act_pedit.c | |||
@@ -498,7 +498,7 @@ static __net_init int pedit_init_net(struct net *net) | |||
498 | { | 498 | { |
499 | struct tc_action_net *tn = net_generic(net, pedit_net_id); | 499 | struct tc_action_net *tn = net_generic(net, pedit_net_id); |
500 | 500 | ||
501 | return tc_action_net_init(tn, &act_pedit_ops); | 501 | return tc_action_net_init(net, tn, &act_pedit_ops); |
502 | } | 502 | } |
503 | 503 | ||
504 | static void __net_exit pedit_exit_net(struct list_head *net_list) | 504 | static void __net_exit pedit_exit_net(struct list_head *net_list) |
diff --git a/net/sched/act_police.c b/net/sched/act_police.c index 49cec3e64a4d..6315e0f8d26e 100644 --- a/net/sched/act_police.c +++ b/net/sched/act_police.c | |||
@@ -371,7 +371,7 @@ static __net_init int police_init_net(struct net *net) | |||
371 | { | 371 | { |
372 | struct tc_action_net *tn = net_generic(net, police_net_id); | 372 | struct tc_action_net *tn = net_generic(net, police_net_id); |
373 | 373 | ||
374 | return tc_action_net_init(tn, &act_police_ops); | 374 | return tc_action_net_init(net, tn, &act_police_ops); |
375 | } | 375 | } |
376 | 376 | ||
377 | static void __net_exit police_exit_net(struct list_head *net_list) | 377 | static void __net_exit police_exit_net(struct list_head *net_list) |
diff --git a/net/sched/act_sample.c b/net/sched/act_sample.c index 595308d60133..10229124a992 100644 --- a/net/sched/act_sample.c +++ b/net/sched/act_sample.c | |||
@@ -102,13 +102,17 @@ static int tcf_sample_init(struct net *net, struct nlattr *nla, | |||
102 | goto_ch = tcf_action_set_ctrlact(*a, parm->action, goto_ch); | 102 | goto_ch = tcf_action_set_ctrlact(*a, parm->action, goto_ch); |
103 | s->rate = rate; | 103 | s->rate = rate; |
104 | s->psample_group_num = psample_group_num; | 104 | s->psample_group_num = psample_group_num; |
105 | RCU_INIT_POINTER(s->psample_group, psample_group); | 105 | rcu_swap_protected(s->psample_group, psample_group, |
106 | lockdep_is_held(&s->tcf_lock)); | ||
106 | 107 | ||
107 | if (tb[TCA_SAMPLE_TRUNC_SIZE]) { | 108 | if (tb[TCA_SAMPLE_TRUNC_SIZE]) { |
108 | s->truncate = true; | 109 | s->truncate = true; |
109 | s->trunc_size = nla_get_u32(tb[TCA_SAMPLE_TRUNC_SIZE]); | 110 | s->trunc_size = nla_get_u32(tb[TCA_SAMPLE_TRUNC_SIZE]); |
110 | } | 111 | } |
111 | spin_unlock_bh(&s->tcf_lock); | 112 | spin_unlock_bh(&s->tcf_lock); |
113 | |||
114 | if (psample_group) | ||
115 | psample_group_put(psample_group); | ||
112 | if (goto_ch) | 116 | if (goto_ch) |
113 | tcf_chain_put_by_act(goto_ch); | 117 | tcf_chain_put_by_act(goto_ch); |
114 | 118 | ||
@@ -265,7 +269,7 @@ static __net_init int sample_init_net(struct net *net) | |||
265 | { | 269 | { |
266 | struct tc_action_net *tn = net_generic(net, sample_net_id); | 270 | struct tc_action_net *tn = net_generic(net, sample_net_id); |
267 | 271 | ||
268 | return tc_action_net_init(tn, &act_sample_ops); | 272 | return tc_action_net_init(net, tn, &act_sample_ops); |
269 | } | 273 | } |
270 | 274 | ||
271 | static void __net_exit sample_exit_net(struct list_head *net_list) | 275 | static void __net_exit sample_exit_net(struct list_head *net_list) |
diff --git a/net/sched/act_simple.c b/net/sched/act_simple.c index 33aefa25b545..6120e56117ca 100644 --- a/net/sched/act_simple.c +++ b/net/sched/act_simple.c | |||
@@ -232,7 +232,7 @@ static __net_init int simp_init_net(struct net *net) | |||
232 | { | 232 | { |
233 | struct tc_action_net *tn = net_generic(net, simp_net_id); | 233 | struct tc_action_net *tn = net_generic(net, simp_net_id); |
234 | 234 | ||
235 | return tc_action_net_init(tn, &act_simp_ops); | 235 | return tc_action_net_init(net, tn, &act_simp_ops); |
236 | } | 236 | } |
237 | 237 | ||
238 | static void __net_exit simp_exit_net(struct list_head *net_list) | 238 | static void __net_exit simp_exit_net(struct list_head *net_list) |
diff --git a/net/sched/act_skbedit.c b/net/sched/act_skbedit.c index 37dced00b63d..6a8d3337c577 100644 --- a/net/sched/act_skbedit.c +++ b/net/sched/act_skbedit.c | |||
@@ -336,7 +336,7 @@ static __net_init int skbedit_init_net(struct net *net) | |||
336 | { | 336 | { |
337 | struct tc_action_net *tn = net_generic(net, skbedit_net_id); | 337 | struct tc_action_net *tn = net_generic(net, skbedit_net_id); |
338 | 338 | ||
339 | return tc_action_net_init(tn, &act_skbedit_ops); | 339 | return tc_action_net_init(net, tn, &act_skbedit_ops); |
340 | } | 340 | } |
341 | 341 | ||
342 | static void __net_exit skbedit_exit_net(struct list_head *net_list) | 342 | static void __net_exit skbedit_exit_net(struct list_head *net_list) |
diff --git a/net/sched/act_skbmod.c b/net/sched/act_skbmod.c index 7da3518e18ef..888437f97ba6 100644 --- a/net/sched/act_skbmod.c +++ b/net/sched/act_skbmod.c | |||
@@ -287,7 +287,7 @@ static __net_init int skbmod_init_net(struct net *net) | |||
287 | { | 287 | { |
288 | struct tc_action_net *tn = net_generic(net, skbmod_net_id); | 288 | struct tc_action_net *tn = net_generic(net, skbmod_net_id); |
289 | 289 | ||
290 | return tc_action_net_init(tn, &act_skbmod_ops); | 290 | return tc_action_net_init(net, tn, &act_skbmod_ops); |
291 | } | 291 | } |
292 | 292 | ||
293 | static void __net_exit skbmod_exit_net(struct list_head *net_list) | 293 | static void __net_exit skbmod_exit_net(struct list_head *net_list) |
diff --git a/net/sched/act_tunnel_key.c b/net/sched/act_tunnel_key.c index 6d0debdc9b97..2f83a79f76aa 100644 --- a/net/sched/act_tunnel_key.c +++ b/net/sched/act_tunnel_key.c | |||
@@ -600,7 +600,7 @@ static __net_init int tunnel_key_init_net(struct net *net) | |||
600 | { | 600 | { |
601 | struct tc_action_net *tn = net_generic(net, tunnel_key_net_id); | 601 | struct tc_action_net *tn = net_generic(net, tunnel_key_net_id); |
602 | 602 | ||
603 | return tc_action_net_init(tn, &act_tunnel_key_ops); | 603 | return tc_action_net_init(net, tn, &act_tunnel_key_ops); |
604 | } | 604 | } |
605 | 605 | ||
606 | static void __net_exit tunnel_key_exit_net(struct list_head *net_list) | 606 | static void __net_exit tunnel_key_exit_net(struct list_head *net_list) |
diff --git a/net/sched/act_vlan.c b/net/sched/act_vlan.c index 216b75709875..08aaf719a70f 100644 --- a/net/sched/act_vlan.c +++ b/net/sched/act_vlan.c | |||
@@ -348,7 +348,7 @@ static __net_init int vlan_init_net(struct net *net) | |||
348 | { | 348 | { |
349 | struct tc_action_net *tn = net_generic(net, vlan_net_id); | 349 | struct tc_action_net *tn = net_generic(net, vlan_net_id); |
350 | 350 | ||
351 | return tc_action_net_init(tn, &act_vlan_ops); | 351 | return tc_action_net_init(net, tn, &act_vlan_ops); |
352 | } | 352 | } |
353 | 353 | ||
354 | static void __net_exit vlan_exit_net(struct list_head *net_list) | 354 | static void __net_exit vlan_exit_net(struct list_head *net_list) |
diff --git a/net/sched/sch_cbs.c b/net/sched/sch_cbs.c index 732e109c3055..810645b5c086 100644 --- a/net/sched/sch_cbs.c +++ b/net/sched/sch_cbs.c | |||
@@ -181,11 +181,6 @@ static struct sk_buff *cbs_dequeue_soft(struct Qdisc *sch) | |||
181 | s64 credits; | 181 | s64 credits; |
182 | int len; | 182 | int len; |
183 | 183 | ||
184 | if (atomic64_read(&q->port_rate) == -1) { | ||
185 | WARN_ONCE(1, "cbs: dequeue() called with unknown port rate."); | ||
186 | return NULL; | ||
187 | } | ||
188 | |||
189 | if (q->credits < 0) { | 184 | if (q->credits < 0) { |
190 | credits = timediff_to_credits(now - q->last, q->idleslope); | 185 | credits = timediff_to_credits(now - q->last, q->idleslope); |
191 | 186 | ||
@@ -303,11 +298,19 @@ static int cbs_enable_offload(struct net_device *dev, struct cbs_sched_data *q, | |||
303 | static void cbs_set_port_rate(struct net_device *dev, struct cbs_sched_data *q) | 298 | static void cbs_set_port_rate(struct net_device *dev, struct cbs_sched_data *q) |
304 | { | 299 | { |
305 | struct ethtool_link_ksettings ecmd; | 300 | struct ethtool_link_ksettings ecmd; |
301 | int speed = SPEED_10; | ||
306 | int port_rate = -1; | 302 | int port_rate = -1; |
303 | int err; | ||
304 | |||
305 | err = __ethtool_get_link_ksettings(dev, &ecmd); | ||
306 | if (err < 0) | ||
307 | goto skip; | ||
308 | |||
309 | if (ecmd.base.speed != SPEED_UNKNOWN) | ||
310 | speed = ecmd.base.speed; | ||
307 | 311 | ||
308 | if (!__ethtool_get_link_ksettings(dev, &ecmd) && | 312 | skip: |
309 | ecmd.base.speed != SPEED_UNKNOWN) | 313 | port_rate = speed * 1000 * BYTES_PER_KBIT; |
310 | port_rate = ecmd.base.speed * 1000 * BYTES_PER_KBIT; | ||
311 | 314 | ||
312 | atomic64_set(&q->port_rate, port_rate); | 315 | atomic64_set(&q->port_rate, port_rate); |
313 | netdev_dbg(dev, "cbs: set %s's port_rate to: %lld, linkspeed: %d\n", | 316 | netdev_dbg(dev, "cbs: set %s's port_rate to: %lld, linkspeed: %d\n", |
diff --git a/net/sched/sch_generic.c b/net/sched/sch_generic.c index 11c03cf4aa74..137db1cbde85 100644 --- a/net/sched/sch_generic.c +++ b/net/sched/sch_generic.c | |||
@@ -624,8 +624,12 @@ static int pfifo_fast_enqueue(struct sk_buff *skb, struct Qdisc *qdisc, | |||
624 | 624 | ||
625 | err = skb_array_produce(q, skb); | 625 | err = skb_array_produce(q, skb); |
626 | 626 | ||
627 | if (unlikely(err)) | 627 | if (unlikely(err)) { |
628 | return qdisc_drop_cpu(skb, qdisc, to_free); | 628 | if (qdisc_is_percpu_stats(qdisc)) |
629 | return qdisc_drop_cpu(skb, qdisc, to_free); | ||
630 | else | ||
631 | return qdisc_drop(skb, qdisc, to_free); | ||
632 | } | ||
629 | 633 | ||
630 | qdisc_update_stats_at_enqueue(qdisc, pkt_len); | 634 | qdisc_update_stats_at_enqueue(qdisc, pkt_len); |
631 | return NET_XMIT_SUCCESS; | 635 | return NET_XMIT_SUCCESS; |
@@ -688,11 +692,14 @@ static void pfifo_fast_reset(struct Qdisc *qdisc) | |||
688 | kfree_skb(skb); | 692 | kfree_skb(skb); |
689 | } | 693 | } |
690 | 694 | ||
691 | for_each_possible_cpu(i) { | 695 | if (qdisc_is_percpu_stats(qdisc)) { |
692 | struct gnet_stats_queue *q = per_cpu_ptr(qdisc->cpu_qstats, i); | 696 | for_each_possible_cpu(i) { |
697 | struct gnet_stats_queue *q; | ||
693 | 698 | ||
694 | q->backlog = 0; | 699 | q = per_cpu_ptr(qdisc->cpu_qstats, i); |
695 | q->qlen = 0; | 700 | q->backlog = 0; |
701 | q->qlen = 0; | ||
702 | } | ||
696 | } | 703 | } |
697 | } | 704 | } |
698 | 705 | ||
diff --git a/net/sched/sch_taprio.c b/net/sched/sch_taprio.c index 540bde009ea5..84b863e2bdbd 100644 --- a/net/sched/sch_taprio.c +++ b/net/sched/sch_taprio.c | |||
@@ -477,11 +477,6 @@ static struct sk_buff *taprio_dequeue(struct Qdisc *sch) | |||
477 | u32 gate_mask; | 477 | u32 gate_mask; |
478 | int i; | 478 | int i; |
479 | 479 | ||
480 | if (atomic64_read(&q->picos_per_byte) == -1) { | ||
481 | WARN_ONCE(1, "taprio: dequeue() called with unknown picos per byte."); | ||
482 | return NULL; | ||
483 | } | ||
484 | |||
485 | rcu_read_lock(); | 480 | rcu_read_lock(); |
486 | entry = rcu_dereference(q->current_entry); | 481 | entry = rcu_dereference(q->current_entry); |
487 | /* if there's no entry, it means that the schedule didn't | 482 | /* if there's no entry, it means that the schedule didn't |
@@ -954,12 +949,20 @@ static void taprio_set_picos_per_byte(struct net_device *dev, | |||
954 | struct taprio_sched *q) | 949 | struct taprio_sched *q) |
955 | { | 950 | { |
956 | struct ethtool_link_ksettings ecmd; | 951 | struct ethtool_link_ksettings ecmd; |
957 | int picos_per_byte = -1; | 952 | int speed = SPEED_10; |
953 | int picos_per_byte; | ||
954 | int err; | ||
958 | 955 | ||
959 | if (!__ethtool_get_link_ksettings(dev, &ecmd) && | 956 | err = __ethtool_get_link_ksettings(dev, &ecmd); |
960 | ecmd.base.speed != SPEED_UNKNOWN) | 957 | if (err < 0) |
961 | picos_per_byte = div64_s64(NSEC_PER_SEC * 1000LL * 8, | 958 | goto skip; |
962 | ecmd.base.speed * 1000 * 1000); | 959 | |
960 | if (ecmd.base.speed != SPEED_UNKNOWN) | ||
961 | speed = ecmd.base.speed; | ||
962 | |||
963 | skip: | ||
964 | picos_per_byte = div64_s64(NSEC_PER_SEC * 1000LL * 8, | ||
965 | speed * 1000 * 1000); | ||
963 | 966 | ||
964 | atomic64_set(&q->picos_per_byte, picos_per_byte); | 967 | atomic64_set(&q->picos_per_byte, picos_per_byte); |
965 | netdev_dbg(dev, "taprio: set %s's picos_per_byte to: %lld, linkspeed: %d\n", | 968 | netdev_dbg(dev, "taprio: set %s's picos_per_byte to: %lld, linkspeed: %d\n", |
@@ -1245,6 +1248,10 @@ static int taprio_init(struct Qdisc *sch, struct nlattr *opt, | |||
1245 | */ | 1248 | */ |
1246 | q->clockid = -1; | 1249 | q->clockid = -1; |
1247 | 1250 | ||
1251 | spin_lock(&taprio_list_lock); | ||
1252 | list_add(&q->taprio_list, &taprio_list); | ||
1253 | spin_unlock(&taprio_list_lock); | ||
1254 | |||
1248 | if (sch->parent != TC_H_ROOT) | 1255 | if (sch->parent != TC_H_ROOT) |
1249 | return -EOPNOTSUPP; | 1256 | return -EOPNOTSUPP; |
1250 | 1257 | ||
@@ -1262,10 +1269,6 @@ static int taprio_init(struct Qdisc *sch, struct nlattr *opt, | |||
1262 | if (!opt) | 1269 | if (!opt) |
1263 | return -EINVAL; | 1270 | return -EINVAL; |
1264 | 1271 | ||
1265 | spin_lock(&taprio_list_lock); | ||
1266 | list_add(&q->taprio_list, &taprio_list); | ||
1267 | spin_unlock(&taprio_list_lock); | ||
1268 | |||
1269 | for (i = 0; i < dev->num_tx_queues; i++) { | 1272 | for (i = 0; i < dev->num_tx_queues; i++) { |
1270 | struct netdev_queue *dev_queue; | 1273 | struct netdev_queue *dev_queue; |
1271 | struct Qdisc *qdisc; | 1274 | struct Qdisc *qdisc; |
diff --git a/security/keys/request_key.c b/security/keys/request_key.c index 7325f382dbf4..957b9e3e1492 100644 --- a/security/keys/request_key.c +++ b/security/keys/request_key.c | |||
@@ -595,7 +595,7 @@ struct key *request_key_and_link(struct key_type *type, | |||
595 | 595 | ||
596 | key = check_cached_key(&ctx); | 596 | key = check_cached_key(&ctx); |
597 | if (key) | 597 | if (key) |
598 | return key; | 598 | goto error_free; |
599 | 599 | ||
600 | /* search all the process keyrings for a key */ | 600 | /* search all the process keyrings for a key */ |
601 | rcu_read_lock(); | 601 | rcu_read_lock(); |
diff --git a/tools/power/x86/turbostat/Makefile b/tools/power/x86/turbostat/Makefile index 045f5f7d68ab..13f1e8b9ac52 100644 --- a/tools/power/x86/turbostat/Makefile +++ b/tools/power/x86/turbostat/Makefile | |||
@@ -9,9 +9,10 @@ ifeq ("$(origin O)", "command line") | |||
9 | endif | 9 | endif |
10 | 10 | ||
11 | turbostat : turbostat.c | 11 | turbostat : turbostat.c |
12 | override CFLAGS += -Wall -I../../../include | 12 | override CFLAGS += -O2 -Wall -I../../../include |
13 | override CFLAGS += -DMSRHEADER='"../../../../arch/x86/include/asm/msr-index.h"' | 13 | override CFLAGS += -DMSRHEADER='"../../../../arch/x86/include/asm/msr-index.h"' |
14 | override CFLAGS += -DINTEL_FAMILY_HEADER='"../../../../arch/x86/include/asm/intel-family.h"' | 14 | override CFLAGS += -DINTEL_FAMILY_HEADER='"../../../../arch/x86/include/asm/intel-family.h"' |
15 | override CFLAGS += -D_FORTIFY_SOURCE=2 | ||
15 | 16 | ||
16 | %: %.c | 17 | %: %.c |
17 | @mkdir -p $(BUILD_OUTPUT) | 18 | @mkdir -p $(BUILD_OUTPUT) |
diff --git a/tools/power/x86/turbostat/turbostat.c b/tools/power/x86/turbostat/turbostat.c index 75fc4fb9901c..b2a86438f074 100644 --- a/tools/power/x86/turbostat/turbostat.c +++ b/tools/power/x86/turbostat/turbostat.c | |||
@@ -39,7 +39,6 @@ FILE *outf; | |||
39 | int *fd_percpu; | 39 | int *fd_percpu; |
40 | struct timeval interval_tv = {5, 0}; | 40 | struct timeval interval_tv = {5, 0}; |
41 | struct timespec interval_ts = {5, 0}; | 41 | struct timespec interval_ts = {5, 0}; |
42 | struct timespec one_msec = {0, 1000000}; | ||
43 | unsigned int num_iterations; | 42 | unsigned int num_iterations; |
44 | unsigned int debug; | 43 | unsigned int debug; |
45 | unsigned int quiet; | 44 | unsigned int quiet; |
@@ -60,6 +59,7 @@ unsigned int do_irtl_hsw; | |||
60 | unsigned int units = 1000000; /* MHz etc */ | 59 | unsigned int units = 1000000; /* MHz etc */ |
61 | unsigned int genuine_intel; | 60 | unsigned int genuine_intel; |
62 | unsigned int authentic_amd; | 61 | unsigned int authentic_amd; |
62 | unsigned int hygon_genuine; | ||
63 | unsigned int max_level, max_extended_level; | 63 | unsigned int max_level, max_extended_level; |
64 | unsigned int has_invariant_tsc; | 64 | unsigned int has_invariant_tsc; |
65 | unsigned int do_nhm_platform_info; | 65 | unsigned int do_nhm_platform_info; |
@@ -100,6 +100,7 @@ unsigned int has_hwp_epp; /* IA32_HWP_REQUEST[bits 31:24] */ | |||
100 | unsigned int has_hwp_pkg; /* IA32_HWP_REQUEST_PKG */ | 100 | unsigned int has_hwp_pkg; /* IA32_HWP_REQUEST_PKG */ |
101 | unsigned int has_misc_feature_control; | 101 | unsigned int has_misc_feature_control; |
102 | unsigned int first_counter_read = 1; | 102 | unsigned int first_counter_read = 1; |
103 | int ignore_stdin; | ||
103 | 104 | ||
104 | #define RAPL_PKG (1 << 0) | 105 | #define RAPL_PKG (1 << 0) |
105 | /* 0x610 MSR_PKG_POWER_LIMIT */ | 106 | /* 0x610 MSR_PKG_POWER_LIMIT */ |
@@ -166,6 +167,7 @@ size_t cpu_present_setsize, cpu_affinity_setsize, cpu_subset_size; | |||
166 | struct thread_data { | 167 | struct thread_data { |
167 | struct timeval tv_begin; | 168 | struct timeval tv_begin; |
168 | struct timeval tv_end; | 169 | struct timeval tv_end; |
170 | struct timeval tv_delta; | ||
169 | unsigned long long tsc; | 171 | unsigned long long tsc; |
170 | unsigned long long aperf; | 172 | unsigned long long aperf; |
171 | unsigned long long mperf; | 173 | unsigned long long mperf; |
@@ -506,6 +508,7 @@ unsigned long long bic_enabled = (0xFFFFFFFFFFFFFFFFULL & ~BIC_DISABLED_BY_DEFAU | |||
506 | unsigned long long bic_present = BIC_USEC | BIC_TOD | BIC_sysfs | BIC_APIC | BIC_X2APIC; | 508 | unsigned long long bic_present = BIC_USEC | BIC_TOD | BIC_sysfs | BIC_APIC | BIC_X2APIC; |
507 | 509 | ||
508 | #define DO_BIC(COUNTER_NAME) (bic_enabled & bic_present & COUNTER_NAME) | 510 | #define DO_BIC(COUNTER_NAME) (bic_enabled & bic_present & COUNTER_NAME) |
511 | #define DO_BIC_READ(COUNTER_NAME) (bic_present & COUNTER_NAME) | ||
509 | #define ENABLE_BIC(COUNTER_NAME) (bic_enabled |= COUNTER_NAME) | 512 | #define ENABLE_BIC(COUNTER_NAME) (bic_enabled |= COUNTER_NAME) |
510 | #define BIC_PRESENT(COUNTER_BIT) (bic_present |= COUNTER_BIT) | 513 | #define BIC_PRESENT(COUNTER_BIT) (bic_present |= COUNTER_BIT) |
511 | #define BIC_NOT_PRESENT(COUNTER_BIT) (bic_present &= ~COUNTER_BIT) | 514 | #define BIC_NOT_PRESENT(COUNTER_BIT) (bic_present &= ~COUNTER_BIT) |
@@ -849,7 +852,6 @@ int dump_counters(struct thread_data *t, struct core_data *c, | |||
849 | outp += sprintf(outp, "pc8: %016llX\n", p->pc8); | 852 | outp += sprintf(outp, "pc8: %016llX\n", p->pc8); |
850 | outp += sprintf(outp, "pc9: %016llX\n", p->pc9); | 853 | outp += sprintf(outp, "pc9: %016llX\n", p->pc9); |
851 | outp += sprintf(outp, "pc10: %016llX\n", p->pc10); | 854 | outp += sprintf(outp, "pc10: %016llX\n", p->pc10); |
852 | outp += sprintf(outp, "pc10: %016llX\n", p->pc10); | ||
853 | outp += sprintf(outp, "cpu_lpi: %016llX\n", p->cpu_lpi); | 855 | outp += sprintf(outp, "cpu_lpi: %016llX\n", p->cpu_lpi); |
854 | outp += sprintf(outp, "sys_lpi: %016llX\n", p->sys_lpi); | 856 | outp += sprintf(outp, "sys_lpi: %016llX\n", p->sys_lpi); |
855 | outp += sprintf(outp, "Joules PKG: %0X\n", p->energy_pkg); | 857 | outp += sprintf(outp, "Joules PKG: %0X\n", p->energy_pkg); |
@@ -911,7 +913,7 @@ int format_counters(struct thread_data *t, struct core_data *c, | |||
911 | if (DO_BIC(BIC_TOD)) | 913 | if (DO_BIC(BIC_TOD)) |
912 | outp += sprintf(outp, "%10ld.%06ld\t", t->tv_end.tv_sec, t->tv_end.tv_usec); | 914 | outp += sprintf(outp, "%10ld.%06ld\t", t->tv_end.tv_sec, t->tv_end.tv_usec); |
913 | 915 | ||
914 | interval_float = tv_delta.tv_sec + tv_delta.tv_usec/1000000.0; | 916 | interval_float = t->tv_delta.tv_sec + t->tv_delta.tv_usec/1000000.0; |
915 | 917 | ||
916 | tsc = t->tsc * tsc_tweak; | 918 | tsc = t->tsc * tsc_tweak; |
917 | 919 | ||
@@ -1287,6 +1289,14 @@ delta_core(struct core_data *new, struct core_data *old) | |||
1287 | } | 1289 | } |
1288 | } | 1290 | } |
1289 | 1291 | ||
1292 | int soft_c1_residency_display(int bic) | ||
1293 | { | ||
1294 | if (!DO_BIC(BIC_CPU_c1) || use_c1_residency_msr) | ||
1295 | return 0; | ||
1296 | |||
1297 | return DO_BIC_READ(bic); | ||
1298 | } | ||
1299 | |||
1290 | /* | 1300 | /* |
1291 | * old = new - old | 1301 | * old = new - old |
1292 | */ | 1302 | */ |
@@ -1309,6 +1319,7 @@ delta_thread(struct thread_data *new, struct thread_data *old, | |||
1309 | * over-write old w/ new so we can print end of interval values | 1319 | * over-write old w/ new so we can print end of interval values |
1310 | */ | 1320 | */ |
1311 | 1321 | ||
1322 | timersub(&new->tv_begin, &old->tv_begin, &old->tv_delta); | ||
1312 | old->tv_begin = new->tv_begin; | 1323 | old->tv_begin = new->tv_begin; |
1313 | old->tv_end = new->tv_end; | 1324 | old->tv_end = new->tv_end; |
1314 | 1325 | ||
@@ -1322,7 +1333,8 @@ delta_thread(struct thread_data *new, struct thread_data *old, | |||
1322 | 1333 | ||
1323 | old->c1 = new->c1 - old->c1; | 1334 | old->c1 = new->c1 - old->c1; |
1324 | 1335 | ||
1325 | if (DO_BIC(BIC_Avg_MHz) || DO_BIC(BIC_Busy) || DO_BIC(BIC_Bzy_MHz)) { | 1336 | if (DO_BIC(BIC_Avg_MHz) || DO_BIC(BIC_Busy) || DO_BIC(BIC_Bzy_MHz) || |
1337 | soft_c1_residency_display(BIC_Avg_MHz)) { | ||
1326 | if ((new->aperf > old->aperf) && (new->mperf > old->mperf)) { | 1338 | if ((new->aperf > old->aperf) && (new->mperf > old->mperf)) { |
1327 | old->aperf = new->aperf - old->aperf; | 1339 | old->aperf = new->aperf - old->aperf; |
1328 | old->mperf = new->mperf - old->mperf; | 1340 | old->mperf = new->mperf - old->mperf; |
@@ -1404,6 +1416,8 @@ void clear_counters(struct thread_data *t, struct core_data *c, struct pkg_data | |||
1404 | t->tv_begin.tv_usec = 0; | 1416 | t->tv_begin.tv_usec = 0; |
1405 | t->tv_end.tv_sec = 0; | 1417 | t->tv_end.tv_sec = 0; |
1406 | t->tv_end.tv_usec = 0; | 1418 | t->tv_end.tv_usec = 0; |
1419 | t->tv_delta.tv_sec = 0; | ||
1420 | t->tv_delta.tv_usec = 0; | ||
1407 | 1421 | ||
1408 | t->tsc = 0; | 1422 | t->tsc = 0; |
1409 | t->aperf = 0; | 1423 | t->aperf = 0; |
@@ -1573,6 +1587,9 @@ void compute_average(struct thread_data *t, struct core_data *c, | |||
1573 | 1587 | ||
1574 | for_all_cpus(sum_counters, t, c, p); | 1588 | for_all_cpus(sum_counters, t, c, p); |
1575 | 1589 | ||
1590 | /* Use the global time delta for the average. */ | ||
1591 | average.threads.tv_delta = tv_delta; | ||
1592 | |||
1576 | average.threads.tsc /= topo.num_cpus; | 1593 | average.threads.tsc /= topo.num_cpus; |
1577 | average.threads.aperf /= topo.num_cpus; | 1594 | average.threads.aperf /= topo.num_cpus; |
1578 | average.threads.mperf /= topo.num_cpus; | 1595 | average.threads.mperf /= topo.num_cpus; |
@@ -1714,7 +1731,7 @@ void get_apic_id(struct thread_data *t) | |||
1714 | if (!DO_BIC(BIC_X2APIC)) | 1731 | if (!DO_BIC(BIC_X2APIC)) |
1715 | return; | 1732 | return; |
1716 | 1733 | ||
1717 | if (authentic_amd) { | 1734 | if (authentic_amd || hygon_genuine) { |
1718 | unsigned int topology_extensions; | 1735 | unsigned int topology_extensions; |
1719 | 1736 | ||
1720 | if (max_extended_level < 0x8000001e) | 1737 | if (max_extended_level < 0x8000001e) |
@@ -1762,19 +1779,20 @@ int get_counters(struct thread_data *t, struct core_data *c, struct pkg_data *p) | |||
1762 | struct msr_counter *mp; | 1779 | struct msr_counter *mp; |
1763 | int i; | 1780 | int i; |
1764 | 1781 | ||
1765 | gettimeofday(&t->tv_begin, (struct timezone *)NULL); | ||
1766 | |||
1767 | if (cpu_migrate(cpu)) { | 1782 | if (cpu_migrate(cpu)) { |
1768 | fprintf(outf, "Could not migrate to CPU %d\n", cpu); | 1783 | fprintf(outf, "Could not migrate to CPU %d\n", cpu); |
1769 | return -1; | 1784 | return -1; |
1770 | } | 1785 | } |
1771 | 1786 | ||
1787 | gettimeofday(&t->tv_begin, (struct timezone *)NULL); | ||
1788 | |||
1772 | if (first_counter_read) | 1789 | if (first_counter_read) |
1773 | get_apic_id(t); | 1790 | get_apic_id(t); |
1774 | retry: | 1791 | retry: |
1775 | t->tsc = rdtsc(); /* we are running on local CPU of interest */ | 1792 | t->tsc = rdtsc(); /* we are running on local CPU of interest */ |
1776 | 1793 | ||
1777 | if (DO_BIC(BIC_Avg_MHz) || DO_BIC(BIC_Busy) || DO_BIC(BIC_Bzy_MHz)) { | 1794 | if (DO_BIC(BIC_Avg_MHz) || DO_BIC(BIC_Busy) || DO_BIC(BIC_Bzy_MHz) || |
1795 | soft_c1_residency_display(BIC_Avg_MHz)) { | ||
1778 | unsigned long long tsc_before, tsc_between, tsc_after, aperf_time, mperf_time; | 1796 | unsigned long long tsc_before, tsc_between, tsc_after, aperf_time, mperf_time; |
1779 | 1797 | ||
1780 | /* | 1798 | /* |
@@ -1851,20 +1869,20 @@ retry: | |||
1851 | if (!(t->flags & CPU_IS_FIRST_THREAD_IN_CORE)) | 1869 | if (!(t->flags & CPU_IS_FIRST_THREAD_IN_CORE)) |
1852 | goto done; | 1870 | goto done; |
1853 | 1871 | ||
1854 | if (DO_BIC(BIC_CPU_c3)) { | 1872 | if (DO_BIC(BIC_CPU_c3) || soft_c1_residency_display(BIC_CPU_c3)) { |
1855 | if (get_msr(cpu, MSR_CORE_C3_RESIDENCY, &c->c3)) | 1873 | if (get_msr(cpu, MSR_CORE_C3_RESIDENCY, &c->c3)) |
1856 | return -6; | 1874 | return -6; |
1857 | } | 1875 | } |
1858 | 1876 | ||
1859 | if (DO_BIC(BIC_CPU_c6) && !do_knl_cstates) { | 1877 | if ((DO_BIC(BIC_CPU_c6) || soft_c1_residency_display(BIC_CPU_c6)) && !do_knl_cstates) { |
1860 | if (get_msr(cpu, MSR_CORE_C6_RESIDENCY, &c->c6)) | 1878 | if (get_msr(cpu, MSR_CORE_C6_RESIDENCY, &c->c6)) |
1861 | return -7; | 1879 | return -7; |
1862 | } else if (do_knl_cstates) { | 1880 | } else if (do_knl_cstates || soft_c1_residency_display(BIC_CPU_c6)) { |
1863 | if (get_msr(cpu, MSR_KNL_CORE_C6_RESIDENCY, &c->c6)) | 1881 | if (get_msr(cpu, MSR_KNL_CORE_C6_RESIDENCY, &c->c6)) |
1864 | return -7; | 1882 | return -7; |
1865 | } | 1883 | } |
1866 | 1884 | ||
1867 | if (DO_BIC(BIC_CPU_c7)) | 1885 | if (DO_BIC(BIC_CPU_c7) || soft_c1_residency_display(BIC_CPU_c7)) |
1868 | if (get_msr(cpu, MSR_CORE_C7_RESIDENCY, &c->c7)) | 1886 | if (get_msr(cpu, MSR_CORE_C7_RESIDENCY, &c->c7)) |
1869 | return -8; | 1887 | return -8; |
1870 | 1888 | ||
@@ -2912,6 +2930,7 @@ int snapshot_cpu_lpi_us(void) | |||
2912 | if (retval != 1) { | 2930 | if (retval != 1) { |
2913 | fprintf(stderr, "Disabling Low Power Idle CPU output\n"); | 2931 | fprintf(stderr, "Disabling Low Power Idle CPU output\n"); |
2914 | BIC_NOT_PRESENT(BIC_CPU_LPI); | 2932 | BIC_NOT_PRESENT(BIC_CPU_LPI); |
2933 | fclose(fp); | ||
2915 | return -1; | 2934 | return -1; |
2916 | } | 2935 | } |
2917 | 2936 | ||
@@ -2938,6 +2957,7 @@ int snapshot_sys_lpi_us(void) | |||
2938 | if (retval != 1) { | 2957 | if (retval != 1) { |
2939 | fprintf(stderr, "Disabling Low Power Idle System output\n"); | 2958 | fprintf(stderr, "Disabling Low Power Idle System output\n"); |
2940 | BIC_NOT_PRESENT(BIC_SYS_LPI); | 2959 | BIC_NOT_PRESENT(BIC_SYS_LPI); |
2960 | fclose(fp); | ||
2941 | return -1; | 2961 | return -1; |
2942 | } | 2962 | } |
2943 | fclose(fp); | 2963 | fclose(fp); |
@@ -2985,8 +3005,6 @@ static void signal_handler (int signal) | |||
2985 | fprintf(stderr, "SIGUSR1\n"); | 3005 | fprintf(stderr, "SIGUSR1\n"); |
2986 | break; | 3006 | break; |
2987 | } | 3007 | } |
2988 | /* make sure this manually-invoked interval is at least 1ms long */ | ||
2989 | nanosleep(&one_msec, NULL); | ||
2990 | } | 3008 | } |
2991 | 3009 | ||
2992 | void setup_signal_handler(void) | 3010 | void setup_signal_handler(void) |
@@ -3005,29 +3023,38 @@ void setup_signal_handler(void) | |||
3005 | 3023 | ||
3006 | void do_sleep(void) | 3024 | void do_sleep(void) |
3007 | { | 3025 | { |
3008 | struct timeval select_timeout; | 3026 | struct timeval tout; |
3027 | struct timespec rest; | ||
3009 | fd_set readfds; | 3028 | fd_set readfds; |
3010 | int retval; | 3029 | int retval; |
3011 | 3030 | ||
3012 | FD_ZERO(&readfds); | 3031 | FD_ZERO(&readfds); |
3013 | FD_SET(0, &readfds); | 3032 | FD_SET(0, &readfds); |
3014 | 3033 | ||
3015 | if (!isatty(fileno(stdin))) { | 3034 | if (ignore_stdin) { |
3016 | nanosleep(&interval_ts, NULL); | 3035 | nanosleep(&interval_ts, NULL); |
3017 | return; | 3036 | return; |
3018 | } | 3037 | } |
3019 | 3038 | ||
3020 | select_timeout = interval_tv; | 3039 | tout = interval_tv; |
3021 | retval = select(1, &readfds, NULL, NULL, &select_timeout); | 3040 | retval = select(1, &readfds, NULL, NULL, &tout); |
3022 | 3041 | ||
3023 | if (retval == 1) { | 3042 | if (retval == 1) { |
3024 | switch (getc(stdin)) { | 3043 | switch (getc(stdin)) { |
3025 | case 'q': | 3044 | case 'q': |
3026 | exit_requested = 1; | 3045 | exit_requested = 1; |
3027 | break; | 3046 | break; |
3047 | case EOF: | ||
3048 | /* | ||
3049 | * 'stdin' is a pipe closed on the other end. There | ||
3050 | * won't be any further input. | ||
3051 | */ | ||
3052 | ignore_stdin = 1; | ||
3053 | /* Sleep the rest of the time */ | ||
3054 | rest.tv_sec = (tout.tv_sec + tout.tv_usec / 1000000); | ||
3055 | rest.tv_nsec = (tout.tv_usec % 1000000) * 1000; | ||
3056 | nanosleep(&rest, NULL); | ||
3028 | } | 3057 | } |
3029 | /* make sure this manually-invoked interval is at least 1ms long */ | ||
3030 | nanosleep(&one_msec, NULL); | ||
3031 | } | 3058 | } |
3032 | } | 3059 | } |
3033 | 3060 | ||
@@ -3209,6 +3236,7 @@ int probe_nhm_msrs(unsigned int family, unsigned int model) | |||
3209 | break; | 3236 | break; |
3210 | case INTEL_FAM6_HASWELL_CORE: /* HSW */ | 3237 | case INTEL_FAM6_HASWELL_CORE: /* HSW */ |
3211 | case INTEL_FAM6_HASWELL_X: /* HSX */ | 3238 | case INTEL_FAM6_HASWELL_X: /* HSX */ |
3239 | case INTEL_FAM6_HASWELL_ULT: /* HSW */ | ||
3212 | case INTEL_FAM6_HASWELL_GT3E: /* HSW */ | 3240 | case INTEL_FAM6_HASWELL_GT3E: /* HSW */ |
3213 | case INTEL_FAM6_BROADWELL_CORE: /* BDW */ | 3241 | case INTEL_FAM6_BROADWELL_CORE: /* BDW */ |
3214 | case INTEL_FAM6_BROADWELL_GT3E: /* BDW */ | 3242 | case INTEL_FAM6_BROADWELL_GT3E: /* BDW */ |
@@ -3405,6 +3433,7 @@ int has_config_tdp(unsigned int family, unsigned int model) | |||
3405 | case INTEL_FAM6_IVYBRIDGE: /* IVB */ | 3433 | case INTEL_FAM6_IVYBRIDGE: /* IVB */ |
3406 | case INTEL_FAM6_HASWELL_CORE: /* HSW */ | 3434 | case INTEL_FAM6_HASWELL_CORE: /* HSW */ |
3407 | case INTEL_FAM6_HASWELL_X: /* HSX */ | 3435 | case INTEL_FAM6_HASWELL_X: /* HSX */ |
3436 | case INTEL_FAM6_HASWELL_ULT: /* HSW */ | ||
3408 | case INTEL_FAM6_HASWELL_GT3E: /* HSW */ | 3437 | case INTEL_FAM6_HASWELL_GT3E: /* HSW */ |
3409 | case INTEL_FAM6_BROADWELL_CORE: /* BDW */ | 3438 | case INTEL_FAM6_BROADWELL_CORE: /* BDW */ |
3410 | case INTEL_FAM6_BROADWELL_GT3E: /* BDW */ | 3439 | case INTEL_FAM6_BROADWELL_GT3E: /* BDW */ |
@@ -3803,6 +3832,7 @@ double get_tdp_amd(unsigned int family) | |||
3803 | { | 3832 | { |
3804 | switch (family) { | 3833 | switch (family) { |
3805 | case 0x17: | 3834 | case 0x17: |
3835 | case 0x18: | ||
3806 | default: | 3836 | default: |
3807 | /* This is the max stock TDP of HEDT/Server Fam17h chips */ | 3837 | /* This is the max stock TDP of HEDT/Server Fam17h chips */ |
3808 | return 250.0; | 3838 | return 250.0; |
@@ -3841,6 +3871,7 @@ void rapl_probe_intel(unsigned int family, unsigned int model) | |||
3841 | case INTEL_FAM6_SANDYBRIDGE: | 3871 | case INTEL_FAM6_SANDYBRIDGE: |
3842 | case INTEL_FAM6_IVYBRIDGE: | 3872 | case INTEL_FAM6_IVYBRIDGE: |
3843 | case INTEL_FAM6_HASWELL_CORE: /* HSW */ | 3873 | case INTEL_FAM6_HASWELL_CORE: /* HSW */ |
3874 | case INTEL_FAM6_HASWELL_ULT: /* HSW */ | ||
3844 | case INTEL_FAM6_HASWELL_GT3E: /* HSW */ | 3875 | case INTEL_FAM6_HASWELL_GT3E: /* HSW */ |
3845 | case INTEL_FAM6_BROADWELL_CORE: /* BDW */ | 3876 | case INTEL_FAM6_BROADWELL_CORE: /* BDW */ |
3846 | case INTEL_FAM6_BROADWELL_GT3E: /* BDW */ | 3877 | case INTEL_FAM6_BROADWELL_GT3E: /* BDW */ |
@@ -3982,6 +4013,7 @@ void rapl_probe_amd(unsigned int family, unsigned int model) | |||
3982 | 4013 | ||
3983 | switch (family) { | 4014 | switch (family) { |
3984 | case 0x17: /* Zen, Zen+ */ | 4015 | case 0x17: /* Zen, Zen+ */ |
4016 | case 0x18: /* Hygon Dhyana */ | ||
3985 | do_rapl = RAPL_AMD_F17H | RAPL_PER_CORE_ENERGY; | 4017 | do_rapl = RAPL_AMD_F17H | RAPL_PER_CORE_ENERGY; |
3986 | if (rapl_joules) { | 4018 | if (rapl_joules) { |
3987 | BIC_PRESENT(BIC_Pkg_J); | 4019 | BIC_PRESENT(BIC_Pkg_J); |
@@ -4002,7 +4034,7 @@ void rapl_probe_amd(unsigned int family, unsigned int model) | |||
4002 | rapl_energy_units = ldexp(1.0, -(msr >> 8 & 0x1f)); | 4034 | rapl_energy_units = ldexp(1.0, -(msr >> 8 & 0x1f)); |
4003 | rapl_power_units = ldexp(1.0, -(msr & 0xf)); | 4035 | rapl_power_units = ldexp(1.0, -(msr & 0xf)); |
4004 | 4036 | ||
4005 | tdp = get_tdp_amd(model); | 4037 | tdp = get_tdp_amd(family); |
4006 | 4038 | ||
4007 | rapl_joule_counter_range = 0xFFFFFFFF * rapl_energy_units / tdp; | 4039 | rapl_joule_counter_range = 0xFFFFFFFF * rapl_energy_units / tdp; |
4008 | if (!quiet) | 4040 | if (!quiet) |
@@ -4018,7 +4050,7 @@ void rapl_probe(unsigned int family, unsigned int model) | |||
4018 | { | 4050 | { |
4019 | if (genuine_intel) | 4051 | if (genuine_intel) |
4020 | rapl_probe_intel(family, model); | 4052 | rapl_probe_intel(family, model); |
4021 | if (authentic_amd) | 4053 | if (authentic_amd || hygon_genuine) |
4022 | rapl_probe_amd(family, model); | 4054 | rapl_probe_amd(family, model); |
4023 | } | 4055 | } |
4024 | 4056 | ||
@@ -4032,6 +4064,7 @@ void perf_limit_reasons_probe(unsigned int family, unsigned int model) | |||
4032 | 4064 | ||
4033 | switch (model) { | 4065 | switch (model) { |
4034 | case INTEL_FAM6_HASWELL_CORE: /* HSW */ | 4066 | case INTEL_FAM6_HASWELL_CORE: /* HSW */ |
4067 | case INTEL_FAM6_HASWELL_ULT: /* HSW */ | ||
4035 | case INTEL_FAM6_HASWELL_GT3E: /* HSW */ | 4068 | case INTEL_FAM6_HASWELL_GT3E: /* HSW */ |
4036 | do_gfx_perf_limit_reasons = 1; | 4069 | do_gfx_perf_limit_reasons = 1; |
4037 | case INTEL_FAM6_HASWELL_X: /* HSX */ | 4070 | case INTEL_FAM6_HASWELL_X: /* HSX */ |
@@ -4251,6 +4284,7 @@ int has_snb_msrs(unsigned int family, unsigned int model) | |||
4251 | case INTEL_FAM6_IVYBRIDGE_X: /* IVB Xeon */ | 4284 | case INTEL_FAM6_IVYBRIDGE_X: /* IVB Xeon */ |
4252 | case INTEL_FAM6_HASWELL_CORE: /* HSW */ | 4285 | case INTEL_FAM6_HASWELL_CORE: /* HSW */ |
4253 | case INTEL_FAM6_HASWELL_X: /* HSW */ | 4286 | case INTEL_FAM6_HASWELL_X: /* HSW */ |
4287 | case INTEL_FAM6_HASWELL_ULT: /* HSW */ | ||
4254 | case INTEL_FAM6_HASWELL_GT3E: /* HSW */ | 4288 | case INTEL_FAM6_HASWELL_GT3E: /* HSW */ |
4255 | case INTEL_FAM6_BROADWELL_CORE: /* BDW */ | 4289 | case INTEL_FAM6_BROADWELL_CORE: /* BDW */ |
4256 | case INTEL_FAM6_BROADWELL_GT3E: /* BDW */ | 4290 | case INTEL_FAM6_BROADWELL_GT3E: /* BDW */ |
@@ -4267,7 +4301,7 @@ int has_snb_msrs(unsigned int family, unsigned int model) | |||
4267 | } | 4301 | } |
4268 | 4302 | ||
4269 | /* | 4303 | /* |
4270 | * HSW adds support for additional MSRs: | 4304 | * HSW ULT added support for C8/C9/C10 MSRs: |
4271 | * | 4305 | * |
4272 | * MSR_PKG_C8_RESIDENCY 0x00000630 | 4306 | * MSR_PKG_C8_RESIDENCY 0x00000630 |
4273 | * MSR_PKG_C9_RESIDENCY 0x00000631 | 4307 | * MSR_PKG_C9_RESIDENCY 0x00000631 |
@@ -4278,13 +4312,13 @@ int has_snb_msrs(unsigned int family, unsigned int model) | |||
4278 | * MSR_PKGC10_IRTL 0x00000635 | 4312 | * MSR_PKGC10_IRTL 0x00000635 |
4279 | * | 4313 | * |
4280 | */ | 4314 | */ |
4281 | int has_hsw_msrs(unsigned int family, unsigned int model) | 4315 | int has_c8910_msrs(unsigned int family, unsigned int model) |
4282 | { | 4316 | { |
4283 | if (!genuine_intel) | 4317 | if (!genuine_intel) |
4284 | return 0; | 4318 | return 0; |
4285 | 4319 | ||
4286 | switch (model) { | 4320 | switch (model) { |
4287 | case INTEL_FAM6_HASWELL_CORE: | 4321 | case INTEL_FAM6_HASWELL_ULT: /* HSW */ |
4288 | case INTEL_FAM6_BROADWELL_CORE: /* BDW */ | 4322 | case INTEL_FAM6_BROADWELL_CORE: /* BDW */ |
4289 | case INTEL_FAM6_SKYLAKE_MOBILE: /* SKL */ | 4323 | case INTEL_FAM6_SKYLAKE_MOBILE: /* SKL */ |
4290 | case INTEL_FAM6_CANNONLAKE_MOBILE: /* CNL */ | 4324 | case INTEL_FAM6_CANNONLAKE_MOBILE: /* CNL */ |
@@ -4568,9 +4602,6 @@ unsigned int intel_model_duplicates(unsigned int model) | |||
4568 | case INTEL_FAM6_XEON_PHI_KNM: | 4602 | case INTEL_FAM6_XEON_PHI_KNM: |
4569 | return INTEL_FAM6_XEON_PHI_KNL; | 4603 | return INTEL_FAM6_XEON_PHI_KNL; |
4570 | 4604 | ||
4571 | case INTEL_FAM6_HASWELL_ULT: | ||
4572 | return INTEL_FAM6_HASWELL_CORE; | ||
4573 | |||
4574 | case INTEL_FAM6_BROADWELL_X: | 4605 | case INTEL_FAM6_BROADWELL_X: |
4575 | case INTEL_FAM6_BROADWELL_XEON_D: /* BDX-DE */ | 4606 | case INTEL_FAM6_BROADWELL_XEON_D: /* BDX-DE */ |
4576 | return INTEL_FAM6_BROADWELL_X; | 4607 | return INTEL_FAM6_BROADWELL_X; |
@@ -4582,7 +4613,11 @@ unsigned int intel_model_duplicates(unsigned int model) | |||
4582 | return INTEL_FAM6_SKYLAKE_MOBILE; | 4613 | return INTEL_FAM6_SKYLAKE_MOBILE; |
4583 | 4614 | ||
4584 | case INTEL_FAM6_ICELAKE_MOBILE: | 4615 | case INTEL_FAM6_ICELAKE_MOBILE: |
4616 | case INTEL_FAM6_ICELAKE_NNPI: | ||
4585 | return INTEL_FAM6_CANNONLAKE_MOBILE; | 4617 | return INTEL_FAM6_CANNONLAKE_MOBILE; |
4618 | |||
4619 | case INTEL_FAM6_ATOM_TREMONT_X: | ||
4620 | return INTEL_FAM6_ATOM_GOLDMONT_X; | ||
4586 | } | 4621 | } |
4587 | return model; | 4622 | return model; |
4588 | } | 4623 | } |
@@ -4600,6 +4635,8 @@ void process_cpuid() | |||
4600 | genuine_intel = 1; | 4635 | genuine_intel = 1; |
4601 | else if (ebx == 0x68747541 && ecx == 0x444d4163 && edx == 0x69746e65) | 4636 | else if (ebx == 0x68747541 && ecx == 0x444d4163 && edx == 0x69746e65) |
4602 | authentic_amd = 1; | 4637 | authentic_amd = 1; |
4638 | else if (ebx == 0x6f677948 && ecx == 0x656e6975 && edx == 0x6e65476e) | ||
4639 | hygon_genuine = 1; | ||
4603 | 4640 | ||
4604 | if (!quiet) | 4641 | if (!quiet) |
4605 | fprintf(outf, "CPUID(0): %.4s%.4s%.4s ", | 4642 | fprintf(outf, "CPUID(0): %.4s%.4s%.4s ", |
@@ -4820,12 +4857,12 @@ void process_cpuid() | |||
4820 | BIC_NOT_PRESENT(BIC_CPU_c7); | 4857 | BIC_NOT_PRESENT(BIC_CPU_c7); |
4821 | BIC_NOT_PRESENT(BIC_Pkgpc7); | 4858 | BIC_NOT_PRESENT(BIC_Pkgpc7); |
4822 | } | 4859 | } |
4823 | if (has_hsw_msrs(family, model)) { | 4860 | if (has_c8910_msrs(family, model)) { |
4824 | BIC_PRESENT(BIC_Pkgpc8); | 4861 | BIC_PRESENT(BIC_Pkgpc8); |
4825 | BIC_PRESENT(BIC_Pkgpc9); | 4862 | BIC_PRESENT(BIC_Pkgpc9); |
4826 | BIC_PRESENT(BIC_Pkgpc10); | 4863 | BIC_PRESENT(BIC_Pkgpc10); |
4827 | } | 4864 | } |
4828 | do_irtl_hsw = has_hsw_msrs(family, model); | 4865 | do_irtl_hsw = has_c8910_msrs(family, model); |
4829 | if (has_skl_msrs(family, model)) { | 4866 | if (has_skl_msrs(family, model)) { |
4830 | BIC_PRESENT(BIC_Totl_c0); | 4867 | BIC_PRESENT(BIC_Totl_c0); |
4831 | BIC_PRESENT(BIC_Any_c0); | 4868 | BIC_PRESENT(BIC_Any_c0); |
@@ -5123,7 +5160,7 @@ int initialize_counters(int cpu_id) | |||
5123 | 5160 | ||
5124 | void allocate_output_buffer() | 5161 | void allocate_output_buffer() |
5125 | { | 5162 | { |
5126 | output_buffer = calloc(1, (1 + topo.num_cpus) * 1024); | 5163 | output_buffer = calloc(1, (1 + topo.num_cpus) * 2048); |
5127 | outp = output_buffer; | 5164 | outp = output_buffer; |
5128 | if (outp == NULL) | 5165 | if (outp == NULL) |
5129 | err(-1, "calloc output buffer"); | 5166 | err(-1, "calloc output buffer"); |
@@ -5269,7 +5306,7 @@ int get_and_dump_counters(void) | |||
5269 | } | 5306 | } |
5270 | 5307 | ||
5271 | void print_version() { | 5308 | void print_version() { |
5272 | fprintf(outf, "turbostat version 19.03.20" | 5309 | fprintf(outf, "turbostat version 19.08.31" |
5273 | " - Len Brown <lenb@kernel.org>\n"); | 5310 | " - Len Brown <lenb@kernel.org>\n"); |
5274 | } | 5311 | } |
5275 | 5312 | ||
diff --git a/tools/power/x86/x86_energy_perf_policy/Makefile b/tools/power/x86/x86_energy_perf_policy/Makefile index 1fdeef864e7c..666b325a62a2 100644 --- a/tools/power/x86/x86_energy_perf_policy/Makefile +++ b/tools/power/x86/x86_energy_perf_policy/Makefile | |||
@@ -9,8 +9,9 @@ ifeq ("$(origin O)", "command line") | |||
9 | endif | 9 | endif |
10 | 10 | ||
11 | x86_energy_perf_policy : x86_energy_perf_policy.c | 11 | x86_energy_perf_policy : x86_energy_perf_policy.c |
12 | override CFLAGS += -Wall -I../../../include | 12 | override CFLAGS += -O2 -Wall -I../../../include |
13 | override CFLAGS += -DMSRHEADER='"../../../../arch/x86/include/asm/msr-index.h"' | 13 | override CFLAGS += -DMSRHEADER='"../../../../arch/x86/include/asm/msr-index.h"' |
14 | override CFLAGS += -D_FORTIFY_SOURCE=2 | ||
14 | 15 | ||
15 | %: %.c | 16 | %: %.c |
16 | @mkdir -p $(BUILD_OUTPUT) | 17 | @mkdir -p $(BUILD_OUTPUT) |
diff --git a/tools/power/x86/x86_energy_perf_policy/x86_energy_perf_policy.8 b/tools/power/x86/x86_energy_perf_policy/x86_energy_perf_policy.8 index 17db1c3af4d0..78c6361898b1 100644 --- a/tools/power/x86/x86_energy_perf_policy/x86_energy_perf_policy.8 +++ b/tools/power/x86/x86_energy_perf_policy/x86_energy_perf_policy.8 | |||
@@ -40,7 +40,7 @@ in the same processor package. | |||
40 | Hardware P-States (HWP) are effectively an expansion of hardware | 40 | Hardware P-States (HWP) are effectively an expansion of hardware |
41 | P-state control from the opportunistic turbo-mode P-state range | 41 | P-state control from the opportunistic turbo-mode P-state range |
42 | to include the entire range of available P-states. | 42 | to include the entire range of available P-states. |
43 | On Broadwell Xeon, the initial HWP implementation, EBP influenced HWP. | 43 | On Broadwell Xeon, the initial HWP implementation, EPB influenced HWP. |
44 | That influence was removed in subsequent generations, | 44 | That influence was removed in subsequent generations, |
45 | where it was moved to the | 45 | where it was moved to the |
46 | Energy_Performance_Preference (EPP) field in | 46 | Energy_Performance_Preference (EPP) field in |
diff --git a/tools/power/x86/x86_energy_perf_policy/x86_energy_perf_policy.c b/tools/power/x86/x86_energy_perf_policy/x86_energy_perf_policy.c index 34a796b303fe..3fe1eed900d4 100644 --- a/tools/power/x86/x86_energy_perf_policy/x86_energy_perf_policy.c +++ b/tools/power/x86/x86_energy_perf_policy/x86_energy_perf_policy.c | |||
@@ -545,7 +545,7 @@ void cmdline(int argc, char **argv) | |||
545 | 545 | ||
546 | progname = argv[0]; | 546 | progname = argv[0]; |
547 | 547 | ||
548 | while ((opt = getopt_long_only(argc, argv, "+a:c:dD:E:e:f:m:M:rt:u:vw", | 548 | while ((opt = getopt_long_only(argc, argv, "+a:c:dD:E:e:f:m:M:rt:u:vw:", |
549 | long_options, &option_index)) != -1) { | 549 | long_options, &option_index)) != -1) { |
550 | switch (opt) { | 550 | switch (opt) { |
551 | case 'a': | 551 | case 'a': |
@@ -1259,6 +1259,15 @@ void probe_dev_msr(void) | |||
1259 | if (system("/sbin/modprobe msr > /dev/null 2>&1")) | 1259 | if (system("/sbin/modprobe msr > /dev/null 2>&1")) |
1260 | err(-5, "no /dev/cpu/0/msr, Try \"# modprobe msr\" "); | 1260 | err(-5, "no /dev/cpu/0/msr, Try \"# modprobe msr\" "); |
1261 | } | 1261 | } |
1262 | |||
1263 | static void get_cpuid_or_exit(unsigned int leaf, | ||
1264 | unsigned int *eax, unsigned int *ebx, | ||
1265 | unsigned int *ecx, unsigned int *edx) | ||
1266 | { | ||
1267 | if (!__get_cpuid(leaf, eax, ebx, ecx, edx)) | ||
1268 | errx(1, "Processor not supported\n"); | ||
1269 | } | ||
1270 | |||
1262 | /* | 1271 | /* |
1263 | * early_cpuid() | 1272 | * early_cpuid() |
1264 | * initialize turbo_is_enabled, has_hwp, has_epb | 1273 | * initialize turbo_is_enabled, has_hwp, has_epb |
@@ -1266,15 +1275,10 @@ void probe_dev_msr(void) | |||
1266 | */ | 1275 | */ |
1267 | void early_cpuid(void) | 1276 | void early_cpuid(void) |
1268 | { | 1277 | { |
1269 | unsigned int eax, ebx, ecx, edx, max_level; | 1278 | unsigned int eax, ebx, ecx, edx; |
1270 | unsigned int fms, family, model; | 1279 | unsigned int fms, family, model; |
1271 | 1280 | ||
1272 | __get_cpuid(0, &max_level, &ebx, &ecx, &edx); | 1281 | get_cpuid_or_exit(1, &fms, &ebx, &ecx, &edx); |
1273 | |||
1274 | if (max_level < 6) | ||
1275 | errx(1, "Processor not supported\n"); | ||
1276 | |||
1277 | __get_cpuid(1, &fms, &ebx, &ecx, &edx); | ||
1278 | family = (fms >> 8) & 0xf; | 1282 | family = (fms >> 8) & 0xf; |
1279 | model = (fms >> 4) & 0xf; | 1283 | model = (fms >> 4) & 0xf; |
1280 | if (family == 6 || family == 0xf) | 1284 | if (family == 6 || family == 0xf) |
@@ -1288,7 +1292,7 @@ void early_cpuid(void) | |||
1288 | bdx_highest_ratio = msr & 0xFF; | 1292 | bdx_highest_ratio = msr & 0xFF; |
1289 | } | 1293 | } |
1290 | 1294 | ||
1291 | __get_cpuid(0x6, &eax, &ebx, &ecx, &edx); | 1295 | get_cpuid_or_exit(0x6, &eax, &ebx, &ecx, &edx); |
1292 | turbo_is_enabled = (eax >> 1) & 1; | 1296 | turbo_is_enabled = (eax >> 1) & 1; |
1293 | has_hwp = (eax >> 7) & 1; | 1297 | has_hwp = (eax >> 7) & 1; |
1294 | has_epb = (ecx >> 3) & 1; | 1298 | has_epb = (ecx >> 3) & 1; |
@@ -1306,7 +1310,7 @@ void parse_cpuid(void) | |||
1306 | 1310 | ||
1307 | eax = ebx = ecx = edx = 0; | 1311 | eax = ebx = ecx = edx = 0; |
1308 | 1312 | ||
1309 | __get_cpuid(0, &max_level, &ebx, &ecx, &edx); | 1313 | get_cpuid_or_exit(0, &max_level, &ebx, &ecx, &edx); |
1310 | 1314 | ||
1311 | if (ebx == 0x756e6547 && edx == 0x49656e69 && ecx == 0x6c65746e) | 1315 | if (ebx == 0x756e6547 && edx == 0x49656e69 && ecx == 0x6c65746e) |
1312 | genuine_intel = 1; | 1316 | genuine_intel = 1; |
@@ -1315,7 +1319,7 @@ void parse_cpuid(void) | |||
1315 | fprintf(stderr, "CPUID(0): %.4s%.4s%.4s ", | 1319 | fprintf(stderr, "CPUID(0): %.4s%.4s%.4s ", |
1316 | (char *)&ebx, (char *)&edx, (char *)&ecx); | 1320 | (char *)&ebx, (char *)&edx, (char *)&ecx); |
1317 | 1321 | ||
1318 | __get_cpuid(1, &fms, &ebx, &ecx, &edx); | 1322 | get_cpuid_or_exit(1, &fms, &ebx, &ecx, &edx); |
1319 | family = (fms >> 8) & 0xf; | 1323 | family = (fms >> 8) & 0xf; |
1320 | model = (fms >> 4) & 0xf; | 1324 | model = (fms >> 4) & 0xf; |
1321 | stepping = fms & 0xf; | 1325 | stepping = fms & 0xf; |
@@ -1340,7 +1344,7 @@ void parse_cpuid(void) | |||
1340 | errx(1, "CPUID: no MSR"); | 1344 | errx(1, "CPUID: no MSR"); |
1341 | 1345 | ||
1342 | 1346 | ||
1343 | __get_cpuid(0x6, &eax, &ebx, &ecx, &edx); | 1347 | get_cpuid_or_exit(0x6, &eax, &ebx, &ecx, &edx); |
1344 | /* turbo_is_enabled already set */ | 1348 | /* turbo_is_enabled already set */ |
1345 | /* has_hwp already set */ | 1349 | /* has_hwp already set */ |
1346 | has_hwp_notify = eax & (1 << 8); | 1350 | has_hwp_notify = eax & (1 << 8); |
diff --git a/tools/testing/selftests/tc-testing/plugin-lib/nsPlugin.py b/tools/testing/selftests/tc-testing/plugin-lib/nsPlugin.py index affa7f2d9670..9539cffa9e5e 100644 --- a/tools/testing/selftests/tc-testing/plugin-lib/nsPlugin.py +++ b/tools/testing/selftests/tc-testing/plugin-lib/nsPlugin.py | |||
@@ -64,7 +64,7 @@ class SubPlugin(TdcPlugin): | |||
64 | cmdlist.insert(0, self.args.NAMES['NS']) | 64 | cmdlist.insert(0, self.args.NAMES['NS']) |
65 | cmdlist.insert(0, 'exec') | 65 | cmdlist.insert(0, 'exec') |
66 | cmdlist.insert(0, 'netns') | 66 | cmdlist.insert(0, 'netns') |
67 | cmdlist.insert(0, 'ip') | 67 | cmdlist.insert(0, self.args.NAMES['IP']) |
68 | else: | 68 | else: |
69 | pass | 69 | pass |
70 | 70 | ||
@@ -78,16 +78,16 @@ class SubPlugin(TdcPlugin): | |||
78 | return command | 78 | return command |
79 | 79 | ||
80 | def _ports_create(self): | 80 | def _ports_create(self): |
81 | cmd = 'ip link add $DEV0 type veth peer name $DEV1' | 81 | cmd = '$IP link add $DEV0 type veth peer name $DEV1' |
82 | self._exec_cmd('pre', cmd) | 82 | self._exec_cmd('pre', cmd) |
83 | cmd = 'ip link set $DEV0 up' | 83 | cmd = '$IP link set $DEV0 up' |
84 | self._exec_cmd('pre', cmd) | 84 | self._exec_cmd('pre', cmd) |
85 | if not self.args.namespace: | 85 | if not self.args.namespace: |
86 | cmd = 'ip link set $DEV1 up' | 86 | cmd = '$IP link set $DEV1 up' |
87 | self._exec_cmd('pre', cmd) | 87 | self._exec_cmd('pre', cmd) |
88 | 88 | ||
89 | def _ports_destroy(self): | 89 | def _ports_destroy(self): |
90 | cmd = 'ip link del $DEV0' | 90 | cmd = '$IP link del $DEV0' |
91 | self._exec_cmd('post', cmd) | 91 | self._exec_cmd('post', cmd) |
92 | 92 | ||
93 | def _ns_create(self): | 93 | def _ns_create(self): |
@@ -97,16 +97,16 @@ class SubPlugin(TdcPlugin): | |||
97 | ''' | 97 | ''' |
98 | self._ports_create() | 98 | self._ports_create() |
99 | if self.args.namespace: | 99 | if self.args.namespace: |
100 | cmd = 'ip netns add {}'.format(self.args.NAMES['NS']) | 100 | cmd = '$IP netns add {}'.format(self.args.NAMES['NS']) |
101 | self._exec_cmd('pre', cmd) | 101 | self._exec_cmd('pre', cmd) |
102 | cmd = 'ip link set $DEV1 netns {}'.format(self.args.NAMES['NS']) | 102 | cmd = '$IP link set $DEV1 netns {}'.format(self.args.NAMES['NS']) |
103 | self._exec_cmd('pre', cmd) | 103 | self._exec_cmd('pre', cmd) |
104 | cmd = 'ip -n {} link set $DEV1 up'.format(self.args.NAMES['NS']) | 104 | cmd = '$IP -n {} link set $DEV1 up'.format(self.args.NAMES['NS']) |
105 | self._exec_cmd('pre', cmd) | 105 | self._exec_cmd('pre', cmd) |
106 | if self.args.device: | 106 | if self.args.device: |
107 | cmd = 'ip link set $DEV2 netns {}'.format(self.args.NAMES['NS']) | 107 | cmd = '$IP link set $DEV2 netns {}'.format(self.args.NAMES['NS']) |
108 | self._exec_cmd('pre', cmd) | 108 | self._exec_cmd('pre', cmd) |
109 | cmd = 'ip -n {} link set $DEV2 up'.format(self.args.NAMES['NS']) | 109 | cmd = '$IP -n {} link set $DEV2 up'.format(self.args.NAMES['NS']) |
110 | self._exec_cmd('pre', cmd) | 110 | self._exec_cmd('pre', cmd) |
111 | 111 | ||
112 | def _ns_destroy(self): | 112 | def _ns_destroy(self): |
@@ -115,7 +115,7 @@ class SubPlugin(TdcPlugin): | |||
115 | devices as well) | 115 | devices as well) |
116 | ''' | 116 | ''' |
117 | if self.args.namespace: | 117 | if self.args.namespace: |
118 | cmd = 'ip netns delete {}'.format(self.args.NAMES['NS']) | 118 | cmd = '$IP netns delete {}'.format(self.args.NAMES['NS']) |
119 | self._exec_cmd('post', cmd) | 119 | self._exec_cmd('post', cmd) |
120 | 120 | ||
121 | def _exec_cmd(self, stage, command): | 121 | def _exec_cmd(self, stage, command): |
diff --git a/virt/kvm/arm/vgic/vgic-mmio.c b/virt/kvm/arm/vgic/vgic-mmio.c index 44efc2ff863f..0d090482720d 100644 --- a/virt/kvm/arm/vgic/vgic-mmio.c +++ b/virt/kvm/arm/vgic/vgic-mmio.c | |||
@@ -211,6 +211,12 @@ static void vgic_hw_irq_spending(struct kvm_vcpu *vcpu, struct vgic_irq *irq, | |||
211 | vgic_irq_set_phys_active(irq, true); | 211 | vgic_irq_set_phys_active(irq, true); |
212 | } | 212 | } |
213 | 213 | ||
214 | static bool is_vgic_v2_sgi(struct kvm_vcpu *vcpu, struct vgic_irq *irq) | ||
215 | { | ||
216 | return (vgic_irq_is_sgi(irq->intid) && | ||
217 | vcpu->kvm->arch.vgic.vgic_model == KVM_DEV_TYPE_ARM_VGIC_V2); | ||
218 | } | ||
219 | |||
214 | void vgic_mmio_write_spending(struct kvm_vcpu *vcpu, | 220 | void vgic_mmio_write_spending(struct kvm_vcpu *vcpu, |
215 | gpa_t addr, unsigned int len, | 221 | gpa_t addr, unsigned int len, |
216 | unsigned long val) | 222 | unsigned long val) |
@@ -223,6 +229,12 @@ void vgic_mmio_write_spending(struct kvm_vcpu *vcpu, | |||
223 | for_each_set_bit(i, &val, len * 8) { | 229 | for_each_set_bit(i, &val, len * 8) { |
224 | struct vgic_irq *irq = vgic_get_irq(vcpu->kvm, vcpu, intid + i); | 230 | struct vgic_irq *irq = vgic_get_irq(vcpu->kvm, vcpu, intid + i); |
225 | 231 | ||
232 | /* GICD_ISPENDR0 SGI bits are WI */ | ||
233 | if (is_vgic_v2_sgi(vcpu, irq)) { | ||
234 | vgic_put_irq(vcpu->kvm, irq); | ||
235 | continue; | ||
236 | } | ||
237 | |||
226 | raw_spin_lock_irqsave(&irq->irq_lock, flags); | 238 | raw_spin_lock_irqsave(&irq->irq_lock, flags); |
227 | if (irq->hw) | 239 | if (irq->hw) |
228 | vgic_hw_irq_spending(vcpu, irq, is_uaccess); | 240 | vgic_hw_irq_spending(vcpu, irq, is_uaccess); |
@@ -270,6 +282,12 @@ void vgic_mmio_write_cpending(struct kvm_vcpu *vcpu, | |||
270 | for_each_set_bit(i, &val, len * 8) { | 282 | for_each_set_bit(i, &val, len * 8) { |
271 | struct vgic_irq *irq = vgic_get_irq(vcpu->kvm, vcpu, intid + i); | 283 | struct vgic_irq *irq = vgic_get_irq(vcpu->kvm, vcpu, intid + i); |
272 | 284 | ||
285 | /* GICD_ICPENDR0 SGI bits are WI */ | ||
286 | if (is_vgic_v2_sgi(vcpu, irq)) { | ||
287 | vgic_put_irq(vcpu->kvm, irq); | ||
288 | continue; | ||
289 | } | ||
290 | |||
273 | raw_spin_lock_irqsave(&irq->irq_lock, flags); | 291 | raw_spin_lock_irqsave(&irq->irq_lock, flags); |
274 | 292 | ||
275 | if (irq->hw) | 293 | if (irq->hw) |
diff --git a/virt/kvm/arm/vgic/vgic-v2.c b/virt/kvm/arm/vgic/vgic-v2.c index 96aab77d0471..b00aa304c260 100644 --- a/virt/kvm/arm/vgic/vgic-v2.c +++ b/virt/kvm/arm/vgic/vgic-v2.c | |||
@@ -184,7 +184,10 @@ void vgic_v2_populate_lr(struct kvm_vcpu *vcpu, struct vgic_irq *irq, int lr) | |||
184 | if (vgic_irq_is_sgi(irq->intid)) { | 184 | if (vgic_irq_is_sgi(irq->intid)) { |
185 | u32 src = ffs(irq->source); | 185 | u32 src = ffs(irq->source); |
186 | 186 | ||
187 | BUG_ON(!src); | 187 | if (WARN_RATELIMIT(!src, "No SGI source for INTID %d\n", |
188 | irq->intid)) | ||
189 | return; | ||
190 | |||
188 | val |= (src - 1) << GICH_LR_PHYSID_CPUID_SHIFT; | 191 | val |= (src - 1) << GICH_LR_PHYSID_CPUID_SHIFT; |
189 | irq->source &= ~(1 << (src - 1)); | 192 | irq->source &= ~(1 << (src - 1)); |
190 | if (irq->source) { | 193 | if (irq->source) { |
diff --git a/virt/kvm/arm/vgic/vgic-v3.c b/virt/kvm/arm/vgic/vgic-v3.c index 0c653a1e5215..a4ad431c92a9 100644 --- a/virt/kvm/arm/vgic/vgic-v3.c +++ b/virt/kvm/arm/vgic/vgic-v3.c | |||
@@ -167,7 +167,10 @@ void vgic_v3_populate_lr(struct kvm_vcpu *vcpu, struct vgic_irq *irq, int lr) | |||
167 | model == KVM_DEV_TYPE_ARM_VGIC_V2) { | 167 | model == KVM_DEV_TYPE_ARM_VGIC_V2) { |
168 | u32 src = ffs(irq->source); | 168 | u32 src = ffs(irq->source); |
169 | 169 | ||
170 | BUG_ON(!src); | 170 | if (WARN_RATELIMIT(!src, "No SGI source for INTID %d\n", |
171 | irq->intid)) | ||
172 | return; | ||
173 | |||
171 | val |= (src - 1) << GICH_LR_PHYSID_CPUID_SHIFT; | 174 | val |= (src - 1) << GICH_LR_PHYSID_CPUID_SHIFT; |
172 | irq->source &= ~(1 << (src - 1)); | 175 | irq->source &= ~(1 << (src - 1)); |
173 | if (irq->source) { | 176 | if (irq->source) { |
diff --git a/virt/kvm/arm/vgic/vgic.c b/virt/kvm/arm/vgic/vgic.c index 13d4b38a94ec..e7bde65ba67c 100644 --- a/virt/kvm/arm/vgic/vgic.c +++ b/virt/kvm/arm/vgic/vgic.c | |||
@@ -254,6 +254,13 @@ static int vgic_irq_cmp(void *priv, struct list_head *a, struct list_head *b) | |||
254 | bool penda, pendb; | 254 | bool penda, pendb; |
255 | int ret; | 255 | int ret; |
256 | 256 | ||
257 | /* | ||
258 | * list_sort may call this function with the same element when | ||
259 | * the list is fairly long. | ||
260 | */ | ||
261 | if (unlikely(irqa == irqb)) | ||
262 | return 0; | ||
263 | |||
257 | raw_spin_lock(&irqa->irq_lock); | 264 | raw_spin_lock(&irqa->irq_lock); |
258 | raw_spin_lock_nested(&irqb->irq_lock, SINGLE_DEPTH_NESTING); | 265 | raw_spin_lock_nested(&irqb->irq_lock, SINGLE_DEPTH_NESTING); |
259 | 266 | ||