On Mon, Mar 18, 2024 at 07:27:34PM -0700, Drew Fustini wrote: > On Mon, Mar 18, 2024 at 11:40:34AM -0700, Drew Fustini wrote: > > On Thu, Feb 08, 2024 at 09:14:11AM +0530, Sunil V L wrote: > > > This series enables the support for "Collaborative Processor Performance > > > Control (CPPC) on ACPI based RISC-V platforms. It depends on the > > > encoding of CPPC registers as defined in RISC-V FFH spec [2]. > > > > > > CPPC is described in the ACPI spec [1]. RISC-V FFH spec required to > > > enable this, is available at [2]. > > > > > > [1] - https://uefi.org/specs/ACPI/6.5/08_Processor_Configuration_and_Control.html#collaborative-processor-performance-control > > > [2] - https://github.com/riscv-non-isa/riscv-acpi-ffh/releases/download/v1.0.0/riscv-ffh.pdf > > > > > > The series is based on the LPI support series. > > > Based-on: 20240118062930.245937-1-sunilvl@ventanamicro.com > > > (https://lore.kernel.org/lkml/20240118062930.245937-1-sunilvl@ventanamicro.com/) > > > > Should the https://github.com/vlsunil/qemu/tree/lpi_exp branch also be > > used for this CPPC series too? > > I noticed the ventanamicro qemu repo has a dev-upstream branch [1] which > contains 4bb6ba4d0fb9 ("riscv/virt: acpi: Enable CPPC - _CPC and _PSD"). > I've built that but I still see 'SBI CPPC extension NOT detected!!' in > the Linux boot log. > > I'm using upstream opensbi. It seems that sbi_cppc_probe() fails because > cppc_dev is not set. Nothing in the upstream opensbi repo seems to call > sbi_cppc_set_device(), so I am uncertain how it is possible for it to > work. Is there an opensbi branch I should be using? > > Thanks, > Drew > > [1] https://github.com/ventanamicro/qemu/tree/dev-upstream Please use below branches for qemu and opensbi. These are just dummy objects/interfaces added to test the kernel change which are otherwise platform specific features. https://github.com/vlsunil/qemu/tree/lpi_cppc_exp https://github.com/vlsunil/opensbi/tree/cppc_exp Regards Sunil _______________________________________________ linux-riscv mailing list linux-riscv@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-riscv
[-- Attachment #1.1: Type: text/plain, Size: 6222 bytes --] On Mon, Mar 18, 2024 at 05:48:13PM -0700, Atish Patra wrote: > On 3/18/24 16:48, Conor Dooley wrote: > > On Mon, Mar 18, 2024 at 03:46:54PM -0700, Atish Patra wrote: > > > For 2.b, either we can start defining pseudo extensions or adding > > > vendor/arch/impid checks. > > > > > > @Conor: You seems to prefer the earlier approach instead of adding the > > > checks. Care to elaborate why do you think that's a better method compared > > > to a simple check ? > > > > Because I don't think that describing these as "errata" in the first > > place is even accurate. This is not a case of a vendor claiming they > > have Sscofpmf support but the implementation is flawed. As far as I > > understand, this is a vendor creating a useful feature prior to the > > creation of a standard extension. > > A bit of a test for this could be "If the standard extension never > > existed, would this be considered a new feature or an implementation > > issue". I think this is pretty clearly in the former camp. > > > > So we have 3 cases. > > 1. Pseudo extension: An vendor extension designed and/or implemented before > the standard RVI extension was ratified but do not violate any standard > encoding space. > > 2. Erratas: An genuine bug/design issue in the expected behavior from a > standard RVI extension (including violating standard encoding space) > > 3. Vendor extension: A new or a variant of standard RVI extension which is > different enough from standard extension. > > IMO, the line between #2 and #1 may get blurry as we going forward because > of the sheer number of small extensions RVI is comping up with (which is a > problem as well). Aye, I think some of that is verging on ridiculous. > Just to clarify: I am not too worried about this particular case as we know > that T-head's implementation predates the Sscofpmf extension. > But once we define a standard mechanism for this kind of situation, vendor > may start to abuse it. How do you envisage it being abused by a vendor? Pre-dating the standard extension does make this one fairly clear-cut, but are you worried about people coming along and claiming to implement XConorSscofpmf instead of Sscofpmf rather than suffer the "shame" of a broken implementation? All this stuff is going to be pretty case-by-case (to begin with at least) so I'm not too worried about that sort of abuse. > > I do not think we should be using m*id detection implementations of a > > feature prior to creation of a standard extension for the same purpose. > > To me the main difference between a case like this and VentanaCondOps/Zicond > > is that we are the ones calling this an extension (hence my use of pseudo) > > and not the vendor of the IP. If T-Head were to publish a document tomorrow > > on the T-Head github repo for official vendor extensions, that difference > > would not even exist any longer. > > > > Exactly! If vendor publishes these as an extension or an errata, that's a > binding agreement to call it in a specific way. I don't agree that we are bound to call it the way that the vendor does. We should just review these sorts of things on a case-by-case basis, committing to doing what the vendor says is abusable. > > I also do not believe that it is a "simple" check. The number of > > implementations that could end up using this PMU could just balloon > > if T-Head has no intention of switching to Sscofpmf. If they don't > > balloon in this case, there's nothing stopping them ballooning in a > > Ideally, they shouldn't as it a simple case of CSR number & IRQ number. > If they care to implement AIA, then they must change it to standard sscofpmf > as the current IRQ violates the AIA spec. But who knows if they care to > implement AIA or not. What kinda "worried" me here is that the c908 implements /both/ Zicbom and the T-Head CMO instructions and /both/ Svpbmt and their original misuse of the reserved bits but they do not support Sscofpmf. Maybe it just was not feasible to migrate entirely (but they did for vector) or to support both interrupt numbers and to alias the CSR, but it seemed like the opportunity to standardise a bunch of other stuff was taken, but this particular extension was not. That's why I was worried that we'd see some ballooning in these specific checks. > > similar case in the future. We should let the platform firmware tell > > explicitly, be that via DT or ACPI, what features are supported rather > > than try to reverse engineer it ourselves via m*id. > > > Fair enough. > > > > That leads into another general issue I have with using m*id detection, > > which I think I have mentioned several times on the list - it prevents the > > platform (hypervisor, emulator or firmware) from disabling that feature. > > > > If that is the only concern, platform can just disable the actual > extension(i.e. sscofpmf in this case) to disable that feature for that > particular vendor. Right. Maybe I wasn't clear that this is a problem with using m*id for /detection/ of extensions and not with using m*id to work around implementation issues with the extension. In the latter case, you're applying a fixup only when the actual extension is communicated to be present, which leaves that control in the hands of the platform. > > If I had a time machine back to when the T-Head perf or cmo stuff was > > submitted, I was try to avoid any of it being merged with the m*id > > detection method. > > > > > I agree that don't have the crystal ball and may be proven wrong in the > > > future (I will be definitely happy about that!). But given the diversity of > > > RISC-V ecosystem, I feel that may be our sad reality. > > > > I don't understand what this comment is referring to, it lacks context > > as to what the sad reality actually is. > > > > I hope that all made sense and explained why I am against this method > > for detecting what I believe to be features rather than errata, > > Conor. > > > > Yes.Thanks again for the clarification. Again, I am not opposed to the idea. > I just wanted to understand if this is the best option we have right now. [-- Attachment #1.2: signature.asc --] [-- Type: application/pgp-signature, Size: 228 bytes --] [-- Attachment #2: Type: text/plain, Size: 161 bytes --] _______________________________________________ linux-riscv mailing list linux-riscv@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-riscv
[-- Attachment #1.1: Type: text/plain, Size: 506 bytes --] On Mon, Mar 18, 2024 at 11:06:48AM +0800, Ziv Xu wrote: > +static int jh7110_timer_start(struct jh7110_clkevt *clkevt) > +{ > + int ret; > + > + /* Disable and clear interrupt first */ > + writel(JH7110_TIMER_INT_DIS, clkevt->base + JH7110_TIMER_INT_MASK); > + ret = jh7110_timer_int_clear(clkevt); The return value here is not checked/used. > + writel(JH7110_TIMER_INT_ENA, clkevt->base + JH7110_TIMER_INT_MASK); > + writel(JH7110_TIMER_ENA, clkevt->base + JH7110_TIMER_ENABLE); > + > + return 0; > +} [-- Attachment #1.2: signature.asc --] [-- Type: application/pgp-signature, Size: 228 bytes --] [-- Attachment #2: Type: text/plain, Size: 161 bytes --] _______________________________________________ linux-riscv mailing list linux-riscv@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-riscv
Thank you Stephen for your carefully check and comments, I will improve the code according to your inputs. I have some additional explanations for two of these points. On 2024/3/9 10:11, Stephen Boyd wrote: [......] >> + >> +/* >> + * Below array is the total combination lists of POSTDIV1 and POSTDIV2 >> + * for example: >> + * postdiv1_2[0] = {2, 4, 8} >> + * ==> div1 = 2, div2 = 4 , div1 * div2 = 8 >> + * And POSTDIV_RESULT_INDEX point to 3rd element in the array >> + */ >> +#define POSTDIV_RESULT_INDEX 2 >> +static int postdiv1_2[][3] = { > const? And move it to the function scope. > >> + {2, 4, 8}, {3, 3, 9}, {2, 5, 10}, {2, 6, 12}, >> + {2, 7, 14}, {3, 5, 15}, {4, 4, 16}, {3, 6, 18}, >> + {4, 5, 20}, {3, 7, 21}, {4, 6, 24}, {5, 5, 25}, >> + {4, 7, 28}, {5, 6, 30}, {5, 7, 35}, {6, 6, 36}, >> + {6, 7, 42}, {7, 7, 49} > It may be better to make it a struct with named members because I have > no idea what each element means. I plan to add some comments to explain the meaning of this array member. This array is only used in this function, and I think it is somewhat unnecessary to define a structure specifically for it. Adding some comments will help everyone understand better. [......] >> + >> +/* >> + * Common data of clock-controller >> + * Note: this structure will be used both by clkgen & sysclk. >> + * @iobase: base address of clock-controller >> + * @regmap: base address of clock-controller for pll, just due to PLL uses >> + * regmap while others use iomem. >> + * @lock: clock register access lock >> + * @onecell_data: used for adding providers. >> + */ >> +struct sg2042_clk_data { >> + void __iomem *iobase; > Why not use a regmap for the iobase as well? I plan to unify it as iomem. Anyway, just use one method should be fine. [......] _______________________________________________ linux-riscv mailing list linux-riscv@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-riscv
On Mon, Mar 18, 2024 at 11:27:37PM -0500, Samuel Holland wrote: > Hi Inochi, > > On 2024-03-18 11:03 PM, Inochi Amaoto wrote: > > On Mon, Mar 18, 2024 at 10:22:47PM -0500, Samuel Holland wrote: > >> On 2024-03-18 1:38 AM, Inochi Amaoto wrote: > >>> The DMA IP of Sophgo CV18XX/SG200X is based on a DW AXI CORE, with > >>> an additional channel remap register located in the top system control > >>> area. The DMA channel is exclusive to each core. > >>> > >>> Add the dmamux binding for CV18XX/SG200X series SoC > >>> > >>> Signed-off-by: Inochi Amaoto <inochiama@outlook.com> > >>> Reviewed-by: Rob Herring <robh@kernel.org> > >>> --- > >>> .../bindings/dma/sophgo,cv1800-dmamux.yaml | 47 ++++++++++++++++ > >>> include/dt-bindings/dma/cv1800-dma.h | 55 +++++++++++++++++++ > >>> 2 files changed, 102 insertions(+) > >>> create mode 100644 Documentation/devicetree/bindings/dma/sophgo,cv1800-dmamux.yaml > >>> create mode 100644 include/dt-bindings/dma/cv1800-dma.h > >>> > >>> diff --git a/Documentation/devicetree/bindings/dma/sophgo,cv1800-dmamux.yaml b/Documentation/devicetree/bindings/dma/sophgo,cv1800-dmamux.yaml > >>> new file mode 100644 > >>> index 000000000000..c813c66737ba > >>> --- /dev/null > >>> +++ b/Documentation/devicetree/bindings/dma/sophgo,cv1800-dmamux.yaml > >>> @@ -0,0 +1,47 @@ > >>> +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) > >>> +%YAML 1.2 > >>> +--- > >>> +$id: http://devicetree.org/schemas/dma/sophgo,cv1800-dmamux.yaml# > >>> +$schema: http://devicetree.org/meta-schemas/core.yaml# > >>> + > >>> +title: Sophgo CV1800/SG200 Series DMA mux > >>> + > >>> +maintainers: > >>> + - Inochi Amaoto <inochiama@outlook.com> > >>> + > >>> +allOf: > >>> + - $ref: dma-router.yaml# > >>> + > >>> +properties: > >>> + compatible: > >>> + const: sophgo,cv1800-dmamux > >>> + > >>> + reg: > >>> + maxItems: 2 > >>> + > >>> + '#dma-cells': > >>> + const: 3 > >>> + description: > >>> + The first cells is DMA channel. The second one is device id. > >>> + The third one is the cpu id. > >> > >> There are 43 devices, but only 8 channels. Since the channel is statically > >> specified in the devicetree as the first cell here, that means the SoC DT author > >> must pre-select which 8 of the 43 devices are usable, right? > > > > Yes, you are right. > > > >> And then the rest > >> would have to omit their dma properties. Wouldn't it be better to leave out the > >> channel number here and dynamically allocate channels at runtime? > >> > > > > You mean defining all the dma channel in the device and allocation channel > > selectively? This is workable, but it still needs a hint to allocate channel. > > I mean allocating hardware channels only when a channel is requested by a client > driver. The dmamux driver could maintain a counter and allocate the channels > sequentially -- then the first 8 calls to cv1800_dmamux_route_allocate() would > succeed and later calls from other devices would fail. > > > Also, according to the information from sophgo, it does not support dynamic > > channel allocation, so all channel can only be initialize once. > > That's important to know. In that case, the driver should probably leave the > registers alone in cv1800_dmamux_free(), and then scan to see if a device is > already mapped to a channel before allocating a new one. (Or it should have some > other way of remembering the mapping.) That way a single client can repeatedly > allocate/free its DMA channel without consuming all of the hardware channels. > Yes, this is needed. > > There is another problem, since we defined all the dmas property in the device, > > How to mask the devices if we do not want to use dma on them? I have see SPI > > device will disable DMA when allocation failed, I guess this is this mechanism > > is the same for all devices? > > I2C/SPI/UART controller drivers generally still work after failing to acquire a > DMA channel. For audio-related drivers, DMA is generally a hard dependency. > > If each board has 8 or fewer DMA-capable devices enabled in its DT, there is no > problem. If some board enables more than 8 DMA-capable devices, then it should > use "/delete-property/ dmas;" on the devices that would be least impacted by > missing DMA. Otherwise, which devices get functional DMA depends on driver probe > order. > > Normally you wouldn't need to do "/delete-property/ dmas;", because many drivers > only request the DMA channel when actively being used (e.g. userspace has the > TTY/spidev/ALSA device file open), but this doesn't help if you can only assign > each channel once. > That is the problem. It is hard when the register can be only write once. It may be better to let the end user to determine which device wants dma. I will do some more reverse engineering to check whether it is possible to do a remap, And at least for now, I will implement the basic mechanisms. Thanks for your explanation. > Regards, > Samuel > > >>> + > >>> + dma-masters: > >>> + maxItems: 1 > >>> + > >>> + dma-requests: > >>> + const: 8 > >>> + > >>> +required: > >>> + - '#dma-cells' > >>> + - dma-masters > >>> + > >>> +additionalProperties: false > >>> + > >>> +examples: > >>> + - | > >>> + dma-router { > >>> + compatible = "sophgo,cv1800-dmamux"; > >>> + #dma-cells = <3>; > >>> + dma-masters = <&dmac>; > >>> + dma-requests = <8>; > >>> + }; > >>> diff --git a/include/dt-bindings/dma/cv1800-dma.h b/include/dt-bindings/dma/cv1800-dma.h > >>> new file mode 100644 > >>> index 000000000000..3ce9dac25259 > >>> --- /dev/null > >>> +++ b/include/dt-bindings/dma/cv1800-dma.h > >>> @@ -0,0 +1,55 @@ > >>> +/* SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause */ > >>> + > >>> +#ifndef __DT_BINDINGS_DMA_CV1800_H__ > >>> +#define __DT_BINDINGS_DMA_CV1800_H__ > >>> + > >>> +#define DMA_I2S0_RX 0 > >>> +#define DMA_I2S0_TX 1 > >>> +#define DMA_I2S1_RX 2 > >>> +#define DMA_I2S1_TX 3 > >>> +#define DMA_I2S2_RX 4 > >>> +#define DMA_I2S2_TX 5 > >>> +#define DMA_I2S3_RX 6 > >>> +#define DMA_I2S3_TX 7 > >>> +#define DMA_UART0_RX 8 > >>> +#define DMA_UART0_TX 9 > >>> +#define DMA_UART1_RX 10 > >>> +#define DMA_UART1_TX 11 > >>> +#define DMA_UART2_RX 12 > >>> +#define DMA_UART2_TX 13 > >>> +#define DMA_UART3_RX 14 > >>> +#define DMA_UART3_TX 15 > >>> +#define DMA_SPI0_RX 16 > >>> +#define DMA_SPI0_TX 17 > >>> +#define DMA_SPI1_RX 18 > >>> +#define DMA_SPI1_TX 19 > >>> +#define DMA_SPI2_RX 20 > >>> +#define DMA_SPI2_TX 21 > >>> +#define DMA_SPI3_RX 22 > >>> +#define DMA_SPI3_TX 23 > >>> +#define DMA_I2C0_RX 24 > >>> +#define DMA_I2C0_TX 25 > >>> +#define DMA_I2C1_RX 26 > >>> +#define DMA_I2C1_TX 27 > >>> +#define DMA_I2C2_RX 28 > >>> +#define DMA_I2C2_TX 29 > >>> +#define DMA_I2C3_RX 30 > >>> +#define DMA_I2C3_TX 31 > >>> +#define DMA_I2C4_RX 32 > >>> +#define DMA_I2C4_TX 33 > >>> +#define DMA_TDM0_RX 34 > >>> +#define DMA_TDM0_TX 35 > >>> +#define DMA_TDM1_RX 36 > >>> +#define DMA_AUDSRC 37 > >>> +#define DMA_SPI_NAND 38 > >>> +#define DMA_SPI_NOR 39 > >>> +#define DMA_UART4_RX 40 > >>> +#define DMA_UART4_TX 41 > >>> +#define DMA_SPI_NOR1 42 > >>> + > >>> +#define DMA_CPU_A53 0 > >>> +#define DMA_CPU_C906_0 1 > >>> +#define DMA_CPU_C906_1 2 > >>> + > >>> + > >>> +#endif // __DT_BINDINGS_DMA_CV1800_H__ > >>> -- > >>> 2.44.0 > >>> > >>> > >>> _______________________________________________ > >>> linux-riscv mailing list > >>> linux-riscv@lists.infradead.org > >>> http://lists.infradead.org/mailman/listinfo/linux-riscv > >> > _______________________________________________ linux-riscv mailing list linux-riscv@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-riscv
Hi Inochi, On 2024-03-18 11:03 PM, Inochi Amaoto wrote: > On Mon, Mar 18, 2024 at 10:22:47PM -0500, Samuel Holland wrote: >> On 2024-03-18 1:38 AM, Inochi Amaoto wrote: >>> The DMA IP of Sophgo CV18XX/SG200X is based on a DW AXI CORE, with >>> an additional channel remap register located in the top system control >>> area. The DMA channel is exclusive to each core. >>> >>> Add the dmamux binding for CV18XX/SG200X series SoC >>> >>> Signed-off-by: Inochi Amaoto <inochiama@outlook.com> >>> Reviewed-by: Rob Herring <robh@kernel.org> >>> --- >>> .../bindings/dma/sophgo,cv1800-dmamux.yaml | 47 ++++++++++++++++ >>> include/dt-bindings/dma/cv1800-dma.h | 55 +++++++++++++++++++ >>> 2 files changed, 102 insertions(+) >>> create mode 100644 Documentation/devicetree/bindings/dma/sophgo,cv1800-dmamux.yaml >>> create mode 100644 include/dt-bindings/dma/cv1800-dma.h >>> >>> diff --git a/Documentation/devicetree/bindings/dma/sophgo,cv1800-dmamux.yaml b/Documentation/devicetree/bindings/dma/sophgo,cv1800-dmamux.yaml >>> new file mode 100644 >>> index 000000000000..c813c66737ba >>> --- /dev/null >>> +++ b/Documentation/devicetree/bindings/dma/sophgo,cv1800-dmamux.yaml >>> @@ -0,0 +1,47 @@ >>> +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) >>> +%YAML 1.2 >>> +--- >>> +$id: http://devicetree.org/schemas/dma/sophgo,cv1800-dmamux.yaml# >>> +$schema: http://devicetree.org/meta-schemas/core.yaml# >>> + >>> +title: Sophgo CV1800/SG200 Series DMA mux >>> + >>> +maintainers: >>> + - Inochi Amaoto <inochiama@outlook.com> >>> + >>> +allOf: >>> + - $ref: dma-router.yaml# >>> + >>> +properties: >>> + compatible: >>> + const: sophgo,cv1800-dmamux >>> + >>> + reg: >>> + maxItems: 2 >>> + >>> + '#dma-cells': >>> + const: 3 >>> + description: >>> + The first cells is DMA channel. The second one is device id. >>> + The third one is the cpu id. >> >> There are 43 devices, but only 8 channels. Since the channel is statically >> specified in the devicetree as the first cell here, that means the SoC DT author >> must pre-select which 8 of the 43 devices are usable, right? > > Yes, you are right. > >> And then the rest >> would have to omit their dma properties. Wouldn't it be better to leave out the >> channel number here and dynamically allocate channels at runtime? >> > > You mean defining all the dma channel in the device and allocation channel > selectively? This is workable, but it still needs a hint to allocate channel. I mean allocating hardware channels only when a channel is requested by a client driver. The dmamux driver could maintain a counter and allocate the channels sequentially -- then the first 8 calls to cv1800_dmamux_route_allocate() would succeed and later calls from other devices would fail. > Also, according to the information from sophgo, it does not support dynamic > channel allocation, so all channel can only be initialize once. That's important to know. In that case, the driver should probably leave the registers alone in cv1800_dmamux_free(), and then scan to see if a device is already mapped to a channel before allocating a new one. (Or it should have some other way of remembering the mapping.) That way a single client can repeatedly allocate/free its DMA channel without consuming all of the hardware channels. > There is another problem, since we defined all the dmas property in the device, > How to mask the devices if we do not want to use dma on them? I have see SPI > device will disable DMA when allocation failed, I guess this is this mechanism > is the same for all devices? I2C/SPI/UART controller drivers generally still work after failing to acquire a DMA channel. For audio-related drivers, DMA is generally a hard dependency. If each board has 8 or fewer DMA-capable devices enabled in its DT, there is no problem. If some board enables more than 8 DMA-capable devices, then it should use "/delete-property/ dmas;" on the devices that would be least impacted by missing DMA. Otherwise, which devices get functional DMA depends on driver probe order. Normally you wouldn't need to do "/delete-property/ dmas;", because many drivers only request the DMA channel when actively being used (e.g. userspace has the TTY/spidev/ALSA device file open), but this doesn't help if you can only assign each channel once. Regards, Samuel >>> + >>> + dma-masters: >>> + maxItems: 1 >>> + >>> + dma-requests: >>> + const: 8 >>> + >>> +required: >>> + - '#dma-cells' >>> + - dma-masters >>> + >>> +additionalProperties: false >>> + >>> +examples: >>> + - | >>> + dma-router { >>> + compatible = "sophgo,cv1800-dmamux"; >>> + #dma-cells = <3>; >>> + dma-masters = <&dmac>; >>> + dma-requests = <8>; >>> + }; >>> diff --git a/include/dt-bindings/dma/cv1800-dma.h b/include/dt-bindings/dma/cv1800-dma.h >>> new file mode 100644 >>> index 000000000000..3ce9dac25259 >>> --- /dev/null >>> +++ b/include/dt-bindings/dma/cv1800-dma.h >>> @@ -0,0 +1,55 @@ >>> +/* SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause */ >>> + >>> +#ifndef __DT_BINDINGS_DMA_CV1800_H__ >>> +#define __DT_BINDINGS_DMA_CV1800_H__ >>> + >>> +#define DMA_I2S0_RX 0 >>> +#define DMA_I2S0_TX 1 >>> +#define DMA_I2S1_RX 2 >>> +#define DMA_I2S1_TX 3 >>> +#define DMA_I2S2_RX 4 >>> +#define DMA_I2S2_TX 5 >>> +#define DMA_I2S3_RX 6 >>> +#define DMA_I2S3_TX 7 >>> +#define DMA_UART0_RX 8 >>> +#define DMA_UART0_TX 9 >>> +#define DMA_UART1_RX 10 >>> +#define DMA_UART1_TX 11 >>> +#define DMA_UART2_RX 12 >>> +#define DMA_UART2_TX 13 >>> +#define DMA_UART3_RX 14 >>> +#define DMA_UART3_TX 15 >>> +#define DMA_SPI0_RX 16 >>> +#define DMA_SPI0_TX 17 >>> +#define DMA_SPI1_RX 18 >>> +#define DMA_SPI1_TX 19 >>> +#define DMA_SPI2_RX 20 >>> +#define DMA_SPI2_TX 21 >>> +#define DMA_SPI3_RX 22 >>> +#define DMA_SPI3_TX 23 >>> +#define DMA_I2C0_RX 24 >>> +#define DMA_I2C0_TX 25 >>> +#define DMA_I2C1_RX 26 >>> +#define DMA_I2C1_TX 27 >>> +#define DMA_I2C2_RX 28 >>> +#define DMA_I2C2_TX 29 >>> +#define DMA_I2C3_RX 30 >>> +#define DMA_I2C3_TX 31 >>> +#define DMA_I2C4_RX 32 >>> +#define DMA_I2C4_TX 33 >>> +#define DMA_TDM0_RX 34 >>> +#define DMA_TDM0_TX 35 >>> +#define DMA_TDM1_RX 36 >>> +#define DMA_AUDSRC 37 >>> +#define DMA_SPI_NAND 38 >>> +#define DMA_SPI_NOR 39 >>> +#define DMA_UART4_RX 40 >>> +#define DMA_UART4_TX 41 >>> +#define DMA_SPI_NOR1 42 >>> + >>> +#define DMA_CPU_A53 0 >>> +#define DMA_CPU_C906_0 1 >>> +#define DMA_CPU_C906_1 2 >>> + >>> + >>> +#endif // __DT_BINDINGS_DMA_CV1800_H__ >>> -- >>> 2.44.0 >>> >>> >>> _______________________________________________ >>> linux-riscv mailing list >>> linux-riscv@lists.infradead.org >>> http://lists.infradead.org/mailman/listinfo/linux-riscv >> _______________________________________________ linux-riscv mailing list linux-riscv@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-riscv
On Mon, Mar 18, 2024 at 10:36:01PM -0500, Samuel Holland wrote: > On 2024-03-18 1:38 AM, Inochi Amaoto wrote: > > Sophgo CV18XX/SG200X use DW AXI CORE with a multiplexer for remapping > > its request lines. The multiplexer supports at most 8 request lines. > > > > Add driver for Sophgo CV18XX/SG200X DMA multiplexer. > > > > Signed-off-by: Inochi Amaoto <inochiama@outlook.com> > > --- > > drivers/dma/Kconfig | 9 ++ > > drivers/dma/Makefile | 1 + > > drivers/dma/cv1800-dmamux.c | 232 ++++++++++++++++++++++++++++++++++++ > > 3 files changed, 242 insertions(+) > > create mode 100644 drivers/dma/cv1800-dmamux.c > > > > diff --git a/drivers/dma/Kconfig b/drivers/dma/Kconfig > > index 002a5ec80620..cb31520b9f86 100644 > > --- a/drivers/dma/Kconfig > > +++ b/drivers/dma/Kconfig > > @@ -546,6 +546,15 @@ config PLX_DMA > > These are exposed via extra functions on the switch's > > upstream port. Each function exposes one DMA channel. > > > > +config SOPHGO_CV1800_DMAMUX > > + tristate "Sophgo CV1800/SG2000 series SoC DMA multiplexer support" > > + depends on MFD_SYSCON > > + depends on ARCH_SOPHGO > > + help > > + Support for the DMA multiplexer on Sophgo CV1800/SG2000 > > + series SoCs. > > + Say Y here if your board have this soc. > > + > > config STE_DMA40 > > bool "ST-Ericsson DMA40 support" > > depends on ARCH_U8500 > > diff --git a/drivers/dma/Makefile b/drivers/dma/Makefile > > index dfd40d14e408..7465f249ee47 100644 > > --- a/drivers/dma/Makefile > > +++ b/drivers/dma/Makefile > > @@ -67,6 +67,7 @@ obj-$(CONFIG_PPC_BESTCOMM) += bestcomm/ > > obj-$(CONFIG_PXA_DMA) += pxa_dma.o > > obj-$(CONFIG_RENESAS_DMA) += sh/ > > obj-$(CONFIG_SF_PDMA) += sf-pdma/ > > +obj-$(CONFIG_SOPHGO_CV1800_DMAMUX) += cv1800-dmamux.o > > obj-$(CONFIG_STE_DMA40) += ste_dma40.o ste_dma40_ll.o > > obj-$(CONFIG_STM32_DMA) += stm32-dma.o > > obj-$(CONFIG_STM32_DMAMUX) += stm32-dmamux.o > > diff --git a/drivers/dma/cv1800-dmamux.c b/drivers/dma/cv1800-dmamux.c > > new file mode 100644 > > index 000000000000..b41c39f2e338 > > --- /dev/null > > +++ b/drivers/dma/cv1800-dmamux.c > > @@ -0,0 +1,232 @@ > > +// SPDX-License-Identifier: GPL-2.0 > > +/* > > + * Copyright (C) 2023 Inochi Amaoto <inochiama@outlook.com> > > + */ > > + > > +#include <linux/bitops.h> > > +#include <linux/module.h> > > +#include <linux/of_dma.h> > > +#include <linux/of_address.h> > > +#include <linux/of_platform.h> > > +#include <linux/platform_device.h> > > +#include <linux/regmap.h> > > +#include <linux/spinlock.h> > > +#include <linux/mfd/syscon.h> > > + > > +#include <soc/sophgo/cv1800-sysctl.h> > > +#include <dt-bindings/dma/cv1800-dma.h> > > + > > +#define DMAMUX_NCELLS 3 > > +#define MAX_DMA_MAPPING_ID DMA_SPI_NOR1 > > +#define MAX_DMA_CPU_ID DMA_CPU_C906_1 > > +#define MAX_DMA_CH_ID 7 > > + > > +#define DMAMUX_INTMUX_REGISTER_LEN 4 > > +#define DMAMUX_NR_CH_PER_REGISTER 4 > > +#define DMAMUX_BIT_PER_CH 8 > > +#define DMAMUX_CH_MASk GENMASK(5, 0) > > +#define DMAMUX_INT_BIT_PER_CPU 10 > > +#define DMAMUX_CH_UPDATE_BIT BIT(31) > > + > > +#define DMAMUX_CH_SET(chid, val) \ > > + (((val) << ((chid) * DMAMUX_BIT_PER_CH)) | DMAMUX_CH_UPDATE_BIT) > > +#define DMAMUX_CH_MASK(chid) \ > > + DMAMUX_CH_SET(chid, DMAMUX_CH_MASk) > > + > > +#define DMAMUX_INT_BIT(chid, cpuid) \ > > + BIT((cpuid) * DMAMUX_INT_BIT_PER_CPU + (chid)) > > +#define DMAMUX_INTEN_BIT(cpuid) \ > > + DMAMUX_INT_BIT(8, cpuid) > > +#define DMAMUX_INT_CH_BIT(chid, cpuid) \ > > + (DMAMUX_INT_BIT(chid, cpuid) | DMAMUX_INTEN_BIT(cpuid)) > > +#define DMAMUX_INT_MASK(chid) \ > > + (DMAMUX_INT_BIT(chid, DMA_CPU_A53) | \ > > + DMAMUX_INT_BIT(chid, DMA_CPU_C906_0) | \ > > + DMAMUX_INT_BIT(chid, DMA_CPU_C906_1)) > > +#define DMAMUX_INT_CH_MASK(chid, cpuid) \ > > + (DMAMUX_INT_MASK(chid) | DMAMUX_INTEN_BIT(cpuid)) > > + > > +struct cv1800_dmamux_data { > > + struct dma_router dmarouter; > > + struct regmap *regmap; > > + spinlock_t lock; > > + DECLARE_BITMAP(used_chans, MAX_DMA_CH_ID); > > + DECLARE_BITMAP(mapped_peripherals, MAX_DMA_MAPPING_ID); > > +}; > > + > > +struct cv1800_dmamux_map { > > + unsigned int channel; > > + unsigned int peripheral; > > + unsigned int cpu; > > +}; > > + > > +static void cv1800_dmamux_free(struct device *dev, void *route_data) > > +{ > > + struct cv1800_dmamux_data *dmamux = dev_get_drvdata(dev); > > + struct cv1800_dmamux_map *map = route_data; > > + u32 regoff = map->channel % DMAMUX_NR_CH_PER_REGISTER; > > + u32 regpos = map->channel / DMAMUX_NR_CH_PER_REGISTER; > > + unsigned long flags; > > + > > + spin_lock_irqsave(&dmamux->lock, flags); > > + > > + regmap_update_bits(dmamux->regmap, > > + regpos + CV1800_SDMA_DMA_CHANNEL_REMAP0, > > + DMAMUX_CH_MASK(regoff), > > + DMAMUX_CH_UPDATE_BIT); > > + > > + regmap_update_bits(dmamux->regmap, CV1800_SDMA_DMA_INT_MUX, > > + DMAMUX_INT_CH_MASK(map->channel, map->cpu), > > + DMAMUX_INTEN_BIT(map->cpu)); > > + > > + clear_bit(map->channel, dmamux->used_chans); > > + clear_bit(map->peripheral, dmamux->mapped_peripherals); > > + > > + spin_unlock_irqrestore(&dmamux->lock, flags); > > + > > + kfree(map); > > +} > > + > > +static void *cv1800_dmamux_route_allocate(struct of_phandle_args *dma_spec, > > + struct of_dma *ofdma) > > +{ > > + struct platform_device *pdev = of_find_device_by_node(ofdma->of_node); > > + struct cv1800_dmamux_data *dmamux = platform_get_drvdata(pdev); > > + struct cv1800_dmamux_map *map; > > + unsigned long flags; > > + unsigned int chid, devid, cpuid; > > + u32 regoff, regpos; > > + > > + if (dma_spec->args_count != DMAMUX_NCELLS) { > > + dev_err(&pdev->dev, "invalid number of dma mux args\n"); > > + return ERR_PTR(-EINVAL); > > + } > > + > > + chid = dma_spec->args[0]; > > + devid = dma_spec->args[1]; > > + cpuid = dma_spec->args[2]; > > + dma_spec->args_count -= 2; > > + > > + if (chid > MAX_DMA_CH_ID) { > > + dev_err(&pdev->dev, "invalid channel id: %u\n", chid); > > + return ERR_PTR(-EINVAL); > > + } > > + > > + if (devid > MAX_DMA_MAPPING_ID) { > > + dev_err(&pdev->dev, "invalid device id: %u\n", devid); > > + return ERR_PTR(-EINVAL); > > + } > > + > > + if (cpuid > MAX_DMA_CPU_ID) { > > + dev_err(&pdev->dev, "invalid cpu id: %u\n", cpuid); > > + return ERR_PTR(-EINVAL); > > + } > > + > > + dma_spec->np = of_parse_phandle(ofdma->of_node, "dma-masters", 0); > > + if (!dma_spec->np) { > > + dev_err(&pdev->dev, "can't get dma master\n"); > > + return ERR_PTR(-EINVAL); > > + } > > + > > + map = kzalloc(sizeof(*map), GFP_KERNEL); > > + if (!map) > > + return ERR_PTR(-ENOMEM); > > + > > + map->channel = chid; > > + map->peripheral = devid; > > + map->cpu = cpuid; > > + > > + regoff = chid % DMAMUX_NR_CH_PER_REGISTER; > > + regpos = chid / DMAMUX_NR_CH_PER_REGISTER; > > + > > + spin_lock_irqsave(&dmamux->lock, flags); > > + > > + if (test_and_set_bit(devid, dmamux->mapped_peripherals)) { > > + dev_err(&pdev->dev, "already used device mapping: %u\n", devid); > > + goto failed; > > + } > > + > > + if (test_and_set_bit(chid, dmamux->used_chans)) { > > + clear_bit(devid, dmamux->mapped_peripherals); > > + dev_err(&pdev->dev, "already used channel id: %u\n", chid); > > + goto failed; > > + } > > + > > + regmap_set_bits(dmamux->regmap, > > + regpos + CV1800_SDMA_DMA_CHANNEL_REMAP0, > > + DMAMUX_CH_SET(regoff, devid)); > > + > > + regmap_update_bits(dmamux->regmap, CV1800_SDMA_DMA_INT_MUX, > > + DMAMUX_INT_CH_MASK(chid, cpuid), > > + DMAMUX_INT_CH_BIT(chid, cpuid)); > > + > > + spin_unlock_irqrestore(&dmamux->lock, flags); > > + > > + dev_info(&pdev->dev, "register channel %u for req %u (cpu %u)\n", > > + chid, devid, cpuid); > > + > > + return map; > > + > > +failed: > > + spin_unlock_irqrestore(&dmamux->lock, flags); > > + dev_err(&pdev->dev, "already used channel id: %u\n", chid); > > This error is already logged above. > > > + return ERR_PTR(-EBUSY); > > +} > > + > > +static int cv1800_dmamux_probe(struct platform_device *pdev) > > +{ > > + struct device *dev = &pdev->dev; > > + struct device_node *mux_node = dev->of_node; > > + struct cv1800_dmamux_data *data; > > + struct device *parent = dev->parent; > > + struct device_node *dma_master; > > + struct regmap *map = NULL; > > + > > + if (!parent) > > + return -ENODEV; > > + > > + map = device_node_to_regmap(parent->of_node); > > + if (IS_ERR(map)) > > + return PTR_ERR(map); > > + > > + dma_master = of_parse_phandle(mux_node, "dma-masters", 0); > > + if (!dma_master) { > > + dev_err(dev, "invalid dma-requests property\n"); > > This error message doesn't match the property the code looks at. > > > + return -ENODEV; > > + } > > + of_node_put(dma_master); > > + > > + data = devm_kmalloc(dev, sizeof(*data), GFP_KERNEL); > > + if (!data) > > + return -ENOMEM; > > + > > + spin_lock_init(&data->lock); > > + data->regmap = map; > > + data->dmarouter.dev = dev; > > + data->dmarouter.route_free = cv1800_dmamux_free; > > + > > + platform_set_drvdata(pdev, data); > > + > > + return of_dma_router_register(mux_node, > > + cv1800_dmamux_route_allocate, > > + &data->dmarouter); > > +} > > + > > +static const struct of_device_id cv1800_dmamux_ids[] = { > > + { .compatible = "sophgo,cv1800-dmamux", }, > > + { } > > +}; > > +MODULE_DEVICE_TABLE(of, cv1800_dmamux_ids); > > + > > +static struct platform_driver cv1800_dmamux_driver = { > > + .driver = { > > + .name = "fsl-raideng", > > copy-paste error? Thanks for point it out. > > > + .of_match_table = cv1800_dmamux_ids, > > + }, > > + .probe = cv1800_dmamux_probe, > > +}; > > +module_platform_driver(cv1800_dmamux_driver); > > This driver can be built as an unloadable module, so it needs a .remove_new > function calling at least of_dma_controller_free(). > Thanks. > Regards, > Samuel > > > + > > +MODULE_AUTHOR("Inochi Amaoto <inochiama@outlook.com>"); > > +MODULE_DESCRIPTION("Sophgo CV1800/SG2000 Series Soc DMAMUX driver"); > > +MODULE_LICENSE("GPL"); > > -- > > 2.44.0 > > > > > > _______________________________________________ > > linux-riscv mailing list > > linux-riscv@lists.infradead.org > > http://lists.infradead.org/mailman/listinfo/linux-riscv > _______________________________________________ linux-riscv mailing list linux-riscv@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-riscv
On Mon, Mar 18, 2024 at 10:22:47PM -0500, Samuel Holland wrote: > On 2024-03-18 1:38 AM, Inochi Amaoto wrote: > > The DMA IP of Sophgo CV18XX/SG200X is based on a DW AXI CORE, with > > an additional channel remap register located in the top system control > > area. The DMA channel is exclusive to each core. > > > > Add the dmamux binding for CV18XX/SG200X series SoC > > > > Signed-off-by: Inochi Amaoto <inochiama@outlook.com> > > Reviewed-by: Rob Herring <robh@kernel.org> > > --- > > .../bindings/dma/sophgo,cv1800-dmamux.yaml | 47 ++++++++++++++++ > > include/dt-bindings/dma/cv1800-dma.h | 55 +++++++++++++++++++ > > 2 files changed, 102 insertions(+) > > create mode 100644 Documentation/devicetree/bindings/dma/sophgo,cv1800-dmamux.yaml > > create mode 100644 include/dt-bindings/dma/cv1800-dma.h > > > > diff --git a/Documentation/devicetree/bindings/dma/sophgo,cv1800-dmamux.yaml b/Documentation/devicetree/bindings/dma/sophgo,cv1800-dmamux.yaml > > new file mode 100644 > > index 000000000000..c813c66737ba > > --- /dev/null > > +++ b/Documentation/devicetree/bindings/dma/sophgo,cv1800-dmamux.yaml > > @@ -0,0 +1,47 @@ > > +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) > > +%YAML 1.2 > > +--- > > +$id: http://devicetree.org/schemas/dma/sophgo,cv1800-dmamux.yaml# > > +$schema: http://devicetree.org/meta-schemas/core.yaml# > > + > > +title: Sophgo CV1800/SG200 Series DMA mux > > + > > +maintainers: > > + - Inochi Amaoto <inochiama@outlook.com> > > + > > +allOf: > > + - $ref: dma-router.yaml# > > + > > +properties: > > + compatible: > > + const: sophgo,cv1800-dmamux > > + > > + reg: > > + maxItems: 2 > > + > > + '#dma-cells': > > + const: 3 > > + description: > > + The first cells is DMA channel. The second one is device id. > > + The third one is the cpu id. > > There are 43 devices, but only 8 channels. Since the channel is statically > specified in the devicetree as the first cell here, that means the SoC DT author > must pre-select which 8 of the 43 devices are usable, right? Yes, you are right. > And then the rest > would have to omit their dma properties. Wouldn't it be better to leave out the > channel number here and dynamically allocate channels at runtime? > You mean defining all the dma channel in the device and allocation channel selectively? This is workable, but it still needs a hint to allocate channel. Also, according to the information from sophgo, it does not support dynamic channel allocation, so all channel can only be initialize once. There is another problem, since we defined all the dmas property in the device, How to mask the devices if we do not want to use dma on them? I have see SPI device will disable DMA when allocation failed, I guess this is this mechanism is the same for all devices? Regards, Inochi > Regards, > Samuel > > > + > > + dma-masters: > > + maxItems: 1 > > + > > + dma-requests: > > + const: 8 > > + > > +required: > > + - '#dma-cells' > > + - dma-masters > > + > > +additionalProperties: false > > + > > +examples: > > + - | > > + dma-router { > > + compatible = "sophgo,cv1800-dmamux"; > > + #dma-cells = <3>; > > + dma-masters = <&dmac>; > > + dma-requests = <8>; > > + }; > > diff --git a/include/dt-bindings/dma/cv1800-dma.h b/include/dt-bindings/dma/cv1800-dma.h > > new file mode 100644 > > index 000000000000..3ce9dac25259 > > --- /dev/null > > +++ b/include/dt-bindings/dma/cv1800-dma.h > > @@ -0,0 +1,55 @@ > > +/* SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause */ > > + > > +#ifndef __DT_BINDINGS_DMA_CV1800_H__ > > +#define __DT_BINDINGS_DMA_CV1800_H__ > > + > > +#define DMA_I2S0_RX 0 > > +#define DMA_I2S0_TX 1 > > +#define DMA_I2S1_RX 2 > > +#define DMA_I2S1_TX 3 > > +#define DMA_I2S2_RX 4 > > +#define DMA_I2S2_TX 5 > > +#define DMA_I2S3_RX 6 > > +#define DMA_I2S3_TX 7 > > +#define DMA_UART0_RX 8 > > +#define DMA_UART0_TX 9 > > +#define DMA_UART1_RX 10 > > +#define DMA_UART1_TX 11 > > +#define DMA_UART2_RX 12 > > +#define DMA_UART2_TX 13 > > +#define DMA_UART3_RX 14 > > +#define DMA_UART3_TX 15 > > +#define DMA_SPI0_RX 16 > > +#define DMA_SPI0_TX 17 > > +#define DMA_SPI1_RX 18 > > +#define DMA_SPI1_TX 19 > > +#define DMA_SPI2_RX 20 > > +#define DMA_SPI2_TX 21 > > +#define DMA_SPI3_RX 22 > > +#define DMA_SPI3_TX 23 > > +#define DMA_I2C0_RX 24 > > +#define DMA_I2C0_TX 25 > > +#define DMA_I2C1_RX 26 > > +#define DMA_I2C1_TX 27 > > +#define DMA_I2C2_RX 28 > > +#define DMA_I2C2_TX 29 > > +#define DMA_I2C3_RX 30 > > +#define DMA_I2C3_TX 31 > > +#define DMA_I2C4_RX 32 > > +#define DMA_I2C4_TX 33 > > +#define DMA_TDM0_RX 34 > > +#define DMA_TDM0_TX 35 > > +#define DMA_TDM1_RX 36 > > +#define DMA_AUDSRC 37 > > +#define DMA_SPI_NAND 38 > > +#define DMA_SPI_NOR 39 > > +#define DMA_UART4_RX 40 > > +#define DMA_UART4_TX 41 > > +#define DMA_SPI_NOR1 42 > > + > > +#define DMA_CPU_A53 0 > > +#define DMA_CPU_C906_0 1 > > +#define DMA_CPU_C906_1 2 > > + > > + > > +#endif // __DT_BINDINGS_DMA_CV1800_H__ > > -- > > 2.44.0 > > > > > > _______________________________________________ > > linux-riscv mailing list > > linux-riscv@lists.infradead.org > > http://lists.infradead.org/mailman/listinfo/linux-riscv > _______________________________________________ linux-riscv mailing list linux-riscv@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-riscv
On Wed, Mar 13, 2024 at 5:05 PM Vladimir Isaev <vladimir.isaev@syntacore.com> wrote: > > Such relocation causes crash of android linker similar to one > described in commit e05d57dcb8c7 > ("riscv: Fixup __vdso_gettimeofday broke dynamic ftrace"). > > Looks like this relocation is added by CONFIG_DYNAMIC_FTRACE which is > disabled in the default android kernel. > > Before: > > readelf -rW arch/riscv/kernel/vdso/vdso.so: > > Relocation section '.rela.dyn' at offset 0xd00 contains 1 entry: > Offset Info Type > 0000000000000d20 0000000000000003 R_RISCV_RELATIVE > > objdump: > 0000000000000c86 <__vdso_riscv_hwprobe@@LINUX_4.15>: > c86: 0001 nop > c88: 0001 nop > c8a: 0001 nop > c8c: 0001 nop > c8e: e211 bnez a2,c92 <__vdso_riscv_hwprobe... > > After: > readelf -rW arch/riscv/kernel/vdso/vdso.so: > > There are no relocations in this file. > > objdump: > 0000000000000c86 <__vdso_riscv_hwprobe@@LINUX_4.15>: > c86: e211 bnez a2,c8a <__vdso_riscv_hwprobe... > c88: c6b9 beqz a3,cd6 <__vdso_riscv_hwprobe... > c8a: e739 bnez a4,cd8 <__vdso_riscv_hwprobe... > c8c: ffffd797 auipc a5,0xffffd > > Also disable SCS since it also should not be available in vdso. > > Fixes: aa5af0aa90ba ("RISC-V: Add hwprobe vDSO function and data") > Signed-off-by: Roman Artemev <roman.artemev@syntacore.com> > Signed-off-by: Vladimir Isaev <vladimir.isaev@syntacore.com> > --- > arch/riscv/kernel/vdso/Makefile | 1 + > 1 file changed, 1 insertion(+) > > diff --git a/arch/riscv/kernel/vdso/Makefile b/arch/riscv/kernel/vdso/Makefile > index 9b517fe1b8a8..272c431ac5b9 100644 > --- a/arch/riscv/kernel/vdso/Makefile > +++ b/arch/riscv/kernel/vdso/Makefile > @@ -37,6 +37,7 @@ endif > > # Disable -pg to prevent insert call site > CFLAGS_REMOVE_vgettimeofday.o = $(CC_FLAGS_FTRACE) $(CC_FLAGS_SCS) > +CFLAGS_REMOVE_hwprobe.o = $(CC_FLAGS_FTRACE) $(CC_FLAGS_SCS) LGTM, good catch, thanks :) Reviewed-by: Guo Ren <guoren@kernel.org> > > # Disable profiling and instrumentation for VDSO code > GCOV_PROFILE := n > -- > 2.43.0 > -- Best Regards Guo Ren _______________________________________________ linux-riscv mailing list linux-riscv@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-riscv
On 2024-03-18 1:38 AM, Inochi Amaoto wrote: > Sophgo CV18XX/SG200X use DW AXI CORE with a multiplexer for remapping > its request lines. The multiplexer supports at most 8 request lines. > > Add driver for Sophgo CV18XX/SG200X DMA multiplexer. > > Signed-off-by: Inochi Amaoto <inochiama@outlook.com> > --- > drivers/dma/Kconfig | 9 ++ > drivers/dma/Makefile | 1 + > drivers/dma/cv1800-dmamux.c | 232 ++++++++++++++++++++++++++++++++++++ > 3 files changed, 242 insertions(+) > create mode 100644 drivers/dma/cv1800-dmamux.c > > diff --git a/drivers/dma/Kconfig b/drivers/dma/Kconfig > index 002a5ec80620..cb31520b9f86 100644 > --- a/drivers/dma/Kconfig > +++ b/drivers/dma/Kconfig > @@ -546,6 +546,15 @@ config PLX_DMA > These are exposed via extra functions on the switch's > upstream port. Each function exposes one DMA channel. > > +config SOPHGO_CV1800_DMAMUX > + tristate "Sophgo CV1800/SG2000 series SoC DMA multiplexer support" > + depends on MFD_SYSCON > + depends on ARCH_SOPHGO > + help > + Support for the DMA multiplexer on Sophgo CV1800/SG2000 > + series SoCs. > + Say Y here if your board have this soc. > + > config STE_DMA40 > bool "ST-Ericsson DMA40 support" > depends on ARCH_U8500 > diff --git a/drivers/dma/Makefile b/drivers/dma/Makefile > index dfd40d14e408..7465f249ee47 100644 > --- a/drivers/dma/Makefile > +++ b/drivers/dma/Makefile > @@ -67,6 +67,7 @@ obj-$(CONFIG_PPC_BESTCOMM) += bestcomm/ > obj-$(CONFIG_PXA_DMA) += pxa_dma.o > obj-$(CONFIG_RENESAS_DMA) += sh/ > obj-$(CONFIG_SF_PDMA) += sf-pdma/ > +obj-$(CONFIG_SOPHGO_CV1800_DMAMUX) += cv1800-dmamux.o > obj-$(CONFIG_STE_DMA40) += ste_dma40.o ste_dma40_ll.o > obj-$(CONFIG_STM32_DMA) += stm32-dma.o > obj-$(CONFIG_STM32_DMAMUX) += stm32-dmamux.o > diff --git a/drivers/dma/cv1800-dmamux.c b/drivers/dma/cv1800-dmamux.c > new file mode 100644 > index 000000000000..b41c39f2e338 > --- /dev/null > +++ b/drivers/dma/cv1800-dmamux.c > @@ -0,0 +1,232 @@ > +// SPDX-License-Identifier: GPL-2.0 > +/* > + * Copyright (C) 2023 Inochi Amaoto <inochiama@outlook.com> > + */ > + > +#include <linux/bitops.h> > +#include <linux/module.h> > +#include <linux/of_dma.h> > +#include <linux/of_address.h> > +#include <linux/of_platform.h> > +#include <linux/platform_device.h> > +#include <linux/regmap.h> > +#include <linux/spinlock.h> > +#include <linux/mfd/syscon.h> > + > +#include <soc/sophgo/cv1800-sysctl.h> > +#include <dt-bindings/dma/cv1800-dma.h> > + > +#define DMAMUX_NCELLS 3 > +#define MAX_DMA_MAPPING_ID DMA_SPI_NOR1 > +#define MAX_DMA_CPU_ID DMA_CPU_C906_1 > +#define MAX_DMA_CH_ID 7 > + > +#define DMAMUX_INTMUX_REGISTER_LEN 4 > +#define DMAMUX_NR_CH_PER_REGISTER 4 > +#define DMAMUX_BIT_PER_CH 8 > +#define DMAMUX_CH_MASk GENMASK(5, 0) > +#define DMAMUX_INT_BIT_PER_CPU 10 > +#define DMAMUX_CH_UPDATE_BIT BIT(31) > + > +#define DMAMUX_CH_SET(chid, val) \ > + (((val) << ((chid) * DMAMUX_BIT_PER_CH)) | DMAMUX_CH_UPDATE_BIT) > +#define DMAMUX_CH_MASK(chid) \ > + DMAMUX_CH_SET(chid, DMAMUX_CH_MASk) > + > +#define DMAMUX_INT_BIT(chid, cpuid) \ > + BIT((cpuid) * DMAMUX_INT_BIT_PER_CPU + (chid)) > +#define DMAMUX_INTEN_BIT(cpuid) \ > + DMAMUX_INT_BIT(8, cpuid) > +#define DMAMUX_INT_CH_BIT(chid, cpuid) \ > + (DMAMUX_INT_BIT(chid, cpuid) | DMAMUX_INTEN_BIT(cpuid)) > +#define DMAMUX_INT_MASK(chid) \ > + (DMAMUX_INT_BIT(chid, DMA_CPU_A53) | \ > + DMAMUX_INT_BIT(chid, DMA_CPU_C906_0) | \ > + DMAMUX_INT_BIT(chid, DMA_CPU_C906_1)) > +#define DMAMUX_INT_CH_MASK(chid, cpuid) \ > + (DMAMUX_INT_MASK(chid) | DMAMUX_INTEN_BIT(cpuid)) > + > +struct cv1800_dmamux_data { > + struct dma_router dmarouter; > + struct regmap *regmap; > + spinlock_t lock; > + DECLARE_BITMAP(used_chans, MAX_DMA_CH_ID); > + DECLARE_BITMAP(mapped_peripherals, MAX_DMA_MAPPING_ID); > +}; > + > +struct cv1800_dmamux_map { > + unsigned int channel; > + unsigned int peripheral; > + unsigned int cpu; > +}; > + > +static void cv1800_dmamux_free(struct device *dev, void *route_data) > +{ > + struct cv1800_dmamux_data *dmamux = dev_get_drvdata(dev); > + struct cv1800_dmamux_map *map = route_data; > + u32 regoff = map->channel % DMAMUX_NR_CH_PER_REGISTER; > + u32 regpos = map->channel / DMAMUX_NR_CH_PER_REGISTER; > + unsigned long flags; > + > + spin_lock_irqsave(&dmamux->lock, flags); > + > + regmap_update_bits(dmamux->regmap, > + regpos + CV1800_SDMA_DMA_CHANNEL_REMAP0, > + DMAMUX_CH_MASK(regoff), > + DMAMUX_CH_UPDATE_BIT); > + > + regmap_update_bits(dmamux->regmap, CV1800_SDMA_DMA_INT_MUX, > + DMAMUX_INT_CH_MASK(map->channel, map->cpu), > + DMAMUX_INTEN_BIT(map->cpu)); > + > + clear_bit(map->channel, dmamux->used_chans); > + clear_bit(map->peripheral, dmamux->mapped_peripherals); > + > + spin_unlock_irqrestore(&dmamux->lock, flags); > + > + kfree(map); > +} > + > +static void *cv1800_dmamux_route_allocate(struct of_phandle_args *dma_spec, > + struct of_dma *ofdma) > +{ > + struct platform_device *pdev = of_find_device_by_node(ofdma->of_node); > + struct cv1800_dmamux_data *dmamux = platform_get_drvdata(pdev); > + struct cv1800_dmamux_map *map; > + unsigned long flags; > + unsigned int chid, devid, cpuid; > + u32 regoff, regpos; > + > + if (dma_spec->args_count != DMAMUX_NCELLS) { > + dev_err(&pdev->dev, "invalid number of dma mux args\n"); > + return ERR_PTR(-EINVAL); > + } > + > + chid = dma_spec->args[0]; > + devid = dma_spec->args[1]; > + cpuid = dma_spec->args[2]; > + dma_spec->args_count -= 2; > + > + if (chid > MAX_DMA_CH_ID) { > + dev_err(&pdev->dev, "invalid channel id: %u\n", chid); > + return ERR_PTR(-EINVAL); > + } > + > + if (devid > MAX_DMA_MAPPING_ID) { > + dev_err(&pdev->dev, "invalid device id: %u\n", devid); > + return ERR_PTR(-EINVAL); > + } > + > + if (cpuid > MAX_DMA_CPU_ID) { > + dev_err(&pdev->dev, "invalid cpu id: %u\n", cpuid); > + return ERR_PTR(-EINVAL); > + } > + > + dma_spec->np = of_parse_phandle(ofdma->of_node, "dma-masters", 0); > + if (!dma_spec->np) { > + dev_err(&pdev->dev, "can't get dma master\n"); > + return ERR_PTR(-EINVAL); > + } > + > + map = kzalloc(sizeof(*map), GFP_KERNEL); > + if (!map) > + return ERR_PTR(-ENOMEM); > + > + map->channel = chid; > + map->peripheral = devid; > + map->cpu = cpuid; > + > + regoff = chid % DMAMUX_NR_CH_PER_REGISTER; > + regpos = chid / DMAMUX_NR_CH_PER_REGISTER; > + > + spin_lock_irqsave(&dmamux->lock, flags); > + > + if (test_and_set_bit(devid, dmamux->mapped_peripherals)) { > + dev_err(&pdev->dev, "already used device mapping: %u\n", devid); > + goto failed; > + } > + > + if (test_and_set_bit(chid, dmamux->used_chans)) { > + clear_bit(devid, dmamux->mapped_peripherals); > + dev_err(&pdev->dev, "already used channel id: %u\n", chid); > + goto failed; > + } > + > + regmap_set_bits(dmamux->regmap, > + regpos + CV1800_SDMA_DMA_CHANNEL_REMAP0, > + DMAMUX_CH_SET(regoff, devid)); > + > + regmap_update_bits(dmamux->regmap, CV1800_SDMA_DMA_INT_MUX, > + DMAMUX_INT_CH_MASK(chid, cpuid), > + DMAMUX_INT_CH_BIT(chid, cpuid)); > + > + spin_unlock_irqrestore(&dmamux->lock, flags); > + > + dev_info(&pdev->dev, "register channel %u for req %u (cpu %u)\n", > + chid, devid, cpuid); > + > + return map; > + > +failed: > + spin_unlock_irqrestore(&dmamux->lock, flags); > + dev_err(&pdev->dev, "already used channel id: %u\n", chid); This error is already logged above. > + return ERR_PTR(-EBUSY); > +} > + > +static int cv1800_dmamux_probe(struct platform_device *pdev) > +{ > + struct device *dev = &pdev->dev; > + struct device_node *mux_node = dev->of_node; > + struct cv1800_dmamux_data *data; > + struct device *parent = dev->parent; > + struct device_node *dma_master; > + struct regmap *map = NULL; > + > + if (!parent) > + return -ENODEV; > + > + map = device_node_to_regmap(parent->of_node); > + if (IS_ERR(map)) > + return PTR_ERR(map); > + > + dma_master = of_parse_phandle(mux_node, "dma-masters", 0); > + if (!dma_master) { > + dev_err(dev, "invalid dma-requests property\n"); This error message doesn't match the property the code looks at. > + return -ENODEV; > + } > + of_node_put(dma_master); > + > + data = devm_kmalloc(dev, sizeof(*data), GFP_KERNEL); > + if (!data) > + return -ENOMEM; > + > + spin_lock_init(&data->lock); > + data->regmap = map; > + data->dmarouter.dev = dev; > + data->dmarouter.route_free = cv1800_dmamux_free; > + > + platform_set_drvdata(pdev, data); > + > + return of_dma_router_register(mux_node, > + cv1800_dmamux_route_allocate, > + &data->dmarouter); > +} > + > +static const struct of_device_id cv1800_dmamux_ids[] = { > + { .compatible = "sophgo,cv1800-dmamux", }, > + { } > +}; > +MODULE_DEVICE_TABLE(of, cv1800_dmamux_ids); > + > +static struct platform_driver cv1800_dmamux_driver = { > + .driver = { > + .name = "fsl-raideng", copy-paste error? > + .of_match_table = cv1800_dmamux_ids, > + }, > + .probe = cv1800_dmamux_probe, > +}; > +module_platform_driver(cv1800_dmamux_driver); This driver can be built as an unloadable module, so it needs a .remove_new function calling at least of_dma_controller_free(). Regards, Samuel > + > +MODULE_AUTHOR("Inochi Amaoto <inochiama@outlook.com>"); > +MODULE_DESCRIPTION("Sophgo CV1800/SG2000 Series Soc DMAMUX driver"); > +MODULE_LICENSE("GPL"); > -- > 2.44.0 > > > _______________________________________________ > linux-riscv mailing list > linux-riscv@lists.infradead.org > http://lists.infradead.org/mailman/listinfo/linux-riscv _______________________________________________ linux-riscv mailing list linux-riscv@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-riscv
On 2024-03-18 1:38 AM, Inochi Amaoto wrote: > The DMA IP of Sophgo CV18XX/SG200X is based on a DW AXI CORE, with > an additional channel remap register located in the top system control > area. The DMA channel is exclusive to each core. > > Add the dmamux binding for CV18XX/SG200X series SoC > > Signed-off-by: Inochi Amaoto <inochiama@outlook.com> > Reviewed-by: Rob Herring <robh@kernel.org> > --- > .../bindings/dma/sophgo,cv1800-dmamux.yaml | 47 ++++++++++++++++ > include/dt-bindings/dma/cv1800-dma.h | 55 +++++++++++++++++++ > 2 files changed, 102 insertions(+) > create mode 100644 Documentation/devicetree/bindings/dma/sophgo,cv1800-dmamux.yaml > create mode 100644 include/dt-bindings/dma/cv1800-dma.h > > diff --git a/Documentation/devicetree/bindings/dma/sophgo,cv1800-dmamux.yaml b/Documentation/devicetree/bindings/dma/sophgo,cv1800-dmamux.yaml > new file mode 100644 > index 000000000000..c813c66737ba > --- /dev/null > +++ b/Documentation/devicetree/bindings/dma/sophgo,cv1800-dmamux.yaml > @@ -0,0 +1,47 @@ > +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) > +%YAML 1.2 > +--- > +$id: http://devicetree.org/schemas/dma/sophgo,cv1800-dmamux.yaml# > +$schema: http://devicetree.org/meta-schemas/core.yaml# > + > +title: Sophgo CV1800/SG200 Series DMA mux > + > +maintainers: > + - Inochi Amaoto <inochiama@outlook.com> > + > +allOf: > + - $ref: dma-router.yaml# > + > +properties: > + compatible: > + const: sophgo,cv1800-dmamux > + > + reg: > + maxItems: 2 > + > + '#dma-cells': > + const: 3 > + description: > + The first cells is DMA channel. The second one is device id. > + The third one is the cpu id. There are 43 devices, but only 8 channels. Since the channel is statically specified in the devicetree as the first cell here, that means the SoC DT author must pre-select which 8 of the 43 devices are usable, right? And then the rest would have to omit their dma properties. Wouldn't it be better to leave out the channel number here and dynamically allocate channels at runtime? Regards, Samuel > + > + dma-masters: > + maxItems: 1 > + > + dma-requests: > + const: 8 > + > +required: > + - '#dma-cells' > + - dma-masters > + > +additionalProperties: false > + > +examples: > + - | > + dma-router { > + compatible = "sophgo,cv1800-dmamux"; > + #dma-cells = <3>; > + dma-masters = <&dmac>; > + dma-requests = <8>; > + }; > diff --git a/include/dt-bindings/dma/cv1800-dma.h b/include/dt-bindings/dma/cv1800-dma.h > new file mode 100644 > index 000000000000..3ce9dac25259 > --- /dev/null > +++ b/include/dt-bindings/dma/cv1800-dma.h > @@ -0,0 +1,55 @@ > +/* SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause */ > + > +#ifndef __DT_BINDINGS_DMA_CV1800_H__ > +#define __DT_BINDINGS_DMA_CV1800_H__ > + > +#define DMA_I2S0_RX 0 > +#define DMA_I2S0_TX 1 > +#define DMA_I2S1_RX 2 > +#define DMA_I2S1_TX 3 > +#define DMA_I2S2_RX 4 > +#define DMA_I2S2_TX 5 > +#define DMA_I2S3_RX 6 > +#define DMA_I2S3_TX 7 > +#define DMA_UART0_RX 8 > +#define DMA_UART0_TX 9 > +#define DMA_UART1_RX 10 > +#define DMA_UART1_TX 11 > +#define DMA_UART2_RX 12 > +#define DMA_UART2_TX 13 > +#define DMA_UART3_RX 14 > +#define DMA_UART3_TX 15 > +#define DMA_SPI0_RX 16 > +#define DMA_SPI0_TX 17 > +#define DMA_SPI1_RX 18 > +#define DMA_SPI1_TX 19 > +#define DMA_SPI2_RX 20 > +#define DMA_SPI2_TX 21 > +#define DMA_SPI3_RX 22 > +#define DMA_SPI3_TX 23 > +#define DMA_I2C0_RX 24 > +#define DMA_I2C0_TX 25 > +#define DMA_I2C1_RX 26 > +#define DMA_I2C1_TX 27 > +#define DMA_I2C2_RX 28 > +#define DMA_I2C2_TX 29 > +#define DMA_I2C3_RX 30 > +#define DMA_I2C3_TX 31 > +#define DMA_I2C4_RX 32 > +#define DMA_I2C4_TX 33 > +#define DMA_TDM0_RX 34 > +#define DMA_TDM0_TX 35 > +#define DMA_TDM1_RX 36 > +#define DMA_AUDSRC 37 > +#define DMA_SPI_NAND 38 > +#define DMA_SPI_NOR 39 > +#define DMA_UART4_RX 40 > +#define DMA_UART4_TX 41 > +#define DMA_SPI_NOR1 42 > + > +#define DMA_CPU_A53 0 > +#define DMA_CPU_C906_0 1 > +#define DMA_CPU_C906_1 2 > + > + > +#endif // __DT_BINDINGS_DMA_CV1800_H__ > -- > 2.44.0 > > > _______________________________________________ > linux-riscv mailing list > linux-riscv@lists.infradead.org > http://lists.infradead.org/mailman/listinfo/linux-riscv _______________________________________________ linux-riscv mailing list linux-riscv@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-riscv
On Mon, Mar 18, 2024 at 11:40:34AM -0700, Drew Fustini wrote: > On Thu, Feb 08, 2024 at 09:14:11AM +0530, Sunil V L wrote: > > This series enables the support for "Collaborative Processor Performance > > Control (CPPC) on ACPI based RISC-V platforms. It depends on the > > encoding of CPPC registers as defined in RISC-V FFH spec [2]. > > > > CPPC is described in the ACPI spec [1]. RISC-V FFH spec required to > > enable this, is available at [2]. > > > > [1] - https://uefi.org/specs/ACPI/6.5/08_Processor_Configuration_and_Control.html#collaborative-processor-performance-control > > [2] - https://github.com/riscv-non-isa/riscv-acpi-ffh/releases/download/v1.0.0/riscv-ffh.pdf > > > > The series is based on the LPI support series. > > Based-on: 20240118062930.245937-1-sunilvl@ventanamicro.com > > (https://lore.kernel.org/lkml/20240118062930.245937-1-sunilvl@ventanamicro.com/) > > Should the https://github.com/vlsunil/qemu/tree/lpi_exp branch also be > used for this CPPC series too? I noticed the ventanamicro qemu repo has a dev-upstream branch [1] which contains 4bb6ba4d0fb9 ("riscv/virt: acpi: Enable CPPC - _CPC and _PSD"). I've built that but I still see 'SBI CPPC extension NOT detected!!' in the Linux boot log. I'm using upstream opensbi. It seems that sbi_cppc_probe() fails because cppc_dev is not set. Nothing in the upstream opensbi repo seems to call sbi_cppc_set_device(), so I am uncertain how it is possible for it to work. Is there an opensbi branch I should be using? Thanks, Drew [1] https://github.com/ventanamicro/qemu/tree/dev-upstream _______________________________________________ linux-riscv mailing list linux-riscv@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-riscv
On 3/18/24 16:48, Conor Dooley wrote: > On Mon, Mar 18, 2024 at 03:46:54PM -0700, Atish Patra wrote: >> On 3/15/24 01:11, Andrew Jones wrote: >>> On Wed, Mar 13, 2024 at 09:31:26AM +0800, Inochi Amaoto wrote: >>> ... >>>> IMHO, it may be better to use a new DT property like "riscv,cpu-errata" or >>>> "<vendor>,cpu-errata". It can achieve almost everything like using pseudo >>>> isa. And the only cost I think is a small amount code to parse this. >>>> >>> >>> What's the ACPI equivalent for this new DT property? If there isn't one, >>> then the cost is also to introduce something to the ACPI spec and add the >>> ACPI parsing code. >>> >>> I'd much rather we call specified behaviors "extensions", whether they >>> are vendor-specific or RVI standard, and then treat all extensions the >>> same way in hardware descriptions and Linux. It'd also be best if errata >>> in extension implementations were handled by replacing the extension in >>> the hardware description with a new name which is specifically for the >>> behavior Linux should expect. (Just because two extensions are almost the >>> same doesn't mean we should say we have one and then have some second >>> mechanism to say, "well, not really, instead of that, it's this". It's >>> cleaner to just remove the extension it doesn't properly implement from >>> its hardware description and create a name for the behavior it does have.) >>> >>> Errata in behaviors which don't have extension names (are hopefully few) >>> and are where mvendorid and friends would need to be checked, but then why >>> not create a pseudo extension name, as Conor suggests, so the rest of >>> Linux code can manage errata the same way it manages every other behavior? >>> >>> The growth rate of the ISA bitmap is worth thinking about, though, since >>> we have several copies of it (at least one "all harts" bitmap, one bitmap >>> for each hart, another one for each vcpu, and then there's nested virt...) >>> We don't have enough extensions to worry about it now, but we can >>> eventually try partitioning, using common maps for common bits, not >>> storing bits which can be inferred from other bits, etc. >> >> This is my biggest worry going forward. We already have a ever growing >> standard RVI extension list. On top of that we have genuine vendor >> extensions. IMHO, errata are bit different than extensions as there will be >> few vendor extensions in the future but many hardware erratas :) > > I dunno, I think there's going to be plenty of both. We may not see (or > use) a lot of vendor extensions in mainline Linux, but they will exist. > I hope that will happen. But I fear we will have lot of vendor extensions in mainline Linux. That is the "sad reality" I was talking about at the end of the thread. >> If we start calling every hardware errata as an pseudo ISA extensions, we >> will much bigger problem maintaining it in the future. > > I've explained to you at least once already that this is not my goal. > Where there are genuine issues with the implementation of an extension > creating a "pseudo" extension is not what I am suggesting we do. > I have no problem with with the approach taken for the SiFive errata, > for example. > Thanks for clarifying. But we have to define the rules what gets in as pseudo extension very clearly to avoid any kind of abuse in the future. >> We discussed this earlier during the Andes PMU extension series[1] as well. >> We have three types of extensions in discussions now. >> >> 1. standard RVI extensions >> 2. Vendor extensions >> a. Genuine vendor extension >> b. Vendor erratas which can be described as pseudo-extensions now > >> Keeping all these within a single ISA bitmap space seems very odd to me. >> I think the feasible approach would be to partition the standard and vendor >> ISA extension space as you suggested. > > Let's be clear - partitioning the space is unrelated to the detection > method. We can go ahead and partition the space and use "pseudo" > extensions or we can have a unified space but use archid/impid for > detection. Having a unified space is the simpler thing to implement > right now, but it totally does not stop us breaking them out in the > future. We could even gate these custom implementations behind config > options if bloat is a concern - but multiplatform kernels are likely to > enable all the options anyway. > Agreed. >> For 2.b, either we can start defining pseudo extensions or adding >> vendor/arch/impid checks. >> >> @Conor: You seems to prefer the earlier approach instead of adding the >> checks. Care to elaborate why do you think that's a better method compared >> to a simple check ? > > Because I don't think that describing these as "errata" in the first > place is even accurate. This is not a case of a vendor claiming they > have Sscofpmf support but the implementation is flawed. As far as I > understand, this is a vendor creating a useful feature prior to the > creation of a standard extension. > A bit of a test for this could be "If the standard extension never > existed, would this be considered a new feature or an implementation > issue". I think this is pretty clearly in the former camp. > So we have 3 cases. 1. Pseudo extension: An vendor extension designed and/or implemented before the standard RVI extension was ratified but do not violate any standard encoding space. 2. Erratas: An genuine bug/design issue in the expected behavior from a standard RVI extension (including violating standard encoding space) 3. Vendor extension: A new or a variant of standard RVI extension which is different enough from standard extension. IMO, the line between #2 and #1 may get blurry as we going forward because of the sheer number of small extensions RVI is comping up with (which is a problem as well). Just to clarify: I am not too worried about this particular case as we know that T-head's implementation predates the Sscofpmf extension. But once we define a standard mechanism for this kind of situation, vendor may start to abuse it. > I do not think we should be using m*id detection implementations of a > feature prior to creation of a standard extension for the same purpose. > To me the main difference between a case like this and VentanaCondOps/Zicond > is that we are the ones calling this an extension (hence my use of pseudo) > and not the vendor of the IP. If T-Head were to publish a document tomorrow > on the T-Head github repo for official vendor extensions, that difference > would not even exist any longer. > Exactly! If vendor publishes these as an extension or an errata, that's a binding agreement to call it in a specific way. > I also do not believe that it is a "simple" check. The number of > implementations that could end up using this PMU could just balloon > if T-Head has no intention of switching to Sscofpmf. If they don't > balloon in this case, there's nothing stopping them ballooning in a Ideally, they shouldn't as it a simple case of CSR number & IRQ number. If they care to implement AIA, then they must change it to standard sscofpmf as the current IRQ violates the AIA spec. But who knows if they care to implement AIA or not. > similar case in the future. We should let the platform firmware tell > explicitly, be that via DT or ACPI, what features are supported rather > than try to reverse engineer it ourselves via m*id. > Fair enough. > That leads into another general issue I have with using m*id detection, > which I think I have mentioned several times on the list - it prevents the > platform (hypervisor, emulator or firmware) from disabling that feature. > If that is the only concern, platform can just disable the actual extension(i.e. sscofpmf in this case) to disable that feature for that particular vendor. > If I had a time machine back to when the T-Head perf or cmo stuff was > submitted, I was try to avoid any of it being merged with the m*id > detection method. > >> I agree that don't have the crystal ball and may be proven wrong in the >> future (I will be definitely happy about that!). But given the diversity of >> RISC-V ecosystem, I feel that may be our sad reality. > > I don't understand what this comment is referring to, it lacks context > as to what the sad reality actually is. > > I hope that all made sense and explained why I am against this method > for detecting what I believe to be features rather than errata, > Conor. > Yes.Thanks again for the clarification. Again, I am not opposed to the idea. I just wanted to understand if this is the best option we have right now. > > _______________________________________________ > linux-riscv mailing list > linux-riscv@lists.infradead.org > http://lists.infradead.org/mailman/listinfo/linux-riscv _______________________________________________ linux-riscv mailing list linux-riscv@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-riscv
[-- Attachment #1.1: Type: text/plain, Size: 6660 bytes --] On Mon, Mar 18, 2024 at 03:46:54PM -0700, Atish Patra wrote: > On 3/15/24 01:11, Andrew Jones wrote: > > On Wed, Mar 13, 2024 at 09:31:26AM +0800, Inochi Amaoto wrote: > > ... > > > IMHO, it may be better to use a new DT property like "riscv,cpu-errata" or > > > "<vendor>,cpu-errata". It can achieve almost everything like using pseudo > > > isa. And the only cost I think is a small amount code to parse this. > > > > > > > What's the ACPI equivalent for this new DT property? If there isn't one, > > then the cost is also to introduce something to the ACPI spec and add the > > ACPI parsing code. > > > > I'd much rather we call specified behaviors "extensions", whether they > > are vendor-specific or RVI standard, and then treat all extensions the > > same way in hardware descriptions and Linux. It'd also be best if errata > > in extension implementations were handled by replacing the extension in > > the hardware description with a new name which is specifically for the > > behavior Linux should expect. (Just because two extensions are almost the > > same doesn't mean we should say we have one and then have some second > > mechanism to say, "well, not really, instead of that, it's this". It's > > cleaner to just remove the extension it doesn't properly implement from > > its hardware description and create a name for the behavior it does have.) > > > > Errata in behaviors which don't have extension names (are hopefully few) > > and are where mvendorid and friends would need to be checked, but then why > > not create a pseudo extension name, as Conor suggests, so the rest of > > Linux code can manage errata the same way it manages every other behavior? > > > > The growth rate of the ISA bitmap is worth thinking about, though, since > > we have several copies of it (at least one "all harts" bitmap, one bitmap > > for each hart, another one for each vcpu, and then there's nested virt...) > > We don't have enough extensions to worry about it now, but we can > > eventually try partitioning, using common maps for common bits, not > > storing bits which can be inferred from other bits, etc. > > This is my biggest worry going forward. We already have a ever growing > standard RVI extension list. On top of that we have genuine vendor > extensions. IMHO, errata are bit different than extensions as there will be > few vendor extensions in the future but many hardware erratas :) I dunno, I think there's going to be plenty of both. We may not see (or use) a lot of vendor extensions in mainline Linux, but they will exist. > If we start calling every hardware errata as an pseudo ISA extensions, we > will much bigger problem maintaining it in the future. I've explained to you at least once already that this is not my goal. Where there are genuine issues with the implementation of an extension creating a "pseudo" extension is not what I am suggesting we do. I have no problem with with the approach taken for the SiFive errata, for example. > We discussed this earlier during the Andes PMU extension series[1] as well. > We have three types of extensions in discussions now. > > 1. standard RVI extensions > 2. Vendor extensions > a. Genuine vendor extension > b. Vendor erratas which can be described as pseudo-extensions now > Keeping all these within a single ISA bitmap space seems very odd to me. > I think the feasible approach would be to partition the standard and vendor > ISA extension space as you suggested. Let's be clear - partitioning the space is unrelated to the detection method. We can go ahead and partition the space and use "pseudo" extensions or we can have a unified space but use archid/impid for detection. Having a unified space is the simpler thing to implement right now, but it totally does not stop us breaking them out in the future. We could even gate these custom implementations behind config options if bloat is a concern - but multiplatform kernels are likely to enable all the options anyway. > For 2.b, either we can start defining pseudo extensions or adding > vendor/arch/impid checks. > > @Conor: You seems to prefer the earlier approach instead of adding the > checks. Care to elaborate why do you think that's a better method compared > to a simple check ? Because I don't think that describing these as "errata" in the first place is even accurate. This is not a case of a vendor claiming they have Sscofpmf support but the implementation is flawed. As far as I understand, this is a vendor creating a useful feature prior to the creation of a standard extension. A bit of a test for this could be "If the standard extension never existed, would this be considered a new feature or an implementation issue". I think this is pretty clearly in the former camp. I do not think we should be using m*id detection implementations of a feature prior to creation of a standard extension for the same purpose. To me the main difference between a case like this and VentanaCondOps/Zicond is that we are the ones calling this an extension (hence my use of pseudo) and not the vendor of the IP. If T-Head were to publish a document tomorrow on the T-Head github repo for official vendor extensions, that difference would not even exist any longer. I also do not believe that it is a "simple" check. The number of implementations that could end up using this PMU could just balloon if T-Head has no intention of switching to Sscofpmf. If they don't balloon in this case, there's nothing stopping them ballooning in a similar case in the future. We should let the platform firmware tell us explicitly, be that via DT or ACPI, what features are supported rather than try to reverse engineer it ourselves via m*id. That leads into another general issue I have with using m*id detection, which I think I have mentioned several times on the list - it prevents the platform (hypervisor, emulator or firmware) from disabling that feature. If I had a time machine back to when the T-Head perf or cmo stuff was submitted, I was try to avoid any of it being merged with the m*id detection method. > I agree that don't have the crystal ball and may be proven wrong in the > future (I will be definitely happy about that!). But given the diversity of > RISC-V ecosystem, I feel that may be our sad reality. I don't understand what this comment is referring to, it lacks context as to what the sad reality actually is. I hope that all made sense and explained why I am against this method for detecting what I believe to be features rather than errata, Conor. [-- Attachment #1.2: signature.asc --] [-- Type: application/pgp-signature, Size: 228 bytes --] [-- Attachment #2: Type: text/plain, Size: 161 bytes --] _______________________________________________ linux-riscv mailing list linux-riscv@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-riscv
On 3/15/24 01:11, Andrew Jones wrote: > On Wed, Mar 13, 2024 at 09:31:26AM +0800, Inochi Amaoto wrote: > ... >> IMHO, it may be better to use a new DT property like "riscv,cpu-errata" or >> "<vendor>,cpu-errata". It can achieve almost everything like using pseudo >> isa. And the only cost I think is a small amount code to parse this. >> > > What's the ACPI equivalent for this new DT property? If there isn't one, > then the cost is also to introduce something to the ACPI spec and add the > ACPI parsing code. > > I'd much rather we call specified behaviors "extensions", whether they > are vendor-specific or RVI standard, and then treat all extensions the > same way in hardware descriptions and Linux. It'd also be best if errata > in extension implementations were handled by replacing the extension in > the hardware description with a new name which is specifically for the > behavior Linux should expect. (Just because two extensions are almost the > same doesn't mean we should say we have one and then have some second > mechanism to say, "well, not really, instead of that, it's this". It's > cleaner to just remove the extension it doesn't properly implement from > its hardware description and create a name for the behavior it does have.) > > Errata in behaviors which don't have extension names (are hopefully few) > and are where mvendorid and friends would need to be checked, but then why > not create a pseudo extension name, as Conor suggests, so the rest of > Linux code can manage errata the same way it manages every other behavior? > > The growth rate of the ISA bitmap is worth thinking about, though, since > we have several copies of it (at least one "all harts" bitmap, one bitmap > for each hart, another one for each vcpu, and then there's nested virt...) > We don't have enough extensions to worry about it now, but we can > eventually try partitioning, using common maps for common bits, not > storing bits which can be inferred from other bits, etc. This is my biggest worry going forward. We already have a ever growing standard RVI extension list. On top of that we have genuine vendor extensions. IMHO, errata are bit different than extensions as there will be few vendor extensions in the future but many hardware erratas :) If we start calling every hardware errata as an pseudo ISA extensions, we will much bigger problem maintaining it in the future. We discussed this earlier during the Andes PMU extension series[1] as well. We have three types of extensions in discussions now. 1. standard RVI extensions 2. Vendor extensions a. Genuine vendor extension b. Vendor erratas which can be described as pseudo-extensions now Keeping all these within a single ISA bitmap space seems very odd to me. I think the feasible approach would be to partition the standard and vendor ISA extension space as you suggested. For 2.b, either we can start defining pseudo extensions or adding vendor/arch/impid checks. @Conor: You seems to prefer the earlier approach instead of adding the checks. Care to elaborate why do you think that's a better method compared to a simple check ? I agree that don't have the crystal ball and may be proven wrong in the future (I will be definitely happy about that!). But given the diversity of RISC-V ecosystem, I feel that may be our sad reality. [1] https://lore.kernel.org/linux-riscv/20240110073917.2398826-8-peterlin@andestech.com/ > > Thanks, > drew > > _______________________________________________ > linux-riscv mailing list > linux-riscv@lists.infradead.org > http://lists.infradead.org/mailman/listinfo/linux-riscv _______________________________________________ linux-riscv mailing list linux-riscv@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-riscv
On Mon, Mar 18, 2024 at 09:06:19AM +0100, Krzysztof Kozlowski wrote: > On 18/03/2024 07:38, Inochi Amaoto wrote: > > Add dma multiplexer support for the Sophgo CV1800/SG2000 SoCs. > > > > The patch include the following patch: > > http://lore.kernel.org/linux-riscv/PH7PR20MB4962F822A64CB127911978AABB4E2@PH7PR20MB4962.namprd20.prod.outlook.com/ > > What does it mean? Did you include here some other commit, so when it > get applied we end up with two same commits? No, that's not how to > handle dependencies. Explain instead the dependency or combine patchsets. > > Best regards, > Krzysztof > Hi Krzysztof, It seems that I missed an important point: Is it suitable to add an initital binding for the syscon, and add the dma-router property in this patch? If so, the dependency can be resolved and I will maintain the syscon change in the orignal patchset. Regards, Inochi _______________________________________________ linux-riscv mailing list linux-riscv@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-riscv
On 3/12/24 21:29, 雷博涵 wrote: > Sorry for the duplicated message. The last one was an HTML e-mail so I resend this. > >> 2024年3月13日 08:02,Atish Patra <atishp@atishpatra.org> 写道: >> >> On Tue, Feb 27, 2024 at 7:49 PM 雷博涵 <garthlei@pku.edu.cn> wrote: >>> >>> Hi all, >>> >>> I am having problems with the RISC-V PMU driver. The overflow handler of my custom perf event kernel counter seems to read an incorrect value from the event. >> >> If I understand you correctly, you have a custom kernel counter for >> the perf event ? Can you explain the use case for that ? > > Actually it was the perf-event backend of an open-source tool called PMCTrack (https://github.com/jcsaezal/pmctrack), which I was trying to port to RISC-V. It creates a kernel counter using `perf_event_create_kernel_counter`, registering an overflow handler. The registered overflow handler calls `perf_event_read_value` to read the counter value. > Thanks. It makes sense now. >> >>> It seems that the issue lies in the function `riscv_pmu_event_set_period`, which sets `prev_count` to a new value but does not modify the underlying hardware counter. When `perf_event_read_value` gets called later in the user-defined overflow handler, `riscv_pmu_event_update` will update the `count` field again based on the unmodified hardware counter value and the modified `prev_count` field, which causes an incorrect reading. >> >> What do you mean by user defined overflow handler ? The overflow >> handler registered via the custom perf event kernel counter which gets >> invoked from perf_event_overflow ? > > Yes. > >> >>> I noticed that other PMU drivers, such as the ARM one, write to the underlying counter in their set_period functions, which prevents the problem. However, the RISC-V SBI specification does not have such an API to write to a counter without starting it. Using `local64_read(&hw_evt->period_left) <= 0` directly as the guard condition to place `riscv_pmu_event_set_period(event)` after it seems to work, but I am not sure whether it can cause other issues. >> >> Not sure the exact code path you are referring to. You don't want to >> invoke riscv_pmu_event_set_period if period_left <= 0 ? > > First, `pmu_sbi_ovf_handler` calls `riscv_pmu_event_update`, so the perf event counter value (`event->count`) is updated. It calls `riscv_pmu_event_set_period` later, which calls `local64_set(&hwc->prev_count, (u64)-left)`. When `perf_event_read_value` gets invoked in the registered overflow handler, `riscv_pmu_event_update` will be invoked eventually. Because `prev_count` has been set to `(u64)-left` and the underlying hardware counter value (the value read via `rvpmu->ctr_read(event)`) has not been changed, `event->count` will be updated again, and the value this time will be incorrect. Got it. This is a genuine issue. I can reproduce it as well with kvm pmu support as it creates a kernel perf event as well. > > I have found that the ARM PMU does not have the problem. The function `armpmu_event_set_period` in `arm_pmu.c` calls `armpmu->write_counter(event, (u64)(-left) & max_period)` after `local64_set(&hwc->prev_count, (u64)-left)`, so that the underlying hardware counter is also set to a new value. Thus, when `armpmu_event_update` gets called later in the registered handler, it will find that the underlying counter has the same value as `prev_count`, so `event->count` can keep the correct value. > > However, as I mentioned before, the RISC-V SBI specification does not have such an API as “write_counter,” so the ARM solution could not be adapted easily. I was wondering if we could postpone `riscv_pmu_event_set_period` after the if-block, like this: > > ``` > if (local64_read(&hw_evt->period_left) <= 0) { > perf_event_overflow(event, &data, regs); > } > riscv_pmu_event_set_period(event); > ``` > > This way `perf_event_read_value` can return the correct counter value. `riscv_pmu_event_set_period` gets invoked after perf_event_overflow. However, I am not sure if it can cause other problems. > That seems like a hack. I think we can avoid updating again based on perf state which can indicate that event->count is already updated. Thus, no need to update it again. I will toy around with this idea and get back to you. >> >>> >>> Thank you, >>> Bohan Lei >> >> >> -- >> Regards, >> Atish > > -- > Regards, > Bohan Lei > > _______________________________________________ > linux-riscv mailing list > linux-riscv@lists.infradead.org > http://lists.infradead.org/mailman/listinfo/linux-riscv _______________________________________________ linux-riscv mailing list linux-riscv@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-riscv
Hi, On Sat, Mar 16, 2024 at 9:51 AM Conor Dooley <conor@kernel.org> wrote: > > On Sat, Mar 16, 2024 at 04:20:03PM +0000, Conor Dooley wrote: > > On Thu, Mar 14, 2024 at 02:20:38PM +0000, Caleb Connolly wrote: > > > On 14/03/2024 12:11, Amrit Anand wrote: > > > 2. A top level board-id property that isn't namespaced implies that it > > > isn't vendor specific, but the proposed implementation doesn't even > > > pretend to be vendor agnostic. > > > > I pointed out previously that the Chromebook guys had some similar > > issues with dtb selection when the OEM varies parts but there does not > > seem to be any of them on CC here. > > That's maybe a bit harsh of me actually, I see that there's a > chrome-platform address on CC, but I don't know if that's gonna reach > the guys that work on these devices (Chen-Yu Tsai and Doug Anderson in > particular). Thanks for the CC. Yeah, I don't watch the "chrome-platform" list myself, though maybe I should... The Chromebook boot flow and how we've handled this so far is documented in the kernel [1]. This method is what we've been using (with slight modifications over the years) since the earlier ARM Chromebooks and is, I believe, supported in both the depthcharge loader (used in Chromebooks) and also in U-Boot, though it's possible (?) that the U-Boot rules might vary ever so slightly. I haven't tried using U-Boot to boot a Chromebook in years. The current way things work for Chromebooks involves a heavy amount of duplication. We bundle an entire "DTB" for every relevant board/rev/sku combination even though many of those DTBs are 99% the same as the other ones. The DTBs have been relatively small and we compress them so this hasn't been a massive deal, but it's always been on the TODO list to come up with a scheme to use DT overlays. We've also talked about bundling a device tree that has the superset of components and then using an in-kernel driver to set the status of some components to okay and there is some overlap there in the possible way to represent board variants. I think Chen-Yu is going to talk about a few of these topics next month at EOSS [2]. In terms of looking at your specific proposal, it's definitely trying to factor in a lot more things than the current one that Chromebooks use. The Chromebook model was "simple" enough that we could just leverage the compatible string, though the way we leverage it has ended up controversial over the years. Yours is definitely too complicated to work the same way. It seems like device tree overlays would be a better fit? I'm not an expert so maybe this is already solved somewhere, but I'd imagine the hard part is getting everyone to agree on how to specify stuff in the DT overlay that allows the bootloader to know whether to overlay it or not... [1] https://docs.kernel.org/arch/arm/google/chromebook-boot-flow.html [2] https://eoss24.sched.com/event/1aBGe/second-source-component-probing-on-device-tree-platforms-chen-yu-tsai-google-llc _______________________________________________ linux-riscv mailing list linux-riscv@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-riscv
Hi Alex, On 2024-03-18 3:50 PM, Alexandre Ghiti wrote: > On Wed, Mar 13, 2024 at 7:00 PM Samuel Holland > <samuel.holland@sifive.com> wrote: >> >> TASK_SIZE_MAX should be set to the largest userspace address under any >> runtime configuration. This optimizes the check in __access_ok(), which >> no longer needs to compute the current value of TASK_SIZE. It is still >> safe because addresses between TASK_SIZE and TASK_SIZE_MAX are invalid >> at the hardware level. >> >> This removes about half of the references to pgtable_l[45]_enabled. >> >> Signed-off-by: Samuel Holland <samuel.holland@sifive.com> >> --- >> >> arch/riscv/include/asm/pgtable-64.h | 1 + >> arch/riscv/include/asm/pgtable.h | 1 + >> 2 files changed, 2 insertions(+) >> >> diff --git a/arch/riscv/include/asm/pgtable-64.h b/arch/riscv/include/asm/pgtable-64.h >> index b99bd66107a6..a677ef3c0fe2 100644 >> --- a/arch/riscv/include/asm/pgtable-64.h >> +++ b/arch/riscv/include/asm/pgtable-64.h >> @@ -17,6 +17,7 @@ extern bool pgtable_l5_enabled; >> #define PGDIR_SHIFT_L4 39 >> #define PGDIR_SHIFT_L5 48 >> #define PGDIR_SIZE_L3 (_AC(1, UL) << PGDIR_SHIFT_L3) >> +#define PGDIR_SIZE_L5 (_AC(1, UL) << PGDIR_SHIFT_L5) >> >> #define PGDIR_SHIFT (pgtable_l5_enabled ? PGDIR_SHIFT_L5 : \ >> (pgtable_l4_enabled ? PGDIR_SHIFT_L4 : PGDIR_SHIFT_L3)) >> diff --git a/arch/riscv/include/asm/pgtable.h b/arch/riscv/include/asm/pgtable.h >> index 6066822e7396..2032f8ac5fc5 100644 >> --- a/arch/riscv/include/asm/pgtable.h >> +++ b/arch/riscv/include/asm/pgtable.h >> @@ -867,6 +867,7 @@ static inline pte_t pte_swp_clear_exclusive(pte_t pte) >> #ifdef CONFIG_64BIT >> #define TASK_SIZE_64 (PGDIR_SIZE * PTRS_PER_PGD / 2) >> #define TASK_SIZE_MIN (PGDIR_SIZE_L3 * PTRS_PER_PGD / 2) >> +#define TASK_SIZE_MAX (PGDIR_SIZE_L5 * PTRS_PER_PGD / 2) >> >> #ifdef CONFIG_COMPAT >> #define TASK_SIZE_32 (_AC(0x80000000, UL)) >> -- >> 2.43.1 >> > > I think you also need to change the check in handle_page_fault() by > using TASK_SIZE_MAX instead of TASK_SIZE, otherwise the fixup can't > happen (https://elixir.bootlin.com/linux/latest/source/arch/riscv/mm/fault.c#L273). It is not necessary to change that check in fault.c unless we expect to handle exceptions (outside of userspace access routines) for addresses between TASK_SIZE and TASK_SIZE_MAX. It looks like the call to fixup_exception() [added in 416721ff05fd ("riscv, mm: Perform BPF exhandler fixup on page fault")] is only intended to catch null pointer dereferences. So making the change wouldn't have any functional impact, but it would still be a valid optimization. > Or I was wondering if it would not be better to do like x86 and use an > alternative, it would be more correct (even though I believe your > solution works) > https://elixir.bootlin.com/linux/latest/source/arch/x86/include/asm/page_64.h#L82. What would be the benefit of using an alternative? Any access to an address between TASK_SIZE and TASK_SIZE_MAX is guaranteed to generate a page fault, so the only benefit I see is returning -EFAULT slightly faster at the cost of applying a few hundred alternatives at boot. But it's possible I'm missing something. Regards, Samuel _______________________________________________ linux-riscv mailing list linux-riscv@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-riscv
On Fri, Mar 15, 2024 at 09:48:09PM +0100, Thomas Weißschuh wrote: > Adapt the proc_hander function signature to make it clear that handlers > are not supposed to modify their ctl_table argument. > > This is a prerequisite to moving the static ctl_table structs into > .rodata. > By migrating all handlers at once a lengthy transition can be avoided. > > The patch was mostly generated by coccinelle with the following script: > > @@ > identifier func, ctl, write, buffer, lenp, ppos; > @@ > > int func( > - struct ctl_table *ctl, > + const struct ctl_table *ctl, > int write, void *buffer, size_t *lenp, loff_t *ppos) > { ... } Which seems to have screwed up the formatting of the XFS code... > diff --git a/fs/xfs/xfs_sysctl.c b/fs/xfs/xfs_sysctl.c > index a191f6560f98..a3ca192eca79 100644 > --- a/fs/xfs/xfs_sysctl.c > +++ b/fs/xfs/xfs_sysctl.c > @@ -10,12 +10,11 @@ static struct ctl_table_header *xfs_table_header; > > #ifdef CONFIG_PROC_FS > STATIC int > -xfs_stats_clear_proc_handler( > - struct ctl_table *ctl, > - int write, > - void *buffer, > - size_t *lenp, > - loff_t *ppos) > +xfs_stats_clear_proc_handler(const struct ctl_table *ctl, > + int write, > + void *buffer, > + size_t *lenp, > + loff_t *ppos) ... because this doesn't match any format I've ever seen in the kernel. The diff for this change shold be just: @@ -10,7 +10,7 @@ static struct ctl_table_header *xfs_table_header; #ifdef CONFIG_PROC_FS STATIC int xfs_stats_clear_proc_handler( - struct ctl_table *ctl, + const struct ctl_table *ctl, int write, void *buffer, size_t *lenp, > { > int ret, *valp = ctl->data; > > @@ -30,12 +29,11 @@ xfs_stats_clear_proc_handler( > } > > STATIC int > -xfs_panic_mask_proc_handler( > - struct ctl_table *ctl, > - int write, > - void *buffer, > - size_t *lenp, > - loff_t *ppos) > +xfs_panic_mask_proc_handler(const struct ctl_table *ctl, > + int write, > + void *buffer, > + size_t *lenp, > + loff_t *ppos) > { > int ret, *valp = ctl->data; > > @@ -51,12 +49,11 @@ xfs_panic_mask_proc_handler( > #endif /* CONFIG_PROC_FS */ > > STATIC int > -xfs_deprecated_dointvec_minmax( > - struct ctl_table *ctl, > - int write, > - void *buffer, > - size_t *lenp, > - loff_t *ppos) > +xfs_deprecated_dointvec_minmax(const struct ctl_table *ctl, > + int write, > + void *buffer, > + size_t *lenp, > + loff_t *ppos) > { > if (write) { > printk_ratelimited(KERN_WARNING And these need fixing as well. A further quick glance at the patch reveals that there are other similar screwed up conversions as well. > diff --git a/kernel/delayacct.c b/kernel/delayacct.c > index 6f0c358e73d8..513791ef573d 100644 > --- a/kernel/delayacct.c > +++ b/kernel/delayacct.c > @@ -44,8 +44,9 @@ void delayacct_init(void) > } > > #ifdef CONFIG_PROC_SYSCTL > -static int sysctl_delayacct(struct ctl_table *table, int write, void *buffer, > - size_t *lenp, loff_t *ppos) > +static int sysctl_delayacct(const struct ctl_table *table, int write, > + void *buffer, > + size_t *lenp, loff_t *ppos) > { > int state = delayacct_on; > struct ctl_table t; Like this. > diff --git a/kernel/events/core.c b/kernel/events/core.c > index 724e6d7e128f..e2955e0d9f44 100644 > --- a/kernel/events/core.c > +++ b/kernel/events/core.c > @@ -450,7 +450,8 @@ static void update_perf_cpu_limits(void) > > static bool perf_rotate_context(struct perf_cpu_pmu_context *cpc); > > -int perf_event_max_sample_rate_handler(struct ctl_table *table, int write, > +int perf_event_max_sample_rate_handler(const struct ctl_table *table, > + int write, > void *buffer, size_t *lenp, loff_t *ppos) > { > int ret; And this. > @@ -474,8 +475,10 @@ int perf_event_max_sample_rate_handler(struct ctl_table *table, int write, > > int sysctl_perf_cpu_time_max_percent __read_mostly = DEFAULT_CPU_TIME_MAX_PERCENT; > > -int perf_cpu_time_max_percent_handler(struct ctl_table *table, int write, > - void *buffer, size_t *lenp, loff_t *ppos) > +int perf_cpu_time_max_percent_handler(const struct ctl_table *table, > + int write, > + void *buffer, size_t *lenp, > + loff_t *ppos) > { > int ret = proc_dointvec_minmax(table, write, buffer, lenp, ppos); > And this. > diff --git a/kernel/hung_task.c b/kernel/hung_task.c > index b2fc2727d654..003f0f5cb111 100644 > --- a/kernel/hung_task.c > +++ b/kernel/hung_task.c > @@ -239,9 +239,10 @@ static long hung_timeout_jiffies(unsigned long last_checked, > /* > * Process updating of timeout sysctl > */ > -static int proc_dohung_task_timeout_secs(struct ctl_table *table, int write, > - void *buffer, > - size_t *lenp, loff_t *ppos) > +static int proc_dohung_task_timeout_secs(const struct ctl_table *table, > + int write, > + void *buffer, > + size_t *lenp, loff_t *ppos) > { > int ret; > And this. > diff --git a/kernel/latencytop.c b/kernel/latencytop.c > index 781249098cb6..0a5c22b19821 100644 > --- a/kernel/latencytop.c > +++ b/kernel/latencytop.c > @@ -65,8 +65,9 @@ static struct latency_record latency_record[MAXLR]; > int latencytop_enabled; > > #ifdef CONFIG_SYSCTL > -static int sysctl_latencytop(struct ctl_table *table, int write, void *buffer, > - size_t *lenp, loff_t *ppos) > +static int sysctl_latencytop(const struct ctl_table *table, int write, > + void *buffer, > + size_t *lenp, loff_t *ppos) > { > int err; > And this. I could go on, but there are so many examples of this in the patch that I think that it needs to be toosed away and regenerated in a way that doesn't trash the existing function parameter formatting. -Dave. -- Dave Chinner david@fromorbit.com _______________________________________________ linux-riscv mailing list linux-riscv@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-riscv
In a future commit the proc_handlers themselves will change to "const struct ctl_table". As a preparation for that adapt the internal helpers. Signed-off-by: Thomas Weißschuh <linux@weissschuh.net> --- net/netfilter/ipvs/ip_vs_ctl.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/net/netfilter/ipvs/ip_vs_ctl.c b/net/netfilter/ipvs/ip_vs_ctl.c index 143a341bbc0a..689ac521ea2d 100644 --- a/net/netfilter/ipvs/ip_vs_ctl.c +++ b/net/netfilter/ipvs/ip_vs_ctl.c @@ -1924,7 +1924,8 @@ proc_do_sync_ports(struct ctl_table *table, int write, return rc; } -static int ipvs_proc_est_cpumask_set(struct ctl_table *table, void *buffer) +static int ipvs_proc_est_cpumask_set(const struct ctl_table *table, + void *buffer) { struct netns_ipvs *ipvs = table->extra2; cpumask_var_t *valp = table->data; @@ -1962,8 +1963,8 @@ static int ipvs_proc_est_cpumask_set(struct ctl_table *table, void *buffer) return ret; } -static int ipvs_proc_est_cpumask_get(struct ctl_table *table, void *buffer, - size_t size) +static int ipvs_proc_est_cpumask_get(const struct ctl_table *table, + void *buffer, size_t size) { struct netns_ipvs *ipvs = table->extra2; cpumask_var_t *valp = table->data; -- 2.44.0 _______________________________________________ linux-riscv mailing list linux-riscv@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-riscv
Adapt the proc_hander function signature to make it clear that handlers are not supposed to modify their ctl_table argument. This is a prerequisite to moving the static ctl_table structs into .rodata. By migrating all handlers at once a lengthy transition can be avoided. The patch was mostly generated by coccinelle with the following script: @@ identifier func, ctl, write, buffer, lenp, ppos; @@ int func( - struct ctl_table *ctl, + const struct ctl_table *ctl, int write, void *buffer, size_t *lenp, loff_t *ppos) { ... } In addition to the scripted changes some other changes are done: * the typedef proc_handler is adapted * the prototypes of non-static handler are adapted * kernel/seccomp.c:{read,write}_actions_logged() and kernel/watchdog.c:proc_watchdog_common() are adapted as they need to adapted together with the handlers for type-consistency reasons Signed-off-by: Thomas Weißschuh <linux@weissschuh.net> --- arch/arm64/kernel/armv8_deprecated.c | 2 +- arch/arm64/kernel/fpsimd.c | 2 +- arch/s390/appldata/appldata_base.c | 10 ++-- arch/s390/kernel/debug.c | 2 +- arch/s390/kernel/topology.c | 2 +- arch/s390/mm/cmm.c | 6 +-- arch/x86/kernel/itmt.c | 2 +- drivers/cdrom/cdrom.c | 6 +-- drivers/char/random.c | 5 +- drivers/macintosh/mac_hid.c | 2 +- drivers/net/vrf.c | 2 +- drivers/parport/procfs.c | 14 ++--- drivers/perf/arm_pmuv3.c | 6 ++- drivers/perf/riscv_pmu_sbi.c | 2 +- fs/coredump.c | 4 +- fs/dcache.c | 3 +- fs/drop_caches.c | 4 +- fs/exec.c | 6 ++- fs/file_table.c | 3 +- fs/fs-writeback.c | 2 +- fs/inode.c | 3 +- fs/pipe.c | 2 +- fs/quota/dquot.c | 4 +- fs/xfs/xfs_sysctl.c | 33 ++++++------ include/linux/ftrace.h | 4 +- include/linux/mm.h | 8 +-- include/linux/perf_event.h | 6 +-- include/linux/security.h | 2 +- include/linux/sysctl.h | 34 ++++++------ include/linux/vmstat.h | 6 +-- include/linux/writeback.h | 2 +- include/net/ndisc.h | 2 +- include/net/neighbour.h | 6 +-- include/net/netfilter/nf_hooks_lwtunnel.h | 2 +- ipc/ipc_sysctl.c | 14 ++--- kernel/bpf/syscall.c | 4 +- kernel/delayacct.c | 5 +- kernel/events/callchain.c | 2 +- kernel/events/core.c | 9 ++-- kernel/fork.c | 2 +- kernel/hung_task.c | 7 +-- kernel/kexec_core.c | 2 +- kernel/kprobes.c | 2 +- kernel/latencytop.c | 5 +- kernel/pid_namespace.c | 4 +- kernel/pid_sysctl.h | 2 +- kernel/printk/internal.h | 2 +- kernel/printk/printk.c | 2 +- kernel/printk/sysctl.c | 6 ++- kernel/sched/core.c | 15 +++--- kernel/sched/rt.c | 20 ++++--- kernel/sched/topology.c | 6 ++- kernel/seccomp.c | 7 +-- kernel/stackleak.c | 5 +- kernel/sysctl.c | 88 ++++++++++++++++--------------- kernel/time/timer.c | 4 +- kernel/trace/ftrace.c | 2 +- kernel/trace/trace.c | 2 +- kernel/trace/trace_events_user.c | 3 +- kernel/trace/trace_stack.c | 2 +- kernel/umh.c | 4 +- kernel/utsname_sysctl.c | 4 +- kernel/watchdog.c | 15 +++--- mm/compaction.c | 17 +++--- mm/hugetlb.c | 16 +++--- mm/page-writeback.c | 27 ++++++---- mm/page_alloc.c | 43 ++++++++++----- mm/util.c | 15 +++--- mm/vmstat.c | 6 +-- net/bridge/br_netfilter_hooks.c | 2 +- net/core/neighbour.c | 24 +++++---- net/core/sysctl_net_core.c | 24 +++++---- net/ipv4/devinet.c | 6 +-- net/ipv4/route.c | 4 +- net/ipv4/sysctl_net_ipv4.c | 34 ++++++------ net/ipv6/addrconf.c | 30 ++++++----- net/ipv6/ndisc.c | 5 +- net/ipv6/route.c | 4 +- net/ipv6/sysctl_net_ipv6.c | 6 ++- net/mpls/af_mpls.c | 4 +- net/netfilter/ipvs/ip_vs_ctl.c | 12 ++--- net/netfilter/nf_conntrack_standalone.c | 2 +- net/netfilter/nf_hooks_lwtunnel.c | 2 +- net/netfilter/nf_log.c | 4 +- net/phonet/sysctl.c | 2 +- net/rds/tcp.c | 4 +- net/sctp/sysctl.c | 30 ++++++----- net/sunrpc/sysctl.c | 5 +- net/sunrpc/xprtrdma/svc_rdma.c | 2 +- security/apparmor/lsm.c | 2 +- security/min_addr.c | 2 +- security/yama/yama_lsm.c | 2 +- 92 files changed, 433 insertions(+), 347 deletions(-) diff --git a/arch/arm64/kernel/armv8_deprecated.c b/arch/arm64/kernel/armv8_deprecated.c index dd6ce86d4332..a3085cb68852 100644 --- a/arch/arm64/kernel/armv8_deprecated.c +++ b/arch/arm64/kernel/armv8_deprecated.c @@ -504,7 +504,7 @@ static int update_insn_emulation_mode(struct insn_emulation *insn, return ret; } -static int emulation_proc_handler(struct ctl_table *table, int write, +static int emulation_proc_handler(const struct ctl_table *table, int write, void *buffer, size_t *lenp, loff_t *ppos) { diff --git a/arch/arm64/kernel/fpsimd.c b/arch/arm64/kernel/fpsimd.c index ebb0158997ca..98efb587ef36 100644 --- a/arch/arm64/kernel/fpsimd.c +++ b/arch/arm64/kernel/fpsimd.c @@ -535,7 +535,7 @@ static unsigned int find_supported_vector_length(enum vec_type type, #if defined(CONFIG_ARM64_SVE) && defined(CONFIG_SYSCTL) -static int vec_proc_do_default_vl(struct ctl_table *table, int write, +static int vec_proc_do_default_vl(const struct ctl_table *table, int write, void *buffer, size_t *lenp, loff_t *ppos) { struct vl_info *info = table->extra1; diff --git a/arch/s390/appldata/appldata_base.c b/arch/s390/appldata/appldata_base.c index c2978cb03b36..91a30e017d65 100644 --- a/arch/s390/appldata/appldata_base.c +++ b/arch/s390/appldata/appldata_base.c @@ -46,9 +46,9 @@ * /proc entries (sysctl) */ static const char appldata_proc_name[APPLDATA_PROC_NAME_LENGTH] = "appldata"; -static int appldata_timer_handler(struct ctl_table *ctl, int write, +static int appldata_timer_handler(const struct ctl_table *ctl, int write, void *buffer, size_t *lenp, loff_t *ppos); -static int appldata_interval_handler(struct ctl_table *ctl, int write, +static int appldata_interval_handler(const struct ctl_table *ctl, int write, void *buffer, size_t *lenp, loff_t *ppos); static struct ctl_table_header *appldata_sysctl_header; @@ -199,7 +199,7 @@ static void __appldata_vtimer_setup(int cmd) * Start/Stop timer, show status of timer (0 = not active, 1 = active) */ static int -appldata_timer_handler(struct ctl_table *ctl, int write, +appldata_timer_handler(const struct ctl_table *ctl, int write, void *buffer, size_t *lenp, loff_t *ppos) { int timer_active = appldata_timer_active; @@ -232,7 +232,7 @@ appldata_timer_handler(struct ctl_table *ctl, int write, * current timer interval. */ static int -appldata_interval_handler(struct ctl_table *ctl, int write, +appldata_interval_handler(const struct ctl_table *ctl, int write, void *buffer, size_t *lenp, loff_t *ppos) { int interval = appldata_interval; @@ -262,7 +262,7 @@ appldata_interval_handler(struct ctl_table *ctl, int write, * monitoring (0 = not in process, 1 = in process) */ static int -appldata_generic_handler(struct ctl_table *ctl, int write, +appldata_generic_handler(const struct ctl_table *ctl, int write, void *buffer, size_t *lenp, loff_t *ppos) { struct appldata_ops *ops = NULL, *tmp_ops; diff --git a/arch/s390/kernel/debug.c b/arch/s390/kernel/debug.c index 85328a0ef3b6..bce50ca75ea7 100644 --- a/arch/s390/kernel/debug.c +++ b/arch/s390/kernel/debug.c @@ -954,7 +954,7 @@ static int debug_active = 1; * always allow read, allow write only if debug_stoppable is set or * if debug_active is already off */ -static int s390dbf_procactive(struct ctl_table *table, int write, +static int s390dbf_procactive(const struct ctl_table *table, int write, void *buffer, size_t *lenp, loff_t *ppos) { if (!write || debug_stoppable || !debug_active) diff --git a/arch/s390/kernel/topology.c b/arch/s390/kernel/topology.c index 89e91b8ce842..1df3dc118696 100644 --- a/arch/s390/kernel/topology.c +++ b/arch/s390/kernel/topology.c @@ -600,7 +600,7 @@ static int __init topology_setup(char *str) } early_param("topology", topology_setup); -static int topology_ctl_handler(struct ctl_table *ctl, int write, +static int topology_ctl_handler(const struct ctl_table *ctl, int write, void *buffer, size_t *lenp, loff_t *ppos) { int enabled = topology_is_enabled(); diff --git a/arch/s390/mm/cmm.c b/arch/s390/mm/cmm.c index f8b13f247646..1d6749e095f7 100644 --- a/arch/s390/mm/cmm.c +++ b/arch/s390/mm/cmm.c @@ -243,7 +243,7 @@ static int cmm_skip_blanks(char *cp, char **endp) return str != cp; } -static int cmm_pages_handler(struct ctl_table *ctl, int write, +static int cmm_pages_handler(const struct ctl_table *ctl, int write, void *buffer, size_t *lenp, loff_t *ppos) { long nr = cmm_get_pages(); @@ -262,7 +262,7 @@ static int cmm_pages_handler(struct ctl_table *ctl, int write, return 0; } -static int cmm_timed_pages_handler(struct ctl_table *ctl, int write, +static int cmm_timed_pages_handler(const struct ctl_table *ctl, int write, void *buffer, size_t *lenp, loff_t *ppos) { @@ -282,7 +282,7 @@ static int cmm_timed_pages_handler(struct ctl_table *ctl, int write, return 0; } -static int cmm_timeout_handler(struct ctl_table *ctl, int write, +static int cmm_timeout_handler(const struct ctl_table *ctl, int write, void *buffer, size_t *lenp, loff_t *ppos) { char buf[64], *p; diff --git a/arch/x86/kernel/itmt.c b/arch/x86/kernel/itmt.c index 9a7c03d47861..51b805c727fc 100644 --- a/arch/x86/kernel/itmt.c +++ b/arch/x86/kernel/itmt.c @@ -38,7 +38,7 @@ static bool __read_mostly sched_itmt_capable; */ unsigned int __read_mostly sysctl_sched_itmt_enabled; -static int sched_itmt_update_handler(struct ctl_table *table, int write, +static int sched_itmt_update_handler(const struct ctl_table *table, int write, void *buffer, size_t *lenp, loff_t *ppos) { unsigned int old_sysctl; diff --git a/drivers/cdrom/cdrom.c b/drivers/cdrom/cdrom.c index a5e07270e0d4..2d5e4adcfc1f 100644 --- a/drivers/cdrom/cdrom.c +++ b/drivers/cdrom/cdrom.c @@ -3473,8 +3473,8 @@ static int cdrom_print_info(const char *header, int val, char *info, return 0; } -static int cdrom_sysctl_info(struct ctl_table *ctl, int write, - void *buffer, size_t *lenp, loff_t *ppos) +static int cdrom_sysctl_info(const struct ctl_table *ctl, int write, + void *buffer, size_t *lenp, loff_t *ppos) { int pos; char *info = cdrom_sysctl_settings.info; @@ -3586,7 +3586,7 @@ static void cdrom_update_settings(void) mutex_unlock(&cdrom_mutex); } -static int cdrom_sysctl_handler(struct ctl_table *ctl, int write, +static int cdrom_sysctl_handler(const struct ctl_table *ctl, int write, void *buffer, size_t *lenp, loff_t *ppos) { int ret; diff --git a/drivers/char/random.c b/drivers/char/random.c index 456be28ba67c..055ed0aa1de8 100644 --- a/drivers/char/random.c +++ b/drivers/char/random.c @@ -1604,7 +1604,7 @@ static u8 sysctl_bootid[UUID_SIZE]; * UUID. The difference is in whether table->data is NULL; if it is, * then a new UUID is generated and returned to the user. */ -static int proc_do_uuid(struct ctl_table *table, int write, void *buf, +static int proc_do_uuid(const struct ctl_table *table, int write, void *buf, size_t *lenp, loff_t *ppos) { u8 tmp_uuid[UUID_SIZE], *uuid; @@ -1635,7 +1635,8 @@ static int proc_do_uuid(struct ctl_table *table, int write, void *buf, } /* The same as proc_dointvec, but writes don't change anything. */ -static int proc_do_rointvec(struct ctl_table *table, int write, void *buf, +static int proc_do_rointvec(const struct ctl_table *table, int write, + void *buf, size_t *lenp, loff_t *ppos) { return write ? 0 : proc_dointvec(table, 0, buf, lenp, ppos); diff --git a/drivers/macintosh/mac_hid.c b/drivers/macintosh/mac_hid.c index 1ae3539beff5..891047c8a110 100644 --- a/drivers/macintosh/mac_hid.c +++ b/drivers/macintosh/mac_hid.c @@ -182,7 +182,7 @@ static void mac_hid_stop_emulation(void) mac_hid_destroy_emumouse(); } -static int mac_hid_toggle_emumouse(struct ctl_table *table, int write, +static int mac_hid_toggle_emumouse(const struct ctl_table *table, int write, void *buffer, size_t *lenp, loff_t *ppos) { int *valp = table->data; diff --git a/drivers/net/vrf.c b/drivers/net/vrf.c index bb95ce43cd97..5d4283c2c022 100644 --- a/drivers/net/vrf.c +++ b/drivers/net/vrf.c @@ -1908,7 +1908,7 @@ static int vrf_strict_mode_change(struct vrf_map *vmap, bool new_mode) return res; } -static int vrf_shared_table_handler(struct ctl_table *table, int write, +static int vrf_shared_table_handler(const struct ctl_table *table, int write, void *buffer, size_t *lenp, loff_t *ppos) { struct net *net = (struct net *)table->extra1; diff --git a/drivers/parport/procfs.c b/drivers/parport/procfs.c index bd388560ed59..2349b5dfece4 100644 --- a/drivers/parport/procfs.c +++ b/drivers/parport/procfs.c @@ -33,8 +33,8 @@ #define PARPORT_MIN_SPINTIME_VALUE 1 #define PARPORT_MAX_SPINTIME_VALUE 1000 -static int do_active_device(struct ctl_table *table, int write, - void *result, size_t *lenp, loff_t *ppos) +static int do_active_device(const struct ctl_table *table, int write, + void *result, size_t *lenp, loff_t *ppos) { struct parport *port = (struct parport *)table->extra1; char buffer[256]; @@ -70,7 +70,7 @@ static int do_active_device(struct ctl_table *table, int write, } #ifdef CONFIG_PARPORT_1284 -static int do_autoprobe(struct ctl_table *table, int write, +static int do_autoprobe(const struct ctl_table *table, int write, void *result, size_t *lenp, loff_t *ppos) { struct parport_device_info *info = table->extra2; @@ -113,7 +113,7 @@ static int do_autoprobe(struct ctl_table *table, int write, } #endif /* IEEE1284.3 support. */ -static int do_hardware_base_addr(struct ctl_table *table, int write, +static int do_hardware_base_addr(const struct ctl_table *table, int write, void *result, size_t *lenp, loff_t *ppos) { struct parport *port = (struct parport *)table->extra1; @@ -140,7 +140,7 @@ static int do_hardware_base_addr(struct ctl_table *table, int write, return 0; } -static int do_hardware_irq(struct ctl_table *table, int write, +static int do_hardware_irq(const struct ctl_table *table, int write, void *result, size_t *lenp, loff_t *ppos) { struct parport *port = (struct parport *)table->extra1; @@ -167,7 +167,7 @@ static int do_hardware_irq(struct ctl_table *table, int write, return 0; } -static int do_hardware_dma(struct ctl_table *table, int write, +static int do_hardware_dma(const struct ctl_table *table, int write, void *result, size_t *lenp, loff_t *ppos) { struct parport *port = (struct parport *)table->extra1; @@ -194,7 +194,7 @@ static int do_hardware_dma(struct ctl_table *table, int write, return 0; } -static int do_hardware_modes(struct ctl_table *table, int write, +static int do_hardware_modes(const struct ctl_table *table, int write, void *result, size_t *lenp, loff_t *ppos) { struct parport *port = (struct parport *)table->extra1; diff --git a/drivers/perf/arm_pmuv3.c b/drivers/perf/arm_pmuv3.c index 23fa6c5da82c..83d12dc83313 100644 --- a/drivers/perf/arm_pmuv3.c +++ b/drivers/perf/arm_pmuv3.c @@ -1253,8 +1253,10 @@ static void armv8pmu_disable_user_access_ipi(void *unused) armv8pmu_disable_user_access(); } -static int armv8pmu_proc_user_access_handler(struct ctl_table *table, int write, - void *buffer, size_t *lenp, loff_t *ppos) +static int armv8pmu_proc_user_access_handler(const struct ctl_table *table, + int write, + void *buffer, size_t *lenp, + loff_t *ppos) { int ret = proc_dointvec_minmax(table, write, buffer, lenp, ppos); if (ret || !write || sysctl_perf_user_access) diff --git a/drivers/perf/riscv_pmu_sbi.c b/drivers/perf/riscv_pmu_sbi.c index 8cbe6e5f9c39..9beda75e2e18 100644 --- a/drivers/perf/riscv_pmu_sbi.c +++ b/drivers/perf/riscv_pmu_sbi.c @@ -1013,7 +1013,7 @@ static void riscv_pmu_update_counter_access(void *info) csr_write(CSR_SCOUNTEREN, 0x2); } -static int riscv_pmu_proc_user_access_handler(struct ctl_table *table, +static int riscv_pmu_proc_user_access_handler(const struct ctl_table *table, int write, void *buffer, size_t *lenp, loff_t *ppos) { diff --git a/fs/coredump.c b/fs/coredump.c index be6403b4b14b..3c9a9782ec05 100644 --- a/fs/coredump.c +++ b/fs/coredump.c @@ -988,8 +988,8 @@ void validate_coredump_safety(void) } } -static int proc_dostring_coredump(struct ctl_table *table, int write, - void *buffer, size_t *lenp, loff_t *ppos) +static int proc_dostring_coredump(const struct ctl_table *table, int write, + void *buffer, size_t *lenp, loff_t *ppos) { int error = proc_dostring(table, write, buffer, lenp, ppos); diff --git a/fs/dcache.c b/fs/dcache.c index 71a8e943a0fa..0118e47578c2 100644 --- a/fs/dcache.c +++ b/fs/dcache.c @@ -174,7 +174,8 @@ static long get_nr_dentry_negative(void) return sum < 0 ? 0 : sum; } -static int proc_nr_dentry(struct ctl_table *table, int write, void *buffer, +static int proc_nr_dentry(const struct ctl_table *table, int write, + void *buffer, size_t *lenp, loff_t *ppos) { dentry_stat.nr_dentry = get_nr_dentry(); diff --git a/fs/drop_caches.c b/fs/drop_caches.c index b9575957a7c2..023482823ff1 100644 --- a/fs/drop_caches.c +++ b/fs/drop_caches.c @@ -48,8 +48,8 @@ static void drop_pagecache_sb(struct super_block *sb, void *unused) iput(toput_inode); } -int drop_caches_sysctl_handler(struct ctl_table *table, int write, - void *buffer, size_t *length, loff_t *ppos) +int drop_caches_sysctl_handler(const struct ctl_table *table, int write, + void *buffer, size_t *length, loff_t *ppos) { int ret; diff --git a/fs/exec.c b/fs/exec.c index ff6f26671cfc..1e17a798053b 100644 --- a/fs/exec.c +++ b/fs/exec.c @@ -2161,8 +2161,10 @@ COMPAT_SYSCALL_DEFINE5(execveat, int, fd, #ifdef CONFIG_SYSCTL -static int proc_dointvec_minmax_coredump(struct ctl_table *table, int write, - void *buffer, size_t *lenp, loff_t *ppos) +static int proc_dointvec_minmax_coredump(const struct ctl_table *table, + int write, + void *buffer, size_t *lenp, + loff_t *ppos) { int error = proc_dointvec_minmax(table, write, buffer, lenp, ppos); diff --git a/fs/file_table.c b/fs/file_table.c index 4f03beed4737..1d4f71072d28 100644 --- a/fs/file_table.c +++ b/fs/file_table.c @@ -96,7 +96,8 @@ EXPORT_SYMBOL_GPL(get_max_files); /* * Handle nr_files sysctl */ -static int proc_nr_files(struct ctl_table *table, int write, void *buffer, +static int proc_nr_files(const struct ctl_table *table, int write, + void *buffer, size_t *lenp, loff_t *ppos) { files_stat.nr_files = get_nr_files(); diff --git a/fs/fs-writeback.c b/fs/fs-writeback.c index e4f17c53ddfc..535a1108960f 100644 --- a/fs/fs-writeback.c +++ b/fs/fs-writeback.c @@ -2404,7 +2404,7 @@ static int __init start_dirtytime_writeback(void) } __initcall(start_dirtytime_writeback); -int dirtytime_interval_handler(struct ctl_table *table, int write, +int dirtytime_interval_handler(const struct ctl_table *table, int write, void *buffer, size_t *lenp, loff_t *ppos) { int ret; diff --git a/fs/inode.c b/fs/inode.c index 3a41f83a4ba5..3b5bbb70a18c 100644 --- a/fs/inode.c +++ b/fs/inode.c @@ -107,7 +107,8 @@ long get_nr_dirty_inodes(void) */ static struct inodes_stat_t inodes_stat; -static int proc_nr_inodes(struct ctl_table *table, int write, void *buffer, +static int proc_nr_inodes(const struct ctl_table *table, int write, + void *buffer, size_t *lenp, loff_t *ppos) { inodes_stat.nr_inodes = get_nr_inodes(); diff --git a/fs/pipe.c b/fs/pipe.c index 50c8a8596b52..7dff2aa50a6d 100644 --- a/fs/pipe.c +++ b/fs/pipe.c @@ -1469,7 +1469,7 @@ static int do_proc_dopipe_max_size_conv(unsigned long *lvalp, return 0; } -static int proc_dopipe_max_size(struct ctl_table *table, int write, +static int proc_dopipe_max_size(const struct ctl_table *table, int write, void *buffer, size_t *lenp, loff_t *ppos) { return do_proc_douintvec(table, write, buffer, lenp, ppos, diff --git a/fs/quota/dquot.c b/fs/quota/dquot.c index dacbee455c03..b33df45426f4 100644 --- a/fs/quota/dquot.c +++ b/fs/quota/dquot.c @@ -2911,8 +2911,8 @@ const struct quotactl_ops dquot_quotactl_sysfile_ops = { }; EXPORT_SYMBOL(dquot_quotactl_sysfile_ops); -static int do_proc_dqstats(struct ctl_table *table, int write, - void *buffer, size_t *lenp, loff_t *ppos) +static int do_proc_dqstats(const struct ctl_table *table, int write, + void *buffer, size_t *lenp, loff_t *ppos) { unsigned int type = (unsigned long *)table->data - dqstats.stat; s64 value = percpu_counter_sum(&dqstats.counter[type]); diff --git a/fs/xfs/xfs_sysctl.c b/fs/xfs/xfs_sysctl.c index a191f6560f98..a3ca192eca79 100644 --- a/fs/xfs/xfs_sysctl.c +++ b/fs/xfs/xfs_sysctl.c @@ -10,12 +10,11 @@ static struct ctl_table_header *xfs_table_header; #ifdef CONFIG_PROC_FS STATIC int -xfs_stats_clear_proc_handler( - struct ctl_table *ctl, - int write, - void *buffer, - size_t *lenp, - loff_t *ppos) +xfs_stats_clear_proc_handler(const struct ctl_table *ctl, + int write, + void *buffer, + size_t *lenp, + loff_t *ppos) { int ret, *valp = ctl->data; @@ -30,12 +29,11 @@ xfs_stats_clear_proc_handler( } STATIC int -xfs_panic_mask_proc_handler( - struct ctl_table *ctl, - int write, - void *buffer, - size_t *lenp, - loff_t *ppos) +xfs_panic_mask_proc_handler(const struct ctl_table *ctl, + int write, + void *buffer, + size_t *lenp, + loff_t *ppos) { int ret, *valp = ctl->data; @@ -51,12 +49,11 @@ xfs_panic_mask_proc_handler( #endif /* CONFIG_PROC_FS */ STATIC int -xfs_deprecated_dointvec_minmax( - struct ctl_table *ctl, - int write, - void *buffer, - size_t *lenp, - loff_t *ppos) +xfs_deprecated_dointvec_minmax(const struct ctl_table *ctl, + int write, + void *buffer, + size_t *lenp, + loff_t *ppos) { if (write) { printk_ratelimited(KERN_WARNING diff --git a/include/linux/ftrace.h b/include/linux/ftrace.h index e8921871ef9a..3e10fe61c2bf 100644 --- a/include/linux/ftrace.h +++ b/include/linux/ftrace.h @@ -470,7 +470,7 @@ static inline void arch_ftrace_set_direct_caller(struct ftrace_regs *fregs, extern int stack_tracer_enabled; -int stack_trace_sysctl(struct ctl_table *table, int write, void *buffer, +int stack_trace_sysctl(const struct ctl_table *table, int write, void *buffer, size_t *lenp, loff_t *ppos); /* DO NOT MODIFY THIS VARIABLE DIRECTLY! */ @@ -1157,7 +1157,7 @@ extern int tracepoint_printk; extern void disable_trace_on_warning(void); extern int __disable_trace_on_warning; -int tracepoint_printk_sysctl(struct ctl_table *table, int write, +int tracepoint_printk_sysctl(const struct ctl_table *table, int write, void *buffer, size_t *lenp, loff_t *ppos); #else /* CONFIG_TRACING */ diff --git a/include/linux/mm.h b/include/linux/mm.h index 0436b919f1c7..f047b5752a78 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h @@ -203,11 +203,11 @@ extern int sysctl_overcommit_memory; extern int sysctl_overcommit_ratio; extern unsigned long sysctl_overcommit_kbytes; -int overcommit_ratio_handler(struct ctl_table *, int, void *, size_t *, +int overcommit_ratio_handler(const struct ctl_table *, int, void *, size_t *, loff_t *); -int overcommit_kbytes_handler(struct ctl_table *, int, void *, size_t *, +int overcommit_kbytes_handler(const struct ctl_table *, int, void *, size_t *, loff_t *); -int overcommit_policy_handler(struct ctl_table *, int, void *, size_t *, +int overcommit_policy_handler(const struct ctl_table *, int, void *, size_t *, loff_t *); #if defined(CONFIG_SPARSEMEM) && !defined(CONFIG_SPARSEMEM_VMEMMAP) @@ -3837,7 +3837,7 @@ extern bool process_shares_mm(struct task_struct *p, struct mm_struct *mm); #ifdef CONFIG_SYSCTL extern int sysctl_drop_caches; -int drop_caches_sysctl_handler(struct ctl_table *, int, void *, size_t *, +int drop_caches_sysctl_handler(const struct ctl_table *, int, void *, size_t *, loff_t *); #endif diff --git a/include/linux/perf_event.h b/include/linux/perf_event.h index d2a15c0c6f8a..707d5fe5da9c 100644 --- a/include/linux/perf_event.h +++ b/include/linux/perf_event.h @@ -1598,11 +1598,11 @@ extern int sysctl_perf_cpu_time_max_percent; extern void perf_sample_event_took(u64 sample_len_ns); -int perf_event_max_sample_rate_handler(struct ctl_table *table, int write, +int perf_event_max_sample_rate_handler(const struct ctl_table *table, int write, void *buffer, size_t *lenp, loff_t *ppos); -int perf_cpu_time_max_percent_handler(struct ctl_table *table, int write, +int perf_cpu_time_max_percent_handler(const struct ctl_table *table, int write, void *buffer, size_t *lenp, loff_t *ppos); -int perf_event_max_stack_handler(struct ctl_table *table, int write, +int perf_event_max_stack_handler(const struct ctl_table *table, int write, void *buffer, size_t *lenp, loff_t *ppos); /* Access to perf_event_open(2) syscall. */ diff --git a/include/linux/security.h b/include/linux/security.h index f249f5b9a9d7..f12d1b7d650e 100644 --- a/include/linux/security.h +++ b/include/linux/security.h @@ -228,7 +228,7 @@ struct request_sock; #define LSM_UNSAFE_NO_NEW_PRIVS 4 #ifdef CONFIG_MMU -extern int mmap_min_addr_handler(struct ctl_table *table, int write, +extern int mmap_min_addr_handler(const struct ctl_table *table, int write, void *buffer, size_t *lenp, loff_t *ppos); #endif diff --git a/include/linux/sysctl.h b/include/linux/sysctl.h index 99ea26b16c0d..97901dae1348 100644 --- a/include/linux/sysctl.h +++ b/include/linux/sysctl.h @@ -61,31 +61,31 @@ extern const int sysctl_vals[]; extern const unsigned long sysctl_long_vals[]; -typedef int proc_handler(struct ctl_table *ctl, int write, void *buffer, +typedef int proc_handler(const struct ctl_table *ctl, int write, void *buffer, size_t *lenp, loff_t *ppos); -int proc_dostring(struct ctl_table *, int, void *, size_t *, loff_t *); -int proc_dobool(struct ctl_table *table, int write, void *buffer, +int proc_dostring(const struct ctl_table *, int, void *, size_t *, loff_t *); +int proc_dobool(const struct ctl_table *table, int write, void *buffer, size_t *lenp, loff_t *ppos); -int proc_dointvec(struct ctl_table *, int, void *, size_t *, loff_t *); -int proc_douintvec(struct ctl_table *, int, void *, size_t *, loff_t *); -int proc_dointvec_minmax(struct ctl_table *, int, void *, size_t *, loff_t *); -int proc_douintvec_minmax(struct ctl_table *table, int write, void *buffer, +int proc_dointvec(const struct ctl_table *, int, void *, size_t *, loff_t *); +int proc_douintvec(const struct ctl_table *, int, void *, size_t *, loff_t *); +int proc_dointvec_minmax(const struct ctl_table *, int, void *, size_t *, loff_t *); +int proc_douintvec_minmax(const struct ctl_table *table, int write, void *buffer, size_t *lenp, loff_t *ppos); -int proc_dou8vec_minmax(struct ctl_table *table, int write, void *buffer, +int proc_dou8vec_minmax(const struct ctl_table *table, int write, void *buffer, size_t *lenp, loff_t *ppos); -int proc_dointvec_jiffies(struct ctl_table *, int, void *, size_t *, loff_t *); -int proc_dointvec_ms_jiffies_minmax(struct ctl_table *table, int write, +int proc_dointvec_jiffies(const struct ctl_table *, int, void *, size_t *, loff_t *); +int proc_dointvec_ms_jiffies_minmax(const struct ctl_table *table, int write, void *buffer, size_t *lenp, loff_t *ppos); -int proc_dointvec_userhz_jiffies(struct ctl_table *, int, void *, size_t *, +int proc_dointvec_userhz_jiffies(const struct ctl_table *, int, void *, size_t *, loff_t *); -int proc_dointvec_ms_jiffies(struct ctl_table *, int, void *, size_t *, +int proc_dointvec_ms_jiffies(const struct ctl_table *, int, void *, size_t *, loff_t *); -int proc_doulongvec_minmax(struct ctl_table *, int, void *, size_t *, loff_t *); -int proc_doulongvec_ms_jiffies_minmax(struct ctl_table *table, int, void *, +int proc_doulongvec_minmax(const struct ctl_table *, int, void *, size_t *, loff_t *); +int proc_doulongvec_ms_jiffies_minmax(const struct ctl_table *table, int, void *, size_t *, loff_t *); -int proc_do_large_bitmap(struct ctl_table *, int, void *, size_t *, loff_t *); -int proc_do_static_key(struct ctl_table *table, int write, void *buffer, +int proc_do_large_bitmap(const struct ctl_table *, int, void *, size_t *, loff_t *); +int proc_do_static_key(const struct ctl_table *table, int write, void *buffer, size_t *lenp, loff_t *ppos); /* @@ -288,7 +288,7 @@ static inline bool sysctl_is_alias(char *param) } #endif /* CONFIG_SYSCTL */ -int sysctl_max_threads(struct ctl_table *table, int write, void *buffer, +int sysctl_max_threads(const struct ctl_table *table, int write, void *buffer, size_t *lenp, loff_t *ppos); #endif /* _LINUX_SYSCTL_H */ diff --git a/include/linux/vmstat.h b/include/linux/vmstat.h index 343906a98d6e..0282aba4faa0 100644 --- a/include/linux/vmstat.h +++ b/include/linux/vmstat.h @@ -17,7 +17,7 @@ extern int sysctl_stat_interval; #define DISABLE_NUMA_STAT 0 extern int sysctl_vm_numa_stat; DECLARE_STATIC_KEY_TRUE(vm_numa_stat_key); -int sysctl_vm_numa_stat_handler(struct ctl_table *table, int write, +int sysctl_vm_numa_stat_handler(const struct ctl_table *table, int write, void *buffer, size_t *length, loff_t *ppos); #endif @@ -301,8 +301,8 @@ void cpu_vm_stats_fold(int cpu); void refresh_zone_stat_thresholds(void); struct ctl_table; -int vmstat_refresh(struct ctl_table *, int write, void *buffer, size_t *lenp, - loff_t *ppos); +int vmstat_refresh(const struct ctl_table *, int write, void *buffer, + size_t *lenp, loff_t *ppos); void drain_zonestat(struct zone *zone, struct per_cpu_zonestat *); diff --git a/include/linux/writeback.h b/include/linux/writeback.h index 9845cb62e40b..e58b039aa592 100644 --- a/include/linux/writeback.h +++ b/include/linux/writeback.h @@ -350,7 +350,7 @@ extern unsigned int dirty_expire_interval; extern unsigned int dirtytime_expire_interval; extern int laptop_mode; -int dirtytime_interval_handler(struct ctl_table *table, int write, +int dirtytime_interval_handler(const struct ctl_table *table, int write, void *buffer, size_t *lenp, loff_t *ppos); void global_dirty_limits(unsigned long *pbackground, unsigned long *pdirty); diff --git a/include/net/ndisc.h b/include/net/ndisc.h index 9bbdf6eaa942..7a533d5b1d59 100644 --- a/include/net/ndisc.h +++ b/include/net/ndisc.h @@ -486,7 +486,7 @@ void igmp6_event_report(struct sk_buff *skb); #ifdef CONFIG_SYSCTL -int ndisc_ifinfo_sysctl_change(struct ctl_table *ctl, int write, +int ndisc_ifinfo_sysctl_change(const struct ctl_table *ctl, int write, void *buffer, size_t *lenp, loff_t *ppos); #endif diff --git a/include/net/neighbour.h b/include/net/neighbour.h index 0d28172193fa..a44f262a7384 100644 --- a/include/net/neighbour.h +++ b/include/net/neighbour.h @@ -412,12 +412,12 @@ void *neigh_seq_start(struct seq_file *, loff_t *, struct neigh_table *, void *neigh_seq_next(struct seq_file *, void *, loff_t *); void neigh_seq_stop(struct seq_file *, void *); -int neigh_proc_dointvec(struct ctl_table *ctl, int write, +int neigh_proc_dointvec(const struct ctl_table *ctl, int write, void *buffer, size_t *lenp, loff_t *ppos); -int neigh_proc_dointvec_jiffies(struct ctl_table *ctl, int write, +int neigh_proc_dointvec_jiffies(const struct ctl_table *ctl, int write, void *buffer, size_t *lenp, loff_t *ppos); -int neigh_proc_dointvec_ms_jiffies(struct ctl_table *ctl, int write, +int neigh_proc_dointvec_ms_jiffies(const struct ctl_table *ctl, int write, void *buffer, size_t *lenp, loff_t *ppos); int neigh_sysctl_register(struct net_device *dev, struct neigh_parms *p, diff --git a/include/net/netfilter/nf_hooks_lwtunnel.h b/include/net/netfilter/nf_hooks_lwtunnel.h index 52e27920f829..cef7a4eb8f97 100644 --- a/include/net/netfilter/nf_hooks_lwtunnel.h +++ b/include/net/netfilter/nf_hooks_lwtunnel.h @@ -2,6 +2,6 @@ #include <linux/types.h> #ifdef CONFIG_SYSCTL -int nf_hooks_lwtunnel_sysctl_handler(struct ctl_table *table, int write, +int nf_hooks_lwtunnel_sysctl_handler(const struct ctl_table *table, int write, void *buffer, size_t *lenp, loff_t *ppos); #endif diff --git a/ipc/ipc_sysctl.c b/ipc/ipc_sysctl.c index 45cb1dabce29..c40e9384fb1b 100644 --- a/ipc/ipc_sysctl.c +++ b/ipc/ipc_sysctl.c @@ -17,8 +17,10 @@ #include <linux/cred.h> #include "util.h" -static int proc_ipc_dointvec_minmax_orphans(struct ctl_table *table, int write, - void *buffer, size_t *lenp, loff_t *ppos) +static int proc_ipc_dointvec_minmax_orphans(const struct ctl_table *table, + int write, + void *buffer, size_t *lenp, + loff_t *ppos) { struct ipc_namespace *ns = container_of(table->data, struct ipc_namespace, shm_rmid_forced); @@ -33,8 +35,8 @@ static int proc_ipc_dointvec_minmax_orphans(struct ctl_table *table, int write, return err; } -static int proc_ipc_auto_msgmni(struct ctl_table *table, int write, - void *buffer, size_t *lenp, loff_t *ppos) +static int proc_ipc_auto_msgmni(const struct ctl_table *table, int write, + void *buffer, size_t *lenp, loff_t *ppos) { struct ctl_table ipc_table; int dummy = 0; @@ -48,8 +50,8 @@ static int proc_ipc_auto_msgmni(struct ctl_table *table, int write, return proc_dointvec_minmax(&ipc_table, write, buffer, lenp, ppos); } -static int proc_ipc_sem_dointvec(struct ctl_table *table, int write, - void *buffer, size_t *lenp, loff_t *ppos) +static int proc_ipc_sem_dointvec(const struct ctl_table *table, int write, + void *buffer, size_t *lenp, loff_t *ppos) { struct ipc_namespace *ns = container_of(table->data, struct ipc_namespace, sem_ctls); diff --git a/kernel/bpf/syscall.c b/kernel/bpf/syscall.c index ae2ff73bde7e..08f92fb3cefa 100644 --- a/kernel/bpf/syscall.c +++ b/kernel/bpf/syscall.c @@ -5904,7 +5904,7 @@ const struct bpf_prog_ops bpf_syscall_prog_ops = { }; #ifdef CONFIG_SYSCTL -static int bpf_stats_handler(struct ctl_table *table, int write, +static int bpf_stats_handler(const struct ctl_table *table, int write, void *buffer, size_t *lenp, loff_t *ppos) { struct static_key *key = (struct static_key *)table->data; @@ -5939,7 +5939,7 @@ void __weak unpriv_ebpf_notify(int new_state) { } -static int bpf_unpriv_handler(struct ctl_table *table, int write, +static int bpf_unpriv_handler(const struct ctl_table *table, int write, void *buffer, size_t *lenp, loff_t *ppos) { int ret, unpriv_enable = *(int *)table->data; diff --git a/kernel/delayacct.c b/kernel/delayacct.c index 6f0c358e73d8..513791ef573d 100644 --- a/kernel/delayacct.c +++ b/kernel/delayacct.c @@ -44,8 +44,9 @@ void delayacct_init(void) } #ifdef CONFIG_PROC_SYSCTL -static int sysctl_delayacct(struct ctl_table *table, int write, void *buffer, - size_t *lenp, loff_t *ppos) +static int sysctl_delayacct(const struct ctl_table *table, int write, + void *buffer, + size_t *lenp, loff_t *ppos) { int state = delayacct_on; struct ctl_table t; diff --git a/kernel/events/callchain.c b/kernel/events/callchain.c index 1273be84392c..bd5699f869c3 100644 --- a/kernel/events/callchain.c +++ b/kernel/events/callchain.c @@ -229,7 +229,7 @@ get_perf_callchain(struct pt_regs *regs, u32 init_nr, bool kernel, bool user, * Used for sysctl_perf_event_max_stack and * sysctl_perf_event_max_contexts_per_stack. */ -int perf_event_max_stack_handler(struct ctl_table *table, int write, +int perf_event_max_stack_handler(const struct ctl_table *table, int write, void *buffer, size_t *lenp, loff_t *ppos) { int *value = table->data; diff --git a/kernel/events/core.c b/kernel/events/core.c index 724e6d7e128f..e2955e0d9f44 100644 --- a/kernel/events/core.c +++ b/kernel/events/core.c @@ -450,7 +450,8 @@ static void update_perf_cpu_limits(void) static bool perf_rotate_context(struct perf_cpu_pmu_context *cpc); -int perf_event_max_sample_rate_handler(struct ctl_table *table, int write, +int perf_event_max_sample_rate_handler(const struct ctl_table *table, + int write, void *buffer, size_t *lenp, loff_t *ppos) { int ret; @@ -474,8 +475,10 @@ int perf_event_max_sample_rate_handler(struct ctl_table *table, int write, int sysctl_perf_cpu_time_max_percent __read_mostly = DEFAULT_CPU_TIME_MAX_PERCENT; -int perf_cpu_time_max_percent_handler(struct ctl_table *table, int write, - void *buffer, size_t *lenp, loff_t *ppos) +int perf_cpu_time_max_percent_handler(const struct ctl_table *table, + int write, + void *buffer, size_t *lenp, + loff_t *ppos) { int ret = proc_dointvec_minmax(table, write, buffer, lenp, ppos); diff --git a/kernel/fork.c b/kernel/fork.c index 39a5046c2f0b..7be1dc035fe1 100644 --- a/kernel/fork.c +++ b/kernel/fork.c @@ -3417,7 +3417,7 @@ int unshare_files(void) return 0; } -int sysctl_max_threads(struct ctl_table *table, int write, +int sysctl_max_threads(const struct ctl_table *table, int write, void *buffer, size_t *lenp, loff_t *ppos) { struct ctl_table t; diff --git a/kernel/hung_task.c b/kernel/hung_task.c index b2fc2727d654..003f0f5cb111 100644 --- a/kernel/hung_task.c +++ b/kernel/hung_task.c @@ -239,9 +239,10 @@ static long hung_timeout_jiffies(unsigned long last_checked, /* * Process updating of timeout sysctl */ -static int proc_dohung_task_timeout_secs(struct ctl_table *table, int write, - void *buffer, - size_t *lenp, loff_t *ppos) +static int proc_dohung_task_timeout_secs(const struct ctl_table *table, + int write, + void *buffer, + size_t *lenp, loff_t *ppos) { int ret; diff --git a/kernel/kexec_core.c b/kernel/kexec_core.c index 0e96f6b24344..a6995bb89eef 100644 --- a/kernel/kexec_core.c +++ b/kernel/kexec_core.c @@ -888,7 +888,7 @@ struct kimage *kexec_crash_image; static int kexec_load_disabled; #ifdef CONFIG_SYSCTL -static int kexec_limit_handler(struct ctl_table *table, int write, +static int kexec_limit_handler(const struct ctl_table *table, int write, void *buffer, size_t *lenp, loff_t *ppos) { struct kexec_load_limit *limit = table->data; diff --git a/kernel/kprobes.c b/kernel/kprobes.c index 9d9095e81792..83771c44fc3a 100644 --- a/kernel/kprobes.c +++ b/kernel/kprobes.c @@ -939,7 +939,7 @@ static void unoptimize_all_kprobes(void) static DEFINE_MUTEX(kprobe_sysctl_mutex); static int sysctl_kprobes_optimization; -static int proc_kprobes_optimization_handler(struct ctl_table *table, +static int proc_kprobes_optimization_handler(const struct ctl_table *table, int write, void *buffer, size_t *length, loff_t *ppos) { diff --git a/kernel/latencytop.c b/kernel/latencytop.c index 781249098cb6..0a5c22b19821 100644 --- a/kernel/latencytop.c +++ b/kernel/latencytop.c @@ -65,8 +65,9 @@ static struct latency_record latency_record[MAXLR]; int latencytop_enabled; #ifdef CONFIG_SYSCTL -static int sysctl_latencytop(struct ctl_table *table, int write, void *buffer, - size_t *lenp, loff_t *ppos) +static int sysctl_latencytop(const struct ctl_table *table, int write, + void *buffer, + size_t *lenp, loff_t *ppos) { int err; diff --git a/kernel/pid_namespace.c b/kernel/pid_namespace.c index 7ade20e95232..008c32f11bbc 100644 --- a/kernel/pid_namespace.c +++ b/kernel/pid_namespace.c @@ -277,8 +277,8 @@ void zap_pid_ns_processes(struct pid_namespace *pid_ns) } #ifdef CONFIG_CHECKPOINT_RESTORE -static int pid_ns_ctl_handler(struct ctl_table *table, int write, - void *buffer, size_t *lenp, loff_t *ppos) +static int pid_ns_ctl_handler(const struct ctl_table *table, int write, + void *buffer, size_t *lenp, loff_t *ppos) { struct pid_namespace *pid_ns = task_active_pid_ns(current); struct ctl_table tmp = *table; diff --git a/kernel/pid_sysctl.h b/kernel/pid_sysctl.h index 2ee41a3a1dfd..a1b47ad10ebc 100644 --- a/kernel/pid_sysctl.h +++ b/kernel/pid_sysctl.h @@ -5,7 +5,7 @@ #include <linux/pid_namespace.h> #if defined(CONFIG_SYSCTL) && defined(CONFIG_MEMFD_CREATE) -static int pid_mfd_noexec_dointvec_minmax(struct ctl_table *table, +static int pid_mfd_noexec_dointvec_minmax(const struct ctl_table *table, int write, void *buf, size_t *lenp, loff_t *ppos) { struct pid_namespace *ns = task_active_pid_ns(current); diff --git a/kernel/printk/internal.h b/kernel/printk/internal.h index 6c2afee5ef62..19dcc5832651 100644 --- a/kernel/printk/internal.h +++ b/kernel/printk/internal.h @@ -8,7 +8,7 @@ #if defined(CONFIG_PRINTK) && defined(CONFIG_SYSCTL) void __init printk_sysctl_init(void); -int devkmsg_sysctl_set_loglvl(struct ctl_table *table, int write, +int devkmsg_sysctl_set_loglvl(const struct ctl_table *table, int write, void *buffer, size_t *lenp, loff_t *ppos); #else #define printk_sysctl_init() do { } while (0) diff --git a/kernel/printk/printk.c b/kernel/printk/printk.c index ca5146006b94..c96ae16ca2cd 100644 --- a/kernel/printk/printk.c +++ b/kernel/printk/printk.c @@ -197,7 +197,7 @@ __setup("printk.devkmsg=", control_devkmsg); char devkmsg_log_str[DEVKMSG_STR_MAX_SIZE] = "ratelimit"; #if defined(CONFIG_PRINTK) && defined(CONFIG_SYSCTL) -int devkmsg_sysctl_set_loglvl(struct ctl_table *table, int write, +int devkmsg_sysctl_set_loglvl(const struct ctl_table *table, int write, void *buffer, size_t *lenp, loff_t *ppos) { char old_str[DEVKMSG_STR_MAX_SIZE]; diff --git a/kernel/printk/sysctl.c b/kernel/printk/sysctl.c index c228343eeb97..2571651aa1ce 100644 --- a/kernel/printk/sysctl.c +++ b/kernel/printk/sysctl.c @@ -11,8 +11,10 @@ static const int ten_thousand = 10000; -static int proc_dointvec_minmax_sysadmin(struct ctl_table *table, int write, - void *buffer, size_t *lenp, loff_t *ppos) +static int proc_dointvec_minmax_sysadmin(const struct ctl_table *table, + int write, + void *buffer, size_t *lenp, + loff_t *ppos) { if (write && !capable(CAP_SYS_ADMIN)) return -EPERM; diff --git a/kernel/sched/core.c b/kernel/sched/core.c index 0621e4ee31de..ea143bb63f63 100644 --- a/kernel/sched/core.c +++ b/kernel/sched/core.c @@ -1835,8 +1835,10 @@ static void uclamp_sync_util_min_rt_default(void) uclamp_update_util_min_rt_default(p); } -static int sysctl_sched_uclamp_handler(struct ctl_table *table, int write, - void *buffer, size_t *lenp, loff_t *ppos) +static int sysctl_sched_uclamp_handler(const struct ctl_table *table, + int write, + void *buffer, size_t *lenp, + loff_t *ppos) { bool update_root_tg = false; int old_min, old_max, old_min_rt; @@ -4603,8 +4605,8 @@ static void reset_memory_tiering(void) } } -static int sysctl_numa_balancing(struct ctl_table *table, int write, - void *buffer, size_t *lenp, loff_t *ppos) +static int sysctl_numa_balancing(const struct ctl_table *table, int write, + void *buffer, size_t *lenp, loff_t *ppos) { struct ctl_table t; int err; @@ -4672,8 +4674,9 @@ static int __init setup_schedstats(char *str) __setup("schedstats=", setup_schedstats); #ifdef CONFIG_PROC_SYSCTL -static int sysctl_schedstats(struct ctl_table *table, int write, void *buffer, - size_t *lenp, loff_t *ppos) +static int sysctl_schedstats(const struct ctl_table *table, int write, + void *buffer, + size_t *lenp, loff_t *ppos) { struct ctl_table t; int err; diff --git a/kernel/sched/rt.c b/kernel/sched/rt.c index 3261b067b67e..3bbf29d4e110 100644 --- a/kernel/sched/rt.c +++ b/kernel/sched/rt.c @@ -26,10 +26,12 @@ int sysctl_sched_rt_runtime = 950000; #ifdef CONFIG_SYSCTL static int sysctl_sched_rr_timeslice = (MSEC_PER_SEC * RR_TIMESLICE) / HZ; -static int sched_rt_handler(struct ctl_table *table, int write, void *buffer, - size_t *lenp, loff_t *ppos); -static int sched_rr_handler(struct ctl_table *table, int write, void *buffer, - size_t *lenp, loff_t *ppos); +static int sched_rt_handler(const struct ctl_table *table, int write, + void *buffer, + size_t *lenp, loff_t *ppos); +static int sched_rr_handler(const struct ctl_table *table, int write, + void *buffer, + size_t *lenp, loff_t *ppos); static struct ctl_table sched_rt_sysctls[] = { { .procname = "sched_rt_period_us", @@ -2953,8 +2955,9 @@ static void sched_rt_do_global(void) raw_spin_unlock_irqrestore(&def_rt_bandwidth.rt_runtime_lock, flags); } -static int sched_rt_handler(struct ctl_table *table, int write, void *buffer, - size_t *lenp, loff_t *ppos) +static int sched_rt_handler(const struct ctl_table *table, int write, + void *buffer, + size_t *lenp, loff_t *ppos) { int old_period, old_runtime; static DEFINE_MUTEX(mutex); @@ -2992,8 +2995,9 @@ static int sched_rt_handler(struct ctl_table *table, int write, void *buffer, return ret; } -static int sched_rr_handler(struct ctl_table *table, int write, void *buffer, - size_t *lenp, loff_t *ppos) +static int sched_rr_handler(const struct ctl_table *table, int write, + void *buffer, + size_t *lenp, loff_t *ppos) { int ret; static DEFINE_MUTEX(mutex); diff --git a/kernel/sched/topology.c b/kernel/sched/topology.c index 99ea5986038c..1c582cee6144 100644 --- a/kernel/sched/topology.c +++ b/kernel/sched/topology.c @@ -285,8 +285,10 @@ void rebuild_sched_domains_energy(void) } #ifdef CONFIG_PROC_SYSCTL -static int sched_energy_aware_handler(struct ctl_table *table, int write, - void *buffer, size_t *lenp, loff_t *ppos) +static int sched_energy_aware_handler(const struct ctl_table *table, + int write, + void *buffer, size_t *lenp, + loff_t *ppos) { int ret, state; diff --git a/kernel/seccomp.c b/kernel/seccomp.c index aca7b437882e..397118a24631 100644 --- a/kernel/seccomp.c +++ b/kernel/seccomp.c @@ -2334,7 +2334,7 @@ static bool seccomp_actions_logged_from_names(u32 *actions_logged, char *names) return true; } -static int read_actions_logged(struct ctl_table *ro_table, void *buffer, +static int read_actions_logged(const struct ctl_table *ro_table, void *buffer, size_t *lenp, loff_t *ppos) { char names[sizeof(seccomp_actions_avail)]; @@ -2352,7 +2352,7 @@ static int read_actions_logged(struct ctl_table *ro_table, void *buffer, return proc_dostring(&table, 0, buffer, lenp, ppos); } -static int write_actions_logged(struct ctl_table *ro_table, void *buffer, +static int write_actions_logged(const struct ctl_table *ro_table, void *buffer, size_t *lenp, loff_t *ppos, u32 *actions_logged) { char names[sizeof(seccomp_actions_avail)]; @@ -2413,7 +2413,8 @@ static void audit_actions_logged(u32 actions_logged, u32 old_actions_logged, return audit_seccomp_actions_logged(new, old, !ret); } -static int seccomp_actions_logged_handler(struct ctl_table *ro_table, int write, +static int seccomp_actions_logged_handler(const struct ctl_table *ro_table, + int write, void *buffer, size_t *lenp, loff_t *ppos) { diff --git a/kernel/stackleak.c b/kernel/stackleak.c index b292e5ca0b7d..abe530071c20 100644 --- a/kernel/stackleak.c +++ b/kernel/stackleak.c @@ -21,8 +21,9 @@ static DEFINE_STATIC_KEY_FALSE(stack_erasing_bypass); #ifdef CONFIG_SYSCTL -static int stack_erasing_sysctl(struct ctl_table *table, int write, - void __user *buffer, size_t *lenp, loff_t *ppos) +static int stack_erasing_sysctl(const struct ctl_table *table, int write, + void __user *buffer, size_t *lenp, + loff_t *ppos) { int ret = 0; int state = !static_branch_unlikely(&stack_erasing_bypass); diff --git a/kernel/sysctl.c b/kernel/sysctl.c index 93824d8a3636..e06478682bb8 100644 --- a/kernel/sysctl.c +++ b/kernel/sysctl.c @@ -256,7 +256,7 @@ static bool proc_first_pos_non_zero_ignore(loff_t *ppos, * * Returns 0 on success. */ -int proc_dostring(struct ctl_table *table, int write, +int proc_dostring(const struct ctl_table *table, int write, void *buffer, size_t *lenp, loff_t *ppos) { if (write) @@ -702,7 +702,7 @@ int do_proc_douintvec(const struct ctl_table *table, int write, * * Returns 0 on success. */ -int proc_dobool(struct ctl_table *table, int write, void *buffer, +int proc_dobool(const struct ctl_table *table, int write, void *buffer, size_t *lenp, loff_t *ppos) { struct ctl_table tmp; @@ -739,7 +739,7 @@ int proc_dobool(struct ctl_table *table, int write, void *buffer, * * Returns 0 on success. */ -int proc_dointvec(struct ctl_table *table, int write, void *buffer, +int proc_dointvec(const struct ctl_table *table, int write, void *buffer, size_t *lenp, loff_t *ppos) { return do_proc_dointvec(table, write, buffer, lenp, ppos, NULL, NULL); @@ -758,8 +758,8 @@ int proc_dointvec(struct ctl_table *table, int write, void *buffer, * * Returns 0 on success. */ -int proc_douintvec(struct ctl_table *table, int write, void *buffer, - size_t *lenp, loff_t *ppos) +int proc_douintvec(const struct ctl_table *table, int write, void *buffer, + size_t *lenp, loff_t *ppos) { return do_proc_douintvec(table, write, buffer, lenp, ppos, do_proc_douintvec_conv, NULL); @@ -769,7 +769,7 @@ int proc_douintvec(struct ctl_table *table, int write, void *buffer, * Taint values can only be increased * This means we can safely use a temporary. */ -static int proc_taint(struct ctl_table *table, int write, +static int proc_taint(const struct ctl_table *table, int write, void *buffer, size_t *lenp, loff_t *ppos) { struct ctl_table t; @@ -864,8 +864,8 @@ static int do_proc_dointvec_minmax_conv(bool *negp, unsigned long *lvalp, * * Returns 0 on success or -EINVAL on write when the range check fails. */ -int proc_dointvec_minmax(struct ctl_table *table, int write, - void *buffer, size_t *lenp, loff_t *ppos) +int proc_dointvec_minmax(const struct ctl_table *table, int write, + void *buffer, size_t *lenp, loff_t *ppos) { struct do_proc_dointvec_minmax_conv_param param = { .min = (int *) table->extra1, @@ -933,7 +933,7 @@ static int do_proc_douintvec_minmax_conv(unsigned long *lvalp, * * Returns 0 on success or -ERANGE on write when the range check fails. */ -int proc_douintvec_minmax(struct ctl_table *table, int write, +int proc_douintvec_minmax(const struct ctl_table *table, int write, void *buffer, size_t *lenp, loff_t *ppos) { struct do_proc_douintvec_minmax_conv_param param = { @@ -961,7 +961,7 @@ int proc_douintvec_minmax(struct ctl_table *table, int write, * * Returns 0 on success or an error on write when the range check fails. */ -int proc_dou8vec_minmax(struct ctl_table *table, int write, +int proc_dou8vec_minmax(const struct ctl_table *table, int write, void *buffer, size_t *lenp, loff_t *ppos) { struct ctl_table tmp; @@ -1004,7 +1004,7 @@ int proc_dou8vec_minmax(struct ctl_table *table, int write, EXPORT_SYMBOL_GPL(proc_dou8vec_minmax); #ifdef CONFIG_MAGIC_SYSRQ -static int sysrq_sysctl_handler(struct ctl_table *table, int write, +static int sysrq_sysctl_handler(const struct ctl_table *table, int write, void *buffer, size_t *lenp, loff_t *ppos) { int tmp, ret; @@ -1121,7 +1121,7 @@ static int do_proc_doulongvec_minmax(const struct ctl_table *table, int write, * * Returns 0 on success. */ -int proc_doulongvec_minmax(struct ctl_table *table, int write, +int proc_doulongvec_minmax(const struct ctl_table *table, int write, void *buffer, size_t *lenp, loff_t *ppos) { return do_proc_doulongvec_minmax(table, write, buffer, lenp, ppos, 1l, 1l); @@ -1144,7 +1144,8 @@ int proc_doulongvec_minmax(struct ctl_table *table, int write, * * Returns 0 on success. */ -int proc_doulongvec_ms_jiffies_minmax(struct ctl_table *table, int write, +int proc_doulongvec_ms_jiffies_minmax(const struct ctl_table *table, + int write, void *buffer, size_t *lenp, loff_t *ppos) { return do_proc_doulongvec_minmax(table, write, buffer, @@ -1265,15 +1266,15 @@ static int do_proc_dointvec_ms_jiffies_minmax_conv(bool *negp, unsigned long *lv * * Returns 0 on success. */ -int proc_dointvec_jiffies(struct ctl_table *table, int write, +int proc_dointvec_jiffies(const struct ctl_table *table, int write, void *buffer, size_t *lenp, loff_t *ppos) { return do_proc_dointvec(table,write,buffer,lenp,ppos, do_proc_dointvec_jiffies_conv,NULL); } -int proc_dointvec_ms_jiffies_minmax(struct ctl_table *table, int write, - void *buffer, size_t *lenp, loff_t *ppos) +int proc_dointvec_ms_jiffies_minmax(const struct ctl_table *table, int write, + void *buffer, size_t *lenp, loff_t *ppos) { struct do_proc_dointvec_minmax_conv_param param = { .min = (int *) table->extra1, @@ -1298,7 +1299,7 @@ int proc_dointvec_ms_jiffies_minmax(struct ctl_table *table, int write, * * Returns 0 on success. */ -int proc_dointvec_userhz_jiffies(struct ctl_table *table, int write, +int proc_dointvec_userhz_jiffies(const struct ctl_table *table, int write, void *buffer, size_t *lenp, loff_t *ppos) { return do_proc_dointvec(table, write, buffer, lenp, ppos, @@ -1321,15 +1322,17 @@ int proc_dointvec_userhz_jiffies(struct ctl_table *table, int write, * * Returns 0 on success. */ -int proc_dointvec_ms_jiffies(struct ctl_table *table, int write, void *buffer, - size_t *lenp, loff_t *ppos) +int proc_dointvec_ms_jiffies(const struct ctl_table *table, int write, + void *buffer, + size_t *lenp, loff_t *ppos) { return do_proc_dointvec(table, write, buffer, lenp, ppos, do_proc_dointvec_ms_jiffies_conv, NULL); } -static int proc_do_cad_pid(struct ctl_table *table, int write, void *buffer, - size_t *lenp, loff_t *ppos) +static int proc_do_cad_pid(const struct ctl_table *table, int write, + void *buffer, + size_t *lenp, loff_t *ppos) { struct pid *new_pid; pid_t tmp; @@ -1367,7 +1370,7 @@ static int proc_do_cad_pid(struct ctl_table *table, int write, void *buffer, * * Returns 0 on success. */ -int proc_do_large_bitmap(struct ctl_table *table, int write, +int proc_do_large_bitmap(const struct ctl_table *table, int write, void *buffer, size_t *lenp, loff_t *ppos) { int err = 0; @@ -1499,85 +1502,86 @@ int proc_do_large_bitmap(struct ctl_table *table, int write, #else /* CONFIG_PROC_SYSCTL */ -int proc_dostring(struct ctl_table *table, int write, +int proc_dostring(const struct ctl_table *table, int write, void *buffer, size_t *lenp, loff_t *ppos) { return -ENOSYS; } -int proc_dobool(struct ctl_table *table, int write, +int proc_dobool(const struct ctl_table *table, int write, void *buffer, size_t *lenp, loff_t *ppos) { return -ENOSYS; } -int proc_dointvec(struct ctl_table *table, int write, +int proc_dointvec(const struct ctl_table *table, int write, void *buffer, size_t *lenp, loff_t *ppos) { return -ENOSYS; } -int proc_douintvec(struct ctl_table *table, int write, - void *buffer, size_t *lenp, loff_t *ppos) +int proc_douintvec(const struct ctl_table *table, int write, + void *buffer, size_t *lenp, loff_t *ppos) { return -ENOSYS; } -int proc_dointvec_minmax(struct ctl_table *table, int write, - void *buffer, size_t *lenp, loff_t *ppos) +int proc_dointvec_minmax(const struct ctl_table *table, int write, + void *buffer, size_t *lenp, loff_t *ppos) { return -ENOSYS; } -int proc_douintvec_minmax(struct ctl_table *table, int write, +int proc_douintvec_minmax(const struct ctl_table *table, int write, void *buffer, size_t *lenp, loff_t *ppos) { return -ENOSYS; } -int proc_dou8vec_minmax(struct ctl_table *table, int write, +int proc_dou8vec_minmax(const struct ctl_table *table, int write, void *buffer, size_t *lenp, loff_t *ppos) { return -ENOSYS; } -int proc_dointvec_jiffies(struct ctl_table *table, int write, - void *buffer, size_t *lenp, loff_t *ppos) +int proc_dointvec_jiffies(const struct ctl_table *table, int write, + void *buffer, size_t *lenp, loff_t *ppos) { return -ENOSYS; } -int proc_dointvec_ms_jiffies_minmax(struct ctl_table *table, int write, +int proc_dointvec_ms_jiffies_minmax(const struct ctl_table *table, int write, void *buffer, size_t *lenp, loff_t *ppos) { return -ENOSYS; } -int proc_dointvec_userhz_jiffies(struct ctl_table *table, int write, - void *buffer, size_t *lenp, loff_t *ppos) +int proc_dointvec_userhz_jiffies(const struct ctl_table *table, int write, + void *buffer, size_t *lenp, loff_t *ppos) { return -ENOSYS; } -int proc_dointvec_ms_jiffies(struct ctl_table *table, int write, +int proc_dointvec_ms_jiffies(const struct ctl_table *table, int write, void *buffer, size_t *lenp, loff_t *ppos) { return -ENOSYS; } -int proc_doulongvec_minmax(struct ctl_table *table, int write, - void *buffer, size_t *lenp, loff_t *ppos) +int proc_doulongvec_minmax(const struct ctl_table *table, int write, + void *buffer, size_t *lenp, loff_t *ppos) { return -ENOSYS; } -int proc_doulongvec_ms_jiffies_minmax(struct ctl_table *table, int write, +int proc_doulongvec_ms_jiffies_minmax(const struct ctl_table *table, + int write, void *buffer, size_t *lenp, loff_t *ppos) { return -ENOSYS; } -int proc_do_large_bitmap(struct ctl_table *table, int write, +int proc_do_large_bitmap(const struct ctl_table *table, int write, void *buffer, size_t *lenp, loff_t *ppos) { return -ENOSYS; @@ -1586,7 +1590,7 @@ int proc_do_large_bitmap(struct ctl_table *table, int write, #endif /* CONFIG_PROC_SYSCTL */ #if defined(CONFIG_SYSCTL) -int proc_do_static_key(struct ctl_table *table, int write, +int proc_do_static_key(const struct ctl_table *table, int write, void *buffer, size_t *lenp, loff_t *ppos) { struct static_key *key = (struct static_key *)table->data; diff --git a/kernel/time/timer.c b/kernel/time/timer.c index ff49ddcc9800..57bece67ad0e 100644 --- a/kernel/time/timer.c +++ b/kernel/time/timer.c @@ -289,8 +289,8 @@ static void timers_update_migration(void) } #ifdef CONFIG_SYSCTL -static int timer_migration_handler(struct ctl_table *table, int write, - void *buffer, size_t *lenp, loff_t *ppos) +static int timer_migration_handler(const struct ctl_table *table, int write, + void *buffer, size_t *lenp, loff_t *ppos) { int ret; diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c index 83ba342aef31..d3f77aff71c3 100644 --- a/kernel/trace/ftrace.c +++ b/kernel/trace/ftrace.c @@ -8217,7 +8217,7 @@ static bool is_permanent_ops_registered(void) } static int -ftrace_enable_sysctl(struct ctl_table *table, int write, +ftrace_enable_sysctl(const struct ctl_table *table, int write, void *buffer, size_t *lenp, loff_t *ppos) { int ret = -ENODEV; diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c index b12f8384a36a..2ae437ca5b73 100644 --- a/kernel/trace/trace.c +++ b/kernel/trace/trace.c @@ -2730,7 +2730,7 @@ static void output_printk(struct trace_event_buffer *fbuffer) raw_spin_unlock_irqrestore(&tracepoint_iter_lock, flags); } -int tracepoint_printk_sysctl(struct ctl_table *table, int write, +int tracepoint_printk_sysctl(const struct ctl_table *table, int write, void *buffer, size_t *lenp, loff_t *ppos) { diff --git a/kernel/trace/trace_events_user.c b/kernel/trace/trace_events_user.c index 70d428c394b6..00547aad3972 100644 --- a/kernel/trace/trace_events_user.c +++ b/kernel/trace/trace_events_user.c @@ -2811,7 +2811,8 @@ static int create_user_tracefs(void) return -ENODEV; } -static int set_max_user_events_sysctl(struct ctl_table *table, int write, +static int set_max_user_events_sysctl(const struct ctl_table *table, + int write, void *buffer, size_t *lenp, loff_t *ppos) { int ret; diff --git a/kernel/trace/trace_stack.c b/kernel/trace/trace_stack.c index 5a48dba912ea..7f9572a37333 100644 --- a/kernel/trace/trace_stack.c +++ b/kernel/trace/trace_stack.c @@ -514,7 +514,7 @@ static const struct file_operations stack_trace_filter_fops = { #endif /* CONFIG_DYNAMIC_FTRACE */ int -stack_trace_sysctl(struct ctl_table *table, int write, void *buffer, +stack_trace_sysctl(const struct ctl_table *table, int write, void *buffer, size_t *lenp, loff_t *ppos) { int was_enabled; diff --git a/kernel/umh.c b/kernel/umh.c index 1b13c5d34624..43bc45be8997 100644 --- a/kernel/umh.c +++ b/kernel/umh.c @@ -495,8 +495,8 @@ int call_usermodehelper(const char *path, char **argv, char **envp, int wait) EXPORT_SYMBOL(call_usermodehelper); #if defined(CONFIG_SYSCTL) -static int proc_cap_handler(struct ctl_table *table, int write, - void *buffer, size_t *lenp, loff_t *ppos) +static int proc_cap_handler(const struct ctl_table *table, int write, + void *buffer, size_t *lenp, loff_t *ppos) { struct ctl_table t; unsigned long cap_array[2]; diff --git a/kernel/utsname_sysctl.c b/kernel/utsname_sysctl.c index 46590d4addc8..653727aae63b 100644 --- a/kernel/utsname_sysctl.c +++ b/kernel/utsname_sysctl.c @@ -30,8 +30,8 @@ static void *get_uts(const struct ctl_table *table) * Special case of dostring for the UTS structure. This has locks * to observe. Should this be in kernel/sys.c ???? */ -static int proc_do_uts_string(struct ctl_table *table, int write, - void *buffer, size_t *lenp, loff_t *ppos) +static int proc_do_uts_string(const struct ctl_table *table, int write, + void *buffer, size_t *lenp, loff_t *ppos) { struct ctl_table uts_table; int r; diff --git a/kernel/watchdog.c b/kernel/watchdog.c index d7b2125503af..e9d0b854b587 100644 --- a/kernel/watchdog.c +++ b/kernel/watchdog.c @@ -769,8 +769,9 @@ static void proc_watchdog_update(void) * -------------------|----------------------------------|------------------------------- * proc_soft_watchdog | watchdog_softlockup_user_enabled | WATCHDOG_SOFTOCKUP_ENABLED */ -static int proc_watchdog_common(int which, struct ctl_table *table, int write, - void *buffer, size_t *lenp, loff_t *ppos) +static int proc_watchdog_common(int which, const struct ctl_table *table, + int write, void *buffer, size_t *lenp, + loff_t *ppos) { int err, old, *param = table->data; @@ -796,7 +797,7 @@ static int proc_watchdog_common(int which, struct ctl_table *table, int write, /* * /proc/sys/kernel/watchdog */ -static int proc_watchdog(struct ctl_table *table, int write, +static int proc_watchdog(const struct ctl_table *table, int write, void *buffer, size_t *lenp, loff_t *ppos) { return proc_watchdog_common(WATCHDOG_HARDLOCKUP_ENABLED | @@ -807,7 +808,7 @@ static int proc_watchdog(struct ctl_table *table, int write, /* * /proc/sys/kernel/nmi_watchdog */ -static int proc_nmi_watchdog(struct ctl_table *table, int write, +static int proc_nmi_watchdog(const struct ctl_table *table, int write, void *buffer, size_t *lenp, loff_t *ppos) { if (!watchdog_hardlockup_available && write) @@ -820,7 +821,7 @@ static int proc_nmi_watchdog(struct ctl_table *table, int write, /* * /proc/sys/kernel/soft_watchdog */ -static int proc_soft_watchdog(struct ctl_table *table, int write, +static int proc_soft_watchdog(const struct ctl_table *table, int write, void *buffer, size_t *lenp, loff_t *ppos) { return proc_watchdog_common(WATCHDOG_SOFTOCKUP_ENABLED, @@ -831,7 +832,7 @@ static int proc_soft_watchdog(struct ctl_table *table, int write, /* * /proc/sys/kernel/watchdog_thresh */ -static int proc_watchdog_thresh(struct ctl_table *table, int write, +static int proc_watchdog_thresh(const struct ctl_table *table, int write, void *buffer, size_t *lenp, loff_t *ppos) { int err, old; @@ -854,7 +855,7 @@ static int proc_watchdog_thresh(struct ctl_table *table, int write, * user to specify a mask that will include cpus that have not yet * been brought online, if desired. */ -static int proc_watchdog_cpumask(struct ctl_table *table, int write, +static int proc_watchdog_cpumask(const struct ctl_table *table, int write, void *buffer, size_t *lenp, loff_t *ppos) { int err; diff --git a/mm/compaction.c b/mm/compaction.c index 807b58e6eb68..6b8db0442365 100644 --- a/mm/compaction.c +++ b/mm/compaction.c @@ -2950,8 +2950,11 @@ static int compact_nodes(void) return 0; } -static int compaction_proactiveness_sysctl_handler(struct ctl_table *table, int write, - void *buffer, size_t *length, loff_t *ppos) +static int compaction_proactiveness_sysctl_handler(const struct ctl_table *table, + int write, + void *buffer, + size_t *length, + loff_t *ppos) { int rc, nid; @@ -2980,8 +2983,9 @@ static int compaction_proactiveness_sysctl_handler(struct ctl_table *table, int * This is the entry point for compacting all nodes via * /proc/sys/vm/compact_memory */ -static int sysctl_compaction_handler(struct ctl_table *table, int write, - void *buffer, size_t *length, loff_t *ppos) +static int sysctl_compaction_handler(const struct ctl_table *table, int write, + void *buffer, size_t *length, + loff_t *ppos) { int ret; @@ -3291,8 +3295,9 @@ static int kcompactd_cpu_online(unsigned int cpu) return 0; } -static int proc_dointvec_minmax_warn_RT_change(struct ctl_table *table, - int write, void *buffer, size_t *lenp, loff_t *ppos) +static int proc_dointvec_minmax_warn_RT_change(const struct ctl_table *table, + int write, void *buffer, + size_t *lenp, loff_t *ppos) { int ret, old; diff --git a/mm/hugetlb.c b/mm/hugetlb.c index b0d89ab98eaa..8b4c87820a38 100644 --- a/mm/hugetlb.c +++ b/mm/hugetlb.c @@ -4968,8 +4968,8 @@ static int hugetlb_sysctl_handler_common(bool obey_mempolicy, return ret; } -static int hugetlb_sysctl_handler(struct ctl_table *table, int write, - void *buffer, size_t *length, loff_t *ppos) +static int hugetlb_sysctl_handler(const struct ctl_table *table, int write, + void *buffer, size_t *length, loff_t *ppos) { return hugetlb_sysctl_handler_common(false, table, write, @@ -4977,16 +4977,20 @@ static int hugetlb_sysctl_handler(struct ctl_table *table, int write, } #ifdef CONFIG_NUMA -static int hugetlb_mempolicy_sysctl_handler(struct ctl_table *table, int write, - void *buffer, size_t *length, loff_t *ppos) +static int hugetlb_mempolicy_sysctl_handler(const struct ctl_table *table, + int write, + void *buffer, size_t *length, + loff_t *ppos) { return hugetlb_sysctl_handler_common(true, table, write, buffer, length, ppos); } #endif /* CONFIG_NUMA */ -static int hugetlb_overcommit_handler(struct ctl_table *table, int write, - void *buffer, size_t *length, loff_t *ppos) +static int hugetlb_overcommit_handler(const struct ctl_table *table, + int write, + void *buffer, size_t *length, + loff_t *ppos) { struct hstate *h = &default_hstate; unsigned long tmp; diff --git a/mm/page-writeback.c b/mm/page-writeback.c index 3e19b87049db..e23c1e353e81 100644 --- a/mm/page-writeback.c +++ b/mm/page-writeback.c @@ -493,8 +493,10 @@ bool node_dirty_ok(struct pglist_data *pgdat) } #ifdef CONFIG_SYSCTL -static int dirty_background_ratio_handler(struct ctl_table *table, int write, - void *buffer, size_t *lenp, loff_t *ppos) +static int dirty_background_ratio_handler(const struct ctl_table *table, + int write, + void *buffer, size_t *lenp, + loff_t *ppos) { int ret; @@ -504,8 +506,10 @@ static int dirty_background_ratio_handler(struct ctl_table *table, int write, return ret; } -static int dirty_background_bytes_handler(struct ctl_table *table, int write, - void *buffer, size_t *lenp, loff_t *ppos) +static int dirty_background_bytes_handler(const struct ctl_table *table, + int write, + void *buffer, size_t *lenp, + loff_t *ppos) { int ret; @@ -515,8 +519,9 @@ static int dirty_background_bytes_handler(struct ctl_table *table, int write, return ret; } -static int dirty_ratio_handler(struct ctl_table *table, int write, void *buffer, - size_t *lenp, loff_t *ppos) +static int dirty_ratio_handler(const struct ctl_table *table, int write, + void *buffer, + size_t *lenp, loff_t *ppos) { int old_ratio = vm_dirty_ratio; int ret; @@ -529,8 +534,8 @@ static int dirty_ratio_handler(struct ctl_table *table, int write, void *buffer, return ret; } -static int dirty_bytes_handler(struct ctl_table *table, int write, - void *buffer, size_t *lenp, loff_t *ppos) +static int dirty_bytes_handler(const struct ctl_table *table, int write, + void *buffer, size_t *lenp, loff_t *ppos) { unsigned long old_bytes = vm_dirty_bytes; int ret; @@ -2132,8 +2137,10 @@ bool wb_over_bg_thresh(struct bdi_writeback *wb) /* * sysctl handler for /proc/sys/vm/dirty_writeback_centisecs */ -static int dirty_writeback_centisecs_handler(struct ctl_table *table, int write, - void *buffer, size_t *length, loff_t *ppos) +static int dirty_writeback_centisecs_handler(const struct ctl_table *table, + int write, + void *buffer, size_t *length, + loff_t *ppos) { unsigned int old_interval = dirty_writeback_interval; int ret; diff --git a/mm/page_alloc.c b/mm/page_alloc.c index 14d39f34d336..ec9171e89f58 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c @@ -5002,8 +5002,10 @@ static char numa_zonelist_order[] = "Node"; /* * sysctl handler for numa_zonelist_order */ -static int numa_zonelist_order_handler(struct ctl_table *table, int write, - void *buffer, size_t *length, loff_t *ppos) +static int numa_zonelist_order_handler(const struct ctl_table *table, + int write, + void *buffer, size_t *length, + loff_t *ppos) { if (write) return __parse_numa_zonelist_order(buffer); @@ -5992,8 +5994,10 @@ postcore_initcall(init_per_zone_wmark_min) * that we can call two helper functions whenever min_free_kbytes * changes. */ -static int min_free_kbytes_sysctl_handler(struct ctl_table *table, int write, - void *buffer, size_t *length, loff_t *ppos) +static int min_free_kbytes_sysctl_handler(const struct ctl_table *table, + int write, + void *buffer, size_t *length, + loff_t *ppos) { int rc; @@ -6008,8 +6012,10 @@ static int min_free_kbytes_sysctl_handler(struct ctl_table *table, int write, return 0; } -static int watermark_scale_factor_sysctl_handler(struct ctl_table *table, int write, - void *buffer, size_t *length, loff_t *ppos) +static int watermark_scale_factor_sysctl_handler(const struct ctl_table *table, + int write, + void *buffer, size_t *length, + loff_t *ppos) { int rc; @@ -6038,8 +6044,11 @@ static void setup_min_unmapped_ratio(void) } -static int sysctl_min_unmapped_ratio_sysctl_handler(struct ctl_table *table, int write, - void *buffer, size_t *length, loff_t *ppos) +static int sysctl_min_unmapped_ratio_sysctl_handler(const struct ctl_table *table, + int write, + void *buffer, + size_t *length, + loff_t *ppos) { int rc; @@ -6065,8 +6074,10 @@ static void setup_min_slab_ratio(void) sysctl_min_slab_ratio) / 100; } -static int sysctl_min_slab_ratio_sysctl_handler(struct ctl_table *table, int write, - void *buffer, size_t *length, loff_t *ppos) +static int sysctl_min_slab_ratio_sysctl_handler(const struct ctl_table *table, + int write, + void *buffer, size_t *length, + loff_t *ppos) { int rc; @@ -6089,8 +6100,9 @@ static int sysctl_min_slab_ratio_sysctl_handler(struct ctl_table *table, int wri * minimum watermarks. The lowmem reserve ratio can only make sense * if in function of the boot time zone sizes. */ -static int lowmem_reserve_ratio_sysctl_handler(struct ctl_table *table, - int write, void *buffer, size_t *length, loff_t *ppos) +static int lowmem_reserve_ratio_sysctl_handler(const struct ctl_table *table, + int write, void *buffer, + size_t *length, loff_t *ppos) { int i; @@ -6110,8 +6122,11 @@ static int lowmem_reserve_ratio_sysctl_handler(struct ctl_table *table, * cpu. It is the fraction of total pages in each zone that a hot per cpu * pagelist can have before it gets flushed back to buddy allocator. */ -static int percpu_pagelist_high_fraction_sysctl_handler(struct ctl_table *table, - int write, void *buffer, size_t *length, loff_t *ppos) +static int percpu_pagelist_high_fraction_sysctl_handler(const struct ctl_table *table, + int write, + void *buffer, + size_t *length, + loff_t *ppos) { struct zone *zone; int old_percpu_pagelist_high_fraction; diff --git a/mm/util.c b/mm/util.c index 669397235787..c975b805679d 100644 --- a/mm/util.c +++ b/mm/util.c @@ -835,8 +835,9 @@ int sysctl_max_map_count __read_mostly = DEFAULT_MAX_MAP_COUNT; unsigned long sysctl_user_reserve_kbytes __read_mostly = 1UL << 17; /* 128MB */ unsigned long sysctl_admin_reserve_kbytes __read_mostly = 1UL << 13; /* 8MB */ -int overcommit_ratio_handler(struct ctl_table *table, int write, void *buffer, - size_t *lenp, loff_t *ppos) +int overcommit_ratio_handler(const struct ctl_table *table, int write, + void *buffer, + size_t *lenp, loff_t *ppos) { int ret; @@ -851,8 +852,9 @@ static void sync_overcommit_as(struct work_struct *dummy) percpu_counter_sync(&vm_committed_as); } -int overcommit_policy_handler(struct ctl_table *table, int write, void *buffer, - size_t *lenp, loff_t *ppos) +int overcommit_policy_handler(const struct ctl_table *table, int write, + void *buffer, + size_t *lenp, loff_t *ppos) { struct ctl_table t; int new_policy = -1; @@ -887,8 +889,9 @@ int overcommit_policy_handler(struct ctl_table *table, int write, void *buffer, return ret; } -int overcommit_kbytes_handler(struct ctl_table *table, int write, void *buffer, - size_t *lenp, loff_t *ppos) +int overcommit_kbytes_handler(const struct ctl_table *table, int write, + void *buffer, + size_t *lenp, loff_t *ppos) { int ret; diff --git a/mm/vmstat.c b/mm/vmstat.c index db79935e4a54..8e6d32af43fe 100644 --- a/mm/vmstat.c +++ b/mm/vmstat.c @@ -74,8 +74,8 @@ static void invalid_numa_statistics(void) static DEFINE_MUTEX(vm_numa_stat_lock); -int sysctl_vm_numa_stat_handler(struct ctl_table *table, int write, - void *buffer, size_t *length, loff_t *ppos) +int sysctl_vm_numa_stat_handler(const struct ctl_table *table, int write, + void *buffer, size_t *length, loff_t *ppos) { int ret, oldval; @@ -1884,7 +1884,7 @@ static void refresh_vm_stats(struct work_struct *work) refresh_cpu_vm_stats(true); } -int vmstat_refresh(struct ctl_table *table, int write, +int vmstat_refresh(const struct ctl_table *table, int write, void *buffer, size_t *lenp, loff_t *ppos) { long val; diff --git a/net/bridge/br_netfilter_hooks.c b/net/bridge/br_netfilter_hooks.c index 35e10c5a766d..86c24072544e 100644 --- a/net/bridge/br_netfilter_hooks.c +++ b/net/bridge/br_netfilter_hooks.c @@ -1170,7 +1170,7 @@ int br_nf_hook_thresh(unsigned int hook, struct net *net, #ifdef CONFIG_SYSCTL static -int brnf_sysctl_call_tables(struct ctl_table *ctl, int write, +int brnf_sysctl_call_tables(const struct ctl_table *ctl, int write, void *buffer, size_t *lenp, loff_t *ppos) { int ret; diff --git a/net/core/neighbour.c b/net/core/neighbour.c index 1fb71107accf..fd0b9a4136a6 100644 --- a/net/core/neighbour.c +++ b/net/core/neighbour.c @@ -3538,7 +3538,7 @@ EXPORT_SYMBOL(neigh_app_ns); #ifdef CONFIG_SYSCTL static int unres_qlen_max = INT_MAX / SKB_TRUESIZE(ETH_FRAME_LEN); -static int proc_unres_qlen(struct ctl_table *ctl, int write, +static int proc_unres_qlen(const struct ctl_table *ctl, int write, void *buffer, size_t *lenp, loff_t *ppos) { int size, ret; @@ -3590,7 +3590,8 @@ static void neigh_proc_update(const struct ctl_table *ctl, int write) neigh_copy_dflt_parms(net, p, index); } -static int neigh_proc_dointvec_zero_intmax(struct ctl_table *ctl, int write, +static int neigh_proc_dointvec_zero_intmax(const struct ctl_table *ctl, + int write, void *buffer, size_t *lenp, loff_t *ppos) { @@ -3605,7 +3606,8 @@ static int neigh_proc_dointvec_zero_intmax(struct ctl_table *ctl, int write, return ret; } -static int neigh_proc_dointvec_ms_jiffies_positive(struct ctl_table *ctl, int write, +static int neigh_proc_dointvec_ms_jiffies_positive(const struct ctl_table *ctl, + int write, void *buffer, size_t *lenp, loff_t *ppos) { struct ctl_table tmp = *ctl; @@ -3621,7 +3623,7 @@ static int neigh_proc_dointvec_ms_jiffies_positive(struct ctl_table *ctl, int wr return ret; } -int neigh_proc_dointvec(struct ctl_table *ctl, int write, void *buffer, +int neigh_proc_dointvec(const struct ctl_table *ctl, int write, void *buffer, size_t *lenp, loff_t *ppos) { int ret = proc_dointvec(ctl, write, buffer, lenp, ppos); @@ -3631,7 +3633,8 @@ int neigh_proc_dointvec(struct ctl_table *ctl, int write, void *buffer, } EXPORT_SYMBOL(neigh_proc_dointvec); -int neigh_proc_dointvec_jiffies(struct ctl_table *ctl, int write, void *buffer, +int neigh_proc_dointvec_jiffies(const struct ctl_table *ctl, int write, + void *buffer, size_t *lenp, loff_t *ppos) { int ret = proc_dointvec_jiffies(ctl, write, buffer, lenp, ppos); @@ -3641,7 +3644,8 @@ int neigh_proc_dointvec_jiffies(struct ctl_table *ctl, int write, void *buffer, } EXPORT_SYMBOL(neigh_proc_dointvec_jiffies); -static int neigh_proc_dointvec_userhz_jiffies(struct ctl_table *ctl, int write, +static int neigh_proc_dointvec_userhz_jiffies(const struct ctl_table *ctl, + int write, void *buffer, size_t *lenp, loff_t *ppos) { @@ -3651,7 +3655,7 @@ static int neigh_proc_dointvec_userhz_jiffies(struct ctl_table *ctl, int write, return ret; } -int neigh_proc_dointvec_ms_jiffies(struct ctl_table *ctl, int write, +int neigh_proc_dointvec_ms_jiffies(const struct ctl_table *ctl, int write, void *buffer, size_t *lenp, loff_t *ppos) { int ret = proc_dointvec_ms_jiffies(ctl, write, buffer, lenp, ppos); @@ -3661,7 +3665,8 @@ int neigh_proc_dointvec_ms_jiffies(struct ctl_table *ctl, int write, } EXPORT_SYMBOL(neigh_proc_dointvec_ms_jiffies); -static int neigh_proc_dointvec_unres_qlen(struct ctl_table *ctl, int write, +static int neigh_proc_dointvec_unres_qlen(const struct ctl_table *ctl, + int write, void *buffer, size_t *lenp, loff_t *ppos) { @@ -3671,7 +3676,8 @@ static int neigh_proc_dointvec_unres_qlen(struct ctl_table *ctl, int write, return ret; } -static int neigh_proc_base_reachable_time(struct ctl_table *ctl, int write, +static int neigh_proc_base_reachable_time(const struct ctl_table *ctl, + int write, void *buffer, size_t *lenp, loff_t *ppos) { diff --git a/net/core/sysctl_net_core.c b/net/core/sysctl_net_core.c index 6973dda3abda..6bb2e573ede4 100644 --- a/net/core/sysctl_net_core.c +++ b/net/core/sysctl_net_core.c @@ -94,7 +94,7 @@ static struct cpumask *rps_default_mask_cow_alloc(struct net *net) return rps_default_mask; } -static int rps_default_mask_sysctl(struct ctl_table *table, int write, +static int rps_default_mask_sysctl(const struct ctl_table *table, int write, void *buffer, size_t *lenp, loff_t *ppos) { struct net *net = (struct net *)table->data; @@ -125,7 +125,7 @@ static int rps_default_mask_sysctl(struct ctl_table *table, int write, return err; } -static int rps_sock_flow_sysctl(struct ctl_table *table, int write, +static int rps_sock_flow_sysctl(const struct ctl_table *table, int write, void *buffer, size_t *lenp, loff_t *ppos) { unsigned int orig_size, size; @@ -197,7 +197,7 @@ static int rps_sock_flow_sysctl(struct ctl_table *table, int write, #ifdef CONFIG_NET_FLOW_LIMIT static DEFINE_MUTEX(flow_limit_update_mutex); -static int flow_limit_cpu_sysctl(struct ctl_table *table, int write, +static int flow_limit_cpu_sysctl(const struct ctl_table *table, int write, void *buffer, size_t *lenp, loff_t *ppos) { struct sd_flow_limit *cur; @@ -254,7 +254,8 @@ static int flow_limit_cpu_sysctl(struct ctl_table *table, int write, return ret; } -static int flow_limit_table_len_sysctl(struct ctl_table *table, int write, +static int flow_limit_table_len_sysctl(const struct ctl_table *table, + int write, void *buffer, size_t *lenp, loff_t *ppos) { unsigned int old, *ptr; @@ -276,7 +277,7 @@ static int flow_limit_table_len_sysctl(struct ctl_table *table, int write, #endif /* CONFIG_NET_FLOW_LIMIT */ #ifdef CONFIG_NET_SCHED -static int set_default_qdisc(struct ctl_table *table, int write, +static int set_default_qdisc(const struct ctl_table *table, int write, void *buffer, size_t *lenp, loff_t *ppos) { char id[IFNAMSIZ]; @@ -295,8 +296,8 @@ static int set_default_qdisc(struct ctl_table *table, int write, } #endif -static int proc_do_dev_weight(struct ctl_table *table, int write, - void *buffer, size_t *lenp, loff_t *ppos) +static int proc_do_dev_weight(const struct ctl_table *table, int write, + void *buffer, size_t *lenp, loff_t *ppos) { static DEFINE_MUTEX(dev_weight_mutex); int ret, weight; @@ -313,7 +314,7 @@ static int proc_do_dev_weight(struct ctl_table *table, int write, return ret; } -static int proc_do_rss_key(struct ctl_table *table, int write, +static int proc_do_rss_key(const struct ctl_table *table, int write, void *buffer, size_t *lenp, loff_t *ppos) { struct ctl_table fake_table; @@ -326,7 +327,8 @@ static int proc_do_rss_key(struct ctl_table *table, int write, } #ifdef CONFIG_BPF_JIT -static int proc_dointvec_minmax_bpf_enable(struct ctl_table *table, int write, +static int proc_dointvec_minmax_bpf_enable(const struct ctl_table *table, + int write, void *buffer, size_t *lenp, loff_t *ppos) { @@ -359,7 +361,7 @@ static int proc_dointvec_minmax_bpf_enable(struct ctl_table *table, int write, # ifdef CONFIG_HAVE_EBPF_JIT static int -proc_dointvec_minmax_bpf_restricted(struct ctl_table *table, int write, +proc_dointvec_minmax_bpf_restricted(const struct ctl_table *table, int write, void *buffer, size_t *lenp, loff_t *ppos) { if (!capable(CAP_SYS_ADMIN)) @@ -370,7 +372,7 @@ proc_dointvec_minmax_bpf_restricted(struct ctl_table *table, int write, # endif /* CONFIG_HAVE_EBPF_JIT */ static int -proc_dolongvec_minmax_bpf_restricted(struct ctl_table *table, int write, +proc_dolongvec_minmax_bpf_restricted(const struct ctl_table *table, int write, void *buffer, size_t *lenp, loff_t *ppos) { if (!capable(CAP_SYS_ADMIN)) diff --git a/net/ipv4/devinet.c b/net/ipv4/devinet.c index 7a437f0d4190..b19b18211767 100644 --- a/net/ipv4/devinet.c +++ b/net/ipv4/devinet.c @@ -2377,7 +2377,7 @@ static int devinet_conf_ifindex(struct net *net, struct ipv4_devconf *cnf) } } -static int devinet_conf_proc(struct ctl_table *ctl, int write, +static int devinet_conf_proc(const struct ctl_table *ctl, int write, void *buffer, size_t *lenp, loff_t *ppos) { int old_value = *(int *)ctl->data; @@ -2429,7 +2429,7 @@ static int devinet_conf_proc(struct ctl_table *ctl, int write, return ret; } -static int devinet_sysctl_forward(struct ctl_table *ctl, int write, +static int devinet_sysctl_forward(const struct ctl_table *ctl, int write, void *buffer, size_t *lenp, loff_t *ppos) { int *valp = ctl->data; @@ -2476,7 +2476,7 @@ static int devinet_sysctl_forward(struct ctl_table *ctl, int write, return ret; } -static int ipv4_doint_and_flush(struct ctl_table *ctl, int write, +static int ipv4_doint_and_flush(const struct ctl_table *ctl, int write, void *buffer, size_t *lenp, loff_t *ppos) { int *valp = ctl->data; diff --git a/net/ipv4/route.c b/net/ipv4/route.c index c8f76f56dc16..4eea59e06671 100644 --- a/net/ipv4/route.c +++ b/net/ipv4/route.c @@ -3408,8 +3408,8 @@ static int ip_rt_gc_min_interval __read_mostly = HZ / 2; static int ip_rt_gc_elasticity __read_mostly = 8; static int ip_min_valid_pmtu __read_mostly = IPV4_MIN_MTU; -static int ipv4_sysctl_rtcache_flush(struct ctl_table *__ctl, int write, - void *buffer, size_t *lenp, loff_t *ppos) +static int ipv4_sysctl_rtcache_flush(const struct ctl_table *__ctl, int write, + void *buffer, size_t *lenp, loff_t *ppos) { struct net *net = (struct net *)__ctl->extra1; diff --git a/net/ipv4/sysctl_net_ipv4.c b/net/ipv4/sysctl_net_ipv4.c index 363dc2a487ac..383270a2d227 100644 --- a/net/ipv4/sysctl_net_ipv4.c +++ b/net/ipv4/sysctl_net_ipv4.c @@ -62,7 +62,7 @@ static void set_local_port_range(struct net *net, unsigned int low, unsigned int } /* Validate changes from /proc interface. */ -static int ipv4_local_port_range(struct ctl_table *table, int write, +static int ipv4_local_port_range(const struct ctl_table *table, int write, void *buffer, size_t *lenp, loff_t *ppos) { struct net *net = table->data; @@ -96,8 +96,8 @@ static int ipv4_local_port_range(struct ctl_table *table, int write, } /* Validate changes from /proc interface. */ -static int ipv4_privileged_ports(struct ctl_table *table, int write, - void *buffer, size_t *lenp, loff_t *ppos) +static int ipv4_privileged_ports(const struct ctl_table *table, int write, + void *buffer, size_t *lenp, loff_t *ppos) { struct net *net = container_of(table->data, struct net, ipv4.sysctl_ip_prot_sock); @@ -159,7 +159,7 @@ static void set_ping_group_range(const struct ctl_table *table, } /* Validate changes from /proc interface. */ -static int ipv4_ping_group_range(struct ctl_table *table, int write, +static int ipv4_ping_group_range(const struct ctl_table *table, int write, void *buffer, size_t *lenp, loff_t *ppos) { struct user_namespace *user_ns = current_user_ns(); @@ -194,7 +194,7 @@ static int ipv4_ping_group_range(struct ctl_table *table, int write, return ret; } -static int ipv4_fwd_update_priority(struct ctl_table *table, int write, +static int ipv4_fwd_update_priority(const struct ctl_table *table, int write, void *buffer, size_t *lenp, loff_t *ppos) { struct net *net; @@ -210,7 +210,7 @@ static int ipv4_fwd_update_priority(struct ctl_table *table, int write, return ret; } -static int proc_tcp_congestion_control(struct ctl_table *ctl, int write, +static int proc_tcp_congestion_control(const struct ctl_table *ctl, int write, void *buffer, size_t *lenp, loff_t *ppos) { struct net *net = container_of(ctl->data, struct net, @@ -230,7 +230,7 @@ static int proc_tcp_congestion_control(struct ctl_table *ctl, int write, return ret; } -static int proc_tcp_available_congestion_control(struct ctl_table *ctl, +static int proc_tcp_available_congestion_control(const struct ctl_table *ctl, int write, void *buffer, size_t *lenp, loff_t *ppos) { @@ -246,7 +246,7 @@ static int proc_tcp_available_congestion_control(struct ctl_table *ctl, return ret; } -static int proc_allowed_congestion_control(struct ctl_table *ctl, +static int proc_allowed_congestion_control(const struct ctl_table *ctl, int write, void *buffer, size_t *lenp, loff_t *ppos) { @@ -283,7 +283,7 @@ static int sscanf_key(char *buf, __le32 *key) return ret; } -static int proc_tcp_fastopen_key(struct ctl_table *table, int write, +static int proc_tcp_fastopen_key(const struct ctl_table *table, int write, void *buffer, size_t *lenp, loff_t *ppos) { struct net *net = container_of(table->data, struct net, @@ -354,7 +354,7 @@ static int proc_tcp_fastopen_key(struct ctl_table *table, int write, return ret; } -static int proc_tfo_blackhole_detect_timeout(struct ctl_table *table, +static int proc_tfo_blackhole_detect_timeout(const struct ctl_table *table, int write, void *buffer, size_t *lenp, loff_t *ppos) { @@ -369,8 +369,8 @@ static int proc_tfo_blackhole_detect_timeout(struct ctl_table *table, return ret; } -static int proc_tcp_available_ulp(struct ctl_table *ctl, - int write, void *buffer, size_t *lenp, +static int proc_tcp_available_ulp(const struct ctl_table *ctl, int write, + void *buffer, size_t *lenp, loff_t *ppos) { struct ctl_table tbl = { .maxlen = TCP_ULP_BUF_MAX, }; @@ -386,7 +386,7 @@ static int proc_tcp_available_ulp(struct ctl_table *ctl, return ret; } -static int proc_tcp_ehash_entries(struct ctl_table *table, int write, +static int proc_tcp_ehash_entries(const struct ctl_table *table, int write, void *buffer, size_t *lenp, loff_t *ppos) { struct net *net = container_of(table->data, struct net, @@ -410,7 +410,7 @@ static int proc_tcp_ehash_entries(struct ctl_table *table, int write, return proc_dointvec(&tbl, write, buffer, lenp, ppos); } -static int proc_udp_hash_entries(struct ctl_table *table, int write, +static int proc_udp_hash_entries(const struct ctl_table *table, int write, void *buffer, size_t *lenp, loff_t *ppos) { struct net *net = container_of(table->data, struct net, @@ -434,7 +434,8 @@ static int proc_udp_hash_entries(struct ctl_table *table, int write, } #ifdef CONFIG_IP_ROUTE_MULTIPATH -static int proc_fib_multipath_hash_policy(struct ctl_table *table, int write, +static int proc_fib_multipath_hash_policy(const struct ctl_table *table, + int write, void *buffer, size_t *lenp, loff_t *ppos) { @@ -449,7 +450,8 @@ static int proc_fib_multipath_hash_policy(struct ctl_table *table, int write, return ret; } -static int proc_fib_multipath_hash_fields(struct ctl_table *table, int write, +static int proc_fib_multipath_hash_fields(const struct ctl_table *table, + int write, void *buffer, size_t *lenp, loff_t *ppos) { diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c index c72f3b63e41d..8e9e655ed690 100644 --- a/net/ipv6/addrconf.c +++ b/net/ipv6/addrconf.c @@ -6305,8 +6305,8 @@ static void ipv6_ifa_notify(int event, struct inet6_ifaddr *ifp) #ifdef CONFIG_SYSCTL -static int addrconf_sysctl_forward(struct ctl_table *ctl, int write, - void *buffer, size_t *lenp, loff_t *ppos) +static int addrconf_sysctl_forward(const struct ctl_table *ctl, int write, + void *buffer, size_t *lenp, loff_t *ppos) { int *valp = ctl->data; int val = *valp; @@ -6330,8 +6330,8 @@ static int addrconf_sysctl_forward(struct ctl_table *ctl, int write, return ret; } -static int addrconf_sysctl_mtu(struct ctl_table *ctl, int write, - void *buffer, size_t *lenp, loff_t *ppos) +static int addrconf_sysctl_mtu(const struct ctl_table *ctl, int write, + void *buffer, size_t *lenp, loff_t *ppos) { struct inet6_dev *idev = ctl->extra1; int min_mtu = IPV6_MIN_MTU; @@ -6401,8 +6401,8 @@ static int addrconf_disable_ipv6(const struct ctl_table *table, int *p, int newf return 0; } -static int addrconf_sysctl_disable(struct ctl_table *ctl, int write, - void *buffer, size_t *lenp, loff_t *ppos) +static int addrconf_sysctl_disable(const struct ctl_table *ctl, int write, + void *buffer, size_t *lenp, loff_t *ppos) { int *valp = ctl->data; int val = *valp; @@ -6426,8 +6426,8 @@ static int addrconf_sysctl_disable(struct ctl_table *ctl, int write, return ret; } -static int addrconf_sysctl_proxy_ndp(struct ctl_table *ctl, int write, - void *buffer, size_t *lenp, loff_t *ppos) +static int addrconf_sysctl_proxy_ndp(const struct ctl_table *ctl, int write, + void *buffer, size_t *lenp, loff_t *ppos) { int *valp = ctl->data; int ret; @@ -6467,7 +6467,8 @@ static int addrconf_sysctl_proxy_ndp(struct ctl_table *ctl, int write, return ret; } -static int addrconf_sysctl_addr_gen_mode(struct ctl_table *ctl, int write, +static int addrconf_sysctl_addr_gen_mode(const struct ctl_table *ctl, + int write, void *buffer, size_t *lenp, loff_t *ppos) { @@ -6530,7 +6531,8 @@ static int addrconf_sysctl_addr_gen_mode(struct ctl_table *ctl, int write, return ret; } -static int addrconf_sysctl_stable_secret(struct ctl_table *ctl, int write, +static int addrconf_sysctl_stable_secret(const struct ctl_table *ctl, + int write, void *buffer, size_t *lenp, loff_t *ppos) { @@ -6598,7 +6600,7 @@ static int addrconf_sysctl_stable_secret(struct ctl_table *ctl, int write, } static -int addrconf_sysctl_ignore_routes_with_linkdown(struct ctl_table *ctl, +int addrconf_sysctl_ignore_routes_with_linkdown(const struct ctl_table *ctl, int write, void *buffer, size_t *lenp, loff_t *ppos) @@ -6698,8 +6700,10 @@ int addrconf_disable_policy(const struct ctl_table *ctl, int *valp, int val) return 0; } -static int addrconf_sysctl_disable_policy(struct ctl_table *ctl, int write, - void *buffer, size_t *lenp, loff_t *ppos) +static int addrconf_sysctl_disable_policy(const struct ctl_table *ctl, + int write, + void *buffer, size_t *lenp, + loff_t *ppos) { int *valp = ctl->data; int val = *valp; diff --git a/net/ipv6/ndisc.c b/net/ipv6/ndisc.c index 945d5f5ca039..2c95a5c8bfa1 100644 --- a/net/ipv6/ndisc.c +++ b/net/ipv6/ndisc.c @@ -1951,8 +1951,9 @@ static void ndisc_warn_deprecated_sysctl(const struct ctl_table *ctl, } } -int ndisc_ifinfo_sysctl_change(struct ctl_table *ctl, int write, void *buffer, - size_t *lenp, loff_t *ppos) +int ndisc_ifinfo_sysctl_change(const struct ctl_table *ctl, int write, + void *buffer, + size_t *lenp, loff_t *ppos) { struct net_device *dev = ctl->extra1; struct inet6_dev *idev; diff --git a/net/ipv6/route.c b/net/ipv6/route.c index 1f4b935a0e57..b434636cca1c 100644 --- a/net/ipv6/route.c +++ b/net/ipv6/route.c @@ -6329,8 +6329,8 @@ static int rt6_stats_seq_show(struct seq_file *seq, void *v) #ifdef CONFIG_SYSCTL -static int ipv6_sysctl_rtcache_flush(struct ctl_table *ctl, int write, - void *buffer, size_t *lenp, loff_t *ppos) +static int ipv6_sysctl_rtcache_flush(const struct ctl_table *ctl, int write, + void *buffer, size_t *lenp, loff_t *ppos) { struct net *net; int delay; diff --git a/net/ipv6/sysctl_net_ipv6.c b/net/ipv6/sysctl_net_ipv6.c index 888676163e90..2d19c119853f 100644 --- a/net/ipv6/sysctl_net_ipv6.c +++ b/net/ipv6/sysctl_net_ipv6.c @@ -30,7 +30,8 @@ static u32 rt6_multipath_hash_fields_all_mask = static u32 ioam6_id_max = IOAM6_DEFAULT_ID; static u64 ioam6_id_wide_max = IOAM6_DEFAULT_ID_WIDE; -static int proc_rt6_multipath_hash_policy(struct ctl_table *table, int write, +static int proc_rt6_multipath_hash_policy(const struct ctl_table *table, + int write, void *buffer, size_t *lenp, loff_t *ppos) { struct net *net; @@ -46,7 +47,8 @@ static int proc_rt6_multipath_hash_policy(struct ctl_table *table, int write, } static int -proc_rt6_multipath_hash_fields(struct ctl_table *table, int write, void *buffer, +proc_rt6_multipath_hash_fields(const struct ctl_table *table, int write, + void *buffer, size_t *lenp, loff_t *ppos) { struct net *net; diff --git a/net/mpls/af_mpls.c b/net/mpls/af_mpls.c index 6dab883a08dd..7138998e29c8 100644 --- a/net/mpls/af_mpls.c +++ b/net/mpls/af_mpls.c @@ -1363,7 +1363,7 @@ static int mpls_netconf_dump_devconf(struct sk_buff *skb, #define MPLS_PERDEV_SYSCTL_OFFSET(field) \ (&((struct mpls_dev *)0)->field) -static int mpls_conf_proc(struct ctl_table *ctl, int write, +static int mpls_conf_proc(const struct ctl_table *ctl, int write, void *buffer, size_t *lenp, loff_t *ppos) { int oval = *(int *)ctl->data; @@ -2617,7 +2617,7 @@ static int resize_platform_label_table(struct net *net, size_t limit) return -ENOMEM; } -static int mpls_platform_labels(struct ctl_table *table, int write, +static int mpls_platform_labels(const struct ctl_table *table, int write, void *buffer, size_t *lenp, loff_t *ppos) { struct net *net = table->data; diff --git a/net/netfilter/ipvs/ip_vs_ctl.c b/net/netfilter/ipvs/ip_vs_ctl.c index 689ac521ea2d..e34879f7a2f4 100644 --- a/net/netfilter/ipvs/ip_vs_ctl.c +++ b/net/netfilter/ipvs/ip_vs_ctl.c @@ -1846,7 +1846,7 @@ static int ip_vs_zero_all(struct netns_ipvs *ipvs) #ifdef CONFIG_SYSCTL static int -proc_do_defense_mode(struct ctl_table *table, int write, +proc_do_defense_mode(const struct ctl_table *table, int write, void *buffer, size_t *lenp, loff_t *ppos) { struct netns_ipvs *ipvs = table->extra2; @@ -1873,7 +1873,7 @@ proc_do_defense_mode(struct ctl_table *table, int write, } static int -proc_do_sync_threshold(struct ctl_table *table, int write, +proc_do_sync_threshold(const struct ctl_table *table, int write, void *buffer, size_t *lenp, loff_t *ppos) { struct netns_ipvs *ipvs = table->extra2; @@ -1901,7 +1901,7 @@ proc_do_sync_threshold(struct ctl_table *table, int write, } static int -proc_do_sync_ports(struct ctl_table *table, int write, +proc_do_sync_ports(const struct ctl_table *table, int write, void *buffer, size_t *lenp, loff_t *ppos) { int *valp = table->data; @@ -1984,7 +1984,7 @@ static int ipvs_proc_est_cpumask_get(const struct ctl_table *table, return ret; } -static int ipvs_proc_est_cpulist(struct ctl_table *table, int write, +static int ipvs_proc_est_cpulist(const struct ctl_table *table, int write, void *buffer, size_t *lenp, loff_t *ppos) { int ret; @@ -2011,7 +2011,7 @@ static int ipvs_proc_est_cpulist(struct ctl_table *table, int write, return ret; } -static int ipvs_proc_est_nice(struct ctl_table *table, int write, +static int ipvs_proc_est_nice(const struct ctl_table *table, int write, void *buffer, size_t *lenp, loff_t *ppos) { struct netns_ipvs *ipvs = table->extra2; @@ -2041,7 +2041,7 @@ static int ipvs_proc_est_nice(struct ctl_table *table, int write, return ret; } -static int ipvs_proc_run_estimation(struct ctl_table *table, int write, +static int ipvs_proc_run_estimation(const struct ctl_table *table, int write, void *buffer, size_t *lenp, loff_t *ppos) { struct netns_ipvs *ipvs = table->extra2; diff --git a/net/netfilter/nf_conntrack_standalone.c b/net/netfilter/nf_conntrack_standalone.c index 0ee98ce5b816..325b9094dca1 100644 --- a/net/netfilter/nf_conntrack_standalone.c +++ b/net/netfilter/nf_conntrack_standalone.c @@ -527,7 +527,7 @@ EXPORT_SYMBOL_GPL(nf_conntrack_count); static unsigned int nf_conntrack_htable_size_user __read_mostly; static int -nf_conntrack_hash_sysctl(struct ctl_table *table, int write, +nf_conntrack_hash_sysctl(const struct ctl_table *table, int write, void *buffer, size_t *lenp, loff_t *ppos) { int ret; diff --git a/net/netfilter/nf_hooks_lwtunnel.c b/net/netfilter/nf_hooks_lwtunnel.c index 00e89ffd78f6..3d237f9cc8ee 100644 --- a/net/netfilter/nf_hooks_lwtunnel.c +++ b/net/netfilter/nf_hooks_lwtunnel.c @@ -25,7 +25,7 @@ static inline int nf_hooks_lwtunnel_set(int enable) } #ifdef CONFIG_SYSCTL -int nf_hooks_lwtunnel_sysctl_handler(struct ctl_table *table, int write, +int nf_hooks_lwtunnel_sysctl_handler(const struct ctl_table *table, int write, void *buffer, size_t *lenp, loff_t *ppos) { int proc_nf_hooks_lwtunnel_enabled = 0; diff --git a/net/netfilter/nf_log.c b/net/netfilter/nf_log.c index 370f8231385c..7569532dbd43 100644 --- a/net/netfilter/nf_log.c +++ b/net/netfilter/nf_log.c @@ -409,8 +409,8 @@ static struct ctl_table nf_log_sysctl_ftable[] = { { } }; -static int nf_log_proc_dostring(struct ctl_table *table, int write, - void *buffer, size_t *lenp, loff_t *ppos) +static int nf_log_proc_dostring(const struct ctl_table *table, int write, + void *buffer, size_t *lenp, loff_t *ppos) { const struct nf_logger *logger; char buf[NFLOGGER_NAME_LEN]; diff --git a/net/phonet/sysctl.c b/net/phonet/sysctl.c index 0d0bf41381c2..e59d16e67376 100644 --- a/net/phonet/sysctl.c +++ b/net/phonet/sysctl.c @@ -48,7 +48,7 @@ void phonet_get_local_port_range(int *min, int *max) } while (read_seqretry(&local_port_range_lock, seq)); } -static int proc_local_port_range(struct ctl_table *table, int write, +static int proc_local_port_range(const struct ctl_table *table, int write, void *buffer, size_t *lenp, loff_t *ppos) { int ret; diff --git a/net/rds/tcp.c b/net/rds/tcp.c index 2dba7505b414..d23ea8c11902 100644 --- a/net/rds/tcp.c +++ b/net/rds/tcp.c @@ -61,7 +61,7 @@ static atomic_t rds_tcp_unloading = ATOMIC_INIT(0); static struct kmem_cache *rds_tcp_conn_slab; -static int rds_tcp_skbuf_handler(struct ctl_table *ctl, int write, +static int rds_tcp_skbuf_handler(const struct ctl_table *ctl, int write, void *buffer, size_t *lenp, loff_t *fpos); static int rds_tcp_min_sndbuf = SOCK_MIN_SNDBUF; @@ -683,7 +683,7 @@ static void rds_tcp_sysctl_reset(struct net *net) spin_unlock_irq(&rds_tcp_conn_lock); } -static int rds_tcp_skbuf_handler(struct ctl_table *ctl, int write, +static int rds_tcp_skbuf_handler(const struct ctl_table *ctl, int write, void *buffer, size_t *lenp, loff_t *fpos) { struct net *net = current->nsproxy->net_ns; diff --git a/net/sctp/sysctl.c b/net/sctp/sysctl.c index f65d6f92afcb..0849b4224676 100644 --- a/net/sctp/sysctl.c +++ b/net/sctp/sysctl.c @@ -43,19 +43,21 @@ static unsigned long max_autoclose_max = (MAX_SCHEDULE_TIMEOUT / HZ > UINT_MAX) ? UINT_MAX : MAX_SCHEDULE_TIMEOUT / HZ; -static int proc_sctp_do_hmac_alg(struct ctl_table *ctl, int write, +static int proc_sctp_do_hmac_alg(const struct ctl_table *ctl, int write, void *buffer, size_t *lenp, loff_t *ppos); -static int proc_sctp_do_rto_min(struct ctl_table *ctl, int write, +static int proc_sctp_do_rto_min(const struct ctl_table *ctl, int write, void *buffer, size_t *lenp, loff_t *ppos); -static int proc_sctp_do_rto_max(struct ctl_table *ctl, int write, void *buffer, +static int proc_sctp_do_rto_max(const struct ctl_table *ctl, int write, + void *buffer, size_t *lenp, loff_t *ppos); -static int proc_sctp_do_udp_port(struct ctl_table *ctl, int write, void *buffer, +static int proc_sctp_do_udp_port(const struct ctl_table *ctl, int write, + void *buffer, size_t *lenp, loff_t *ppos); -static int proc_sctp_do_alpha_beta(struct ctl_table *ctl, int write, +static int proc_sctp_do_alpha_beta(const struct ctl_table *ctl, int write, void *buffer, size_t *lenp, loff_t *ppos); -static int proc_sctp_do_auth(struct ctl_table *ctl, int write, +static int proc_sctp_do_auth(const struct ctl_table *ctl, int write, void *buffer, size_t *lenp, loff_t *ppos); -static int proc_sctp_do_probe_interval(struct ctl_table *ctl, int write, +static int proc_sctp_do_probe_interval(const struct ctl_table *ctl, int write, void *buffer, size_t *lenp, loff_t *ppos); static struct ctl_table sctp_table[] = { @@ -388,7 +390,7 @@ static struct ctl_table sctp_net_table[] = { { /* sentinel */ } }; -static int proc_sctp_do_hmac_alg(struct ctl_table *ctl, int write, +static int proc_sctp_do_hmac_alg(const struct ctl_table *ctl, int write, void *buffer, size_t *lenp, loff_t *ppos) { struct net *net = current->nsproxy->net_ns; @@ -433,7 +435,7 @@ static int proc_sctp_do_hmac_alg(struct ctl_table *ctl, int write, return ret; } -static int proc_sctp_do_rto_min(struct ctl_table *ctl, int write, +static int proc_sctp_do_rto_min(const struct ctl_table *ctl, int write, void *buffer, size_t *lenp, loff_t *ppos) { struct net *net = current->nsproxy->net_ns; @@ -461,7 +463,7 @@ static int proc_sctp_do_rto_min(struct ctl_table *ctl, int write, return ret; } -static int proc_sctp_do_rto_max(struct ctl_table *ctl, int write, +static int proc_sctp_do_rto_max(const struct ctl_table *ctl, int write, void *buffer, size_t *lenp, loff_t *ppos) { struct net *net = current->nsproxy->net_ns; @@ -489,7 +491,7 @@ static int proc_sctp_do_rto_max(struct ctl_table *ctl, int write, return ret; } -static int proc_sctp_do_alpha_beta(struct ctl_table *ctl, int write, +static int proc_sctp_do_alpha_beta(const struct ctl_table *ctl, int write, void *buffer, size_t *lenp, loff_t *ppos) { if (write) @@ -499,7 +501,7 @@ static int proc_sctp_do_alpha_beta(struct ctl_table *ctl, int write, return proc_dointvec_minmax(ctl, write, buffer, lenp, ppos); } -static int proc_sctp_do_auth(struct ctl_table *ctl, int write, +static int proc_sctp_do_auth(const struct ctl_table *ctl, int write, void *buffer, size_t *lenp, loff_t *ppos) { struct net *net = current->nsproxy->net_ns; @@ -528,7 +530,7 @@ static int proc_sctp_do_auth(struct ctl_table *ctl, int write, return ret; } -static int proc_sctp_do_udp_port(struct ctl_table *ctl, int write, +static int proc_sctp_do_udp_port(const struct ctl_table *ctl, int write, void *buffer, size_t *lenp, loff_t *ppos) { struct net *net = current->nsproxy->net_ns; @@ -569,7 +571,7 @@ static int proc_sctp_do_udp_port(struct ctl_table *ctl, int write, return ret; } -static int proc_sctp_do_probe_interval(struct ctl_table *ctl, int write, +static int proc_sctp_do_probe_interval(const struct ctl_table *ctl, int write, void *buffer, size_t *lenp, loff_t *ppos) { struct net *net = current->nsproxy->net_ns; diff --git a/net/sunrpc/sysctl.c b/net/sunrpc/sysctl.c index 93941ab12549..e3d6ceaee8fd 100644 --- a/net/sunrpc/sysctl.c +++ b/net/sunrpc/sysctl.c @@ -40,7 +40,7 @@ EXPORT_SYMBOL_GPL(nlm_debug); #if IS_ENABLED(CONFIG_SUNRPC_DEBUG) -static int proc_do_xprt(struct ctl_table *table, int write, +static int proc_do_xprt(const struct ctl_table *table, int write, void *buffer, size_t *lenp, loff_t *ppos) { char tmpbuf[256]; @@ -62,7 +62,8 @@ static int proc_do_xprt(struct ctl_table *table, int write, } static int -proc_dodebug(struct ctl_table *table, int write, void *buffer, size_t *lenp, +proc_dodebug(const struct ctl_table *table, int write, void *buffer, + size_t *lenp, loff_t *ppos) { char tmpbuf[20], *s = NULL; diff --git a/net/sunrpc/xprtrdma/svc_rdma.c b/net/sunrpc/xprtrdma/svc_rdma.c index f86970733eb0..09832e4945a3 100644 --- a/net/sunrpc/xprtrdma/svc_rdma.c +++ b/net/sunrpc/xprtrdma/svc_rdma.c @@ -74,7 +74,7 @@ enum { SVCRDMA_COUNTER_BUFSIZ = sizeof(unsigned long long), }; -static int svcrdma_counter_handler(struct ctl_table *table, int write, +static int svcrdma_counter_handler(const struct ctl_table *table, int write, void *buffer, size_t *lenp, loff_t *ppos) { struct percpu_counter *stat = (struct percpu_counter *)table->data; diff --git a/security/apparmor/lsm.c b/security/apparmor/lsm.c index 9a3dcaafb5b1..9b8d8d1b748b 100644 --- a/security/apparmor/lsm.c +++ b/security/apparmor/lsm.c @@ -2029,7 +2029,7 @@ static int __init alloc_buffers(void) } #ifdef CONFIG_SYSCTL -static int apparmor_dointvec(struct ctl_table *table, int write, +static int apparmor_dointvec(const struct ctl_table *table, int write, void *buffer, size_t *lenp, loff_t *ppos) { if (!aa_current_policy_admin_capable(NULL)) diff --git a/security/min_addr.c b/security/min_addr.c index 88c9a6a21f47..0ce267c041ab 100644 --- a/security/min_addr.c +++ b/security/min_addr.c @@ -29,7 +29,7 @@ static void update_mmap_min_addr(void) * sysctl handler which just sets dac_mmap_min_addr = the new value and then * calls update_mmap_min_addr() so non MAP_FIXED hints get rounded properly */ -int mmap_min_addr_handler(struct ctl_table *table, int write, +int mmap_min_addr_handler(const struct ctl_table *table, int write, void *buffer, size_t *lenp, loff_t *ppos) { int ret; diff --git a/security/yama/yama_lsm.c b/security/yama/yama_lsm.c index 49dc52b454ef..8c11e3f207a8 100644 --- a/security/yama/yama_lsm.c +++ b/security/yama/yama_lsm.c @@ -435,7 +435,7 @@ static struct security_hook_list yama_hooks[] __ro_after_init = { }; #ifdef CONFIG_SYSCTL -static int yama_dointvec_minmax(struct ctl_table *table, int write, +static int yama_dointvec_minmax(const struct ctl_table *table, int write, void *buffer, size_t *lenp, loff_t *ppos) { struct ctl_table table_copy; -- 2.44.0 _______________________________________________ linux-riscv mailing list linux-riscv@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-riscv
In a future commit the proc_handlers themselves will change to "const struct ctl_table". As a preparation for that adapt the internal helper. Signed-off-by: Thomas Weißschuh <linux@weissschuh.net> --- include/linux/sysctl.h | 2 +- kernel/sysctl.c | 21 +++++++++++---------- 2 files changed, 12 insertions(+), 11 deletions(-) diff --git a/include/linux/sysctl.h b/include/linux/sysctl.h index ee7d33b89e9e..99ea26b16c0d 100644 --- a/include/linux/sysctl.h +++ b/include/linux/sysctl.h @@ -238,7 +238,7 @@ extern struct ctl_table_header *register_sysctl_mount_point(const char *path); void do_sysctl_args(void); bool sysctl_is_alias(char *param); -int do_proc_douintvec(struct ctl_table *table, int write, +int do_proc_douintvec(const struct ctl_table *table, int write, void *buffer, size_t *lenp, loff_t *ppos, int (*conv)(unsigned long *lvalp, unsigned int *valp, diff --git a/kernel/sysctl.c b/kernel/sysctl.c index 157f7ce2942d..93824d8a3636 100644 --- a/kernel/sysctl.c +++ b/kernel/sysctl.c @@ -205,7 +205,7 @@ static int _proc_do_string(char *data, int maxlen, int write, return 0; } -static void warn_sysctl_write(struct ctl_table *table) +static void warn_sysctl_write(const struct ctl_table *table) { pr_warn_once("%s wrote to %s when file position was not 0!\n" "This will not be supported in the future. To silence this\n" @@ -223,7 +223,7 @@ static void warn_sysctl_write(struct ctl_table *table) * handlers can ignore the return value. */ static bool proc_first_pos_non_zero_ignore(loff_t *ppos, - struct ctl_table *table) + const struct ctl_table *table) { if (!*ppos) return false; @@ -468,7 +468,7 @@ static int do_proc_douintvec_conv(unsigned long *lvalp, static const char proc_wspace_sep[] = { ' ', '\t', '\n' }; -static int __do_proc_dointvec(void *tbl_data, struct ctl_table *table, +static int __do_proc_dointvec(void *tbl_data, const struct ctl_table *table, int write, void *buffer, size_t *lenp, loff_t *ppos, int (*conv)(bool *negp, unsigned long *lvalp, int *valp, @@ -541,7 +541,7 @@ static int __do_proc_dointvec(void *tbl_data, struct ctl_table *table, return err; } -static int do_proc_dointvec(struct ctl_table *table, int write, +static int do_proc_dointvec(const struct ctl_table *table, int write, void *buffer, size_t *lenp, loff_t *ppos, int (*conv)(bool *negp, unsigned long *lvalp, int *valp, int write, void *data), @@ -552,7 +552,7 @@ static int do_proc_dointvec(struct ctl_table *table, int write, } static int do_proc_douintvec_w(unsigned int *tbl_data, - struct ctl_table *table, + const struct ctl_table *table, void *buffer, size_t *lenp, loff_t *ppos, int (*conv)(unsigned long *lvalp, @@ -639,7 +639,7 @@ static int do_proc_douintvec_r(unsigned int *tbl_data, void *buffer, return err; } -static int __do_proc_douintvec(void *tbl_data, struct ctl_table *table, +static int __do_proc_douintvec(void *tbl_data, const struct ctl_table *table, int write, void *buffer, size_t *lenp, loff_t *ppos, int (*conv)(unsigned long *lvalp, @@ -675,7 +675,7 @@ static int __do_proc_douintvec(void *tbl_data, struct ctl_table *table, return do_proc_douintvec_r(i, buffer, lenp, ppos, conv, data); } -int do_proc_douintvec(struct ctl_table *table, int write, +int do_proc_douintvec(const struct ctl_table *table, int write, void *buffer, size_t *lenp, loff_t *ppos, int (*conv)(unsigned long *lvalp, unsigned int *valp, @@ -1023,8 +1023,9 @@ static int sysrq_sysctl_handler(struct ctl_table *table, int write, } #endif -static int __do_proc_doulongvec_minmax(void *data, struct ctl_table *table, - int write, void *buffer, size_t *lenp, loff_t *ppos, +static int __do_proc_doulongvec_minmax(void *data, + const struct ctl_table *table, int write, + void *buffer, size_t *lenp, loff_t *ppos, unsigned long convmul, unsigned long convdiv) { unsigned long *i, *min, *max; @@ -1096,7 +1097,7 @@ static int __do_proc_doulongvec_minmax(void *data, struct ctl_table *table, return err; } -static int do_proc_doulongvec_minmax(struct ctl_table *table, int write, +static int do_proc_doulongvec_minmax(const struct ctl_table *table, int write, void *buffer, size_t *lenp, loff_t *ppos, unsigned long convmul, unsigned long convdiv) { -- 2.44.0 _______________________________________________ linux-riscv mailing list linux-riscv@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-riscv
In a future commit the proc_handlers themselves will change to "const struct ctl_table". As a preparation for that adapt the internal helper. Signed-off-by: Thomas Weißschuh <linux@weissschuh.net> --- net/ipv6/ndisc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/net/ipv6/ndisc.c b/net/ipv6/ndisc.c index ae134634c323..945d5f5ca039 100644 --- a/net/ipv6/ndisc.c +++ b/net/ipv6/ndisc.c @@ -1936,7 +1936,7 @@ static struct notifier_block ndisc_netdev_notifier = { }; #ifdef CONFIG_SYSCTL -static void ndisc_warn_deprecated_sysctl(struct ctl_table *ctl, +static void ndisc_warn_deprecated_sysctl(const struct ctl_table *ctl, const char *func, const char *dev_name) { static char warncomm[TASK_COMM_LEN]; -- 2.44.0 _______________________________________________ linux-riscv mailing list linux-riscv@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-riscv
In a future commit the proc_handlers themselves will change to "const struct ctl_table". As a preparation for that adapt the internal helper. Signed-off-by: Thomas Weißschuh <linux@weissschuh.net> --- net/core/neighbour.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/net/core/neighbour.c b/net/core/neighbour.c index 552719c3bbc3..1fb71107accf 100644 --- a/net/core/neighbour.c +++ b/net/core/neighbour.c @@ -3573,7 +3573,7 @@ static void neigh_copy_dflt_parms(struct net *net, struct neigh_parms *p, rcu_read_unlock(); } -static void neigh_proc_update(struct ctl_table *ctl, int write) +static void neigh_proc_update(const struct ctl_table *ctl, int write) { struct net_device *dev = ctl->extra1; struct neigh_parms *p = ctl->extra2; -- 2.44.0 _______________________________________________ linux-riscv mailing list linux-riscv@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-riscv