Backmerging 5.2-rc1 to -misc-next for robher
Showing the changes to include/linux (333 of 10984 files). Show all
Unified · Split
| @@ -141,10 +141,14 @@ enum acpi_address_range_id { · 140 unmodified lines | ||
| 141 | 141 | |
| 142 | 142 | |
| 143 | 143 | /* Table Handlers */ |
| 144 | +union acpi_subtable_headers { | |
| 145 | + struct acpi_subtable_header common; | |
| 146 | + struct acpi_hmat_structure hmat; | |
| 147 | +}; | |
| 144 | 148 | |
| 145 | 149 | typedef int (*acpi_tbl_table_handler)(struct acpi_table_header *table); |
| 146 | 150 | |
| 147 | −typedef int (*acpi_tbl_entry_handler)(struct acpi_subtable_header *header, | |
| 151 | +typedef int (*acpi_tbl_entry_handler)(union acpi_subtable_headers *header, | |
| 148 | 152 | const unsigned long end); |
| 149 | 153 | |
| 150 | 154 | /* Debugger support */ |
| @@ -513,7 +517,8 @@ extern bool osc_pc_lpi_support_confirmed; · 362 unmodified lines | ||
| 513 | 517 | #define OSC_PCI_CLOCK_PM_SUPPORT 0x00000004 |
| 514 | 518 | #define OSC_PCI_SEGMENT_GROUPS_SUPPORT 0x00000008 |
| 515 | 519 | #define OSC_PCI_MSI_SUPPORT 0x00000010 |
| 516 | −#define OSC_PCI_SUPPORT_MASKS 0x0000001f | |
| 520 | +#define OSC_PCI_HPX_TYPE_3_SUPPORT 0x00000100 | |
| 521 | +#define OSC_PCI_SUPPORT_MASKS 0x0000011f | |
| 517 | 522 | |
| 518 | 523 | /* PCI Host Bridge _OSC: Capabilities DWORD 3: Control Field */ |
| 519 | 524 | #define OSC_PCI_EXPRESS_NATIVE_HP_CONTROL 0x00000001 |
| @@ -669,12 +674,14 @@ static inline bool acpi_dev_present(const char *hid, const char *uid, s64 hrv) · 149 unmodified lines | ||
| 669 | 674 | return false; |
| 670 | 675 | } |
| 671 | 676 | |
| 672 | −static inline const char * | |
| 673 | −acpi_dev_get_first_match_name(const char *hid, const char *uid, s64 hrv) | |
| 677 | +static inline struct acpi_device * | |
| 678 | +acpi_dev_get_first_match_dev(const char *hid, const char *uid, s64 hrv) | |
| 674 | 679 | { |
| 675 | 680 | return NULL; |
| 676 | 681 | } |
| 677 | 682 | |
| 683 | +static inline void acpi_dev_put(struct acpi_device *adev) {} | |
| 684 | + | |
| 678 | 685 | static inline bool is_acpi_node(struct fwnode_handle *fwnode) |
| 679 | 686 | { |
| 680 | 687 | return false; |
| @@ -26,6 +26,14 @@ · 25 unmodified lines | ||
| 26 | 26 | #define IORT_IRQ_MASK(irq) (irq & 0xffffffffULL) |
| 27 | 27 | #define IORT_IRQ_TRIGGER_MASK(irq) ((irq >> 32) & 0xffffffffULL) |
| 28 | 28 | |
| 29 | +/* | |
| 30 | + * PMCG model identifiers for use in smmu pmu driver. Please note | |
| 31 | + * that this is purely for the use of software and has nothing to | |
| 32 | + * do with hardware or with IORT specification. | |
| 33 | + */ | |
| 34 | +#define IORT_SMMU_V3_PMCG_GENERIC 0x00000000 /* Generic SMMUv3 PMCG */ | |
| 35 | +#define IORT_SMMU_V3_PMCG_HISI_HIP08 0x00000001 /* HiSilicon HIP08 PMCG */ | |
| 36 | + | |
| 29 | 37 | int iort_register_domain_token(int trans_id, phys_addr_t base, |
| 30 | 38 | struct fwnode_handle *fw_node); |
| 31 | 39 | void iort_deregister_domain_token(int trans_id); |
| @@ -23,7 +23,7 @@ · 22 unmodified lines | ||
| 23 | 23 | #define AU6601_BASE_CLOCK 31000000 |
| 24 | 24 | #define AU6601_MIN_CLOCK 150000 |
| 25 | 25 | #define AU6601_MAX_CLOCK 208000000 |
| 26 | −#define AU6601_MAX_DMA_SEGMENTS 1 | |
| 26 | +#define AU6601_MAX_DMA_SEGMENTS 64 | |
| 27 | 27 | #define AU6601_MAX_PIO_SEGMENTS 1 |
| 28 | 28 | #define AU6601_MAX_DMA_BLOCK_SIZE 0x1000 |
| 29 | 29 | #define AU6601_MAX_PIO_BLOCK_SIZE 0x200 |
| @@ -124,38 +124,11 @@ struct clcd_board { · 123 unmodified lines | ||
| 124 | 124 | struct amba_device; |
| 125 | 125 | struct clk; |
| 126 | 126 | |
| 127 | −/** | |
| 128 | − * struct clcd_vendor_data - holds hardware (IP-block) vendor-specific | |
| 129 | − * variant information | |
| 130 | − * | |
| 131 | − * @clock_timregs: the CLCD needs to be clocked when accessing the | |
| 132 | − * timer registers, or the hardware will hang. | |
| 133 | − * @packed_24_bit_pixels: this variant supports 24bit packed pixel data, | |
| 134 | − * so that RGB accesses 3 bytes at a time, not just on even 32bit | |
| 135 | − * boundaries, packing the pixel data in memory. ST Microelectronics | |
| 136 | − * have this. | |
| 137 | − * @st_bitmux_control: ST Microelectronics have implemented output | |
| 138 | − * bit line multiplexing into the CLCD control register. This indicates | |
| 139 | − * that we need to use this. | |
| 140 | − * @init_board: custom board init function for this variant | |
| 141 | − * @init_panel: custom panel init function for this variant | |
| 142 | − */ | |
| 143 | −struct clcd_vendor_data { | |
| 144 | − bool clock_timregs; | |
| 145 | − bool packed_24_bit_pixels; | |
| 146 | − bool st_bitmux_control; | |
| 147 | − int (*init_board)(struct amba_device *adev, | |
| 148 | − struct clcd_board *board); | |
| 149 | − int (*init_panel)(struct clcd_fb *fb, | |
| 150 | − struct device_node *panel); | |
| 151 | −}; | |
| 152 | − | |
| 153 | 127 | /* this data structure describes each frame buffer device we find */ |
| 154 | 128 | struct clcd_fb { |
| 155 | 129 | struct fb_info fb; |
| 156 | 130 | struct amba_device *dev; |
| 157 | 131 | struct clk *clk; |
| 158 | − struct clcd_vendor_data *vendor; | |
| 159 | 132 | struct clcd_panel *panel; |
| 160 | 133 | struct clcd_board *board; |
| 161 | 134 | void *board_data; |
| @@ -257,10 +230,6 @@ static inline void clcdfb_decode(struct clcd_fb *fb, struct clcd_regs *regs) · 95 unmodified lines | ||
| 257 | 230 | else |
| 258 | 231 | val |= CNTL_LCDBPP16_444; |
| 259 | 232 | break; |
| 260 | − case 24: | |
| 261 | − /* Modified variant supporting 24 bit packed pixels */ | |
| 262 | − val |= CNTL_ST_LCDBPP24_PACKED; | |
| 263 | − break; | |
| 264 | 233 | case 32: |
| 265 | 234 | val |= CNTL_LCDBPP24; |
| 266 | 235 | break; |
| @@ -0,0 +1,23 @@ | ||
| 1 | +/* SPDX-License-Identifier: GPL-2.0+ */ | |
| 2 | +/* | |
| 3 | + * rWTM BIU Mailbox driver for Armada 37xx | |
| 4 | + * | |
| 5 | + * Author: Marek Behun <marek.behun@nic.cz> | |
| 6 | + */ | |
| 7 | + | |
| 8 | +#ifndef _LINUX_ARMADA_37XX_RWTM_MAILBOX_H_ | |
| 9 | +#define _LINUX_ARMADA_37XX_RWTM_MAILBOX_H_ | |
| 10 | + | |
| 11 | +#include <linux/types.h> | |
| 12 | + | |
| 13 | +struct armada_37xx_rwtm_tx_msg { | |
| 14 | + u16 command; | |
| 15 | + u32 args[16]; | |
| 16 | +}; | |
| 17 | + | |
| 18 | +struct armada_37xx_rwtm_rx_msg { | |
| 19 | + u32 retval; | |
| 20 | + u32 status[16]; | |
| 21 | +}; | |
| 22 | + | |
| 23 | +#endif /* _LINUX_ARMADA_37XX_RWTM_MAILBOX_H_ */ | |
| @@ -1,270 +0,0 @@ | ||
| 1 | −/* | |
| 2 | − * Timer/Counter Unit (TC) registers. | |
| 3 | − * | |
| 4 | − * This program is free software; you can redistribute it and/or modify | |
| 5 | − * it under the terms of the GNU General Public License as published by | |
| 6 | − * the Free Software Foundation; either version 2 of the License, or | |
| 7 | − * (at your option) any later version. | |
| 8 | − */ | |
| 9 | − | |
| 10 | −#ifndef ATMEL_TC_H | |
| 11 | −#define ATMEL_TC_H | |
| 12 | − | |
| 13 | −#include <linux/compiler.h> | |
| 14 | −#include <linux/list.h> | |
| 15 | − | |
| 16 | −/* | |
| 17 | − * Many 32-bit Atmel SOCs include one or more TC blocks, each of which holds | |
| 18 | − * three general-purpose 16-bit timers. These timers share one register bank. | |
| 19 | − * Depending on the SOC, each timer may have its own clock and IRQ, or those | |
| 20 | − * may be shared by the whole TC block. | |
| 21 | − * | |
| 22 | − * These TC blocks may have up to nine external pins: TCLK0..2 signals for | |
| 23 | − * clocks or clock gates, and per-timer TIOA and TIOB signals used for PWM | |
| 24 | − * or triggering. Those pins need to be set up for use with the TC block, | |
| 25 | − * else they will be used as GPIOs or for a different controller. | |
| 26 | − * | |
| 27 | − * Although we expect each TC block to have a platform_device node, those | |
| 28 | − * nodes are not what drivers bind to. Instead, they ask for a specific | |
| 29 | − * TC block, by number ... which is a common approach on systems with many | |
| 30 | − * timers. Then they use clk_get() and platform_get_irq() to get clock and | |
| 31 | − * IRQ resources. | |
| 32 | − */ | |
| 33 | − | |
| 34 | −struct clk; | |
| 35 | − | |
| 36 | −/** | |
| 37 | − * struct atmel_tcb_config - SoC data for a Timer/Counter Block | |
| 38 | − * @counter_width: size in bits of a timer counter register | |
| 39 | − */ | |
| 40 | −struct atmel_tcb_config { | |
| 41 | − size_t counter_width; | |
| 42 | −}; | |
| 43 | − | |
| 44 | −/** | |
| 45 | − * struct atmel_tc - information about a Timer/Counter Block | |
| 46 | − * @pdev: physical device | |
| 47 | − * @regs: mapping through which the I/O registers can be accessed | |
| 48 | − * @id: block id | |
| 49 | − * @tcb_config: configuration data from SoC | |
| 50 | − * @irq: irq for each of the three channels | |
| 51 | − * @clk: internal clock source for each of the three channels | |
| 52 | − * @node: list node, for tclib internal use | |
| 53 | − * @allocated: if already used, for tclib internal use | |
| 54 | − * | |
| 55 | − * On some platforms, each TC channel has its own clocks and IRQs, | |
| 56 | − * while on others, all TC channels share the same clock and IRQ. | |
| 57 | − * Drivers should clk_enable() all the clocks they need even though | |
| 58 | − * all the entries in @clk may point to the same physical clock. | |
| 59 | − * Likewise, drivers should request irqs independently for each | |
| 60 | − * channel, but they must use IRQF_SHARED in case some of the entries | |
| 61 | − * in @irq are actually the same IRQ. | |
| 62 | − */ | |
| 63 | −struct atmel_tc { | |
| 64 | − struct platform_device *pdev; | |
| 65 | − void __iomem *regs; | |
| 66 | − int id; | |
| 67 | − const struct atmel_tcb_config *tcb_config; | |
| 68 | − int irq[3]; | |
| 69 | − struct clk *clk[3]; | |
| 70 | − struct clk *slow_clk; | |
| 71 | − struct list_head node; | |
| 72 | − bool allocated; | |
| 73 | −}; | |
| 74 | − | |
| 75 | −extern struct atmel_tc *atmel_tc_alloc(unsigned block); | |
| 76 | −extern void atmel_tc_free(struct atmel_tc *tc); | |
| 77 | − | |
| 78 | −/* platform-specific ATMEL_TC_TIMER_CLOCKx divisors (0 means 32KiHz) */ | |
| 79 | −extern const u8 atmel_tc_divisors[5]; | |
| 80 | − | |
| 81 | − | |
| 82 | −/* | |
| 83 | − * Two registers have block-wide controls. These are: configuring the three | |
| 84 | − * "external" clocks (or event sources) used by the timer channels; and | |
| 85 | − * synchronizing the timers by resetting them all at once. | |
| 86 | − * | |
| 87 | − * "External" can mean "external to chip" using the TCLK0, TCLK1, or TCLK2 | |
| 88 | − * signals. Or, it can mean "external to timer", using the TIOA output from | |
| 89 | − * one of the other two timers that's being run in waveform mode. | |
| 90 | − */ | |
| 91 | − | |
| 92 | −#define ATMEL_TC_BCR 0xc0 /* TC Block Control Register */ | |
| 93 | −#define ATMEL_TC_SYNC (1 << 0) /* synchronize timers */ | |
| 94 | − | |
| 95 | −#define ATMEL_TC_BMR 0xc4 /* TC Block Mode Register */ | |
| 96 | −#define ATMEL_TC_TC0XC0S (3 << 0) /* external clock 0 source */ | |
| 97 | −#define ATMEL_TC_TC0XC0S_TCLK0 (0 << 0) | |
| 98 | −#define ATMEL_TC_TC0XC0S_NONE (1 << 0) | |
| 99 | −#define ATMEL_TC_TC0XC0S_TIOA1 (2 << 0) | |
| 100 | −#define ATMEL_TC_TC0XC0S_TIOA2 (3 << 0) | |
| 101 | −#define ATMEL_TC_TC1XC1S (3 << 2) /* external clock 1 source */ | |
| 102 | −#define ATMEL_TC_TC1XC1S_TCLK1 (0 << 2) | |
| 103 | −#define ATMEL_TC_TC1XC1S_NONE (1 << 2) | |
| 104 | −#define ATMEL_TC_TC1XC1S_TIOA0 (2 << 2) | |
| 105 | −#define ATMEL_TC_TC1XC1S_TIOA2 (3 << 2) | |
| 106 | −#define ATMEL_TC_TC2XC2S (3 << 4) /* external clock 2 source */ | |
| 107 | −#define ATMEL_TC_TC2XC2S_TCLK2 (0 << 4) | |
| 108 | −#define ATMEL_TC_TC2XC2S_NONE (1 << 4) | |
| 109 | −#define ATMEL_TC_TC2XC2S_TIOA0 (2 << 4) | |
| 110 | −#define ATMEL_TC_TC2XC2S_TIOA1 (3 << 4) | |
| 111 | − | |
| 112 | − | |
| 113 | −/* | |
| 114 | − * Each TC block has three "channels", each with one counter and controls. | |
| 115 | − * | |
| 116 | − * Note that the semantics of ATMEL_TC_TIMER_CLOCKx (input clock selection | |
| 117 | − * when it's not "external") is silicon-specific. AT91 platforms use one | |
| 118 | − * set of definitions; AVR32 platforms use a different set. Don't hard-wire | |
| 119 | − * such knowledge into your code, use the global "atmel_tc_divisors" ... | |
| 120 | − * where index N is the divisor for clock N+1, else zero to indicate it uses | |
| 121 | − * the 32 KiHz clock. | |
| 122 | − * | |
| 123 | − * The timers can be chained in various ways, and operated in "waveform" | |
| 124 | − * generation mode (including PWM) or "capture" mode (to time events). In | |
| 125 | − * both modes, behavior can be configured in many ways. | |
| 126 | − * | |
| 127 | − * Each timer has two I/O pins, TIOA and TIOB. Waveform mode uses TIOA as a | |
| 128 | − * PWM output, and TIOB as either another PWM or as a trigger. Capture mode | |
| 129 | − * uses them only as inputs. | |
| 130 | − */ | |
| 131 | −#define ATMEL_TC_CHAN(idx) ((idx)*0x40) | |
| 132 | −#define ATMEL_TC_REG(idx, reg) (ATMEL_TC_CHAN(idx) + ATMEL_TC_ ## reg) | |
| 133 | − | |
| 134 | −#define ATMEL_TC_CCR 0x00 /* Channel Control Register */ | |
| 135 | −#define ATMEL_TC_CLKEN (1 << 0) /* clock enable */ | |
| 136 | −#define ATMEL_TC_CLKDIS (1 << 1) /* clock disable */ | |
| 137 | −#define ATMEL_TC_SWTRG (1 << 2) /* software trigger */ | |
| 138 | − | |
| 139 | −#define ATMEL_TC_CMR 0x04 /* Channel Mode Register */ | |
| 140 | − | |
| 141 | −/* Both modes share some CMR bits */ | |
| 142 | −#define ATMEL_TC_TCCLKS (7 << 0) /* clock source */ | |
| 143 | −#define ATMEL_TC_TIMER_CLOCK1 (0 << 0) | |
| 144 | −#define ATMEL_TC_TIMER_CLOCK2 (1 << 0) | |
| 145 | −#define ATMEL_TC_TIMER_CLOCK3 (2 << 0) | |
| 146 | −#define ATMEL_TC_TIMER_CLOCK4 (3 << 0) | |
| 147 | −#define ATMEL_TC_TIMER_CLOCK5 (4 << 0) | |
| 148 | −#define ATMEL_TC_XC0 (5 << 0) | |
| 149 | −#define ATMEL_TC_XC1 (6 << 0) | |
| 150 | −#define ATMEL_TC_XC2 (7 << 0) | |
| 151 | −#define ATMEL_TC_CLKI (1 << 3) /* clock invert */ | |
| 152 | −#define ATMEL_TC_BURST (3 << 4) /* clock gating */ | |
| 153 | −#define ATMEL_TC_GATE_NONE (0 << 4) | |
| 154 | −#define ATMEL_TC_GATE_XC0 (1 << 4) | |
| 155 | −#define ATMEL_TC_GATE_XC1 (2 << 4) | |
| 156 | −#define ATMEL_TC_GATE_XC2 (3 << 4) | |
| 157 | −#define ATMEL_TC_WAVE (1 << 15) /* true = Waveform mode */ | |
| 158 | − | |
| 159 | −/* CAPTURE mode CMR bits */ | |
| 160 | −#define ATMEL_TC_LDBSTOP (1 << 6) /* counter stops on RB load */ | |
| 161 | −#define ATMEL_TC_LDBDIS (1 << 7) /* counter disable on RB load */ | |
| 162 | −#define ATMEL_TC_ETRGEDG (3 << 8) /* external trigger edge */ | |
| 163 | −#define ATMEL_TC_ETRGEDG_NONE (0 << 8) | |
| 164 | −#define ATMEL_TC_ETRGEDG_RISING (1 << 8) | |
| 165 | −#define ATMEL_TC_ETRGEDG_FALLING (2 << 8) | |
| 166 | −#define ATMEL_TC_ETRGEDG_BOTH (3 << 8) | |
| 167 | −#define ATMEL_TC_ABETRG (1 << 10) /* external trigger is TIOA? */ | |
| 168 | −#define ATMEL_TC_CPCTRG (1 << 14) /* RC compare trigger enable */ | |
| 169 | −#define ATMEL_TC_LDRA (3 << 16) /* RA loading edge (of TIOA) */ | |
| 170 | −#define ATMEL_TC_LDRA_NONE (0 << 16) | |
| 171 | −#define ATMEL_TC_LDRA_RISING (1 << 16) | |
| 172 | −#define ATMEL_TC_LDRA_FALLING (2 << 16) | |
| 173 | −#define ATMEL_TC_LDRA_BOTH (3 << 16) | |
| 174 | −#define ATMEL_TC_LDRB (3 << 18) /* RB loading edge (of TIOA) */ | |
| 175 | −#define ATMEL_TC_LDRB_NONE (0 << 18) | |
| 176 | −#define ATMEL_TC_LDRB_RISING (1 << 18) | |
| 177 | −#define ATMEL_TC_LDRB_FALLING (2 << 18) | |
| 178 | −#define ATMEL_TC_LDRB_BOTH (3 << 18) | |
| 179 | − | |
| 180 | −/* WAVEFORM mode CMR bits */ | |
| 181 | −#define ATMEL_TC_CPCSTOP (1 << 6) /* RC compare stops counter */ | |
| 182 | −#define ATMEL_TC_CPCDIS (1 << 7) /* RC compare disables counter */ | |
| 183 | −#define ATMEL_TC_EEVTEDG (3 << 8) /* external event edge */ | |
| 184 | −#define ATMEL_TC_EEVTEDG_NONE (0 << 8) | |
| 185 | −#define ATMEL_TC_EEVTEDG_RISING (1 << 8) | |
| 186 | −#define ATMEL_TC_EEVTEDG_FALLING (2 << 8) | |
| 187 | −#define ATMEL_TC_EEVTEDG_BOTH (3 << 8) | |
| 188 | −#define ATMEL_TC_EEVT (3 << 10) /* external event source */ | |
| 189 | −#define ATMEL_TC_EEVT_TIOB (0 << 10) | |
| 190 | −#define ATMEL_TC_EEVT_XC0 (1 << 10) | |
| 191 | −#define ATMEL_TC_EEVT_XC1 (2 << 10) | |
| 192 | −#define ATMEL_TC_EEVT_XC2 (3 << 10) | |
| 193 | −#define ATMEL_TC_ENETRG (1 << 12) /* external event is trigger */ | |
| 194 | −#define ATMEL_TC_WAVESEL (3 << 13) /* waveform type */ | |
| 195 | −#define ATMEL_TC_WAVESEL_UP (0 << 13) | |
| 196 | −#define ATMEL_TC_WAVESEL_UPDOWN (1 << 13) | |
| 197 | −#define ATMEL_TC_WAVESEL_UP_AUTO (2 << 13) | |
| 198 | −#define ATMEL_TC_WAVESEL_UPDOWN_AUTO (3 << 13) | |
| 199 | −#define ATMEL_TC_ACPA (3 << 16) /* RA compare changes TIOA */ | |
| 200 | −#define ATMEL_TC_ACPA_NONE (0 << 16) | |
| 201 | −#define ATMEL_TC_ACPA_SET (1 << 16) | |
| 202 | −#define ATMEL_TC_ACPA_CLEAR (2 << 16) | |
| 203 | −#define ATMEL_TC_ACPA_TOGGLE (3 << 16) | |
| 204 | −#define ATMEL_TC_ACPC (3 << 18) /* RC compare changes TIOA */ | |
| 205 | −#define ATMEL_TC_ACPC_NONE (0 << 18) | |
| 206 | −#define ATMEL_TC_ACPC_SET (1 << 18) | |
| 207 | −#define ATMEL_TC_ACPC_CLEAR (2 << 18) | |
| 208 | −#define ATMEL_TC_ACPC_TOGGLE (3 << 18) | |
| 209 | −#define ATMEL_TC_AEEVT (3 << 20) /* external event changes TIOA */ | |
| 210 | −#define ATMEL_TC_AEEVT_NONE (0 << 20) | |
| 211 | −#define ATMEL_TC_AEEVT_SET (1 << 20) | |
| 212 | −#define ATMEL_TC_AEEVT_CLEAR (2 << 20) | |
| 213 | −#define ATMEL_TC_AEEVT_TOGGLE (3 << 20) | |
| 214 | −#define ATMEL_TC_ASWTRG (3 << 22) /* software trigger changes TIOA */ | |
| 215 | −#define ATMEL_TC_ASWTRG_NONE (0 << 22) | |
| 216 | −#define ATMEL_TC_ASWTRG_SET (1 << 22) | |
| 217 | −#define ATMEL_TC_ASWTRG_CLEAR (2 << 22) | |
| 218 | −#define ATMEL_TC_ASWTRG_TOGGLE (3 << 22) | |
| 219 | −#define ATMEL_TC_BCPB (3 << 24) /* RB compare changes TIOB */ | |
| 220 | −#define ATMEL_TC_BCPB_NONE (0 << 24) | |
| 221 | −#define ATMEL_TC_BCPB_SET (1 << 24) | |
| 222 | −#define ATMEL_TC_BCPB_CLEAR (2 << 24) | |
| 223 | −#define ATMEL_TC_BCPB_TOGGLE (3 << 24) | |
| 224 | −#define ATMEL_TC_BCPC (3 << 26) /* RC compare changes TIOB */ | |
| 225 | −#define ATMEL_TC_BCPC_NONE (0 << 26) | |
| 226 | −#define ATMEL_TC_BCPC_SET (1 << 26) | |
| 227 | −#define ATMEL_TC_BCPC_CLEAR (2 << 26) | |
| 228 | −#define ATMEL_TC_BCPC_TOGGLE (3 << 26) | |
| 229 | −#define ATMEL_TC_BEEVT (3 << 28) /* external event changes TIOB */ | |
| 230 | −#define ATMEL_TC_BEEVT_NONE (0 << 28) | |
| 231 | −#define ATMEL_TC_BEEVT_SET (1 << 28) | |
| 232 | −#define ATMEL_TC_BEEVT_CLEAR (2 << 28) | |
| 233 | −#define ATMEL_TC_BEEVT_TOGGLE (3 << 28) | |
| 234 | −#define ATMEL_TC_BSWTRG (3 << 30) /* software trigger changes TIOB */ | |
| 235 | −#define ATMEL_TC_BSWTRG_NONE (0 << 30) | |
| 236 | −#define ATMEL_TC_BSWTRG_SET (1 << 30) | |
| 237 | −#define ATMEL_TC_BSWTRG_CLEAR (2 << 30) | |
| 238 | −#define ATMEL_TC_BSWTRG_TOGGLE (3 << 30) | |
| 239 | − | |
| 240 | −#define ATMEL_TC_CV 0x10 /* counter Value */ | |
| 241 | −#define ATMEL_TC_RA 0x14 /* register A */ | |
| 242 | −#define ATMEL_TC_RB 0x18 /* register B */ | |
| 243 | −#define ATMEL_TC_RC 0x1c /* register C */ | |
| 244 | − | |
| 245 | −#define ATMEL_TC_SR 0x20 /* status (read-only) */ | |
| 246 | −/* Status-only flags */ | |
| 247 | −#define ATMEL_TC_CLKSTA (1 << 16) /* clock enabled */ | |
| 248 | −#define ATMEL_TC_MTIOA (1 << 17) /* TIOA mirror */ | |
| 249 | −#define ATMEL_TC_MTIOB (1 << 18) /* TIOB mirror */ | |
| 250 | − | |
| 251 | −#define ATMEL_TC_IER 0x24 /* interrupt enable (write-only) */ | |
| 252 | −#define ATMEL_TC_IDR 0x28 /* interrupt disable (write-only) */ | |
| 253 | −#define ATMEL_TC_IMR 0x2c /* interrupt mask (read-only) */ | |
| 254 | − | |
| 255 | −/* Status and IRQ flags */ | |
| 256 | −#define ATMEL_TC_COVFS (1 << 0) /* counter overflow */ | |
| 257 | −#define ATMEL_TC_LOVRS (1 << 1) /* load overrun */ | |
| 258 | −#define ATMEL_TC_CPAS (1 << 2) /* RA compare */ | |
| 259 | −#define ATMEL_TC_CPBS (1 << 3) /* RB compare */ | |
| 260 | −#define ATMEL_TC_CPCS (1 << 4) /* RC compare */ | |
| 261 | −#define ATMEL_TC_LDRAS (1 << 5) /* RA loading */ | |
| 262 | −#define ATMEL_TC_LDRBS (1 << 6) /* RB loading */ | |
| 263 | −#define ATMEL_TC_ETRGS (1 << 7) /* external trigger */ | |
| 264 | −#define ATMEL_TC_ALL_IRQ (ATMEL_TC_COVFS | ATMEL_TC_LOVRS | \ | |
| 265 | − ATMEL_TC_CPAS | ATMEL_TC_CPBS | \ | |
| 266 | − ATMEL_TC_CPCS | ATMEL_TC_LDRAS | \ | |
| 267 | − ATMEL_TC_LDRBS | ATMEL_TC_ETRGS) \ | |
| 268 | − /* all IRQs */ | |
| 269 | − | |
| 270 | −#endif | |
| @@ -86,6 +86,29 @@ struct audit_field { · 85 unmodified lines | ||
| 86 | 86 | u32 op; |
| 87 | 87 | }; |
| 88 | 88 | |
| 89 | +enum audit_ntp_type { | |
| 90 | + AUDIT_NTP_OFFSET, | |
| 91 | + AUDIT_NTP_FREQ, | |
| 92 | + AUDIT_NTP_STATUS, | |
| 93 | + AUDIT_NTP_TAI, | |
| 94 | + AUDIT_NTP_TICK, | |
| 95 | + AUDIT_NTP_ADJUST, | |
| 96 | + | |
| 97 | + AUDIT_NTP_NVALS /* count */ | |
| 98 | +}; | |
| 99 | + | |
| 100 | +#ifdef CONFIG_AUDITSYSCALL | |
| 101 | +struct audit_ntp_val { | |
| 102 | + long long oldval, newval; | |
| 103 | +}; | |
| 104 | + | |
| 105 | +struct audit_ntp_data { | |
| 106 | + struct audit_ntp_val vals[AUDIT_NTP_NVALS]; | |
| 107 | +}; | |
| 108 | +#else | |
| 109 | +struct audit_ntp_data {}; | |
| 110 | +#endif | |
| 111 | + | |
| 89 | 112 | extern int is_audit_feature_set(int which); |
| 90 | 113 | |
| 91 | 114 | extern int __init audit_register_class(int class, unsigned *list); |
| @@ -365,6 +388,8 @@ extern void __audit_log_capset(const struct cred *new, const struct cred *old); · 273 unmodified lines | ||
| 365 | 388 | extern void __audit_mmap_fd(int fd, int flags); |
| 366 | 389 | extern void __audit_log_kern_module(char *name); |
| 367 | 390 | extern void __audit_fanotify(unsigned int response); |
| 391 | +extern void __audit_tk_injoffset(struct timespec64 offset); | |
| 392 | +extern void __audit_ntp_log(const struct audit_ntp_data *ad); | |
| 368 | 393 | |
| 369 | 394 | static inline void audit_ipc_obj(struct kern_ipc_perm *ipcp) |
| 370 | 395 | { |
| @@ -467,6 +492,39 @@ static inline void audit_fanotify(unsigned int response) · 96 unmodified lines | ||
| 467 | 492 | __audit_fanotify(response); |
| 468 | 493 | } |
| 469 | 494 | |
| 495 | +static inline void audit_tk_injoffset(struct timespec64 offset) | |
| 496 | +{ | |
| 497 | + /* ignore no-op events */ | |
| 498 | + if (offset.tv_sec == 0 && offset.tv_nsec == 0) | |
| 499 | + return; | |
| 500 | + | |
| 501 | + if (!audit_dummy_context()) | |
| 502 | + __audit_tk_injoffset(offset); | |
| 503 | +} | |
| 504 | + | |
| 505 | +static inline void audit_ntp_init(struct audit_ntp_data *ad) | |
| 506 | +{ | |
| 507 | + memset(ad, 0, sizeof(*ad)); | |
| 508 | +} | |
| 509 | + | |
| 510 | +static inline void audit_ntp_set_old(struct audit_ntp_data *ad, | |
| 511 | + enum audit_ntp_type type, long long val) | |
| 512 | +{ | |
| 513 | + ad->vals[type].oldval = val; | |
| 514 | +} | |
| 515 | + | |
| 516 | +static inline void audit_ntp_set_new(struct audit_ntp_data *ad, | |
| 517 | + enum audit_ntp_type type, long long val) | |
| 518 | +{ | |
| 519 | + ad->vals[type].newval = val; | |
| 520 | +} | |
| 521 | + | |
| 522 | +static inline void audit_ntp_log(const struct audit_ntp_data *ad) | |
| 523 | +{ | |
| 524 | + if (!audit_dummy_context()) | |
| 525 | + __audit_ntp_log(ad); | |
| 526 | +} | |
| 527 | + | |
| 470 | 528 | extern int audit_n_rules; |
| 471 | 529 | extern int audit_signals; |
| 472 | 530 | #else /* CONFIG_AUDITSYSCALL */ |
| @@ -580,6 +638,23 @@ static inline void audit_log_kern_module(char *name) · 107 unmodified lines | ||
| 580 | 638 | static inline void audit_fanotify(unsigned int response) |
| 581 | 639 | { } |
| 582 | 640 | |
| 641 | +static inline void audit_tk_injoffset(struct timespec64 offset) | |
| 642 | +{ } | |
| 643 | + | |
| 644 | +static inline void audit_ntp_init(struct audit_ntp_data *ad) | |
| 645 | +{ } | |
| 646 | + | |
| 647 | +static inline void audit_ntp_set_old(struct audit_ntp_data *ad, | |
| 648 | + enum audit_ntp_type type, long long val) | |
| 649 | +{ } | |
| 650 | + | |
| 651 | +static inline void audit_ntp_set_new(struct audit_ntp_data *ad, | |
| 652 | + enum audit_ntp_type type, long long val) | |
| 653 | +{ } | |
| 654 | + | |
| 655 | +static inline void audit_ntp_log(const struct audit_ntp_data *ad) | |
| 656 | +{ } | |
| 657 | + | |
| 583 | 658 | static inline void audit_ptrace(struct task_struct *t) |
| 584 | 659 | { } |
| 585 | 660 | #define audit_n_rules 0 |
| @@ -151,21 +151,6 @@ static inline void balloon_page_delete(struct page *page) · 150 unmodified lines | ||
| 151 | 151 | list_del(&page->lru); |
| 152 | 152 | } |
| 153 | 153 | |
| 154 | −static inline bool __is_movable_balloon_page(struct page *page) | |
| 155 | −{ | |
| 156 | − return false; | |
| 157 | −} | |
| 158 | − | |
| 159 | −static inline bool balloon_page_movable(struct page *page) | |
| 160 | −{ | |
| 161 | − return false; | |
| 162 | −} | |
| 163 | − | |
| 164 | −static inline bool isolated_balloon_page(struct page *page) | |
| 165 | −{ | |
| 166 | − return false; | |
| 167 | −} | |
| 168 | − | |
| 169 | 154 | static inline bool balloon_page_isolate(struct page *page) |
| 170 | 155 | { |
| 171 | 156 | return false; |
| @@ -15,7 +15,6 @@ struct filename; · 14 unmodified lines | ||
| 15 | 15 | * This structure is used to hold the arguments that are used when loading binaries. |
| 16 | 16 | */ |
| 17 | 17 | struct linux_binprm { |
| 18 | − char buf[BINPRM_BUF_SIZE]; | |
| 19 | 18 | #ifdef CONFIG_MMU |
| 20 | 19 | struct vm_area_struct *vma; |
| 21 | 20 | unsigned long vma_pages; |
| @@ -64,6 +63,8 @@ struct linux_binprm { · 42 unmodified lines | ||
| 64 | 63 | unsigned long loader, exec; |
| 65 | 64 | |
| 66 | 65 | struct rlimit rlim_stack; /* Saved RLIMIT_STACK used during exec. */ |
| 66 | + | |
| 67 | + char buf[BINPRM_BUF_SIZE]; | |
| 67 | 68 | } __randomize_layout; |
| 68 | 69 | |
| 69 | 70 | #define BINPRM_FLAGS_ENFORCE_NONDUMP_BIT 0 |
| @@ -1,19 +1,6 @@ | ||
| 1 | +/* SPDX-License-Identifier: GPL-2.0 */ | |
| 1 | 2 | /* |
| 2 | 3 | * Copyright (C) 2001 Jens Axboe <axboe@suse.de> |
| 3 | − * | |
| 4 | − * This program is free software; you can redistribute it and/or modify | |
| 5 | − * it under the terms of the GNU General Public License version 2 as | |
| 6 | − * published by the Free Software Foundation. | |
| 7 | − * | |
| 8 | − * This program is distributed in the hope that it will be useful, | |
| 9 | − * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 10 | − * | |
| 11 | − * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
| 12 | − * GNU General Public License for more details. | |
| 13 | − * | |
| 14 | − * You should have received a copy of the GNU General Public Licens | |
| 15 | − * along with this program; if not, write to the Free Software | |
| 16 | − * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111- | |
| 17 | 4 | */ |
| 18 | 5 | #ifndef __LINUX_BIO_H |
| 19 | 6 | #define __LINUX_BIO_H |
| @@ -134,9 +121,8 @@ static inline bool bio_next_segment(const struct bio *bio, · 114 unmodified lines | ||
| 134 | 121 | * drivers should _never_ use the all version - the bio may have been split |
| 135 | 122 | * before it got to the driver and the driver won't own all of it |
| 136 | 123 | */ |
| 137 | −#define bio_for_each_segment_all(bvl, bio, i, iter) \ | |
| 138 | − for (i = 0, bvl = bvec_init_iter_all(&iter); \ | |
| 139 | − bio_next_segment((bio), &iter); i++) | |
| 124 | +#define bio_for_each_segment_all(bvl, bio, iter) \ | |
| 125 | + for (bvl = bvec_init_iter_all(&iter); bio_next_segment((bio), &iter); ) | |
| 140 | 126 | |
| 141 | 127 | static inline void bio_advance_iter(struct bio *bio, struct bvec_iter *iter, |
| 142 | 128 | unsigned bytes) |
| @@ -60,7 +60,7 @@ static __always_inline unsigned long hweight_long(unsigned long w) · 59 unmodified lines | ||
| 60 | 60 | */ |
| 61 | 61 | static inline __u64 rol64(__u64 word, unsigned int shift) |
| 62 | 62 | { |
| 63 | − return (word << shift) | (word >> (64 - shift)); | |
| 63 | + return (word << (shift & 63)) | (word >> ((-shift) & 63)); | |
| 64 | 64 | } |
| 65 | 65 | |
| 66 | 66 | /** |
| @@ -70,7 +70,7 @@ static inline __u64 rol64(__u64 word, unsigned int shift) · 3 unmodified lines | ||
| 70 | 70 | */ |
| 71 | 71 | static inline __u64 ror64(__u64 word, unsigned int shift) |
| 72 | 72 | { |
| 73 | − return (word >> shift) | (word << (64 - shift)); | |
| 73 | + return (word >> (shift & 63)) | (word << ((-shift) & 63)); | |
| 74 | 74 | } |
| 75 | 75 | |
| 76 | 76 | /** |
| @@ -80,7 +80,7 @@ static inline __u64 ror64(__u64 word, unsigned int shift) · 3 unmodified lines | ||
| 80 | 80 | */ |
| 81 | 81 | static inline __u32 rol32(__u32 word, unsigned int shift) |
| 82 | 82 | { |
| 83 | − return (word << shift) | (word >> ((-shift) & 31)); | |
| 83 | + return (word << (shift & 31)) | (word >> ((-shift) & 31)); | |
| 84 | 84 | } |
| 85 | 85 | |
| 86 | 86 | /** |
| @@ -90,7 +90,7 @@ static inline __u32 rol32(__u32 word, unsigned int shift) · 3 unmodified lines | ||
| 90 | 90 | */ |
| 91 | 91 | static inline __u32 ror32(__u32 word, unsigned int shift) |
| 92 | 92 | { |
| 93 | − return (word >> shift) | (word << (32 - shift)); | |
| 93 | + return (word >> (shift & 31)) | (word << ((-shift) & 31)); | |
| 94 | 94 | } |
| 95 | 95 | |
| 96 | 96 | /** |
| @@ -100,7 +100,7 @@ static inline __u32 ror32(__u32 word, unsigned int shift) · 3 unmodified lines | ||
| 100 | 100 | */ |
| 101 | 101 | static inline __u16 rol16(__u16 word, unsigned int shift) |
| 102 | 102 | { |
| 103 | − return (word << shift) | (word >> (16 - shift)); | |
| 103 | + return (word << (shift & 15)) | (word >> ((-shift) & 15)); | |
| 104 | 104 | } |
| 105 | 105 | |
| 106 | 106 | /** |
| @@ -110,7 +110,7 @@ static inline __u16 rol16(__u16 word, unsigned int shift) · 3 unmodified lines | ||
| 110 | 110 | */ |
| 111 | 111 | static inline __u16 ror16(__u16 word, unsigned int shift) |
| 112 | 112 | { |
| 113 | − return (word >> shift) | (word << (16 - shift)); | |
| 113 | + return (word >> (shift & 15)) | (word << ((-shift) & 15)); | |
| 114 | 114 | } |
| 115 | 115 | |
| 116 | 116 | /** |
| @@ -120,7 +120,7 @@ static inline __u16 ror16(__u16 word, unsigned int shift) · 3 unmodified lines | ||
| 120 | 120 | */ |
| 121 | 121 | static inline __u8 rol8(__u8 word, unsigned int shift) |
| 122 | 122 | { |
| 123 | − return (word << shift) | (word >> (8 - shift)); | |
| 123 | + return (word << (shift & 7)) | (word >> ((-shift) & 7)); | |
| 124 | 124 | } |
| 125 | 125 | |
| 126 | 126 | /** |
| @@ -130,7 +130,7 @@ static inline __u8 rol8(__u8 word, unsigned int shift) · 3 unmodified lines | ||
| 130 | 130 | */ |
| 131 | 131 | static inline __u8 ror8(__u8 word, unsigned int shift) |
| 132 | 132 | { |
| 133 | − return (word >> shift) | (word << (8 - shift)); | |
| 133 | + return (word >> (shift & 7)) | (word << ((-shift) & 7)); | |
| 134 | 134 | } |
| 135 | 135 | |
| 136 | 136 | /** |
| @@ -1,3 +1,4 @@ | ||
| 1 | +/* SPDX-License-Identifier: GPL-2.0 */ | |
| 1 | 2 | #ifndef _LINUX_BLK_MQ_RDMA_H |
| 2 | 3 | #define _LINUX_BLK_MQ_RDMA_H |
| 3 | 4 | |
| @@ -70,6 +70,8 @@ struct blk_mq_hw_ctx { · 69 unmodified lines | ||
| 70 | 70 | struct dentry *sched_debugfs_dir; |
| 71 | 71 | #endif |
| 72 | 72 | |
| 73 | + struct list_head hctx_list; | |
| 74 | + | |
| 73 | 75 | /* Must be the last member - see also blk_mq_hw_ctx_size(). */ |
| 74 | 76 | struct srcu_struct srcu[0]; |
| 75 | 77 | }; |
| @@ -215,21 +215,24 @@ struct bio { · 214 unmodified lines | ||
| 215 | 215 | /* |
| 216 | 216 | * bio flags |
| 217 | 217 | */ |
| 218 | −#define BIO_NO_PAGE_REF 0 /* don't put release vec pages */ | |
| 219 | −#define BIO_SEG_VALID 1 /* bi_phys_segments valid */ | |
| 220 | −#define BIO_CLONED 2 /* doesn't own data */ | |
| 221 | −#define BIO_BOUNCED 3 /* bio is a bounce bio */ | |
| 222 | −#define BIO_USER_MAPPED 4 /* contains user pages */ | |
| 223 | −#define BIO_NULL_MAPPED 5 /* contains invalid user pages */ | |
| 224 | −#define BIO_QUIET 6 /* Make BIO Quiet */ | |
| 225 | −#define BIO_CHAIN 7 /* chained bio, ->bi_remaining in effect */ | |
| 226 | −#define BIO_REFFED 8 /* bio has elevated ->bi_cnt */ | |
| 227 | −#define BIO_THROTTLED 9 /* This bio has already been subjected to | |
| 218 | +enum { | |
| 219 | + BIO_NO_PAGE_REF, /* don't put release vec pages */ | |
| 220 | + BIO_SEG_VALID, /* bi_phys_segments valid */ | |
| 221 | + BIO_CLONED, /* doesn't own data */ | |
| 222 | + BIO_BOUNCED, /* bio is a bounce bio */ | |
| 223 | + BIO_USER_MAPPED, /* contains user pages */ | |
| 224 | + BIO_NULL_MAPPED, /* contains invalid user pages */ | |
| 225 | + BIO_QUIET, /* Make BIO Quiet */ | |
| 226 | + BIO_CHAIN, /* chained bio, ->bi_remaining in effect */ | |
| 227 | + BIO_REFFED, /* bio has elevated ->bi_cnt */ | |
| 228 | + BIO_THROTTLED, /* This bio has already been subjected to | |
| 228 | 229 | * throttling rules. Don't do it again. */ |
| 229 | −#define BIO_TRACE_COMPLETION 10 /* bio_endio() should trace the final completion | |
| 230 | + BIO_TRACE_COMPLETION, /* bio_endio() should trace the final completion | |
| 230 | 231 | * of this bio. */ |
| 231 | −#define BIO_QUEUE_ENTERED 11 /* can use blk_queue_enter_live() */ | |
| 232 | −#define BIO_TRACKED 12 /* set if bio goes through the rq_qos path */ | |
| 232 | + BIO_QUEUE_ENTERED, /* can use blk_queue_enter_live() */ | |
| 233 | + BIO_TRACKED, /* set if bio goes through the rq_qos path */ | |
| 234 | + BIO_FLAG_LAST | |
| 235 | +}; | |
| 233 | 236 | |
| 234 | 237 | /* See BVEC_POOL_OFFSET below before adding new flags */ |
| 235 | 238 | |
| @@ -535,6 +535,13 @@ struct request_queue { · 534 unmodified lines | ||
| 535 | 535 | |
| 536 | 536 | struct mutex sysfs_lock; |
| 537 | 537 | |
| 538 | + /* | |
| 539 | + * for reusing dead hctx instance in case of updating | |
| 540 | + * nr_hw_queues | |
| 541 | + */ | |
| 542 | + struct list_head unused_hctx_list; | |
| 543 | + spinlock_t unused_hctx_lock; | |
| 544 | + | |
| 538 | 545 | atomic_t mq_freeze_depth; |
| 539 | 546 | |
| 540 | 547 | #if defined(CONFIG_BLK_DEV_BSG) |
| @@ -548,7 +555,6 @@ struct request_queue { · 7 unmodified lines | ||
| 548 | 555 | struct rcu_head rcu_head; |
| 549 | 556 | wait_queue_head_t mq_freeze_wq; |
| 550 | 557 | struct percpu_ref q_usage_counter; |
| 551 | − struct list_head all_q_node; | |
| 552 | 558 | |
| 553 | 559 | struct blk_mq_tag_set *tag_set; |
| 554 | 560 | struct list_head tag_set_list; |
| @@ -641,6 +647,13 @@ static inline bool blk_account_rq(struct request *rq) · 86 unmodified lines | ||
| 641 | 647 | |
| 642 | 648 | #define rq_data_dir(rq) (op_is_write(req_op(rq)) ? WRITE : READ) |
| 643 | 649 | |
| 650 | +#define rq_dma_dir(rq) \ | |
| 651 | + (op_is_write(req_op(rq)) ? DMA_TO_DEVICE : DMA_FROM_DEVICE) | |
| 652 | + | |
| 653 | +#define dma_map_bvec(dev, bv, dir, attrs) \ | |
| 654 | + dma_map_page_attrs(dev, (bv)->bv_page, (bv)->bv_offset, (bv)->bv_len, \ | |
| 655 | + (dir), (attrs)) | |
| 656 | + | |
| 644 | 657 | static inline bool queue_is_mq(struct request_queue *q) |
| 645 | 658 | { |
| 646 | 659 | return q->mq_ops; |
| @@ -932,6 +945,17 @@ static inline unsigned int blk_rq_payload_bytes(struct request *rq) · 285 unmodified lines | ||
| 932 | 945 | return blk_rq_bytes(rq); |
| 933 | 946 | } |
| 934 | 947 | |
| 948 | +/* | |
| 949 | + * Return the first full biovec in the request. The caller needs to check that | |
| 950 | + * there are any bvecs before calling this helper. | |
| 951 | + */ | |
| 952 | +static inline struct bio_vec req_bvec(struct request *rq) | |
| 953 | +{ | |
| 954 | + if (rq->rq_flags & RQF_SPECIAL_PAYLOAD) | |
| 955 | + return rq->special_vec; | |
| 956 | + return mp_bvec_iter_bvec(rq->bio->bi_io_vec, rq->bio->bi_iter); | |
| 957 | +} | |
| 958 | + | |
| 935 | 959 | static inline unsigned int blk_queue_get_max_sectors(struct request_queue *q, |
| 936 | 960 | int op) |
| 937 | 961 | { |
| @@ -1052,7 +1076,6 @@ extern int bdev_stack_limits(struct queue_limits *t, struct block_device *bdev, · 114 unmodified lines | ||
| 1052 | 1076 | extern void disk_stack_limits(struct gendisk *disk, struct block_device *bdev, |
| 1053 | 1077 | sector_t offset); |
| 1054 | 1078 | extern void blk_queue_stack_limits(struct request_queue *t, struct request_queue *b); |
| 1055 | −extern void blk_queue_dma_pad(struct request_queue *, unsigned int); | |
| 1056 | 1079 | extern void blk_queue_update_dma_pad(struct request_queue *, unsigned int); |
| 1057 | 1080 | extern int blk_queue_dma_drain(struct request_queue *q, |
| 1058 | 1081 | dma_drain_needed_fn *dma_drain_needed, |
| @@ -1548,6 +1571,17 @@ static inline unsigned int bio_integrity_bytes(struct blk_integrity *bi, · 489 unmodified lines | ||
| 1548 | 1571 | return bio_integrity_intervals(bi, sectors) * bi->tuple_size; |
| 1549 | 1572 | } |
| 1550 | 1573 | |
| 1574 | +/* | |
| 1575 | + * Return the first bvec that contains integrity data. Only drivers that are | |
| 1576 | + * limited to a single integrity segment should use this helper. | |
| 1577 | + */ | |
| 1578 | +static inline struct bio_vec *rq_integrity_vec(struct request *rq) | |
| 1579 | +{ | |
| 1580 | + if (WARN_ON_ONCE(queue_max_integrity_segments(rq->q) > 1)) | |
| 1581 | + return NULL; | |
| 1582 | + return rq->bio->bi_integrity->bip_vec; | |
| 1583 | +} | |
| 1584 | + | |
| 1551 | 1585 | #else /* CONFIG_BLK_DEV_INTEGRITY */ |
| 1552 | 1586 | |
| 1553 | 1587 | struct bio; |
| @@ -1622,6 +1656,11 @@ static inline unsigned int bio_integrity_bytes(struct blk_integrity *bi, · 68 unmodified lines | ||
| 1622 | 1656 | return 0; |
| 1623 | 1657 | } |
| 1624 | 1658 | |
| 1659 | +static inline struct bio_vec *rq_integrity_vec(struct request *rq) | |
| 1660 | +{ | |
| 1661 | + return NULL; | |
| 1662 | +} | |
| 1663 | + | |
| 1625 | 1664 | #endif /* CONFIG_BLK_DEV_INTEGRITY */ |
| 1626 | 1665 | |
| 1627 | 1666 | struct block_device_operations { |
| @@ -17,6 +17,8 @@ struct bpf_map; · 16 unmodified lines | ||
| 17 | 17 | struct bpf_prog; |
| 18 | 18 | struct bpf_sock_ops_kern; |
| 19 | 19 | struct bpf_cgroup_storage; |
| 20 | +struct ctl_table; | |
| 21 | +struct ctl_table_header; | |
| 20 | 22 | |
| 21 | 23 | #ifdef CONFIG_CGROUP_BPF |
| 22 | 24 | |
| @@ -109,6 +111,12 @@ int __cgroup_bpf_run_filter_sock_ops(struct sock *sk, · 86 unmodified lines | ||
| 109 | 111 | int __cgroup_bpf_check_dev_permission(short dev_type, u32 major, u32 minor, |
| 110 | 112 | short access, enum bpf_attach_type type); |
| 111 | 113 | |
| 114 | +int __cgroup_bpf_run_filter_sysctl(struct ctl_table_header *head, | |
| 115 | + struct ctl_table *table, int write, | |
| 116 | + void __user *buf, size_t *pcount, | |
| 117 | + loff_t *ppos, void **new_buf, | |
| 118 | + enum bpf_attach_type type); | |
| 119 | + | |
| 112 | 120 | static inline enum bpf_cgroup_storage_type cgroup_storage_type( |
| 113 | 121 | struct bpf_map *map) |
| 114 | 122 | { |
| @@ -253,6 +261,18 @@ int bpf_percpu_cgroup_storage_update(struct bpf_map *map, void *key, · 138 unmodified lines | ||
| 253 | 261 | \ |
| 254 | 262 | __ret; \ |
| 255 | 263 | }) |
| 264 | + | |
| 265 | + | |
| 266 | +#define BPF_CGROUP_RUN_PROG_SYSCTL(head, table, write, buf, count, pos, nbuf) \ | |
| 267 | +({ \ | |
| 268 | + int __ret = 0; \ | |
| 269 | + if (cgroup_bpf_enabled) \ | |
| 270 | + __ret = __cgroup_bpf_run_filter_sysctl(head, table, write, \ | |
| 271 | + buf, count, pos, nbuf, \ | |
| 272 | + BPF_CGROUP_SYSCTL); \ | |
| 273 | + __ret; \ | |
| 274 | +}) | |
| 275 | + | |
| 256 | 276 | int cgroup_bpf_prog_attach(const union bpf_attr *attr, |
| 257 | 277 | enum bpf_prog_type ptype, struct bpf_prog *prog); |
| 258 | 278 | int cgroup_bpf_prog_detach(const union bpf_attr *attr, |
| @@ -321,6 +341,7 @@ static inline int bpf_percpu_cgroup_storage_update(struct bpf_map *map, · 62 unmodified lines | ||
| 321 | 341 | #define BPF_CGROUP_RUN_PROG_UDP6_SENDMSG_LOCK(sk, uaddr, t_ctx) ({ 0; }) |
| 322 | 342 | #define BPF_CGROUP_RUN_PROG_SOCK_OPS(sock_ops) ({ 0; }) |
| 323 | 343 | #define BPF_CGROUP_RUN_PROG_DEVICE_CGROUP(type,major,minor,access) ({ 0; }) |
| 344 | +#define BPF_CGROUP_RUN_PROG_SYSCTL(head,table,write,buf,count,pos,nbuf) ({ 0; }) | |
| 324 | 345 | |
| 325 | 346 | #define for_each_cgroup_storage_type(stype) for (; false; ) |
| 326 | 347 | |
| @@ -57,6 +57,12 @@ struct bpf_map_ops { · 56 unmodified lines | ||
| 57 | 57 | const struct btf *btf, |
| 58 | 58 | const struct btf_type *key_type, |
| 59 | 59 | const struct btf_type *value_type); |
| 60 | + | |
| 61 | + /* Direct value access helpers. */ | |
| 62 | + int (*map_direct_value_addr)(const struct bpf_map *map, | |
| 63 | + u64 *imm, u32 off); | |
| 64 | + int (*map_direct_value_meta)(const struct bpf_map *map, | |
| 65 | + u64 imm, u32 *off); | |
| 60 | 66 | }; |
| 61 | 67 | |
| 62 | 68 | struct bpf_map { |
| @@ -81,7 +87,8 @@ struct bpf_map { · 18 unmodified lines | ||
| 81 | 87 | struct btf *btf; |
| 82 | 88 | u32 pages; |
| 83 | 89 | bool unpriv_array; |
| 84 | − /* 51 bytes hole */ | |
| 90 | + bool frozen; /* write-once */ | |
| 91 | + /* 48 bytes hole */ | |
| 85 | 92 | |
| 86 | 93 | /* The 3rd and 4th cacheline with misc members to avoid false sharing |
| 87 | 94 | * particularly with refcounting. |
| @@ -177,6 +184,7 @@ enum bpf_arg_type { · 89 unmodified lines | ||
| 177 | 184 | ARG_PTR_TO_MAP_KEY, /* pointer to stack used as map key */ |
| 178 | 185 | ARG_PTR_TO_MAP_VALUE, /* pointer to stack used as map value */ |
| 179 | 186 | ARG_PTR_TO_UNINIT_MAP_VALUE, /* pointer to valid memory used to store a map value */ |
| 187 | + ARG_PTR_TO_MAP_VALUE_OR_NULL, /* pointer to stack used as map value or NULL */ | |
| 180 | 188 | |
| 181 | 189 | /* the following constraints used to prototype bpf_memcmp() and other |
| 182 | 190 | * functions that access data on eBPF program stack |
| @@ -195,6 +203,9 @@ enum bpf_arg_type { · 12 unmodified lines | ||
| 195 | 203 | ARG_ANYTHING, /* any (initialized) argument is ok */ |
| 196 | 204 | ARG_PTR_TO_SPIN_LOCK, /* pointer to bpf_spin_lock */ |
| 197 | 205 | ARG_PTR_TO_SOCK_COMMON, /* pointer to sock_common */ |
| 206 | + ARG_PTR_TO_INT, /* pointer to int */ | |
| 207 | + ARG_PTR_TO_LONG, /* pointer to long */ | |
| 208 | + ARG_PTR_TO_SOCKET, /* pointer to bpf_sock (fullsock) */ | |
| 198 | 209 | }; |
| 199 | 210 | |
| 200 | 211 | /* type of values returned from helper functions */ |
| @@ -205,6 +216,7 @@ enum bpf_return_type { · 4 unmodified lines | ||
| 205 | 216 | RET_PTR_TO_MAP_VALUE_OR_NULL, /* returns a pointer to map elem value or NULL */ |
| 206 | 217 | RET_PTR_TO_SOCKET_OR_NULL, /* returns a pointer to a socket or NULL */ |
| 207 | 218 | RET_PTR_TO_TCP_SOCK_OR_NULL, /* returns a pointer to a tcp_sock or NULL */ |
| 219 | + RET_PTR_TO_SOCK_COMMON_OR_NULL, /* returns a pointer to a sock_common or NULL */ | |
| 208 | 220 | }; |
| 209 | 221 | |
| 210 | 222 | /* eBPF function prototype used by verifier to allow BPF_CALLs from eBPF programs |
| @@ -262,6 +274,7 @@ enum bpf_reg_type { · 51 unmodified lines | ||
| 262 | 274 | PTR_TO_SOCK_COMMON_OR_NULL, /* reg points to sock_common or NULL */ |
| 263 | 275 | PTR_TO_TCP_SOCK, /* reg points to struct tcp_sock */ |
| 264 | 276 | PTR_TO_TCP_SOCK_OR_NULL, /* reg points to struct tcp_sock or NULL */ |
| 277 | + PTR_TO_TP_BUFFER, /* reg points to a writable raw tp's buffer */ | |
| 265 | 278 | }; |
| 266 | 279 | |
| 267 | 280 | /* The information passed from prog-specific *_is_valid_access |
| @@ -351,6 +364,7 @@ struct bpf_prog_aux { · 83 unmodified lines | ||
| 351 | 364 | u32 used_map_cnt; |
| 352 | 365 | u32 max_ctx_offset; |
| 353 | 366 | u32 max_pkt_offset; |
| 367 | + u32 max_tp_access; | |
| 354 | 368 | u32 stack_depth; |
| 355 | 369 | u32 id; |
| 356 | 370 | u32 func_cnt; /* used by non-func prog as the number of func progs */ |
| @@ -420,8 +434,38 @@ struct bpf_array { · 63 unmodified lines | ||
| 420 | 434 | }; |
| 421 | 435 | }; |
| 422 | 436 | |
| 437 | +#define BPF_COMPLEXITY_LIMIT_INSNS 1000000 /* yes. 1M insns */ | |
| 423 | 438 | #define MAX_TAIL_CALL_CNT 32 |
| 424 | 439 | |
| 440 | +#define BPF_F_ACCESS_MASK (BPF_F_RDONLY | \ | |
| 441 | + BPF_F_RDONLY_PROG | \ | |
| 442 | + BPF_F_WRONLY | \ | |
| 443 | + BPF_F_WRONLY_PROG) | |
| 444 | + | |
| 445 | +#define BPF_MAP_CAN_READ BIT(0) | |
| 446 | +#define BPF_MAP_CAN_WRITE BIT(1) | |
| 447 | + | |
| 448 | +static inline u32 bpf_map_flags_to_cap(struct bpf_map *map) | |
| 449 | +{ | |
| 450 | + u32 access_flags = map->map_flags & (BPF_F_RDONLY_PROG | BPF_F_WRONLY_PROG); | |
| 451 | + | |
| 452 | + /* Combination of BPF_F_RDONLY_PROG | BPF_F_WRONLY_PROG is | |
| 453 | + * not possible. | |
| 454 | + */ | |
| 455 | + if (access_flags & BPF_F_RDONLY_PROG) | |
| 456 | + return BPF_MAP_CAN_READ; | |
| 457 | + else if (access_flags & BPF_F_WRONLY_PROG) | |
| 458 | + return BPF_MAP_CAN_WRITE; | |
| 459 | + else | |
| 460 | + return BPF_MAP_CAN_READ | BPF_MAP_CAN_WRITE; | |
| 461 | +} | |
| 462 | + | |
| 463 | +static inline bool bpf_map_flags_access_ok(u32 access_flags) | |
| 464 | +{ | |
| 465 | + return (access_flags & (BPF_F_RDONLY_PROG | BPF_F_WRONLY_PROG)) != | |
| 466 | + (BPF_F_RDONLY_PROG | BPF_F_WRONLY_PROG); | |
| 467 | +} | |
| 468 | + | |
| 425 | 469 | struct bpf_event_entry { |
| 426 | 470 | struct perf_event *event; |
| 427 | 471 | struct file *perf_file; |
| @@ -445,14 +489,6 @@ typedef u32 (*bpf_convert_ctx_access_t)(enum bpf_access_type type, · 17 unmodified lines | ||
| 445 | 489 | u64 bpf_event_output(struct bpf_map *map, u64 flags, void *meta, u64 meta_size, |
| 446 | 490 | void *ctx, u64 ctx_size, bpf_ctx_copy_t ctx_copy); |
| 447 | 491 | |
| 448 | −int bpf_prog_test_run_xdp(struct bpf_prog *prog, const union bpf_attr *kattr, | |
| 449 | − union bpf_attr __user *uattr); | |
| 450 | −int bpf_prog_test_run_skb(struct bpf_prog *prog, const union bpf_attr *kattr, | |
| 451 | − union bpf_attr __user *uattr); | |
| 452 | −int bpf_prog_test_run_flow_dissector(struct bpf_prog *prog, | |
| 453 | − const union bpf_attr *kattr, | |
| 454 | − union bpf_attr __user *uattr); | |
| 455 | − | |
| 456 | 492 | /* an array of programs to be executed under rcu_lock. |
| 457 | 493 | * |
| 458 | 494 | * Typical usage: |
| @@ -510,7 +546,7 @@ int bpf_prog_array_copy(struct bpf_prog_array __rcu *old_array, · 51 unmodified lines | ||
| 510 | 546 | } \ |
| 511 | 547 | _out: \ |
| 512 | 548 | rcu_read_unlock(); \ |
| 513 | − preempt_enable_no_resched(); \ | |
| 549 | + preempt_enable(); \ | |
| 514 | 550 | _ret; \ |
| 515 | 551 | }) |
| 516 | 552 | |
| @@ -643,6 +679,13 @@ static inline int bpf_map_attr_numa_node(const union bpf_attr *attr) · 126 unmodified lines | ||
| 643 | 679 | struct bpf_prog *bpf_prog_get_type_path(const char *name, enum bpf_prog_type type); |
| 644 | 680 | int array_map_alloc_check(union bpf_attr *attr); |
| 645 | 681 | |
| 682 | +int bpf_prog_test_run_xdp(struct bpf_prog *prog, const union bpf_attr *kattr, | |
| 683 | + union bpf_attr __user *uattr); | |
| 684 | +int bpf_prog_test_run_skb(struct bpf_prog *prog, const union bpf_attr *kattr, | |
| 685 | + union bpf_attr __user *uattr); | |
| 686 | +int bpf_prog_test_run_flow_dissector(struct bpf_prog *prog, | |
| 687 | + const union bpf_attr *kattr, | |
| 688 | + union bpf_attr __user *uattr); | |
| 646 | 689 | #else /* !CONFIG_BPF_SYSCALL */ |
| 647 | 690 | static inline struct bpf_prog *bpf_prog_get(u32 ufd) |
| 648 | 691 | { |
| @@ -754,6 +797,27 @@ static inline struct bpf_prog *bpf_prog_get_type_path(const char *name, · 105 unmodified lines | ||
| 754 | 797 | { |
| 755 | 798 | return ERR_PTR(-EOPNOTSUPP); |
| 756 | 799 | } |
| 800 | + | |
| 801 | +static inline int bpf_prog_test_run_xdp(struct bpf_prog *prog, | |
| 802 | + const union bpf_attr *kattr, | |
| 803 | + union bpf_attr __user *uattr) | |
| 804 | +{ | |
| 805 | + return -ENOTSUPP; | |
| 806 | +} | |
| 807 | + | |
| 808 | +static inline int bpf_prog_test_run_skb(struct bpf_prog *prog, | |
| 809 | + const union bpf_attr *kattr, | |
| 810 | + union bpf_attr __user *uattr) | |
| 811 | +{ | |
| 812 | + return -ENOTSUPP; | |
| 813 | +} | |
| 814 | + | |
| 815 | +static inline int bpf_prog_test_run_flow_dissector(struct bpf_prog *prog, | |
| 816 | + const union bpf_attr *kattr, | |
| 817 | + union bpf_attr __user *uattr) | |
| 818 | +{ | |
| 819 | + return -ENOTSUPP; | |
| 820 | +} | |
| 757 | 821 | #endif /* CONFIG_BPF_SYSCALL */ |
| 758 | 822 | |
| 759 | 823 | static inline struct bpf_prog *bpf_prog_get_type(u32 ufd, |
| @@ -929,6 +993,8 @@ extern const struct bpf_func_proto bpf_sk_redirect_map_proto; · 169 unmodified lines | ||
| 929 | 993 | extern const struct bpf_func_proto bpf_spin_lock_proto; |
| 930 | 994 | extern const struct bpf_func_proto bpf_spin_unlock_proto; |
| 931 | 995 | extern const struct bpf_func_proto bpf_get_local_storage_proto; |
| 996 | +extern const struct bpf_func_proto bpf_strtol_proto; | |
| 997 | +extern const struct bpf_func_proto bpf_strtoul_proto; | |
| 932 | 998 | |
| 933 | 999 | /* Shared helpers among cBPF and eBPF. */ |
| 934 | 1000 | void bpf_user_rnd_init_once(void); |
| @@ -25,9 +25,11 @@ BPF_PROG_TYPE(BPF_PROG_TYPE_KPROBE, kprobe) · 24 unmodified lines | ||
| 25 | 25 | BPF_PROG_TYPE(BPF_PROG_TYPE_TRACEPOINT, tracepoint) |
| 26 | 26 | BPF_PROG_TYPE(BPF_PROG_TYPE_PERF_EVENT, perf_event) |
| 27 | 27 | BPF_PROG_TYPE(BPF_PROG_TYPE_RAW_TRACEPOINT, raw_tracepoint) |
| 28 | +BPF_PROG_TYPE(BPF_PROG_TYPE_RAW_TRACEPOINT_WRITABLE, raw_tracepoint_writable) | |
| 28 | 29 | #endif |
| 29 | 30 | #ifdef CONFIG_CGROUP_BPF |
| 30 | 31 | BPF_PROG_TYPE(BPF_PROG_TYPE_CGROUP_DEVICE, cg_dev) |
| 32 | +BPF_PROG_TYPE(BPF_PROG_TYPE_CGROUP_SYSCTL, cg_sysctl) | |
| 31 | 33 | #endif |
| 32 | 34 | #ifdef CONFIG_BPF_LIRC_MODE2 |
| 33 | 35 | BPF_PROG_TYPE(BPF_PROG_TYPE_LIRC_MODE2, lirc_mode2) |
| @@ -59,6 +61,7 @@ BPF_MAP_TYPE(BPF_MAP_TYPE_ARRAY_OF_MAPS, array_of_maps_map_ops) · 25 unmodified lines | ||
| 59 | 61 | BPF_MAP_TYPE(BPF_MAP_TYPE_HASH_OF_MAPS, htab_of_maps_map_ops) |
| 60 | 62 | #ifdef CONFIG_NET |
| 61 | 63 | BPF_MAP_TYPE(BPF_MAP_TYPE_DEVMAP, dev_map_ops) |
| 64 | +BPF_MAP_TYPE(BPF_MAP_TYPE_SK_STORAGE, sk_storage_map_ops) | |
| 62 | 65 | #if defined(CONFIG_BPF_STREAM_PARSER) |
| 63 | 66 | BPF_MAP_TYPE(BPF_MAP_TYPE_SOCKMAP, sock_map_ops) |
| 64 | 67 | BPF_MAP_TYPE(BPF_MAP_TYPE_SOCKHASH, sock_hash_ops) |
| @@ -207,6 +207,7 @@ struct bpf_verifier_state { · 206 unmodified lines | ||
| 207 | 207 | struct bpf_verifier_state_list { |
| 208 | 208 | struct bpf_verifier_state state; |
| 209 | 209 | struct bpf_verifier_state_list *next; |
| 210 | + int miss_cnt, hit_cnt; | |
| 210 | 211 | }; |
| 211 | 212 | |
| 212 | 213 | /* Possible states for alu_state member. */ |
| @@ -223,6 +224,10 @@ struct bpf_insn_aux_data { · 10 unmodified lines | ||
| 223 | 224 | unsigned long map_state; /* pointer/poison value for maps */ |
| 224 | 225 | s32 call_imm; /* saved imm field of call insn */ |
| 225 | 226 | u32 alu_limit; /* limit for add/sub register with pointer */ |
| 227 | + struct { | |
| 228 | + u32 map_index; /* index into used_maps[] */ | |
| 229 | + u32 map_off; /* offset from value base address */ | |
| 230 | + }; | |
| 226 | 231 | }; |
| 227 | 232 | int ctx_field_size; /* the ctx field size for load insn, maybe 0 */ |
| 228 | 233 | int sanitize_stack_off; /* stack slot to be cleared */ |
| @@ -248,6 +253,12 @@ static inline bool bpf_verifier_log_full(const struct bpf_verifier_log *log) · 19 unmodified lines | ||
| 248 | 253 | return log->len_used >= log->len_total - 1; |
| 249 | 254 | } |
| 250 | 255 | |
| 256 | +#define BPF_LOG_LEVEL1 1 | |
| 257 | +#define BPF_LOG_LEVEL2 2 | |
| 258 | +#define BPF_LOG_STATS 4 | |
| 259 | +#define BPF_LOG_LEVEL (BPF_LOG_LEVEL1 | BPF_LOG_LEVEL2) | |
| 260 | +#define BPF_LOG_MASK (BPF_LOG_LEVEL | BPF_LOG_STATS) | |
| 261 | + | |
| 251 | 262 | static inline bool bpf_verifier_log_needed(const struct bpf_verifier_log *log) |
| 252 | 263 | { |
| 253 | 264 | return log->level && log->ubuf && !bpf_verifier_log_full(log); |
| @@ -274,6 +285,7 @@ struct bpf_verifier_env { · 20 unmodified lines | ||
| 274 | 285 | bool strict_alignment; /* perform strict pointer alignment checks */ |
| 275 | 286 | struct bpf_verifier_state *cur_state; /* current verifier state */ |
| 276 | 287 | struct bpf_verifier_state_list **explored_states; /* search pruning optimization */ |
| 288 | + struct bpf_verifier_state_list *free_list; | |
| 277 | 289 | struct bpf_map *used_maps[MAX_USED_MAPS]; /* array of map's used by eBPF program */ |
| 278 | 290 | u32 used_map_cnt; /* number of used maps */ |
| 279 | 291 | u32 id_gen; /* used to generate unique reg IDs */ |
| @@ -283,7 +295,27 @@ struct bpf_verifier_env { · 3 unmodified lines | ||
| 283 | 295 | const struct bpf_line_info *prev_linfo; |
| 284 | 296 | struct bpf_verifier_log log; |
| 285 | 297 | struct bpf_subprog_info subprog_info[BPF_MAX_SUBPROGS + 1]; |
| 298 | + struct { | |
| 299 | + int *insn_state; | |
| 300 | + int *insn_stack; | |
| 301 | + int cur_stack; | |
| 302 | + } cfg; | |
| 286 | 303 | u32 subprog_cnt; |
| 304 | + /* number of instructions analyzed by the verifier */ | |
| 305 | + u32 insn_processed; | |
| 306 | + /* total verification time */ | |
| 307 | + u64 verification_time; | |
| 308 | + /* maximum number of verifier states kept in 'branching' instructions */ | |
| 309 | + u32 max_states_per_insn; | |
| 310 | + /* total number of allocated verifier states */ | |
| 311 | + u32 total_states; | |
| 312 | + /* some states are freed during program analysis. | |
| 313 | + * this is peak number of states. this number dominates kernel | |
| 314 | + * memory consumption during verification | |
| 315 | + */ | |
| 316 | + u32 peak_states; | |
| 317 | + /* longest register parentage chain walked for liveness marking */ | |
| 318 | + u32 longest_mark_read_walk; | |
| 287 | 319 | }; |
| 288 | 320 | |
| 289 | 321 | __printf(2, 0) void bpf_verifier_vlog(struct bpf_verifier_log *log, |
| @@ -1,24 +1,10 @@ | ||
| 1 | +/* SPDX-License-Identifier: GPL-2.0-or-later */ | |
| 1 | 2 | /* |
| 2 | 3 | * BSG helper library |
| 3 | 4 | * |
| 4 | 5 | * Copyright (C) 2008 James Smart, Emulex Corporation |
| 5 | 6 | * Copyright (C) 2011 Red Hat, Inc. All rights reserved. |
| 6 | 7 | * Copyright (C) 2011 Mike Christie |
| 7 | − * | |
| 8 | − * This program is free software; you can redistribute it and/or modify | |
| 9 | − * it under the terms of the GNU General Public License as published by | |
| 10 | − * the Free Software Foundation; either version 2 of the License, or | |
| 11 | − * (at your option) any later version. | |
| 12 | − * | |
| 13 | − * This program is distributed in the hope that it will be useful, | |
| 14 | − * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 15 | − * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
| 16 | − * GNU General Public License for more details. | |
| 17 | − * | |
| 18 | − * You should have received a copy of the GNU General Public License | |
| 19 | − * along with this program; if not, write to the Free Software | |
| 20 | − * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
| 21 | − * | |
| 22 | 8 | */ |
| 23 | 9 | #ifndef _BLK_BSG_ |
| 24 | 10 | #define _BLK_BSG_ |
| @@ -51,6 +51,7 @@ bool btf_member_is_reg_int(const struct btf *btf, const struct btf_type *s, · 50 unmodified lines | ||
| 51 | 51 | const struct btf_member *m, |
| 52 | 52 | u32 expected_offset, u32 expected_size); |
| 53 | 53 | int btf_find_spin_lock(const struct btf *btf, const struct btf_type *t); |
| 54 | +bool btf_type_is_void(const struct btf_type *t); | |
| 54 | 55 | |
| 55 | 56 | #ifdef CONFIG_BPF_SYSCALL |
| 56 | 57 | const struct btf_type *btf_type_by_id(const struct btf *btf, u32 type_id); |
| @@ -1,21 +1,8 @@ | ||
| 1 | +/* SPDX-License-Identifier: GPL-2.0 */ | |
| 1 | 2 | /* |
| 2 | 3 | * bvec iterator |
| 3 | 4 | * |
| 4 | 5 | * Copyright (C) 2001 Ming Lei <ming.lei@canonical.com> |
| 5 | − * | |
| 6 | − * This program is free software; you can redistribute it and/or modify | |
| 7 | − * it under the terms of the GNU General Public License version 2 as | |
| 8 | − * published by the Free Software Foundation. | |
| 9 | − * | |
| 10 | − * This program is distributed in the hope that it will be useful, | |
| 11 | − * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 12 | − * | |
| 13 | − * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
| 14 | − * GNU General Public License for more details. | |
| 15 | − * | |
| 16 | − * You should have received a copy of the GNU General Public Licens | |
| 17 | − * along with this program; if not, write to the Free Software | |
| 18 | − * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111- | |
| 19 | 6 | */ |
| 20 | 7 | #ifndef __LINUX_BVEC_ITER_H |
| 21 | 8 | #define __LINUX_BVEC_ITER_H |
| @@ -51,11 +38,6 @@ struct bvec_iter_all { · 29 unmodified lines | ||
| 51 | 38 | unsigned done; |
| 52 | 39 | }; |
| 53 | 40 | |
| 54 | −static inline struct page *bvec_nth_page(struct page *page, int idx) | |
| 55 | −{ | |
| 56 | − return idx == 0 ? page : nth_page(page, idx); | |
| 57 | −} | |
| 58 | − | |
| 59 | 41 | /* |
| 60 | 42 | * various member access, note that bio_data should of course not be used |
| 61 | 43 | * on highmem page vectors |
| @@ -92,8 +74,8 @@ static inline struct page *bvec_nth_page(struct page *page, int idx) · 30 unmodified lines | ||
| 92 | 74 | PAGE_SIZE - bvec_iter_offset((bvec), (iter))) |
| 93 | 75 | |
| 94 | 76 | #define bvec_iter_page(bvec, iter) \ |
| 95 | − bvec_nth_page(mp_bvec_iter_page((bvec), (iter)), \ | |
| 96 | − mp_bvec_iter_page_idx((bvec), (iter))) | |
| 77 | + (mp_bvec_iter_page((bvec), (iter)) + \ | |
| 78 | + mp_bvec_iter_page_idx((bvec), (iter))) | |
| 97 | 79 | |
| 98 | 80 | #define bvec_iter_bvec(bvec, iter) \ |
| 99 | 81 | ((struct bio_vec) { \ |
| @@ -157,11 +139,11 @@ static inline void bvec_advance(const struct bio_vec *bvec, · 57 unmodified lines | ||
| 157 | 139 | struct bio_vec *bv = &iter_all->bv; |
| 158 | 140 | |
| 159 | 141 | if (iter_all->done) { |
| 160 | − bv->bv_page = nth_page(bv->bv_page, 1); | |
| 142 | + bv->bv_page++; | |
| 161 | 143 | bv->bv_offset = 0; |
| 162 | 144 | } else { |
| 163 | − bv->bv_page = bvec->bv_page; | |
| 164 | − bv->bv_offset = bvec->bv_offset; | |
| 145 | + bv->bv_page = bvec->bv_page + (bvec->bv_offset >> PAGE_SHIFT); | |
| 146 | + bv->bv_offset = bvec->bv_offset & ~PAGE_MASK; | |
| 165 | 147 | } |
| 166 | 148 | bv->bv_len = min_t(unsigned int, PAGE_SIZE - bv->bv_offset, |
| 167 | 149 | bvec->bv_len - iter_all->done); |
| @@ -183,7 +165,7 @@ static inline void mp_bvec_last_segment(const struct bio_vec *bvec, · 15 unmodified lines | ||
| 183 | 165 | unsigned total = bvec->bv_offset + bvec->bv_len; |
| 184 | 166 | unsigned last_page = (total - 1) / PAGE_SIZE; |
| 185 | 167 | |
| 186 | − seg->bv_page = bvec_nth_page(bvec->bv_page, last_page); | |
| 168 | + seg->bv_page = bvec->bv_page + last_page; | |
| 187 | 169 | |
| 188 | 170 | /* the whole segment is inside the last page */ |
| 189 | 171 | if (bvec->bv_offset >= last_page * PAGE_SIZE) { |
| @@ -195,9 +177,4 @@ static inline void mp_bvec_last_segment(const struct bio_vec *bvec, · 5 unmodified lines | ||
| 195 | 177 | } |
| 196 | 178 | } |
| 197 | 179 | |
| 198 | −#define mp_bvec_for_each_page(pg, bv, i) \ | |
| 199 | − for (i = (bv)->bv_offset / PAGE_SIZE; \ | |
| 200 | − (i <= (((bv)->bv_offset + (bv)->bv_len - 1) / PAGE_SIZE)) && \ | |
| 201 | − (pg = bvec_nth_page((bv)->bv_page, i)); i += 1) | |
| 202 | − | |
| 203 | 180 | #endif /* __LINUX_BVEC_ITER_H */ |
| @@ -436,6 +436,12 @@ union ceph_mds_request_args { · 435 unmodified lines | ||
| 436 | 436 | __le64 length; /* num bytes to lock from start */ |
| 437 | 437 | __u8 wait; /* will caller wait for lock to become available? */ |
| 438 | 438 | } __attribute__ ((packed)) filelock_change; |
| 439 | + struct { | |
| 440 | + __le32 mask; /* CEPH_CAP_* */ | |
| 441 | + __le64 snapid; | |
| 442 | + __le64 parent; | |
| 443 | + __le32 hash; | |
| 444 | + } __attribute__ ((packed)) lookupino; | |
| 439 | 445 | } __attribute__ ((packed)); |
| 440 | 446 | |
| 441 | 447 | #define CEPH_MDS_FLAG_REPLAY 1 /* this is a replayed op */ |
| @@ -323,7 +323,8 @@ struct ceph_connection { · 322 unmodified lines | ||
| 323 | 323 | }; |
| 324 | 324 | |
| 325 | 325 | |
| 326 | −extern const char *ceph_pr_addr(const struct sockaddr_storage *ss); | |
| 326 | +extern const char *ceph_pr_addr(const struct ceph_entity_addr *addr); | |
| 327 | + | |
| 327 | 328 | extern int ceph_parse_ips(const char *c, const char *end, |
| 328 | 329 | struct ceph_entity_addr *addr, |
| 329 | 330 | int max_count, int *count); |
| @@ -110,17 +110,16 @@ struct ceph_object_id { · 109 unmodified lines | ||
| 110 | 110 | int name_len; |
| 111 | 111 | }; |
| 112 | 112 | |
| 113 | +#define __CEPH_OID_INITIALIZER(oid) { .name = (oid).inline_name } | |
| 114 | + | |
| 115 | +#define CEPH_DEFINE_OID_ONSTACK(oid) \ | |
| 116 | + struct ceph_object_id oid = __CEPH_OID_INITIALIZER(oid) | |
| 117 | + | |
| 113 | 118 | static inline void ceph_oid_init(struct ceph_object_id *oid) |
| 114 | 119 | { |
| 115 | − oid->name = oid->inline_name; | |
| 116 | − oid->name_len = 0; | |
| 120 | + *oid = (struct ceph_object_id) __CEPH_OID_INITIALIZER(*oid); | |
| 117 | 121 | } |
| 118 | 122 | |
| 119 | −#define CEPH_OID_INIT_ONSTACK(oid) \ | |
| 120 | − ({ ceph_oid_init(&oid); oid; }) | |
| 121 | −#define CEPH_DEFINE_OID_ONSTACK(oid) \ | |
| 122 | − struct ceph_object_id oid = CEPH_OID_INIT_ONSTACK(oid) | |
| 123 | − | |
| 124 | 123 | static inline bool ceph_oid_empty(const struct ceph_object_id *oid) |
| 125 | 124 | { |
| 126 | 125 | return oid->name == oid->inline_name && !oid->name_len; |
| @@ -65,6 +65,12 @@ enum { · 64 unmodified lines | ||
| 65 | 65 | * specified at mount time and thus is implemented here. |
| 66 | 66 | */ |
| 67 | 67 | CGRP_CPUSET_CLONE_CHILDREN, |
| 68 | + | |
| 69 | + /* Control group has to be frozen. */ | |
| 70 | + CGRP_FREEZE, | |
| 71 | + | |
| 72 | + /* Cgroup is frozen. */ | |
| 73 | + CGRP_FROZEN, | |
| 68 | 74 | }; |
| 69 | 75 | |
| 70 | 76 | /* cgroup_root->flags */ |
| @@ -317,6 +323,25 @@ struct cgroup_rstat_cpu { · 246 unmodified lines | ||
| 317 | 323 | struct cgroup *updated_next; /* NULL iff not on the list */ |
| 318 | 324 | }; |
| 319 | 325 | |
| 326 | +struct cgroup_freezer_state { | |
| 327 | + /* Should the cgroup and its descendants be frozen. */ | |
| 328 | + bool freeze; | |
| 329 | + | |
| 330 | + /* Should the cgroup actually be frozen? */ | |
| 331 | + int e_freeze; | |
| 332 | + | |
| 333 | + /* Fields below are protected by css_set_lock */ | |
| 334 | + | |
| 335 | + /* Number of frozen descendant cgroups */ | |
| 336 | + int nr_frozen_descendants; | |
| 337 | + | |
| 338 | + /* | |
| 339 | + * Number of tasks, which are counted as frozen: | |
| 340 | + * frozen, SIGSTOPped, and PTRACEd. | |
| 341 | + */ | |
| 342 | + int nr_frozen_tasks; | |
| 343 | +}; | |
| 344 | + | |
| 320 | 345 | struct cgroup { |
| 321 | 346 | /* self css with NULL ->ss, points back to this cgroup */ |
| 322 | 347 | struct cgroup_subsys_state self; |
| @@ -349,6 +374,11 @@ struct cgroup { · 26 unmodified lines | ||
| 349 | 374 | * Dying cgroups are cgroups which were deleted by a user, |
| 350 | 375 | * but are still existing because someone else is holding a reference. |
| 351 | 376 | * max_descendants is a maximum allowed number of descent cgroups. |
| 377 | + * | |
| 378 | + * nr_descendants and nr_dying_descendants are protected | |
| 379 | + * by cgroup_mutex and css_set_lock. It's fine to read them holding | |
| 380 | + * any of cgroup_mutex and css_set_lock; for writing both locks | |
| 381 | + * should be held. | |
| 352 | 382 | */ |
| 353 | 383 | int nr_descendants; |
| 354 | 384 | int nr_dying_descendants; |
| @@ -448,6 +478,9 @@ struct cgroup { · 93 unmodified lines | ||
| 448 | 478 | /* If there is block congestion on this cgroup. */ |
| 449 | 479 | atomic_t congestion_count; |
| 450 | 480 | |
| 481 | + /* Used to store internal freezer state */ | |
| 482 | + struct cgroup_freezer_state freezer; | |
| 483 | + | |
| 451 | 484 | /* ids of the ancestors at each level including self */ |
| 452 | 485 | int ancestor_ids[]; |
| 453 | 486 | }; |
| @@ -881,4 +881,47 @@ static inline void put_cgroup_ns(struct cgroup_namespace *ns) · 880 unmodified lines | ||
| 881 | 881 | free_cgroup_ns(ns); |
| 882 | 882 | } |
| 883 | 883 | |
| 884 | +#ifdef CONFIG_CGROUPS | |
| 885 | + | |
| 886 | +void cgroup_enter_frozen(void); | |
| 887 | +void cgroup_leave_frozen(bool always_leave); | |
| 888 | +void cgroup_update_frozen(struct cgroup *cgrp); | |
| 889 | +void cgroup_freeze(struct cgroup *cgrp, bool freeze); | |
| 890 | +void cgroup_freezer_migrate_task(struct task_struct *task, struct cgroup *src, | |
| 891 | + struct cgroup *dst); | |
| 892 | + | |
| 893 | +static inline bool cgroup_task_freeze(struct task_struct *task) | |
| 894 | +{ | |
| 895 | + bool ret; | |
| 896 | + | |
| 897 | + if (task->flags & PF_KTHREAD) | |
| 898 | + return false; | |
| 899 | + | |
| 900 | + rcu_read_lock(); | |
| 901 | + ret = test_bit(CGRP_FREEZE, &task_dfl_cgroup(task)->flags); | |
| 902 | + rcu_read_unlock(); | |
| 903 | + | |
| 904 | + return ret; | |
| 905 | +} | |
| 906 | + | |
| 907 | +static inline bool cgroup_task_frozen(struct task_struct *task) | |
| 908 | +{ | |
| 909 | + return task->frozen; | |
| 910 | +} | |
| 911 | + | |
| 912 | +#else /* !CONFIG_CGROUPS */ | |
| 913 | + | |
| 914 | +static inline void cgroup_enter_frozen(void) { } | |
| 915 | +static inline void cgroup_leave_frozen(bool always_leave) { } | |
| 916 | +static inline bool cgroup_task_freeze(struct task_struct *task) | |
| 917 | +{ | |
| 918 | + return false; | |
| 919 | +} | |
| 920 | +static inline bool cgroup_task_frozen(struct task_struct *task) | |
| 921 | +{ | |
| 922 | + return false; | |
| 923 | +} | |
| 924 | + | |
| 925 | +#endif /* !CONFIG_CGROUPS */ | |
| 926 | + | |
| 884 | 927 | #endif /* _LINUX_CGROUP_H */ |
| @@ -6,7 +6,6 @@ · 5 unmodified lines | ||
| 6 | 6 | #ifndef __LINUX_CLK_PROVIDER_H |
| 7 | 7 | #define __LINUX_CLK_PROVIDER_H |
| 8 | 8 | |
| 9 | −#include <linux/io.h> | |
| 10 | 9 | #include <linux/of.h> |
| 11 | 10 | #include <linux/of_clk.h> |
| 12 | 11 | |
| @@ -24,7 +23,7 @@ · 11 unmodified lines | ||
| 24 | 23 | #define CLK_SET_RATE_PARENT BIT(2) /* propagate rate change up one level */ |
| 25 | 24 | #define CLK_IGNORE_UNUSED BIT(3) /* do not gate even if unused */ |
| 26 | 25 | /* unused */ |
| 27 | −#define CLK_IS_BASIC BIT(5) /* Basic clk, can't do a to_clk_foo() */ | |
| 26 | + /* unused */ | |
| 28 | 27 | #define CLK_GET_RATE_NOCACHE BIT(6) /* do not use the cached clk rate */ |
| 29 | 28 | #define CLK_SET_RATE_NO_REPARENT BIT(7) /* don't re-parent on rate change */ |
| 30 | 29 | #define CLK_GET_ACCURACY_NOCACHE BIT(8) /* do not use the cached clk accuracy */ |
| @@ -250,6 +249,20 @@ struct clk_ops { · 219 unmodified lines | ||
| 250 | 249 | void (*debug_init)(struct clk_hw *hw, struct dentry *dentry); |
| 251 | 250 | }; |
| 252 | 251 | |
| 252 | +/** | |
| 253 | + * struct clk_parent_data - clk parent information | |
| 254 | + * @hw: parent clk_hw pointer (used for clk providers with internal clks) | |
| 255 | + * @fw_name: parent name local to provider registering clk | |
| 256 | + * @name: globally unique parent name (used as a fallback) | |
| 257 | + * @index: parent index local to provider registering clk (if @fw_name absent) | |
| 258 | + */ | |
| 259 | +struct clk_parent_data { | |
| 260 | + const struct clk_hw *hw; | |
| 261 | + const char *fw_name; | |
| 262 | + const char *name; | |
| 263 | + int index; | |
| 264 | +}; | |
| 265 | + | |
| 253 | 266 | /** |
| 254 | 267 | * struct clk_init_data - holds init data that's common to all clocks and is |
| 255 | 268 | * shared between the clock provider and the common clock framework. |
| @@ -257,13 +270,20 @@ struct clk_ops { · 1 unmodified line | ||
| 257 | 270 | * @name: clock name |
| 258 | 271 | * @ops: operations this clock supports |
| 259 | 272 | * @parent_names: array of string names for all possible parents |
| 273 | + * @parent_data: array of parent data for all possible parents (when some | |
| 274 | + * parents are external to the clk controller) | |
| 275 | + * @parent_hws: array of pointers to all possible parents (when all parents | |
| 276 | + * are internal to the clk controller) | |
| 260 | 277 | * @num_parents: number of possible parents |
| 261 | 278 | * @flags: framework-level hints and quirks |
| 262 | 279 | */ |
| 263 | 280 | struct clk_init_data { |
| 264 | 281 | const char *name; |
| 265 | 282 | const struct clk_ops *ops; |
| 283 | + /* Only one of the following three should be assigned */ | |
| 266 | 284 | const char * const *parent_names; |
| 285 | + const struct clk_parent_data *parent_data; | |
| 286 | + const struct clk_hw **parent_hws; | |
| 267 | 287 | u8 num_parents; |
| 268 | 288 | unsigned long flags; |
| 269 | 289 | }; |
| @@ -307,7 +327,6 @@ struct clk_fixed_rate { · 37 unmodified lines | ||
| 307 | 327 | struct clk_hw hw; |
| 308 | 328 | unsigned long fixed_rate; |
| 309 | 329 | unsigned long fixed_accuracy; |
| 310 | − u8 flags; | |
| 311 | 330 | }; |
| 312 | 331 | |
| 313 | 332 | #define to_clk_fixed_rate(_hw) container_of(_hw, struct clk_fixed_rate, hw) |
| @@ -349,6 +368,9 @@ void of_fixed_clk_setup(struct device_node *np); · 35 unmodified lines | ||
| 349 | 368 | * of this register, and mask of gate bits are in higher 16-bit of this |
| 350 | 369 | * register. While setting the gate bits, higher 16-bit should also be |
| 351 | 370 | * updated to indicate changing gate bits. |
| 371 | + * CLK_GATE_BIG_ENDIAN - by default little endian register accesses are used for | |
| 372 | + * the gate register. Setting this flag makes the register accesses big | |
| 373 | + * endian. | |
| 352 | 374 | */ |
| 353 | 375 | struct clk_gate { |
| 354 | 376 | struct clk_hw hw; |
| @@ -362,6 +384,7 @@ struct clk_gate { · 7 unmodified lines | ||
| 362 | 384 | |
| 363 | 385 | #define CLK_GATE_SET_TO_DISABLE BIT(0) |
| 364 | 386 | #define CLK_GATE_HIWORD_MASK BIT(1) |
| 387 | +#define CLK_GATE_BIG_ENDIAN BIT(2) | |
| 365 | 388 | |
| 366 | 389 | extern const struct clk_ops clk_gate_ops; |
| 367 | 390 | struct clk *clk_register_gate(struct device *dev, const char *name, |
| @@ -417,6 +440,9 @@ struct clk_div_table { · 49 unmodified lines | ||
| 417 | 440 | * CLK_DIVIDER_MAX_AT_ZERO - For dividers which are like CLK_DIVIDER_ONE_BASED |
| 418 | 441 | * except when the value read from the register is zero, the divisor is |
| 419 | 442 | * 2^width of the field. |
| 443 | + * CLK_DIVIDER_BIG_ENDIAN - By default little endian register accesses are used | |
| 444 | + * for the divider register. Setting this flag makes the register accesses | |
| 445 | + * big endian. | |
| 420 | 446 | */ |
| 421 | 447 | struct clk_divider { |
| 422 | 448 | struct clk_hw hw; |
| @@ -438,6 +464,7 @@ struct clk_divider { · 15 unmodified lines | ||
| 438 | 464 | #define CLK_DIVIDER_ROUND_CLOSEST BIT(4) |
| 439 | 465 | #define CLK_DIVIDER_READ_ONLY BIT(5) |
| 440 | 466 | #define CLK_DIVIDER_MAX_AT_ZERO BIT(6) |
| 467 | +#define CLK_DIVIDER_BIG_ENDIAN BIT(7) | |
| 441 | 468 | |
| 442 | 469 | extern const struct clk_ops clk_divider_ops; |
| 443 | 470 | extern const struct clk_ops clk_divider_ro_ops; |
| @@ -499,8 +526,13 @@ void clk_hw_unregister_divider(struct clk_hw *hw); · 55 unmodified lines | ||
| 499 | 526 | * register, and mask of mux bits are in higher 16-bit of this register. |
| 500 | 527 | * While setting the mux bits, higher 16-bit should also be updated to |
| 501 | 528 | * indicate changing mux bits. |
| 529 | + * CLK_MUX_READ_ONLY - The mux registers can't be written, only read in the | |
| 530 | + * .get_parent clk_op. | |
| 502 | 531 | * CLK_MUX_ROUND_CLOSEST - Use the parent rate that is closest to the desired |
| 503 | 532 | * frequency. |
| 533 | + * CLK_MUX_BIG_ENDIAN - By default little endian register accesses are used for | |
| 534 | + * the mux register. Setting this flag makes the register accesses big | |
| 535 | + * endian. | |
| 504 | 536 | */ |
| 505 | 537 | struct clk_mux { |
| 506 | 538 | struct clk_hw hw; |
| @@ -519,6 +551,7 @@ struct clk_mux { · 12 unmodified lines | ||
| 519 | 551 | #define CLK_MUX_HIWORD_MASK BIT(2) |
| 520 | 552 | #define CLK_MUX_READ_ONLY BIT(3) /* mux can't be changed */ |
| 521 | 553 | #define CLK_MUX_ROUND_CLOSEST BIT(4) |
| 554 | +#define CLK_MUX_BIG_ENDIAN BIT(5) | |
| 522 | 555 | |
| 523 | 556 | extern const struct clk_ops clk_mux_ops; |
| 524 | 557 | extern const struct clk_ops clk_mux_ro_ops; |
| @@ -602,6 +635,9 @@ void clk_hw_unregister_fixed_factor(struct clk_hw *hw); · 77 unmodified lines | ||
| 602 | 635 | * is the value read from the register. If CLK_FRAC_DIVIDER_ZERO_BASED |
| 603 | 636 | * is set then the numerator and denominator are both the value read |
| 604 | 637 | * plus one. |
| 638 | + * CLK_FRAC_DIVIDER_BIG_ENDIAN - By default little endian register accesses are | |
| 639 | + * used for the divider register. Setting this flag makes the register | |
| 640 | + * accesses big endian. | |
| 605 | 641 | */ |
| 606 | 642 | struct clk_fractional_divider { |
| 607 | 643 | struct clk_hw hw; |
| @@ -622,6 +658,7 @@ struct clk_fractional_divider { · 14 unmodified lines | ||
| 622 | 658 | #define to_clk_fd(_hw) container_of(_hw, struct clk_fractional_divider, hw) |
| 623 | 659 | |
| 624 | 660 | #define CLK_FRAC_DIVIDER_ZERO_BASED BIT(0) |
| 661 | +#define CLK_FRAC_DIVIDER_BIG_ENDIAN BIT(1) | |
| 625 | 662 | |
| 626 | 663 | extern const struct clk_ops clk_fractional_divider_ops; |
| 627 | 664 | struct clk *clk_register_fractional_divider(struct device *dev, |
| @@ -654,6 +691,9 @@ void clk_hw_unregister_fractional_divider(struct clk_hw *hw); · 26 unmodified lines | ||
| 654 | 691 | * leaving the parent rate unmodified. |
| 655 | 692 | * CLK_MULTIPLIER_ROUND_CLOSEST - Makes the best calculated divider to be |
| 656 | 693 | * rounded to the closest integer instead of the down one. |
| 694 | + * CLK_MULTIPLIER_BIG_ENDIAN - By default little endian register accesses are | |
| 695 | + * used for the multiplier register. Setting this flag makes the register | |
| 696 | + * accesses big endian. | |
| 657 | 697 | */ |
| 658 | 698 | struct clk_multiplier { |
| 659 | 699 | struct clk_hw hw; |
| @@ -668,6 +708,7 @@ struct clk_multiplier { · 8 unmodified lines | ||
| 668 | 708 | |
| 669 | 709 | #define CLK_MULTIPLIER_ZERO_BYPASS BIT(0) |
| 670 | 710 | #define CLK_MULTIPLIER_ROUND_CLOSEST BIT(1) |
| 711 | +#define CLK_MULTIPLIER_BIG_ENDIAN BIT(2) | |
| 671 | 712 | |
| 672 | 713 | extern const struct clk_ops clk_multiplier_ops; |
| 673 | 714 | |
| @@ -712,16 +753,19 @@ struct clk_hw *clk_hw_register_composite(struct device *dev, const char *name, · 38 unmodified lines | ||
| 712 | 753 | unsigned long flags); |
| 713 | 754 | void clk_hw_unregister_composite(struct clk_hw *hw); |
| 714 | 755 | |
| 715 | −/*** | |
| 716 | − * struct clk_gpio_gate - gpio gated clock | |
| 756 | +/** | |
| 757 | + * struct clk_gpio - gpio gated clock | |
| 717 | 758 | * |
| 718 | 759 | * @hw: handle between common and hardware-specific interfaces |
| 719 | 760 | * @gpiod: gpio descriptor |
| 720 | 761 | * |
| 721 | − * Clock with a gpio control for enabling and disabling the parent clock. | |
| 722 | − * Implements .enable, .disable and .is_enabled | |
| 762 | + * Clock with a gpio control for enabling and disabling the parent clock | |
| 763 | + * or switching between two parents by asserting or deasserting the gpio. | |
| 764 | + * | |
| 765 | + * Implements .enable, .disable and .is_enabled or | |
| 766 | + * .get_parent, .set_parent and .determine_rate depending on which clk_ops | |
| 767 | + * is used. | |
| 723 | 768 | */ |
| 724 | − | |
| 725 | 769 | struct clk_gpio { |
| 726 | 770 | struct clk_hw hw; |
| 727 | 771 | struct gpio_desc *gpiod; |
| @@ -738,16 +782,6 @@ struct clk_hw *clk_hw_register_gpio_gate(struct device *dev, const char *name, · 10 unmodified lines | ||
| 738 | 782 | unsigned long flags); |
| 739 | 783 | void clk_hw_unregister_gpio_gate(struct clk_hw *hw); |
| 740 | 784 | |
| 741 | −/** | |
| 742 | − * struct clk_gpio_mux - gpio controlled clock multiplexer | |
| 743 | − * | |
| 744 | − * @hw: see struct clk_gpio | |
| 745 | − * @gpiod: gpio descriptor to select the parent of this clock multiplexer | |
| 746 | − * | |
| 747 | − * Clock with a gpio control for selecting the parent clock. | |
| 748 | − * Implements .get_parent, .set_parent and .determine_rate | |
| 749 | − */ | |
| 750 | − | |
| 751 | 785 | extern const struct clk_ops clk_gpio_mux_ops; |
| 752 | 786 | struct clk *clk_register_gpio_mux(struct device *dev, const char *name, |
| 753 | 787 | const char * const *parent_names, u8 num_parents, struct gpio_desc *gpiod, |
| @@ -757,22 +791,12 @@ struct clk_hw *clk_hw_register_gpio_mux(struct device *dev, const char *name, · 3 unmodified lines | ||
| 757 | 791 | unsigned long flags); |
| 758 | 792 | void clk_hw_unregister_gpio_mux(struct clk_hw *hw); |
| 759 | 793 | |
| 760 | −/** | |
| 761 | − * clk_register - allocate a new clock, register it and return an opaque cookie | |
| 762 | − * @dev: device that is registering this clock | |
| 763 | − * @hw: link to hardware-specific clock data | |
| 764 | − * | |
| 765 | − * clk_register is the primary interface for populating the clock tree with new | |
| 766 | − * clock nodes. It returns a pointer to the newly allocated struct clk which | |
| 767 | − * cannot be dereferenced by driver code but may be used in conjuction with the | |
| 768 | − * rest of the clock API. In the event of an error clk_register will return an | |
| 769 | − * error code; drivers must test for an error code after calling clk_register. | |
| 770 | − */ | |
| 771 | 794 | struct clk *clk_register(struct device *dev, struct clk_hw *hw); |
| 772 | 795 | struct clk *devm_clk_register(struct device *dev, struct clk_hw *hw); |
| 773 | 796 | |
| 774 | 797 | int __must_check clk_hw_register(struct device *dev, struct clk_hw *hw); |
| 775 | 798 | int __must_check devm_clk_hw_register(struct device *dev, struct clk_hw *hw); |
| 799 | +int __must_check of_clk_hw_register(struct device_node *node, struct clk_hw *hw); | |
| 776 | 800 | |
| 777 | 801 | void clk_unregister(struct clk *clk); |
| 778 | 802 | void devm_clk_unregister(struct device *dev, struct clk *clk); |
| @@ -993,37 +1017,6 @@ static inline int of_clk_detect_critical(struct device_node *np, int index, · 214 unmodified lines | ||
| 993 | 1017 | } |
| 994 | 1018 | #endif /* CONFIG_OF */ |
| 995 | 1019 | |
| 996 | −/* | |
| 997 | − * wrap access to peripherals in accessor routines | |
| 998 | − * for improved portability across platforms | |
| 999 | − */ | |
| 1000 | − | |
| 1001 | −#if IS_ENABLED(CONFIG_PPC) | |
| 1002 | − | |
| 1003 | −static inline u32 clk_readl(u32 __iomem *reg) | |
| 1004 | −{ | |
| 1005 | − return ioread32be(reg); | |
| 1006 | −} | |
| 1007 | − | |
| 1008 | −static inline void clk_writel(u32 val, u32 __iomem *reg) | |
| 1009 | −{ | |
| 1010 | − iowrite32be(val, reg); | |
| 1011 | −} | |
| 1012 | − | |
| 1013 | −#else /* platform dependent I/O accessors */ | |
| 1014 | − | |
| 1015 | −static inline u32 clk_readl(u32 __iomem *reg) | |
| 1016 | −{ | |
| 1017 | − return readl(reg); | |
| 1018 | −} | |
| 1019 | − | |
| 1020 | −static inline void clk_writel(u32 val, u32 __iomem *reg) | |
| 1021 | −{ | |
| 1022 | − writel(val, reg); | |
| 1023 | −} | |
| 1024 | − | |
| 1025 | −#endif /* platform dependent I/O accessors */ | |
| 1026 | − | |
| 1027 | 1020 | void clk_gate_restore_context(struct clk_hw *hw); |
| 1028 | 1021 | |
| 1029 | 1022 | #endif /* CONFIG_COMMON_CLK */ |
| @@ -811,6 +811,22 @@ static inline bool clk_has_parent(struct clk *clk, struct clk *parent) · 810 unmodified lines | ||
| 811 | 811 | return true; |
| 812 | 812 | } |
| 813 | 813 | |
| 814 | +static inline int clk_set_rate_range(struct clk *clk, unsigned long min, | |
| 815 | + unsigned long max) | |
| 816 | +{ | |
| 817 | + return 0; | |
| 818 | +} | |
| 819 | + | |
| 820 | +static inline int clk_set_min_rate(struct clk *clk, unsigned long rate) | |
| 821 | +{ | |
| 822 | + return 0; | |
| 823 | +} | |
| 824 | + | |
| 825 | +static inline int clk_set_max_rate(struct clk *clk, unsigned long rate) | |
| 826 | +{ | |
| 827 | + return 0; | |
| 828 | +} | |
| 829 | + | |
| 814 | 830 | static inline int clk_set_parent(struct clk *clk, struct clk *parent) |
| 815 | 831 | { |
| 816 | 832 | return 0; |
| @@ -0,0 +1,79 @@ | ||
| 1 | +/* SPDX-License-Identifier: GPL-2.0 */ | |
| 2 | +/* | |
| 3 | + * Copyright (C) 2018-2019 SiFive, Inc. | |
| 4 | + * Wesley Terpstra | |
| 5 | + * Paul Walmsley | |
| 6 | + */ | |
| 7 | + | |
| 8 | +#ifndef __LINUX_CLK_ANALOGBITS_WRPLL_CLN28HPC_H | |
| 9 | +#define __LINUX_CLK_ANALOGBITS_WRPLL_CLN28HPC_H | |
| 10 | + | |
| 11 | +#include <linux/types.h> | |
| 12 | + | |
| 13 | +/* DIVQ_VALUES: number of valid DIVQ values */ | |
| 14 | +#define DIVQ_VALUES 6 | |
| 15 | + | |
| 16 | +/* | |
| 17 | + * Bit definitions for struct wrpll_cfg.flags | |
| 18 | + * | |
| 19 | + * WRPLL_FLAGS_BYPASS_FLAG: if set, the PLL is either in bypass, or should be | |
| 20 | + * programmed to enter bypass | |
| 21 | + * WRPLL_FLAGS_RESET_FLAG: if set, the PLL is in reset | |
| 22 | + * WRPLL_FLAGS_INT_FEEDBACK_FLAG: if set, the PLL is configured for internal | |
| 23 | + * feedback mode | |
| 24 | + * WRPLL_FLAGS_EXT_FEEDBACK_FLAG: if set, the PLL is configured for external | |
| 25 | + * feedback mode (not yet supported by this driver) | |
| 26 | + */ | |
| 27 | +#define WRPLL_FLAGS_BYPASS_SHIFT 0 | |
| 28 | +#define WRPLL_FLAGS_BYPASS_MASK BIT(WRPLL_FLAGS_BYPASS_SHIFT) | |
| 29 | +#define WRPLL_FLAGS_RESET_SHIFT 1 | |
| 30 | +#define WRPLL_FLAGS_RESET_MASK BIT(WRPLL_FLAGS_RESET_SHIFT) | |
| 31 | +#define WRPLL_FLAGS_INT_FEEDBACK_SHIFT 2 | |
| 32 | +#define WRPLL_FLAGS_INT_FEEDBACK_MASK BIT(WRPLL_FLAGS_INT_FEEDBACK_SHIFT) | |
| 33 | +#define WRPLL_FLAGS_EXT_FEEDBACK_SHIFT 3 | |
| 34 | +#define WRPLL_FLAGS_EXT_FEEDBACK_MASK BIT(WRPLL_FLAGS_EXT_FEEDBACK_SHIFT) | |
| 35 | + | |
| 36 | +/** | |
| 37 | + * struct wrpll_cfg - WRPLL configuration values | |
| 38 | + * @divr: reference divider value (6 bits), as presented to the PLL signals | |
| 39 | + * @divf: feedback divider value (9 bits), as presented to the PLL signals | |
| 40 | + * @divq: output divider value (3 bits), as presented to the PLL signals | |
| 41 | + * @flags: PLL configuration flags. See above for more information | |
| 42 | + * @range: PLL loop filter range. See below for more information | |
| 43 | + * @output_rate_cache: cached output rates, swept across DIVQ | |
| 44 | + * @parent_rate: PLL refclk rate for which values are valid | |
| 45 | + * @max_r: maximum possible R divider value, given @parent_rate | |
| 46 | + * @init_r: initial R divider value to start the search from | |
| 47 | + * | |
| 48 | + * @divr, @divq, @divq, @range represent what the PLL expects to see | |
| 49 | + * on its input signals. Thus @divr and @divf are the actual divisors | |
| 50 | + * minus one. @divq is a power-of-two divider; for example, 1 = | |
| 51 | + * divide-by-2 and 6 = divide-by-64. 0 is an invalid @divq value. | |
| 52 | + * | |
| 53 | + * When initially passing a struct wrpll_cfg record, the | |
| 54 | + * record should be zero-initialized with the exception of the @flags | |
| 55 | + * field. The only flag bits that need to be set are either | |
| 56 | + * WRPLL_FLAGS_INT_FEEDBACK or WRPLL_FLAGS_EXT_FEEDBACK. | |
| 57 | + */ | |
| 58 | +struct wrpll_cfg { | |
| 59 | + u8 divr; | |
| 60 | + u8 divq; | |
| 61 | + u8 range; | |
| 62 | + u8 flags; | |
| 63 | + u16 divf; | |
| 64 | +/* private: */ | |
| 65 | + u32 output_rate_cache[DIVQ_VALUES]; | |
| 66 | + unsigned long parent_rate; | |
| 67 | + u8 max_r; | |
| 68 | + u8 init_r; | |
| 69 | +}; | |
| 70 | + | |
| 71 | +int wrpll_configure_for_rate(struct wrpll_cfg *c, u32 target_rate, | |
| 72 | + unsigned long parent_rate); | |
| 73 | + | |
| 74 | +unsigned int wrpll_calc_max_lock_us(const struct wrpll_cfg *c); | |
| 75 | + | |
| 76 | +unsigned long wrpll_calc_output_rate(const struct wrpll_cfg *c, | |
| 77 | + unsigned long parent_rate); | |
| 78 | + | |
| 79 | +#endif /* __LINUX_CLK_ANALOGBITS_WRPLL_CLN28HPC_H */ | |
| @@ -74,6 +74,8 @@ · 73 unmodified lines | ||
| 74 | 74 | #define AT91_PMC_USBDIV_4 (2 << 28) |
| 75 | 75 | #define AT91_PMC_USB96M (1 << 28) /* Divider by 2 Enable (PLLB only) */ |
| 76 | 76 | |
| 77 | +#define AT91_PMC_CPU_CKR 0x28 /* CPU Clock Register */ | |
| 78 | + | |
| 77 | 79 | #define AT91_PMC_MCKR 0x30 /* Master Clock Register */ |
| 78 | 80 | #define AT91_PMC_CSS (3 << 0) /* Master Clock Selection */ |
| 79 | 81 | #define AT91_PMC_CSS_SLOW (0 << 0) |
| @@ -159,6 +161,7 @@ · 79 unmodified lines | ||
| 159 | 161 | |
| 160 | 162 | #define AT91_PMC_FSMR 0x70 /* Fast Startup Mode Register */ |
| 161 | 163 | #define AT91_PMC_FSTT(n) BIT(n) |
| 164 | +#define AT91_PMC_RTTAL BIT(16) | |
| 162 | 165 | #define AT91_PMC_RTCAL BIT(17) /* RTC Alarm Enable */ |
| 163 | 166 | #define AT91_PMC_USBAL BIT(18) /* USB Resume Enable */ |
| 164 | 167 | #define AT91_PMC_SDMMC_CD BIT(19) /* SDMMC Card Detect Enable */ |
| @@ -187,16 +190,8 @@ · 22 unmodified lines | ||
| 187 | 190 | |
| 188 | 191 | #define AT91_PMC_PCR 0x10c /* Peripheral Control Register [some SAM9 and SAMA5] */ |
| 189 | 192 | #define AT91_PMC_PCR_PID_MASK 0x3f |
| 190 | −#define AT91_PMC_PCR_GCKCSS_OFFSET 8 | |
| 191 | −#define AT91_PMC_PCR_GCKCSS_MASK (0x7 << AT91_PMC_PCR_GCKCSS_OFFSET) | |
| 192 | −#define AT91_PMC_PCR_GCKCSS(n) ((n) << AT91_PMC_PCR_GCKCSS_OFFSET) /* GCK Clock Source Selection */ | |
| 193 | 193 | #define AT91_PMC_PCR_CMD (0x1 << 12) /* Command (read=0, write=1) */ |
| 194 | −#define AT91_PMC_PCR_DIV_OFFSET 16 | |
| 195 | −#define AT91_PMC_PCR_DIV_MASK (0x3 << AT91_PMC_PCR_DIV_OFFSET) | |
| 196 | −#define AT91_PMC_PCR_DIV(n) ((n) << AT91_PMC_PCR_DIV_OFFSET) /* Divisor Value */ | |
| 197 | −#define AT91_PMC_PCR_GCKDIV_OFFSET 20 | |
| 198 | −#define AT91_PMC_PCR_GCKDIV_MASK (0xff << AT91_PMC_PCR_GCKDIV_OFFSET) | |
| 199 | −#define AT91_PMC_PCR_GCKDIV(n) ((n) << AT91_PMC_PCR_GCKDIV_OFFSET) /* Generated Clock Divisor Value */ | |
| 194 | +#define AT91_PMC_PCR_GCKDIV_MASK GENMASK(27, 20) | |
| 200 | 195 | #define AT91_PMC_PCR_EN (0x1 << 28) /* Enable */ |
| 201 | 196 | #define AT91_PMC_PCR_GCKEN (0x1 << 29) /* GCK Enable */ |
| 202 | 197 | |
| @@ -243,6 +243,7 @@ struct ti_clk_ll_ops { · 242 unmodified lines | ||
| 243 | 243 | |
| 244 | 244 | #define to_clk_hw_omap(_hw) container_of(_hw, struct clk_hw_omap, hw) |
| 245 | 245 | |
| 246 | +bool omap2_clk_is_hw_omap(struct clk_hw *hw); | |
| 246 | 247 | int omap2_clk_disable_autoidle_all(void); |
| 247 | 248 | int omap2_clk_enable_autoidle_all(void); |
| 248 | 249 | int omap2_clk_allow_idle(struct clk *clk); |
| @@ -293,6 +294,7 @@ struct ti_clk_features { · 44 unmodified lines | ||
| 293 | 294 | #define TI_CLK_DISABLE_CLKDM_CONTROL BIT(2) |
| 294 | 295 | #define TI_CLK_ERRATA_I810 BIT(3) |
| 295 | 296 | #define TI_CLK_CLKCTRL_COMPAT BIT(4) |
| 297 | +#define TI_CLK_DEVICE_TYPE_GP BIT(5) | |
| 296 | 298 | |
| 297 | 299 | void ti_clk_setup_features(struct ti_clk_features *features); |
| 298 | 300 | const struct ti_clk_features *ti_clk_get_features(void); |
| @@ -53,23 +53,24 @@ void ftrace_likely_update(struct ftrace_likely_data *f, int val, · 52 unmodified lines | ||
| 53 | 53 | * "Define 'is'", Bill Clinton |
| 54 | 54 | * "Define 'if'", Steven Rostedt |
| 55 | 55 | */ |
| 56 | −#define if(cond, ...) __trace_if( (cond , ## __VA_ARGS__) ) | |
| 57 | −#define __trace_if(cond) \ | |
| 58 | − if (__builtin_constant_p(!!(cond)) ? !!(cond) : \ | |
| 59 | − ({ \ | |
| 60 | − int ______r; \ | |
| 61 | − static struct ftrace_branch_data \ | |
| 62 | − __aligned(4) \ | |
| 63 | − __section("_ftrace_branch") \ | |
| 64 | − ______f = { \ | |
| 65 | − .func = __func__, \ | |
| 66 | − .file = __FILE__, \ | |
| 67 | − .line = __LINE__, \ | |
| 68 | − }; \ | |
| 69 | − ______r = !!(cond); \ | |
| 70 | − ______f.miss_hit[______r]++; \ | |
| 71 | − ______r; \ | |
| 72 | − })) | |
| 56 | +#define if(cond, ...) if ( __trace_if_var( !!(cond , ## __VA_ARGS__) ) ) | |
| 57 | + | |
| 58 | +#define __trace_if_var(cond) (__builtin_constant_p(cond) ? (cond) : __trace_if_value(cond)) | |
| 59 | + | |
| 60 | +#define __trace_if_value(cond) ({ \ | |
| 61 | + static struct ftrace_branch_data \ | |
| 62 | + __aligned(4) \ | |
| 63 | + __section("_ftrace_branch") \ | |
| 64 | + __if_trace = { \ | |
| 65 | + .func = __func__, \ | |
| 66 | + .file = __FILE__, \ | |
| 67 | + .line = __LINE__, \ | |
| 68 | + }; \ | |
| 69 | + (cond) ? \ | |
| 70 | + (__if_trace.miss_hit[1]++,1) : \ | |
| 71 | + (__if_trace.miss_hit[0]++,0); \ | |
| 72 | +}) | |
| 73 | + | |
| 73 | 74 | #endif /* CONFIG_PROFILE_ALL_BRANCHES */ |
| 74 | 75 | |
| 75 | 76 | #else |
| @@ -140,8 +140,7 @@ struct ftrace_likely_data { · 139 unmodified lines | ||
| 140 | 140 | * Do not use __always_inline here, since currently it expands to inline again |
| 141 | 141 | * (which would break users of __always_inline). |
| 142 | 142 | */ |
| 143 | −#if !defined(CONFIG_ARCH_SUPPORTS_OPTIMIZED_INLINING) || \ | |
| 144 | − !defined(CONFIG_OPTIMIZE_INLINING) | |
| 143 | +#if !defined(CONFIG_OPTIMIZE_INLINING) | |
| 145 | 144 | #define inline inline __attribute__((__always_inline__)) __gnu_inline \ |
| 146 | 145 | __maybe_unused notrace |
| 147 | 146 | #else |
| @@ -166,6 +166,11 @@ struct console { · 165 unmodified lines | ||
| 166 | 166 | extern int console_set_on_cmdline; |
| 167 | 167 | extern struct console *early_console; |
| 168 | 168 | |
| 169 | +enum con_flush_mode { | |
| 170 | + CONSOLE_FLUSH_PENDING, | |
| 171 | + CONSOLE_REPLAY_ALL, | |
| 172 | +}; | |
| 173 | + | |
| 169 | 174 | extern int add_preferred_console(char *name, int idx, char *options); |
| 170 | 175 | extern void register_console(struct console *); |
| 171 | 176 | extern int unregister_console(struct console *); |
| @@ -175,7 +180,7 @@ extern int console_trylock(void); · 3 unmodified lines | ||
| 175 | 180 | extern void console_unlock(void); |
| 176 | 181 | extern void console_conditional_schedule(void); |
| 177 | 182 | extern void console_unblank(void); |
| 178 | −extern void console_flush_on_panic(void); | |
| 183 | +extern void console_flush_on_panic(enum con_flush_mode mode); | |
| 179 | 184 | extern struct tty_driver *console_device(int *); |
| 180 | 185 | extern void console_stop(struct console *); |
| 181 | 186 | extern void console_start(struct console *); |
| @@ -12,11 +12,13 @@ · 11 unmodified lines | ||
| 12 | 12 | |
| 13 | 13 | /* ETMv3.5/PTM's ETMCR config bit */ |
| 14 | 14 | #define ETM_OPT_CYCACC 12 |
| 15 | +#define ETM_OPT_CTXTID 14 | |
| 15 | 16 | #define ETM_OPT_TS 28 |
| 16 | 17 | #define ETM_OPT_RETSTK 29 |
| 17 | 18 | |
| 18 | 19 | /* ETMv4 CONFIGR programming bits for the ETM OPTs */ |
| 19 | 20 | #define ETM4_CFG_BIT_CYCACC 4 |
| 21 | +#define ETM4_CFG_BIT_CTXTID 6 | |
| 20 | 22 | #define ETM4_CFG_BIT_TS 11 |
| 21 | 23 | #define ETM4_CFG_BIT_RETSTK 12 |
| 22 | 24 | |
| @@ -192,9 +192,10 @@ struct coresight_device { · 191 unmodified lines | ||
| 192 | 192 | */ |
| 193 | 193 | struct coresight_ops_sink { |
| 194 | 194 | int (*enable)(struct coresight_device *csdev, u32 mode, void *data); |
| 195 | − void (*disable)(struct coresight_device *csdev); | |
| 196 | − void *(*alloc_buffer)(struct coresight_device *csdev, int cpu, | |
| 197 | − void **pages, int nr_pages, bool overwrite); | |
| 195 | + int (*disable)(struct coresight_device *csdev); | |
| 196 | + void *(*alloc_buffer)(struct coresight_device *csdev, | |
| 197 | + struct perf_event *event, void **pages, | |
| 198 | + int nr_pages, bool overwrite); | |
| 198 | 199 | void (*free_buffer)(void *config); |
| 199 | 200 | unsigned long (*update_buffer)(struct coresight_device *csdev, |
| 200 | 201 | struct perf_output_handle *handle, |
| @@ -0,0 +1,510 @@ | ||
| 1 | +/* SPDX-License-Identifier: GPL-2.0 */ | |
| 2 | +/* | |
| 3 | + * Counter interface | |
| 4 | + * Copyright (C) 2018 William Breathitt Gray | |
| 5 | + */ | |
| 6 | +#ifndef _COUNTER_H_ | |
| 7 | +#define _COUNTER_H_ | |
| 8 | + | |
| 9 | +#include <linux/counter_enum.h> | |
| 10 | +#include <linux/device.h> | |
| 11 | +#include <linux/types.h> | |
| 12 | + | |
| 13 | +enum counter_count_direction { | |
| 14 | + COUNTER_COUNT_DIRECTION_FORWARD = 0, | |
| 15 | + COUNTER_COUNT_DIRECTION_BACKWARD | |
| 16 | +}; | |
| 17 | +extern const char *const counter_count_direction_str[2]; | |
| 18 | + | |
| 19 | +enum counter_count_mode { | |
| 20 | + COUNTER_COUNT_MODE_NORMAL = 0, | |
| 21 | + COUNTER_COUNT_MODE_RANGE_LIMIT, | |
| 22 | + COUNTER_COUNT_MODE_NON_RECYCLE, | |
| 23 | + COUNTER_COUNT_MODE_MODULO_N | |
| 24 | +}; | |
| 25 | +extern const char *const counter_count_mode_str[4]; | |
| 26 | + | |
| 27 | +struct counter_device; | |
| 28 | +struct counter_signal; | |
| 29 | + | |
| 30 | +/** | |
| 31 | + * struct counter_signal_ext - Counter Signal extensions | |
| 32 | + * @name: attribute name | |
| 33 | + * @read: read callback for this attribute; may be NULL | |
| 34 | + * @write: write callback for this attribute; may be NULL | |
| 35 | + * @priv: data private to the driver | |
| 36 | + */ | |
| 37 | +struct counter_signal_ext { | |
| 38 | + const char *name; | |
| 39 | + ssize_t (*read)(struct counter_device *counter, | |
| 40 | + struct counter_signal *signal, void *priv, char *buf); | |
| 41 | + ssize_t (*write)(struct counter_device *counter, | |
| 42 | + struct counter_signal *signal, void *priv, | |
| 43 | + const char *buf, size_t len); | |
| 44 | + void *priv; | |
| 45 | +}; | |
| 46 | + | |
| 47 | +/** | |
| 48 | + * struct counter_signal - Counter Signal node | |
| 49 | + * @id: unique ID used to identify signal | |
| 50 | + * @name: device-specific Signal name; ideally, this should match the name | |
| 51 | + * as it appears in the datasheet documentation | |
| 52 | + * @ext: optional array of Counter Signal extensions | |
| 53 | + * @num_ext: number of Counter Signal extensions specified in @ext | |
| 54 | + * @priv: optional private data supplied by driver | |
| 55 | + */ | |
| 56 | +struct counter_signal { | |
| 57 | + int id; | |
| 58 | + const char *name; | |
| 59 | + | |
| 60 | + const struct counter_signal_ext *ext; | |
| 61 | + size_t num_ext; | |
| 62 | + | |
| 63 | + void *priv; | |
| 64 | +}; | |
| 65 | + | |
| 66 | +/** | |
| 67 | + * struct counter_signal_enum_ext - Signal enum extension attribute | |
| 68 | + * @items: Array of strings | |
| 69 | + * @num_items: Number of items specified in @items | |
| 70 | + * @set: Set callback function; may be NULL | |
| 71 | + * @get: Get callback function; may be NULL | |
| 72 | + * | |
| 73 | + * The counter_signal_enum_ext structure can be used to implement enum style | |
| 74 | + * Signal extension attributes. Enum style attributes are those which have a set | |
| 75 | + * of strings that map to unsigned integer values. The Generic Counter Signal | |
| 76 | + * enum extension helper code takes care of mapping between value and string, as | |
| 77 | + * well as generating a "_available" file which contains a list of all available | |
| 78 | + * items. The get callback is used to query the currently active item; the index | |
| 79 | + * of the item within the respective items array is returned via the 'item' | |
| 80 | + * parameter. The set callback is called when the attribute is updated; the | |
| 81 | + * 'item' parameter contains the index of the newly activated item within the | |
| 82 | + * respective items array. | |
| 83 | + */ | |
| 84 | +struct counter_signal_enum_ext { | |
| 85 | + const char * const *items; | |
| 86 | + size_t num_items; | |
| 87 | + int (*get)(struct counter_device *counter, | |
| 88 | + struct counter_signal *signal, size_t *item); | |
| 89 | + int (*set)(struct counter_device *counter, | |
| 90 | + struct counter_signal *signal, size_t item); | |
| 91 | +}; | |
| 92 | + | |
| 93 | +/** | |
| 94 | + * COUNTER_SIGNAL_ENUM() - Initialize Signal enum extension | |
| 95 | + * @_name: Attribute name | |
| 96 | + * @_e: Pointer to a counter_signal_enum_ext structure | |
| 97 | + * | |
| 98 | + * This should usually be used together with COUNTER_SIGNAL_ENUM_AVAILABLE() | |
| 99 | + */ | |
| 100 | +#define COUNTER_SIGNAL_ENUM(_name, _e) \ | |
| 101 | +{ \ | |
| 102 | + .name = (_name), \ | |
| 103 | + .read = counter_signal_enum_read, \ | |
| 104 | + .write = counter_signal_enum_write, \ | |
| 105 | + .priv = (_e) \ | |
| 106 | +} | |
| 107 | + | |
| 108 | +/** | |
| 109 | + * COUNTER_SIGNAL_ENUM_AVAILABLE() - Initialize Signal enum available extension | |
| 110 | + * @_name: Attribute name ("_available" will be appended to the name) | |
| 111 | + * @_e: Pointer to a counter_signal_enum_ext structure | |
| 112 | + * | |
| 113 | + * Creates a read only attribute that lists all the available enum items in a | |
| 114 | + * newline separated list. This should usually be used together with | |
| 115 | + * COUNTER_SIGNAL_ENUM() | |
| 116 | + */ | |
| 117 | +#define COUNTER_SIGNAL_ENUM_AVAILABLE(_name, _e) \ | |
| 118 | +{ \ | |
| 119 | + .name = (_name "_available"), \ | |
| 120 | + .read = counter_signal_enum_available_read, \ | |
| 121 | + .priv = (_e) \ | |
| 122 | +} | |
| 123 | + | |
| 124 | +enum counter_synapse_action { | |
| 125 | + COUNTER_SYNAPSE_ACTION_NONE = 0, | |
| 126 | + COUNTER_SYNAPSE_ACTION_RISING_EDGE, | |
| 127 | + COUNTER_SYNAPSE_ACTION_FALLING_EDGE, | |
| 128 | + COUNTER_SYNAPSE_ACTION_BOTH_EDGES | |
| 129 | +}; | |
| 130 | + | |
| 131 | +/** | |
| 132 | + * struct counter_synapse - Counter Synapse node | |
| 133 | + * @action: index of current action mode | |
| 134 | + * @actions_list: array of available action modes | |
| 135 | + * @num_actions: number of action modes specified in @actions_list | |
| 136 | + * @signal: pointer to associated signal | |
| 137 | + */ | |
| 138 | +struct counter_synapse { | |
| 139 | + size_t action; | |
| 140 | + const enum counter_synapse_action *actions_list; | |
| 141 | + size_t num_actions; | |
| 142 | + | |
| 143 | + struct counter_signal *signal; | |
| 144 | +}; | |
| 145 | + | |
| 146 | +struct counter_count; | |
| 147 | + | |
| 148 | +/** | |
| 149 | + * struct counter_count_ext - Counter Count extension | |
| 150 | + * @name: attribute name | |
| 151 | + * @read: read callback for this attribute; may be NULL | |
| 152 | + * @write: write callback for this attribute; may be NULL | |
| 153 | + * @priv: data private to the driver | |
| 154 | + */ | |
| 155 | +struct counter_count_ext { | |
| 156 | + const char *name; | |
| 157 | + ssize_t (*read)(struct counter_device *counter, | |
| 158 | + struct counter_count *count, void *priv, char *buf); | |
| 159 | + ssize_t (*write)(struct counter_device *counter, | |
| 160 | + struct counter_count *count, void *priv, | |
| 161 | + const char *buf, size_t len); | |
| 162 | + void *priv; | |
| 163 | +}; | |
| 164 | + | |
| 165 | +enum counter_count_function { | |
| 166 | + COUNTER_COUNT_FUNCTION_INCREASE = 0, | |
| 167 | + COUNTER_COUNT_FUNCTION_DECREASE, | |
| 168 | + COUNTER_COUNT_FUNCTION_PULSE_DIRECTION, | |
| 169 | + COUNTER_COUNT_FUNCTION_QUADRATURE_X1_A, | |
| 170 | + COUNTER_COUNT_FUNCTION_QUADRATURE_X1_B, | |
| 171 | + COUNTER_COUNT_FUNCTION_QUADRATURE_X2_A, | |
| 172 | + COUNTER_COUNT_FUNCTION_QUADRATURE_X2_B, | |
| 173 | + COUNTER_COUNT_FUNCTION_QUADRATURE_X4 | |
| 174 | +}; | |
| 175 | + | |
| 176 | +/** | |
| 177 | + * struct counter_count - Counter Count node | |
| 178 | + * @id: unique ID used to identify Count | |
| 179 | + * @name: device-specific Count name; ideally, this should match | |
| 180 | + * the name as it appears in the datasheet documentation | |
| 181 | + * @function: index of current function mode | |
| 182 | + * @functions_list: array available function modes | |
| 183 | + * @num_functions: number of function modes specified in @functions_list | |
| 184 | + * @synapses: array of synapses for initialization | |
| 185 | + * @num_synapses: number of synapses specified in @synapses | |
| 186 | + * @ext: optional array of Counter Count extensions | |
| 187 | + * @num_ext: number of Counter Count extensions specified in @ext | |
| 188 | + * @priv: optional private data supplied by driver | |
| 189 | + */ | |
| 190 | +struct counter_count { | |
| 191 | + int id; | |
| 192 | + const char *name; | |
| 193 | + | |
| 194 | + size_t function; | |
| 195 | + const enum counter_count_function *functions_list; | |
| 196 | + size_t num_functions; | |
| 197 | + | |
| 198 | + struct counter_synapse *synapses; | |
| 199 | + size_t num_synapses; | |
| 200 | + | |
| 201 | + const struct counter_count_ext *ext; | |
| 202 | + size_t num_ext; | |
| 203 | + | |
| 204 | + void *priv; | |
| 205 | +}; | |
| 206 | + | |
| 207 | +/** | |
| 208 | + * struct counter_count_enum_ext - Count enum extension attribute | |
| 209 | + * @items: Array of strings | |
| 210 | + * @num_items: Number of items specified in @items | |
| 211 | + * @set: Set callback function; may be NULL | |
| 212 | + * @get: Get callback function; may be NULL | |
| 213 | + * | |
| 214 | + * The counter_count_enum_ext structure can be used to implement enum style | |
| 215 | + * Count extension attributes. Enum style attributes are those which have a set | |
| 216 | + * of strings that map to unsigned integer values. The Generic Counter Count | |
| 217 | + * enum extension helper code takes care of mapping between value and string, as | |
| 218 | + * well as generating a "_available" file which contains a list of all available | |
| 219 | + * items. The get callback is used to query the currently active item; the index | |
| 220 | + * of the item within the respective items array is returned via the 'item' | |
| 221 | + * parameter. The set callback is called when the attribute is updated; the | |
| 222 | + * 'item' parameter contains the index of the newly activated item within the | |
| 223 | + * respective items array. | |
| 224 | + */ | |
| 225 | +struct counter_count_enum_ext { | |
| 226 | + const char * const *items; | |
| 227 | + size_t num_items; | |
| 228 | + int (*get)(struct counter_device *counter, struct counter_count *count, | |
| 229 | + size_t *item); | |
| 230 | + int (*set)(struct counter_device *counter, struct counter_count *count, | |
| 231 | + size_t item); | |
| 232 | +}; | |
| 233 | + | |
| 234 | +/** | |
| 235 | + * COUNTER_COUNT_ENUM() - Initialize Count enum extension | |
| 236 | + * @_name: Attribute name | |
| 237 | + * @_e: Pointer to a counter_count_enum_ext structure | |
| 238 | + * | |
| 239 | + * This should usually be used together with COUNTER_COUNT_ENUM_AVAILABLE() | |
| 240 | + */ | |
| 241 | +#define COUNTER_COUNT_ENUM(_name, _e) \ | |
| 242 | +{ \ | |
| 243 | + .name = (_name), \ | |
| 244 | + .read = counter_count_enum_read, \ | |
| 245 | + .write = counter_count_enum_write, \ | |
| 246 | + .priv = (_e) \ | |
| 247 | +} | |
| 248 | + | |
| 249 | +/** | |
| 250 | + * COUNTER_COUNT_ENUM_AVAILABLE() - Initialize Count enum available extension | |
| 251 | + * @_name: Attribute name ("_available" will be appended to the name) | |
| 252 | + * @_e: Pointer to a counter_count_enum_ext structure | |
| 253 | + * | |
| 254 | + * Creates a read only attribute that lists all the available enum items in a | |
| 255 | + * newline separated list. This should usually be used together with | |
| 256 | + * COUNTER_COUNT_ENUM() | |
| 257 | + */ | |
| 258 | +#define COUNTER_COUNT_ENUM_AVAILABLE(_name, _e) \ | |
| 259 | +{ \ | |
| 260 | + .name = (_name "_available"), \ | |
| 261 | + .read = counter_count_enum_available_read, \ | |
| 262 | + .priv = (_e) \ | |
| 263 | +} | |
| 264 | + | |
| 265 | +/** | |
| 266 | + * struct counter_device_attr_group - internal container for attribute group | |
| 267 | + * @attr_group: Counter sysfs attributes group | |
| 268 | + * @attr_list: list to keep track of created Counter sysfs attributes | |
| 269 | + * @num_attr: number of Counter sysfs attributes | |
| 270 | + */ | |
| 271 | +struct counter_device_attr_group { | |
| 272 | + struct attribute_group attr_group; | |
| 273 | + struct list_head attr_list; | |
| 274 | + size_t num_attr; | |
| 275 | +}; | |
| 276 | + | |
| 277 | +/** | |
| 278 | + * struct counter_device_state - internal state container for a Counter device | |
| 279 | + * @id: unique ID used to identify the Counter | |
| 280 | + * @dev: internal device structure | |
| 281 | + * @groups_list: attribute groups list (for Signals, Counts, and ext) | |
| 282 | + * @num_groups: number of attribute groups containers | |
| 283 | + * @groups: Counter sysfs attribute groups (to populate @dev.groups) | |
| 284 | + */ | |
| 285 | +struct counter_device_state { | |
| 286 | + int id; | |
| 287 | + struct device dev; | |
| 288 | + struct counter_device_attr_group *groups_list; | |
| 289 | + size_t num_groups; | |
| 290 | + const struct attribute_group **groups; | |
| 291 | +}; | |
| 292 | + | |
| 293 | +/** | |
| 294 | + * struct counter_signal_read_value - Opaque Signal read value | |
| 295 | + * @buf: string representation of Signal read value | |
| 296 | + * @len: length of string in @buf | |
| 297 | + */ | |
| 298 | +struct counter_signal_read_value { | |
| 299 | + char *buf; | |
| 300 | + size_t len; | |
| 301 | +}; | |
| 302 | + | |
| 303 | +/** | |
| 304 | + * struct counter_count_read_value - Opaque Count read value | |
| 305 | + * @buf: string representation of Count read value | |
| 306 | + * @len: length of string in @buf | |
| 307 | + */ | |
| 308 | +struct counter_count_read_value { | |
| 309 | + char *buf; | |
| 310 | + size_t len; | |
| 311 | +}; | |
| 312 | + | |
| 313 | +/** | |
| 314 | + * struct counter_count_write_value - Opaque Count write value | |
| 315 | + * @buf: string representation of Count write value | |
| 316 | + */ | |
| 317 | +struct counter_count_write_value { | |
| 318 | + const char *buf; | |
| 319 | +}; | |
| 320 | + | |
| 321 | +/** | |
| 322 | + * struct counter_ops - Callbacks from driver | |
| 323 | + * @signal_read: optional read callback for Signal attribute. The read | |
| 324 | + * value of the respective Signal should be passed back via | |
| 325 | + * the val parameter. val points to an opaque type which | |
| 326 | + * should be set only by calling the | |
| 327 | + * counter_signal_read_value_set function from within the | |
| 328 | + * signal_read callback. | |
| 329 | + * @count_read: optional read callback for Count attribute. The read | |
| 330 | + * value of the respective Count should be passed back via | |
| 331 | + * the val parameter. val points to an opaque type which | |
| 332 | + * should be set only by calling the | |
| 333 | + * counter_count_read_value_set function from within the | |
| 334 | + * count_read callback. | |
| 335 | + * @count_write: optional write callback for Count attribute. The write | |
| 336 | + * value for the respective Count is passed in via the val | |
| 337 | + * parameter. val points to an opaque type which should be | |
| 338 | + * accessed only by calling the | |
| 339 | + * counter_count_write_value_get function. | |
| 340 | + * @function_get: function to get the current count function mode. Returns | |
| 341 | + * 0 on success and negative error code on error. The index | |
| 342 | + * of the respective Count's returned function mode should | |
| 343 | + * be passed back via the function parameter. | |
| 344 | + * @function_set: function to set the count function mode. function is the | |
| 345 | + * index of the requested function mode from the respective | |
| 346 | + * Count's functions_list array. | |
| 347 | + * @action_get: function to get the current action mode. Returns 0 on | |
| 348 | + * success and negative error code on error. The index of | |
| 349 | + * the respective Signal's returned action mode should be | |
| 350 | + * passed back via the action parameter. | |
| 351 | + * @action_set: function to set the action mode. action is the index of | |
| 352 | + * the requested action mode from the respective Synapse's | |
| 353 | + * actions_list array. | |
| 354 | + */ | |
| 355 | +struct counter_ops { | |
| 356 | + int (*signal_read)(struct counter_device *counter, | |
| 357 | + struct counter_signal *signal, | |
| 358 | + struct counter_signal_read_value *val); | |
| 359 | + int (*count_read)(struct counter_device *counter, | |
| 360 | + struct counter_count *count, | |
| 361 | + struct counter_count_read_value *val); | |
| 362 | + int (*count_write)(struct counter_device *counter, | |
| 363 | + struct counter_count *count, | |
| 364 | + struct counter_count_write_value *val); | |
| 365 | + int (*function_get)(struct counter_device *counter, | |
| 366 | + struct counter_count *count, size_t *function); | |
| 367 | + int (*function_set)(struct counter_device *counter, | |
| 368 | + struct counter_count *count, size_t function); | |
| 369 | + int (*action_get)(struct counter_device *counter, | |
| 370 | + struct counter_count *count, | |
| 371 | + struct counter_synapse *synapse, size_t *action); | |
| 372 | + int (*action_set)(struct counter_device *counter, | |
| 373 | + struct counter_count *count, | |
| 374 | + struct counter_synapse *synapse, size_t action); | |
| 375 | +}; | |
| 376 | + | |
| 377 | +/** | |
| 378 | + * struct counter_device_ext - Counter device extension | |
| 379 | + * @name: attribute name | |
| 380 | + * @read: read callback for this attribute; may be NULL | |
| 381 | + * @write: write callback for this attribute; may be NULL | |
| 382 | + * @priv: data private to the driver | |
| 383 | + */ | |
| 384 | +struct counter_device_ext { | |
| 385 | + const char *name; | |
| 386 | + ssize_t (*read)(struct counter_device *counter, void *priv, char *buf); | |
| 387 | + ssize_t (*write)(struct counter_device *counter, void *priv, | |
| 388 | + const char *buf, size_t len); | |
| 389 | + void *priv; | |
| 390 | +}; | |
| 391 | + | |
| 392 | +/** | |
| 393 | + * struct counter_device_enum_ext - Counter enum extension attribute | |
| 394 | + * @items: Array of strings | |
| 395 | + * @num_items: Number of items specified in @items | |
| 396 | + * @set: Set callback function; may be NULL | |
| 397 | + * @get: Get callback function; may be NULL | |
| 398 | + * | |
| 399 | + * The counter_device_enum_ext structure can be used to implement enum style | |
| 400 | + * Counter extension attributes. Enum style attributes are those which have a | |
| 401 | + * set of strings that map to unsigned integer values. The Generic Counter enum | |
| 402 | + * extension helper code takes care of mapping between value and string, as well | |
| 403 | + * as generating a "_available" file which contains a list of all available | |
| 404 | + * items. The get callback is used to query the currently active item; the index | |
| 405 | + * of the item within the respective items array is returned via the 'item' | |
| 406 | + * parameter. The set callback is called when the attribute is updated; the | |
| 407 | + * 'item' parameter contains the index of the newly activated item within the | |
| 408 | + * respective items array. | |
| 409 | + */ | |
| 410 | +struct counter_device_enum_ext { | |
| 411 | + const char * const *items; | |
| 412 | + size_t num_items; | |
| 413 | + int (*get)(struct counter_device *counter, size_t *item); | |
| 414 | + int (*set)(struct counter_device *counter, size_t item); | |
| 415 | +}; | |
| 416 | + | |
| 417 | +/** | |
| 418 | + * COUNTER_DEVICE_ENUM() - Initialize Counter enum extension | |
| 419 | + * @_name: Attribute name | |
| 420 | + * @_e: Pointer to a counter_device_enum_ext structure | |
| 421 | + * | |
| 422 | + * This should usually be used together with COUNTER_DEVICE_ENUM_AVAILABLE() | |
| 423 | + */ | |
| 424 | +#define COUNTER_DEVICE_ENUM(_name, _e) \ | |
| 425 | +{ \ | |
| 426 | + .name = (_name), \ | |
| 427 | + .read = counter_device_enum_read, \ | |
| 428 | + .write = counter_device_enum_write, \ | |
| 429 | + .priv = (_e) \ | |
| 430 | +} | |
| 431 | + | |
| 432 | +/** | |
| 433 | + * COUNTER_DEVICE_ENUM_AVAILABLE() - Initialize Counter enum available extension | |
| 434 | + * @_name: Attribute name ("_available" will be appended to the name) | |
| 435 | + * @_e: Pointer to a counter_device_enum_ext structure | |
| 436 | + * | |
| 437 | + * Creates a read only attribute that lists all the available enum items in a | |
| 438 | + * newline separated list. This should usually be used together with | |
| 439 | + * COUNTER_DEVICE_ENUM() | |
| 440 | + */ | |
| 441 | +#define COUNTER_DEVICE_ENUM_AVAILABLE(_name, _e) \ | |
| 442 | +{ \ | |
| 443 | + .name = (_name "_available"), \ | |
| 444 | + .read = counter_device_enum_available_read, \ | |
| 445 | + .priv = (_e) \ | |
| 446 | +} | |
| 447 | + | |
| 448 | +/** | |
| 449 | + * struct counter_device - Counter data structure | |
| 450 | + * @name: name of the device as it appears in the datasheet | |
| 451 | + * @parent: optional parent device providing the counters | |
| 452 | + * @device_state: internal device state container | |
| 453 | + * @ops: callbacks from driver | |
| 454 | + * @signals: array of Signals | |
| 455 | + * @num_signals: number of Signals specified in @signals | |
| 456 | + * @counts: array of Counts | |
| 457 | + * @num_counts: number of Counts specified in @counts | |
| 458 | + * @ext: optional array of Counter device extensions | |
| 459 | + * @num_ext: number of Counter device extensions specified in @ext | |
| 460 | + * @priv: optional private data supplied by driver | |
| 461 | + */ | |
| 462 | +struct counter_device { | |
| 463 | + const char *name; | |
| 464 | + struct device *parent; | |
| 465 | + struct counter_device_state *device_state; | |
| 466 | + | |
| 467 | + const struct counter_ops *ops; | |
| 468 | + | |
| 469 | + struct counter_signal *signals; | |
| 470 | + size_t num_signals; | |
| 471 | + struct counter_count *counts; | |
| 472 | + size_t num_counts; | |
| 473 | + | |
| 474 | + const struct counter_device_ext *ext; | |
| 475 | + size_t num_ext; | |
| 476 | + | |
| 477 | + void *priv; | |
| 478 | +}; | |
| 479 | + | |
| 480 | +enum counter_signal_level { | |
| 481 | + COUNTER_SIGNAL_LEVEL_LOW = 0, | |
| 482 | + COUNTER_SIGNAL_LEVEL_HIGH | |
| 483 | +}; | |
| 484 | + | |
| 485 | +enum counter_signal_value_type { | |
| 486 | + COUNTER_SIGNAL_LEVEL = 0 | |
| 487 | +}; | |
| 488 | + | |
| 489 | +enum counter_count_value_type { | |
| 490 | + COUNTER_COUNT_POSITION = 0, | |
| 491 | +}; | |
| 492 | + | |
| 493 | +void counter_signal_read_value_set(struct counter_signal_read_value *const val, | |
| 494 | + const enum counter_signal_value_type type, | |
| 495 | + void *const data); | |
| 496 | +void counter_count_read_value_set(struct counter_count_read_value *const val, | |
| 497 | + const enum counter_count_value_type type, | |
| 498 | + void *const data); | |
| 499 | +int counter_count_write_value_get(void *const data, | |
| 500 | + const enum counter_count_value_type type, | |
| 501 | + const struct counter_count_write_value *const val); | |
| 502 | + | |
| 503 | +int counter_register(struct counter_device *const counter); | |
| 504 | +void counter_unregister(struct counter_device *const counter); | |
| 505 | +int devm_counter_register(struct device *dev, | |
| 506 | + struct counter_device *const counter); | |
| 507 | +void devm_counter_unregister(struct device *dev, | |
| 508 | + struct counter_device *const counter); | |
| 509 | + | |
| 510 | +#endif /* _COUNTER_H_ */ | |
| @@ -0,0 +1,45 @@ | ||
| 1 | +/* SPDX-License-Identifier: GPL-2.0 */ | |
| 2 | +/* | |
| 3 | + * Counter interface enum functions | |
| 4 | + * Copyright (C) 2018 William Breathitt Gray | |
| 5 | + */ | |
| 6 | +#ifndef _COUNTER_ENUM_H_ | |
| 7 | +#define _COUNTER_ENUM_H_ | |
| 8 | + | |
| 9 | +#include <linux/types.h> | |
| 10 | + | |
| 11 | +struct counter_device; | |
| 12 | +struct counter_signal; | |
| 13 | +struct counter_count; | |
| 14 | + | |
| 15 | +ssize_t counter_signal_enum_read(struct counter_device *counter, | |
| 16 | + struct counter_signal *signal, void *priv, | |
| 17 | + char *buf); | |
| 18 | +ssize_t counter_signal_enum_write(struct counter_device *counter, | |
| 19 | + struct counter_signal *signal, void *priv, | |
| 20 | + const char *buf, size_t len); | |
| 21 | + | |
| 22 | +ssize_t counter_signal_enum_available_read(struct counter_device *counter, | |
| 23 | + struct counter_signal *signal, | |
| 24 | + void *priv, char *buf); | |
| 25 | + | |
| 26 | +ssize_t counter_count_enum_read(struct counter_device *counter, | |
| 27 | + struct counter_count *count, void *priv, | |
| 28 | + char *buf); | |
| 29 | +ssize_t counter_count_enum_write(struct counter_device *counter, | |
| 30 | + struct counter_count *count, void *priv, | |
| 31 | + const char *buf, size_t len); | |
| 32 | + | |
| 33 | +ssize_t counter_count_enum_available_read(struct counter_device *counter, | |
| 34 | + struct counter_count *count, | |
| 35 | + void *priv, char *buf); | |
| 36 | + | |
| 37 | +ssize_t counter_device_enum_read(struct counter_device *counter, void *priv, | |
| 38 | + char *buf); | |
| 39 | +ssize_t counter_device_enum_write(struct counter_device *counter, void *priv, | |
| 40 | + const char *buf, size_t len); | |
| 41 | + | |
| 42 | +ssize_t counter_device_enum_available_read(struct counter_device *counter, | |
| 43 | + void *priv, char *buf); | |
| 44 | + | |
| 45 | +#endif /* _COUNTER_ENUM_H_ */ | |
| @@ -44,7 +44,7 @@ · 43 unmodified lines | ||
| 44 | 44 | */ |
| 45 | 45 | #define CPER_REC_LEN 256 |
| 46 | 46 | /* |
| 47 | − * Severity difinition for error_severity in struct cper_record_header | |
| 47 | + * Severity definition for error_severity in struct cper_record_header | |
| 48 | 48 | * and section_severity in struct cper_section_descriptor |
| 49 | 49 | */ |
| 50 | 50 | enum { |
| @@ -55,24 +55,21 @@ enum { · 4 unmodified lines | ||
| 55 | 55 | }; |
| 56 | 56 | |
| 57 | 57 | /* |
| 58 | − * Validation bits difinition for validation_bits in struct | |
| 58 | + * Validation bits definition for validation_bits in struct | |
| 59 | 59 | * cper_record_header. If set, corresponding fields in struct |
| 60 | 60 | * cper_record_header contain valid information. |
| 61 | − * | |
| 62 | − * corresponds platform_id | |
| 63 | 61 | */ |
| 64 | 62 | #define CPER_VALID_PLATFORM_ID 0x0001 |
| 65 | −/* corresponds timestamp */ | |
| 66 | 63 | #define CPER_VALID_TIMESTAMP 0x0002 |
| 67 | −/* corresponds partition_id */ | |
| 68 | 64 | #define CPER_VALID_PARTITION_ID 0x0004 |
| 69 | 65 | |
| 70 | 66 | /* |
| 71 | 67 | * Notification type used to generate error record, used in |
| 72 | − * notification_type in struct cper_record_header | |
| 73 | − * | |
| 74 | − * Corrected Machine Check | |
| 68 | + * notification_type in struct cper_record_header. These UUIDs are defined | |
| 69 | + * in the UEFI spec v2.7, sec N.2.1. | |
| 75 | 70 | */ |
| 71 | + | |
| 72 | +/* Corrected Machine Check */ | |
| 76 | 73 | #define CPER_NOTIFY_CMC \ |
| 77 | 74 | GUID_INIT(0x2DCE8BB1, 0xBDD7, 0x450e, 0xB9, 0xAD, 0x9C, 0xF4, \ |
| 78 | 75 | 0xEB, 0xD4, 0xF8, 0x90) |
| @@ -122,14 +119,11 @@ enum { · 43 unmodified lines | ||
| 122 | 119 | #define CPER_SEC_REV 0x0100 |
| 123 | 120 | |
| 124 | 121 | /* |
| 125 | − * Validation bits difinition for validation_bits in struct | |
| 122 | + * Validation bits definition for validation_bits in struct | |
| 126 | 123 | * cper_section_descriptor. If set, corresponding fields in struct |
| 127 | 124 | * cper_section_descriptor contain valid information. |
| 128 | − * | |
| 129 | − * corresponds fru_id | |
| 130 | 125 | */ |
| 131 | 126 | #define CPER_SEC_VALID_FRU_ID 0x1 |
| 132 | −/* corresponds fru_text */ | |
| 133 | 127 | #define CPER_SEC_VALID_FRU_TEXT 0x2 |
| 134 | 128 | |
| 135 | 129 | /* |
| @@ -165,10 +159,11 @@ enum { · 29 unmodified lines | ||
| 165 | 159 | |
| 166 | 160 | /* |
| 167 | 161 | * Section type definitions, used in section_type field in struct |
| 168 | − * cper_section_descriptor | |
| 169 | − * | |
| 170 | − * Processor Generic | |
| 162 | + * cper_section_descriptor. These UUIDs are defined in the UEFI spec | |
| 163 | + * v2.7, sec N.2.2. | |
| 171 | 164 | */ |
| 165 | + | |
| 166 | +/* Processor Generic */ | |
| 172 | 167 | #define CPER_SEC_PROC_GENERIC \ |
| 173 | 168 | GUID_INIT(0x9876CCAD, 0x47B4, 0x4bdb, 0xB6, 0x5E, 0x16, 0xF1, \ |
| 174 | 169 | 0x93, 0xC4, 0xF3, 0xDB) |
| @@ -325,220 +320,223 @@ enum { · 150 unmodified lines | ||
| 325 | 320 | */ |
| 326 | 321 | #pragma pack(1) |
| 327 | 322 | |
| 323 | +/* Record Header, UEFI v2.7 sec N.2.1 */ | |
| 328 | 324 | struct cper_record_header { |
| 329 | 325 | char signature[CPER_SIG_SIZE]; /* must be CPER_SIG_RECORD */ |
| 330 | − __u16 revision; /* must be CPER_RECORD_REV */ | |
| 331 | − __u32 signature_end; /* must be CPER_SIG_END */ | |
| 332 | − __u16 section_count; | |
| 333 | − __u32 error_severity; | |
| 334 | − __u32 validation_bits; | |
| 335 | − __u32 record_length; | |
| 336 | − __u64 timestamp; | |
| 326 | + u16 revision; /* must be CPER_RECORD_REV */ | |
| 327 | + u32 signature_end; /* must be CPER_SIG_END */ | |
| 328 | + u16 section_count; | |
| 329 | + u32 error_severity; | |
| 330 | + u32 validation_bits; | |
| 331 | + u32 record_length; | |
| 332 | + u64 timestamp; | |
| 337 | 333 | guid_t platform_id; |
| 338 | 334 | guid_t partition_id; |
| 339 | 335 | guid_t creator_id; |
| 340 | 336 | guid_t notification_type; |
| 341 | − __u64 record_id; | |
| 342 | − __u32 flags; | |
| 343 | − __u64 persistence_information; | |
| 344 | − __u8 reserved[12]; /* must be zero */ | |
| 337 | + u64 record_id; | |
| 338 | + u32 flags; | |
| 339 | + u64 persistence_information; | |
| 340 | + u8 reserved[12]; /* must be zero */ | |
| 345 | 341 | }; |
| 346 | 342 | |
| 343 | +/* Section Descriptor, UEFI v2.7 sec N.2.2 */ | |
| 347 | 344 | struct cper_section_descriptor { |
| 348 | − __u32 section_offset; /* Offset in bytes of the | |
| 345 | + u32 section_offset; /* Offset in bytes of the | |
| 349 | 346 | * section body from the base |
| 350 | 347 | * of the record header */ |
| 351 | − __u32 section_length; | |
| 352 | − __u16 revision; /* must be CPER_RECORD_REV */ | |
| 353 | − __u8 validation_bits; | |
| 354 | − __u8 reserved; /* must be zero */ | |
| 355 | − __u32 flags; | |
| 348 | + u32 section_length; | |
| 349 | + u16 revision; /* must be CPER_RECORD_REV */ | |
| 350 | + u8 validation_bits; | |
| 351 | + u8 reserved; /* must be zero */ | |
| 352 | + u32 flags; | |
| 356 | 353 | guid_t section_type; |
| 357 | 354 | guid_t fru_id; |
| 358 | − __u32 section_severity; | |
| 359 | − __u8 fru_text[20]; | |
| 355 | + u32 section_severity; | |
| 356 | + u8 fru_text[20]; | |
| 360 | 357 | }; |
| 361 | 358 | |
| 362 | −/* Generic Processor Error Section */ | |
| 359 | +/* Generic Processor Error Section, UEFI v2.7 sec N.2.4.1 */ | |
| 363 | 360 | struct cper_sec_proc_generic { |
| 364 | − __u64 validation_bits; | |
| 365 | − __u8 proc_type; | |
| 366 | − __u8 proc_isa; | |
| 367 | − __u8 proc_error_type; | |
| 368 | − __u8 operation; | |
| 369 | − __u8 flags; | |
| 370 | − __u8 level; | |
| 371 | − __u16 reserved; | |
| 372 | − __u64 cpu_version; | |
| 361 | + u64 validation_bits; | |
| 362 | + u8 proc_type; | |
| 363 | + u8 proc_isa; | |
| 364 | + u8 proc_error_type; | |
| 365 | + u8 operation; | |
| 366 | + u8 flags; | |
| 367 | + u8 level; | |
| 368 | + u16 reserved; | |
| 369 | + u64 cpu_version; | |
| 373 | 370 | char cpu_brand[128]; |
| 374 | − __u64 proc_id; | |
| 375 | − __u64 target_addr; | |
| 376 | − __u64 requestor_id; | |
| 377 | − __u64 responder_id; | |
| 378 | − __u64 ip; | |
| 371 | + u64 proc_id; | |
| 372 | + u64 target_addr; | |
| 373 | + u64 requestor_id; | |
| 374 | + u64 responder_id; | |
| 375 | + u64 ip; | |
| 379 | 376 | }; |
| 380 | 377 | |
| 381 | −/* IA32/X64 Processor Error Section */ | |
| 378 | +/* IA32/X64 Processor Error Section, UEFI v2.7 sec N.2.4.2 */ | |
| 382 | 379 | struct cper_sec_proc_ia { |
| 383 | − __u64 validation_bits; | |
| 384 | − __u64 lapic_id; | |
| 385 | − __u8 cpuid[48]; | |
| 380 | + u64 validation_bits; | |
| 381 | + u64 lapic_id; | |
| 382 | + u8 cpuid[48]; | |
| 386 | 383 | }; |
| 387 | 384 | |
| 388 | −/* IA32/X64 Processor Error Information Structure */ | |
| 385 | +/* IA32/X64 Processor Error Information Structure, UEFI v2.7 sec N.2.4.2.1 */ | |
| 389 | 386 | struct cper_ia_err_info { |
| 390 | 387 | guid_t err_type; |
| 391 | − __u64 validation_bits; | |
| 392 | − __u64 check_info; | |
| 393 | − __u64 target_id; | |
| 394 | − __u64 requestor_id; | |
| 395 | − __u64 responder_id; | |
| 396 | − __u64 ip; | |
| 388 | + u64 validation_bits; | |
| 389 | + u64 check_info; | |
| 390 | + u64 target_id; | |
| 391 | + u64 requestor_id; | |
| 392 | + u64 responder_id; | |
| 393 | + u64 ip; | |
| 397 | 394 | }; |
| 398 | 395 | |
| 399 | −/* IA32/X64 Processor Context Information Structure */ | |
| 396 | +/* IA32/X64 Processor Context Information Structure, UEFI v2.7 sec N.2.4.2.2 */ | |
| 400 | 397 | struct cper_ia_proc_ctx { |
| 401 | − __u16 reg_ctx_type; | |
| 402 | − __u16 reg_arr_size; | |
| 403 | − __u32 msr_addr; | |
| 404 | − __u64 mm_reg_addr; | |
| 398 | + u16 reg_ctx_type; | |
| 399 | + u16 reg_arr_size; | |
| 400 | + u32 msr_addr; | |
| 401 | + u64 mm_reg_addr; | |
| 405 | 402 | }; |
| 406 | 403 | |
| 407 | −/* ARM Processor Error Section */ | |
| 404 | +/* ARM Processor Error Section, UEFI v2.7 sec N.2.4.4 */ | |
| 408 | 405 | struct cper_sec_proc_arm { |
| 409 | − __u32 validation_bits; | |
| 410 | − __u16 err_info_num; /* Number of Processor Error Info */ | |
| 411 | − __u16 context_info_num; /* Number of Processor Context Info Records*/ | |
| 412 | − __u32 section_length; | |
| 413 | − __u8 affinity_level; | |
| 414 | − __u8 reserved[3]; /* must be zero */ | |
| 415 | − __u64 mpidr; | |
| 416 | − __u64 midr; | |
| 417 | − __u32 running_state; /* Bit 0 set - Processor running. PSCI = 0 */ | |
| 418 | − __u32 psci_state; | |
| 406 | + u32 validation_bits; | |
| 407 | + u16 err_info_num; /* Number of Processor Error Info */ | |
| 408 | + u16 context_info_num; /* Number of Processor Context Info Records*/ | |
| 409 | + u32 section_length; | |
| 410 | + u8 affinity_level; | |
| 411 | + u8 reserved[3]; /* must be zero */ | |
| 412 | + u64 mpidr; | |
| 413 | + u64 midr; | |
| 414 | + u32 running_state; /* Bit 0 set - Processor running. PSCI = 0 */ | |
| 415 | + u32 psci_state; | |
| 419 | 416 | }; |
| 420 | 417 | |
| 421 | −/* ARM Processor Error Information Structure */ | |
| 418 | +/* ARM Processor Error Information Structure, UEFI v2.7 sec N.2.4.4.1 */ | |
| 422 | 419 | struct cper_arm_err_info { |
| 423 | − __u8 version; | |
| 424 | − __u8 length; | |
| 425 | − __u16 validation_bits; | |
| 426 | − __u8 type; | |
| 427 | − __u16 multiple_error; | |
| 428 | − __u8 flags; | |
| 429 | − __u64 error_info; | |
| 430 | − __u64 virt_fault_addr; | |
| 431 | − __u64 physical_fault_addr; | |
| 420 | + u8 version; | |
| 421 | + u8 length; | |
| 422 | + u16 validation_bits; | |
| 423 | + u8 type; | |
| 424 | + u16 multiple_error; | |
| 425 | + u8 flags; | |
| 426 | + u64 error_info; | |
| 427 | + u64 virt_fault_addr; | |
| 428 | + u64 physical_fault_addr; | |
| 432 | 429 | }; |
| 433 | 430 | |
| 434 | −/* ARM Processor Context Information Structure */ | |
| 431 | +/* ARM Processor Context Information Structure, UEFI v2.7 sec N.2.4.4.2 */ | |
| 435 | 432 | struct cper_arm_ctx_info { |
| 436 | − __u16 version; | |
| 437 | − __u16 type; | |
| 438 | − __u32 size; | |
| 433 | + u16 version; | |
| 434 | + u16 type; | |
| 435 | + u32 size; | |
| 439 | 436 | }; |
| 440 | 437 | |
| 441 | −/* Old Memory Error Section UEFI 2.1, 2.2 */ | |
| 438 | +/* Old Memory Error Section, UEFI v2.1, v2.2 */ | |
| 442 | 439 | struct cper_sec_mem_err_old { |
| 443 | − __u64 validation_bits; | |
| 444 | − __u64 error_status; | |
| 445 | − __u64 physical_addr; | |
| 446 | − __u64 physical_addr_mask; | |
| 447 | − __u16 node; | |
| 448 | − __u16 card; | |
| 449 | − __u16 module; | |
| 450 | − __u16 bank; | |
| 451 | − __u16 device; | |
| 452 | − __u16 row; | |
| 453 | − __u16 column; | |
| 454 | − __u16 bit_pos; | |
| 455 | − __u64 requestor_id; | |
| 456 | − __u64 responder_id; | |
| 457 | − __u64 target_id; | |
| 458 | − __u8 error_type; | |
| 440 | + u64 validation_bits; | |
| 441 | + u64 error_status; | |
| 442 | + u64 physical_addr; | |
| 443 | + u64 physical_addr_mask; | |
| 444 | + u16 node; | |
| 445 | + u16 card; | |
| 446 | + u16 module; | |
| 447 | + u16 bank; | |
| 448 | + u16 device; | |
| 449 | + u16 row; | |
| 450 | + u16 column; | |
| 451 | + u16 bit_pos; | |
| 452 | + u64 requestor_id; | |
| 453 | + u64 responder_id; | |
| 454 | + u64 target_id; | |
| 455 | + u8 error_type; | |
| 459 | 456 | }; |
| 460 | 457 | |
| 461 | −/* Memory Error Section UEFI >= 2.3 */ | |
| 458 | +/* Memory Error Section (UEFI >= v2.3), UEFI v2.7 sec N.2.5 */ | |
| 462 | 459 | struct cper_sec_mem_err { |
| 463 | − __u64 validation_bits; | |
| 464 | − __u64 error_status; | |
| 465 | − __u64 physical_addr; | |
| 466 | − __u64 physical_addr_mask; | |
| 467 | − __u16 node; | |
| 468 | − __u16 card; | |
| 469 | − __u16 module; | |
| 470 | − __u16 bank; | |
| 471 | − __u16 device; | |
| 472 | − __u16 row; | |
| 473 | − __u16 column; | |
| 474 | − __u16 bit_pos; | |
| 475 | − __u64 requestor_id; | |
| 476 | − __u64 responder_id; | |
| 477 | − __u64 target_id; | |
| 478 | − __u8 error_type; | |
| 479 | − __u8 reserved; | |
| 480 | − __u16 rank; | |
| 481 | − __u16 mem_array_handle; /* card handle in UEFI 2.4 */ | |
| 482 | − __u16 mem_dev_handle; /* module handle in UEFI 2.4 */ | |
| 460 | + u64 validation_bits; | |
| 461 | + u64 error_status; | |
| 462 | + u64 physical_addr; | |
| 463 | + u64 physical_addr_mask; | |
| 464 | + u16 node; | |
| 465 | + u16 card; | |
| 466 | + u16 module; | |
| 467 | + u16 bank; | |
| 468 | + u16 device; | |
| 469 | + u16 row; | |
| 470 | + u16 column; | |
| 471 | + u16 bit_pos; | |
| 472 | + u64 requestor_id; | |
| 473 | + u64 responder_id; | |
| 474 | + u64 target_id; | |
| 475 | + u8 error_type; | |
| 476 | + u8 reserved; | |
| 477 | + u16 rank; | |
| 478 | + u16 mem_array_handle; /* "card handle" in UEFI 2.4 */ | |
| 479 | + u16 mem_dev_handle; /* "module handle" in UEFI 2.4 */ | |
| 483 | 480 | }; |
| 484 | 481 | |
| 485 | 482 | struct cper_mem_err_compact { |
| 486 | − __u64 validation_bits; | |
| 487 | − __u16 node; | |
| 488 | − __u16 card; | |
| 489 | − __u16 module; | |
| 490 | − __u16 bank; | |
| 491 | − __u16 device; | |
| 492 | − __u16 row; | |
| 493 | − __u16 column; | |
| 494 | − __u16 bit_pos; | |
| 495 | − __u64 requestor_id; | |
| 496 | − __u64 responder_id; | |
| 497 | − __u64 target_id; | |
| 498 | − __u16 rank; | |
| 499 | − __u16 mem_array_handle; | |
| 500 | − __u16 mem_dev_handle; | |
| 483 | + u64 validation_bits; | |
| 484 | + u16 node; | |
| 485 | + u16 card; | |
| 486 | + u16 module; | |
| 487 | + u16 bank; | |
| 488 | + u16 device; | |
| 489 | + u16 row; | |
| 490 | + u16 column; | |
| 491 | + u16 bit_pos; | |
| 492 | + u64 requestor_id; | |
| 493 | + u64 responder_id; | |
| 494 | + u64 target_id; | |
| 495 | + u16 rank; | |
| 496 | + u16 mem_array_handle; | |
| 497 | + u16 mem_dev_handle; | |
| 501 | 498 | }; |
| 502 | 499 | |
| 500 | +/* PCI Express Error Section, UEFI v2.7 sec N.2.7 */ | |
| 503 | 501 | struct cper_sec_pcie { |
| 504 | − __u64 validation_bits; | |
| 505 | − __u32 port_type; | |
| 502 | + u64 validation_bits; | |
| 503 | + u32 port_type; | |
| 506 | 504 | struct { |
| 507 | − __u8 minor; | |
| 508 | − __u8 major; | |
| 509 | − __u8 reserved[2]; | |
| 505 | + u8 minor; | |
| 506 | + u8 major; | |
| 507 | + u8 reserved[2]; | |
| 510 | 508 | } version; |
| 511 | − __u16 command; | |
| 512 | − __u16 status; | |
| 513 | − __u32 reserved; | |
| 509 | + u16 command; | |
| 510 | + u16 status; | |
| 511 | + u32 reserved; | |
| 514 | 512 | struct { |
| 515 | − __u16 vendor_id; | |
| 516 | − __u16 device_id; | |
| 517 | − __u8 class_code[3]; | |
| 518 | − __u8 function; | |
| 519 | − __u8 device; | |
| 520 | − __u16 segment; | |
| 521 | − __u8 bus; | |
| 522 | − __u8 secondary_bus; | |
| 523 | − __u16 slot; | |
| 524 | − __u8 reserved; | |
| 513 | + u16 vendor_id; | |
| 514 | + u16 device_id; | |
| 515 | + u8 class_code[3]; | |
| 516 | + u8 function; | |
| 517 | + u8 device; | |
| 518 | + u16 segment; | |
| 519 | + u8 bus; | |
| 520 | + u8 secondary_bus; | |
| 521 | + u16 slot; | |
| 522 | + u8 reserved; | |
| 525 | 523 | } device_id; |
| 526 | 524 | struct { |
| 527 | − __u32 lower; | |
| 528 | − __u32 upper; | |
| 525 | + u32 lower; | |
| 526 | + u32 upper; | |
| 529 | 527 | } serial_number; |
| 530 | 528 | struct { |
| 531 | − __u16 secondary_status; | |
| 532 | − __u16 control; | |
| 529 | + u16 secondary_status; | |
| 530 | + u16 control; | |
| 533 | 531 | } bridge; |
| 534 | − __u8 capability[60]; | |
| 535 | − __u8 aer_info[96]; | |
| 532 | + u8 capability[60]; | |
| 533 | + u8 aer_info[96]; | |
| 536 | 534 | }; |
| 537 | 535 | |
| 538 | 536 | /* Reset to default packing */ |
| 539 | 537 | #pragma pack() |
| 540 | 538 | |
| 541 | −extern const char * const cper_proc_error_type_strs[4]; | |
| 539 | +extern const char *const cper_proc_error_type_strs[4]; | |
| 542 | 540 | |
| 543 | 541 | u64 cper_next_record_id(void); |
| 544 | 542 | const char *cper_severity_str(unsigned int); |
| @@ -57,6 +57,8 @@ extern ssize_t cpu_show_spec_store_bypass(struct device *dev, · 56 unmodified lines | ||
| 57 | 57 | struct device_attribute *attr, char *buf); |
| 58 | 58 | extern ssize_t cpu_show_l1tf(struct device *dev, |
| 59 | 59 | struct device_attribute *attr, char *buf); |
| 60 | +extern ssize_t cpu_show_mds(struct device *dev, | |
| 61 | + struct device_attribute *attr, char *buf); | |
| 60 | 62 | |
| 61 | 63 | extern __printf(4, 5) |
| 62 | 64 | struct device *cpu_device_create(struct device *parent, void *drvdata, |
| @@ -137,9 +139,26 @@ static inline int disable_nonboot_cpus(void) · 74 unmodified lines | ||
| 137 | 139 | return freeze_secondary_cpus(0); |
| 138 | 140 | } |
| 139 | 141 | extern void enable_nonboot_cpus(void); |
| 142 | + | |
| 143 | +static inline int suspend_disable_secondary_cpus(void) | |
| 144 | +{ | |
| 145 | + int cpu = 0; | |
| 146 | + | |
| 147 | + if (IS_ENABLED(CONFIG_PM_SLEEP_SMP_NONZERO_CPU)) | |
| 148 | + cpu = -1; | |
| 149 | + | |
| 150 | + return freeze_secondary_cpus(cpu); | |
| 151 | +} | |
| 152 | +static inline void suspend_enable_secondary_cpus(void) | |
| 153 | +{ | |
| 154 | + return enable_nonboot_cpus(); | |
| 155 | +} | |
| 156 | + | |
| 140 | 157 | #else /* !CONFIG_PM_SLEEP_SMP */ |
| 141 | 158 | static inline int disable_nonboot_cpus(void) { return 0; } |
| 142 | 159 | static inline void enable_nonboot_cpus(void) {} |
| 160 | +static inline int suspend_disable_secondary_cpus(void) { return 0; } | |
| 161 | +static inline void suspend_enable_secondary_cpus(void) { } | |
| 143 | 162 | #endif /* !CONFIG_PM_SLEEP_SMP */ |
| 144 | 163 | |
| 145 | 164 | void cpu_startup_entry(enum cpuhp_state state); |
| @@ -175,6 +194,7 @@ enum cpuhp_smt_control { · 29 unmodified lines | ||
| 175 | 194 | CPU_SMT_DISABLED, |
| 176 | 195 | CPU_SMT_FORCE_DISABLED, |
| 177 | 196 | CPU_SMT_NOT_SUPPORTED, |
| 197 | + CPU_SMT_NOT_IMPLEMENTED, | |
| 178 | 198 | }; |
| 179 | 199 | |
| 180 | 200 | #if defined(CONFIG_SMP) && defined(CONFIG_HOTPLUG_SMT) |
| @@ -182,9 +202,33 @@ extern enum cpuhp_smt_control cpu_smt_control; · 1 unmodified line | ||
| 182 | 202 | extern void cpu_smt_disable(bool force); |
| 183 | 203 | extern void cpu_smt_check_topology(void); |
| 184 | 204 | #else |
| 185 | −# define cpu_smt_control (CPU_SMT_ENABLED) | |
| 205 | +# define cpu_smt_control (CPU_SMT_NOT_IMPLEMENTED) | |
| 186 | 206 | static inline void cpu_smt_disable(bool force) { } |
| 187 | 207 | static inline void cpu_smt_check_topology(void) { } |
| 188 | 208 | #endif |
| 189 | 209 | |
| 210 | +/* | |
| 211 | + * These are used for a global "mitigations=" cmdline option for toggling | |
| 212 | + * optional CPU mitigations. | |
| 213 | + */ | |
| 214 | +enum cpu_mitigations { | |
| 215 | + CPU_MITIGATIONS_OFF, | |
| 216 | + CPU_MITIGATIONS_AUTO, | |
| 217 | + CPU_MITIGATIONS_AUTO_NOSMT, | |
| 218 | +}; | |
| 219 | + | |
| 220 | +extern enum cpu_mitigations cpu_mitigations; | |
| 221 | + | |
| 222 | +/* mitigations=off */ | |
| 223 | +static inline bool cpu_mitigations_off(void) | |
| 224 | +{ | |
| 225 | + return cpu_mitigations == CPU_MITIGATIONS_OFF; | |
| 226 | +} | |
| 227 | + | |
| 228 | +/* mitigations=auto,nosmt */ | |
| 229 | +static inline bool cpu_mitigations_auto_nosmt(void) | |
| 230 | +{ | |
| 231 | + return cpu_mitigations == CPU_MITIGATIONS_AUTO_NOSMT; | |
| 232 | +} | |
| 233 | + | |
| 190 | 234 | #endif /* _LINUX_CPU_H_ */ |
| @@ -42,13 +42,6 @@ enum cpufreq_table_sorting { · 41 unmodified lines | ||
| 42 | 42 | CPUFREQ_TABLE_SORTED_DESCENDING |
| 43 | 43 | }; |
| 44 | 44 | |
| 45 | −struct cpufreq_freqs { | |
| 46 | − unsigned int cpu; /* cpu nr */ | |
| 47 | − unsigned int old; | |
| 48 | − unsigned int new; | |
| 49 | − u8 flags; /* flags of cpufreq_driver, see below. */ | |
| 50 | −}; | |
| 51 | − | |
| 52 | 45 | struct cpufreq_cpuinfo { |
| 53 | 46 | unsigned int max_freq; |
| 54 | 47 | unsigned int min_freq; |
| @@ -156,6 +149,13 @@ struct cpufreq_policy { · 101 unmodified lines | ||
| 156 | 149 | struct thermal_cooling_device *cdev; |
| 157 | 150 | }; |
| 158 | 151 | |
| 152 | +struct cpufreq_freqs { | |
| 153 | + struct cpufreq_policy *policy; | |
| 154 | + unsigned int old; | |
| 155 | + unsigned int new; | |
| 156 | + u8 flags; /* flags of cpufreq_driver, see below. */ | |
| 157 | +}; | |
| 158 | + | |
| 159 | 159 | /* Only for ACPI */ |
| 160 | 160 | #define CPUFREQ_SHARED_TYPE_NONE (0) /* None */ |
| 161 | 161 | #define CPUFREQ_SHARED_TYPE_HW (1) /* HW does needed coordination */ |
| @@ -178,6 +178,11 @@ static inline struct cpufreq_policy *cpufreq_cpu_get(unsigned int cpu) · 16 unmodified lines | ||
| 178 | 178 | static inline void cpufreq_cpu_put(struct cpufreq_policy *policy) { } |
| 179 | 179 | #endif |
| 180 | 180 | |
| 181 | +static inline bool policy_is_inactive(struct cpufreq_policy *policy) | |
| 182 | +{ | |
| 183 | + return cpumask_empty(policy->cpus); | |
| 184 | +} | |
| 185 | + | |
| 181 | 186 | static inline bool policy_is_shared(struct cpufreq_policy *policy) |
| 182 | 187 | { |
| 183 | 188 | return cpumask_weight(policy->cpus) > 1; |
| @@ -193,8 +198,14 @@ unsigned int cpufreq_quick_get_max(unsigned int cpu); · 9 unmodified lines | ||
| 193 | 198 | void disable_cpufreq(void); |
| 194 | 199 | |
| 195 | 200 | u64 get_cpu_idle_time(unsigned int cpu, u64 *wall, int io_busy); |
| 201 | + | |
| 202 | +struct cpufreq_policy *cpufreq_cpu_acquire(unsigned int cpu); | |
| 203 | +void cpufreq_cpu_release(struct cpufreq_policy *policy); | |
| 196 | 204 | int cpufreq_get_policy(struct cpufreq_policy *policy, unsigned int cpu); |
| 205 | +int cpufreq_set_policy(struct cpufreq_policy *policy, | |
| 206 | + struct cpufreq_policy *new_policy); | |
| 197 | 207 | void cpufreq_update_policy(unsigned int cpu); |
| 208 | +void cpufreq_update_limits(unsigned int cpu); | |
| 198 | 209 | bool have_governor_per_policy(void); |
| 199 | 210 | struct kobject *get_governor_parent_kobj(struct cpufreq_policy *policy); |
| 200 | 211 | void cpufreq_enable_fast_switch(struct cpufreq_policy *policy); |
| @@ -322,6 +333,9 @@ struct cpufreq_driver { · 121 unmodified lines | ||
| 322 | 333 | /* should be defined, if possible */ |
| 323 | 334 | unsigned int (*get)(unsigned int cpu); |
| 324 | 335 | |
| 336 | + /* Called to update policy limits on firmware notifications. */ | |
| 337 | + void (*update_limits)(unsigned int cpu); | |
| 338 | + | |
| 325 | 339 | /* optional */ |
| 326 | 340 | int (*bios_limit)(int cpu, unsigned int *limit); |
| 327 | 341 | |
| @@ -147,6 +147,7 @@ enum cpuhp_state { · 146 unmodified lines | ||
| 147 | 147 | CPUHP_AP_X86_VDSO_VMA_ONLINE, |
| 148 | 148 | CPUHP_AP_IRQ_AFFINITY_ONLINE, |
| 149 | 149 | CPUHP_AP_ARM_MVEBU_SYNC_CLOCKS, |
| 150 | + CPUHP_AP_X86_INTEL_EPB_ONLINE, | |
| 150 | 151 | CPUHP_AP_PERF_ONLINE, |
| 151 | 152 | CPUHP_AP_PERF_X86_ONLINE, |
| 152 | 153 | CPUHP_AP_PERF_X86_UNCORE_ONLINE, |
| @@ -170,6 +171,7 @@ enum cpuhp_state { · 17 unmodified lines | ||
| 170 | 171 | CPUHP_AP_PERF_POWERPC_NEST_IMC_ONLINE, |
| 171 | 172 | CPUHP_AP_PERF_POWERPC_CORE_IMC_ONLINE, |
| 172 | 173 | CPUHP_AP_PERF_POWERPC_THREAD_IMC_ONLINE, |
| 174 | + CPUHP_AP_PERF_POWERPC_TRACE_IMC_ONLINE, | |
| 173 | 175 | CPUHP_AP_WATCHDOG_ONLINE, |
| 174 | 176 | CPUHP_AP_WORKQUEUE_ONLINE, |
| 175 | 177 | CPUHP_AP_RCUTREE_ONLINE, |
| @@ -83,6 +83,7 @@ struct cpuidle_device { · 82 unmodified lines | ||
| 83 | 83 | unsigned int use_deepest_state:1; |
| 84 | 84 | unsigned int poll_time_limit:1; |
| 85 | 85 | unsigned int cpu; |
| 86 | + ktime_t next_hrtimer; | |
| 86 | 87 | |
| 87 | 88 | int last_residency; |
| 88 | 89 | struct cpuidle_state_usage states_usage[CPUIDLE_STATE_MAX]; |
| @@ -633,8 +633,7 @@ static inline int cpumask_parselist_user(const char __user *buf, int len, · 632 unmodified lines | ||
| 633 | 633 | */ |
| 634 | 634 | static inline int cpumask_parse(const char *buf, struct cpumask *dstp) |
| 635 | 635 | { |
| 636 | − char *nl = strchr(buf, '\n'); | |
| 637 | − unsigned int len = nl ? (unsigned int)(nl - buf) : strlen(buf); | |
| 636 | + unsigned int len = strchrnul(buf, '\n') - buf; | |
| 638 | 637 | |
| 639 | 638 | return bitmap_parse(buf, len, cpumask_bits(dstp), nr_cpumask_bits); |
| 640 | 639 | } |
| @@ -138,7 +138,7 @@ struct cred { · 137 unmodified lines | ||
| 138 | 138 | #ifdef CONFIG_KEYS |
| 139 | 139 | unsigned char jit_keyring; /* default keyring to attach requested |
| 140 | 140 | * keys to */ |
| 141 | − struct key __rcu *session_keyring; /* keyring inherited over fork */ | |
| 141 | + struct key *session_keyring; /* keyring inherited over fork */ | |
| 142 | 142 | struct key *process_keyring; /* keyring private to this process */ |
| 143 | 143 | struct key *thread_keyring; /* keyring private to this thread */ |
| 144 | 144 | struct key *request_key_auth; /* assumed request_key authority */ |
| @@ -176,7 +176,6 @@ struct dentry_operations { · 175 unmodified lines | ||
| 176 | 176 | * typically using d_splice_alias. */ |
| 177 | 177 | |
| 178 | 178 | #define DCACHE_REFERENCED 0x00000040 /* Recently used, don't discard. */ |
| 179 | −#define DCACHE_RCUACCESS 0x00000080 /* Entry has ever been RCU-visible */ | |
| 180 | 179 | |
| 181 | 180 | #define DCACHE_CANT_MOUNT 0x00000100 |
| 182 | 181 | #define DCACHE_GENOCIDE 0x00000200 |
| @@ -212,11 +211,12 @@ struct dentry_operations { · 29 unmodified lines | ||
| 212 | 211 | |
| 213 | 212 | #define DCACHE_MAY_FREE 0x00800000 |
| 214 | 213 | #define DCACHE_FALLTHRU 0x01000000 /* Fall through to lower layer */ |
| 215 | −#define DCACHE_ENCRYPTED_WITH_KEY 0x02000000 /* dir is encrypted with a valid key */ | |
| 214 | +#define DCACHE_ENCRYPTED_NAME 0x02000000 /* Encrypted name (dir key was unavailable) */ | |
| 216 | 215 | #define DCACHE_OP_REAL 0x04000000 |
| 217 | 216 | |
| 218 | 217 | #define DCACHE_PAR_LOOKUP 0x10000000 /* being looked up (with parent locked shared) */ |
| 219 | 218 | #define DCACHE_DENTRY_CURSOR 0x20000000 |
| 219 | +#define DCACHE_NORCU 0x40000000 /* No RCU delay for freeing */ | |
| 220 | 220 | |
| 221 | 221 | extern seqlock_t rename_lock; |
| 222 | 222 | |
| @@ -235,7 +235,6 @@ extern void d_set_d_op(struct dentry *dentry, const struct dentry_operations *op · 12 unmodified lines | ||
| 235 | 235 | /* allocate/de-allocate */ |
| 236 | 236 | extern struct dentry * d_alloc(struct dentry *, const struct qstr *); |
| 237 | 237 | extern struct dentry * d_alloc_anon(struct super_block *); |
| 238 | −extern struct dentry * d_alloc_pseudo(struct super_block *, const struct qstr *); | |
| 239 | 238 | extern struct dentry * d_alloc_parallel(struct dentry *, const struct qstr *, |
| 240 | 239 | wait_queue_head_t *); |
| 241 | 240 | extern struct dentry * d_splice_alias(struct inode *, struct dentry *); |
| @@ -594,7 +593,7 @@ static inline struct inode *d_real_inode(const struct dentry *dentry) · 352 unmodified lines | ||
| 594 | 593 | } |
| 595 | 594 | |
| 596 | 595 | struct name_snapshot { |
| 597 | − const unsigned char *name; | |
| 596 | + struct qstr name; | |
| 598 | 597 | unsigned char inline_name[DNAME_INLINE_LEN]; |
| 599 | 598 | }; |
| 600 | 599 | void take_dentry_name_snapshot(struct name_snapshot *, struct dentry *); |
| @@ -62,7 +62,8 @@ typedef int (*dm_clone_and_map_request_fn) (struct dm_target *ti, · 61 unmodified lines | ||
| 62 | 62 | struct request *rq, |
| 63 | 63 | union map_info *map_context, |
| 64 | 64 | struct request **clone); |
| 65 | −typedef void (*dm_release_clone_request_fn) (struct request *clone); | |
| 65 | +typedef void (*dm_release_clone_request_fn) (struct request *clone, | |
| 66 | + union map_info *map_context); | |
| 66 | 67 | |
| 67 | 68 | /* |
| 68 | 69 | * Returns: |
| @@ -976,18 +976,14 @@ struct dev_links_info { · 975 unmodified lines | ||
| 976 | 976 | * a higher-level representation of the device. |
| 977 | 977 | */ |
| 978 | 978 | struct device { |
| 979 | + struct kobject kobj; | |
| 979 | 980 | struct device *parent; |
| 980 | 981 | |
| 981 | 982 | struct device_private *p; |
| 982 | 983 | |
| 983 | − struct kobject kobj; | |
| 984 | 984 | const char *init_name; /* initial name of the device */ |
| 985 | 985 | const struct device_type *type; |
| 986 | 986 | |
| 987 | − struct mutex mutex; /* mutex to synchronize calls to | |
| 988 | − * its driver. | |
| 989 | − */ | |
| 990 | − | |
| 991 | 987 | struct bus_type *bus; /* type of bus device is on */ |
| 992 | 988 | struct device_driver *driver; /* which driver has allocated this |
| 993 | 989 | device */ |
| @@ -995,6 +991,10 @@ struct device { · 1 unmodified line | ||
| 995 | 991 | core doesn't touch it */ |
| 996 | 992 | void *driver_data; /* Driver data, set and get with |
| 997 | 993 | dev_set_drvdata/dev_get_drvdata */ |
| 994 | + struct mutex mutex; /* mutex to synchronize calls to | |
| 995 | + * its driver. | |
| 996 | + */ | |
| 997 | + | |
| 998 | 998 | struct dev_links_info links; |
| 999 | 999 | struct dev_pm_info power; |
| 1000 | 1000 | struct dev_pm_domain *pm_domain; |
| @@ -1009,9 +1009,6 @@ struct device { · 8 unmodified lines | ||
| 1009 | 1009 | struct list_head msi_list; |
| 1010 | 1010 | #endif |
| 1011 | 1011 | |
| 1012 | −#ifdef CONFIG_NUMA | |
| 1013 | − int numa_node; /* NUMA node this device is close to */ | |
| 1014 | −#endif | |
| 1015 | 1012 | const struct dma_map_ops *dma_ops; |
| 1016 | 1013 | u64 *dma_mask; /* dma mask (if dma'able device) */ |
| 1017 | 1014 | u64 coherent_dma_mask;/* Like dma_mask, but for |
| @@ -1040,6 +1037,9 @@ struct device { · 22 unmodified lines | ||
| 1040 | 1037 | struct device_node *of_node; /* associated device tree node */ |
| 1041 | 1038 | struct fwnode_handle *fwnode; /* firmware device node */ |
| 1042 | 1039 | |
| 1040 | +#ifdef CONFIG_NUMA | |
| 1041 | + int numa_node; /* NUMA node this device is close to */ | |
| 1042 | +#endif | |
| 1043 | 1043 | dev_t devt; /* dev_t, creates the sysfs "dev" */ |
| 1044 | 1044 | u32 id; /* device instance */ |
| 1045 | 1045 | |
| @@ -1229,7 +1229,7 @@ static inline void device_lock_assert(struct device *dev) · 183 unmodified lines | ||
| 1229 | 1229 | |
| 1230 | 1230 | static inline struct device_node *dev_of_node(struct device *dev) |
| 1231 | 1231 | { |
| 1232 | − if (!IS_ENABLED(CONFIG_OF)) | |
| 1232 | + if (!IS_ENABLED(CONFIG_OF) || !dev) | |
| 1233 | 1233 | return NULL; |
| 1234 | 1234 | return dev->of_node; |
| 1235 | 1235 | } |
| @@ -71,12 +71,25 @@ void iommu_dma_unmap_resource(struct device *dev, dma_addr_t handle, · 70 unmodified lines | ||
| 71 | 71 | size_t size, enum dma_data_direction dir, unsigned long attrs); |
| 72 | 72 | |
| 73 | 73 | /* The DMA API isn't _quite_ the whole story, though... */ |
| 74 | −void iommu_dma_map_msi_msg(int irq, struct msi_msg *msg); | |
| 74 | +/* | |
| 75 | + * iommu_dma_prepare_msi() - Map the MSI page in the IOMMU device | |
| 76 | + * | |
| 77 | + * The MSI page will be stored in @desc. | |
| 78 | + * | |
| 79 | + * Return: 0 on success otherwise an error describing the failure. | |
| 80 | + */ | |
| 81 | +int iommu_dma_prepare_msi(struct msi_desc *desc, phys_addr_t msi_addr); | |
| 82 | + | |
| 83 | +/* Update the MSI message if required. */ | |
| 84 | +void iommu_dma_compose_msi_msg(struct msi_desc *desc, | |
| 85 | + struct msi_msg *msg); | |
| 86 | + | |
| 75 | 87 | void iommu_dma_get_resv_regions(struct device *dev, struct list_head *list); |
| 76 | 88 | |
| 77 | 89 | #else |
| 78 | 90 | |
| 79 | 91 | struct iommu_domain; |
| 92 | +struct msi_desc; | |
| 80 | 93 | struct msi_msg; |
| 81 | 94 | struct device; |
| 82 | 95 | |
| @@ -99,7 +112,14 @@ static inline void iommu_put_dma_cookie(struct iommu_domain *domain) · 16 unmodified lines | ||
| 99 | 112 | { |
| 100 | 113 | } |
| 101 | 114 | |
| 102 | −static inline void iommu_dma_map_msi_msg(int irq, struct msi_msg *msg) | |
| 115 | +static inline int iommu_dma_prepare_msi(struct msi_desc *desc, | |
| 116 | + phys_addr_t msi_addr) | |
| 117 | +{ | |
| 118 | + return 0; | |
| 119 | +} | |
| 120 | + | |
| 121 | +static inline void iommu_dma_compose_msi_msg(struct msi_desc *desc, | |
| 122 | + struct msi_msg *msg) | |
| 103 | 123 | { |
| 104 | 124 | } |
| 105 | 125 | |
| @@ -267,9 +267,9 @@ size_t dma_direct_max_mapping_size(struct device *dev); · 266 unmodified lines | ||
| 267 | 267 | |
| 268 | 268 | static inline const struct dma_map_ops *get_dma_ops(struct device *dev) |
| 269 | 269 | { |
| 270 | − if (dev && dev->dma_ops) | |
| 270 | + if (dev->dma_ops) | |
| 271 | 271 | return dev->dma_ops; |
| 272 | − return get_arch_dma_ops(dev ? dev->bus : NULL); | |
| 272 | + return get_arch_dma_ops(dev->bus); | |
| 273 | 273 | } |
| 274 | 274 | |
| 275 | 275 | static inline void set_dma_ops(struct device *dev, |
| @@ -650,7 +650,7 @@ static inline void dma_free_coherent(struct device *dev, size_t size, · 374 unmodified lines | ||
| 650 | 650 | |
| 651 | 651 | static inline u64 dma_get_mask(struct device *dev) |
| 652 | 652 | { |
| 653 | − if (dev && dev->dma_mask && *dev->dma_mask) | |
| 653 | + if (dev->dma_mask && *dev->dma_mask) | |
| 654 | 654 | return *dev->dma_mask; |
| 655 | 655 | return DMA_BIT_MASK(32); |
| 656 | 656 | } |
| @@ -72,6 +72,12 @@ static inline void arch_sync_dma_for_cpu_all(struct device *dev) · 71 unmodified lines | ||
| 72 | 72 | } |
| 73 | 73 | #endif /* CONFIG_ARCH_HAS_SYNC_DMA_FOR_CPU_ALL */ |
| 74 | 74 | |
| 75 | +#ifdef CONFIG_ARCH_HAS_DMA_PREP_COHERENT | |
| 75 | 76 | void arch_dma_prep_coherent(struct page *page, size_t size); |
| 77 | +#else | |
| 78 | +static inline void arch_dma_prep_coherent(struct page *page, size_t size) | |
| 79 | +{ | |
| 80 | +} | |
| 81 | +#endif /* CONFIG_ARCH_HAS_DMA_PREP_COHERENT */ | |
| 76 | 82 | |
| 77 | 83 | #endif /* _LINUX_DMA_NONCOHERENT_H */ |
| @@ -0,0 +1,14 @@ | ||
| 1 | +/* SPDX-License-Identifier: GPL-2.0 */ | |
| 2 | +/* | |
| 3 | + * Definitions for the Intel integrated DMA 64-bit | |
| 4 | + * | |
| 5 | + * Copyright (C) 2019 Intel Corporation | |
| 6 | + */ | |
| 7 | + | |
| 8 | +#ifndef __LINUX_DMA_IDMA64_H__ | |
| 9 | +#define __LINUX_DMA_IDMA64_H__ | |
| 10 | + | |
| 11 | +/* Platform driver name */ | |
| 12 | +#define LPSS_IDMA64_DRIVER_NAME "idma64" | |
| 13 | + | |
| 14 | +#endif /* __LINUX_DMA_IDMA64_H__ */ | |
| @@ -102,9 +102,7 @@ const struct dmi_system_id *dmi_first_match(const struct dmi_system_id *list); · 101 unmodified lines | ||
| 102 | 102 | extern const char * dmi_get_system_info(int field); |
| 103 | 103 | extern const struct dmi_device * dmi_find_device(int type, const char *name, |
| 104 | 104 | const struct dmi_device *from); |
| 105 | −extern void dmi_scan_machine(void); | |
| 106 | −extern void dmi_memdev_walk(void); | |
| 107 | −extern void dmi_set_dump_stack_arch_desc(void); | |
| 105 | +extern void dmi_setup(void); | |
| 108 | 106 | extern bool dmi_get_date(int field, int *yearp, int *monthp, int *dayp); |
| 109 | 107 | extern int dmi_get_bios_year(void); |
| 110 | 108 | extern int dmi_name_in_vendors(const char *str); |
| @@ -122,9 +120,7 @@ static inline int dmi_check_system(const struct dmi_system_id *list) { return 0; · 11 unmodified lines | ||
| 122 | 120 | static inline const char * dmi_get_system_info(int field) { return NULL; } |
| 123 | 121 | static inline const struct dmi_device * dmi_find_device(int type, const char *name, |
| 124 | 122 | const struct dmi_device *from) { return NULL; } |
| 125 | −static inline void dmi_scan_machine(void) { return; } | |
| 126 | −static inline void dmi_memdev_walk(void) { } | |
| 127 | −static inline void dmi_set_dump_stack_arch_desc(void) { } | |
| 123 | +static inline void dmi_setup(void) { } | |
| 128 | 124 | static inline bool dmi_get_date(int field, int *yearp, int *monthp, int *dayp) |
| 129 | 125 | { |
| 130 | 126 | if (yearp) |
| @@ -27,6 +27,7 @@ · 26 unmodified lines | ||
| 27 | 27 | #include <uapi/linux/dns_resolver.h> |
| 28 | 28 | |
| 29 | 29 | extern int dns_query(const char *type, const char *name, size_t namelen, |
| 30 | − const char *options, char **_result, time64_t *_expiry); | |
| 30 | + const char *options, char **_result, time64_t *_expiry, | |
| 31 | + bool invalidate); | |
| 31 | 32 | |
| 32 | 33 | #endif /* _LINUX_DNS_RESOLVER_H */ |
| @@ -0,0 +1,76 @@ | ||
| 1 | +/* SPDX-License-Identifier: GPL-2.0 | |
| 2 | + * Copyright (c) 2019, Vladimir Oltean <olteanv@gmail.com> | |
| 3 | + */ | |
| 4 | + | |
| 5 | +#ifndef _NET_DSA_8021Q_H | |
| 6 | +#define _NET_DSA_8021Q_H | |
| 7 | + | |
| 8 | +#include <linux/types.h> | |
| 9 | + | |
| 10 | +struct dsa_switch; | |
| 11 | +struct sk_buff; | |
| 12 | +struct net_device; | |
| 13 | +struct packet_type; | |
| 14 | + | |
| 15 | +#if IS_ENABLED(CONFIG_NET_DSA_TAG_8021Q) | |
| 16 | + | |
| 17 | +int dsa_port_setup_8021q_tagging(struct dsa_switch *ds, int index, | |
| 18 | + bool enabled); | |
| 19 | + | |
| 20 | +struct sk_buff *dsa_8021q_xmit(struct sk_buff *skb, struct net_device *netdev, | |
| 21 | + u16 tpid, u16 tci); | |
| 22 | + | |
| 23 | +struct sk_buff *dsa_8021q_rcv(struct sk_buff *skb, struct net_device *netdev, | |
| 24 | + struct packet_type *pt, u16 *tpid, u16 *tci); | |
| 25 | + | |
| 26 | +u16 dsa_8021q_tx_vid(struct dsa_switch *ds, int port); | |
| 27 | + | |
| 28 | +u16 dsa_8021q_rx_vid(struct dsa_switch *ds, int port); | |
| 29 | + | |
| 30 | +int dsa_8021q_rx_switch_id(u16 vid); | |
| 31 | + | |
| 32 | +int dsa_8021q_rx_source_port(u16 vid); | |
| 33 | + | |
| 34 | +#else | |
| 35 | + | |
| 36 | +int dsa_port_setup_8021q_tagging(struct dsa_switch *ds, int index, | |
| 37 | + bool enabled) | |
| 38 | +{ | |
| 39 | + return 0; | |
| 40 | +} | |
| 41 | + | |
| 42 | +struct sk_buff *dsa_8021q_xmit(struct sk_buff *skb, struct net_device *netdev, | |
| 43 | + u16 tpid, u16 tci) | |
| 44 | +{ | |
| 45 | + return NULL; | |
| 46 | +} | |
| 47 | + | |
| 48 | +struct sk_buff *dsa_8021q_rcv(struct sk_buff *skb, struct net_device *netdev, | |
| 49 | + struct packet_type *pt, u16 *tpid, u16 *tci) | |
| 50 | +{ | |
| 51 | + return NULL; | |
| 52 | +} | |
| 53 | + | |
| 54 | +u16 dsa_8021q_tx_vid(struct dsa_switch *ds, int port) | |
| 55 | +{ | |
| 56 | + return 0; | |
| 57 | +} | |
| 58 | + | |
| 59 | +u16 dsa_8021q_rx_vid(struct dsa_switch *ds, int port) | |
| 60 | +{ | |
| 61 | + return 0; | |
| 62 | +} | |
| 63 | + | |
| 64 | +int dsa_8021q_rx_switch_id(u16 vid) | |
| 65 | +{ | |
| 66 | + return 0; | |
| 67 | +} | |
| 68 | + | |
| 69 | +int dsa_8021q_rx_source_port(u16 vid) | |
| 70 | +{ | |
| 71 | + return 0; | |
| 72 | +} | |
| 73 | + | |
| 74 | +#endif /* IS_ENABLED(CONFIG_NET_DSA_TAG_8021Q) */ | |
| 75 | + | |
| 76 | +#endif /* _NET_DSA_8021Q_H */ | |
| @@ -0,0 +1,40 @@ | ||
| 1 | +/* SPDX-License-Identifier: GPL-2.0 | |
| 2 | + * Copyright (c) 2019, Vladimir Oltean <olteanv@gmail.com> | |
| 3 | + */ | |
| 4 | + | |
| 5 | +/* Included by drivers/net/dsa/sja1105/sja1105.h and net/dsa/tag_sja1105.c */ | |
| 6 | + | |
| 7 | +#ifndef _NET_DSA_SJA1105_H | |
| 8 | +#define _NET_DSA_SJA1105_H | |
| 9 | + | |
| 10 | +#include <linux/skbuff.h> | |
| 11 | +#include <linux/etherdevice.h> | |
| 12 | +#include <net/dsa.h> | |
| 13 | + | |
| 14 | +#define ETH_P_SJA1105 ETH_P_DSA_8021Q | |
| 15 | + | |
| 16 | +/* IEEE 802.3 Annex 57A: Slow Protocols PDUs (01:80:C2:xx:xx:xx) */ | |
| 17 | +#define SJA1105_LINKLOCAL_FILTER_A 0x0180C2000000ull | |
| 18 | +#define SJA1105_LINKLOCAL_FILTER_A_MASK 0xFFFFFF000000ull | |
| 19 | +/* IEEE 1588 Annex F: Transport of PTP over Ethernet (01:1B:19:xx:xx:xx) */ | |
| 20 | +#define SJA1105_LINKLOCAL_FILTER_B 0x011B19000000ull | |
| 21 | +#define SJA1105_LINKLOCAL_FILTER_B_MASK 0xFFFFFF000000ull | |
| 22 | + | |
| 23 | +enum sja1105_frame_type { | |
| 24 | + SJA1105_FRAME_TYPE_NORMAL = 0, | |
| 25 | + SJA1105_FRAME_TYPE_LINK_LOCAL, | |
| 26 | +}; | |
| 27 | + | |
| 28 | +struct sja1105_skb_cb { | |
| 29 | + enum sja1105_frame_type type; | |
| 30 | +}; | |
| 31 | + | |
| 32 | +#define SJA1105_SKB_CB(skb) \ | |
| 33 | + ((struct sja1105_skb_cb *)DSA_SKB_CB_PRIV(skb)) | |
| 34 | + | |
| 35 | +struct sja1105_port { | |
| 36 | + struct dsa_port *dp; | |
| 37 | + int mgmt_slot; | |
| 38 | +}; | |
| 39 | + | |
| 40 | +#endif /* _NET_DSA_SJA1105_H */ | |
| @@ -71,6 +71,13 @@ void __dynamic_netdev_dbg(struct _ddebug *descriptor, · 70 unmodified lines | ||
| 71 | 71 | const struct net_device *dev, |
| 72 | 72 | const char *fmt, ...); |
| 73 | 73 | |
| 74 | +struct ib_device; | |
| 75 | + | |
| 76 | +extern __printf(3, 4) | |
| 77 | +void __dynamic_ibdev_dbg(struct _ddebug *descriptor, | |
| 78 | + const struct ib_device *ibdev, | |
| 79 | + const char *fmt, ...); | |
| 80 | + | |
| 74 | 81 | #define DEFINE_DYNAMIC_DEBUG_METADATA(name, fmt) \ |
| 75 | 82 | static struct _ddebug __aligned(8) \ |
| 76 | 83 | __attribute__((section("__verbose"))) name = { \ |
| @@ -154,6 +161,10 @@ void __dynamic_netdev_dbg(struct _ddebug *descriptor, · 77 unmodified lines | ||
| 154 | 161 | _dynamic_func_call(fmt, __dynamic_netdev_dbg, \ |
| 155 | 162 | dev, fmt, ##__VA_ARGS__) |
| 156 | 163 | |
| 164 | +#define dynamic_ibdev_dbg(dev, fmt, ...) \ | |
| 165 | + _dynamic_func_call(fmt, __dynamic_ibdev_dbg, \ | |
| 166 | + dev, fmt, ##__VA_ARGS__) | |
| 167 | + | |
| 157 | 168 | #define dynamic_hex_dump(prefix_str, prefix_type, rowsize, \ |
| 158 | 169 | groupsize, buf, len, ascii) \ |
| 159 | 170 | _dynamic_func_call_no_desc(__builtin_constant_p(prefix_str) ? prefix_str : "hexdump", \ |
| @@ -1611,7 +1611,12 @@ efi_status_t efi_setup_gop(efi_system_table_t *sys_table_arg, · 1610 unmodified lines | ||
| 1611 | 1611 | struct screen_info *si, efi_guid_t *proto, |
| 1612 | 1612 | unsigned long size); |
| 1613 | 1613 | |
| 1614 | −bool efi_runtime_disabled(void); | |
| 1614 | +#ifdef CONFIG_EFI | |
| 1615 | +extern bool efi_runtime_disabled(void); | |
| 1616 | +#else | |
| 1617 | +static inline bool efi_runtime_disabled(void) { return true; } | |
| 1618 | +#endif | |
| 1619 | + | |
| 1615 | 1620 | extern void efi_call_virt_check_flags(unsigned long flags, const char *call); |
| 1616 | 1621 | extern unsigned long efi_call_virt_save_flags(void); |
| 1617 | 1622 | |
| @@ -31,6 +31,7 @@ struct elevator_mq_ops { · 30 unmodified lines | ||
| 31 | 31 | void (*exit_sched)(struct elevator_queue *); |
| 32 | 32 | int (*init_hctx)(struct blk_mq_hw_ctx *, unsigned int); |
| 33 | 33 | void (*exit_hctx)(struct blk_mq_hw_ctx *, unsigned int); |
| 34 | + void (*depth_updated)(struct blk_mq_hw_ctx *); | |
| 34 | 35 | |
| 35 | 36 | bool (*allow_merge)(struct request_queue *, struct request *, struct bio *); |
| 36 | 37 | bool (*bio_merge)(struct blk_mq_hw_ctx *, struct bio *); |
| @@ -33,7 +33,7 @@ struct device; · 32 unmodified lines | ||
| 33 | 33 | int eth_platform_get_mac_address(struct device *dev, u8 *mac_addr); |
| 34 | 34 | unsigned char *arch_get_platform_mac_address(void); |
| 35 | 35 | int nvmem_get_mac_address(struct device *dev, void *addrbuf); |
| 36 | −u32 eth_get_headlen(void *data, unsigned int max_len); | |
| 36 | +u32 eth_get_headlen(const struct net_device *dev, void *data, unsigned int len); | |
| 37 | 37 | __be16 eth_type_trans(struct sk_buff *skb, struct net_device *dev); |
| 38 | 38 | extern const struct header_ops eth_header_ops; |
| 39 | 39 | |
| @@ -448,6 +448,18 @@ static inline void eth_addr_dec(u8 *addr) · 408 unmodified lines | ||
| 448 | 448 | u64_to_ether_addr(u, addr); |
| 449 | 449 | } |
| 450 | 450 | |
| 451 | +/** | |
| 452 | + * eth_addr_inc() - Increment the given MAC address. | |
| 453 | + * @addr: Pointer to a six-byte array containing Ethernet address to increment. | |
| 454 | + */ | |
| 455 | +static inline void eth_addr_inc(u8 *addr) | |
| 456 | +{ | |
| 457 | + u64 u = ether_addr_to_u64(addr); | |
| 458 | + | |
| 459 | + u++; | |
| 460 | + u64_to_ether_addr(u, addr); | |
| 461 | +} | |
| 462 | + | |
| 451 | 463 | /** |
| 452 | 464 | * is_etherdev_addr - Tell if given Ethernet address belongs to the device. |
| 453 | 465 | * @dev: Pointer to a device structure |
| @@ -164,6 +164,10 @@ struct f2fs_checkpoint { · 163 unmodified lines | ||
| 164 | 164 | unsigned char sit_nat_version_bitmap[1]; |
| 165 | 165 | } __packed; |
| 166 | 166 | |
| 167 | +#define CP_CHKSUM_OFFSET 4092 /* default chksum offset in checkpoint */ | |
| 168 | +#define CP_MIN_CHKSUM_OFFSET \ | |
| 169 | + (offsetof(struct f2fs_checkpoint, sit_nat_version_bitmap)) | |
| 170 | + | |
| 167 | 171 | /* |
| 168 | 172 | * For orphan inode management |
| 169 | 173 | */ |
| @@ -198,11 +202,12 @@ struct f2fs_extent { · 28 unmodified lines | ||
| 198 | 202 | get_extra_isize(inode)) |
| 199 | 203 | #define DEF_NIDS_PER_INODE 5 /* Node IDs in an Inode */ |
| 200 | 204 | #define ADDRS_PER_INODE(inode) addrs_per_inode(inode) |
| 201 | −#define ADDRS_PER_BLOCK 1018 /* Address Pointers in a Direct Block */ | |
| 205 | +#define DEF_ADDRS_PER_BLOCK 1018 /* Address Pointers in a Direct Block */ | |
| 206 | +#define ADDRS_PER_BLOCK(inode) addrs_per_block(inode) | |
| 202 | 207 | #define NIDS_PER_BLOCK 1018 /* Node IDs in an Indirect Block */ |
| 203 | 208 | |
| 204 | 209 | #define ADDRS_PER_PAGE(page, inode) \ |
| 205 | − (IS_INODE(page) ? ADDRS_PER_INODE(inode) : ADDRS_PER_BLOCK) | |
| 210 | + (IS_INODE(page) ? ADDRS_PER_INODE(inode) : ADDRS_PER_BLOCK(inode)) | |
| 206 | 211 | |
| 207 | 212 | #define NODE_DIR1_BLOCK (DEF_ADDRS_PER_INODE + 1) |
| 208 | 213 | #define NODE_DIR2_BLOCK (DEF_ADDRS_PER_INODE + 2) |
| @@ -267,7 +272,7 @@ struct f2fs_inode { · 58 unmodified lines | ||
| 267 | 272 | } __packed; |
| 268 | 273 | |
| 269 | 274 | struct direct_node { |
| 270 | − __le32 addr[ADDRS_PER_BLOCK]; /* array of data block address */ | |
| 275 | + __le32 addr[DEF_ADDRS_PER_BLOCK]; /* array of data block address */ | |
| 271 | 276 | } __packed; |
| 272 | 277 | |
| 273 | 278 | struct indirect_node { |
| @@ -20,6 +20,7 @@ · 19 unmodified lines | ||
| 20 | 20 | #include <linux/set_memory.h> |
| 21 | 21 | #include <linux/kallsyms.h> |
| 22 | 22 | #include <linux/if_vlan.h> |
| 23 | +#include <linux/vmalloc.h> | |
| 23 | 24 | |
| 24 | 25 | #include <net/sch_generic.h> |
| 25 | 26 | |
| @@ -33,6 +34,8 @@ struct bpf_prog_aux; · 7 unmodified lines | ||
| 33 | 34 | struct xdp_rxq_info; |
| 34 | 35 | struct xdp_buff; |
| 35 | 36 | struct sock_reuseport; |
| 37 | +struct ctl_table; | |
| 38 | +struct ctl_table_header; | |
| 36 | 39 | |
| 37 | 40 | /* ArgX, context and stack frame pointer register positions. Note, |
| 38 | 41 | * Arg1, Arg2, Arg3, etc are used as argument mappings of function |
| @@ -503,7 +506,6 @@ struct bpf_prog { · 464 unmodified lines | ||
| 503 | 506 | u16 pages; /* Number of allocated pages */ |
| 504 | 507 | u16 jited:1, /* Is our filter JIT'ed? */ |
| 505 | 508 | jit_requested:1,/* archs need to JIT the prog */ |
| 506 | − undo_set_mem:1, /* Passed set_memory_ro() checkpoint */ | |
| 507 | 509 | gpl_compatible:1, /* Is filter GPL compatible? */ |
| 508 | 510 | cb_access:1, /* Is control block accessed? */ |
| 509 | 511 | dst_needed:1, /* Do we need dst entry? */ |
| @@ -733,24 +735,15 @@ bpf_ctx_narrow_access_ok(u32 off, u32 size, u32 size_default) · 223 unmodified lines | ||
| 733 | 735 | |
| 734 | 736 | static inline void bpf_prog_lock_ro(struct bpf_prog *fp) |
| 735 | 737 | { |
| 736 | − fp->undo_set_mem = 1; | |
| 738 | + set_vm_flush_reset_perms(fp); | |
| 737 | 739 | set_memory_ro((unsigned long)fp, fp->pages); |
| 738 | 740 | } |
| 739 | 741 | |
| 740 | −static inline void bpf_prog_unlock_ro(struct bpf_prog *fp) | |
| 741 | −{ | |
| 742 | − if (fp->undo_set_mem) | |
| 743 | − set_memory_rw((unsigned long)fp, fp->pages); | |
| 744 | −} | |
| 745 | − | |
| 746 | 742 | static inline void bpf_jit_binary_lock_ro(struct bpf_binary_header *hdr) |
| 747 | 743 | { |
| 744 | + set_vm_flush_reset_perms(hdr); | |
| 748 | 745 | set_memory_ro((unsigned long)hdr, hdr->pages); |
| 749 | −} | |
| 750 | − | |
| 751 | −static inline void bpf_jit_binary_unlock_ro(struct bpf_binary_header *hdr) | |
| 752 | −{ | |
| 753 | − set_memory_rw((unsigned long)hdr, hdr->pages); | |
| 746 | + set_memory_x((unsigned long)hdr, hdr->pages); | |
| 754 | 747 | } |
| 755 | 748 | |
| 756 | 749 | static inline struct bpf_binary_header * |
| @@ -788,7 +781,6 @@ void __bpf_prog_free(struct bpf_prog *fp); · 31 unmodified lines | ||
| 788 | 781 | |
| 789 | 782 | static inline void bpf_prog_unlock_free(struct bpf_prog *fp) |
| 790 | 783 | { |
| 791 | − bpf_prog_unlock_ro(fp); | |
| 792 | 784 | __bpf_prog_free(fp); |
| 793 | 785 | } |
| 794 | 786 | |
| @@ -1177,4 +1169,18 @@ struct bpf_sock_ops_kern { · 382 unmodified lines | ||
| 1177 | 1169 | */ |
| 1178 | 1170 | }; |
| 1179 | 1171 | |
| 1172 | +struct bpf_sysctl_kern { | |
| 1173 | + struct ctl_table_header *head; | |
| 1174 | + struct ctl_table *table; | |
| 1175 | + void *cur_val; | |
| 1176 | + size_t cur_len; | |
| 1177 | + void *new_val; | |
| 1178 | + size_t new_len; | |
| 1179 | + int new_updated; | |
| 1180 | + int write; | |
| 1181 | + loff_t *ppos; | |
| 1182 | + /* Temporary "register" for indirect stores to ppos. */ | |
| 1183 | + u64 tmp_reg; | |
| 1184 | +}; | |
| 1185 | + | |
| 1180 | 1186 | #endif /* __LINUX_FILTER_H__ */ |
| @@ -15,4 +15,9 @@ · 14 unmodified lines | ||
| 15 | 15 | |
| 16 | 16 | #include <linux/firmware/imx/svc/misc.h> |
| 17 | 17 | #include <linux/firmware/imx/svc/pm.h> |
| 18 | + | |
| 19 | +int imx_scu_enable_general_irq_channel(struct device *dev); | |
| 20 | +int imx_scu_irq_register_notifier(struct notifier_block *nb); | |
| 21 | +int imx_scu_irq_unregister_notifier(struct notifier_block *nb); | |
| 22 | +int imx_scu_irq_group_enable(u8 group, u32 mask, u8 enable); | |
| 18 | 23 | #endif /* _SC_SCI_H */ |
| @@ -309,4 +309,23 @@ INTEL_SIP_SMC_FAST_CALL_VAL(INTEL_SIP_SMC_FUNCID_FPGA_CONFIG_COMPLETED_WRITE) · 308 unmodified lines | ||
| 309 | 309 | #define INTEL_SIP_SMC_FUNCID_RSU_UPDATE 12 |
| 310 | 310 | #define INTEL_SIP_SMC_RSU_UPDATE \ |
| 311 | 311 | INTEL_SIP_SMC_FAST_CALL_VAL(INTEL_SIP_SMC_FUNCID_RSU_UPDATE) |
| 312 | + | |
| 313 | +/* | |
| 314 | + * Request INTEL_SIP_SMC_ECC_DBE | |
| 315 | + * | |
| 316 | + * Sync call used by service driver at EL1 to alert EL3 that a Double | |
| 317 | + * Bit ECC error has occurred. | |
| 318 | + * | |
| 319 | + * Call register usage: | |
| 320 | + * a0 INTEL_SIP_SMC_ECC_DBE | |
| 321 | + * a1 SysManager Double Bit Error value | |
| 322 | + * a2-7 not used | |
| 323 | + * | |
| 324 | + * Return status | |
| 325 | + * a0 INTEL_SIP_SMC_STATUS_OK | |
| 326 | + */ | |
| 327 | +#define INTEL_SIP_SMC_FUNCID_ECC_DBE 13 | |
| 328 | +#define INTEL_SIP_SMC_ECC_DBE \ | |
| 329 | + INTEL_SIP_SMC_FAST_CALL_VAL(INTEL_SIP_SMC_FUNCID_ECC_DBE) | |
| 330 | + | |
| 312 | 331 | #endif |
| @@ -0,0 +1,96 @@ | ||
| 1 | +/* | |
| 2 | + * Copyright (c) 2013, NVIDIA Corporation. | |
| 3 | + * | |
| 4 | + * This program is free software; you can redistribute it and/or modify | |
| 5 | + * it under the terms of the GNU General Public License as published by | |
| 6 | + * the Free Software Foundation; either version 2 of the License, or | |
| 7 | + * (at your option) any later version. | |
| 8 | + * | |
| 9 | + * This program is distributed in the hope that it will be useful, but WITHOUT | |
| 10 | + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |
| 11 | + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for | |
| 12 | + * more details. | |
| 13 | + */ | |
| 14 | + | |
| 15 | +/* | |
| 16 | + * Support for the Trusted Foundations secure monitor. | |
| 17 | + * | |
| 18 | + * Trusted Foundation comes active on some ARM consumer devices (most | |
| 19 | + * Tegra-based devices sold on the market are concerned). Such devices can only | |
| 20 | + * perform some basic operations, like setting the CPU reset vector, through | |
| 21 | + * SMC calls to the secure monitor. The calls are completely specific to | |
| 22 | + * Trusted Foundations, and do *not* follow the SMC calling convention or the | |
| 23 | + * PSCI standard. | |
| 24 | + */ | |
| 25 | + | |
| 26 | +#ifndef __FIRMWARE_TRUSTED_FOUNDATIONS_H | |
| 27 | +#define __FIRMWARE_TRUSTED_FOUNDATIONS_H | |
| 28 | + | |
| 29 | +#include <linux/printk.h> | |
| 30 | +#include <linux/bug.h> | |
| 31 | +#include <linux/of.h> | |
| 32 | +#include <linux/cpu.h> | |
| 33 | +#include <linux/smp.h> | |
| 34 | +#include <linux/types.h> | |
| 35 | + | |
| 36 | +#include <asm/hardware/cache-l2x0.h> | |
| 37 | +#include <asm/outercache.h> | |
| 38 | + | |
| 39 | +#define TF_PM_MODE_LP0 0 | |
| 40 | +#define TF_PM_MODE_LP1 1 | |
| 41 | +#define TF_PM_MODE_LP1_NO_MC_CLK 2 | |
| 42 | +#define TF_PM_MODE_LP2 3 | |
| 43 | +#define TF_PM_MODE_LP2_NOFLUSH_L2 4 | |
| 44 | + | |
| 45 | +struct trusted_foundations_platform_data { | |
| 46 | + unsigned int version_major; | |
| 47 | + unsigned int version_minor; | |
| 48 | +}; | |
| 49 | + | |
| 50 | +#if IS_ENABLED(CONFIG_TRUSTED_FOUNDATIONS) | |
| 51 | + | |
| 52 | +void register_trusted_foundations(struct trusted_foundations_platform_data *pd); | |
| 53 | +void of_register_trusted_foundations(void); | |
| 54 | +bool trusted_foundations_registered(void); | |
| 55 | + | |
| 56 | +#else /* CONFIG_TRUSTED_FOUNDATIONS */ | |
| 57 | +static inline void tf_dummy_write_sec(unsigned long val, unsigned int reg) | |
| 58 | +{ | |
| 59 | +} | |
| 60 | + | |
| 61 | +static inline void register_trusted_foundations( | |
| 62 | + struct trusted_foundations_platform_data *pd) | |
| 63 | +{ | |
| 64 | + /* | |
| 65 | + * If the system requires TF and we cannot provide it, continue booting | |
| 66 | + * but disable features that cannot be provided. | |
| 67 | + */ | |
| 68 | + pr_err("No support for Trusted Foundations, continuing in degraded mode.\n"); | |
| 69 | + pr_err("Secondary processors as well as CPU PM will be disabled.\n"); | |
| 70 | +#if IS_ENABLED(CONFIG_CACHE_L2X0) | |
| 71 | + pr_err("L2X0 cache will be kept disabled.\n"); | |
| 72 | + outer_cache.write_sec = tf_dummy_write_sec; | |
| 73 | +#endif | |
| 74 | +#if IS_ENABLED(CONFIG_SMP) | |
| 75 | + setup_max_cpus = 0; | |
| 76 | +#endif | |
| 77 | + cpu_idle_poll_ctrl(true); | |
| 78 | +} | |
| 79 | + | |
| 80 | +static inline void of_register_trusted_foundations(void) | |
| 81 | +{ | |
| 82 | + /* | |
| 83 | + * If we find the target should enable TF but does not support it, | |
| 84 | + * fail as the system won't be able to do much anyway | |
| 85 | + */ | |
| 86 | + if (of_find_compatible_node(NULL, NULL, "tlm,trusted-foundations")) | |
| 87 | + register_trusted_foundations(NULL); | |
| 88 | +} | |
| 89 | + | |
| 90 | +static inline bool trusted_foundations_registered(void) | |
| 91 | +{ | |
| 92 | + return false; | |
| 93 | +} | |
| 94 | +#endif /* CONFIG_TRUSTED_FOUNDATIONS */ | |
| 95 | + | |
| 96 | +#endif | |
| @@ -48,6 +48,14 @@ · 47 unmodified lines | ||
| 48 | 48 | #define ZYNQMP_PM_CAPABILITY_WAKEUP 0x4U |
| 49 | 49 | #define ZYNQMP_PM_CAPABILITY_POWER 0x8U |
| 50 | 50 | |
| 51 | +/* | |
| 52 | + * Firmware FPGA Manager flags | |
| 53 | + * XILINX_ZYNQMP_PM_FPGA_FULL: FPGA full reconfiguration | |
| 54 | + * XILINX_ZYNQMP_PM_FPGA_PARTIAL: FPGA partial reconfiguration | |
| 55 | + */ | |
| 56 | +#define XILINX_ZYNQMP_PM_FPGA_FULL 0x0U | |
| 57 | +#define XILINX_ZYNQMP_PM_FPGA_PARTIAL BIT(0) | |
| 58 | + | |
| 51 | 59 | enum pm_api_id { |
| 52 | 60 | PM_GET_API_VERSION = 1, |
| 53 | 61 | PM_REQUEST_NODE = 13, |
| @@ -56,6 +64,8 @@ enum pm_api_id { · 2 unmodified lines | ||
| 56 | 64 | PM_RESET_ASSERT = 17, |
| 57 | 65 | PM_RESET_GET_STATUS, |
| 58 | 66 | PM_PM_INIT_FINALIZE = 21, |
| 67 | + PM_FPGA_LOAD, | |
| 68 | + PM_FPGA_GET_STATUS, | |
| 59 | 69 | PM_GET_CHIPID = 24, |
| 60 | 70 | PM_IOCTL = 34, |
| 61 | 71 | PM_QUERY_DATA, |
| @@ -258,6 +268,8 @@ struct zynqmp_pm_query_data { · 196 unmodified lines | ||
| 258 | 268 | struct zynqmp_eemi_ops { |
| 259 | 269 | int (*get_api_version)(u32 *version); |
| 260 | 270 | int (*get_chipid)(u32 *idcode, u32 *version); |
| 271 | + int (*fpga_load)(const u64 address, const u32 size, const u32 flags); | |
| 272 | + int (*fpga_get_status)(u32 *value); | |
| 261 | 273 | int (*query_data)(struct zynqmp_pm_query_data qdata, u32 *out); |
| 262 | 274 | int (*clock_enable)(u32 clock_id); |
| 263 | 275 | int (*clock_disable)(u32 clock_id); |
| @@ -293,7 +305,7 @@ const struct zynqmp_eemi_ops *zynqmp_pm_get_eemi_ops(void); · 29 unmodified lines | ||
| 293 | 305 | #else |
| 294 | 306 | static inline struct zynqmp_eemi_ops *zynqmp_pm_get_eemi_ops(void) |
| 295 | 307 | { |
| 296 | − return NULL; | |
| 308 | + return ERR_PTR(-ENODEV); | |
| 297 | 309 | } |
| 298 | 310 | #endif |
| 299 | 311 | |
| @@ -165,10 +165,13 @@ typedef int (dio_iodone_t)(struct kiocb *iocb, loff_t offset, · 164 unmodified lines | ||
| 165 | 165 | #define FMODE_NONOTIFY ((__force fmode_t)0x4000000) |
| 166 | 166 | |
| 167 | 167 | /* File is capable of returning -EAGAIN if I/O will block */ |
| 168 | −#define FMODE_NOWAIT ((__force fmode_t)0x8000000) | |
| 168 | +#define FMODE_NOWAIT ((__force fmode_t)0x8000000) | |
| 169 | + | |
| 170 | +/* File represents mount that needs unmounting */ | |
| 171 | +#define FMODE_NEED_UNMOUNT ((__force fmode_t)0x10000000) | |
| 169 | 172 | |
| 170 | 173 | /* File does not contribute to nr_files count */ |
| 171 | −#define FMODE_NOACCOUNT ((__force fmode_t)0x20000000) | |
| 174 | +#define FMODE_NOACCOUNT ((__force fmode_t)0x20000000) | |
| 172 | 175 | |
| 173 | 176 | /* |
| 174 | 177 | * Flag for rw_copy_check_uvector and compat_rw_copy_check_uvector |
| @@ -694,7 +697,10 @@ struct inode { · 519 unmodified lines | ||
| 694 | 697 | #ifdef CONFIG_IMA |
| 695 | 698 | atomic_t i_readcount; /* struct files open RO */ |
| 696 | 699 | #endif |
| 697 | − const struct file_operations *i_fop; /* former ->i_op->default_file_ops */ | |
| 700 | + union { | |
| 701 | + const struct file_operations *i_fop; /* former ->i_op->default_file_ops */ | |
| 702 | + void (*free_inode)(struct inode *); | |
| 703 | + }; | |
| 698 | 704 | struct file_lock_context *i_flctx; |
| 699 | 705 | struct address_space i_data; |
| 700 | 706 | struct list_head i_devices; |
| @@ -969,7 +975,6 @@ static inline struct file *get_file(struct file *f) · 268 unmodified lines | ||
| 969 | 975 | #define get_file_rcu_many(x, cnt) \ |
| 970 | 976 | atomic_long_add_unless(&(x)->f_count, (cnt), 0) |
| 971 | 977 | #define get_file_rcu(x) get_file_rcu_many((x), 1) |
| 972 | −#define fput_atomic(x) atomic_long_add_unless(&(x)->f_count, -1, 1) | |
| 973 | 978 | #define file_count(x) atomic_long_read(&(x)->f_count) |
| 974 | 979 | |
| 975 | 980 | #define MAX_NON_LFS ((1UL<<31) - 1) |
| @@ -1093,6 +1098,7 @@ struct file_lock { · 117 unmodified lines | ||
| 1093 | 1098 | struct { |
| 1094 | 1099 | struct list_head link; /* link in AFS vnode's pending_locks list */ |
| 1095 | 1100 | int state; /* state of grant or error if -ve */ |
| 1101 | + unsigned int debug_id; | |
| 1096 | 1102 | } afs; |
| 1097 | 1103 | } fl_u; |
| 1098 | 1104 | } __randomize_layout; |
| @@ -1903,6 +1909,7 @@ extern loff_t vfs_dedupe_file_range_one(struct file *src_file, loff_t src_pos, · 804 unmodified lines | ||
| 1903 | 1909 | struct super_operations { |
| 1904 | 1910 | struct inode *(*alloc_inode)(struct super_block *sb); |
| 1905 | 1911 | void (*destroy_inode)(struct inode *); |
| 1912 | + void (*free_inode)(struct inode *); | |
| 1906 | 1913 | |
| 1907 | 1914 | void (*dirty_inode) (struct inode *, int flags); |
| 1908 | 1915 | int (*write_inode) (struct inode *, struct writeback_control *wbc); |
| @@ -1956,6 +1963,7 @@ struct super_operations { · 47 unmodified lines | ||
| 1956 | 1963 | #define S_DAX 0 /* Make all the DAX code disappear */ |
| 1957 | 1964 | #endif |
| 1958 | 1965 | #define S_ENCRYPTED 16384 /* Encrypted file (using fs/crypto/) */ |
| 1966 | +#define S_CASEFOLD 32768 /* Casefolded file */ | |
| 1959 | 1967 | |
| 1960 | 1968 | /* |
| 1961 | 1969 | * Note that nosuid etc flags are inode-specific: setting some file-system |
| @@ -1996,6 +2004,7 @@ static inline bool sb_rdonly(const struct super_block *sb) { return sb->s_flags · 34 unmodified lines | ||
| 1996 | 2004 | #define IS_NOSEC(inode) ((inode)->i_flags & S_NOSEC) |
| 1997 | 2005 | #define IS_DAX(inode) ((inode)->i_flags & S_DAX) |
| 1998 | 2006 | #define IS_ENCRYPTED(inode) ((inode)->i_flags & S_ENCRYPTED) |
| 2007 | +#define IS_CASEFOLDED(inode) ((inode)->i_flags & S_CASEFOLD) | |
| 1999 | 2008 | |
| 2000 | 2009 | #define IS_WHITEOUT(inode) (S_ISCHR(inode->i_mode) && \ |
| 2001 | 2010 | (inode)->i_rdev == WHITEOUT_DEV) |
| @@ -2785,6 +2794,9 @@ extern int vfs_fsync_range(struct file *file, loff_t start, loff_t end, · 783 unmodified lines | ||
| 2785 | 2794 | int datasync); |
| 2786 | 2795 | extern int vfs_fsync(struct file *file, int datasync); |
| 2787 | 2796 | |
| 2797 | +extern int sync_file_range(struct file *file, loff_t offset, loff_t nbytes, | |
| 2798 | + unsigned int flags); | |
| 2799 | + | |
| 2788 | 2800 | /* |
| 2789 | 2801 | * Sync the bytes written if this was a synchronous write. Expect ki_pos |
| 2790 | 2802 | * to already be updated for the write, and will return either the amount |
| @@ -13,8 +13,10 @@ · 12 unmodified lines | ||
| 13 | 13 | #define _LINUX_FS_CONTEXT_H |
| 14 | 14 | |
| 15 | 15 | #include <linux/kernel.h> |
| 16 | +#include <linux/refcount.h> | |
| 16 | 17 | #include <linux/errno.h> |
| 17 | 18 | #include <linux/security.h> |
| 19 | +#include <linux/mutex.h> | |
| 18 | 20 | |
| 19 | 21 | struct cred; |
| 20 | 22 | struct dentry; |
| @@ -34,6 +36,19 @@ enum fs_context_purpose { · 13 unmodified lines | ||
| 34 | 36 | FS_CONTEXT_FOR_RECONFIGURE, /* Superblock reconfiguration (remount) */ |
| 35 | 37 | }; |
| 36 | 38 | |
| 39 | +/* | |
| 40 | + * Userspace usage phase for fsopen/fspick. | |
| 41 | + */ | |
| 42 | +enum fs_context_phase { | |
| 43 | + FS_CONTEXT_CREATE_PARAMS, /* Loading params for sb creation */ | |
| 44 | + FS_CONTEXT_CREATING, /* A superblock is being created */ | |
| 45 | + FS_CONTEXT_AWAITING_MOUNT, /* Superblock created, awaiting fsmount() */ | |
| 46 | + FS_CONTEXT_AWAITING_RECONF, /* Awaiting initialisation for reconfiguration */ | |
| 47 | + FS_CONTEXT_RECONF_PARAMS, /* Loading params for reconfiguration */ | |
| 48 | + FS_CONTEXT_RECONFIGURING, /* Reconfiguring the superblock */ | |
| 49 | + FS_CONTEXT_FAILED, /* Failed to correctly transition a context */ | |
| 50 | +}; | |
| 51 | + | |
| 37 | 52 | /* |
| 38 | 53 | * Type of parameter value. |
| 39 | 54 | */ |
| @@ -74,12 +89,14 @@ struct fs_parameter { · 34 unmodified lines | ||
| 74 | 89 | */ |
| 75 | 90 | struct fs_context { |
| 76 | 91 | const struct fs_context_operations *ops; |
| 92 | + struct mutex uapi_mutex; /* Userspace access mutex */ | |
| 77 | 93 | struct file_system_type *fs_type; |
| 78 | 94 | void *fs_private; /* The filesystem's context */ |
| 79 | 95 | struct dentry *root; /* The root and superblock */ |
| 80 | 96 | struct user_namespace *user_ns; /* The user namespace for this mount */ |
| 81 | 97 | struct net *net_ns; /* The network namespace for this mount */ |
| 82 | 98 | const struct cred *cred; /* The mounter's credentials */ |
| 99 | + struct fc_log *log; /* Logging buffer */ | |
| 83 | 100 | const char *source; /* The source name (eg. dev path) */ |
| 84 | 101 | const char *subtype; /* The subtype to set on the superblock */ |
| 85 | 102 | void *security; /* Linux S&M options */ |
| @@ -88,6 +105,7 @@ struct fs_context { · 2 unmodified lines | ||
| 88 | 105 | unsigned int sb_flags_mask; /* Superblock flags that were changed */ |
| 89 | 106 | unsigned int lsm_flags; /* Information flags from the fs to the LSM */ |
| 90 | 107 | enum fs_context_purpose purpose:8; |
| 108 | + enum fs_context_phase phase:8; /* The phase the context is in */ | |
| 91 | 109 | bool need_free:1; /* Need to call ops->free() */ |
| 92 | 110 | bool global:1; /* Goes into &init_user_ns */ |
| 93 | 111 | }; |
| @@ -135,15 +153,21 @@ extern int vfs_get_super(struct fs_context *fc, · 41 unmodified lines | ||
| 135 | 153 | |
| 136 | 154 | extern const struct file_operations fscontext_fops; |
| 137 | 155 | |
| 138 | −#ifdef CONFIG_PRINTK | |
| 156 | +/* | |
| 157 | + * Mount error, warning and informational message logging. This structure is | |
| 158 | + * shareable between a mount and a subordinate mount. | |
| 159 | + */ | |
| 160 | +struct fc_log { | |
| 161 | + refcount_t usage; | |
| 162 | + u8 head; /* Insertion index in buffer[] */ | |
| 163 | + u8 tail; /* Removal index in buffer[] */ | |
| 164 | + u8 need_free; /* Mask of kfree'able items in buffer[] */ | |
| 165 | + struct module *owner; /* Owner module for strings that don't then need freeing */ | |
| 166 | + char *buffer[8]; | |
| 167 | +}; | |
| 168 | + | |
| 139 | 169 | extern __attribute__((format(printf, 2, 3))) |
| 140 | 170 | void logfc(struct fs_context *fc, const char *fmt, ...); |
| 141 | −#else | |
| 142 | −static inline __attribute__((format(printf, 2, 3))) | |
| 143 | −void logfc(struct fs_context *fc, const char *fmt, ...) | |
| 144 | −{ | |
| 145 | −} | |
| 146 | −#endif | |
| 147 | 171 | |
| 148 | 172 | /** |
| 149 | 173 | * infof - Store supplementary informational message |
| @@ -33,6 +33,7 @@ struct fscrypt_name { · 32 unmodified lines | ||
| 33 | 33 | u32 hash; |
| 34 | 34 | u32 minor_hash; |
| 35 | 35 | struct fscrypt_str crypto_buf; |
| 36 | + bool is_ciphertext_name; | |
| 36 | 37 | }; |
| 37 | 38 | |
| 38 | 39 | #define FSTR_INIT(n, l) { .name = n, .len = l } |
| @@ -79,7 +80,8 @@ struct fscrypt_ctx { · 40 unmodified lines | ||
| 79 | 80 | |
| 80 | 81 | static inline bool fscrypt_has_encryption_key(const struct inode *inode) |
| 81 | 82 | { |
| 82 | − return (inode->i_crypt_info != NULL); | |
| 83 | + /* pairs with cmpxchg_release() in fscrypt_get_encryption_info() */ | |
| 84 | + return READ_ONCE(inode->i_crypt_info) != NULL; | |
| 83 | 85 | } |
| 84 | 86 | |
| 85 | 87 | static inline bool fscrypt_dummy_context_enabled(struct inode *inode) |
| @@ -88,9 +90,21 @@ static inline bool fscrypt_dummy_context_enabled(struct inode *inode) · 2 unmodified lines | ||
| 88 | 90 | inode->i_sb->s_cop->dummy_context(inode); |
| 89 | 91 | } |
| 90 | 92 | |
| 93 | +/* | |
| 94 | + * When d_splice_alias() moves a directory's encrypted alias to its decrypted | |
| 95 | + * alias as a result of the encryption key being added, DCACHE_ENCRYPTED_NAME | |
| 96 | + * must be cleared. Note that we don't have to support arbitrary moves of this | |
| 97 | + * flag because fscrypt doesn't allow encrypted aliases to be the source or | |
| 98 | + * target of a rename(). | |
| 99 | + */ | |
| 100 | +static inline void fscrypt_handle_d_move(struct dentry *dentry) | |
| 101 | +{ | |
| 102 | + dentry->d_flags &= ~DCACHE_ENCRYPTED_NAME; | |
| 103 | +} | |
| 104 | + | |
| 91 | 105 | /* crypto.c */ |
| 92 | 106 | extern void fscrypt_enqueue_decrypt_work(struct work_struct *); |
| 93 | −extern struct fscrypt_ctx *fscrypt_get_ctx(const struct inode *, gfp_t); | |
| 107 | +extern struct fscrypt_ctx *fscrypt_get_ctx(gfp_t); | |
| 94 | 108 | extern void fscrypt_release_ctx(struct fscrypt_ctx *); |
| 95 | 109 | extern struct page *fscrypt_encrypt_page(const struct inode *, struct page *, |
| 96 | 110 | unsigned int, unsigned int, |
| @@ -114,6 +128,7 @@ extern int fscrypt_inherit_context(struct inode *, struct inode *, · 17 unmodified lines | ||
| 114 | 128 | /* keyinfo.c */ |
| 115 | 129 | extern int fscrypt_get_encryption_info(struct inode *); |
| 116 | 130 | extern void fscrypt_put_encryption_info(struct inode *); |
| 131 | +extern void fscrypt_free_inode(struct inode *); | |
| 117 | 132 | |
| 118 | 133 | /* fname.c */ |
| 119 | 134 | extern int fscrypt_setup_filename(struct inode *, const struct qstr *, |
| @@ -214,13 +229,15 @@ extern int fscrypt_zeroout_range(const struct inode *, pgoff_t, sector_t, · 94 unmodified lines | ||
| 214 | 229 | |
| 215 | 230 | /* hooks.c */ |
| 216 | 231 | extern int fscrypt_file_open(struct inode *inode, struct file *filp); |
| 217 | −extern int __fscrypt_prepare_link(struct inode *inode, struct inode *dir); | |
| 232 | +extern int __fscrypt_prepare_link(struct inode *inode, struct inode *dir, | |
| 233 | + struct dentry *dentry); | |
| 218 | 234 | extern int __fscrypt_prepare_rename(struct inode *old_dir, |
| 219 | 235 | struct dentry *old_dentry, |
| 220 | 236 | struct inode *new_dir, |
| 221 | 237 | struct dentry *new_dentry, |
| 222 | 238 | unsigned int flags); |
| 223 | −extern int __fscrypt_prepare_lookup(struct inode *dir, struct dentry *dentry); | |
| 239 | +extern int __fscrypt_prepare_lookup(struct inode *dir, struct dentry *dentry, | |
| 240 | + struct fscrypt_name *fname); | |
| 224 | 241 | extern int __fscrypt_prepare_symlink(struct inode *dir, unsigned int len, |
| 225 | 242 | unsigned int max_len, |
| 226 | 243 | struct fscrypt_str *disk_link); |
| @@ -230,6 +247,11 @@ extern int __fscrypt_encrypt_symlink(struct inode *inode, const char *target, · 3 unmodified lines | ||
| 230 | 247 | extern const char *fscrypt_get_symlink(struct inode *inode, const void *caddr, |
| 231 | 248 | unsigned int max_size, |
| 232 | 249 | struct delayed_call *done); |
| 250 | +static inline void fscrypt_set_ops(struct super_block *sb, | |
| 251 | + const struct fscrypt_operations *s_cop) | |
| 252 | +{ | |
| 253 | + sb->s_cop = s_cop; | |
| 254 | +} | |
| 233 | 255 | #else /* !CONFIG_FS_ENCRYPTION */ |
| 234 | 256 | |
| 235 | 257 | static inline bool fscrypt_has_encryption_key(const struct inode *inode) |
| @@ -242,13 +264,16 @@ static inline bool fscrypt_dummy_context_enabled(struct inode *inode) · 6 unmodified lines | ||
| 242 | 264 | return false; |
| 243 | 265 | } |
| 244 | 266 | |
| 267 | +static inline void fscrypt_handle_d_move(struct dentry *dentry) | |
| 268 | +{ | |
| 269 | +} | |
| 270 | + | |
| 245 | 271 | /* crypto.c */ |
| 246 | 272 | static inline void fscrypt_enqueue_decrypt_work(struct work_struct *work) |
| 247 | 273 | { |
| 248 | 274 | } |
| 249 | 275 | |
| 250 | −static inline struct fscrypt_ctx *fscrypt_get_ctx(const struct inode *inode, | |
| 251 | − gfp_t gfp_flags) | |
| 276 | +static inline struct fscrypt_ctx *fscrypt_get_ctx(gfp_t gfp_flags) | |
| 252 | 277 | { |
| 253 | 278 | return ERR_PTR(-EOPNOTSUPP); |
| 254 | 279 | } |
| @@ -322,6 +347,10 @@ static inline void fscrypt_put_encryption_info(struct inode *inode) · 67 unmodified lines | ||
| 322 | 347 | return; |
| 323 | 348 | } |
| 324 | 349 | |
| 350 | +static inline void fscrypt_free_inode(struct inode *inode) | |
| 351 | +{ | |
| 352 | +} | |
| 353 | + | |
| 325 | 354 | /* fname.c */ |
| 326 | 355 | static inline int fscrypt_setup_filename(struct inode *dir, |
| 327 | 356 | const struct qstr *iname, |
| @@ -330,7 +359,7 @@ static inline int fscrypt_setup_filename(struct inode *dir, · 2 unmodified lines | ||
| 330 | 359 | if (IS_ENCRYPTED(dir)) |
| 331 | 360 | return -EOPNOTSUPP; |
| 332 | 361 | |
| 333 | − memset(fname, 0, sizeof(struct fscrypt_name)); | |
| 362 | + memset(fname, 0, sizeof(*fname)); | |
| 334 | 363 | fname->usr_fname = iname; |
| 335 | 364 | fname->disk_name.name = (unsigned char *)iname->name; |
| 336 | 365 | fname->disk_name.len = iname->len; |
| @@ -401,8 +430,8 @@ static inline int fscrypt_file_open(struct inode *inode, struct file *filp) · 64 unmodified lines | ||
| 401 | 430 | return 0; |
| 402 | 431 | } |
| 403 | 432 | |
| 404 | −static inline int __fscrypt_prepare_link(struct inode *inode, | |
| 405 | − struct inode *dir) | |
| 433 | +static inline int __fscrypt_prepare_link(struct inode *inode, struct inode *dir, | |
| 434 | + struct dentry *dentry) | |
| 406 | 435 | { |
| 407 | 436 | return -EOPNOTSUPP; |
| 408 | 437 | } |
| @@ -417,7 +446,8 @@ static inline int __fscrypt_prepare_rename(struct inode *old_dir, · 8 unmodified lines | ||
| 417 | 446 | } |
| 418 | 447 | |
| 419 | 448 | static inline int __fscrypt_prepare_lookup(struct inode *dir, |
| 420 | − struct dentry *dentry) | |
| 449 | + struct dentry *dentry, | |
| 450 | + struct fscrypt_name *fname) | |
| 421 | 451 | { |
| 422 | 452 | return -EOPNOTSUPP; |
| 423 | 453 | } |
| @@ -446,6 +476,12 @@ static inline const char *fscrypt_get_symlink(struct inode *inode, · 22 unmodified lines | ||
| 446 | 476 | { |
| 447 | 477 | return ERR_PTR(-EOPNOTSUPP); |
| 448 | 478 | } |
| 479 | + | |
| 480 | +static inline void fscrypt_set_ops(struct super_block *sb, | |
| 481 | + const struct fscrypt_operations *s_cop) | |
| 482 | +{ | |
| 483 | +} | |
| 484 | + | |
| 449 | 485 | #endif /* !CONFIG_FS_ENCRYPTION */ |
| 450 | 486 | |
| 451 | 487 | /** |
| @@ -497,7 +533,7 @@ static inline int fscrypt_prepare_link(struct dentry *old_dentry, · 45 unmodified lines | ||
| 497 | 533 | struct dentry *dentry) |
| 498 | 534 | { |
| 499 | 535 | if (IS_ENCRYPTED(dir)) |
| 500 | − return __fscrypt_prepare_link(d_inode(old_dentry), dir); | |
| 536 | + return __fscrypt_prepare_link(d_inode(old_dentry), dir, dentry); | |
| 501 | 537 | return 0; |
| 502 | 538 | } |
| 503 | 539 | |
| @@ -538,27 +574,32 @@ static inline int fscrypt_prepare_rename(struct inode *old_dir, · 34 unmodified lines | ||
| 538 | 574 | * fscrypt_prepare_lookup - prepare to lookup a name in a possibly-encrypted directory |
| 539 | 575 | * @dir: directory being searched |
| 540 | 576 | * @dentry: filename being looked up |
| 541 | − * @flags: lookup flags | |
| 577 | + * @fname: (output) the name to use to search the on-disk directory | |
| 542 | 578 | * |
| 543 | − * Prepare for ->lookup() in a directory which may be encrypted. Lookups can be | |
| 544 | − * done with or without the directory's encryption key; without the key, | |
| 579 | + * Prepare for ->lookup() in a directory which may be encrypted by determining | |
| 580 | + * the name that will actually be used to search the directory on-disk. Lookups | |
| 581 | + * can be done with or without the directory's encryption key; without the key, | |
| 545 | 582 | * filenames are presented in encrypted form. Therefore, we'll try to set up |
| 546 | 583 | * the directory's encryption key, but even without it the lookup can continue. |
| 547 | 584 | * |
| 548 | − * To allow invalidating stale dentries if the directory's encryption key is | |
| 549 | − * added later, we also install a custom ->d_revalidate() method and use the | |
| 550 | − * DCACHE_ENCRYPTED_WITH_KEY flag to indicate whether a given dentry is a | |
| 551 | − * plaintext name (flag set) or a ciphertext name (flag cleared). | |
| 585 | + * This also installs a custom ->d_revalidate() method which will invalidate the | |
| 586 | + * dentry if it was created without the key and the key is later added. | |
| 552 | 587 | * |
| 553 | − * Return: 0 on success, -errno if a problem occurred while setting up the | |
| 554 | − * encryption key | |
| 588 | + * Return: 0 on success; -ENOENT if key is unavailable but the filename isn't a | |
| 589 | + * correctly formed encoded ciphertext name, so a negative dentry should be | |
| 590 | + * created; or another -errno code. | |
| 555 | 591 | */ |
| 556 | 592 | static inline int fscrypt_prepare_lookup(struct inode *dir, |
| 557 | 593 | struct dentry *dentry, |
| 558 | − unsigned int flags) | |
| 594 | + struct fscrypt_name *fname) | |
| 559 | 595 | { |
| 560 | 596 | if (IS_ENCRYPTED(dir)) |
| 561 | − return __fscrypt_prepare_lookup(dir, dentry); | |
| 597 | + return __fscrypt_prepare_lookup(dir, dentry, fname); | |
| 598 | + | |
| 599 | + memset(fname, 0, sizeof(*fname)); | |
| 600 | + fname->usr_fname = &dentry->d_name; | |
| 601 | + fname->disk_name.name = (unsigned char *)dentry->d_name.name; | |
| 602 | + fname->disk_name.len = dentry->d_name.len; | |
| 562 | 603 | return 0; |
| 563 | 604 | } |
| 564 | 605 | |
| @@ -0,0 +1,88 @@ | ||
| 1 | +// SPDX-License-Identifier: GPL-2.0 | |
| 2 | +#ifndef __FSL_FTM_H__ | |
| 3 | +#define __FSL_FTM_H__ | |
| 4 | + | |
| 5 | +#define FTM_SC 0x0 /* Status And Control */ | |
| 6 | +#define FTM_CNT 0x4 /* Counter */ | |
| 7 | +#define FTM_MOD 0x8 /* Modulo */ | |
| 8 | + | |
| 9 | +#define FTM_CNTIN 0x4C /* Counter Initial Value */ | |
| 10 | +#define FTM_STATUS 0x50 /* Capture And Compare Status */ | |
| 11 | +#define FTM_MODE 0x54 /* Features Mode Selection */ | |
| 12 | +#define FTM_SYNC 0x58 /* Synchronization */ | |
| 13 | +#define FTM_OUTINIT 0x5C /* Initial State For Channels Output */ | |
| 14 | +#define FTM_OUTMASK 0x60 /* Output Mask */ | |
| 15 | +#define FTM_COMBINE 0x64 /* Function For Linked Channels */ | |
| 16 | +#define FTM_DEADTIME 0x68 /* Deadtime Insertion Control */ | |
| 17 | +#define FTM_EXTTRIG 0x6C /* FTM External Trigger */ | |
| 18 | +#define FTM_POL 0x70 /* Channels Polarity */ | |
| 19 | +#define FTM_FMS 0x74 /* Fault Mode Status */ | |
| 20 | +#define FTM_FILTER 0x78 /* Input Capture Filter Control */ | |
| 21 | +#define FTM_FLTCTRL 0x7C /* Fault Control */ | |
| 22 | +#define FTM_QDCTRL 0x80 /* Quadrature Decoder Control And Status */ | |
| 23 | +#define FTM_CONF 0x84 /* Configuration */ | |
| 24 | +#define FTM_FLTPOL 0x88 /* FTM Fault Input Polarity */ | |
| 25 | +#define FTM_SYNCONF 0x8C /* Synchronization Configuration */ | |
| 26 | +#define FTM_INVCTRL 0x90 /* FTM Inverting Control */ | |
| 27 | +#define FTM_SWOCTRL 0x94 /* FTM Software Output Control */ | |
| 28 | +#define FTM_PWMLOAD 0x98 /* FTM PWM Load */ | |
| 29 | + | |
| 30 | +#define FTM_SC_CLK_MASK_SHIFT 3 | |
| 31 | +#define FTM_SC_CLK_MASK (3 << FTM_SC_CLK_MASK_SHIFT) | |
| 32 | +#define FTM_SC_TOF 0x80 | |
| 33 | +#define FTM_SC_TOIE 0x40 | |
| 34 | +#define FTM_SC_CPWMS 0x20 | |
| 35 | +#define FTM_SC_CLKS 0x18 | |
| 36 | +#define FTM_SC_PS_1 0x0 | |
| 37 | +#define FTM_SC_PS_2 0x1 | |
| 38 | +#define FTM_SC_PS_4 0x2 | |
| 39 | +#define FTM_SC_PS_8 0x3 | |
| 40 | +#define FTM_SC_PS_16 0x4 | |
| 41 | +#define FTM_SC_PS_32 0x5 | |
| 42 | +#define FTM_SC_PS_64 0x6 | |
| 43 | +#define FTM_SC_PS_128 0x7 | |
| 44 | +#define FTM_SC_PS_MASK 0x7 | |
| 45 | + | |
| 46 | +#define FTM_MODE_FAULTIE 0x80 | |
| 47 | +#define FTM_MODE_FAULTM 0x60 | |
| 48 | +#define FTM_MODE_CAPTEST 0x10 | |
| 49 | +#define FTM_MODE_PWMSYNC 0x8 | |
| 50 | +#define FTM_MODE_WPDIS 0x4 | |
| 51 | +#define FTM_MODE_INIT 0x2 | |
| 52 | +#define FTM_MODE_FTMEN 0x1 | |
| 53 | + | |
| 54 | +/* NXP Errata: The PHAFLTREN and PHBFLTREN bits are tide to zero internally | |
| 55 | + * and these bits cannot be set. Flextimer cannot use Filter in | |
| 56 | + * Quadrature Decoder Mode. | |
| 57 | + * https://community.nxp.com/thread/467648#comment-1010319 | |
| 58 | + */ | |
| 59 | +#define FTM_QDCTRL_PHAFLTREN 0x80 | |
| 60 | +#define FTM_QDCTRL_PHBFLTREN 0x40 | |
| 61 | +#define FTM_QDCTRL_PHAPOL 0x20 | |
| 62 | +#define FTM_QDCTRL_PHBPOL 0x10 | |
| 63 | +#define FTM_QDCTRL_QUADMODE 0x8 | |
| 64 | +#define FTM_QDCTRL_QUADDIR 0x4 | |
| 65 | +#define FTM_QDCTRL_TOFDIR 0x2 | |
| 66 | +#define FTM_QDCTRL_QUADEN 0x1 | |
| 67 | + | |
| 68 | +#define FTM_FMS_FAULTF 0x80 | |
| 69 | +#define FTM_FMS_WPEN 0x40 | |
| 70 | +#define FTM_FMS_FAULTIN 0x10 | |
| 71 | +#define FTM_FMS_FAULTF3 0x8 | |
| 72 | +#define FTM_FMS_FAULTF2 0x4 | |
| 73 | +#define FTM_FMS_FAULTF1 0x2 | |
| 74 | +#define FTM_FMS_FAULTF0 0x1 | |
| 75 | + | |
| 76 | +#define FTM_CSC_BASE 0xC | |
| 77 | +#define FTM_CSC_MSB 0x20 | |
| 78 | +#define FTM_CSC_MSA 0x10 | |
| 79 | +#define FTM_CSC_ELSB 0x8 | |
| 80 | +#define FTM_CSC_ELSA 0x4 | |
| 81 | +#define FTM_CSC(_channel) (FTM_CSC_BASE + ((_channel) * 8)) | |
| 82 | + | |
| 83 | +#define FTM_CV_BASE 0x10 | |
| 84 | +#define FTM_CV(_channel) (FTM_CV_BASE + ((_channel) * 8)) | |
| 85 | + | |
| 86 | +#define FTM_PS_MAX 7 | |
| 87 | + | |
| 88 | +#endif | |
| @@ -27,7 +27,7 @@ static inline int fsnotify_dirent(struct inode *dir, struct dentry *dentry, · 26 unmodified lines | ||
| 27 | 27 | __u32 mask) |
| 28 | 28 | { |
| 29 | 29 | return fsnotify(dir, mask, d_inode(dentry), FSNOTIFY_EVENT_INODE, |
| 30 | − dentry->d_name.name, 0); | |
| 30 | + &dentry->d_name, 0); | |
| 31 | 31 | } |
| 32 | 32 | |
| 33 | 33 | /* Notify this dentry's parent about a child's events. */ |
| @@ -102,7 +102,7 @@ static inline void fsnotify_link_count(struct inode *inode) · 68 unmodified lines | ||
| 102 | 102 | * fsnotify_move - file old_name at old_dir was moved to new_name at new_dir |
| 103 | 103 | */ |
| 104 | 104 | static inline void fsnotify_move(struct inode *old_dir, struct inode *new_dir, |
| 105 | − const unsigned char *old_name, | |
| 105 | + const struct qstr *old_name, | |
| 106 | 106 | int isdir, struct inode *target, |
| 107 | 107 | struct dentry *moved) |
| 108 | 108 | { |
| @@ -111,7 +111,7 @@ static inline void fsnotify_move(struct inode *old_dir, struct inode *new_dir, · 2 unmodified lines | ||
| 111 | 111 | __u32 old_dir_mask = FS_MOVED_FROM; |
| 112 | 112 | __u32 new_dir_mask = FS_MOVED_TO; |
| 113 | 113 | __u32 mask = FS_MOVE_SELF; |
| 114 | − const unsigned char *new_name = moved->d_name.name; | |
| 114 | + const struct qstr *new_name = &moved->d_name; | |
| 115 | 115 | |
| 116 | 116 | if (old_dir == new_dir) |
| 117 | 117 | old_dir_mask |= FS_DN_RENAME; |
| @@ -151,39 +151,6 @@ static inline void fsnotify_vfsmount_delete(struct vfsmount *mnt) · 33 unmodified lines | ||
| 151 | 151 | __fsnotify_vfsmount_delete(mnt); |
| 152 | 152 | } |
| 153 | 153 | |
| 154 | −/* | |
| 155 | − * fsnotify_nameremove - a filename was removed from a directory | |
| 156 | − * | |
| 157 | − * This is mostly called under parent vfs inode lock so name and | |
| 158 | − * dentry->d_parent should be stable. However there are some corner cases where | |
| 159 | − * inode lock is not held. So to be on the safe side and be reselient to future | |
| 160 | − * callers and out of tree users of d_delete(), we do not assume that d_parent | |
| 161 | − * and d_name are stable and we use dget_parent() and | |
| 162 | − * take_dentry_name_snapshot() to grab stable references. | |
| 163 | − */ | |
| 164 | −static inline void fsnotify_nameremove(struct dentry *dentry, int isdir) | |
| 165 | −{ | |
| 166 | − struct dentry *parent; | |
| 167 | − struct name_snapshot name; | |
| 168 | − __u32 mask = FS_DELETE; | |
| 169 | − | |
| 170 | − /* d_delete() of pseudo inode? (e.g. __ns_get_path() playing tricks) */ | |
| 171 | − if (IS_ROOT(dentry)) | |
| 172 | − return; | |
| 173 | − | |
| 174 | − if (isdir) | |
| 175 | − mask |= FS_ISDIR; | |
| 176 | − | |
| 177 | − parent = dget_parent(dentry); | |
| 178 | − take_dentry_name_snapshot(&name, dentry); | |
| 179 | − | |
| 180 | − fsnotify(d_inode(parent), mask, d_inode(dentry), FSNOTIFY_EVENT_INODE, | |
| 181 | − name.name, 0); | |
| 182 | − | |
| 183 | − release_dentry_name_snapshot(&name); | |
| 184 | − dput(parent); | |
| 185 | −} | |
| 186 | − | |
| 187 | 154 | /* |
| 188 | 155 | * fsnotify_inoderemove - an inode is going away |
| 189 | 156 | */ |
| @@ -218,7 +185,7 @@ static inline void fsnotify_link(struct inode *dir, struct inode *inode, struct · 28 unmodified lines | ||
| 218 | 185 | fsnotify_link_count(inode); |
| 219 | 186 | audit_inode_child(dir, new_dentry, AUDIT_TYPE_CHILD_CREATE); |
| 220 | 187 | |
| 221 | − fsnotify(dir, FS_CREATE, inode, FSNOTIFY_EVENT_INODE, new_dentry->d_name.name, 0); | |
| 188 | + fsnotify(dir, FS_CREATE, inode, FSNOTIFY_EVENT_INODE, &new_dentry->d_name, 0); | |
| 222 | 189 | } |
| 223 | 190 | |
| 224 | 191 | /* |
| @@ -117,7 +117,7 @@ struct fsnotify_ops { · 116 unmodified lines | ||
| 117 | 117 | int (*handle_event)(struct fsnotify_group *group, |
| 118 | 118 | struct inode *inode, |
| 119 | 119 | u32 mask, const void *data, int data_type, |
| 120 | − const unsigned char *file_name, u32 cookie, | |
| 120 | + const struct qstr *file_name, u32 cookie, | |
| 121 | 121 | struct fsnotify_iter_info *iter_info); |
| 122 | 122 | void (*free_group_priv)(struct fsnotify_group *group); |
| 123 | 123 | void (*freeing_mark)(struct fsnotify_mark *mark, struct fsnotify_group *group); |
| @@ -350,11 +350,12 @@ struct fsnotify_mark { · 226 unmodified lines | ||
| 350 | 350 | |
| 351 | 351 | /* main fsnotify call to send events */ |
| 352 | 352 | extern int fsnotify(struct inode *to_tell, __u32 mask, const void *data, int data_is, |
| 353 | − const unsigned char *name, u32 cookie); | |
| 353 | + const struct qstr *name, u32 cookie); | |
| 354 | 354 | extern int __fsnotify_parent(const struct path *path, struct dentry *dentry, __u32 mask); |
| 355 | 355 | extern void __fsnotify_inode_delete(struct inode *inode); |
| 356 | 356 | extern void __fsnotify_vfsmount_delete(struct vfsmount *mnt); |
| 357 | 357 | extern void fsnotify_sb_delete(struct super_block *sb); |
| 358 | +extern void fsnotify_nameremove(struct dentry *dentry, int isdir); | |
| 358 | 359 | extern u32 fsnotify_get_cookie(void); |
| 359 | 360 | |
| 360 | 361 | static inline int fsnotify_inode_watches_children(struct inode *inode) |
| @@ -505,7 +506,7 @@ static inline void fsnotify_init_event(struct fsnotify_event *event, · 144 unmodified lines | ||
| 505 | 506 | #else |
| 506 | 507 | |
| 507 | 508 | static inline int fsnotify(struct inode *to_tell, __u32 mask, const void *data, int data_is, |
| 508 | − const unsigned char *name, u32 cookie) | |
| 509 | + const struct qstr *name, u32 cookie) | |
| 509 | 510 | { |
| 510 | 511 | return 0; |
| 511 | 512 | } |
| @@ -524,6 +525,9 @@ static inline void __fsnotify_vfsmount_delete(struct vfsmount *mnt) · 12 unmodified lines | ||
| 524 | 525 | static inline void fsnotify_sb_delete(struct super_block *sb) |
| 525 | 526 | {} |
| 526 | 527 | |
| 528 | +static inline void fsnotify_nameremove(struct dentry *dentry, int isdir) | |
| 529 | +{} | |
| 530 | + | |
| 527 | 531 | static inline void fsnotify_update_flags(struct dentry *dentry) |
| 528 | 532 | {} |
| 529 | 533 | |
| @@ -241,21 +241,11 @@ static inline void ftrace_free_mem(struct module *mod, void *start, void *end) { · 240 unmodified lines | ||
| 241 | 241 | |
| 242 | 242 | #ifdef CONFIG_STACK_TRACER |
| 243 | 243 | |
| 244 | −#define STACK_TRACE_ENTRIES 500 | |
| 245 | − | |
| 246 | −struct stack_trace; | |
| 247 | − | |
| 248 | −extern unsigned stack_trace_index[]; | |
| 249 | −extern struct stack_trace stack_trace_max; | |
| 250 | −extern unsigned long stack_trace_max_size; | |
| 251 | −extern arch_spinlock_t stack_trace_max_lock; | |
| 252 | − | |
| 253 | 244 | extern int stack_tracer_enabled; |
| 254 | −void stack_trace_print(void); | |
| 255 | −int | |
| 256 | −stack_trace_sysctl(struct ctl_table *table, int write, | |
| 257 | − void __user *buffer, size_t *lenp, | |
| 258 | − loff_t *ppos); | |
| 245 | + | |
| 246 | +int stack_trace_sysctl(struct ctl_table *table, int write, | |
| 247 | + void __user *buffer, size_t *lenp, | |
| 248 | + loff_t *ppos); | |
| 259 | 249 | |
| 260 | 250 | /* DO NOT MODIFY THIS VARIABLE DIRECTLY! */ |
| 261 | 251 | DECLARE_PER_CPU(int, disable_stack_tracer); |
| @@ -751,6 +741,8 @@ struct ftrace_graph_ret { · 489 unmodified lines | ||
| 751 | 741 | typedef void (*trace_func_graph_ret_t)(struct ftrace_graph_ret *); /* return */ |
| 752 | 742 | typedef int (*trace_func_graph_ent_t)(struct ftrace_graph_ent *); /* entry */ |
| 753 | 743 | |
| 744 | +extern int ftrace_graph_entry_stub(struct ftrace_graph_ent *trace); | |
| 745 | + | |
| 754 | 746 | #ifdef CONFIG_FUNCTION_GRAPH_TRACER |
| 755 | 747 | |
| 756 | 748 | struct fgraph_ops { |
| @@ -150,6 +150,13 @@ enum { · 149 unmodified lines | ||
| 150 | 150 | DISK_EVENT_EJECT_REQUEST = 1 << 1, /* eject requested */ |
| 151 | 151 | }; |
| 152 | 152 | |
| 153 | +enum { | |
| 154 | + /* Poll even if events_poll_msecs is unset */ | |
| 155 | + DISK_EVENT_FLAG_POLL = 1 << 0, | |
| 156 | + /* Forward events to udev */ | |
| 157 | + DISK_EVENT_FLAG_UEVENT = 1 << 1, | |
| 158 | +}; | |
| 159 | + | |
| 153 | 160 | struct disk_part_tbl { |
| 154 | 161 | struct rcu_head rcu_head; |
| 155 | 162 | int len; |
| @@ -184,8 +191,8 @@ struct gendisk { · 28 unmodified lines | ||
| 184 | 191 | char disk_name[DISK_NAME_LEN]; /* name of major driver */ |
| 185 | 192 | char *(*devnode)(struct gendisk *gd, umode_t *mode); |
| 186 | 193 | |
| 187 | − unsigned int events; /* supported events */ | |
| 188 | − unsigned int async_events; /* async events, subset of all */ | |
| 194 | + unsigned short events; /* supported events */ | |
| 195 | + unsigned short event_flags; /* flags related to event processing */ | |
| 189 | 196 | |
| 190 | 197 | /* Array of pointers to partitions indexed by partno. |
| 191 | 198 | * Protected with matching bdev lock but stat and other |
| @@ -610,6 +617,7 @@ struct unixware_disklabel { · 418 unmodified lines | ||
| 610 | 617 | |
| 611 | 618 | extern int blk_alloc_devt(struct hd_struct *part, dev_t *devt); |
| 612 | 619 | extern void blk_free_devt(dev_t devt); |
| 620 | +extern void blk_invalidate_devt(dev_t devt); | |
| 613 | 621 | extern dev_t blk_lookup_devt(const char *name, int partno); |
| 614 | 622 | extern char *disk_name (struct gendisk *hd, int partno, char *buf); |
| 615 | 623 | |
| @@ -714,7 +722,7 @@ static inline void hd_free_part(struct hd_struct *part) · 98 unmodified lines | ||
| 714 | 722 | */ |
| 715 | 723 | static inline sector_t part_nr_sects_read(struct hd_struct *part) |
| 716 | 724 | { |
| 717 | −#if BITS_PER_LONG==32 && defined(CONFIG_LBDAF) && defined(CONFIG_SMP) | |
| 725 | +#if BITS_PER_LONG==32 && defined(CONFIG_SMP) | |
| 718 | 726 | sector_t nr_sects; |
| 719 | 727 | unsigned seq; |
| 720 | 728 | do { |
| @@ -722,7 +730,7 @@ static inline sector_t part_nr_sects_read(struct hd_struct *part) · 1 unmodified line | ||
| 722 | 730 | nr_sects = part->nr_sects; |
| 723 | 731 | } while (read_seqcount_retry(&part->nr_sects_seq, seq)); |
| 724 | 732 | return nr_sects; |
| 725 | −#elif BITS_PER_LONG==32 && defined(CONFIG_LBDAF) && defined(CONFIG_PREEMPT) | |
| 733 | +#elif BITS_PER_LONG==32 && defined(CONFIG_PREEMPT) | |
| 726 | 734 | sector_t nr_sects; |
| 727 | 735 | |
| 728 | 736 | preempt_disable(); |
| @@ -741,11 +749,11 @@ static inline sector_t part_nr_sects_read(struct hd_struct *part) · 12 unmodified lines | ||
| 741 | 749 | */ |
| 742 | 750 | static inline void part_nr_sects_write(struct hd_struct *part, sector_t size) |
| 743 | 751 | { |
| 744 | −#if BITS_PER_LONG==32 && defined(CONFIG_LBDAF) && defined(CONFIG_SMP) | |
| 752 | +#if BITS_PER_LONG==32 && defined(CONFIG_SMP) | |
| 745 | 753 | write_seqcount_begin(&part->nr_sects_seq); |
| 746 | 754 | part->nr_sects = size; |
| 747 | 755 | write_seqcount_end(&part->nr_sects_seq); |
| 748 | −#elif BITS_PER_LONG==32 && defined(CONFIG_LBDAF) && defined(CONFIG_PREEMPT) | |
| 756 | +#elif BITS_PER_LONG==32 && defined(CONFIG_PREEMPT) | |
| 749 | 757 | preempt_disable(); |
| 750 | 758 | part->nr_sects = size; |
| 751 | 759 | preempt_enable(); |
| @@ -233,7 +233,6 @@ const char *CONCAT_(GENL_MAGIC_FAMILY, _genl_cmd_to_str)(__u8 cmd) · 232 unmodified lines | ||
| 233 | 233 | { \ |
| 234 | 234 | handler \ |
| 235 | 235 | .cmd = op_name, \ |
| 236 | − .policy = CONCAT_(GENL_MAGIC_FAMILY, _tla_nl_policy), \ | |
| 237 | 236 | }, |
| 238 | 237 | |
| 239 | 238 | #define ZZZ_genl_ops CONCAT_(GENL_MAGIC_FAMILY, _genl_ops) |
| @@ -290,7 +289,8 @@ static struct genl_family ZZZ_genl_family __ro_after_init = { · 50 unmodified lines | ||
| 290 | 289 | #ifdef GENL_MAGIC_FAMILY_HDRSZ |
| 291 | 290 | .hdrsize = NLA_ALIGN(GENL_MAGIC_FAMILY_HDRSZ), |
| 292 | 291 | #endif |
| 293 | − .maxattr = ARRAY_SIZE(drbd_tla_nl_policy)-1, | |
| 292 | + .maxattr = ARRAY_SIZE(CONCAT_(GENL_MAGIC_FAMILY, _tla_nl_policy))-1, | |
| 293 | + .policy = CONCAT_(GENL_MAGIC_FAMILY, _tla_nl_policy), | |
| 294 | 294 | .ops = ZZZ_genl_ops, |
| 295 | 295 | .n_ops = ARRAY_SIZE(ZZZ_genl_ops), |
| 296 | 296 | .mcgrps = ZZZ_genl_mcgrps, |
| @@ -585,12 +585,12 @@ static inline bool pm_suspended_storage(void) · 584 unmodified lines | ||
| 585 | 585 | } |
| 586 | 586 | #endif /* CONFIG_PM_SLEEP */ |
| 587 | 587 | |
| 588 | −#if (defined(CONFIG_MEMORY_ISOLATION) && defined(CONFIG_COMPACTION)) || defined(CONFIG_CMA) | |
| 588 | +#ifdef CONFIG_CONTIG_ALLOC | |
| 589 | 589 | /* The below functions must be run on a range from a single zone. */ |
| 590 | 590 | extern int alloc_contig_range(unsigned long start, unsigned long end, |
| 591 | 591 | unsigned migratetype, gfp_t gfp_mask); |
| 592 | −extern void free_contig_range(unsigned long pfn, unsigned nr_pages); | |
| 593 | 592 | #endif |
| 593 | +void free_contig_range(unsigned long pfn, unsigned int nr_pages); | |
| 594 | 594 | |
| 595 | 595 | #ifdef CONFIG_CMA |
| 596 | 596 | /* CMA stuff */ |
| @@ -227,9 +227,10 @@ struct gpio_irq_chip { · 226 unmodified lines | ||
| 227 | 227 | * @reg_dat: data (in) register for generic GPIO |
| 228 | 228 | * @reg_set: output set register (out=high) for generic GPIO |
| 229 | 229 | * @reg_clr: output clear register (out=low) for generic GPIO |
| 230 | − * @reg_dir: direction setting register for generic GPIO | |
| 231 | − * @bgpio_dir_inverted: indicates that the direction register is inverted | |
| 232 | − * (gpiolib private state variable) | |
| 230 | + * @reg_dir_out: direction out setting register for generic GPIO | |
| 231 | + * @reg_dir_in: direction in setting register for generic GPIO | |
| 232 | + * @bgpio_dir_unreadable: indicates that the direction register(s) cannot | |
| 233 | + * be read and we need to rely on out internal state tracking. | |
| 233 | 234 | * @bgpio_bits: number of register bits used for a generic GPIO i.e. |
| 234 | 235 | * <register width> * 8 |
| 235 | 236 | * @bgpio_lock: used to lock chip->bgpio_data. Also, this is needed to keep |
| @@ -237,7 +238,8 @@ struct gpio_irq_chip { · 1 unmodified line | ||
| 237 | 238 | * @bgpio_data: shadowed data register for generic GPIO to clear/set bits |
| 238 | 239 | * safely. |
| 239 | 240 | * @bgpio_dir: shadowed direction register for generic GPIO to clear/set |
| 240 | − * direction safely. | |
| 241 | + * direction safely. A "1" in this word means the line is set as | |
| 242 | + * output. | |
| 241 | 243 | * |
| 242 | 244 | * A gpio_chip can help platforms abstract various sources of GPIOs so |
| 243 | 245 | * they can all be accessed through a common programing interface. |
| @@ -298,8 +300,9 @@ struct gpio_chip { · 54 unmodified lines | ||
| 298 | 300 | void __iomem *reg_dat; |
| 299 | 301 | void __iomem *reg_set; |
| 300 | 302 | void __iomem *reg_clr; |
| 301 | − void __iomem *reg_dir; | |
| 302 | − bool bgpio_dir_inverted; | |
| 303 | + void __iomem *reg_dir_out; | |
| 304 | + void __iomem *reg_dir_in; | |
| 305 | + bool bgpio_dir_unreadable; | |
| 303 | 306 | int bgpio_bits; |
| 304 | 307 | spinlock_t bgpio_lock; |
| 305 | 308 | unsigned long bgpio_data; |
| @@ -614,6 +617,9 @@ struct gpio_desc *gpiochip_request_own_desc(struct gpio_chip *chip, u16 hwnum, · 308 unmodified lines | ||
| 614 | 617 | enum gpiod_flags flags); |
| 615 | 618 | void gpiochip_free_own_desc(struct gpio_desc *desc); |
| 616 | 619 | |
| 620 | +void devprop_gpiochip_set_names(struct gpio_chip *chip, | |
| 621 | + const struct fwnode_handle *fwnode); | |
| 622 | + | |
| 617 | 623 | #else /* CONFIG_GPIOLIB */ |
| 618 | 624 | |
| 619 | 625 | static inline struct gpio_chip *gpiod_to_chip(const struct gpio_desc *desc) |
| @@ -6,14 +6,16 @@ · 5 unmodified lines | ||
| 6 | 6 | #include <linux/list.h> |
| 7 | 7 | |
| 8 | 8 | enum gpio_lookup_flags { |
| 9 | − GPIO_ACTIVE_HIGH = (0 << 0), | |
| 10 | − GPIO_ACTIVE_LOW = (1 << 0), | |
| 11 | − GPIO_OPEN_DRAIN = (1 << 1), | |
| 12 | − GPIO_OPEN_SOURCE = (1 << 2), | |
| 13 | − GPIO_PERSISTENT = (0 << 3), | |
| 14 | − GPIO_TRANSITORY = (1 << 3), | |
| 15 | − GPIO_PULL_UP = (1 << 4), | |
| 16 | − GPIO_PULL_DOWN = (1 << 5), | |
| 9 | + GPIO_ACTIVE_HIGH = (0 << 0), | |
| 10 | + GPIO_ACTIVE_LOW = (1 << 0), | |
| 11 | + GPIO_OPEN_DRAIN = (1 << 1), | |
| 12 | + GPIO_OPEN_SOURCE = (1 << 2), | |
| 13 | + GPIO_PERSISTENT = (0 << 3), | |
| 14 | + GPIO_TRANSITORY = (1 << 3), | |
| 15 | + GPIO_PULL_UP = (1 << 4), | |
| 16 | + GPIO_PULL_DOWN = (1 << 5), | |
| 17 | + | |
| 18 | + GPIO_LOOKUP_FLAGS_DEFAULT = GPIO_ACTIVE_HIGH | GPIO_PERSISTENT, | |
| 17 | 19 | }; |
| 18 | 20 | |
| 19 | 21 | /** |
| @@ -22,7 +24,7 @@ enum gpio_lookup_flags { · 2 unmodified lines | ||
| 22 | 24 | * @chip_hwnum: hardware number (i.e. relative to the chip) of the GPIO |
| 23 | 25 | * @con_id: name of the GPIO from the device's point of view |
| 24 | 26 | * @idx: index of the GPIO in case several GPIOs share the same name |
| 25 | − * @flags: mask of GPIO_* values | |
| 27 | + * @flags: bitmask of gpio_lookup_flags GPIO_* values | |
| 26 | 28 | * |
| 27 | 29 | * gpiod_lookup is a lookup table for associating GPIOs to specific devices and |
| 28 | 30 | * functions using platform data. |
| @@ -32,7 +34,7 @@ struct gpiod_lookup { · 3 unmodified lines | ||
| 32 | 34 | u16 chip_hwnum; |
| 33 | 35 | const char *con_id; |
| 34 | 36 | unsigned int idx; |
| 35 | − enum gpio_lookup_flags flags; | |
| 37 | + unsigned long flags; | |
| 36 | 38 | }; |
| 37 | 39 | |
| 38 | 40 | struct gpiod_lookup_table { |
| @@ -46,7 +48,7 @@ struct gpiod_lookup_table { · 7 unmodified lines | ||
| 46 | 48 | * @chip_label: name of the chip the GPIO belongs to |
| 47 | 49 | * @chip_hwnum: hardware number (i.e. relative to the chip) of the GPIO |
| 48 | 50 | * @line_name: consumer name for the hogged line |
| 49 | − * @lflags: mask of GPIO lookup flags | |
| 51 | + * @lflags: bitmask of gpio_lookup_flags GPIO_* values | |
| 50 | 52 | * @dflags: GPIO flags used to specify the direction and value |
| 51 | 53 | */ |
| 52 | 54 | struct gpiod_hog { |
| @@ -54,7 +56,7 @@ struct gpiod_hog { · 1 unmodified line | ||
| 54 | 56 | const char *chip_label; |
| 55 | 57 | u16 chip_hwnum; |
| 56 | 58 | const char *line_name; |
| 57 | − enum gpio_lookup_flags lflags; | |
| 59 | + unsigned long lflags; | |
| 58 | 60 | int dflags; |
| 59 | 61 | }; |
| 60 | 62 | |
| @@ -382,6 +382,7 @@ struct hid_item { · 381 unmodified lines | ||
| 382 | 382 | #define HID_GROUP_WACOM 0x0101 |
| 383 | 383 | #define HID_GROUP_LOGITECH_DJ_DEVICE 0x0102 |
| 384 | 384 | #define HID_GROUP_STEAM 0x0103 |
| 385 | +#define HID_GROUP_LOGITECH_27MHZ_DEVICE 0x0104 | |
| 385 | 386 | |
| 386 | 387 | /* |
| 387 | 388 | * HID protocol status |
| @@ -417,6 +418,7 @@ struct hid_global { · 29 unmodified lines | ||
| 417 | 418 | |
| 418 | 419 | struct hid_local { |
| 419 | 420 | unsigned usage[HID_MAX_USAGES]; /* usage array */ |
| 421 | + u8 usage_size[HID_MAX_USAGES]; /* usage size array */ | |
| 420 | 422 | unsigned collection_index[HID_MAX_USAGES]; /* collection index array */ |
| 421 | 423 | unsigned usage_index; |
| 422 | 424 | unsigned usage_minimum; |
| @@ -893,7 +895,7 @@ struct hid_field *hidinput_get_led_field(struct hid_device *hid); · 470 unmodified lines | ||
| 893 | 895 | unsigned int hidinput_count_leds(struct hid_device *hid); |
| 894 | 896 | __s32 hidinput_calc_abs_res(const struct hid_field *field, __u16 code); |
| 895 | 897 | void hid_output_report(struct hid_report *report, __u8 *data); |
| 896 | −void __hid_request(struct hid_device *hid, struct hid_report *rep, int reqtype); | |
| 898 | +int __hid_request(struct hid_device *hid, struct hid_report *rep, int reqtype); | |
| 897 | 899 | u8 *hid_alloc_report_buf(struct hid_report *report, gfp_t flags); |
| 898 | 900 | struct hid_device *hid_allocate_device(void); |
| 899 | 901 | struct hid_report *hid_register_report(struct hid_device *device, |
| @@ -77,8 +77,34 @@ · 76 unmodified lines | ||
| 77 | 77 | #include <linux/migrate.h> |
| 78 | 78 | #include <linux/memremap.h> |
| 79 | 79 | #include <linux/completion.h> |
| 80 | +#include <linux/mmu_notifier.h> | |
| 80 | 81 | |
| 81 | −struct hmm; | |
| 82 | + | |
| 83 | +/* | |
| 84 | + * struct hmm - HMM per mm struct | |
| 85 | + * | |
| 86 | + * @mm: mm struct this HMM struct is bound to | |
| 87 | + * @lock: lock protecting ranges list | |
| 88 | + * @ranges: list of range being snapshotted | |
| 89 | + * @mirrors: list of mirrors for this mm | |
| 90 | + * @mmu_notifier: mmu notifier to track updates to CPU page table | |
| 91 | + * @mirrors_sem: read/write semaphore protecting the mirrors list | |
| 92 | + * @wq: wait queue for user waiting on a range invalidation | |
| 93 | + * @notifiers: count of active mmu notifiers | |
| 94 | + * @dead: is the mm dead ? | |
| 95 | + */ | |
| 96 | +struct hmm { | |
| 97 | + struct mm_struct *mm; | |
| 98 | + struct kref kref; | |
| 99 | + struct mutex lock; | |
| 100 | + struct list_head ranges; | |
| 101 | + struct list_head mirrors; | |
| 102 | + struct mmu_notifier mmu_notifier; | |
| 103 | + struct rw_semaphore mirrors_sem; | |
| 104 | + wait_queue_head_t wq; | |
| 105 | + long notifiers; | |
| 106 | + bool dead; | |
| 107 | +}; | |
| 82 | 108 | |
| 83 | 109 | /* |
| 84 | 110 | * hmm_pfn_flag_e - HMM flag enums |
| @@ -131,6 +157,7 @@ enum hmm_pfn_value_e { · 46 unmodified lines | ||
| 131 | 157 | /* |
| 132 | 158 | * struct hmm_range - track invalidation lock on virtual address range |
| 133 | 159 | * |
| 160 | + * @hmm: the core HMM structure this range is active against | |
| 134 | 161 | * @vma: the vm area struct for the range |
| 135 | 162 | * @list: all range lock are on a list |
| 136 | 163 | * @start: range virtual start address (inclusive) |
| @@ -138,10 +165,13 @@ enum hmm_pfn_value_e { · 1 unmodified line | ||
| 138 | 165 | * @pfns: array of pfns (big enough for the range) |
| 139 | 166 | * @flags: pfn flags to match device driver page table |
| 140 | 167 | * @values: pfn value for some special case (none, special, error, ...) |
| 168 | + * @default_flags: default flags for the range (write, read, ... see hmm doc) | |
| 169 | + * @pfn_flags_mask: allows to mask pfn flags so that only default_flags matter | |
| 141 | 170 | * @pfn_shifts: pfn shift value (should be <= PAGE_SHIFT) |
| 142 | 171 | * @valid: pfns array did not change since it has been fill by an HMM function |
| 143 | 172 | */ |
| 144 | 173 | struct hmm_range { |
| 174 | + struct hmm *hmm; | |
| 145 | 175 | struct vm_area_struct *vma; |
| 146 | 176 | struct list_head list; |
| 147 | 177 | unsigned long start; |
| @@ -149,41 +179,96 @@ struct hmm_range { · 1 unmodified line | ||
| 149 | 179 | uint64_t *pfns; |
| 150 | 180 | const uint64_t *flags; |
| 151 | 181 | const uint64_t *values; |
| 182 | + uint64_t default_flags; | |
| 183 | + uint64_t pfn_flags_mask; | |
| 184 | + uint8_t page_shift; | |
| 152 | 185 | uint8_t pfn_shift; |
| 153 | 186 | bool valid; |
| 154 | 187 | }; |
| 155 | 188 | |
| 156 | 189 | /* |
| 157 | − * hmm_pfn_to_page() - return struct page pointed to by a valid HMM pfn | |
| 158 | − * @range: range use to decode HMM pfn value | |
| 159 | − * @pfn: HMM pfn value to get corresponding struct page from | |
| 160 | − * Returns: struct page pointer if pfn is a valid HMM pfn, NULL otherwise | |
| 190 | + * hmm_range_page_shift() - return the page shift for the range | |
| 191 | + * @range: range being queried | |
| 192 | + * Returns: page shift (page size = 1 << page shift) for the range | |
| 193 | + */ | |
| 194 | +static inline unsigned hmm_range_page_shift(const struct hmm_range *range) | |
| 195 | +{ | |
| 196 | + return range->page_shift; | |
| 197 | +} | |
| 198 | + | |
| 199 | +/* | |
| 200 | + * hmm_range_page_size() - return the page size for the range | |
| 201 | + * @range: range being queried | |
| 202 | + * Returns: page size for the range in bytes | |
| 203 | + */ | |
| 204 | +static inline unsigned long hmm_range_page_size(const struct hmm_range *range) | |
| 205 | +{ | |
| 206 | + return 1UL << hmm_range_page_shift(range); | |
| 207 | +} | |
| 208 | + | |
| 209 | +/* | |
| 210 | + * hmm_range_wait_until_valid() - wait for range to be valid | |
| 211 | + * @range: range affected by invalidation to wait on | |
| 212 | + * @timeout: time out for wait in ms (ie abort wait after that period of time) | |
| 213 | + * Returns: true if the range is valid, false otherwise. | |
| 214 | + */ | |
| 215 | +static inline bool hmm_range_wait_until_valid(struct hmm_range *range, | |
| 216 | + unsigned long timeout) | |
| 217 | +{ | |
| 218 | + /* Check if mm is dead ? */ | |
| 219 | + if (range->hmm == NULL || range->hmm->dead || range->hmm->mm == NULL) { | |
| 220 | + range->valid = false; | |
| 221 | + return false; | |
| 222 | + } | |
| 223 | + if (range->valid) | |
| 224 | + return true; | |
| 225 | + wait_event_timeout(range->hmm->wq, range->valid || range->hmm->dead, | |
| 226 | + msecs_to_jiffies(timeout)); | |
| 227 | + /* Return current valid status just in case we get lucky */ | |
| 228 | + return range->valid; | |
| 229 | +} | |
| 230 | + | |
| 231 | +/* | |
| 232 | + * hmm_range_valid() - test if a range is valid or not | |
| 233 | + * @range: range | |
| 234 | + * Returns: true if the range is valid, false otherwise. | |
| 235 | + */ | |
| 236 | +static inline bool hmm_range_valid(struct hmm_range *range) | |
| 237 | +{ | |
| 238 | + return range->valid; | |
| 239 | +} | |
| 240 | + | |
| 241 | +/* | |
| 242 | + * hmm_device_entry_to_page() - return struct page pointed to by a device entry | |
| 243 | + * @range: range use to decode device entry value | |
| 244 | + * @entry: device entry value to get corresponding struct page from | |
| 245 | + * Returns: struct page pointer if entry is a valid, NULL otherwise | |
| 161 | 246 | * |
| 162 | − * If the HMM pfn is valid (ie valid flag set) then return the struct page | |
| 163 | − * matching the pfn value stored in the HMM pfn. Otherwise return NULL. | |
| 247 | + * If the device entry is valid (ie valid flag set) then return the struct page | |
| 248 | + * matching the entry value. Otherwise return NULL. | |
| 164 | 249 | */ |
| 165 | −static inline struct page *hmm_pfn_to_page(const struct hmm_range *range, | |
| 166 | − uint64_t pfn) | |
| 250 | +static inline struct page *hmm_device_entry_to_page(const struct hmm_range *range, | |
| 251 | + uint64_t entry) | |
| 167 | 252 | { |
| 168 | − if (pfn == range->values[HMM_PFN_NONE]) | |
| 253 | + if (entry == range->values[HMM_PFN_NONE]) | |
| 169 | 254 | return NULL; |
| 170 | − if (pfn == range->values[HMM_PFN_ERROR]) | |
| 255 | + if (entry == range->values[HMM_PFN_ERROR]) | |
| 171 | 256 | return NULL; |
| 172 | − if (pfn == range->values[HMM_PFN_SPECIAL]) | |
| 257 | + if (entry == range->values[HMM_PFN_SPECIAL]) | |
| 173 | 258 | return NULL; |
| 174 | − if (!(pfn & range->flags[HMM_PFN_VALID])) | |
| 259 | + if (!(entry & range->flags[HMM_PFN_VALID])) | |
| 175 | 260 | return NULL; |
| 176 | − return pfn_to_page(pfn >> range->pfn_shift); | |
| 261 | + return pfn_to_page(entry >> range->pfn_shift); | |
| 177 | 262 | } |
| 178 | 263 | |
| 179 | 264 | /* |
| 180 | − * hmm_pfn_to_pfn() - return pfn value store in a HMM pfn | |
| 181 | − * @range: range use to decode HMM pfn value | |
| 182 | − * @pfn: HMM pfn value to extract pfn from | |
| 183 | − * Returns: pfn value if HMM pfn is valid, -1UL otherwise | |
| 265 | + * hmm_device_entry_to_pfn() - return pfn value store in a device entry | |
| 266 | + * @range: range use to decode device entry value | |
| 267 | + * @entry: device entry to extract pfn from | |
| 268 | + * Returns: pfn value if device entry is valid, -1UL otherwise | |
| 184 | 269 | */ |
| 185 | −static inline unsigned long hmm_pfn_to_pfn(const struct hmm_range *range, | |
| 186 | − uint64_t pfn) | |
| 270 | +static inline unsigned long | |
| 271 | +hmm_device_entry_to_pfn(const struct hmm_range *range, uint64_t pfn) | |
| 187 | 272 | { |
| 188 | 273 | if (pfn == range->values[HMM_PFN_NONE]) |
| 189 | 274 | return -1UL; |
| @@ -197,31 +282,66 @@ static inline unsigned long hmm_pfn_to_pfn(const struct hmm_range *range, · 7 unmodified lines | ||
| 197 | 282 | } |
| 198 | 283 | |
| 199 | 284 | /* |
| 200 | − * hmm_pfn_from_page() - create a valid HMM pfn value from struct page | |
| 285 | + * hmm_device_entry_from_page() - create a valid device entry for a page | |
| 201 | 286 | * @range: range use to encode HMM pfn value |
| 202 | − * @page: struct page pointer for which to create the HMM pfn | |
| 203 | − * Returns: valid HMM pfn for the page | |
| 287 | + * @page: page for which to create the device entry | |
| 288 | + * Returns: valid device entry for the page | |
| 204 | 289 | */ |
| 205 | −static inline uint64_t hmm_pfn_from_page(const struct hmm_range *range, | |
| 206 | − struct page *page) | |
| 290 | +static inline uint64_t hmm_device_entry_from_page(const struct hmm_range *range, | |
| 291 | + struct page *page) | |
| 207 | 292 | { |
| 208 | 293 | return (page_to_pfn(page) << range->pfn_shift) | |
| 209 | 294 | range->flags[HMM_PFN_VALID]; |
| 210 | 295 | } |
| 211 | 296 | |
| 212 | 297 | /* |
| 213 | − * hmm_pfn_from_pfn() - create a valid HMM pfn value from pfn | |
| 298 | + * hmm_device_entry_from_pfn() - create a valid device entry value from pfn | |
| 214 | 299 | * @range: range use to encode HMM pfn value |
| 215 | − * @pfn: pfn value for which to create the HMM pfn | |
| 216 | − * Returns: valid HMM pfn for the pfn | |
| 300 | + * @pfn: pfn value for which to create the device entry | |
| 301 | + * Returns: valid device entry for the pfn | |
| 217 | 302 | */ |
| 218 | −static inline uint64_t hmm_pfn_from_pfn(const struct hmm_range *range, | |
| 219 | − unsigned long pfn) | |
| 303 | +static inline uint64_t hmm_device_entry_from_pfn(const struct hmm_range *range, | |
| 304 | + unsigned long pfn) | |
| 220 | 305 | { |
| 221 | 306 | return (pfn << range->pfn_shift) | |
| 222 | 307 | range->flags[HMM_PFN_VALID]; |
| 223 | 308 | } |
| 224 | 309 | |
| 310 | +/* | |
| 311 | + * Old API: | |
| 312 | + * hmm_pfn_to_page() | |
| 313 | + * hmm_pfn_to_pfn() | |
| 314 | + * hmm_pfn_from_page() | |
| 315 | + * hmm_pfn_from_pfn() | |
| 316 | + * | |
| 317 | + * This are the OLD API please use new API, it is here to avoid cross-tree | |
| 318 | + * merge painfullness ie we convert things to new API in stages. | |
| 319 | + */ | |
| 320 | +static inline struct page *hmm_pfn_to_page(const struct hmm_range *range, | |
| 321 | + uint64_t pfn) | |
| 322 | +{ | |
| 323 | + return hmm_device_entry_to_page(range, pfn); | |
| 324 | +} | |
| 325 | + | |
| 326 | +static inline unsigned long hmm_pfn_to_pfn(const struct hmm_range *range, | |
| 327 | + uint64_t pfn) | |
| 328 | +{ | |
| 329 | + return hmm_device_entry_to_pfn(range, pfn); | |
| 330 | +} | |
| 331 | + | |
| 332 | +static inline uint64_t hmm_pfn_from_page(const struct hmm_range *range, | |
| 333 | + struct page *page) | |
| 334 | +{ | |
| 335 | + return hmm_device_entry_from_page(range, page); | |
| 336 | +} | |
| 337 | + | |
| 338 | +static inline uint64_t hmm_pfn_from_pfn(const struct hmm_range *range, | |
| 339 | + unsigned long pfn) | |
| 340 | +{ | |
| 341 | + return hmm_device_entry_from_pfn(range, pfn); | |
| 342 | +} | |
| 343 | + | |
| 344 | + | |
| 225 | 345 | |
| 226 | 346 | #if IS_ENABLED(CONFIG_HMM_MIRROR) |
| 227 | 347 | /* |
| @@ -353,43 +473,113 @@ struct hmm_mirror { · 125 unmodified lines | ||
| 353 | 473 | int hmm_mirror_register(struct hmm_mirror *mirror, struct mm_struct *mm); |
| 354 | 474 | void hmm_mirror_unregister(struct hmm_mirror *mirror); |
| 355 | 475 | |
| 356 | − | |
| 357 | 476 | /* |
| 358 | − * To snapshot the CPU page table, call hmm_vma_get_pfns(), then take a device | |
| 359 | − * driver lock that serializes device page table updates, then call | |
| 360 | − * hmm_vma_range_done(), to check if the snapshot is still valid. The same | |
| 361 | − * device driver page table update lock must also be used in the | |
| 362 | − * hmm_mirror_ops.sync_cpu_device_pagetables() callback, so that CPU page | |
| 363 | − * table invalidation serializes on it. | |
| 364 | − * | |
| 365 | − * YOU MUST CALL hmm_vma_range_done() ONCE AND ONLY ONCE EACH TIME YOU CALL | |
| 366 | − * hmm_vma_get_pfns() WITHOUT ERROR ! | |
| 367 | − * | |
| 368 | − * IF YOU DO NOT FOLLOW THE ABOVE RULE THE SNAPSHOT CONTENT MIGHT BE INVALID ! | |
| 477 | + * hmm_mirror_mm_is_alive() - test if mm is still alive | |
| 478 | + * @mirror: the HMM mm mirror for which we want to lock the mmap_sem | |
| 479 | + * Returns: false if the mm is dead, true otherwise | |
| 480 | + * | |
| 481 | + * This is an optimization it will not accurately always return -EINVAL if the | |
| 482 | + * mm is dead ie there can be false negative (process is being kill but HMM is | |
| 483 | + * not yet inform of that). It is only intented to be use to optimize out case | |
| 484 | + * where driver is about to do something time consuming and it would be better | |
| 485 | + * to skip it if the mm is dead. | |
| 369 | 486 | */ |
| 370 | −int hmm_vma_get_pfns(struct hmm_range *range); | |
| 371 | −bool hmm_vma_range_done(struct hmm_range *range); | |
| 487 | +static inline bool hmm_mirror_mm_is_alive(struct hmm_mirror *mirror) | |
| 488 | +{ | |
| 489 | + struct mm_struct *mm; | |
| 490 | + | |
| 491 | + if (!mirror || !mirror->hmm) | |
| 492 | + return false; | |
| 493 | + mm = READ_ONCE(mirror->hmm->mm); | |
| 494 | + if (mirror->hmm->dead || !mm) | |
| 495 | + return false; | |
| 496 | + | |
| 497 | + return true; | |
| 498 | +} | |
| 372 | 499 | |
| 373 | 500 | |
| 374 | 501 | /* |
| 375 | − * Fault memory on behalf of device driver. Unlike handle_mm_fault(), this will | |
| 376 | − * not migrate any device memory back to system memory. The HMM pfn array will | |
| 377 | − * be updated with the fault result and current snapshot of the CPU page table | |
| 378 | − * for the range. | |
| 379 | − * | |
| 380 | − * The mmap_sem must be taken in read mode before entering and it might be | |
| 381 | − * dropped by the function if the block argument is false. In that case, the | |
| 382 | − * function returns -EAGAIN. | |
| 383 | − * | |
| 384 | − * Return value does not reflect if the fault was successful for every single | |
| 385 | − * address or not. Therefore, the caller must to inspect the HMM pfn array to | |
| 386 | − * determine fault status for each address. | |
| 387 | − * | |
| 388 | − * Trying to fault inside an invalid vma will result in -EINVAL. | |
| 502 | + * Please see Documentation/vm/hmm.rst for how to use the range API. | |
| 503 | + */ | |
| 504 | +int hmm_range_register(struct hmm_range *range, | |
| 505 | + struct mm_struct *mm, | |
| 506 | + unsigned long start, | |
| 507 | + unsigned long end, | |
| 508 | + unsigned page_shift); | |
| 509 | +void hmm_range_unregister(struct hmm_range *range); | |
| 510 | +long hmm_range_snapshot(struct hmm_range *range); | |
| 511 | +long hmm_range_fault(struct hmm_range *range, bool block); | |
| 512 | +long hmm_range_dma_map(struct hmm_range *range, | |
| 513 | + struct device *device, | |
| 514 | + dma_addr_t *daddrs, | |
| 515 | + bool block); | |
| 516 | +long hmm_range_dma_unmap(struct hmm_range *range, | |
| 517 | + struct vm_area_struct *vma, | |
| 518 | + struct device *device, | |
| 519 | + dma_addr_t *daddrs, | |
| 520 | + bool dirty); | |
| 521 | + | |
| 522 | +/* | |
| 523 | + * HMM_RANGE_DEFAULT_TIMEOUT - default timeout (ms) when waiting for a range | |
| 389 | 524 | * |
| 390 | − * See the function description in mm/hmm.c for further documentation. | |
| 525 | + * When waiting for mmu notifiers we need some kind of time out otherwise we | |
| 526 | + * could potentialy wait for ever, 1000ms ie 1s sounds like a long time to | |
| 527 | + * wait already. | |
| 391 | 528 | */ |
| 392 | −int hmm_vma_fault(struct hmm_range *range, bool block); | |
| 529 | +#define HMM_RANGE_DEFAULT_TIMEOUT 1000 | |
| 530 | + | |
| 531 | +/* This is a temporary helper to avoid merge conflict between trees. */ | |
| 532 | +static inline bool hmm_vma_range_done(struct hmm_range *range) | |
| 533 | +{ | |
| 534 | + bool ret = hmm_range_valid(range); | |
| 535 | + | |
| 536 | + hmm_range_unregister(range); | |
| 537 | + return ret; | |
| 538 | +} | |
| 539 | + | |
| 540 | +/* This is a temporary helper to avoid merge conflict between trees. */ | |
| 541 | +static inline int hmm_vma_fault(struct hmm_range *range, bool block) | |
| 542 | +{ | |
| 543 | + long ret; | |
| 544 | + | |
| 545 | + /* | |
| 546 | + * With the old API the driver must set each individual entries with | |
| 547 | + * the requested flags (valid, write, ...). So here we set the mask to | |
| 548 | + * keep intact the entries provided by the driver and zero out the | |
| 549 | + * default_flags. | |
| 550 | + */ | |
| 551 | + range->default_flags = 0; | |
| 552 | + range->pfn_flags_mask = -1UL; | |
| 553 | + | |
| 554 | + ret = hmm_range_register(range, range->vma->vm_mm, | |
| 555 | + range->start, range->end, | |
| 556 | + PAGE_SHIFT); | |
| 557 | + if (ret) | |
| 558 | + return (int)ret; | |
| 559 | + | |
| 560 | + if (!hmm_range_wait_until_valid(range, HMM_RANGE_DEFAULT_TIMEOUT)) { | |
| 561 | + /* | |
| 562 | + * The mmap_sem was taken by driver we release it here and | |
| 563 | + * returns -EAGAIN which correspond to mmap_sem have been | |
| 564 | + * drop in the old API. | |
| 565 | + */ | |
| 566 | + up_read(&range->vma->vm_mm->mmap_sem); | |
| 567 | + return -EAGAIN; | |
| 568 | + } | |
| 569 | + | |
| 570 | + ret = hmm_range_fault(range, block); | |
| 571 | + if (ret <= 0) { | |
| 572 | + if (ret == -EBUSY || !ret) { | |
| 573 | + /* Same as above drop mmap_sem to match old API. */ | |
| 574 | + up_read(&range->vma->vm_mm->mmap_sem); | |
| 575 | + ret = -EBUSY; | |
| 576 | + } else if (ret == -EAGAIN) | |
| 577 | + ret = -EBUSY; | |
| 578 | + hmm_range_unregister(range); | |
| 579 | + return ret; | |
| 580 | + } | |
| 581 | + return 0; | |
| 582 | +} | |
| 393 | 583 | |
| 394 | 584 | /* Below are for HMM internal use only! Not to be used by device driver! */ |
| 395 | 585 | void hmm_mm_destroy(struct mm_struct *mm); |
| @@ -47,10 +47,8 @@ extern bool move_huge_pmd(struct vm_area_struct *vma, unsigned long old_addr, · 46 unmodified lines | ||
| 47 | 47 | extern int change_huge_pmd(struct vm_area_struct *vma, pmd_t *pmd, |
| 48 | 48 | unsigned long addr, pgprot_t newprot, |
| 49 | 49 | int prot_numa); |
| 50 | −vm_fault_t vmf_insert_pfn_pmd(struct vm_area_struct *vma, unsigned long addr, | |
| 51 | − pmd_t *pmd, pfn_t pfn, bool write); | |
| 52 | −vm_fault_t vmf_insert_pfn_pud(struct vm_area_struct *vma, unsigned long addr, | |
| 53 | − pud_t *pud, pfn_t pfn, bool write); | |
| 50 | +vm_fault_t vmf_insert_pfn_pmd(struct vm_fault *vmf, pfn_t pfn, bool write); | |
| 51 | +vm_fault_t vmf_insert_pfn_pud(struct vm_fault *vmf, pfn_t pfn, bool write); | |
| 54 | 52 | enum transparent_hugepage_flag { |
| 55 | 53 | TRANSPARENT_HUGEPAGE_FLAG, |
| 56 | 54 | TRANSPARENT_HUGEPAGE_REQ_MADV_FLAG, |
| @@ -123,9 +123,7 @@ void move_hugetlb_state(struct page *oldpage, struct page *newpage, int reason); · 122 unmodified lines | ||
| 123 | 123 | void free_huge_page(struct page *page); |
| 124 | 124 | void hugetlb_fix_reserve_counts(struct inode *inode); |
| 125 | 125 | extern struct mutex *hugetlb_fault_mutex_table; |
| 126 | −u32 hugetlb_fault_mutex_hash(struct hstate *h, struct mm_struct *mm, | |
| 127 | − struct vm_area_struct *vma, | |
| 128 | − struct address_space *mapping, | |
| 126 | +u32 hugetlb_fault_mutex_hash(struct hstate *h, struct address_space *mapping, | |
| 129 | 127 | pgoff_t idx, unsigned long address); |
| 130 | 128 | |
| 131 | 129 | pte_t *huge_pmd_share(struct mm_struct *mm, unsigned long addr, pud_t *pud); |
| @@ -40,6 +40,11 @@ enum hwmon_chip_attributes { · 39 unmodified lines | ||
| 40 | 40 | hwmon_chip_register_tz, |
| 41 | 41 | hwmon_chip_update_interval, |
| 42 | 42 | hwmon_chip_alarms, |
| 43 | + hwmon_chip_samples, | |
| 44 | + hwmon_chip_curr_samples, | |
| 45 | + hwmon_chip_in_samples, | |
| 46 | + hwmon_chip_power_samples, | |
| 47 | + hwmon_chip_temp_samples, | |
| 43 | 48 | }; |
| 44 | 49 | |
| 45 | 50 | #define HWMON_C_TEMP_RESET_HISTORY BIT(hwmon_chip_temp_reset_history) |
| @@ -49,6 +54,11 @@ enum hwmon_chip_attributes { · 3 unmodified lines | ||
| 49 | 54 | #define HWMON_C_REGISTER_TZ BIT(hwmon_chip_register_tz) |
| 50 | 55 | #define HWMON_C_UPDATE_INTERVAL BIT(hwmon_chip_update_interval) |
| 51 | 56 | #define HWMON_C_ALARMS BIT(hwmon_chip_alarms) |
| 57 | +#define HWMON_C_SAMPLES BIT(hwmon_chip_samples) | |
| 58 | +#define HWMON_C_CURR_SAMPLES BIT(hwmon_chip_curr_samples) | |
| 59 | +#define HWMON_C_IN_SAMPLES BIT(hwmon_chip_in_samples) | |
| 60 | +#define HWMON_C_POWER_SAMPLES BIT(hwmon_chip_power_samples) | |
| 61 | +#define HWMON_C_TEMP_SAMPLES BIT(hwmon_chip_temp_samples) | |
| 52 | 62 | |
| 53 | 63 | enum hwmon_temp_attributes { |
| 54 | 64 | hwmon_temp_input = 0, |
| @@ -365,6 +375,14 @@ struct hwmon_channel_info { · 310 unmodified lines | ||
| 365 | 375 | const u32 *config; |
| 366 | 376 | }; |
| 367 | 377 | |
| 378 | +#define HWMON_CHANNEL_INFO(stype, ...) \ | |
| 379 | + (&(struct hwmon_channel_info) { \ | |
| 380 | + .type = hwmon_##stype, \ | |
| 381 | + .config = (u32 []) { \ | |
| 382 | + __VA_ARGS__, 0 \ | |
| 383 | + } \ | |
| 384 | + }) | |
| 385 | + | |
| 368 | 386 | /** |
| 369 | 387 | * Chip configuration |
| 370 | 388 | * @ops: Pointer to hwmon operations. |
| @@ -141,6 +141,11 @@ struct hv_ring_buffer_info { · 140 unmodified lines | ||
| 141 | 141 | |
| 142 | 142 | u32 ring_datasize; /* < ring_size */ |
| 143 | 143 | u32 priv_read_index; |
| 144 | + /* | |
| 145 | + * The ring buffer mutex lock. This lock prevents the ring buffer from | |
| 146 | + * being freed while the ring buffer is being accessed. | |
| 147 | + */ | |
| 148 | + struct mutex ring_buffer_mutex; | |
| 144 | 149 | }; |
| 145 | 150 | |
| 146 | 151 | |
| @@ -1206,7 +1211,7 @@ struct hv_ring_buffer_debug_info { · 1059 unmodified lines | ||
| 1206 | 1211 | }; |
| 1207 | 1212 | |
| 1208 | 1213 | |
| 1209 | −int hv_ringbuffer_get_debuginfo(const struct hv_ring_buffer_info *ring_info, | |
| 1214 | +int hv_ringbuffer_get_debuginfo(struct hv_ring_buffer_info *ring_info, | |
| 1210 | 1215 | struct hv_ring_buffer_debug_info *debug_info); |
| 1211 | 1216 | |
| 1212 | 1217 | /* Vmbus interface */ |
| @@ -33,6 +33,7 @@ struct i2c_algo_bit_data { · 32 unmodified lines | ||
| 33 | 33 | minimum 5 us for standard-mode I2C and SMBus, |
| 34 | 34 | maximum 50 us for SMBus */ |
| 35 | 35 | int timeout; /* in jiffies */ |
| 36 | + bool can_do_atomic; /* callbacks don't sleep, we can be atomic */ | |
| 36 | 37 | }; |
| 37 | 38 | |
| 38 | 39 | int i2c_bit_add_bus(struct i2c_adapter *); |
| @@ -469,6 +469,9 @@ extern int i2c_probe_func_quick_read(struct i2c_adapter *, unsigned short addr); · 468 unmodified lines | ||
| 469 | 469 | extern struct i2c_client * |
| 470 | 470 | i2c_new_dummy(struct i2c_adapter *adap, u16 address); |
| 471 | 471 | |
| 472 | +extern struct i2c_client * | |
| 473 | +devm_i2c_new_dummy_device(struct device *dev, struct i2c_adapter *adap, u16 address); | |
| 474 | + | |
| 472 | 475 | extern struct i2c_client * |
| 473 | 476 | i2c_new_secondary_device(struct i2c_client *client, |
| 474 | 477 | const char *name, |
| @@ -499,9 +502,13 @@ i2c_register_board_info(int busnum, struct i2c_board_info const *info, · 24 unmodified lines | ||
| 499 | 502 | * @master_xfer: Issue a set of i2c transactions to the given I2C adapter |
| 500 | 503 | * defined by the msgs array, with num messages available to transfer via |
| 501 | 504 | * the adapter specified by adap. |
| 505 | + * @master_xfer_atomic: same as @master_xfer. Yet, only using atomic context | |
| 506 | + * so e.g. PMICs can be accessed very late before shutdown. Optional. | |
| 502 | 507 | * @smbus_xfer: Issue smbus transactions to the given I2C adapter. If this |
| 503 | 508 | * is not present, then the bus layer will try and convert the SMBus calls |
| 504 | 509 | * into I2C transfers instead. |
| 510 | + * @smbus_xfer_atomic: same as @smbus_xfer. Yet, only using atomic context | |
| 511 | + * so e.g. PMICs can be accessed very late before shutdown. Optional. | |
| 505 | 512 | * @functionality: Return the flags that this algorithm/adapter pair supports |
| 506 | 513 | * from the I2C_FUNC_* flags. |
| 507 | 514 | * @reg_slave: Register given client to I2C slave mode of this adapter |
| @@ -512,25 +519,33 @@ i2c_register_board_info(int busnum, struct i2c_board_info const *info, · 4 unmodified lines | ||
| 512 | 519 | * be addressed using the same bus algorithms - i.e. bit-banging or the PCF8584 |
| 513 | 520 | * to name two of the most common. |
| 514 | 521 | * |
| 515 | − * The return codes from the @master_xfer field should indicate the type of | |
| 516 | − * error code that occurred during the transfer, as documented in the kernel | |
| 517 | − * Documentation file Documentation/i2c/fault-codes. | |
| 522 | + * The return codes from the @master_xfer{_atomic} fields should indicate the | |
| 523 | + * type of error code that occurred during the transfer, as documented in the | |
| 524 | + * Kernel Documentation file Documentation/i2c/fault-codes. | |
| 518 | 525 | */ |
| 519 | 526 | struct i2c_algorithm { |
| 520 | − /* If an adapter algorithm can't do I2C-level access, set master_xfer | |
| 521 | − to NULL. If an adapter algorithm can do SMBus access, set | |
| 522 | − smbus_xfer. If set to NULL, the SMBus protocol is simulated | |
| 523 | − using common I2C messages */ | |
| 524 | − /* master_xfer should return the number of messages successfully | |
| 525 | − processed, or a negative value on error */ | |
| 527 | + /* | |
| 528 | + * If an adapter algorithm can't do I2C-level access, set master_xfer | |
| 529 | + * to NULL. If an adapter algorithm can do SMBus access, set | |
| 530 | + * smbus_xfer. If set to NULL, the SMBus protocol is simulated | |
| 531 | + * using common I2C messages. | |
| 532 | + * | |
| 533 | + * master_xfer should return the number of messages successfully | |
| 534 | + * processed, or a negative value on error | |
| 535 | + */ | |
| 526 | 536 | int (*master_xfer)(struct i2c_adapter *adap, struct i2c_msg *msgs, |
| 527 | 537 | int num); |
| 528 | − int (*smbus_xfer) (struct i2c_adapter *adap, u16 addr, | |
| 529 | − unsigned short flags, char read_write, | |
| 530 | − u8 command, int size, union i2c_smbus_data *data); | |
| 538 | + int (*master_xfer_atomic)(struct i2c_adapter *adap, | |
| 539 | + struct i2c_msg *msgs, int num); | |
| 540 | + int (*smbus_xfer)(struct i2c_adapter *adap, u16 addr, | |
| 541 | + unsigned short flags, char read_write, | |
| 542 | + u8 command, int size, union i2c_smbus_data *data); | |
| 543 | + int (*smbus_xfer_atomic)(struct i2c_adapter *adap, u16 addr, | |
| 544 | + unsigned short flags, char read_write, | |
| 545 | + u8 command, int size, union i2c_smbus_data *data); | |
| 531 | 546 | |
| 532 | 547 | /* To determine what the adapter supports */ |
| 533 | − u32 (*functionality) (struct i2c_adapter *); | |
| 548 | + u32 (*functionality)(struct i2c_adapter *adap); | |
| 534 | 549 | |
| 535 | 550 | #if IS_ENABLED(CONFIG_I2C_SLAVE) |
| 536 | 551 | int (*reg_slave)(struct i2c_client *client); |
| @@ -682,7 +697,8 @@ struct i2c_adapter { · 145 unmodified lines | ||
| 682 | 697 | int retries; |
| 683 | 698 | struct device dev; /* the adapter device */ |
| 684 | 699 | unsigned long locked_flags; /* owned by the I2C core */ |
| 685 | −#define I2C_ALF_IS_SUSPENDED 0 | |
| 700 | +#define I2C_ALF_IS_SUSPENDED 0 | |
| 701 | +#define I2C_ALF_SUSPEND_REPORTED 1 | |
| 686 | 702 | |
| 687 | 703 | int nr; |
| 688 | 704 | char name[48]; |
| @@ -1557,7 +1557,7 @@ struct ieee80211_vht_operation { · 1556 unmodified lines | ||
| 1557 | 1557 | * struct ieee80211_he_cap_elem - HE capabilities element |
| 1558 | 1558 | * |
| 1559 | 1559 | * This structure is the "HE capabilities element" fixed fields as |
| 1560 | − * described in P802.11ax_D3.0 section 9.4.2.237.2 and 9.4.2.237.3 | |
| 1560 | + * described in P802.11ax_D4.0 section 9.4.2.242.2 and 9.4.2.242.3 | |
| 1561 | 1561 | */ |
| 1562 | 1562 | struct ieee80211_he_cap_elem { |
| 1563 | 1563 | u8 mac_cap_info[6]; |
| @@ -1619,12 +1619,12 @@ struct ieee80211_he_mcs_nss_supp { · 55 unmodified lines | ||
| 1619 | 1619 | * struct ieee80211_he_operation - HE capabilities element |
| 1620 | 1620 | * |
| 1621 | 1621 | * This structure is the "HE operation element" fields as |
| 1622 | − * described in P802.11ax_D3.0 section 9.4.2.238 | |
| 1622 | + * described in P802.11ax_D4.0 section 9.4.2.243 | |
| 1623 | 1623 | */ |
| 1624 | 1624 | struct ieee80211_he_operation { |
| 1625 | 1625 | __le32 he_oper_params; |
| 1626 | 1626 | __le16 he_mcs_nss_set; |
| 1627 | − /* Optional 0,1,3 or 4 bytes: depends on @he_oper_params */ | |
| 1627 | + /* Optional 0,1,3,4,5,7 or 8 bytes: depends on @he_oper_params */ | |
| 1628 | 1628 | u8 optional[0]; |
| 1629 | 1629 | } __packed; |
| 1630 | 1630 | |
| @@ -1632,7 +1632,7 @@ struct ieee80211_he_operation { · 1 unmodified line | ||
| 1632 | 1632 | * struct ieee80211_he_mu_edca_param_ac_rec - MU AC Parameter Record field |
| 1633 | 1633 | * |
| 1634 | 1634 | * This structure is the "MU AC Parameter Record" fields as |
| 1635 | − * described in P802.11ax_D2.0 section 9.4.2.240 | |
| 1635 | + * described in P802.11ax_D4.0 section 9.4.2.245 | |
| 1636 | 1636 | */ |
| 1637 | 1637 | struct ieee80211_he_mu_edca_param_ac_rec { |
| 1638 | 1638 | u8 aifsn; |
| @@ -1644,7 +1644,7 @@ struct ieee80211_he_mu_edca_param_ac_rec { · 5 unmodified lines | ||
| 1644 | 1644 | * struct ieee80211_mu_edca_param_set - MU EDCA Parameter Set element |
| 1645 | 1645 | * |
| 1646 | 1646 | * This structure is the "MU EDCA Parameter Set element" fields as |
| 1647 | − * described in P802.11ax_D2.0 section 9.4.2.240 | |
| 1647 | + * described in P802.11ax_D4.0 section 9.4.2.245 | |
| 1648 | 1648 | */ |
| 1649 | 1649 | struct ieee80211_mu_edca_param_set { |
| 1650 | 1650 | u8 mu_qos_info; |
| @@ -2026,6 +2026,7 @@ ieee80211_he_ppe_size(u8 ppe_thres_hdr, const u8 *phy_cap_info) · 375 unmodified lines | ||
| 2026 | 2026 | #define IEEE80211_HE_OPERATION_VHT_OPER_INFO 0x00004000 |
| 2027 | 2027 | #define IEEE80211_HE_OPERATION_CO_HOSTED_BSS 0x00008000 |
| 2028 | 2028 | #define IEEE80211_HE_OPERATION_ER_SU_DISABLE 0x00010000 |
| 2029 | +#define IEEE80211_HE_OPERATION_6GHZ_OP_INFO 0x00020000 | |
| 2029 | 2030 | #define IEEE80211_HE_OPERATION_BSS_COLOR_MASK 0x3f000000 |
| 2030 | 2031 | #define IEEE80211_HE_OPERATION_BSS_COLOR_OFFSET 24 |
| 2031 | 2032 | #define IEEE80211_HE_OPERATION_PARTIAL_BSS_COLOR 0x40000000 |
| @@ -2056,6 +2057,8 @@ ieee80211_he_oper_size(const u8 *he_oper_ie) · 24 unmodified lines | ||
| 2056 | 2057 | oper_len += 3; |
| 2057 | 2058 | if (he_oper_params & IEEE80211_HE_OPERATION_CO_HOSTED_BSS) |
| 2058 | 2059 | oper_len++; |
| 2060 | + if (he_oper_params & IEEE80211_HE_OPERATION_6GHZ_OP_INFO) | |
| 2061 | + oper_len += 4; | |
| 2059 | 2062 | |
| 2060 | 2063 | /* Add the first byte (extension ID) to the total length */ |
| 2061 | 2064 | oper_len++; |
| @@ -2487,6 +2490,7 @@ enum ieee80211_eid_ext { · 425 unmodified lines | ||
| 2487 | 2490 | WLAN_EID_EXT_HE_MU_EDCA = 38, |
| 2488 | 2491 | WLAN_EID_EXT_MAX_CHANNEL_SWITCH_TIME = 52, |
| 2489 | 2492 | WLAN_EID_EXT_MULTIPLE_BSSID_CONFIGURATION = 55, |
| 2493 | + WLAN_EID_EXT_NON_INHERITANCE = 56, | |
| 2490 | 2494 | }; |
| 2491 | 2495 | |
| 2492 | 2496 | /* Action category code */ |
| @@ -56,9 +56,6 @@ struct br_ip_list { · 55 unmodified lines | ||
| 56 | 56 | |
| 57 | 57 | extern void brioctl_set(int (*ioctl_hook)(struct net *, unsigned int, void __user *)); |
| 58 | 58 | |
| 59 | −typedef int br_should_route_hook_t(struct sk_buff *skb); | |
| 60 | −extern br_should_route_hook_t __rcu *br_should_route_hook; | |
| 61 | − | |
| 62 | 59 | #if IS_ENABLED(CONFIG_BRIDGE) && IS_ENABLED(CONFIG_BRIDGE_IGMP_SNOOPING) |
| 63 | 60 | int br_multicast_list_adjacent(struct net_device *dev, |
| 64 | 61 | struct list_head *br_ip_list); |
| @@ -69,6 +69,7 @@ struct ad_sigma_delta { · 68 unmodified lines | ||
| 69 | 69 | bool irq_dis; |
| 70 | 70 | |
| 71 | 71 | bool bus_locked; |
| 72 | + bool keep_cs_asserted; | |
| 72 | 73 | |
| 73 | 74 | uint8_t comm; |
| 74 | 75 | |
| @@ -290,6 +290,20 @@ int iio_read_max_channel_raw(struct iio_channel *chan, int *val); · 289 unmodified lines | ||
| 290 | 290 | int iio_read_avail_channel_raw(struct iio_channel *chan, |
| 291 | 291 | const int **vals, int *length); |
| 292 | 292 | |
| 293 | +/** | |
| 294 | + * iio_read_avail_channel_attribute() - read available channel attribute values | |
| 295 | + * @chan: The channel being queried. | |
| 296 | + * @vals: Available values read back. | |
| 297 | + * @type: Type of values read back. | |
| 298 | + * @length: Number of entries in vals. | |
| 299 | + * @attribute: info attribute to be read back. | |
| 300 | + * | |
| 301 | + * Returns an error code, IIO_AVAIL_RANGE or IIO_AVAIL_LIST. | |
| 302 | + */ | |
| 303 | +int iio_read_avail_channel_attribute(struct iio_channel *chan, | |
| 304 | + const int **vals, int *type, int *length, | |
| 305 | + enum iio_chan_info_enum attribute); | |
| 306 | + | |
| 293 | 307 | /** |
| 294 | 308 | * iio_get_channel_type() - get the type of a channel |
| 295 | 309 | * @channel: The channel being queried. |
| @@ -11,6 +11,7 @@ · 10 unmodified lines | ||
| 11 | 11 | #ifndef _IIO_INKERN_H_ |
| 12 | 12 | #define _IIO_INKERN_H_ |
| 13 | 13 | |
| 14 | +struct iio_dev; | |
| 14 | 15 | struct iio_map; |
| 15 | 16 | |
| 16 | 17 | /** |
| @@ -129,8 +129,8 @@ enum cpole1_capacitor { · 128 unmodified lines | ||
| 129 | 129 | * @pll2_ndiv_b_cnt: PLL2 Feedback N-divider, B Counter, range 0..63. |
| 130 | 130 | * @pll2_freq_doubler_en: PLL2 frequency doubler enable. |
| 131 | 131 | * @pll2_r2_div: PLL2 R2 divider, range 0..31. |
| 132 | − * @pll2_vco_diff_m1: VCO1 divider, range 3..5. | |
| 133 | − * @pll2_vco_diff_m2: VCO2 divider, range 3..5. | |
| 132 | + * @pll2_vco_div_m1: VCO1 divider, range 3..5. | |
| 133 | + * @pll2_vco_div_m2: VCO2 divider, range 3..5. | |
| 134 | 134 | * @rpole2: PLL2 loop filter Rpole resistor value. |
| 135 | 135 | * @rzero: PLL2 loop filter Rzero resistor value. |
| 136 | 136 | * @cpole1: PLL2 loop filter Cpole capacitor value. |
| @@ -176,8 +176,8 @@ struct ad9523_platform_data { · 39 unmodified lines | ||
| 176 | 176 | unsigned char pll2_ndiv_b_cnt; |
| 177 | 177 | bool pll2_freq_doubler_en; |
| 178 | 178 | unsigned char pll2_r2_div; |
| 179 | − unsigned char pll2_vco_diff_m1; /* 3..5 */ | |
| 180 | − unsigned char pll2_vco_diff_m2; /* 3..5 */ | |
| 179 | + unsigned char pll2_vco_div_m1; /* 3..5 */ | |
| 180 | + unsigned char pll2_vco_div_m2; /* 3..5 */ | |
| 181 | 181 | |
| 182 | 182 | /* Loop Filter PLL2 */ |
| 183 | 183 | enum rpole2_resistor rpole2; |
| @@ -104,6 +104,7 @@ · 103 unmodified lines | ||
| 104 | 104 | struct itg3200 { |
| 105 | 105 | struct i2c_client *i2c; |
| 106 | 106 | struct iio_trigger *trig; |
| 107 | + struct iio_mount_matrix orientation; | |
| 107 | 108 | }; |
| 108 | 109 | |
| 109 | 110 | enum ITG3200_SCAN_INDEX { |
| @@ -130,8 +130,8 @@ struct iio_mount_matrix { · 129 unmodified lines | ||
| 130 | 130 | |
| 131 | 131 | ssize_t iio_show_mount_matrix(struct iio_dev *indio_dev, uintptr_t priv, |
| 132 | 132 | const struct iio_chan_spec *chan, char *buf); |
| 133 | −int of_iio_read_mount_matrix(const struct device *dev, const char *propname, | |
| 134 | − struct iio_mount_matrix *matrix); | |
| 133 | +int iio_read_mount_matrix(struct device *dev, const char *propname, | |
| 134 | + struct iio_mount_matrix *matrix); | |
| 135 | 135 | |
| 136 | 136 | typedef const struct iio_mount_matrix * |
| 137 | 137 | (iio_get_mount_matrix_t)(const struct iio_dev *indio_dev, |
| @@ -21,6 +21,7 @@ · 20 unmodified lines | ||
| 21 | 21 | #define ADIS_REG_PAGE_ID 0x00 |
| 22 | 22 | |
| 23 | 23 | struct adis; |
| 24 | +struct adis_burst; | |
| 24 | 25 | |
| 25 | 26 | /** |
| 26 | 27 | * struct adis_data - ADIS chip variant specific data |
| @@ -57,6 +58,7 @@ struct adis { · 30 unmodified lines | ||
| 57 | 58 | struct iio_trigger *trig; |
| 58 | 59 | |
| 59 | 60 | const struct adis_data *data; |
| 61 | + struct adis_burst *burst; | |
| 60 | 62 | |
| 61 | 63 | struct mutex txrx_lock; |
| 62 | 64 | struct spi_message msg; |
| @@ -232,6 +234,18 @@ int adis_single_conversion(struct iio_dev *indio_dev, · 169 unmodified lines | ||
| 232 | 234 | |
| 233 | 235 | #ifdef CONFIG_IIO_ADIS_LIB_BUFFER |
| 234 | 236 | |
| 237 | +/** | |
| 238 | + * struct adis_burst - ADIS data for burst transfers | |
| 239 | + * @en burst mode enabled | |
| 240 | + * @reg_cmd register command that triggers burst | |
| 241 | + * @extra_len extra length to account in the SPI RX buffer | |
| 242 | + */ | |
| 243 | +struct adis_burst { | |
| 244 | + bool en; | |
| 245 | + unsigned int reg_cmd; | |
| 246 | + unsigned int extra_len; | |
| 247 | +}; | |
| 248 | + | |
| 235 | 249 | int adis_setup_buffer_and_trigger(struct adis *adis, |
| 236 | 250 | struct iio_dev *indio_dev, irqreturn_t (*trigger_handler)(int, void *)); |
| 237 | 251 | void adis_cleanup_buffer_and_trigger(struct adis *adis, |
| @@ -73,6 +73,15 @@ · 72 unmodified lines | ||
| 73 | 73 | |
| 74 | 74 | #define TIM17_OC1 "tim17_oc1" |
| 75 | 75 | |
| 76 | +#if IS_REACHABLE(CONFIG_IIO_STM32_TIMER_TRIGGER) | |
| 76 | 77 | bool is_stm32_timer_trigger(struct iio_trigger *trig); |
| 77 | − | |
| 78 | +#else | |
| 79 | +static inline bool is_stm32_timer_trigger(struct iio_trigger *trig) | |
| 80 | +{ | |
| 81 | +#if IS_ENABLED(CONFIG_IIO_STM32_TIMER_TRIGGER) | |
| 82 | + pr_warn_once("stm32-timer-trigger not linked in\n"); | |
| 83 | +#endif | |
| 84 | + return false; | |
| 85 | +} | |
| 86 | +#endif | |
| 78 | 87 | #endif |
| @@ -31,7 +31,7 @@ extern void ima_post_path_mknod(struct dentry *dentry); · 30 unmodified lines | ||
| 31 | 31 | extern void ima_add_kexec_buffer(struct kimage *image); |
| 32 | 32 | #endif |
| 33 | 33 | |
| 34 | −#if defined(CONFIG_X86) && defined(CONFIG_EFI) | |
| 34 | +#if (defined(CONFIG_X86) && defined(CONFIG_EFI)) || defined(CONFIG_S390) | |
| 35 | 35 | extern bool arch_ima_get_secureboot(void); |
| 36 | 36 | extern const char * const *arch_get_ima_policy(void); |
| 37 | 37 | #else |
| @@ -237,6 +237,20 @@ static inline struct in_device *__in_dev_get_rtnl(const struct net_device *dev) · 236 unmodified lines | ||
| 237 | 237 | return rtnl_dereference(dev->ip_ptr); |
| 238 | 238 | } |
| 239 | 239 | |
| 240 | +/* called with rcu_read_lock or rtnl held */ | |
| 241 | +static inline bool ip_ignore_linkdown(const struct net_device *dev) | |
| 242 | +{ | |
| 243 | + struct in_device *in_dev; | |
| 244 | + bool rc = false; | |
| 245 | + | |
| 246 | + in_dev = rcu_dereference_rtnl(dev->ip_ptr); | |
| 247 | + if (in_dev && | |
| 248 | + IN_DEV_IGNORE_ROUTES_WITH_LINKDOWN(in_dev)) | |
| 249 | + rc = true; | |
| 250 | + | |
| 251 | + return rc; | |
| 252 | +} | |
| 253 | + | |
| 240 | 254 | static inline struct neigh_parms *__in_dev_arp_parms_get_rcu(const struct net_device *dev) |
| 241 | 255 | { |
| 242 | 256 | struct in_device *in_dev = __in_dev_get_rcu(dev); |
| @@ -489,9 +489,11 @@ struct dmar_domain { · 488 unmodified lines | ||
| 489 | 489 | /* Domain ids per IOMMU. Use u16 since |
| 490 | 490 | * domain ids are 16 bit wide according |
| 491 | 491 | * to VT-d spec, section 9.3 */ |
| 492 | + unsigned int auxd_refcnt; /* Refcount of auxiliary attaching */ | |
| 492 | 493 | |
| 493 | 494 | bool has_iotlb_device; |
| 494 | 495 | struct list_head devices; /* all devices' list */ |
| 496 | + struct list_head auxd; /* link to device's auxiliary list */ | |
| 495 | 497 | struct iova_domain iovad; /* iova's that belong to this domain */ |
| 496 | 498 | |
| 497 | 499 | struct dma_pte *pgd; /* virtual address */ |
| @@ -510,6 +512,11 @@ struct dmar_domain { · 12 unmodified lines | ||
| 510 | 512 | 2 == 1GiB, 3 == 512GiB, 4 == 1TiB */ |
| 511 | 513 | u64 max_addr; /* maximum mapped address */ |
| 512 | 514 | |
| 515 | + int default_pasid; /* | |
| 516 | + * The default pasid used for non-SVM | |
| 517 | + * traffic on mediated devices. | |
| 518 | + */ | |
| 519 | + | |
| 513 | 520 | struct iommu_domain domain; /* generic domain data structure for |
| 514 | 521 | iommu core */ |
| 515 | 522 | }; |
| @@ -559,6 +566,9 @@ struct device_domain_info { · 43 unmodified lines | ||
| 559 | 566 | struct list_head link; /* link to domain siblings */ |
| 560 | 567 | struct list_head global; /* link to global list */ |
| 561 | 568 | struct list_head table; /* link to pasid table */ |
| 569 | + struct list_head auxiliary_domains; /* auxiliary domains | |
| 570 | + * attached to this device | |
| 571 | + */ | |
| 562 | 572 | u8 bus; /* PCI bus number */ |
| 563 | 573 | u8 devfn; /* PCI devfn number */ |
| 564 | 574 | u16 pfsid; /* SRIOV physical function source ID */ |
| @@ -568,6 +578,7 @@ struct device_domain_info { · 3 unmodified lines | ||
| 568 | 578 | u8 pri_enabled:1; |
| 569 | 579 | u8 ats_supported:1; |
| 570 | 580 | u8 ats_enabled:1; |
| 581 | + u8 auxd_enabled:1; /* Multiple domains per device */ | |
| 571 | 582 | u8 ats_qdep; |
| 572 | 583 | struct device *dev; /* it's NULL for PCIe-to-PCI bridge */ |
| 573 | 584 | struct intel_iommu *iommu; /* IOMMU used by this device */ |
| @@ -650,6 +661,7 @@ struct intel_iommu *domain_get_iommu(struct dmar_domain *domain); · 76 unmodified lines | ||
| 650 | 661 | int for_each_device_domain(int (*fn)(struct device_domain_info *info, |
| 651 | 662 | void *data), void *data); |
| 652 | 663 | void iommu_flush_write_buffer(struct intel_iommu *iommu); |
| 664 | +int intel_iommu_enable_pasid(struct intel_iommu *iommu, struct device *dev); | |
| 653 | 665 | |
| 654 | 666 | #ifdef CONFIG_INTEL_IOMMU_SVM |
| 655 | 667 | int intel_svm_init(struct intel_iommu *iommu); |
| @@ -679,7 +691,6 @@ struct intel_svm { · 23 unmodified lines | ||
| 679 | 691 | struct list_head list; |
| 680 | 692 | }; |
| 681 | 693 | |
| 682 | −extern int intel_iommu_enable_pasid(struct intel_iommu *iommu, struct intel_svm_dev *sdev); | |
| 683 | 694 | extern struct intel_iommu *intel_svm_device_to_iommu(struct device *dev); |
| 684 | 695 | #endif |
| 685 | 696 | |
| @@ -0,0 +1,112 @@ | ||
| 1 | +/* SPDX-License-Identifier: GPL-2.0 */ | |
| 2 | +/* | |
| 3 | + * Intel ISH client Interface definitions | |
| 4 | + * | |
| 5 | + * Copyright (c) 2019, Intel Corporation. | |
| 6 | + */ | |
| 7 | + | |
| 8 | +#ifndef _INTEL_ISH_CLIENT_IF_H_ | |
| 9 | +#define _INTEL_ISH_CLIENT_IF_H_ | |
| 10 | + | |
| 11 | +struct ishtp_cl_device; | |
| 12 | +struct ishtp_device; | |
| 13 | +struct ishtp_cl; | |
| 14 | +struct ishtp_fw_client; | |
| 15 | + | |
| 16 | +/* Client state */ | |
| 17 | +enum cl_state { | |
| 18 | + ISHTP_CL_INITIALIZING = 0, | |
| 19 | + ISHTP_CL_CONNECTING, | |
| 20 | + ISHTP_CL_CONNECTED, | |
| 21 | + ISHTP_CL_DISCONNECTING, | |
| 22 | + ISHTP_CL_DISCONNECTED | |
| 23 | +}; | |
| 24 | + | |
| 25 | +/** | |
| 26 | + * struct ishtp_cl_device - ISHTP device handle | |
| 27 | + * @driver: driver instance on a bus | |
| 28 | + * @name: Name of the device for probe | |
| 29 | + * @probe: driver callback for device probe | |
| 30 | + * @remove: driver callback on device removal | |
| 31 | + * | |
| 32 | + * Client drivers defines to get probed/removed for ISHTP client device. | |
| 33 | + */ | |
| 34 | +struct ishtp_cl_driver { | |
| 35 | + struct device_driver driver; | |
| 36 | + const char *name; | |
| 37 | + const guid_t *guid; | |
| 38 | + int (*probe)(struct ishtp_cl_device *dev); | |
| 39 | + int (*remove)(struct ishtp_cl_device *dev); | |
| 40 | + int (*reset)(struct ishtp_cl_device *dev); | |
| 41 | + const struct dev_pm_ops *pm; | |
| 42 | +}; | |
| 43 | + | |
| 44 | +/** | |
| 45 | + * struct ishtp_msg_data - ISHTP message data struct | |
| 46 | + * @size: Size of data in the *data | |
| 47 | + * @data: Pointer to data | |
| 48 | + */ | |
| 49 | +struct ishtp_msg_data { | |
| 50 | + uint32_t size; | |
| 51 | + unsigned char *data; | |
| 52 | +}; | |
| 53 | + | |
| 54 | +/* | |
| 55 | + * struct ishtp_cl_rb - request block structure | |
| 56 | + * @list: Link to list members | |
| 57 | + * @cl: ISHTP client instance | |
| 58 | + * @buffer: message header | |
| 59 | + * @buf_idx: Index into buffer | |
| 60 | + * @read_time: unused at this time | |
| 61 | + */ | |
| 62 | +struct ishtp_cl_rb { | |
| 63 | + struct list_head list; | |
| 64 | + struct ishtp_cl *cl; | |
| 65 | + struct ishtp_msg_data buffer; | |
| 66 | + unsigned long buf_idx; | |
| 67 | + unsigned long read_time; | |
| 68 | +}; | |
| 69 | + | |
| 70 | +int ishtp_cl_driver_register(struct ishtp_cl_driver *driver, | |
| 71 | + struct module *owner); | |
| 72 | +void ishtp_cl_driver_unregister(struct ishtp_cl_driver *driver); | |
| 73 | +int ishtp_register_event_cb(struct ishtp_cl_device *device, | |
| 74 | + void (*read_cb)(struct ishtp_cl_device *)); | |
| 75 | + | |
| 76 | +/* Get the device * from ishtp device instance */ | |
| 77 | +struct device *ishtp_device(struct ishtp_cl_device *cl_device); | |
| 78 | +/* Trace interface for clients */ | |
| 79 | +void *ishtp_trace_callback(struct ishtp_cl_device *cl_device); | |
| 80 | +/* Get device pointer of PCI device for DMA acces */ | |
| 81 | +struct device *ishtp_get_pci_device(struct ishtp_cl_device *cl_device); | |
| 82 | + | |
| 83 | +struct ishtp_cl *ishtp_cl_allocate(struct ishtp_cl_device *cl_device); | |
| 84 | +void ishtp_cl_free(struct ishtp_cl *cl); | |
| 85 | +int ishtp_cl_link(struct ishtp_cl *cl); | |
| 86 | +void ishtp_cl_unlink(struct ishtp_cl *cl); | |
| 87 | +int ishtp_cl_disconnect(struct ishtp_cl *cl); | |
| 88 | +int ishtp_cl_connect(struct ishtp_cl *cl); | |
| 89 | +int ishtp_cl_send(struct ishtp_cl *cl, uint8_t *buf, size_t length); | |
| 90 | +int ishtp_cl_flush_queues(struct ishtp_cl *cl); | |
| 91 | +int ishtp_cl_io_rb_recycle(struct ishtp_cl_rb *rb); | |
| 92 | +bool ishtp_cl_tx_empty(struct ishtp_cl *cl); | |
| 93 | +struct ishtp_cl_rb *ishtp_cl_rx_get_rb(struct ishtp_cl *cl); | |
| 94 | +void *ishtp_get_client_data(struct ishtp_cl *cl); | |
| 95 | +void ishtp_set_client_data(struct ishtp_cl *cl, void *data); | |
| 96 | +struct ishtp_device *ishtp_get_ishtp_device(struct ishtp_cl *cl); | |
| 97 | +void ishtp_set_tx_ring_size(struct ishtp_cl *cl, int size); | |
| 98 | +void ishtp_set_rx_ring_size(struct ishtp_cl *cl, int size); | |
| 99 | +void ishtp_set_connection_state(struct ishtp_cl *cl, int state); | |
| 100 | +void ishtp_cl_set_fw_client_id(struct ishtp_cl *cl, int fw_client_id); | |
| 101 | + | |
| 102 | +void ishtp_put_device(struct ishtp_cl_device *cl_dev); | |
| 103 | +void ishtp_get_device(struct ishtp_cl_device *cl_dev); | |
| 104 | +void ishtp_set_drvdata(struct ishtp_cl_device *cl_device, void *data); | |
| 105 | +void *ishtp_get_drvdata(struct ishtp_cl_device *cl_device); | |
| 106 | +int ishtp_register_event_cb(struct ishtp_cl_device *device, | |
| 107 | + void (*read_cb)(struct ishtp_cl_device *)); | |
| 108 | +struct ishtp_fw_client *ishtp_fw_cl_get_client(struct ishtp_device *dev, | |
| 109 | + const guid_t *uuid); | |
| 110 | +int ishtp_get_fw_client_id(struct ishtp_fw_client *fw_client); | |
| 111 | +int ish_hw_reset(struct ishtp_device *dev); | |
| 112 | +#endif /* _INTEL_ISH_CLIENT_IF_H_ */ | |
| @@ -668,31 +668,6 @@ extern void tasklet_kill_immediate(struct tasklet_struct *t, unsigned int cpu); · 667 unmodified lines | ||
| 668 | 668 | extern void tasklet_init(struct tasklet_struct *t, |
| 669 | 669 | void (*func)(unsigned long), unsigned long data); |
| 670 | 670 | |
| 671 | −struct tasklet_hrtimer { | |
| 672 | − struct hrtimer timer; | |
| 673 | − struct tasklet_struct tasklet; | |
| 674 | − enum hrtimer_restart (*function)(struct hrtimer *); | |
| 675 | −}; | |
| 676 | − | |
| 677 | −extern void | |
| 678 | −tasklet_hrtimer_init(struct tasklet_hrtimer *ttimer, | |
| 679 | − enum hrtimer_restart (*function)(struct hrtimer *), | |
| 680 | − clockid_t which_clock, enum hrtimer_mode mode); | |
| 681 | − | |
| 682 | −static inline | |
| 683 | −void tasklet_hrtimer_start(struct tasklet_hrtimer *ttimer, ktime_t time, | |
| 684 | − const enum hrtimer_mode mode) | |
| 685 | −{ | |
| 686 | − hrtimer_start(&ttimer->timer, time, mode); | |
| 687 | −} | |
| 688 | − | |
| 689 | −static inline | |
| 690 | −void tasklet_hrtimer_cancel(struct tasklet_hrtimer *ttimer) | |
| 691 | −{ | |
| 692 | − hrtimer_cancel(&ttimer->timer); | |
| 693 | − tasklet_kill(&ttimer->tasklet); | |
| 694 | −} | |
| 695 | − | |
| 696 | 671 | /* |
| 697 | 672 | * Autoprobing for irqs: |
| 698 | 673 | * |
| @@ -53,6 +53,8 @@ struct vm_fault; · 52 unmodified lines | ||
| 53 | 53 | */ |
| 54 | 54 | #define IOMAP_NULL_ADDR -1ULL /* addr is not valid */ |
| 55 | 55 | |
| 56 | +struct iomap_page_ops; | |
| 57 | + | |
| 56 | 58 | struct iomap { |
| 57 | 59 | u64 addr; /* disk offset of mapping, bytes */ |
| 58 | 60 | loff_t offset; /* file offset of mapping, bytes */ |
| @@ -63,12 +65,22 @@ struct iomap { · 4 unmodified lines | ||
| 63 | 65 | struct dax_device *dax_dev; /* dax_dev for dax operations */ |
| 64 | 66 | void *inline_data; |
| 65 | 67 | void *private; /* filesystem private */ |
| 68 | + const struct iomap_page_ops *page_ops; | |
| 69 | +}; | |
| 66 | 70 | |
| 67 | − /* | |
| 68 | − * Called when finished processing a page in the mapping returned in | |
| 69 | − * this iomap. At least for now this is only supported in the buffered | |
| 70 | − * write path. | |
| 71 | − */ | |
| 71 | +/* | |
| 72 | + * When a filesystem sets page_ops in an iomap mapping it returns, page_prepare | |
| 73 | + * and page_done will be called for each page written to. This only applies to | |
| 74 | + * buffered writes as unbuffered writes will not typically have pages | |
| 75 | + * associated with them. | |
| 76 | + * | |
| 77 | + * When page_prepare succeeds, page_done will always be called to do any | |
| 78 | + * cleanup work necessary. In that page_done call, @page will be NULL if the | |
| 79 | + * associated page could not be obtained. | |
| 80 | + */ | |
| 81 | +struct iomap_page_ops { | |
| 82 | + int (*page_prepare)(struct inode *inode, loff_t pos, unsigned len, | |
| 83 | + struct iomap *iomap); | |
| 72 | 84 | void (*page_done)(struct inode *inode, loff_t pos, unsigned copied, |
| 73 | 85 | struct page *page, struct iomap *iomap); |
| 74 | 86 | }; |
| @@ -48,6 +48,7 @@ struct bus_type; · 47 unmodified lines | ||
| 48 | 48 | struct device; |
| 49 | 49 | struct iommu_domain; |
| 50 | 50 | struct notifier_block; |
| 51 | +struct iommu_sva; | |
| 51 | 52 | |
| 52 | 53 | /* iommu fault flags */ |
| 53 | 54 | #define IOMMU_FAULT_READ 0x0 |
| @@ -55,6 +56,8 @@ struct notifier_block; · 1 unmodified line | ||
| 55 | 56 | |
| 56 | 57 | typedef int (*iommu_fault_handler_t)(struct iommu_domain *, |
| 57 | 58 | struct device *, unsigned long, int, void *); |
| 59 | +typedef int (*iommu_mm_exit_handler_t)(struct device *dev, struct iommu_sva *, | |
| 60 | + void *); | |
| 58 | 61 | |
| 59 | 62 | struct iommu_domain_geometry { |
| 60 | 63 | dma_addr_t aperture_start; /* First address that can be mapped */ |
| @@ -156,6 +159,33 @@ struct iommu_resv_region { · 95 unmodified lines | ||
| 156 | 159 | enum iommu_resv_type type; |
| 157 | 160 | }; |
| 158 | 161 | |
| 162 | +/* Per device IOMMU features */ | |
| 163 | +enum iommu_dev_features { | |
| 164 | + IOMMU_DEV_FEAT_AUX, /* Aux-domain feature */ | |
| 165 | + IOMMU_DEV_FEAT_SVA, /* Shared Virtual Addresses */ | |
| 166 | +}; | |
| 167 | + | |
| 168 | +#define IOMMU_PASID_INVALID (-1U) | |
| 169 | + | |
| 170 | +/** | |
| 171 | + * struct iommu_sva_ops - device driver callbacks for an SVA context | |
| 172 | + * | |
| 173 | + * @mm_exit: called when the mm is about to be torn down by exit_mmap. After | |
| 174 | + * @mm_exit returns, the device must not issue any more transaction | |
| 175 | + * with the PASID given as argument. | |
| 176 | + * | |
| 177 | + * The @mm_exit handler is allowed to sleep. Be careful about the | |
| 178 | + * locks taken in @mm_exit, because they might lead to deadlocks if | |
| 179 | + * they are also held when dropping references to the mm. Consider the | |
| 180 | + * following call chain: | |
| 181 | + * mutex_lock(A); mmput(mm) -> exit_mm() -> @mm_exit() -> mutex_lock(A) | |
| 182 | + * Using mmput_async() prevents this scenario. | |
| 183 | + * | |
| 184 | + */ | |
| 185 | +struct iommu_sva_ops { | |
| 186 | + iommu_mm_exit_handler_t mm_exit; | |
| 187 | +}; | |
| 188 | + | |
| 159 | 189 | #ifdef CONFIG_IOMMU_API |
| 160 | 190 | |
| 161 | 191 | /** |
| @@ -186,6 +216,14 @@ struct iommu_resv_region { · 24 unmodified lines | ||
| 186 | 216 | * @of_xlate: add OF master IDs to iommu grouping |
| 187 | 217 | * @is_attach_deferred: Check if domain attach should be deferred from iommu |
| 188 | 218 | * driver init to device driver init (default no) |
| 219 | + * @dev_has/enable/disable_feat: per device entries to check/enable/disable | |
| 220 | + * iommu specific features. | |
| 221 | + * @dev_feat_enabled: check enabled feature | |
| 222 | + * @aux_attach/detach_dev: aux-domain specific attach/detach entries. | |
| 223 | + * @aux_get_pasid: get the pasid given an aux-domain | |
| 224 | + * @sva_bind: Bind process address space to device | |
| 225 | + * @sva_unbind: Unbind process address space from device | |
| 226 | + * @sva_get_pasid: Get PASID associated to a SVA handle | |
| 189 | 227 | * @pgsize_bitmap: bitmap of all possible supported page sizes |
| 190 | 228 | */ |
| 191 | 229 | struct iommu_ops { |
| @@ -230,6 +268,22 @@ struct iommu_ops { · 38 unmodified lines | ||
| 230 | 268 | int (*of_xlate)(struct device *dev, struct of_phandle_args *args); |
| 231 | 269 | bool (*is_attach_deferred)(struct iommu_domain *domain, struct device *dev); |
| 232 | 270 | |
| 271 | + /* Per device IOMMU features */ | |
| 272 | + bool (*dev_has_feat)(struct device *dev, enum iommu_dev_features f); | |
| 273 | + bool (*dev_feat_enabled)(struct device *dev, enum iommu_dev_features f); | |
| 274 | + int (*dev_enable_feat)(struct device *dev, enum iommu_dev_features f); | |
| 275 | + int (*dev_disable_feat)(struct device *dev, enum iommu_dev_features f); | |
| 276 | + | |
| 277 | + /* Aux-domain specific attach/detach entries */ | |
| 278 | + int (*aux_attach_dev)(struct iommu_domain *domain, struct device *dev); | |
| 279 | + void (*aux_detach_dev)(struct iommu_domain *domain, struct device *dev); | |
| 280 | + int (*aux_get_pasid)(struct iommu_domain *domain, struct device *dev); | |
| 281 | + | |
| 282 | + struct iommu_sva *(*sva_bind)(struct device *dev, struct mm_struct *mm, | |
| 283 | + void *drvdata); | |
| 284 | + void (*sva_unbind)(struct iommu_sva *handle); | |
| 285 | + int (*sva_get_pasid)(struct iommu_sva *handle); | |
| 286 | + | |
| 233 | 287 | unsigned long pgsize_bitmap; |
| 234 | 288 | }; |
| 235 | 289 | |
| @@ -392,10 +446,22 @@ struct iommu_fwspec { · 156 unmodified lines | ||
| 392 | 446 | const struct iommu_ops *ops; |
| 393 | 447 | struct fwnode_handle *iommu_fwnode; |
| 394 | 448 | void *iommu_priv; |
| 449 | + u32 flags; | |
| 395 | 450 | unsigned int num_ids; |
| 396 | 451 | u32 ids[1]; |
| 397 | 452 | }; |
| 398 | 453 | |
| 454 | +/* ATS is supported */ | |
| 455 | +#define IOMMU_FWSPEC_PCI_RC_ATS (1 << 0) | |
| 456 | + | |
| 457 | +/** | |
| 458 | + * struct iommu_sva - handle to a device-mm bond | |
| 459 | + */ | |
| 460 | +struct iommu_sva { | |
| 461 | + struct device *dev; | |
| 462 | + const struct iommu_sva_ops *ops; | |
| 463 | +}; | |
| 464 | + | |
| 399 | 465 | int iommu_fwspec_init(struct device *dev, struct fwnode_handle *iommu_fwnode, |
| 400 | 466 | const struct iommu_ops *ops); |
| 401 | 467 | void iommu_fwspec_free(struct device *dev); |
| @@ -416,6 +482,22 @@ static inline void dev_iommu_fwspec_set(struct device *dev, · 14 unmodified lines | ||
| 416 | 482 | int iommu_probe_device(struct device *dev); |
| 417 | 483 | void iommu_release_device(struct device *dev); |
| 418 | 484 | |
| 485 | +bool iommu_dev_has_feature(struct device *dev, enum iommu_dev_features f); | |
| 486 | +int iommu_dev_enable_feature(struct device *dev, enum iommu_dev_features f); | |
| 487 | +int iommu_dev_disable_feature(struct device *dev, enum iommu_dev_features f); | |
| 488 | +bool iommu_dev_feature_enabled(struct device *dev, enum iommu_dev_features f); | |
| 489 | +int iommu_aux_attach_device(struct iommu_domain *domain, struct device *dev); | |
| 490 | +void iommu_aux_detach_device(struct iommu_domain *domain, struct device *dev); | |
| 491 | +int iommu_aux_get_pasid(struct iommu_domain *domain, struct device *dev); | |
| 492 | + | |
| 493 | +struct iommu_sva *iommu_sva_bind_device(struct device *dev, | |
| 494 | + struct mm_struct *mm, | |
| 495 | + void *drvdata); | |
| 496 | +void iommu_sva_unbind_device(struct iommu_sva *handle); | |
| 497 | +int iommu_sva_set_ops(struct iommu_sva *handle, | |
| 498 | + const struct iommu_sva_ops *ops); | |
| 499 | +int iommu_sva_get_pasid(struct iommu_sva *handle); | |
| 500 | + | |
| 419 | 501 | #else /* CONFIG_IOMMU_API */ |
| 420 | 502 | |
| 421 | 503 | struct iommu_ops {}; |
| @@ -700,6 +782,68 @@ const struct iommu_ops *iommu_ops_from_fwnode(struct fwnode_handle *fwnode) · 278 unmodified lines | ||
| 700 | 782 | return NULL; |
| 701 | 783 | } |
| 702 | 784 | |
| 785 | +static inline bool | |
| 786 | +iommu_dev_has_feature(struct device *dev, enum iommu_dev_features feat) | |
| 787 | +{ | |
| 788 | + return false; | |
| 789 | +} | |
| 790 | + | |
| 791 | +static inline bool | |
| 792 | +iommu_dev_feature_enabled(struct device *dev, enum iommu_dev_features feat) | |
| 793 | +{ | |
| 794 | + return false; | |
| 795 | +} | |
| 796 | + | |
| 797 | +static inline int | |
| 798 | +iommu_dev_enable_feature(struct device *dev, enum iommu_dev_features feat) | |
| 799 | +{ | |
| 800 | + return -ENODEV; | |
| 801 | +} | |
| 802 | + | |
| 803 | +static inline int | |
| 804 | +iommu_dev_disable_feature(struct device *dev, enum iommu_dev_features feat) | |
| 805 | +{ | |
| 806 | + return -ENODEV; | |
| 807 | +} | |
| 808 | + | |
| 809 | +static inline int | |
| 810 | +iommu_aux_attach_device(struct iommu_domain *domain, struct device *dev) | |
| 811 | +{ | |
| 812 | + return -ENODEV; | |
| 813 | +} | |
| 814 | + | |
| 815 | +static inline void | |
| 816 | +iommu_aux_detach_device(struct iommu_domain *domain, struct device *dev) | |
| 817 | +{ | |
| 818 | +} | |
| 819 | + | |
| 820 | +static inline int | |
| 821 | +iommu_aux_get_pasid(struct iommu_domain *domain, struct device *dev) | |
| 822 | +{ | |
| 823 | + return -ENODEV; | |
| 824 | +} | |
| 825 | + | |
| 826 | +static inline struct iommu_sva * | |
| 827 | +iommu_sva_bind_device(struct device *dev, struct mm_struct *mm, void *drvdata) | |
| 828 | +{ | |
| 829 | + return NULL; | |
| 830 | +} | |
| 831 | + | |
| 832 | +static inline void iommu_sva_unbind_device(struct iommu_sva *handle) | |
| 833 | +{ | |
| 834 | +} | |
| 835 | + | |
| 836 | +static inline int iommu_sva_set_ops(struct iommu_sva *handle, | |
| 837 | + const struct iommu_sva_ops *ops) | |
| 838 | +{ | |
| 839 | + return -EINVAL; | |
| 840 | +} | |
| 841 | + | |
| 842 | +static inline int iommu_sva_get_pasid(struct iommu_sva *handle) | |
| 843 | +{ | |
| 844 | + return IOMMU_PASID_INVALID; | |
| 845 | +} | |
| 846 | + | |
| 703 | 847 | #endif /* CONFIG_IOMMU_API */ |
| 704 | 848 | |
| 705 | 849 | #ifdef CONFIG_IOMMU_DEBUGFS |
| @@ -76,6 +76,14 @@ struct iova_domain { · 75 unmodified lines | ||
| 76 | 76 | unsigned long start_pfn; /* Lower limit for this domain */ |
| 77 | 77 | unsigned long dma_32bit_pfn; |
| 78 | 78 | unsigned long max32_alloc_size; /* Size of last failed allocation */ |
| 79 | + struct iova_fq __percpu *fq; /* Flush Queue */ | |
| 80 | + | |
| 81 | + atomic64_t fq_flush_start_cnt; /* Number of TLB flushes that | |
| 82 | + have been started */ | |
| 83 | + | |
| 84 | + atomic64_t fq_flush_finish_cnt; /* Number of TLB flushes that | |
| 85 | + have been finished */ | |
| 86 | + | |
| 79 | 87 | struct iova anchor; /* rbtree lookup anchor */ |
| 80 | 88 | struct iova_rcache rcaches[IOVA_RANGE_CACHE_MAX_SIZE]; /* IOVA range caches */ |
| 81 | 89 | |
| @@ -85,14 +93,6 @@ struct iova_domain { · 3 unmodified lines | ||
| 85 | 93 | iova_entry_dtor entry_dtor; /* IOMMU driver specific destructor for |
| 86 | 94 | iova entry */ |
| 87 | 95 | |
| 88 | − struct iova_fq __percpu *fq; /* Flush Queue */ | |
| 89 | − | |
| 90 | − atomic64_t fq_flush_start_cnt; /* Number of TLB flushes that | |
| 91 | − have been started */ | |
| 92 | − | |
| 93 | − atomic64_t fq_flush_finish_cnt; /* Number of TLB flushes that | |
| 94 | − have been finished */ | |
| 95 | − | |
| 96 | 96 | struct timer_list fq_timer; /* Timer to regularily empty the |
| 97 | 97 | flush-queues */ |
| 98 | 98 | atomic_t fq_timer_on; /* 1 when timer is active, 0 |
| @@ -19,6 +19,7 @@ struct ipc_ids { · 18 unmodified lines | ||
| 19 | 19 | struct rw_semaphore rwsem; |
| 20 | 20 | struct idr ipcs_idr; |
| 21 | 21 | int max_idx; |
| 22 | + int last_idx; /* For wrap around detection */ | |
| 22 | 23 | #ifdef CONFIG_CHECKPOINT_RESTORE |
| 23 | 24 | int next_id; |
| 24 | 25 | #endif |
| @@ -625,6 +625,8 @@ extern int irq_chip_set_wake_parent(struct irq_data *data, unsigned int on); · 624 unmodified lines | ||
| 625 | 625 | extern int irq_chip_set_vcpu_affinity_parent(struct irq_data *data, |
| 626 | 626 | void *vcpu_info); |
| 627 | 627 | extern int irq_chip_set_type_parent(struct irq_data *data, unsigned int type); |
| 628 | +extern int irq_chip_request_resources_parent(struct irq_data *data); | |
| 629 | +extern void irq_chip_release_resources_parent(struct irq_data *data); | |
| 628 | 630 | #endif |
| 629 | 631 | |
| 630 | 632 | /* Handling of unhandled and spurious interrupts: */ |
| @@ -165,7 +165,7 @@ · 164 unmodified lines | ||
| 165 | 165 | #define GICR_PROPBASER_nCnB GIC_BASER_CACHEABILITY(GICR_PROPBASER, INNER, nCnB) |
| 166 | 166 | #define GICR_PROPBASER_nC GIC_BASER_CACHEABILITY(GICR_PROPBASER, INNER, nC) |
| 167 | 167 | #define GICR_PROPBASER_RaWt GIC_BASER_CACHEABILITY(GICR_PROPBASER, INNER, RaWt) |
| 168 | −#define GICR_PROPBASER_RaWb GIC_BASER_CACHEABILITY(GICR_PROPBASER, INNER, RaWt) | |
| 168 | +#define GICR_PROPBASER_RaWb GIC_BASER_CACHEABILITY(GICR_PROPBASER, INNER, RaWb) | |
| 169 | 169 | #define GICR_PROPBASER_WaWt GIC_BASER_CACHEABILITY(GICR_PROPBASER, INNER, WaWt) |
| 170 | 170 | #define GICR_PROPBASER_WaWb GIC_BASER_CACHEABILITY(GICR_PROPBASER, INNER, WaWb) |
| 171 | 171 | #define GICR_PROPBASER_RaWaWt GIC_BASER_CACHEABILITY(GICR_PROPBASER, INNER, RaWaWt) |
| @@ -192,7 +192,7 @@ · 20 unmodified lines | ||
| 192 | 192 | #define GICR_PENDBASER_nCnB GIC_BASER_CACHEABILITY(GICR_PENDBASER, INNER, nCnB) |
| 193 | 193 | #define GICR_PENDBASER_nC GIC_BASER_CACHEABILITY(GICR_PENDBASER, INNER, nC) |
| 194 | 194 | #define GICR_PENDBASER_RaWt GIC_BASER_CACHEABILITY(GICR_PENDBASER, INNER, RaWt) |
| 195 | −#define GICR_PENDBASER_RaWb GIC_BASER_CACHEABILITY(GICR_PENDBASER, INNER, RaWt) | |
| 195 | +#define GICR_PENDBASER_RaWb GIC_BASER_CACHEABILITY(GICR_PENDBASER, INNER, RaWb) | |
| 196 | 196 | #define GICR_PENDBASER_WaWt GIC_BASER_CACHEABILITY(GICR_PENDBASER, INNER, WaWt) |
| 197 | 197 | #define GICR_PENDBASER_WaWb GIC_BASER_CACHEABILITY(GICR_PENDBASER, INNER, WaWb) |
| 198 | 198 | #define GICR_PENDBASER_RaWaWt GIC_BASER_CACHEABILITY(GICR_PENDBASER, INNER, RaWaWt) |
| @@ -251,7 +251,7 @@ · 52 unmodified lines | ||
| 251 | 251 | #define GICR_VPROPBASER_nCnB GIC_BASER_CACHEABILITY(GICR_VPROPBASER, INNER, nCnB) |
| 252 | 252 | #define GICR_VPROPBASER_nC GIC_BASER_CACHEABILITY(GICR_VPROPBASER, INNER, nC) |
| 253 | 253 | #define GICR_VPROPBASER_RaWt GIC_BASER_CACHEABILITY(GICR_VPROPBASER, INNER, RaWt) |
| 254 | −#define GICR_VPROPBASER_RaWb GIC_BASER_CACHEABILITY(GICR_VPROPBASER, INNER, RaWt) | |
| 254 | +#define GICR_VPROPBASER_RaWb GIC_BASER_CACHEABILITY(GICR_VPROPBASER, INNER, RaWb) | |
| 255 | 255 | #define GICR_VPROPBASER_WaWt GIC_BASER_CACHEABILITY(GICR_VPROPBASER, INNER, WaWt) |
| 256 | 256 | #define GICR_VPROPBASER_WaWb GIC_BASER_CACHEABILITY(GICR_VPROPBASER, INNER, WaWb) |
| 257 | 257 | #define GICR_VPROPBASER_RaWaWt GIC_BASER_CACHEABILITY(GICR_VPROPBASER, INNER, RaWaWt) |
| @@ -277,7 +277,7 @@ · 19 unmodified lines | ||
| 277 | 277 | #define GICR_VPENDBASER_nCnB GIC_BASER_CACHEABILITY(GICR_VPENDBASER, INNER, nCnB) |
| 278 | 278 | #define GICR_VPENDBASER_nC GIC_BASER_CACHEABILITY(GICR_VPENDBASER, INNER, nC) |
| 279 | 279 | #define GICR_VPENDBASER_RaWt GIC_BASER_CACHEABILITY(GICR_VPENDBASER, INNER, RaWt) |
| 280 | −#define GICR_VPENDBASER_RaWb GIC_BASER_CACHEABILITY(GICR_VPENDBASER, INNER, RaWt) | |
| 280 | +#define GICR_VPENDBASER_RaWb GIC_BASER_CACHEABILITY(GICR_VPENDBASER, INNER, RaWb) | |
| 281 | 281 | #define GICR_VPENDBASER_WaWt GIC_BASER_CACHEABILITY(GICR_VPENDBASER, INNER, WaWt) |
| 282 | 282 | #define GICR_VPENDBASER_WaWb GIC_BASER_CACHEABILITY(GICR_VPENDBASER, INNER, WaWb) |
| 283 | 283 | #define GICR_VPENDBASER_RaWaWt GIC_BASER_CACHEABILITY(GICR_VPENDBASER, INNER, RaWaWt) |
| @@ -351,7 +351,7 @@ · 67 unmodified lines | ||
| 351 | 351 | #define GITS_CBASER_nCnB GIC_BASER_CACHEABILITY(GITS_CBASER, INNER, nCnB) |
| 352 | 352 | #define GITS_CBASER_nC GIC_BASER_CACHEABILITY(GITS_CBASER, INNER, nC) |
| 353 | 353 | #define GITS_CBASER_RaWt GIC_BASER_CACHEABILITY(GITS_CBASER, INNER, RaWt) |
| 354 | −#define GITS_CBASER_RaWb GIC_BASER_CACHEABILITY(GITS_CBASER, INNER, RaWt) | |
| 354 | +#define GITS_CBASER_RaWb GIC_BASER_CACHEABILITY(GITS_CBASER, INNER, RaWb) | |
| 355 | 355 | #define GITS_CBASER_WaWt GIC_BASER_CACHEABILITY(GITS_CBASER, INNER, WaWt) |
| 356 | 356 | #define GITS_CBASER_WaWb GIC_BASER_CACHEABILITY(GITS_CBASER, INNER, WaWb) |
| 357 | 357 | #define GITS_CBASER_RaWaWt GIC_BASER_CACHEABILITY(GITS_CBASER, INNER, RaWaWt) |
| @@ -377,7 +377,7 @@ · 19 unmodified lines | ||
| 377 | 377 | #define GITS_BASER_nCnB GIC_BASER_CACHEABILITY(GITS_BASER, INNER, nCnB) |
| 378 | 378 | #define GITS_BASER_nC GIC_BASER_CACHEABILITY(GITS_BASER, INNER, nC) |
| 379 | 379 | #define GITS_BASER_RaWt GIC_BASER_CACHEABILITY(GITS_BASER, INNER, RaWt) |
| 380 | −#define GITS_BASER_RaWb GIC_BASER_CACHEABILITY(GITS_BASER, INNER, RaWt) | |
| 380 | +#define GITS_BASER_RaWb GIC_BASER_CACHEABILITY(GITS_BASER, INNER, RaWb) | |
| 381 | 381 | #define GITS_BASER_WaWt GIC_BASER_CACHEABILITY(GITS_BASER, INNER, WaWt) |
| 382 | 382 | #define GITS_BASER_WaWb GIC_BASER_CACHEABILITY(GITS_BASER, INNER, WaWb) |
| 383 | 383 | #define GITS_BASER_RaWaWt GIC_BASER_CACHEABILITY(GITS_BASER, INNER, RaWaWt) |
| @@ -0,0 +1,12 @@ | ||
| 1 | +/* SPDX-License-Identifier: GPL-2.0 */ | |
| 2 | +#ifndef __IRQ_IXP4XX_H | |
| 3 | +#define __IRQ_IXP4XX_H | |
| 4 | + | |
| 5 | +#include <linux/ioport.h> | |
| 6 | +struct irq_domain; | |
| 7 | + | |
| 8 | +void ixp4xx_irq_init(resource_size_t irqbase, | |
| 9 | + bool is_356); | |
| 10 | +struct irq_domain *ixp4xx_get_irq_domain(void); | |
| 11 | + | |
| 12 | +#endif /* __IRQ_IXP4XX_H */ | |
| @@ -82,6 +82,7 @@ enum irq_domain_bus_token { · 81 unmodified lines | ||
| 82 | 82 | DOMAIN_BUS_NEXUS, |
| 83 | 83 | DOMAIN_BUS_IPI, |
| 84 | 84 | DOMAIN_BUS_FSL_MC_MSI, |
| 85 | + DOMAIN_BUS_TI_SCI_INTA_MSI, | |
| 85 | 86 | }; |
| 86 | 87 | |
| 87 | 88 | /** |
| @@ -1318,7 +1318,7 @@ extern void __wait_on_journal (journal_t *); · 1317 unmodified lines | ||
| 1318 | 1318 | |
| 1319 | 1319 | /* Transaction cache support */ |
| 1320 | 1320 | extern void jbd2_journal_destroy_transaction_cache(void); |
| 1321 | −extern int jbd2_journal_init_transaction_cache(void); | |
| 1321 | +extern int __init jbd2_journal_init_transaction_cache(void); | |
| 1322 | 1322 | extern void jbd2_journal_free_transaction(transaction_t *); |
| 1323 | 1323 | |
| 1324 | 1324 | /* |
| @@ -1446,8 +1446,10 @@ static inline void jbd2_free_inode(struct jbd2_inode *jinode) · 121 unmodified lines | ||
| 1446 | 1446 | /* Primary revoke support */ |
| 1447 | 1447 | #define JOURNAL_REVOKE_DEFAULT_HASH 256 |
| 1448 | 1448 | extern int jbd2_journal_init_revoke(journal_t *, int); |
| 1449 | −extern void jbd2_journal_destroy_revoke_caches(void); | |
| 1450 | −extern int jbd2_journal_init_revoke_caches(void); | |
| 1449 | +extern void jbd2_journal_destroy_revoke_record_cache(void); | |
| 1450 | +extern void jbd2_journal_destroy_revoke_table_cache(void); | |
| 1451 | +extern int __init jbd2_journal_init_revoke_record_cache(void); | |
| 1452 | +extern int __init jbd2_journal_init_revoke_table_cache(void); | |
| 1451 | 1453 | |
| 1452 | 1454 | extern void jbd2_journal_destroy_revoke(journal_t *); |
| 1453 | 1455 | extern int jbd2_journal_revoke (handle_t *, unsigned long long, struct buffer_head *); |
| @@ -1606,7 +1608,6 @@ static inline u32 jbd2_chksum(journal_t *journal, u32 crc, · 152 unmodified lines | ||
| 1606 | 1608 | JBD_MAX_CHECKSUM_SIZE); |
| 1607 | 1609 | |
| 1608 | 1610 | desc.shash.tfm = journal->j_chksum_driver; |
| 1609 | − desc.shash.flags = 0; | |
| 1610 | 1611 | *(u32 *)desc.ctx = crc; |
| 1611 | 1612 | |
| 1612 | 1613 | err = crypto_shash_update(&desc.shash, address, length); |
| @@ -297,6 +297,7 @@ static inline u64 jiffies_to_nsecs(const unsigned long j) · 296 unmodified lines | ||
| 297 | 297 | } |
| 298 | 298 | |
| 299 | 299 | extern u64 jiffies64_to_nsecs(u64 j); |
| 300 | +extern u64 jiffies64_to_msecs(u64 j); | |
| 300 | 301 | |
| 301 | 302 | extern unsigned long __msecs_to_jiffies(const unsigned int m); |
| 302 | 303 | #if HZ <= MSEC_PER_SEC && !(MSEC_PER_SEC % HZ) |
| @@ -12,21 +12,79 @@ struct static_key_deferred { · 11 unmodified lines | ||
| 12 | 12 | struct delayed_work work; |
| 13 | 13 | }; |
| 14 | 14 | |
| 15 | −extern void static_key_slow_dec_deferred(struct static_key_deferred *key); | |
| 16 | −extern void static_key_deferred_flush(struct static_key_deferred *key); | |
| 15 | +struct static_key_true_deferred { | |
| 16 | + struct static_key_true key; | |
| 17 | + unsigned long timeout; | |
| 18 | + struct delayed_work work; | |
| 19 | +}; | |
| 20 | + | |
| 21 | +struct static_key_false_deferred { | |
| 22 | + struct static_key_false key; | |
| 23 | + unsigned long timeout; | |
| 24 | + struct delayed_work work; | |
| 25 | +}; | |
| 26 | + | |
| 27 | +#define static_key_slow_dec_deferred(x) \ | |
| 28 | + __static_key_slow_dec_deferred(&(x)->key, &(x)->work, (x)->timeout) | |
| 29 | +#define static_branch_slow_dec_deferred(x) \ | |
| 30 | + __static_key_slow_dec_deferred(&(x)->key.key, &(x)->work, (x)->timeout) | |
| 31 | + | |
| 32 | +#define static_key_deferred_flush(x) \ | |
| 33 | + __static_key_deferred_flush((x), &(x)->work) | |
| 34 | + | |
| 35 | +extern void | |
| 36 | +__static_key_slow_dec_deferred(struct static_key *key, | |
| 37 | + struct delayed_work *work, | |
| 38 | + unsigned long timeout); | |
| 39 | +extern void __static_key_deferred_flush(void *key, struct delayed_work *work); | |
| 17 | 40 | extern void |
| 18 | 41 | jump_label_rate_limit(struct static_key_deferred *key, unsigned long rl); |
| 19 | 42 | |
| 43 | +extern void jump_label_update_timeout(struct work_struct *work); | |
| 44 | + | |
| 45 | +#define DEFINE_STATIC_KEY_DEFERRED_TRUE(name, rl) \ | |
| 46 | + struct static_key_true_deferred name = { \ | |
| 47 | + .key = { STATIC_KEY_INIT_TRUE }, \ | |
| 48 | + .timeout = (rl), \ | |
| 49 | + .work = __DELAYED_WORK_INITIALIZER((name).work, \ | |
| 50 | + jump_label_update_timeout, \ | |
| 51 | + 0), \ | |
| 52 | + } | |
| 53 | + | |
| 54 | +#define DEFINE_STATIC_KEY_DEFERRED_FALSE(name, rl) \ | |
| 55 | + struct static_key_false_deferred name = { \ | |
| 56 | + .key = { STATIC_KEY_INIT_FALSE }, \ | |
| 57 | + .timeout = (rl), \ | |
| 58 | + .work = __DELAYED_WORK_INITIALIZER((name).work, \ | |
| 59 | + jump_label_update_timeout, \ | |
| 60 | + 0), \ | |
| 61 | + } | |
| 62 | + | |
| 63 | +#define static_branch_deferred_inc(x) static_branch_inc(&(x)->key) | |
| 64 | + | |
| 20 | 65 | #else /* !CONFIG_JUMP_LABEL */ |
| 21 | 66 | struct static_key_deferred { |
| 22 | 67 | struct static_key key; |
| 23 | 68 | }; |
| 69 | +struct static_key_true_deferred { | |
| 70 | + struct static_key_true key; | |
| 71 | +}; | |
| 72 | +struct static_key_false_deferred { | |
| 73 | + struct static_key_false key; | |
| 74 | +}; | |
| 75 | +#define DEFINE_STATIC_KEY_DEFERRED_TRUE(name, rl) \ | |
| 76 | + struct static_key_true_deferred name = { STATIC_KEY_TRUE_INIT } | |
| 77 | +#define DEFINE_STATIC_KEY_DEFERRED_FALSE(name, rl) \ | |
| 78 | + struct static_key_false_deferred name = { STATIC_KEY_FALSE_INIT } | |
| 79 | + | |
| 80 | +#define static_branch_slow_dec_deferred(x) static_branch_dec(&(x)->key) | |
| 81 | + | |
| 24 | 82 | static inline void static_key_slow_dec_deferred(struct static_key_deferred *key) |
| 25 | 83 | { |
| 26 | 84 | STATIC_KEY_CHECK_USE(key); |
| 27 | 85 | static_key_slow_dec(&key->key); |
| 28 | 86 | } |
| 29 | −static inline void static_key_deferred_flush(struct static_key_deferred *key) | |
| 87 | +static inline void static_key_deferred_flush(void *key) | |
| 30 | 88 | { |
| 31 | 89 | STATIC_KEY_CHECK_USE(key); |
| 32 | 90 | } |
| @@ -17,6 +17,7 @@ · 16 unmodified lines | ||
| 17 | 17 | #include <asm/byteorder.h> |
| 18 | 18 | #include <asm/div64.h> |
| 19 | 19 | #include <uapi/linux/kernel.h> |
| 20 | +#include <asm/div64.h> | |
| 20 | 21 | |
| 21 | 22 | #define STACK_MAGIC 0xdeadbeef |
| 22 | 23 | |
| @@ -175,18 +176,7 @@ · 152 unmodified lines | ||
| 175 | 176 | #define _RET_IP_ (unsigned long)__builtin_return_address(0) |
| 176 | 177 | #define _THIS_IP_ ({ __label__ __here; __here: (unsigned long)&&__here; }) |
| 177 | 178 | |
| 178 | −#ifdef CONFIG_LBDAF | |
| 179 | −# define sector_div(a, b) do_div(a, b) | |
| 180 | −#else | |
| 181 | −# define sector_div(n, b)( \ | |
| 182 | −{ \ | |
| 183 | − int _res; \ | |
| 184 | − _res = (n) % (b); \ | |
| 185 | − (n) /= (b); \ | |
| 186 | − _res; \ | |
| 187 | −} \ | |
| 188 | −) | |
| 189 | −#endif | |
| 179 | +#define sector_div(a, b) do_div(a, b) | |
| 190 | 180 | |
| 191 | 181 | /** |
| 192 | 182 | * upper_32_bits - return bits 32-63 of a number |
| @@ -494,6 +484,7 @@ extern int __kernel_text_address(unsigned long addr); · 301 unmodified lines | ||
| 494 | 484 | extern int kernel_text_address(unsigned long addr); |
| 495 | 485 | extern int func_ptr_is_kernel_text(void *ptr); |
| 496 | 486 | |
| 487 | +u64 int_pow(u64 base, unsigned int exp); | |
| 497 | 488 | unsigned long int_sqrt(unsigned long); |
| 498 | 489 | |
| 499 | 490 | #if BITS_PER_LONG < 64 |
| @@ -64,7 +64,7 @@ enum kernfs_root_flag { · 63 unmodified lines | ||
| 64 | 64 | KERNFS_ROOT_CREATE_DEACTIVATED = 0x0001, |
| 65 | 65 | |
| 66 | 66 | /* |
| 67 | − * For regular flies, if the opener has CAP_DAC_OVERRIDE, open(2) | |
| 67 | + * For regular files, if the opener has CAP_DAC_OVERRIDE, open(2) | |
| 68 | 68 | * succeeds regardless of the RW permissions. sysfs had an extra |
| 69 | 69 | * layer of enforcement where open(2) fails with -EACCES regardless |
| 70 | 70 | * of CAP_DAC_OVERRIDE if the permission doesn't have the |
| @@ -371,6 +371,11 @@ __poll_t kernfs_generic_poll(struct kernfs_open_file *of, · 300 unmodified lines | ||
| 371 | 371 | struct poll_table_struct *pt); |
| 372 | 372 | void kernfs_notify(struct kernfs_node *kn); |
| 373 | 373 | |
| 374 | +int kernfs_xattr_get(struct kernfs_node *kn, const char *name, | |
| 375 | + void *value, size_t size); | |
| 376 | +int kernfs_xattr_set(struct kernfs_node *kn, const char *name, | |
| 377 | + const void *value, size_t size, int flags); | |
| 378 | + | |
| 374 | 379 | const void *kernfs_super_ns(struct super_block *sb); |
| 375 | 380 | int kernfs_get_tree(struct fs_context *fc); |
| 376 | 381 | void kernfs_free_fs_context(struct fs_context *fc); |
| @@ -473,6 +478,14 @@ static inline int kernfs_setattr(struct kernfs_node *kn, · 96 unmodified lines | ||
| 473 | 478 | |
| 474 | 479 | static inline void kernfs_notify(struct kernfs_node *kn) { } |
| 475 | 480 | |
| 481 | +static inline int kernfs_xattr_get(struct kernfs_node *kn, const char *name, | |
| 482 | + void *value, size_t size) | |
| 483 | +{ return -ENOSYS; } | |
| 484 | + | |
| 485 | +static inline int kernfs_xattr_set(struct kernfs_node *kn, const char *name, | |
| 486 | + const void *value, size_t size, int flags) | |
| 487 | +{ return -ENOSYS; } | |
| 488 | + | |
| 476 | 489 | static inline const void *kernfs_super_ns(struct super_block *sb) |
| 477 | 490 | { return NULL; } |
| 478 | 491 | |
| @@ -139,7 +139,8 @@ static inline bool kobject_has_children(struct kobject *kobj) · 138 unmodified lines | ||
| 139 | 139 | struct kobj_type { |
| 140 | 140 | void (*release)(struct kobject *kobj); |
| 141 | 141 | const struct sysfs_ops *sysfs_ops; |
| 142 | − struct attribute **default_attrs; | |
| 142 | + struct attribute **default_attrs; /* use default_groups instead */ | |
| 143 | + const struct attribute_group **default_groups; | |
| 143 | 144 | const struct kobj_ns_type_operations *(*child_ns_type)(struct kobject *kobj); |
| 144 | 145 | const void *(*namespace)(struct kobject *kobj); |
| 145 | 146 | void (*get_ownership)(struct kobject *kobj, kuid_t *uid, kgid_t *gid); |
| @@ -173,6 +173,7 @@ struct kretprobe_instance { · 172 unmodified lines | ||
| 173 | 173 | struct kretprobe *rp; |
| 174 | 174 | kprobe_opcode_t *ret_addr; |
| 175 | 175 | struct task_struct *task; |
| 176 | + void *fp; | |
| 176 | 177 | char data[0]; |
| 177 | 178 | }; |
| 178 | 179 | |
| @@ -4,7 +4,6 @@ · 3 unmodified lines | ||
| 4 | 4 | /* Simple interface for creating and stopping kernel threads without mess. */ |
| 5 | 5 | #include <linux/err.h> |
| 6 | 6 | #include <linux/sched.h> |
| 7 | −#include <linux/cgroup.h> | |
| 8 | 7 | |
| 9 | 8 | __printf(4, 5) |
| 10 | 9 | struct task_struct *kthread_create_on_node(int (*threadfn)(void *data), |
| @@ -198,6 +197,8 @@ bool kthread_cancel_delayed_work_sync(struct kthread_delayed_work *work); · 187 unmodified lines | ||
| 198 | 197 | |
| 199 | 198 | void kthread_destroy_worker(struct kthread_worker *worker); |
| 200 | 199 | |
| 200 | +struct cgroup_subsys_state; | |
| 201 | + | |
| 201 | 202 | #ifdef CONFIG_BLK_CGROUP |
| 202 | 203 | void kthread_associate_blkcg(struct cgroup_subsys_state *css); |
| 203 | 204 | struct cgroup_subsys_state *kthread_blkcg(void); |
| @@ -28,6 +28,7 @@ · 27 unmodified lines | ||
| 28 | 28 | #include <linux/irqbypass.h> |
| 29 | 29 | #include <linux/swait.h> |
| 30 | 30 | #include <linux/refcount.h> |
| 31 | +#include <linux/nospec.h> | |
| 31 | 32 | #include <asm/signal.h> |
| 32 | 33 | |
| 33 | 34 | #include <linux/kvm.h> |
| @@ -226,6 +227,32 @@ enum { · 192 unmodified lines | ||
| 226 | 227 | READING_SHADOW_PAGE_TABLES, |
| 227 | 228 | }; |
| 228 | 229 | |
| 230 | +#define KVM_UNMAPPED_PAGE ((void *) 0x500 + POISON_POINTER_DELTA) | |
| 231 | + | |
| 232 | +struct kvm_host_map { | |
| 233 | + /* | |
| 234 | + * Only valid if the 'pfn' is managed by the host kernel (i.e. There is | |
| 235 | + * a 'struct page' for it. When using mem= kernel parameter some memory | |
| 236 | + * can be used as guest memory but they are not managed by host | |
| 237 | + * kernel). | |
| 238 | + * If 'pfn' is not managed by the host kernel, this field is | |
| 239 | + * initialized to KVM_UNMAPPED_PAGE. | |
| 240 | + */ | |
| 241 | + struct page *page; | |
| 242 | + void *hva; | |
| 243 | + kvm_pfn_t pfn; | |
| 244 | + kvm_pfn_t gfn; | |
| 245 | +}; | |
| 246 | + | |
| 247 | +/* | |
| 248 | + * Used to check if the mapping is valid or not. Never use 'kvm_host_map' | |
| 249 | + * directly to check for that. | |
| 250 | + */ | |
| 251 | +static inline bool kvm_vcpu_mapped(struct kvm_host_map *map) | |
| 252 | +{ | |
| 253 | + return !!map->hva; | |
| 254 | +} | |
| 255 | + | |
| 229 | 256 | /* |
| 230 | 257 | * Sometimes a large or cross-page mmio needs to be broken up into separate |
| 231 | 258 | * exits for userspace servicing. |
| @@ -513,10 +540,10 @@ static inline struct kvm_io_bus *kvm_get_bus(struct kvm *kvm, enum kvm_bus idx) · 281 unmodified lines | ||
| 513 | 540 | |
| 514 | 541 | static inline struct kvm_vcpu *kvm_get_vcpu(struct kvm *kvm, int i) |
| 515 | 542 | { |
| 516 | − /* Pairs with smp_wmb() in kvm_vm_ioctl_create_vcpu, in case | |
| 517 | − * the caller has read kvm->online_vcpus before (as is the case | |
| 518 | − * for kvm_for_each_vcpu, for example). | |
| 519 | − */ | |
| 543 | + int num_vcpus = atomic_read(&kvm->online_vcpus); | |
| 544 | + i = array_index_nospec(i, num_vcpus); | |
| 545 | + | |
| 546 | + /* Pairs with smp_wmb() in kvm_vm_ioctl_create_vcpu. */ | |
| 520 | 547 | smp_rmb(); |
| 521 | 548 | return kvm->vcpus[i]; |
| 522 | 549 | } |
| @@ -600,6 +627,7 @@ void kvm_put_kvm(struct kvm *kvm); · 77 unmodified lines | ||
| 600 | 627 | |
| 601 | 628 | static inline struct kvm_memslots *__kvm_memslots(struct kvm *kvm, int as_id) |
| 602 | 629 | { |
| 630 | + as_id = array_index_nospec(as_id, KVM_ADDRESS_SPACE_NUM); | |
| 603 | 631 | return srcu_dereference_check(kvm->memslots[as_id], &kvm->srcu, |
| 604 | 632 | lockdep_is_held(&kvm->slots_lock) || |
| 605 | 633 | !refcount_read(&kvm->users_count)); |
| @@ -731,7 +759,9 @@ struct kvm_memslots *kvm_vcpu_memslots(struct kvm_vcpu *vcpu); · 125 unmodified lines | ||
| 731 | 759 | struct kvm_memory_slot *kvm_vcpu_gfn_to_memslot(struct kvm_vcpu *vcpu, gfn_t gfn); |
| 732 | 760 | kvm_pfn_t kvm_vcpu_gfn_to_pfn_atomic(struct kvm_vcpu *vcpu, gfn_t gfn); |
| 733 | 761 | kvm_pfn_t kvm_vcpu_gfn_to_pfn(struct kvm_vcpu *vcpu, gfn_t gfn); |
| 762 | +int kvm_vcpu_map(struct kvm_vcpu *vcpu, gpa_t gpa, struct kvm_host_map *map); | |
| 734 | 763 | struct page *kvm_vcpu_gfn_to_page(struct kvm_vcpu *vcpu, gfn_t gfn); |
| 764 | +void kvm_vcpu_unmap(struct kvm_vcpu *vcpu, struct kvm_host_map *map, bool dirty); | |
| 735 | 765 | unsigned long kvm_vcpu_gfn_to_hva(struct kvm_vcpu *vcpu, gfn_t gfn); |
| 736 | 766 | unsigned long kvm_vcpu_gfn_to_hva_prot(struct kvm_vcpu *vcpu, gfn_t gfn, bool *writable); |
| 737 | 767 | int kvm_vcpu_read_guest_page(struct kvm_vcpu *vcpu, gfn_t gfn, void *data, int offset, |
| @@ -1240,11 +1270,21 @@ struct kvm_device_ops { · 502 unmodified lines | ||
| 1240 | 1270 | */ |
| 1241 | 1271 | void (*destroy)(struct kvm_device *dev); |
| 1242 | 1272 | |
| 1273 | + /* | |
| 1274 | + * Release is an alternative method to free the device. It is | |
| 1275 | + * called when the device file descriptor is closed. Once | |
| 1276 | + * release is called, the destroy method will not be called | |
| 1277 | + * anymore as the device is removed from the device list of | |
| 1278 | + * the VM. kvm->lock is held. | |
| 1279 | + */ | |
| 1280 | + void (*release)(struct kvm_device *dev); | |
| 1281 | + | |
| 1243 | 1282 | int (*set_attr)(struct kvm_device *dev, struct kvm_device_attr *attr); |
| 1244 | 1283 | int (*get_attr)(struct kvm_device *dev, struct kvm_device_attr *attr); |
| 1245 | 1284 | int (*has_attr)(struct kvm_device *dev, struct kvm_device_attr *attr); |
| 1246 | 1285 | long (*ioctl)(struct kvm_device *dev, unsigned int ioctl, |
| 1247 | 1286 | unsigned long arg); |
| 1287 | + int (*mmap)(struct kvm_device *dev, struct vm_area_struct *vma); | |
| 1248 | 1288 | }; |
| 1249 | 1289 | |
| 1250 | 1290 | void kvm_device_get(struct kvm_device *dev); |
| @@ -1305,6 +1345,16 @@ static inline bool vcpu_valid_wakeup(struct kvm_vcpu *vcpu) · 54 unmodified lines | ||
| 1305 | 1345 | } |
| 1306 | 1346 | #endif /* CONFIG_HAVE_KVM_INVALID_WAKEUPS */ |
| 1307 | 1347 | |
| 1348 | +#ifdef CONFIG_HAVE_KVM_NO_POLL | |
| 1349 | +/* Callback that tells if we must not poll */ | |
| 1350 | +bool kvm_arch_no_poll(struct kvm_vcpu *vcpu); | |
| 1351 | +#else | |
| 1352 | +static inline bool kvm_arch_no_poll(struct kvm_vcpu *vcpu) | |
| 1353 | +{ | |
| 1354 | + return false; | |
| 1355 | +} | |
| 1356 | +#endif /* CONFIG_HAVE_KVM_NO_POLL */ | |
| 1357 | + | |
| 1308 | 1358 | #ifdef CONFIG_HAVE_KVM_VCPU_ASYNC_IOCTL |
| 1309 | 1359 | long kvm_arch_vcpu_async_ioctl(struct file *filp, |
| 1310 | 1360 | unsigned int ioctl, unsigned long arg); |
| @@ -36,7 +36,7 @@ account_scheduler_latency(struct task_struct *task, int usecs, int inter) · 35 unmodified lines | ||
| 36 | 36 | __account_scheduler_latency(task, usecs, inter); |
| 37 | 37 | } |
| 38 | 38 | |
| 39 | −void clear_all_latency_tracing(struct task_struct *p); | |
| 39 | +void clear_tsk_latency_tracing(struct task_struct *p); | |
| 40 | 40 | |
| 41 | 41 | extern int sysctl_latencytop(struct ctl_table *table, int write, |
| 42 | 42 | void __user *buffer, size_t *lenp, loff_t *ppos); |
| @@ -48,7 +48,7 @@ account_scheduler_latency(struct task_struct *task, int usecs, int inter) · 5 unmodified lines | ||
| 48 | 48 | { |
| 49 | 49 | } |
| 50 | 50 | |
| 51 | −static inline void clear_all_latency_tracing(struct task_struct *p) | |
| 51 | +static inline void clear_tsk_latency_tracing(struct task_struct *p) | |
| 52 | 52 | { |
| 53 | 53 | } |
| 54 | 54 | |
| @@ -358,6 +358,7 @@ struct nvm_geo { · 357 unmodified lines | ||
| 358 | 358 | u16 csecs; /* sector size */ |
| 359 | 359 | u16 sos; /* out-of-band area size */ |
| 360 | 360 | bool ext; /* metadata in extended data buffer */ |
| 361 | + u32 mdts; /* Max data transfer size*/ | |
| 361 | 362 | |
| 362 | 363 | /* device write constrains */ |
| 363 | 364 | u32 ws_min; /* minimum write size */ |
| @@ -427,6 +428,7 @@ struct nvm_dev { · 63 unmodified lines | ||
| 427 | 428 | char name[DISK_NAME_LEN]; |
| 428 | 429 | void *private_data; |
| 429 | 430 | |
| 431 | + struct kref ref; | |
| 430 | 432 | void *rmap; |
| 431 | 433 | |
| 432 | 434 | struct mutex mlock; |
| @@ -150,6 +150,23 @@ static inline void list_replace_init(struct list_head *old, · 149 unmodified lines | ||
| 150 | 150 | INIT_LIST_HEAD(old); |
| 151 | 151 | } |
| 152 | 152 | |
| 153 | +/** | |
| 154 | + * list_swap - replace entry1 with entry2 and re-add entry1 at entry2's position | |
| 155 | + * @entry1: the location to place entry2 | |
| 156 | + * @entry2: the location to place entry1 | |
| 157 | + */ | |
| 158 | +static inline void list_swap(struct list_head *entry1, | |
| 159 | + struct list_head *entry2) | |
| 160 | +{ | |
| 161 | + struct list_head *pos = entry2->prev; | |
| 162 | + | |
| 163 | + list_del(entry2); | |
| 164 | + list_replace(entry1, entry2); | |
| 165 | + if (pos == entry1) | |
| 166 | + pos = entry2; | |
| 167 | + list_add(entry1, pos); | |
| 168 | +} | |
| 169 | + | |
| 153 | 170 | /** |
| 154 | 171 | * list_del_init - deletes entry from list and reinitialize it. |
| 155 | 172 | * @entry: the element to delete from the list. |
| @@ -270,6 +287,24 @@ static inline void list_rotate_left(struct list_head *head) · 114 unmodified lines | ||
| 270 | 287 | } |
| 271 | 288 | } |
| 272 | 289 | |
| 290 | +/** | |
| 291 | + * list_rotate_to_front() - Rotate list to specific item. | |
| 292 | + * @list: The desired new front of the list. | |
| 293 | + * @head: The head of the list. | |
| 294 | + * | |
| 295 | + * Rotates list so that @list becomes the new front of the list. | |
| 296 | + */ | |
| 297 | +static inline void list_rotate_to_front(struct list_head *list, | |
| 298 | + struct list_head *head) | |
| 299 | +{ | |
| 300 | + /* | |
| 301 | + * Deletes the list head from the list denoted by @head and | |
| 302 | + * places it as the tail of @list, this effectively rotates the | |
| 303 | + * list so that @list is at the front. | |
| 304 | + */ | |
| 305 | + list_move_tail(head, list); | |
| 306 | +} | |
| 307 | + | |
| 273 | 308 | /** |
| 274 | 309 | * list_is_singular - tests whether a list has just one entry. |
| 275 | 310 | * @head: the list to test. |
| @@ -754,7 +789,7 @@ static inline void hlist_add_behind(struct hlist_node *n, · 478 unmodified lines | ||
| 754 | 789 | struct hlist_node *prev) |
| 755 | 790 | { |
| 756 | 791 | n->next = prev->next; |
| 757 | − WRITE_ONCE(prev->next, n); | |
| 792 | + prev->next = n; | |
| 758 | 793 | n->pprev = &prev->next; |
| 759 | 794 | |
| 760 | 795 | if (n->next) |
| @@ -86,6 +86,32 @@ static inline void hlist_bl_add_head(struct hlist_bl_node *n, · 85 unmodified lines | ||
| 86 | 86 | hlist_bl_set_first(h, n); |
| 87 | 87 | } |
| 88 | 88 | |
| 89 | +static inline void hlist_bl_add_before(struct hlist_bl_node *n, | |
| 90 | + struct hlist_bl_node *next) | |
| 91 | +{ | |
| 92 | + struct hlist_bl_node **pprev = next->pprev; | |
| 93 | + | |
| 94 | + n->pprev = pprev; | |
| 95 | + n->next = next; | |
| 96 | + next->pprev = &n->next; | |
| 97 | + | |
| 98 | + /* pprev may be `first`, so be careful not to lose the lock bit */ | |
| 99 | + WRITE_ONCE(*pprev, | |
| 100 | + (struct hlist_bl_node *) | |
| 101 | + ((uintptr_t)n | ((uintptr_t)*pprev & LIST_BL_LOCKMASK))); | |
| 102 | +} | |
| 103 | + | |
| 104 | +static inline void hlist_bl_add_behind(struct hlist_bl_node *n, | |
| 105 | + struct hlist_bl_node *prev) | |
| 106 | +{ | |
| 107 | + n->next = prev->next; | |
| 108 | + n->pprev = &prev->next; | |
| 109 | + prev->next = n; | |
| 110 | + | |
| 111 | + if (n->next) | |
| 112 | + n->next->pprev = &n->next; | |
| 113 | +} | |
| 114 | + | |
| 89 | 115 | static inline void __hlist_bl_del(struct hlist_bl_node *n) |
| 90 | 116 | { |
| 91 | 117 | struct hlist_bl_node *next = n->next; |
| @@ -6,6 +6,7 @@ · 5 unmodified lines | ||
| 6 | 6 | |
| 7 | 7 | struct list_head; |
| 8 | 8 | |
| 9 | +__attribute__((nonnull(2,3))) | |
| 9 | 10 | void list_sort(void *priv, struct list_head *head, |
| 10 | 11 | int (*cmp)(void *priv, struct list_head *a, |
| 11 | 12 | struct list_head *b)); |
| @@ -86,7 +86,6 @@ struct klp_func { · 85 unmodified lines | ||
| 86 | 86 | struct list_head node; |
| 87 | 87 | struct list_head stack_node; |
| 88 | 88 | unsigned long old_size, new_size; |
| 89 | − bool kobj_added; | |
| 90 | 89 | bool nop; |
| 91 | 90 | bool patched; |
| 92 | 91 | bool transition; |
| @@ -141,7 +140,6 @@ struct klp_object { · 48 unmodified lines | ||
| 141 | 140 | struct list_head func_list; |
| 142 | 141 | struct list_head node; |
| 143 | 142 | struct module *mod; |
| 144 | − bool kobj_added; | |
| 145 | 143 | bool dynamic; |
| 146 | 144 | bool patched; |
| 147 | 145 | }; |
| @@ -170,7 +168,6 @@ struct klp_patch { · 22 unmodified lines | ||
| 170 | 168 | struct list_head list; |
| 171 | 169 | struct kobject kobj; |
| 172 | 170 | struct list_head obj_list; |
| 173 | − bool kobj_added; | |
| 174 | 171 | bool enabled; |
| 175 | 172 | bool forced; |
| 176 | 173 | struct work_struct free_work; |
| @@ -46,6 +46,7 @@ struct nlmclnt_initdata { · 45 unmodified lines | ||
| 46 | 46 | int noresvport; |
| 47 | 47 | struct net *net; |
| 48 | 48 | const struct nlmclnt_operations *nlmclnt_ops; |
| 49 | + const struct cred *cred; | |
| 49 | 50 | }; |
| 50 | 51 | |
| 51 | 52 | /* |
| @@ -75,7 +76,7 @@ struct nlmclnt_operations { · 23 unmodified lines | ||
| 75 | 76 | }; |
| 76 | 77 | |
| 77 | 78 | extern int nlmclnt_proc(struct nlm_host *host, int cmd, struct file_lock *fl, void *data); |
| 78 | −extern int lockd_up(struct net *net); | |
| 79 | +extern int lockd_up(struct net *net, const struct cred *cred); | |
| 79 | 80 | extern void lockd_down(struct net *net); |
| 80 | 81 | |
| 81 | 82 | #endif /* LINUX_LOCKD_BIND_H */ |
| @@ -70,6 +70,7 @@ struct nlm_host { · 69 unmodified lines | ||
| 70 | 70 | struct nsm_handle *h_nsmhandle; /* NSM status handle */ |
| 71 | 71 | char *h_addrbuf; /* address eyecatcher */ |
| 72 | 72 | struct net *net; /* host net */ |
| 73 | + const struct cred *h_cred; | |
| 73 | 74 | char nodename[UNX_MAXNODENAME + 1]; |
| 74 | 75 | const struct nlmclnt_operations *h_nlmclnt_ops; /* Callback ops for NLM users */ |
| 75 | 76 | }; |
| @@ -229,7 +230,8 @@ struct nlm_host *nlmclnt_lookup_host(const struct sockaddr *sap, · 153 unmodified lines | ||
| 229 | 230 | const u32 version, |
| 230 | 231 | const char *hostname, |
| 231 | 232 | int noresvport, |
| 232 | − struct net *net); | |
| 233 | + struct net *net, | |
| 234 | + const struct cred *cred); | |
| 233 | 235 | void nlmclnt_release_host(struct nlm_host *); |
| 234 | 236 | struct nlm_host *nlmsvc_lookup_host(const struct svc_rqst *rqstp, |
| 235 | 237 | const char *hostname, |
| @@ -66,6 +66,11 @@ struct lock_class_key { · 65 unmodified lines | ||
| 66 | 66 | |
| 67 | 67 | extern struct lock_class_key __lockdep_no_validate__; |
| 68 | 68 | |
| 69 | +struct lock_trace { | |
| 70 | + unsigned int nr_entries; | |
| 71 | + unsigned int offset; | |
| 72 | +}; | |
| 73 | + | |
| 69 | 74 | #define LOCKSTAT_POINTS 4 |
| 70 | 75 | |
| 71 | 76 | /* |
| @@ -100,7 +105,7 @@ struct lock_class { · 28 unmodified lines | ||
| 100 | 105 | * IRQ/softirq usage tracking bits: |
| 101 | 106 | */ |
| 102 | 107 | unsigned long usage_mask; |
| 103 | − struct stack_trace usage_traces[XXX_LOCK_USAGE_STATES]; | |
| 108 | + struct lock_trace usage_traces[XXX_LOCK_USAGE_STATES]; | |
| 104 | 109 | |
| 105 | 110 | /* |
| 106 | 111 | * Generation counter, when doing certain classes of graph walking, |
| @@ -188,7 +193,7 @@ struct lock_list { · 81 unmodified lines | ||
| 188 | 193 | struct list_head entry; |
| 189 | 194 | struct lock_class *class; |
| 190 | 195 | struct lock_class *links_to; |
| 191 | − struct stack_trace trace; | |
| 196 | + struct lock_trace trace; | |
| 192 | 197 | int distance; |
| 193 | 198 | |
| 194 | 199 | /* |
| @@ -471,7 +476,7 @@ struct pin_cookie { }; · 276 unmodified lines | ||
| 471 | 476 | |
| 472 | 477 | #define NIL_COOKIE (struct pin_cookie){ } |
| 473 | 478 | |
| 474 | −#define lockdep_pin_lock(l) ({ struct pin_cookie cookie; cookie; }) | |
| 479 | +#define lockdep_pin_lock(l) ({ struct pin_cookie cookie = { }; cookie; }) | |
| 475 | 480 | #define lockdep_repin_lock(l, c) do { (void)(l); (void)(c); } while (0) |
| 476 | 481 | #define lockdep_unpin_lock(l, c) do { (void)(l); (void)(c); } while (0) |
| 477 | 482 | |
| @@ -127,7 +127,6 @@ · 126 unmodified lines | ||
| 127 | 127 | * options cleanly (a filesystem may modify the data e.g. with strsep()). |
| 128 | 128 | * This also allows the original mount data to be stripped of security- |
| 129 | 129 | * specific options to avoid having to make filesystems aware of them. |
| 130 | − * @type the type of filesystem being mounted. | |
| 131 | 130 | * @orig the original mount data copied from userspace. |
| 132 | 131 | * @copy copied data which will be passed to the security module. |
| 133 | 132 | * Returns 0 if the copy was successful. |
| @@ -160,6 +159,10 @@ · 26 unmodified lines | ||
| 160 | 159 | * Parse a string of security data filling in the opts structure |
| 161 | 160 | * @options string containing all mount options known by the LSM |
| 162 | 161 | * @opts binary data structure usable by the LSM |
| 162 | + * @move_mount: | |
| 163 | + * Check permission before a mount is moved. | |
| 164 | + * @from_path indicates the mount that is going to be moved. | |
| 165 | + * @to_path indicates the mountpoint that will be mounted upon. | |
| 163 | 166 | * @dentry_init_security: |
| 164 | 167 | * Compute a context for a dentry as the inode is not yet available |
| 165 | 168 | * since NFSv4 has no label backed by an EA anyway. |
| @@ -320,10 +323,11 @@ · 154 unmodified lines | ||
| 320 | 323 | * @new_dentry contains the dentry structure of the new link. |
| 321 | 324 | * Return 0 if permission is granted. |
| 322 | 325 | * @path_chmod: |
| 323 | − * Check for permission to change DAC's permission of a file or directory. | |
| 324 | − * @dentry contains the dentry structure. | |
| 325 | − * @mnt contains the vfsmnt structure. | |
| 326 | − * @mode contains DAC's mode. | |
| 326 | + * Check for permission to change a mode of the file @path. The new | |
| 327 | + * mode is specified in @mode. | |
| 328 | + * @path contains the path structure of the file to change the mode. | |
| 329 | + * @mode contains the new DAC's permission, which is a bitmask of | |
| 330 | + * constants from <include/uapi/linux/stat.h> | |
| 327 | 331 | * Return 0 if permission is granted. |
| 328 | 332 | * @path_chown: |
| 329 | 333 | * Check for permission to change owner/group of a file or directory. |
| @@ -445,6 +449,15 @@ · 115 unmodified lines | ||
| 445 | 449 | * to abort the copy up. Note that the caller is responsible for reading |
| 446 | 450 | * and writing the xattrs as this hook is merely a filter. |
| 447 | 451 | * |
| 452 | + * Security hooks for kernfs node operations | |
| 453 | + * | |
| 454 | + * @kernfs_init_security: | |
| 455 | + * Initialize the security context of a newly created kernfs node based | |
| 456 | + * on its own and its parent's attributes. | |
| 457 | + * | |
| 458 | + * @kn_dir the parent kernfs node | |
| 459 | + * @kn the new child kernfs node | |
| 460 | + * | |
| 448 | 461 | * Security hooks for file operations |
| 449 | 462 | * |
| 450 | 463 | * @file_permission: |
| @@ -502,7 +515,7 @@ · 51 unmodified lines | ||
| 502 | 515 | * Return 0 if permission is granted. |
| 503 | 516 | * @file_lock: |
| 504 | 517 | * Check permission before performing file locking operations. |
| 505 | − * Note: this hook mediates both flock and fcntl style locks. | |
| 518 | + * Note the hook mediates both flock and fcntl style locks. | |
| 506 | 519 | * @file contains the file structure. |
| 507 | 520 | * @cmd contains the posix-translated lock operation to perform |
| 508 | 521 | * (e.g. F_RDLCK, F_WRLCK). |
| @@ -645,12 +658,12 @@ · 136 unmodified lines | ||
| 645 | 658 | * @p contains the task_struct of process. |
| 646 | 659 | * @nice contains the new nice value. |
| 647 | 660 | * Return 0 if permission is granted. |
| 648 | − * @task_setioprio | |
| 661 | + * @task_setioprio: | |
| 649 | 662 | * Check permission before setting the ioprio value of @p to @ioprio. |
| 650 | 663 | * @p contains the task_struct of process. |
| 651 | 664 | * @ioprio contains the new ioprio value |
| 652 | 665 | * Return 0 if permission is granted. |
| 653 | − * @task_getioprio | |
| 666 | + * @task_getioprio: | |
| 654 | 667 | * Check permission before getting the ioprio value of @p. |
| 655 | 668 | * @p contains the task_struct of process. |
| 656 | 669 | * Return 0 if permission is granted. |
| @@ -672,17 +685,15 @@ · 15 unmodified lines | ||
| 672 | 685 | * Return 0 if permission is granted. |
| 673 | 686 | * @task_setscheduler: |
| 674 | 687 | * Check permission before setting scheduling policy and/or parameters of |
| 675 | − * process @p based on @policy and @lp. | |
| 688 | + * process @p. | |
| 676 | 689 | * @p contains the task_struct for process. |
| 677 | − * @policy contains the scheduling policy. | |
| 678 | − * @lp contains the scheduling parameters. | |
| 679 | 690 | * Return 0 if permission is granted. |
| 680 | 691 | * @task_getscheduler: |
| 681 | 692 | * Check permission before obtaining scheduling information for process |
| 682 | 693 | * @p. |
| 683 | 694 | * @p contains the task_struct for process. |
| 684 | 695 | * Return 0 if permission is granted. |
| 685 | − * @task_movememory | |
| 696 | + * @task_movememory: | |
| 686 | 697 | * Check permission before moving memory owned by process @p. |
| 687 | 698 | * @p contains the task_struct for process. |
| 688 | 699 | * Return 0 if permission is granted. |
| @@ -769,9 +780,9 @@ · 80 unmodified lines | ||
| 769 | 780 | * socket structure, but rather, the socket security information is stored |
| 770 | 781 | * in the associated inode. Typically, the inode alloc_security hook will |
| 771 | 782 | * allocate and and attach security information to |
| 772 | − * sock->inode->i_security. This hook may be used to update the | |
| 773 | − * sock->inode->i_security field with additional information that wasn't | |
| 774 | − * available when the inode was allocated. | |
| 783 | + * SOCK_INODE(sock)->i_security. This hook may be used to update the | |
| 784 | + * SOCK_INODE(sock)->i_security field with additional information that | |
| 785 | + * wasn't available when the inode was allocated. | |
| 775 | 786 | * @sock contains the newly created socket structure. |
| 776 | 787 | * @family contains the requested protocol family. |
| 777 | 788 | * @type contains the requested communications type. |
| @@ -876,13 +887,13 @@ · 98 unmodified lines | ||
| 876 | 887 | * @socket_getpeersec_dgram: |
| 877 | 888 | * This hook allows the security module to provide peer socket security |
| 878 | 889 | * state for udp sockets on a per-packet basis to userspace via |
| 879 | − * getsockopt SO_GETPEERSEC. The application must first have indicated | |
| 880 | − * the IP_PASSSEC option via getsockopt. It can then retrieve the | |
| 890 | + * getsockopt SO_GETPEERSEC. The application must first have indicated | |
| 891 | + * the IP_PASSSEC option via getsockopt. It can then retrieve the | |
| 881 | 892 | * security state returned by this hook for a packet via the SCM_SECURITY |
| 882 | 893 | * ancillary message type. |
| 883 | − * @skb is the skbuff for the packet being queried | |
| 884 | − * @secdata is a pointer to a buffer in which to copy the security data | |
| 885 | − * @seclen is the maximum length for @secdata | |
| 894 | + * @sock contains the peer socket. May be NULL. | |
| 895 | + * @skb is the sk_buff for the packet being queried. May be NULL. | |
| 896 | + * @secid pointer to store the secid of the packet. | |
| 886 | 897 | * Return 0 on success, error on failure. |
| 887 | 898 | * @sk_alloc_security: |
| 888 | 899 | * Allocate and attach a security structure to the sk->sk_security field, |
| @@ -906,9 +917,9 @@ · 17 unmodified lines | ||
| 906 | 917 | * @secmark_relabel_packet: |
| 907 | 918 | * check if the process should be allowed to relabel packets to |
| 908 | 919 | * the given secid |
| 909 | − * @security_secmark_refcount_inc | |
| 920 | + * @secmark_refcount_inc: | |
| 910 | 921 | * tells the LSM to increment the number of secmark labeling rules loaded |
| 911 | − * @security_secmark_refcount_dec | |
| 922 | + * @secmark_refcount_dec: | |
| 912 | 923 | * tells the LSM to decrement the number of secmark labeling rules loaded |
| 913 | 924 | * @req_classify_flow: |
| 914 | 925 | * Sets the flow's sid to the openreq sid. |
| @@ -1113,41 +1124,41 @@ · 198 unmodified lines | ||
| 1113 | 1124 | * |
| 1114 | 1125 | * @msg_queue_alloc_security: |
| 1115 | 1126 | * Allocate and attach a security structure to the |
| 1116 | − * msq->q_perm.security field. The security field is initialized to | |
| 1127 | + * @perm->security field. The security field is initialized to | |
| 1117 | 1128 | * NULL when the structure is first created. |
| 1118 | − * @msq contains the message queue structure to be modified. | |
| 1129 | + * @perm contains the IPC permissions of the message queue. | |
| 1119 | 1130 | * Return 0 if operation was successful and permission is granted. |
| 1120 | 1131 | * @msg_queue_free_security: |
| 1121 | − * Deallocate security structure for this message queue. | |
| 1122 | − * @msq contains the message queue structure to be modified. | |
| 1132 | + * Deallocate security field @perm->security for the message queue. | |
| 1133 | + * @perm contains the IPC permissions of the message queue. | |
| 1123 | 1134 | * @msg_queue_associate: |
| 1124 | 1135 | * Check permission when a message queue is requested through the |
| 1125 | − * msgget system call. This hook is only called when returning the | |
| 1136 | + * msgget system call. This hook is only called when returning the | |
| 1126 | 1137 | * message queue identifier for an existing message queue, not when a |
| 1127 | 1138 | * new message queue is created. |
| 1128 | − * @msq contains the message queue to act upon. | |
| 1139 | + * @perm contains the IPC permissions of the message queue. | |
| 1129 | 1140 | * @msqflg contains the operation control flags. |
| 1130 | 1141 | * Return 0 if permission is granted. |
| 1131 | 1142 | * @msg_queue_msgctl: |
| 1132 | 1143 | * Check permission when a message control operation specified by @cmd |
| 1133 | − * is to be performed on the message queue @msq. | |
| 1134 | − * The @msq may be NULL, e.g. for IPC_INFO or MSG_INFO. | |
| 1135 | − * @msq contains the message queue to act upon. May be NULL. | |
| 1144 | + * is to be performed on the message queue with permissions @perm. | |
| 1145 | + * The @perm may be NULL, e.g. for IPC_INFO or MSG_INFO. | |
| 1146 | + * @perm contains the IPC permissions of the msg queue. May be NULL. | |
| 1136 | 1147 | * @cmd contains the operation to be performed. |
| 1137 | 1148 | * Return 0 if permission is granted. |
| 1138 | 1149 | * @msg_queue_msgsnd: |
| 1139 | 1150 | * Check permission before a message, @msg, is enqueued on the message |
| 1140 | − * queue, @msq. | |
| 1141 | − * @msq contains the message queue to send message to. | |
| 1151 | + * queue with permissions @perm. | |
| 1152 | + * @perm contains the IPC permissions of the message queue. | |
| 1142 | 1153 | * @msg contains the message to be enqueued. |
| 1143 | 1154 | * @msqflg contains operational flags. |
| 1144 | 1155 | * Return 0 if permission is granted. |
| 1145 | 1156 | * @msg_queue_msgrcv: |
| 1146 | 1157 | * Check permission before a message, @msg, is removed from the message |
| 1147 | − * queue, @msq. The @target task structure contains a pointer to the | |
| 1158 | + * queue. The @target task structure contains a pointer to the | |
| 1148 | 1159 | * process that will be receiving the message (not equal to the current |
| 1149 | 1160 | * process when inline receives are being performed). |
| 1150 | − * @msq contains the message queue to retrieve message from. | |
| 1161 | + * @perm contains the IPC permissions of the message queue. | |
| 1151 | 1162 | * @msg contains the message destination. |
| 1152 | 1163 | * @target contains the task structure for recipient process. |
| 1153 | 1164 | * @type contains the type of message requested. |
| @@ -1157,34 +1168,34 @@ · 3 unmodified lines | ||
| 1157 | 1168 | * Security hooks for System V Shared Memory Segments |
| 1158 | 1169 | * |
| 1159 | 1170 | * @shm_alloc_security: |
| 1160 | − * Allocate and attach a security structure to the shp->shm_perm.security | |
| 1161 | − * field. The security field is initialized to NULL when the structure is | |
| 1171 | + * Allocate and attach a security structure to the @perm->security | |
| 1172 | + * field. The security field is initialized to NULL when the structure is | |
| 1162 | 1173 | * first created. |
| 1163 | − * @shp contains the shared memory structure to be modified. | |
| 1174 | + * @perm contains the IPC permissions of the shared memory structure. | |
| 1164 | 1175 | * Return 0 if operation was successful and permission is granted. |
| 1165 | 1176 | * @shm_free_security: |
| 1166 | − * Deallocate the security struct for this memory segment. | |
| 1167 | − * @shp contains the shared memory structure to be modified. | |
| 1177 | + * Deallocate the security structure @perm->security for the memory segment. | |
| 1178 | + * @perm contains the IPC permissions of the shared memory structure. | |
| 1168 | 1179 | * @shm_associate: |
| 1169 | 1180 | * Check permission when a shared memory region is requested through the |
| 1170 | − * shmget system call. This hook is only called when returning the shared | |
| 1181 | + * shmget system call. This hook is only called when returning the shared | |
| 1171 | 1182 | * memory region identifier for an existing region, not when a new shared |
| 1172 | 1183 | * memory region is created. |
| 1173 | − * @shp contains the shared memory structure to be modified. | |
| 1184 | + * @perm contains the IPC permissions of the shared memory structure. | |
| 1174 | 1185 | * @shmflg contains the operation control flags. |
| 1175 | 1186 | * Return 0 if permission is granted. |
| 1176 | 1187 | * @shm_shmctl: |
| 1177 | 1188 | * Check permission when a shared memory control operation specified by |
| 1178 | − * @cmd is to be performed on the shared memory region @shp. | |
| 1179 | − * The @shp may be NULL, e.g. for IPC_INFO or SHM_INFO. | |
| 1180 | − * @shp contains shared memory structure to be modified. | |
| 1189 | + * @cmd is to be performed on the shared memory region with permissions @perm. | |
| 1190 | + * The @perm may be NULL, e.g. for IPC_INFO or SHM_INFO. | |
| 1191 | + * @perm contains the IPC permissions of the shared memory structure. | |
| 1181 | 1192 | * @cmd contains the operation to be performed. |
| 1182 | 1193 | * Return 0 if permission is granted. |
| 1183 | 1194 | * @shm_shmat: |
| 1184 | 1195 | * Check permissions prior to allowing the shmat system call to attach the |
| 1185 | − * shared memory segment @shp to the data segment of the calling process. | |
| 1186 | − * The attaching address is specified by @shmaddr. | |
| 1187 | − * @shp contains the shared memory structure to be modified. | |
| 1196 | + * shared memory segment with permissions @perm to the data segment of the | |
| 1197 | + * calling process. The attaching address is specified by @shmaddr. | |
| 1198 | + * @perm contains the IPC permissions of the shared memory structure. | |
| 1188 | 1199 | * @shmaddr contains the address to attach memory region to. |
| 1189 | 1200 | * @shmflg contains the operational flags. |
| 1190 | 1201 | * Return 0 if permission is granted. |
| @@ -1192,34 +1203,34 @@ · 1 unmodified line | ||
| 1192 | 1203 | * Security hooks for System V Semaphores |
| 1193 | 1204 | * |
| 1194 | 1205 | * @sem_alloc_security: |
| 1195 | − * Allocate and attach a security structure to the sma->sem_perm.security | |
| 1196 | − * field. The security field is initialized to NULL when the structure is | |
| 1206 | + * Allocate and attach a security structure to the @perm->security | |
| 1207 | + * field. The security field is initialized to NULL when the structure is | |
| 1197 | 1208 | * first created. |
| 1198 | − * @sma contains the semaphore structure | |
| 1209 | + * @perm contains the IPC permissions of the semaphore. | |
| 1199 | 1210 | * Return 0 if operation was successful and permission is granted. |
| 1200 | 1211 | * @sem_free_security: |
| 1201 | − * deallocate security struct for this semaphore | |
| 1202 | − * @sma contains the semaphore structure. | |
| 1212 | + * Deallocate security structure @perm->security for the semaphore. | |
| 1213 | + * @perm contains the IPC permissions of the semaphore. | |
| 1203 | 1214 | * @sem_associate: |
| 1204 | 1215 | * Check permission when a semaphore is requested through the semget |
| 1205 | − * system call. This hook is only called when returning the semaphore | |
| 1216 | + * system call. This hook is only called when returning the semaphore | |
| 1206 | 1217 | * identifier for an existing semaphore, not when a new one must be |
| 1207 | 1218 | * created. |
| 1208 | − * @sma contains the semaphore structure. | |
| 1219 | + * @perm contains the IPC permissions of the semaphore. | |
| 1209 | 1220 | * @semflg contains the operation control flags. |
| 1210 | 1221 | * Return 0 if permission is granted. |
| 1211 | 1222 | * @sem_semctl: |
| 1212 | 1223 | * Check permission when a semaphore operation specified by @cmd is to be |
| 1213 | − * performed on the semaphore @sma. The @sma may be NULL, e.g. for | |
| 1224 | + * performed on the semaphore. The @perm may be NULL, e.g. for | |
| 1214 | 1225 | * IPC_INFO or SEM_INFO. |
| 1215 | − * @sma contains the semaphore structure. May be NULL. | |
| 1226 | + * @perm contains the IPC permissions of the semaphore. May be NULL. | |
| 1216 | 1227 | * @cmd contains the operation to be performed. |
| 1217 | 1228 | * Return 0 if permission is granted. |
| 1218 | 1229 | * @sem_semop: |
| 1219 | 1230 | * Check permissions before performing operations on members of the |
| 1220 | − * semaphore set @sma. If the @alter flag is nonzero, the semaphore set | |
| 1231 | + * semaphore set. If the @alter flag is nonzero, the semaphore set | |
| 1221 | 1232 | * may be modified. |
| 1222 | − * @sma contains the semaphore structure. | |
| 1233 | + * @perm contains the IPC permissions of the semaphore. | |
| 1223 | 1234 | * @sops contains the operations to perform. |
| 1224 | 1235 | * @nsops contains the number of operations to perform. |
| 1225 | 1236 | * @alter contains the flag indicating whether changes are to be made. |
| @@ -1292,13 +1303,12 @@ · 66 unmodified lines | ||
| 1292 | 1303 | * Check permission before accessing the kernel message ring or changing |
| 1293 | 1304 | * logging to the console. |
| 1294 | 1305 | * See the syslog(2) manual page for an explanation of the @type values. |
| 1295 | − * @type contains the type of action. | |
| 1296 | − * @from_file indicates the context of action (if it came from /proc). | |
| 1306 | + * @type contains the SYSLOG_ACTION_* constant from <include/linux/syslog.h> | |
| 1297 | 1307 | * Return 0 if permission is granted. |
| 1298 | 1308 | * @settime: |
| 1299 | 1309 | * Check permission to change the system time. |
| 1300 | − * struct timespec64 is defined in include/linux/time64.h and timezone | |
| 1301 | − * is defined in include/linux/time.h | |
| 1310 | + * struct timespec64 is defined in <include/linux/time64.h> and timezone | |
| 1311 | + * is defined in <include/linux/time.h> | |
| 1302 | 1312 | * @ts contains new time |
| 1303 | 1313 | * @tz contains new timezone |
| 1304 | 1314 | * Return 0 if permission is granted. |
| @@ -1340,7 +1350,7 @@ · 35 unmodified lines | ||
| 1340 | 1350 | * @audit_rule_init: |
| 1341 | 1351 | * Allocate and initialize an LSM audit rule structure. |
| 1342 | 1352 | * @field contains the required Audit action. |
| 1343 | − * Fields flags are defined in include/linux/audit.h | |
| 1353 | + * Fields flags are defined in <include/linux/audit.h> | |
| 1344 | 1354 | * @op contains the operator the rule uses. |
| 1345 | 1355 | * @rulestr contains the context where the rule will be applied to. |
| 1346 | 1356 | * @lsmrule contains a pointer to receive the result. |
| @@ -1348,9 +1358,9 @@ · 1 unmodified line | ||
| 1348 | 1358 | * -EINVAL in case of an invalid rule. |
| 1349 | 1359 | * |
| 1350 | 1360 | * @audit_rule_known: |
| 1351 | − * Specifies whether given @rule contains any fields related to | |
| 1361 | + * Specifies whether given @krule contains any fields related to | |
| 1352 | 1362 | * current LSM. |
| 1353 | − * @rule contains the audit rule of interest. | |
| 1363 | + * @krule contains the audit rule of interest. | |
| 1354 | 1364 | * Return 1 in case of relation found, 0 otherwise. |
| 1355 | 1365 | * |
| 1356 | 1366 | * @audit_rule_match: |
| @@ -1359,13 +1369,13 @@ · 2 unmodified lines | ||
| 1359 | 1369 | * @secid contains the security id in question. |
| 1360 | 1370 | * @field contains the field which relates to current LSM. |
| 1361 | 1371 | * @op contains the operator that will be used for matching. |
| 1362 | − * @rule points to the audit rule that will be checked against. | |
| 1372 | + * @lrule points to the audit rule that will be checked against. | |
| 1363 | 1373 | * Return 1 if secid matches the rule, 0 if it does not, -ERRNO on failure. |
| 1364 | 1374 | * |
| 1365 | 1375 | * @audit_rule_free: |
| 1366 | 1376 | * Deallocate the LSM audit rule structure previously allocated by |
| 1367 | 1377 | * audit_rule_init. |
| 1368 | − * @rule contains the allocated rule | |
| 1378 | + * @lsmrule contains the allocated rule | |
| 1369 | 1379 | * |
| 1370 | 1380 | * @inode_invalidate_secctx: |
| 1371 | 1381 | * Notify the security module that it must revalidate the security context |
| @@ -1378,9 +1388,7 @@ · 6 unmodified lines | ||
| 1378 | 1388 | * this hook to initialize the security context in its incore inode to the |
| 1379 | 1389 | * value provided by the server for the file when the server returned the |
| 1380 | 1390 | * file's attributes to the client. |
| 1381 | − * | |
| 1382 | 1391 | * Must be called with inode->i_mutex locked. |
| 1383 | − * | |
| 1384 | 1392 | * @inode we wish to set the security context of. |
| 1385 | 1393 | * @ctx contains the string which we wish to set in the inode. |
| 1386 | 1394 | * @ctxlen contains the length of @ctx. |
| @@ -1393,9 +1401,7 @@ · 6 unmodified lines | ||
| 1393 | 1401 | * this hook to change the security context in its incore inode and on the |
| 1394 | 1402 | * backing filesystem to a value provided by the client on a SETATTR |
| 1395 | 1403 | * operation. |
| 1396 | − * | |
| 1397 | 1404 | * Must be called with inode->i_mutex locked. |
| 1398 | − * | |
| 1399 | 1405 | * @dentry contains the inode we wish to set the security context of. |
| 1400 | 1406 | * @ctx contains the string which we wish to set in the inode. |
| 1401 | 1407 | * @ctxlen contains the length of @ctx. |
| @@ -1403,7 +1409,6 @@ · 1 unmodified line | ||
| 1403 | 1409 | * @inode_getsecctx: |
| 1404 | 1410 | * On success, returns 0 and fills out @ctx and @ctxlen with the security |
| 1405 | 1411 | * context for the given @inode. |
| 1406 | − * | |
| 1407 | 1412 | * @inode we wish to get the security context of. |
| 1408 | 1413 | * @ctx is a pointer in which to place the allocated security context. |
| 1409 | 1414 | * @ctxlen points to the place to put the length of @ctx. |
| @@ -1501,6 +1506,7 @@ union security_list_options { · 91 unmodified lines | ||
| 1501 | 1506 | unsigned long *set_kern_flags); |
| 1502 | 1507 | int (*sb_add_mnt_opt)(const char *option, const char *val, int len, |
| 1503 | 1508 | void **mnt_opts); |
| 1509 | + int (*move_mount)(const struct path *from_path, const struct path *to_path); | |
| 1504 | 1510 | int (*dentry_init_security)(struct dentry *dentry, int mode, |
| 1505 | 1511 | const struct qstr *name, void **ctx, |
| 1506 | 1512 | u32 *ctxlen); |
| @@ -1578,6 +1584,9 @@ union security_list_options { · 71 unmodified lines | ||
| 1578 | 1584 | int (*inode_copy_up)(struct dentry *src, struct cred **new); |
| 1579 | 1585 | int (*inode_copy_up_xattr)(const char *name); |
| 1580 | 1586 | |
| 1587 | + int (*kernfs_init_security)(struct kernfs_node *kn_dir, | |
| 1588 | + struct kernfs_node *kn); | |
| 1589 | + | |
| 1581 | 1590 | int (*file_permission)(struct file *file, int mask); |
| 1582 | 1591 | int (*file_alloc_security)(struct file *file); |
| 1583 | 1592 | void (*file_free_security)(struct file *file); |
| @@ -1640,28 +1649,28 @@ union security_list_options { · 56 unmodified lines | ||
| 1640 | 1649 | int (*msg_msg_alloc_security)(struct msg_msg *msg); |
| 1641 | 1650 | void (*msg_msg_free_security)(struct msg_msg *msg); |
| 1642 | 1651 | |
| 1643 | − int (*msg_queue_alloc_security)(struct kern_ipc_perm *msq); | |
| 1644 | − void (*msg_queue_free_security)(struct kern_ipc_perm *msq); | |
| 1645 | − int (*msg_queue_associate)(struct kern_ipc_perm *msq, int msqflg); | |
| 1646 | − int (*msg_queue_msgctl)(struct kern_ipc_perm *msq, int cmd); | |
| 1647 | − int (*msg_queue_msgsnd)(struct kern_ipc_perm *msq, struct msg_msg *msg, | |
| 1652 | + int (*msg_queue_alloc_security)(struct kern_ipc_perm *perm); | |
| 1653 | + void (*msg_queue_free_security)(struct kern_ipc_perm *perm); | |
| 1654 | + int (*msg_queue_associate)(struct kern_ipc_perm *perm, int msqflg); | |
| 1655 | + int (*msg_queue_msgctl)(struct kern_ipc_perm *perm, int cmd); | |
| 1656 | + int (*msg_queue_msgsnd)(struct kern_ipc_perm *perm, struct msg_msg *msg, | |
| 1648 | 1657 | int msqflg); |
| 1649 | − int (*msg_queue_msgrcv)(struct kern_ipc_perm *msq, struct msg_msg *msg, | |
| 1658 | + int (*msg_queue_msgrcv)(struct kern_ipc_perm *perm, struct msg_msg *msg, | |
| 1650 | 1659 | struct task_struct *target, long type, |
| 1651 | 1660 | int mode); |
| 1652 | 1661 | |
| 1653 | − int (*shm_alloc_security)(struct kern_ipc_perm *shp); | |
| 1654 | − void (*shm_free_security)(struct kern_ipc_perm *shp); | |
| 1655 | − int (*shm_associate)(struct kern_ipc_perm *shp, int shmflg); | |
| 1656 | − int (*shm_shmctl)(struct kern_ipc_perm *shp, int cmd); | |
| 1657 | − int (*shm_shmat)(struct kern_ipc_perm *shp, char __user *shmaddr, | |
| 1662 | + int (*shm_alloc_security)(struct kern_ipc_perm *perm); | |
| 1663 | + void (*shm_free_security)(struct kern_ipc_perm *perm); | |
| 1664 | + int (*shm_associate)(struct kern_ipc_perm *perm, int shmflg); | |
| 1665 | + int (*shm_shmctl)(struct kern_ipc_perm *perm, int cmd); | |
| 1666 | + int (*shm_shmat)(struct kern_ipc_perm *perm, char __user *shmaddr, | |
| 1658 | 1667 | int shmflg); |
| 1659 | 1668 | |
| 1660 | − int (*sem_alloc_security)(struct kern_ipc_perm *sma); | |
| 1661 | − void (*sem_free_security)(struct kern_ipc_perm *sma); | |
| 1662 | − int (*sem_associate)(struct kern_ipc_perm *sma, int semflg); | |
| 1663 | − int (*sem_semctl)(struct kern_ipc_perm *sma, int cmd); | |
| 1664 | − int (*sem_semop)(struct kern_ipc_perm *sma, struct sembuf *sops, | |
| 1669 | + int (*sem_alloc_security)(struct kern_ipc_perm *perm); | |
| 1670 | + void (*sem_free_security)(struct kern_ipc_perm *perm); | |
| 1671 | + int (*sem_associate)(struct kern_ipc_perm *perm, int semflg); | |
| 1672 | + int (*sem_semctl)(struct kern_ipc_perm *perm, int cmd); | |
| 1673 | + int (*sem_semop)(struct kern_ipc_perm *perm, struct sembuf *sops, | |
| 1665 | 1674 | unsigned nsops, int alter); |
| 1666 | 1675 | |
| 1667 | 1676 | int (*netlink_send)(struct sock *sk, struct sk_buff *skb); |
| @@ -1835,6 +1844,7 @@ struct security_hook_heads { · 167 unmodified lines | ||
| 1835 | 1844 | struct hlist_head sb_set_mnt_opts; |
| 1836 | 1845 | struct hlist_head sb_clone_mnt_opts; |
| 1837 | 1846 | struct hlist_head sb_add_mnt_opt; |
| 1847 | + struct hlist_head move_mount; | |
| 1838 | 1848 | struct hlist_head dentry_init_security; |
| 1839 | 1849 | struct hlist_head dentry_create_files_as; |
| 1840 | 1850 | #ifdef CONFIG_SECURITY_PATH |
| @@ -1879,6 +1889,7 @@ struct security_hook_heads { · 38 unmodified lines | ||
| 1879 | 1889 | struct hlist_head inode_getsecid; |
| 1880 | 1890 | struct hlist_head inode_copy_up; |
| 1881 | 1891 | struct hlist_head inode_copy_up_xattr; |
| 1892 | + struct hlist_head kernfs_init_security; | |
| 1882 | 1893 | struct hlist_head file_permission; |
| 1883 | 1894 | struct hlist_head file_alloc_security; |
| 1884 | 1895 | struct hlist_head file_free_security; |
| @@ -34,5 +34,6 @@ · 33 unmodified lines | ||
| 34 | 34 | /* struct phy_device dev_flags definitions */ |
| 35 | 35 | #define MARVELL_PHY_M1145_FLAGS_RESISTANCE 0x00000001 |
| 36 | 36 | #define MARVELL_PHY_M1118_DNS323_LEDS 0x00000002 |
| 37 | +#define MARVELL_PHY_LED0_LINK_LED1_ACTIVE 0x00000004 | |
| 37 | 38 | |
| 38 | 39 | #endif /* _MARVELL_PHY_H */ |
| @@ -284,4 +284,17 @@ static inline u64 mul_u64_u32_div(u64 a, u32 mul, u32 divisor) · 283 unmodified lines | ||
| 284 | 284 | #define DIV64_U64_ROUND_UP(ll, d) \ |
| 285 | 285 | ({ u64 _tmp = (d); div64_u64((ll) + _tmp - 1, _tmp); }) |
| 286 | 286 | |
| 287 | +/** | |
| 288 | + * DIV64_U64_ROUND_CLOSEST - unsigned 64bit divide with 64bit divisor rounded to nearest integer | |
| 289 | + * @dividend: unsigned 64bit dividend | |
| 290 | + * @divisor: unsigned 64bit divisor | |
| 291 | + * | |
| 292 | + * Divide unsigned 64bit dividend by unsigned 64bit divisor | |
| 293 | + * and round to closest integer. | |
| 294 | + * | |
| 295 | + * Return: dividend / divisor rounded to nearest integer | |
| 296 | + */ | |
| 297 | +#define DIV64_U64_ROUND_CLOSEST(dividend, divisor) \ | |
| 298 | + ({ u64 _tmp = (divisor); div64_u64((dividend) + _tmp / 2, _tmp); }) | |
| 299 | + | |
| 287 | 300 | #endif /* _LINUX_MATH64_H */ |
| @@ -15,6 +15,20 @@ · 14 unmodified lines | ||
| 15 | 15 | |
| 16 | 16 | struct mdev_device; |
| 17 | 17 | |
| 18 | +/* | |
| 19 | + * Called by the parent device driver to set the device which represents | |
| 20 | + * this mdev in iommu protection scope. By default, the iommu device is | |
| 21 | + * NULL, that indicates using vendor defined isolation. | |
| 22 | + * | |
| 23 | + * @dev: the mediated device that iommu will isolate. | |
| 24 | + * @iommu_device: a pci device which represents the iommu for @dev. | |
| 25 | + * | |
| 26 | + * Return 0 for success, otherwise negative error value. | |
| 27 | + */ | |
| 28 | +int mdev_set_iommu_device(struct device *dev, struct device *iommu_device); | |
| 29 | + | |
| 30 | +struct device *mdev_get_iommu_device(struct device *dev); | |
| 31 | + | |
| 18 | 32 | /** |
| 19 | 33 | * struct mdev_parent_ops - Structure to be registered for each parent device to |
| 20 | 34 | * register the device to mdev module. |
| @@ -118,21 +132,20 @@ struct mdev_driver { · 97 unmodified lines | ||
| 118 | 132 | |
| 119 | 133 | #define to_mdev_driver(drv) container_of(drv, struct mdev_driver, driver) |
| 120 | 134 | |
| 121 | −extern void *mdev_get_drvdata(struct mdev_device *mdev); | |
| 122 | −extern void mdev_set_drvdata(struct mdev_device *mdev, void *data); | |
| 123 | −extern const guid_t *mdev_uuid(struct mdev_device *mdev); | |
| 135 | +void *mdev_get_drvdata(struct mdev_device *mdev); | |
| 136 | +void mdev_set_drvdata(struct mdev_device *mdev, void *data); | |
| 137 | +const guid_t *mdev_uuid(struct mdev_device *mdev); | |
| 124 | 138 | |
| 125 | 139 | extern struct bus_type mdev_bus_type; |
| 126 | 140 | |
| 127 | −extern int mdev_register_device(struct device *dev, | |
| 128 | − const struct mdev_parent_ops *ops); | |
| 129 | −extern void mdev_unregister_device(struct device *dev); | |
| 141 | +int mdev_register_device(struct device *dev, const struct mdev_parent_ops *ops); | |
| 142 | +void mdev_unregister_device(struct device *dev); | |
| 130 | 143 | |
| 131 | −extern int mdev_register_driver(struct mdev_driver *drv, struct module *owner); | |
| 132 | −extern void mdev_unregister_driver(struct mdev_driver *drv); | |
| 144 | +int mdev_register_driver(struct mdev_driver *drv, struct module *owner); | |
| 145 | +void mdev_unregister_driver(struct mdev_driver *drv); | |
| 133 | 146 | |
| 134 | −extern struct device *mdev_parent_dev(struct mdev_device *mdev); | |
| 135 | −extern struct device *mdev_dev(struct mdev_device *mdev); | |
| 136 | −extern struct mdev_device *mdev_from_dev(struct device *dev); | |
| 147 | +struct device *mdev_parent_dev(struct mdev_device *mdev); | |
| 148 | +struct device *mdev_dev(struct mdev_device *mdev); | |
| 149 | +struct mdev_device *mdev_from_dev(struct device *dev); | |
| 137 | 150 | |
| 138 | 151 | #endif /* MDEV_H */ |
| @@ -39,7 +39,8 @@ struct mdio_device { · 38 unmodified lines | ||
| 39 | 39 | /* Bus address of the MDIO device (0-31) */ |
| 40 | 40 | int addr; |
| 41 | 41 | int flags; |
| 42 | − struct gpio_desc *reset; | |
| 42 | + struct gpio_desc *reset_gpio; | |
| 43 | + struct reset_control *reset_ctrl; | |
| 43 | 44 | unsigned int reset_assert_delay; |
| 44 | 45 | unsigned int reset_deassert_delay; |
| 45 | 46 | }; |
| @@ -1,4 +1,7 @@ | ||
| 1 | 1 | /* SPDX-License-Identifier: GPL-2.0 */ |
| 2 | +/* | |
| 3 | + * Copyright (c) 2013-2016, Intel Corporation. All rights reserved. | |
| 4 | + */ | |
| 2 | 5 | #ifndef _LINUX_MEI_CL_BUS_H |
| 3 | 6 | #define _LINUX_MEI_CL_BUS_H |
| 4 | 7 | |
| @@ -96,13 +96,14 @@ struct memblock { · 95 unmodified lines | ||
| 96 | 96 | extern struct memblock memblock; |
| 97 | 97 | extern int memblock_debug; |
| 98 | 98 | |
| 99 | −#ifdef CONFIG_ARCH_DISCARD_MEMBLOCK | |
| 99 | +#ifndef CONFIG_ARCH_KEEP_MEMBLOCK | |
| 100 | 100 | #define __init_memblock __meminit |
| 101 | 101 | #define __initdata_memblock __meminitdata |
| 102 | 102 | void memblock_discard(void); |
| 103 | 103 | #else |
| 104 | 104 | #define __init_memblock |
| 105 | 105 | #define __initdata_memblock |
| 106 | +static inline void memblock_discard(void) {} | |
| 106 | 107 | #endif |
| 107 | 108 | |
| 108 | 109 | #define memblock_dbg(fmt, ...) \ |
| @@ -240,6 +241,47 @@ void __next_mem_pfn_range(int *idx, int nid, unsigned long *out_start_pfn, · 131 unmodified lines | ||
| 240 | 241 | i >= 0; __next_mem_pfn_range(&i, nid, p_start, p_end, p_nid)) |
| 241 | 242 | #endif /* CONFIG_HAVE_MEMBLOCK_NODE_MAP */ |
| 242 | 243 | |
| 244 | +#ifdef CONFIG_DEFERRED_STRUCT_PAGE_INIT | |
| 245 | +void __next_mem_pfn_range_in_zone(u64 *idx, struct zone *zone, | |
| 246 | + unsigned long *out_spfn, | |
| 247 | + unsigned long *out_epfn); | |
| 248 | +/** | |
| 249 | + * for_each_free_mem_range_in_zone - iterate through zone specific free | |
| 250 | + * memblock areas | |
| 251 | + * @i: u64 used as loop variable | |
| 252 | + * @zone: zone in which all of the memory blocks reside | |
| 253 | + * @p_start: ptr to phys_addr_t for start address of the range, can be %NULL | |
| 254 | + * @p_end: ptr to phys_addr_t for end address of the range, can be %NULL | |
| 255 | + * | |
| 256 | + * Walks over free (memory && !reserved) areas of memblock in a specific | |
| 257 | + * zone. Available once memblock and an empty zone is initialized. The main | |
| 258 | + * assumption is that the zone start, end, and pgdat have been associated. | |
| 259 | + * This way we can use the zone to determine NUMA node, and if a given part | |
| 260 | + * of the memblock is valid for the zone. | |
| 261 | + */ | |
| 262 | +#define for_each_free_mem_pfn_range_in_zone(i, zone, p_start, p_end) \ | |
| 263 | + for (i = 0, \ | |
| 264 | + __next_mem_pfn_range_in_zone(&i, zone, p_start, p_end); \ | |
| 265 | + i != U64_MAX; \ | |
| 266 | + __next_mem_pfn_range_in_zone(&i, zone, p_start, p_end)) | |
| 267 | + | |
| 268 | +/** | |
| 269 | + * for_each_free_mem_range_in_zone_from - iterate through zone specific | |
| 270 | + * free memblock areas from a given point | |
| 271 | + * @i: u64 used as loop variable | |
| 272 | + * @zone: zone in which all of the memory blocks reside | |
| 273 | + * @p_start: ptr to phys_addr_t for start address of the range, can be %NULL | |
| 274 | + * @p_end: ptr to phys_addr_t for end address of the range, can be %NULL | |
| 275 | + * | |
| 276 | + * Walks over free (memory && !reserved) areas of memblock in a specific | |
| 277 | + * zone, continuing from current position. Available as soon as memblock is | |
| 278 | + * initialized. | |
| 279 | + */ | |
| 280 | +#define for_each_free_mem_pfn_range_in_zone_from(i, zone, p_start, p_end) \ | |
| 281 | + for (; i != U64_MAX; \ | |
| 282 | + __next_mem_pfn_range_in_zone(&i, zone, p_start, p_end)) | |
| 283 | +#endif /* CONFIG_DEFERRED_STRUCT_PAGE_INIT */ | |
| 284 | + | |
| 243 | 285 | /** |
| 244 | 286 | * for_each_free_mem_range - iterate through free memblock areas |
| 245 | 287 | * @i: u64 used as loop variable |
| @@ -94,8 +94,8 @@ enum mem_cgroup_events_target { · 93 unmodified lines | ||
| 94 | 94 | MEM_CGROUP_NTARGETS, |
| 95 | 95 | }; |
| 96 | 96 | |
| 97 | −struct mem_cgroup_stat_cpu { | |
| 98 | − long count[MEMCG_NR_STAT]; | |
| 97 | +struct memcg_vmstats_percpu { | |
| 98 | + long stat[MEMCG_NR_STAT]; | |
| 99 | 99 | unsigned long events[NR_VM_EVENT_ITEMS]; |
| 100 | 100 | unsigned long nr_page_events; |
| 101 | 101 | unsigned long targets[MEM_CGROUP_NTARGETS]; |
| @@ -128,6 +128,7 @@ struct mem_cgroup_per_node { · 26 unmodified lines | ||
| 128 | 128 | |
| 129 | 129 | struct lruvec_stat __percpu *lruvec_stat_cpu; |
| 130 | 130 | atomic_long_t lruvec_stat[NR_VM_NODE_STAT_ITEMS]; |
| 131 | + atomic_long_t lruvec_stat_local[NR_VM_NODE_STAT_ITEMS]; | |
| 131 | 132 | |
| 132 | 133 | unsigned long lru_zone_size[MAX_NR_ZONES][NR_LRU_LISTS]; |
| 133 | 134 | |
| @@ -274,13 +275,17 @@ struct mem_cgroup { · 140 unmodified lines | ||
| 274 | 275 | struct task_struct *move_lock_task; |
| 275 | 276 | |
| 276 | 277 | /* memory.stat */ |
| 277 | − struct mem_cgroup_stat_cpu __percpu *stat_cpu; | |
| 278 | + struct memcg_vmstats_percpu __percpu *vmstats_percpu; | |
| 278 | 279 | |
| 279 | 280 | MEMCG_PADDING(_pad2_); |
| 280 | 281 | |
| 281 | − atomic_long_t stat[MEMCG_NR_STAT]; | |
| 282 | − atomic_long_t events[NR_VM_EVENT_ITEMS]; | |
| 283 | − atomic_long_t memory_events[MEMCG_NR_MEMORY_EVENTS]; | |
| 282 | + atomic_long_t vmstats[MEMCG_NR_STAT]; | |
| 283 | + atomic_long_t vmstats_local[MEMCG_NR_STAT]; | |
| 284 | + | |
| 285 | + atomic_long_t vmevents[NR_VM_EVENT_ITEMS]; | |
| 286 | + atomic_long_t vmevents_local[NR_VM_EVENT_ITEMS]; | |
| 287 | + | |
| 288 | + atomic_long_t memory_events[MEMCG_NR_MEMORY_EVENTS]; | |
| 284 | 289 | |
| 285 | 290 | unsigned long socket_pressure; |
| 286 | 291 | |
| @@ -501,22 +506,6 @@ int mem_cgroup_select_victim_node(struct mem_cgroup *memcg); · 214 unmodified lines | ||
| 501 | 506 | void mem_cgroup_update_lru_size(struct lruvec *lruvec, enum lru_list lru, |
| 502 | 507 | int zid, int nr_pages); |
| 503 | 508 | |
| 504 | −unsigned long mem_cgroup_node_nr_lru_pages(struct mem_cgroup *memcg, | |
| 505 | − int nid, unsigned int lru_mask); | |
| 506 | − | |
| 507 | −static inline | |
| 508 | −unsigned long mem_cgroup_get_lru_size(struct lruvec *lruvec, enum lru_list lru) | |
| 509 | −{ | |
| 510 | − struct mem_cgroup_per_node *mz; | |
| 511 | − unsigned long nr_pages = 0; | |
| 512 | − int zid; | |
| 513 | − | |
| 514 | − mz = container_of(lruvec, struct mem_cgroup_per_node, lruvec); | |
| 515 | − for (zid = 0; zid < MAX_NR_ZONES; zid++) | |
| 516 | − nr_pages += mz->lru_zone_size[zid][lru]; | |
| 517 | − return nr_pages; | |
| 518 | −} | |
| 519 | − | |
| 520 | 509 | static inline |
| 521 | 510 | unsigned long mem_cgroup_get_zone_lru_size(struct lruvec *lruvec, |
| 522 | 511 | enum lru_list lru, int zone_idx) |
| @@ -570,10 +559,9 @@ void unlock_page_memcg(struct page *page); · 47 unmodified lines | ||
| 570 | 559 | * idx can be of type enum memcg_stat_item or node_stat_item. |
| 571 | 560 | * Keep in sync with memcg_exact_page_state(). |
| 572 | 561 | */ |
| 573 | −static inline unsigned long memcg_page_state(struct mem_cgroup *memcg, | |
| 574 | − int idx) | |
| 562 | +static inline unsigned long memcg_page_state(struct mem_cgroup *memcg, int idx) | |
| 575 | 563 | { |
| 576 | − long x = atomic_long_read(&memcg->stat[idx]); | |
| 564 | + long x = atomic_long_read(&memcg->vmstats[idx]); | |
| 577 | 565 | #ifdef CONFIG_SMP |
| 578 | 566 | if (x < 0) |
| 579 | 567 | x = 0; |
| @@ -581,23 +569,23 @@ static inline unsigned long memcg_page_state(struct mem_cgroup *memcg, · 1 unmodified line | ||
| 581 | 569 | return x; |
| 582 | 570 | } |
| 583 | 571 | |
| 584 | −/* idx can be of type enum memcg_stat_item or node_stat_item */ | |
| 585 | −static inline void __mod_memcg_state(struct mem_cgroup *memcg, | |
| 586 | − int idx, int val) | |
| 572 | +/* | |
| 573 | + * idx can be of type enum memcg_stat_item or node_stat_item. | |
| 574 | + * Keep in sync with memcg_exact_page_state(). | |
| 575 | + */ | |
| 576 | +static inline unsigned long memcg_page_state_local(struct mem_cgroup *memcg, | |
| 577 | + int idx) | |
| 587 | 578 | { |
| 588 | − long x; | |
| 589 | − | |
| 590 | − if (mem_cgroup_disabled()) | |
| 591 | − return; | |
| 592 | − | |
| 593 | − x = val + __this_cpu_read(memcg->stat_cpu->count[idx]); | |
| 594 | − if (unlikely(abs(x) > MEMCG_CHARGE_BATCH)) { | |
| 595 | − atomic_long_add(x, &memcg->stat[idx]); | |
| 579 | + long x = atomic_long_read(&memcg->vmstats_local[idx]); | |
| 580 | +#ifdef CONFIG_SMP | |
| 581 | + if (x < 0) | |
| 596 | 582 | x = 0; |
| 597 | − } | |
| 598 | − __this_cpu_write(memcg->stat_cpu->count[idx], x); | |
| 583 | +#endif | |
| 584 | + return x; | |
| 599 | 585 | } |
| 600 | 586 | |
| 587 | +void __mod_memcg_state(struct mem_cgroup *memcg, int idx, int val); | |
| 588 | + | |
| 601 | 589 | /* idx can be of type enum memcg_stat_item or node_stat_item */ |
| 602 | 590 | static inline void mod_memcg_state(struct mem_cgroup *memcg, |
| 603 | 591 | int idx, int val) |
| @@ -658,32 +646,27 @@ static inline unsigned long lruvec_page_state(struct lruvec *lruvec, · 54 unmodified lines | ||
| 658 | 646 | return x; |
| 659 | 647 | } |
| 660 | 648 | |
| 661 | −static inline void __mod_lruvec_state(struct lruvec *lruvec, | |
| 662 | − enum node_stat_item idx, int val) | |
| 649 | +static inline unsigned long lruvec_page_state_local(struct lruvec *lruvec, | |
| 650 | + enum node_stat_item idx) | |
| 663 | 651 | { |
| 664 | 652 | struct mem_cgroup_per_node *pn; |
| 665 | 653 | long x; |
| 666 | 654 | |
| 667 | − /* Update node */ | |
| 668 | − __mod_node_page_state(lruvec_pgdat(lruvec), idx, val); | |
| 669 | − | |
| 670 | 655 | if (mem_cgroup_disabled()) |
| 671 | − return; | |
| 656 | + return node_page_state(lruvec_pgdat(lruvec), idx); | |
| 672 | 657 | |
| 673 | 658 | pn = container_of(lruvec, struct mem_cgroup_per_node, lruvec); |
| 674 | − | |
| 675 | − /* Update memcg */ | |
| 676 | − __mod_memcg_state(pn->memcg, idx, val); | |
| 677 | − | |
| 678 | − /* Update lruvec */ | |
| 679 | − x = val + __this_cpu_read(pn->lruvec_stat_cpu->count[idx]); | |
| 680 | − if (unlikely(abs(x) > MEMCG_CHARGE_BATCH)) { | |
| 681 | − atomic_long_add(x, &pn->lruvec_stat[idx]); | |
| 659 | + x = atomic_long_read(&pn->lruvec_stat_local[idx]); | |
| 660 | +#ifdef CONFIG_SMP | |
| 661 | + if (x < 0) | |
| 682 | 662 | x = 0; |
| 683 | − } | |
| 684 | − __this_cpu_write(pn->lruvec_stat_cpu->count[idx], x); | |
| 663 | +#endif | |
| 664 | + return x; | |
| 685 | 665 | } |
| 686 | 666 | |
| 667 | +void __mod_lruvec_state(struct lruvec *lruvec, enum node_stat_item idx, | |
| 668 | + int val); | |
| 669 | + | |
| 687 | 670 | static inline void mod_lruvec_state(struct lruvec *lruvec, |
| 688 | 671 | enum node_stat_item idx, int val) |
| 689 | 672 | { |
| @@ -724,22 +707,8 @@ unsigned long mem_cgroup_soft_limit_reclaim(pg_data_t *pgdat, int order, · 34 unmodified lines | ||
| 724 | 707 | gfp_t gfp_mask, |
| 725 | 708 | unsigned long *total_scanned); |
| 726 | 709 | |
| 727 | −static inline void __count_memcg_events(struct mem_cgroup *memcg, | |
| 728 | − enum vm_event_item idx, | |
| 729 | − unsigned long count) | |
| 730 | −{ | |
| 731 | − unsigned long x; | |
| 732 | − | |
| 733 | − if (mem_cgroup_disabled()) | |
| 734 | − return; | |
| 735 | − | |
| 736 | − x = count + __this_cpu_read(memcg->stat_cpu->events[idx]); | |
| 737 | − if (unlikely(x > MEMCG_CHARGE_BATCH)) { | |
| 738 | − atomic_long_add(x, &memcg->events[idx]); | |
| 739 | − x = 0; | |
| 740 | − } | |
| 741 | − __this_cpu_write(memcg->stat_cpu->events[idx], x); | |
| 742 | −} | |
| 710 | +void __count_memcg_events(struct mem_cgroup *memcg, enum vm_event_item idx, | |
| 711 | + unsigned long count); | |
| 743 | 712 | |
| 744 | 713 | static inline void count_memcg_events(struct mem_cgroup *memcg, |
| 745 | 714 | enum vm_event_item idx, |
| @@ -960,11 +929,6 @@ static inline bool mem_cgroup_online(struct mem_cgroup *memcg) · 214 unmodified lines | ||
| 960 | 929 | return true; |
| 961 | 930 | } |
| 962 | 931 | |
| 963 | −static inline unsigned long | |
| 964 | −mem_cgroup_get_lru_size(struct lruvec *lruvec, enum lru_list lru) | |
| 965 | −{ | |
| 966 | − return 0; | |
| 967 | −} | |
| 968 | 932 | static inline |
| 969 | 933 | unsigned long mem_cgroup_get_zone_lru_size(struct lruvec *lruvec, |
| 970 | 934 | enum lru_list lru, int zone_idx) |
| @@ -972,13 +936,6 @@ unsigned long mem_cgroup_get_zone_lru_size(struct lruvec *lruvec, · 1 unmodified line | ||
| 972 | 936 | return 0; |
| 973 | 937 | } |
| 974 | 938 | |
| 975 | −static inline unsigned long | |
| 976 | −mem_cgroup_node_nr_lru_pages(struct mem_cgroup *memcg, | |
| 977 | − int nid, unsigned int lru_mask) | |
| 978 | −{ | |
| 979 | − return 0; | |
| 980 | −} | |
| 981 | − | |
| 982 | 939 | static inline unsigned long mem_cgroup_get_max(struct mem_cgroup *memcg) |
| 983 | 940 | { |
| 984 | 941 | return 0; |
| @@ -1039,8 +996,13 @@ static inline void mem_cgroup_print_oom_group(struct mem_cgroup *memcg) · 54 unmodified lines | ||
| 1039 | 996 | { |
| 1040 | 997 | } |
| 1041 | 998 | |
| 1042 | −static inline unsigned long memcg_page_state(struct mem_cgroup *memcg, | |
| 1043 | − int idx) | |
| 999 | +static inline unsigned long memcg_page_state(struct mem_cgroup *memcg, int idx) | |
| 1000 | +{ | |
| 1001 | + return 0; | |
| 1002 | +} | |
| 1003 | + | |
| 1004 | +static inline unsigned long memcg_page_state_local(struct mem_cgroup *memcg, | |
| 1005 | + int idx) | |
| 1044 | 1006 | { |
| 1045 | 1007 | return 0; |
| 1046 | 1008 | } |
| @@ -1075,6 +1037,12 @@ static inline unsigned long lruvec_page_state(struct lruvec *lruvec, · 28 unmodified lines | ||
| 1075 | 1037 | return node_page_state(lruvec_pgdat(lruvec), idx); |
| 1076 | 1038 | } |
| 1077 | 1039 | |
| 1040 | +static inline unsigned long lruvec_page_state_local(struct lruvec *lruvec, | |
| 1041 | + enum node_stat_item idx) | |
| 1042 | +{ | |
| 1043 | + return node_page_state(lruvec_pgdat(lruvec), idx); | |
| 1044 | +} | |
| 1045 | + | |
| 1078 | 1046 | static inline void __mod_lruvec_state(struct lruvec *lruvec, |
| 1079 | 1047 | enum node_stat_item idx, int val) |
| 1080 | 1048 | { |
| @@ -1117,6 +1085,12 @@ static inline void count_memcg_events(struct mem_cgroup *memcg, · 36 unmodified lines | ||
| 1117 | 1085 | { |
| 1118 | 1086 | } |
| 1119 | 1087 | |
| 1088 | +static inline void __count_memcg_events(struct mem_cgroup *memcg, | |
| 1089 | + enum vm_event_item idx, | |
| 1090 | + unsigned long count) | |
| 1091 | +{ | |
| 1092 | +} | |
| 1093 | + | |
| 1120 | 1094 | static inline void count_memcg_page_event(struct page *page, |
| 1121 | 1095 | int idx) |
| 1122 | 1096 | { |
| @@ -113,7 +113,7 @@ extern int register_memory_isolate_notifier(struct notifier_block *nb); · 112 unmodified lines | ||
| 113 | 113 | extern void unregister_memory_isolate_notifier(struct notifier_block *nb); |
| 114 | 114 | int hotplug_memory_register(int nid, struct mem_section *section); |
| 115 | 115 | #ifdef CONFIG_MEMORY_HOTREMOVE |
| 116 | −extern int unregister_memory_section(struct mem_section *); | |
| 116 | +extern void unregister_memory_section(struct mem_section *); | |
| 117 | 117 | #endif |
| 118 | 118 | extern int memory_dev_init(void); |
| 119 | 119 | extern int memory_notify(unsigned long val, void *v); |
| @@ -53,6 +53,16 @@ enum { · 52 unmodified lines | ||
| 53 | 53 | MMOP_ONLINE_MOVABLE, |
| 54 | 54 | }; |
| 55 | 55 | |
| 56 | +/* | |
| 57 | + * Restrictions for the memory hotplug: | |
| 58 | + * flags: MHP_ flags | |
| 59 | + * altmap: alternative allocator for memmap array | |
| 60 | + */ | |
| 61 | +struct mhp_restrictions { | |
| 62 | + unsigned long flags; | |
| 63 | + struct vmem_altmap *altmap; | |
| 64 | +}; | |
| 65 | + | |
| 56 | 66 | /* |
| 57 | 67 | * Zone resizing functions |
| 58 | 68 | * |
| @@ -87,7 +97,8 @@ extern int add_one_highpage(struct page *page, int pfn, int bad_ppro); · 28 unmodified lines | ||
| 87 | 97 | extern int online_pages(unsigned long, unsigned long, int); |
| 88 | 98 | extern int test_pages_in_a_zone(unsigned long start_pfn, unsigned long end_pfn, |
| 89 | 99 | unsigned long *valid_start, unsigned long *valid_end); |
| 90 | −extern void __offline_isolated_pages(unsigned long, unsigned long); | |
| 100 | +extern unsigned long __offline_isolated_pages(unsigned long start_pfn, | |
| 101 | + unsigned long end_pfn); | |
| 91 | 102 | |
| 92 | 103 | typedef void (*online_page_callback_t)(struct page *page, unsigned int order); |
| 93 | 104 | |
| @@ -100,6 +111,8 @@ extern void __online_page_free(struct page *page); · 6 unmodified lines | ||
| 100 | 111 | |
| 101 | 112 | extern int try_online_node(int nid); |
| 102 | 113 | |
| 114 | +extern int arch_add_memory(int nid, u64 start, u64 size, | |
| 115 | + struct mhp_restrictions *restrictions); | |
| 103 | 116 | extern u64 max_mem_size; |
| 104 | 117 | |
| 105 | 118 | extern bool memhp_auto_online; |
| @@ -111,26 +124,33 @@ static inline bool movable_node_is_enabled(void) · 5 unmodified lines | ||
| 111 | 124 | } |
| 112 | 125 | |
| 113 | 126 | #ifdef CONFIG_MEMORY_HOTREMOVE |
| 114 | −extern int arch_remove_memory(int nid, u64 start, u64 size, | |
| 115 | − struct vmem_altmap *altmap); | |
| 116 | −extern int __remove_pages(struct zone *zone, unsigned long start_pfn, | |
| 117 | − unsigned long nr_pages, struct vmem_altmap *altmap); | |
| 127 | +extern void arch_remove_memory(int nid, u64 start, u64 size, | |
| 128 | + struct vmem_altmap *altmap); | |
| 129 | +extern void __remove_pages(struct zone *zone, unsigned long start_pfn, | |
| 130 | + unsigned long nr_pages, struct vmem_altmap *altmap); | |
| 118 | 131 | #endif /* CONFIG_MEMORY_HOTREMOVE */ |
| 119 | 132 | |
| 133 | +/* | |
| 134 | + * Do we want sysfs memblock files created. This will allow userspace to online | |
| 135 | + * and offline memory explicitly. Lack of this bit means that the caller has to | |
| 136 | + * call move_pfn_range_to_zone to finish the initialization. | |
| 137 | + */ | |
| 138 | + | |
| 139 | +#define MHP_MEMBLOCK_API (1<<0) | |
| 140 | + | |
| 120 | 141 | /* reasonably generic interface to expand the physical pages */ |
| 121 | 142 | extern int __add_pages(int nid, unsigned long start_pfn, unsigned long nr_pages, |
| 122 | − struct vmem_altmap *altmap, bool want_memblock); | |
| 143 | + struct mhp_restrictions *restrictions); | |
| 123 | 144 | |
| 124 | 145 | #ifndef CONFIG_ARCH_HAS_ADD_PAGES |
| 125 | 146 | static inline int add_pages(int nid, unsigned long start_pfn, |
| 126 | − unsigned long nr_pages, struct vmem_altmap *altmap, | |
| 127 | − bool want_memblock) | |
| 147 | + unsigned long nr_pages, struct mhp_restrictions *restrictions) | |
| 128 | 148 | { |
| 129 | − return __add_pages(nid, start_pfn, nr_pages, altmap, want_memblock); | |
| 149 | + return __add_pages(nid, start_pfn, nr_pages, restrictions); | |
| 130 | 150 | } |
| 131 | 151 | #else /* ARCH_HAS_ADD_PAGES */ |
| 132 | 152 | int add_pages(int nid, unsigned long start_pfn, unsigned long nr_pages, |
| 133 | − struct vmem_altmap *altmap, bool want_memblock); | |
| 153 | + struct mhp_restrictions *restrictions); | |
| 134 | 154 | #endif /* ARCH_HAS_ADD_PAGES */ |
| 135 | 155 | |
| 136 | 156 | #ifdef CONFIG_NUMA |
| @@ -331,8 +351,6 @@ extern int walk_memory_range(unsigned long start_pfn, unsigned long end_pfn, · 194 unmodified lines | ||
| 331 | 351 | extern int __add_memory(int nid, u64 start, u64 size); |
| 332 | 352 | extern int add_memory(int nid, u64 start, u64 size); |
| 333 | 353 | extern int add_memory_resource(int nid, struct resource *resource); |
| 334 | −extern int arch_add_memory(int nid, u64 start, u64 size, | |
| 335 | − struct vmem_altmap *altmap, bool want_memblock); | |
| 336 | 354 | extern void move_pfn_range_to_zone(struct zone *zone, unsigned long start_pfn, |
| 337 | 355 | unsigned long nr_pages, struct vmem_altmap *altmap); |
| 338 | 356 | extern bool is_memblock_offlined(struct memory_block *mem); |
| @@ -0,0 +1,29 @@ | ||
| 1 | +/* SPDX-License-Identifier: GPL-2.0 */ | |
| 2 | +/* | |
| 3 | + * Copyright (C) 2018-2019 Intel Corporation | |
| 4 | + * Copyright (C) 2012 Freescale Semiconductor, Inc. | |
| 5 | + * Copyright (C) 2012 Linaro Ltd. | |
| 6 | + */ | |
| 7 | + | |
| 8 | +#ifndef __LINUX_MFD_ALTERA_SYSMGR_H__ | |
| 9 | +#define __LINUX_MFD_ALTERA_SYSMGR_H__ | |
| 10 | + | |
| 11 | +#include <linux/err.h> | |
| 12 | +#include <linux/errno.h> | |
| 13 | +#include <linux/firmware/intel/stratix10-smc.h> | |
| 14 | + | |
| 15 | +struct device_node; | |
| 16 | + | |
| 17 | +#ifdef CONFIG_MFD_ALTERA_SYSMGR | |
| 18 | +struct regmap *altr_sysmgr_regmap_lookup_by_phandle(struct device_node *np, | |
| 19 | + const char *property); | |
| 20 | +#else | |
| 21 | +static inline struct regmap * | |
| 22 | +altr_sysmgr_regmap_lookup_by_phandle(struct device_node *np, | |
| 23 | + const char *property) | |
| 24 | +{ | |
| 25 | + return ERR_PTR(-ENOTSUPP); | |
| 26 | +} | |
| 27 | +#endif | |
| 28 | + | |
| 29 | +#endif /* __LINUX_MFD_ALTERA_SYSMGR_H__ */ | |
| @@ -23,7 +23,10 @@ · 22 unmodified lines | ||
| 23 | 23 | #include <linux/mutex.h> |
| 24 | 24 | |
| 25 | 25 | #define CROS_EC_DEV_NAME "cros_ec" |
| 26 | +#define CROS_EC_DEV_FP_NAME "cros_fp" | |
| 26 | 27 | #define CROS_EC_DEV_PD_NAME "cros_pd" |
| 28 | +#define CROS_EC_DEV_TP_NAME "cros_tp" | |
| 29 | +#define CROS_EC_DEV_ISH_NAME "cros_ish" | |
| 27 | 30 | |
| 28 | 31 | /* |
| 29 | 32 | * The EC is unresponsive for a time after a reboot command. Add a |
| @@ -120,6 +123,7 @@ struct cros_ec_command { · 90 unmodified lines | ||
| 120 | 123 | * @pkt_xfer: Send packet to EC and get response. |
| 121 | 124 | * @lock: One transaction at a time. |
| 122 | 125 | * @mkbp_event_supported: True if this EC supports the MKBP event protocol. |
| 126 | + * @host_sleep_v1: True if this EC supports the sleep v1 command. | |
| 123 | 127 | * @event_notifier: Interrupt event notifier for transport devices. |
| 124 | 128 | * @event_data: Raw payload transferred with the MKBP event. |
| 125 | 129 | * @event_size: Size in bytes of the event data. |
| @@ -153,6 +157,7 @@ struct cros_ec_device { · 27 unmodified lines | ||
| 153 | 157 | struct cros_ec_command *msg); |
| 154 | 158 | struct mutex lock; |
| 155 | 159 | bool mkbp_event_supported; |
| 160 | + bool host_sleep_v1; | |
| 156 | 161 | struct blocking_notifier_head event_notifier; |
| 157 | 162 | |
| 158 | 163 | struct ec_response_get_next_event_v1 event_data; |
| @@ -840,7 +840,7 @@ enum ec_feature_code { · 839 unmodified lines | ||
| 840 | 840 | * (Common Smart Battery System Interface Specification) |
| 841 | 841 | */ |
| 842 | 842 | EC_FEATURE_SMART_BATTERY = 18, |
| 843 | − /* EC can dectect when the host hangs. */ | |
| 843 | + /* EC can detect when the host hangs. */ | |
| 844 | 844 | EC_FEATURE_HANG_DETECT = 19, |
| 845 | 845 | /* Report power information, for pit only */ |
| 846 | 846 | EC_FEATURE_PMU = 20, |
| @@ -852,10 +852,42 @@ enum ec_feature_code { · 5 unmodified lines | ||
| 852 | 852 | EC_FEATURE_USB_MUX = 23, |
| 853 | 853 | /* Motion Sensor code has an internal software FIFO */ |
| 854 | 854 | EC_FEATURE_MOTION_SENSE_FIFO = 24, |
| 855 | + /* Support temporary secure vstore */ | |
| 856 | + EC_FEATURE_VSTORE = 25, | |
| 857 | + /* EC decides on USB-C SS mux state, muxes configured by host */ | |
| 858 | + EC_FEATURE_USBC_SS_MUX_VIRTUAL = 26, | |
| 855 | 859 | /* EC has RTC feature that can be controlled by host commands */ |
| 856 | 860 | EC_FEATURE_RTC = 27, |
| 861 | + /* The MCU exposes a Fingerprint sensor */ | |
| 862 | + EC_FEATURE_FINGERPRINT = 28, | |
| 863 | + /* The MCU exposes a Touchpad */ | |
| 864 | + EC_FEATURE_TOUCHPAD = 29, | |
| 865 | + /* The MCU has RWSIG task enabled */ | |
| 866 | + EC_FEATURE_RWSIG = 30, | |
| 867 | + /* EC has device events support */ | |
| 868 | + EC_FEATURE_DEVICE_EVENT = 31, | |
| 869 | + /* EC supports the unified wake masks for LPC/eSPI systems */ | |
| 870 | + EC_FEATURE_UNIFIED_WAKE_MASKS = 32, | |
| 871 | + /* EC supports 64-bit host events */ | |
| 872 | + EC_FEATURE_HOST_EVENT64 = 33, | |
| 873 | + /* EC runs code in RAM (not in place, a.k.a. XIP) */ | |
| 874 | + EC_FEATURE_EXEC_IN_RAM = 34, | |
| 857 | 875 | /* EC supports CEC commands */ |
| 858 | 876 | EC_FEATURE_CEC = 35, |
| 877 | + /* EC supports tight sensor timestamping. */ | |
| 878 | + EC_FEATURE_MOTION_SENSE_TIGHT_TIMESTAMPS = 36, | |
| 879 | + /* | |
| 880 | + * EC supports tablet mode detection aligned to Chrome and allows | |
| 881 | + * setting of threshold by host command using | |
| 882 | + * MOTIONSENSE_CMD_TABLET_MODE_LID_ANGLE. | |
| 883 | + */ | |
| 884 | + EC_FEATURE_REFINED_TABLET_MODE_HYSTERESIS = 37, | |
| 885 | + /* EC supports audio codec. */ | |
| 886 | + EC_FEATURE_AUDIO_CODEC = 38, | |
| 887 | + /* EC Supports SCP. */ | |
| 888 | + EC_FEATURE_SCP = 39, | |
| 889 | + /* The MCU is an Integrated Sensor Hub */ | |
| 890 | + EC_FEATURE_ISH = 40, | |
| 859 | 891 | }; |
| 860 | 892 | |
| 861 | 893 | #define EC_FEATURE_MASK_0(event_code) (1UL << (event_code % 32)) |
| @@ -2729,6 +2761,63 @@ struct ec_params_host_sleep_event { · 1867 unmodified lines | ||
| 2729 | 2761 | uint8_t sleep_event; |
| 2730 | 2762 | } __packed; |
| 2731 | 2763 | |
| 2764 | +/* | |
| 2765 | + * Use a default timeout value (CONFIG_SLEEP_TIMEOUT_MS) for detecting sleep | |
| 2766 | + * transition failures | |
| 2767 | + */ | |
| 2768 | +#define EC_HOST_SLEEP_TIMEOUT_DEFAULT 0 | |
| 2769 | + | |
| 2770 | +/* Disable timeout detection for this sleep transition */ | |
| 2771 | +#define EC_HOST_SLEEP_TIMEOUT_INFINITE 0xFFFF | |
| 2772 | + | |
| 2773 | +struct ec_params_host_sleep_event_v1 { | |
| 2774 | + /* The type of sleep being entered or exited. */ | |
| 2775 | + uint8_t sleep_event; | |
| 2776 | + | |
| 2777 | + /* Padding */ | |
| 2778 | + uint8_t reserved; | |
| 2779 | + union { | |
| 2780 | + /* Parameters that apply for suspend messages. */ | |
| 2781 | + struct { | |
| 2782 | + /* | |
| 2783 | + * The timeout in milliseconds between when this message | |
| 2784 | + * is received and when the EC will declare sleep | |
| 2785 | + * transition failure if the sleep signal is not | |
| 2786 | + * asserted. | |
| 2787 | + */ | |
| 2788 | + uint16_t sleep_timeout_ms; | |
| 2789 | + } suspend_params; | |
| 2790 | + | |
| 2791 | + /* No parameters for non-suspend messages. */ | |
| 2792 | + }; | |
| 2793 | +} __packed; | |
| 2794 | + | |
| 2795 | +/* A timeout occurred when this bit is set */ | |
| 2796 | +#define EC_HOST_RESUME_SLEEP_TIMEOUT 0x80000000 | |
| 2797 | + | |
| 2798 | +/* | |
| 2799 | + * The mask defining which bits correspond to the number of sleep transitions, | |
| 2800 | + * as well as the maximum number of suspend line transitions that will be | |
| 2801 | + * reported back to the host. | |
| 2802 | + */ | |
| 2803 | +#define EC_HOST_RESUME_SLEEP_TRANSITIONS_MASK 0x7FFFFFFF | |
| 2804 | + | |
| 2805 | +struct ec_response_host_sleep_event_v1 { | |
| 2806 | + union { | |
| 2807 | + /* Response fields that apply for resume messages. */ | |
| 2808 | + struct { | |
| 2809 | + /* | |
| 2810 | + * The number of sleep power signal transitions that | |
| 2811 | + * occurred since the suspend message. The high bit | |
| 2812 | + * indicates a timeout occurred. | |
| 2813 | + */ | |
| 2814 | + uint32_t sleep_transitions; | |
| 2815 | + } resume_response; | |
| 2816 | + | |
| 2817 | + /* No response fields for non-resume messages. */ | |
| 2818 | + }; | |
| 2819 | +} __packed; | |
| 2820 | + | |
| 2732 | 2821 | /*****************************************************************************/ |
| 2733 | 2822 | /* Smart battery pass-through */ |
| 2734 | 2823 | |
| @@ -1,3 +1,4 @@ | ||
| 1 | +/* SPDX-License-Identifier: GPL-2.0+ */ | |
| 1 | 2 | /* |
| 2 | 3 | * Definitions for DA9063 MFD driver |
| 3 | 4 | * |
| @@ -5,12 +6,6 @@ · 1 unmodified line | ||
| 5 | 6 | * |
| 6 | 7 | * Author: Michal Hajduk, Dialog Semiconductor |
| 7 | 8 | * Author: Krystian Garbaciak, Dialog Semiconductor |
| 8 | − * | |
| 9 | − * This program is free software; you can redistribute it and/or modify it | |
| 10 | − * under the terms of the GNU General Public License as published by the | |
| 11 | − * Free Software Foundation; either version 2 of the License, or (at your | |
| 12 | − * option) any later version. | |
| 13 | − * | |
| 14 | 9 | */ |
| 15 | 10 | |
| 16 | 11 | #ifndef __MFD_DA9063_CORE_H__ |
| @@ -1,3 +1,4 @@ | ||
| 1 | +/* SPDX-License-Identifier: GPL-2.0+ */ | |
| 1 | 2 | /* |
| 2 | 3 | * Registers definition for DA9063 modules |
| 3 | 4 | * |
| @@ -5,12 +6,6 @@ · 1 unmodified line | ||
| 5 | 6 | * |
| 6 | 7 | * Author: Michal Hajduk, Dialog Semiconductor |
| 7 | 8 | * Author: Krystian Garbaciak, Dialog Semiconductor |
| 8 | − * | |
| 9 | − * This program is free software; you can redistribute it and/or modify it | |
| 10 | − * under the terms of the GNU General Public License as published by the | |
| 11 | − * Free Software Foundation; either version 2 of the License, or (at your | |
| 12 | − * option) any later version. | |
| 13 | − * | |
| 14 | 9 | */ |
| 15 | 10 | |
| 16 | 11 | #ifndef _DA9063_REG_H |
| @@ -215,9 +210,9 @@ · 198 unmodified lines | ||
| 215 | 210 | |
| 216 | 211 | /* DA9063 Configuration registers */ |
| 217 | 212 | /* OTP */ |
| 218 | −#define DA9063_REG_OPT_COUNT 0x101 | |
| 219 | −#define DA9063_REG_OPT_ADDR 0x102 | |
| 220 | −#define DA9063_REG_OPT_DATA 0x103 | |
| 213 | +#define DA9063_REG_OTP_CONT 0x101 | |
| 214 | +#define DA9063_REG_OTP_ADDR 0x102 | |
| 215 | +#define DA9063_REG_OTP_DATA 0x103 | |
| 221 | 216 | |
| 222 | 217 | /* Customer Trim and Configuration */ |
| 223 | 218 | #define DA9063_REG_T_OFFSET 0x104 |
| @@ -136,8 +136,8 @@ · 135 unmodified lines | ||
| 136 | 136 | #define MAX77620_FPS_PERIOD_MIN_US 40 |
| 137 | 137 | #define MAX20024_FPS_PERIOD_MIN_US 20 |
| 138 | 138 | |
| 139 | −#define MAX77620_FPS_PERIOD_MAX_US 2560 | |
| 140 | −#define MAX20024_FPS_PERIOD_MAX_US 5120 | |
| 139 | +#define MAX20024_FPS_PERIOD_MAX_US 2560 | |
| 140 | +#define MAX77620_FPS_PERIOD_MAX_US 5120 | |
| 141 | 141 | |
| 142 | 142 | #define MAX77620_REG_FPS_GPIO1 0x54 |
| 143 | 143 | #define MAX77620_REG_FPS_GPIO2 0x55 |
| @@ -324,6 +324,7 @@ enum max77620_fps_src { · 180 unmodified lines | ||
| 324 | 324 | enum max77620_chip_id { |
| 325 | 325 | MAX77620, |
| 326 | 326 | MAX20024, |
| 327 | + MAX77663, | |
| 327 | 328 | }; |
| 328 | 329 | |
| 329 | 330 | struct max77620_chip { |
| @@ -0,0 +1,59 @@ | ||
| 1 | +/* SPDX-License-Identifier: GPL-2.0 */ | |
| 2 | +/* | |
| 3 | + * Copyright (C) 2018 BayLibre SAS | |
| 4 | + * Author: Bartosz Golaszewski <bgolaszewski@baylibre.com> | |
| 5 | + * | |
| 6 | + * Common definitions for MAXIM 77650/77651 charger/power-supply. | |
| 7 | + */ | |
| 8 | + | |
| 9 | +#ifndef MAX77650_H | |
| 10 | +#define MAX77650_H | |
| 11 | + | |
| 12 | +#include <linux/bits.h> | |
| 13 | + | |
| 14 | +#define MAX77650_REG_INT_GLBL 0x00 | |
| 15 | +#define MAX77650_REG_INT_CHG 0x01 | |
| 16 | +#define MAX77650_REG_STAT_CHG_A 0x02 | |
| 17 | +#define MAX77650_REG_STAT_CHG_B 0x03 | |
| 18 | +#define MAX77650_REG_ERCFLAG 0x04 | |
| 19 | +#define MAX77650_REG_STAT_GLBL 0x05 | |
| 20 | +#define MAX77650_REG_INTM_GLBL 0x06 | |
| 21 | +#define MAX77650_REG_INTM_CHG 0x07 | |
| 22 | +#define MAX77650_REG_CNFG_GLBL 0x10 | |
| 23 | +#define MAX77650_REG_CID 0x11 | |
| 24 | +#define MAX77650_REG_CNFG_GPIO 0x12 | |
| 25 | +#define MAX77650_REG_CNFG_CHG_A 0x18 | |
| 26 | +#define MAX77650_REG_CNFG_CHG_B 0x19 | |
| 27 | +#define MAX77650_REG_CNFG_CHG_C 0x1a | |
| 28 | +#define MAX77650_REG_CNFG_CHG_D 0x1b | |
| 29 | +#define MAX77650_REG_CNFG_CHG_E 0x1c | |
| 30 | +#define MAX77650_REG_CNFG_CHG_F 0x1d | |
| 31 | +#define MAX77650_REG_CNFG_CHG_G 0x1e | |
| 32 | +#define MAX77650_REG_CNFG_CHG_H 0x1f | |
| 33 | +#define MAX77650_REG_CNFG_CHG_I 0x20 | |
| 34 | +#define MAX77650_REG_CNFG_SBB_TOP 0x28 | |
| 35 | +#define MAX77650_REG_CNFG_SBB0_A 0x29 | |
| 36 | +#define MAX77650_REG_CNFG_SBB0_B 0x2a | |
| 37 | +#define MAX77650_REG_CNFG_SBB1_A 0x2b | |
| 38 | +#define MAX77650_REG_CNFG_SBB1_B 0x2c | |
| 39 | +#define MAX77650_REG_CNFG_SBB2_A 0x2d | |
| 40 | +#define MAX77650_REG_CNFG_SBB2_B 0x2e | |
| 41 | +#define MAX77650_REG_CNFG_LDO_A 0x38 | |
| 42 | +#define MAX77650_REG_CNFG_LDO_B 0x39 | |
| 43 | +#define MAX77650_REG_CNFG_LED0_A 0x40 | |
| 44 | +#define MAX77650_REG_CNFG_LED1_A 0x41 | |
| 45 | +#define MAX77650_REG_CNFG_LED2_A 0x42 | |
| 46 | +#define MAX77650_REG_CNFG_LED0_B 0x43 | |
| 47 | +#define MAX77650_REG_CNFG_LED1_B 0x44 | |
| 48 | +#define MAX77650_REG_CNFG_LED2_B 0x45 | |
| 49 | +#define MAX77650_REG_CNFG_LED_TOP 0x46 | |
| 50 | + | |
| 51 | +#define MAX77650_CID_MASK GENMASK(3, 0) | |
| 52 | +#define MAX77650_CID_BITS(_reg) (_reg & MAX77650_CID_MASK) | |
| 53 | + | |
| 54 | +#define MAX77650_CID_77650A 0x03 | |
| 55 | +#define MAX77650_CID_77650C 0x0a | |
| 56 | +#define MAX77650_CID_77651A 0x06 | |
| 57 | +#define MAX77650_CID_77651B 0x08 | |
| 58 | + | |
| 59 | +#endif /* MAX77650_H */ | |
| @@ -553,7 +553,6 @@ struct palmas_pmic { · 552 unmodified lines | ||
| 553 | 553 | struct palmas *palmas; |
| 554 | 554 | struct device *dev; |
| 555 | 555 | struct regulator_desc desc[PALMAS_NUM_REGS]; |
| 556 | − struct regulator_dev *rdev[PALMAS_NUM_REGS]; | |
| 557 | 556 | struct mutex mutex; |
| 558 | 557 | |
| 559 | 558 | int smps123; |
| @@ -0,0 +1,123 @@ | ||
| 1 | +/* SPDX-License-Identifier: GPL-2.0 */ | |
| 2 | +/* | |
| 3 | + * Copyright (C) 2019 STMicroelectronics | |
| 4 | + * Author(s): Amelie Delaunay <amelie.delaunay@st.com>. | |
| 5 | + */ | |
| 6 | + | |
| 7 | +#ifndef MFD_STMFX_H | |
| 8 | +#define MFX_STMFX_H | |
| 9 | + | |
| 10 | +#include <linux/regmap.h> | |
| 11 | + | |
| 12 | +/* General */ | |
| 13 | +#define STMFX_REG_CHIP_ID 0x00 /* R */ | |
| 14 | +#define STMFX_REG_FW_VERSION_MSB 0x01 /* R */ | |
| 15 | +#define STMFX_REG_FW_VERSION_LSB 0x02 /* R */ | |
| 16 | +#define STMFX_REG_SYS_CTRL 0x40 /* RW */ | |
| 17 | +/* IRQ output management */ | |
| 18 | +#define STMFX_REG_IRQ_OUT_PIN 0x41 /* RW */ | |
| 19 | +#define STMFX_REG_IRQ_SRC_EN 0x42 /* RW */ | |
| 20 | +#define STMFX_REG_IRQ_PENDING 0x08 /* R */ | |
| 21 | +#define STMFX_REG_IRQ_ACK 0x44 /* RW */ | |
| 22 | +/* GPIO management */ | |
| 23 | +#define STMFX_REG_IRQ_GPI_PENDING1 0x0C /* R */ | |
| 24 | +#define STMFX_REG_IRQ_GPI_PENDING2 0x0D /* R */ | |
| 25 | +#define STMFX_REG_IRQ_GPI_PENDING3 0x0E /* R */ | |
| 26 | +#define STMFX_REG_GPIO_STATE1 0x10 /* R */ | |
| 27 | +#define STMFX_REG_GPIO_STATE2 0x11 /* R */ | |
| 28 | +#define STMFX_REG_GPIO_STATE3 0x12 /* R */ | |
| 29 | +#define STMFX_REG_IRQ_GPI_SRC1 0x48 /* RW */ | |
| 30 | +#define STMFX_REG_IRQ_GPI_SRC2 0x49 /* RW */ | |
| 31 | +#define STMFX_REG_IRQ_GPI_SRC3 0x4A /* RW */ | |
| 32 | +#define STMFX_REG_IRQ_GPI_EVT1 0x4C /* RW */ | |
| 33 | +#define STMFX_REG_IRQ_GPI_EVT2 0x4D /* RW */ | |
| 34 | +#define STMFX_REG_IRQ_GPI_EVT3 0x4E /* RW */ | |
| 35 | +#define STMFX_REG_IRQ_GPI_TYPE1 0x50 /* RW */ | |
| 36 | +#define STMFX_REG_IRQ_GPI_TYPE2 0x51 /* RW */ | |
| 37 | +#define STMFX_REG_IRQ_GPI_TYPE3 0x52 /* RW */ | |
| 38 | +#define STMFX_REG_IRQ_GPI_ACK1 0x54 /* RW */ | |
| 39 | +#define STMFX_REG_IRQ_GPI_ACK2 0x55 /* RW */ | |
| 40 | +#define STMFX_REG_IRQ_GPI_ACK3 0x56 /* RW */ | |
| 41 | +#define STMFX_REG_GPIO_DIR1 0x60 /* RW */ | |
| 42 | +#define STMFX_REG_GPIO_DIR2 0x61 /* RW */ | |
| 43 | +#define STMFX_REG_GPIO_DIR3 0x62 /* RW */ | |
| 44 | +#define STMFX_REG_GPIO_TYPE1 0x64 /* RW */ | |
| 45 | +#define STMFX_REG_GPIO_TYPE2 0x65 /* RW */ | |
| 46 | +#define STMFX_REG_GPIO_TYPE3 0x66 /* RW */ | |
| 47 | +#define STMFX_REG_GPIO_PUPD1 0x68 /* RW */ | |
| 48 | +#define STMFX_REG_GPIO_PUPD2 0x69 /* RW */ | |
| 49 | +#define STMFX_REG_GPIO_PUPD3 0x6A /* RW */ | |
| 50 | +#define STMFX_REG_GPO_SET1 0x6C /* RW */ | |
| 51 | +#define STMFX_REG_GPO_SET2 0x6D /* RW */ | |
| 52 | +#define STMFX_REG_GPO_SET3 0x6E /* RW */ | |
| 53 | +#define STMFX_REG_GPO_CLR1 0x70 /* RW */ | |
| 54 | +#define STMFX_REG_GPO_CLR2 0x71 /* RW */ | |
| 55 | +#define STMFX_REG_GPO_CLR3 0x72 /* RW */ | |
| 56 | + | |
| 57 | +#define STMFX_REG_MAX 0xB0 | |
| 58 | + | |
| 59 | +/* MFX boot time is around 10ms, so after reset, we have to wait this delay */ | |
| 60 | +#define STMFX_BOOT_TIME_MS 10 | |
| 61 | + | |
| 62 | +/* STMFX_REG_CHIP_ID bitfields */ | |
| 63 | +#define STMFX_REG_CHIP_ID_MASK GENMASK(7, 0) | |
| 64 | + | |
| 65 | +/* STMFX_REG_SYS_CTRL bitfields */ | |
| 66 | +#define STMFX_REG_SYS_CTRL_GPIO_EN BIT(0) | |
| 67 | +#define STMFX_REG_SYS_CTRL_TS_EN BIT(1) | |
| 68 | +#define STMFX_REG_SYS_CTRL_IDD_EN BIT(2) | |
| 69 | +#define STMFX_REG_SYS_CTRL_ALTGPIO_EN BIT(3) | |
| 70 | +#define STMFX_REG_SYS_CTRL_SWRST BIT(7) | |
| 71 | + | |
| 72 | +/* STMFX_REG_IRQ_OUT_PIN bitfields */ | |
| 73 | +#define STMFX_REG_IRQ_OUT_PIN_TYPE BIT(0) /* 0-OD 1-PP */ | |
| 74 | +#define STMFX_REG_IRQ_OUT_PIN_POL BIT(1) /* 0-active LOW 1-active HIGH */ | |
| 75 | + | |
| 76 | +/* STMFX_REG_IRQ_(SRC_EN/PENDING/ACK) bit shift */ | |
| 77 | +enum stmfx_irqs { | |
| 78 | + STMFX_REG_IRQ_SRC_EN_GPIO = 0, | |
| 79 | + STMFX_REG_IRQ_SRC_EN_IDD, | |
| 80 | + STMFX_REG_IRQ_SRC_EN_ERROR, | |
| 81 | + STMFX_REG_IRQ_SRC_EN_TS_DET, | |
| 82 | + STMFX_REG_IRQ_SRC_EN_TS_NE, | |
| 83 | + STMFX_REG_IRQ_SRC_EN_TS_TH, | |
| 84 | + STMFX_REG_IRQ_SRC_EN_TS_FULL, | |
| 85 | + STMFX_REG_IRQ_SRC_EN_TS_OVF, | |
| 86 | + STMFX_REG_IRQ_SRC_MAX, | |
| 87 | +}; | |
| 88 | + | |
| 89 | +enum stmfx_functions { | |
| 90 | + STMFX_FUNC_GPIO = BIT(0), /* GPIO[15:0] */ | |
| 91 | + STMFX_FUNC_ALTGPIO_LOW = BIT(1), /* aGPIO[3:0] */ | |
| 92 | + STMFX_FUNC_ALTGPIO_HIGH = BIT(2), /* aGPIO[7:4] */ | |
| 93 | + STMFX_FUNC_TS = BIT(3), | |
| 94 | + STMFX_FUNC_IDD = BIT(4), | |
| 95 | +}; | |
| 96 | + | |
| 97 | +/** | |
| 98 | + * struct stmfx_ddata - STMFX MFD structure | |
| 99 | + * @device: device reference used for logs | |
| 100 | + * @map: register map | |
| 101 | + * @vdd: STMFX power supply | |
| 102 | + * @irq_domain: IRQ domain | |
| 103 | + * @lock: IRQ bus lock | |
| 104 | + * @irq_src: cache of IRQ_SRC_EN register for bus_lock | |
| 105 | + * @bkp_sysctrl: backup of SYS_CTRL register for suspend/resume | |
| 106 | + * @bkp_irqoutpin: backup of IRQ_OUT_PIN register for suspend/resume | |
| 107 | + */ | |
| 108 | +struct stmfx { | |
| 109 | + struct device *dev; | |
| 110 | + struct regmap *map; | |
| 111 | + struct regulator *vdd; | |
| 112 | + struct irq_domain *irq_domain; | |
| 113 | + struct mutex lock; /* IRQ bus lock */ | |
| 114 | + u8 irq_src; | |
| 115 | +#ifdef CONFIG_PM | |
| 116 | + u8 bkp_sysctrl; | |
| 117 | + u8 bkp_irqoutpin; | |
| 118 | +#endif | |
| 119 | +}; | |
| 120 | + | |
| 121 | +int stmfx_function_enable(struct stmfx *stmfx, u32 func); | |
| 122 | +int stmfx_function_disable(struct stmfx *stmfx, u32 func); | |
| 123 | +#endif | |
| @@ -1,12 +1,8 @@ | ||
| 1 | +/* SPDX-License-Identifier: GPL-2.0+ */ | |
| 1 | 2 | /* |
| 2 | 3 | * Copyright (C) 2014 Atmel Corporation. |
| 3 | 4 | * |
| 4 | 5 | * Memory Controllers (MATRIX, EBI) - System peripherals registers. |
| 5 | − * | |
| 6 | − * This program is free software; you can redistribute it and/or modify | |
| 7 | − * it under the terms of the GNU General Public License as published by | |
| 8 | − * the Free Software Foundation; either version 2 of the License, or | |
| 9 | − * (at your option) any later version. | |
| 10 | 6 | */ |
| 11 | 7 | |
| 12 | 8 | #ifndef _LINUX_MFD_SYSCON_ATMEL_MATRIX_H |
| @@ -1,3 +1,4 @@ | ||
| 1 | +/* SPDX-License-Identifier: GPL-2.0+ */ | |
| 1 | 2 | /* |
| 2 | 3 | * Copyright (C) 2005 Ivan Kokshaysky |
| 3 | 4 | * Copyright (C) SAN People |
| @@ -5,11 +6,6 @@ · 1 unmodified line | ||
| 5 | 6 | * Memory Controllers (MC, EBI, SMC, SDRAMC, BFC) - System peripherals |
| 6 | 7 | * registers. |
| 7 | 8 | * Based on AT91RM9200 datasheet revision E. |
| 8 | − * | |
| 9 | − * This program is free software; you can redistribute it and/or modify | |
| 10 | − * it under the terms of the GNU General Public License as published by | |
| 11 | − * the Free Software Foundation; either version 2 of the License, or | |
| 12 | − * (at your option) any later version. | |
| 13 | 9 | */ |
| 14 | 10 | |
| 15 | 11 | #ifndef _LINUX_MFD_SYSCON_ATMEL_MC_H_ |
| @@ -1,3 +1,4 @@ | ||
| 1 | +/* SPDX-License-Identifier: GPL-2.0 */ | |
| 1 | 2 | /* |
| 2 | 3 | * Atmel SMC (Static Memory Controller) register offsets and bit definitions. |
| 3 | 4 | * |
| @@ -5,10 +6,6 @@ · 1 unmodified line | ||
| 5 | 6 | * Copyright (C) 2014 Free Electrons |
| 6 | 7 | * |
| 7 | 8 | * Author: Boris Brezillon <boris.brezillon@free-electrons.com> |
| 8 | − * | |
| 9 | − * This program is free software; you can redistribute it and/or modify | |
| 10 | − * it under the terms of the GNU General Public License version 2 as | |
| 11 | − * published by the Free Software Foundation. | |
| 12 | 9 | */ |
| 13 | 10 | |
| 14 | 11 | #ifndef _LINUX_MFD_SYSCON_ATMEL_SMC_H_ |
| @@ -1,14 +1,10 @@ | ||
| 1 | +/* SPDX-License-Identifier: GPL-2.0+ */ | |
| 1 | 2 | /* |
| 2 | 3 | * Copyright (C) 2005 Ivan Kokshaysky |
| 3 | 4 | * Copyright (C) SAN People |
| 4 | 5 | * |
| 5 | 6 | * System Timer (ST) - System peripherals registers. |
| 6 | 7 | * Based on AT91RM9200 datasheet revision E. |
| 7 | − * | |
| 8 | − * This program is free software; you can redistribute it and/or modify | |
| 9 | − * it under the terms of the GNU General Public License as published by | |
| 10 | − * the Free Software Foundation; either version 2 of the License, or | |
| 11 | − * (at your option) any later version. | |
| 12 | 8 | */ |
| 13 | 9 | |
| 14 | 10 | #ifndef _LINUX_MFD_SYSCON_ATMEL_ST_H |
| @@ -410,6 +410,15 @@ · 409 unmodified lines | ||
| 410 | 410 | #define IMX6SX_GPR1_FEC_CLOCK_PAD_DIR_MASK (0x3 << 17) |
| 411 | 411 | #define IMX6SX_GPR1_FEC_CLOCK_MUX_SEL_EXT (0x3 << 13) |
| 412 | 412 | |
| 413 | +#define IMX6SX_GPR2_MQS_OVERSAMPLE_MASK (0x1 << 26) | |
| 414 | +#define IMX6SX_GPR2_MQS_OVERSAMPLE_SHIFT (26) | |
| 415 | +#define IMX6SX_GPR2_MQS_EN_MASK (0x1 << 25) | |
| 416 | +#define IMX6SX_GPR2_MQS_EN_SHIFT (25) | |
| 417 | +#define IMX6SX_GPR2_MQS_SW_RST_MASK (0x1 << 24) | |
| 418 | +#define IMX6SX_GPR2_MQS_SW_RST_SHIFT (24) | |
| 419 | +#define IMX6SX_GPR2_MQS_CLK_DIV_MASK (0xFF << 16) | |
| 420 | +#define IMX6SX_GPR2_MQS_CLK_DIV_SHIFT (16) | |
| 421 | + | |
| 413 | 422 | #define IMX6SX_GPR4_FEC_ENET1_STOP_REQ (0x1 << 3) |
| 414 | 423 | #define IMX6SX_GPR4_FEC_ENET2_STOP_REQ (0x1 << 4) |
| 415 | 424 | |
| @@ -15,50 +15,6 @@ · 14 unmodified lines | ||
| 15 | 15 | |
| 16 | 16 | #include <linux/bitops.h> |
| 17 | 17 | |
| 18 | −/* LM3532 */ | |
| 19 | −#define LM3532_REG_OUTPUT_CFG 0x10 | |
| 20 | −#define LM3532_ILED1_CFG_MASK 0x03 | |
| 21 | −#define LM3532_ILED2_CFG_MASK 0x0C | |
| 22 | −#define LM3532_ILED3_CFG_MASK 0x30 | |
| 23 | −#define LM3532_ILED1_CFG_SHIFT 0 | |
| 24 | −#define LM3532_ILED2_CFG_SHIFT 2 | |
| 25 | −#define LM3532_ILED3_CFG_SHIFT 4 | |
| 26 | − | |
| 27 | −#define LM3532_REG_RAMPUP 0x12 | |
| 28 | −#define LM3532_REG_RAMPDN LM3532_REG_RAMPUP | |
| 29 | −#define LM3532_RAMPUP_MASK 0x07 | |
| 30 | −#define LM3532_RAMPUP_SHIFT 0 | |
| 31 | −#define LM3532_RAMPDN_MASK 0x38 | |
| 32 | −#define LM3532_RAMPDN_SHIFT 3 | |
| 33 | − | |
| 34 | −#define LM3532_REG_ENABLE 0x1D | |
| 35 | − | |
| 36 | −#define LM3532_REG_PWM_A_CFG 0x13 | |
| 37 | −#define LM3532_PWM_A_MASK 0x05 /* zone 0 */ | |
| 38 | −#define LM3532_PWM_ZONE_0 BIT(2) | |
| 39 | − | |
| 40 | −#define LM3532_REG_PWM_B_CFG 0x14 | |
| 41 | −#define LM3532_PWM_B_MASK 0x09 /* zone 1 */ | |
| 42 | −#define LM3532_PWM_ZONE_1 BIT(3) | |
| 43 | − | |
| 44 | −#define LM3532_REG_PWM_C_CFG 0x15 | |
| 45 | −#define LM3532_PWM_C_MASK 0x11 /* zone 2 */ | |
| 46 | −#define LM3532_PWM_ZONE_2 BIT(4) | |
| 47 | − | |
| 48 | −#define LM3532_REG_ZONE_CFG_A 0x16 | |
| 49 | −#define LM3532_REG_ZONE_CFG_B 0x18 | |
| 50 | −#define LM3532_REG_ZONE_CFG_C 0x1A | |
| 51 | −#define LM3532_ZONE_MASK (BIT(2) | BIT(3) | BIT(4)) | |
| 52 | −#define LM3532_ZONE_0 0 | |
| 53 | −#define LM3532_ZONE_1 BIT(2) | |
| 54 | −#define LM3532_ZONE_2 BIT(3) | |
| 55 | − | |
| 56 | −#define LM3532_REG_BRT_A 0x70 /* zone 0 */ | |
| 57 | −#define LM3532_REG_BRT_B 0x76 /* zone 1 */ | |
| 58 | −#define LM3532_REG_BRT_C 0x7C /* zone 2 */ | |
| 59 | − | |
| 60 | −#define LM3532_MAX_REG 0x7E | |
| 61 | − | |
| 62 | 18 | /* LM3631 */ |
| 63 | 19 | #define LM3631_REG_DEVCTRL 0x00 |
| 64 | 20 | #define LM3631_LCD_EN_MASK BIT(1) |
| @@ -22,7 +22,6 @@ · 21 unmodified lines | ||
| 22 | 22 | #define LMU_EVENT_MONITOR_DONE 0x01 |
| 23 | 23 | |
| 24 | 24 | enum ti_lmu_id { |
| 25 | − LM3532, | |
| 26 | 25 | LM3631, |
| 27 | 26 | LM3632, |
| 28 | 27 | LM3633, |
| @@ -1213,6 +1213,6 @@ · 1212 unmodified lines | ||
| 1213 | 1213 | #define WM831X_LDO1_OK_WIDTH 1 /* LDO1_OK */ |
| 1214 | 1214 | |
| 1215 | 1215 | #define WM831X_ISINK_MAX_ISEL 55 |
| 1216 | −extern int wm831x_isinkv_values[WM831X_ISINK_MAX_ISEL + 1]; | |
| 1216 | +extern const unsigned int wm831x_isinkv_values[WM831X_ISINK_MAX_ISEL + 1]; | |
| 1217 | 1217 | |
| 1218 | 1218 | #endif |
| @@ -923,12 +923,4 @@ struct wm8400 { · 922 unmodified lines | ||
| 923 | 923 | #define WM8400_LINE_CMP_VTHD_SHIFT 0 /* LINE_CMP_VTHD - [3:0] */ |
| 924 | 924 | #define WM8400_LINE_CMP_VTHD_WIDTH 4 /* LINE_CMP_VTHD - [3:0] */ |
| 925 | 925 | |
| 926 | −int wm8400_block_read(struct wm8400 *wm8400, u8 reg, int count, u16 *data); | |
| 927 | − | |
| 928 | −static inline int wm8400_set_bits(struct wm8400 *wm8400, u8 reg, | |
| 929 | − u16 mask, u16 val) | |
| 930 | −{ | |
| 931 | − return regmap_update_bits(wm8400->regmap, reg, mask, val); | |
| 932 | −} | |
| 933 | − | |
| 934 | 926 | #endif |
| @@ -170,7 +170,7 @@ static inline void mlx5_cq_arm(struct mlx5_core_cq *cq, u32 cmd, · 169 unmodified lines | ||
| 170 | 170 | doorbell[0] = cpu_to_be32(sn << 28 | cmd | ci); |
| 171 | 171 | doorbell[1] = cpu_to_be32(cq->cqn); |
| 172 | 172 | |
| 173 | − mlx5_write64(doorbell, uar_page + MLX5_CQ_DOORBELL, NULL); | |
| 173 | + mlx5_write64(doorbell, uar_page + MLX5_CQ_DOORBELL); | |
| 174 | 174 | } |
| 175 | 175 | |
| 176 | 176 | static inline void mlx5_cq_hold(struct mlx5_core_cq *cq) |
| @@ -361,6 +361,7 @@ enum { · 360 unmodified lines | ||
| 361 | 361 | |
| 362 | 362 | enum { |
| 363 | 363 | MLX5_GENERAL_SUBTYPE_DELAY_DROP_TIMEOUT = 0x1, |
| 364 | + MLX5_GENERAL_SUBTYPE_PCI_POWER_CHANGE_EVENT = 0x5, | |
| 364 | 365 | }; |
| 365 | 366 | |
| 366 | 367 | enum { |
| @@ -1001,7 +1002,8 @@ enum { · 634 unmodified lines | ||
| 1001 | 1002 | MLX5_MATCH_OUTER_HEADERS = 1 << 0, |
| 1002 | 1003 | MLX5_MATCH_MISC_PARAMETERS = 1 << 1, |
| 1003 | 1004 | MLX5_MATCH_INNER_HEADERS = 1 << 2, |
| 1004 | − | |
| 1005 | + MLX5_MATCH_MISC_PARAMETERS_2 = 1 << 3, | |
| 1006 | + MLX5_MATCH_MISC_PARAMETERS_3 = 1 << 4, | |
| 1005 | 1007 | }; |
| 1006 | 1008 | |
| 1007 | 1009 | enum { |
| @@ -1045,6 +1047,7 @@ enum mlx5_mpls_supported_fields { · 37 unmodified lines | ||
| 1045 | 1047 | }; |
| 1046 | 1048 | |
| 1047 | 1049 | enum mlx5_flex_parser_protos { |
| 1050 | + MLX5_FLEX_PROTO_GENEVE = 1 << 3, | |
| 1048 | 1051 | MLX5_FLEX_PROTO_CW_MPLS_GRE = 1 << 4, |
| 1049 | 1052 | MLX5_FLEX_PROTO_CW_MPLS_UDP = 1 << 5, |
| 1050 | 1053 | }; |
| @@ -1166,6 +1169,12 @@ enum mlx5_qcam_feature_groups { · 115 unmodified lines | ||
| 1166 | 1169 | #define MLX5_CAP_FLOWTABLE_SNIFFER_TX_MAX(mdev, cap) \ |
| 1167 | 1170 | MLX5_CAP_FLOWTABLE_MAX(mdev, flow_table_properties_nic_transmit_sniffer.cap) |
| 1168 | 1171 | |
| 1172 | +#define MLX5_CAP_FLOWTABLE_RDMA_RX(mdev, cap) \ | |
| 1173 | + MLX5_CAP_FLOWTABLE(mdev, flow_table_properties_nic_receive_rdma.cap) | |
| 1174 | + | |
| 1175 | +#define MLX5_CAP_FLOWTABLE_RDMA_RX_MAX(mdev, cap) \ | |
| 1176 | + MLX5_CAP_FLOWTABLE_MAX(mdev, flow_table_properties_nic_receive_rdma.cap) | |
| 1177 | + | |
| 1169 | 1178 | #define MLX5_CAP_ESW_FLOWTABLE(mdev, cap) \ |
| 1170 | 1179 | MLX5_GET(flow_table_eswitch_cap, \ |
| 1171 | 1180 | mdev->caps.hca_cur[MLX5_CAP_ESWITCH_FLOW_TABLE], cap) |
| @@ -36,46 +36,25 @@ · 35 unmodified lines | ||
| 36 | 36 | #define MLX5_BF_OFFSET 0x800 |
| 37 | 37 | #define MLX5_CQ_DOORBELL 0x20 |
| 38 | 38 | |
| 39 | −#if BITS_PER_LONG == 64 | |
| 40 | 39 | /* Assume that we can just write a 64-bit doorbell atomically. s390 |
| 41 | 40 | * actually doesn't have writeq() but S/390 systems don't even have |
| 42 | 41 | * PCI so we won't worry about it. |
| 42 | + * | |
| 43 | + * Note that the write is not atomic on 32-bit systems! In contrast to 64-bit | |
| 44 | + * ones, it requires proper locking. mlx5_write64 doesn't do any locking, so use | |
| 45 | + * it at your own discretion, protected by some kind of lock on 32 bits. | |
| 46 | + * | |
| 47 | + * TODO: use write{q,l}_relaxed() | |
| 43 | 48 | */ |
| 44 | 49 | |
| 45 | −#define MLX5_DECLARE_DOORBELL_LOCK(name) | |
| 46 | −#define MLX5_INIT_DOORBELL_LOCK(ptr) do { } while (0) | |
| 47 | −#define MLX5_GET_DOORBELL_LOCK(ptr) (NULL) | |
| 48 | − | |
| 49 | −static inline void mlx5_write64(__be32 val[2], void __iomem *dest, | |
| 50 | − spinlock_t *doorbell_lock) | |
| 50 | +static inline void mlx5_write64(__be32 val[2], void __iomem *dest) | |
| 51 | 51 | { |
| 52 | +#if BITS_PER_LONG == 64 | |
| 52 | 53 | __raw_writeq(*(u64 *)val, dest); |
| 53 | −} | |
| 54 | − | |
| 55 | 54 | #else |
| 56 | − | |
| 57 | −/* Just fall back to a spinlock to protect the doorbell if | |
| 58 | − * BITS_PER_LONG is 32 -- there's no portable way to do atomic 64-bit | |
| 59 | − * MMIO writes. | |
| 60 | − */ | |
| 61 | − | |
| 62 | −#define MLX5_DECLARE_DOORBELL_LOCK(name) spinlock_t name; | |
| 63 | −#define MLX5_INIT_DOORBELL_LOCK(ptr) spin_lock_init(ptr) | |
| 64 | −#define MLX5_GET_DOORBELL_LOCK(ptr) (ptr) | |
| 65 | − | |
| 66 | −static inline void mlx5_write64(__be32 val[2], void __iomem *dest, | |
| 67 | − spinlock_t *doorbell_lock) | |
| 68 | −{ | |
| 69 | − unsigned long flags; | |
| 70 | − | |
| 71 | − if (doorbell_lock) | |
| 72 | − spin_lock_irqsave(doorbell_lock, flags); | |
| 73 | 55 | __raw_writel((__force u32) val[0], dest); |
| 74 | 56 | __raw_writel((__force u32) val[1], dest + 4); |
| 75 | − if (doorbell_lock) | |
| 76 | − spin_unlock_irqrestore(doorbell_lock, flags); | |
| 77 | −} | |
| 78 | − | |
| 79 | 57 | #endif |
| 58 | +} | |
| 80 | 59 | |
| 81 | 60 | #endif /* MLX5_DOORBELL_H */ |
| @@ -56,7 +56,6 @@ · 55 unmodified lines | ||
| 56 | 56 | |
| 57 | 57 | enum { |
| 58 | 58 | MLX5_BOARD_ID_LEN = 64, |
| 59 | − MLX5_MAX_NAME_LEN = 16, | |
| 60 | 59 | }; |
| 61 | 60 | |
| 62 | 61 | enum { |
| @@ -133,6 +132,7 @@ enum { · 70 unmodified lines | ||
| 133 | 132 | MLX5_REG_MTRC_CONF = 0x9041, |
| 134 | 133 | MLX5_REG_MTRC_STDB = 0x9042, |
| 135 | 134 | MLX5_REG_MTRC_CTRL = 0x9043, |
| 135 | + MLX5_REG_MPEIN = 0x9050, | |
| 136 | 136 | MLX5_REG_MPCNT = 0x9051, |
| 137 | 137 | MLX5_REG_MTPPS = 0x9053, |
| 138 | 138 | MLX5_REG_MTPPSE = 0x9054, |
| @@ -512,8 +512,13 @@ struct mlx5_rl_table { · 373 unmodified lines | ||
| 512 | 512 | struct mlx5_rl_entry *rl_entry; |
| 513 | 513 | }; |
| 514 | 514 | |
| 515 | +struct mlx5_core_roce { | |
| 516 | + struct mlx5_flow_table *ft; | |
| 517 | + struct mlx5_flow_group *fg; | |
| 518 | + struct mlx5_flow_handle *allow_rule; | |
| 519 | +}; | |
| 520 | + | |
| 515 | 521 | struct mlx5_priv { |
| 516 | − char name[MLX5_MAX_NAME_LEN]; | |
| 517 | 522 | struct mlx5_eq_table *eq_table; |
| 518 | 523 | |
| 519 | 524 | /* pages stuff */ |
| @@ -566,6 +571,7 @@ struct mlx5_priv { · 46 unmodified lines | ||
| 566 | 571 | struct mlx5_lag *lag; |
| 567 | 572 | struct mlx5_devcom *devcom; |
| 568 | 573 | unsigned long pci_dev_data; |
| 574 | + struct mlx5_core_roce roce; | |
| 569 | 575 | struct mlx5_fc_stats fc_stats; |
| 570 | 576 | struct mlx5_rl_table rl_table; |
| 571 | 577 | |
| @@ -642,6 +648,7 @@ struct mlx5_fw_tracer; · 70 unmodified lines | ||
| 642 | 648 | struct mlx5_vxlan; |
| 643 | 649 | |
| 644 | 650 | struct mlx5_core_dev { |
| 651 | + struct device *device; | |
| 645 | 652 | struct pci_dev *pdev; |
| 646 | 653 | /* sync pci state */ |
| 647 | 654 | struct mutex pci_status_mutex; |
| @@ -662,6 +669,7 @@ struct mlx5_core_dev { · 14 unmodified lines | ||
| 662 | 669 | u64 sys_image_guid; |
| 663 | 670 | phys_addr_t iseg_base; |
| 664 | 671 | struct mlx5_init_seg __iomem *iseg; |
| 672 | + phys_addr_t bar_addr; | |
| 665 | 673 | enum mlx5_device_state state; |
| 666 | 674 | /* sync interface state */ |
| 667 | 675 | struct mutex intf_state_mutex; |
| @@ -681,7 +689,6 @@ struct mlx5_core_dev { · 13 unmodified lines | ||
| 681 | 689 | #endif |
| 682 | 690 | struct mlx5_clock clock; |
| 683 | 691 | struct mlx5_ib_clock_info *clock_info; |
| 684 | − struct page *clock_info_page; | |
| 685 | 692 | struct mlx5_fw_tracer *tracer; |
| 686 | 693 | }; |
| 687 | 694 | |
| @@ -887,6 +894,7 @@ void mlx5_cmd_mbox_status(void *out, u8 *status, u32 *syndrome); · 199 unmodified lines | ||
| 887 | 894 | int mlx5_core_get_caps(struct mlx5_core_dev *dev, enum mlx5_cap_type cap_type); |
| 888 | 895 | int mlx5_cmd_alloc_uar(struct mlx5_core_dev *dev, u32 *uarn); |
| 889 | 896 | int mlx5_cmd_free_uar(struct mlx5_core_dev *dev, u32 uarn); |
| 897 | +void mlx5_health_flush(struct mlx5_core_dev *dev); | |
| 890 | 898 | void mlx5_health_cleanup(struct mlx5_core_dev *dev); |
| 891 | 899 | int mlx5_health_init(struct mlx5_core_dev *dev); |
| 892 | 900 | void mlx5_start_health_poll(struct mlx5_core_dev *dev); |
| @@ -35,7 +35,7 @@ struct mlx5_eswitch_rep_if { · 34 unmodified lines | ||
| 35 | 35 | void (*unload)(struct mlx5_eswitch_rep *rep); |
| 36 | 36 | void *(*get_proto_dev)(struct mlx5_eswitch_rep *rep); |
| 37 | 37 | void *priv; |
| 38 | − u8 state; | |
| 38 | + atomic_t state; | |
| 39 | 39 | }; |
| 40 | 40 | |
| 41 | 41 | struct mlx5_eswitch_rep { |
| @@ -73,6 +73,13 @@ enum mlx5_flow_namespace_type { · 72 unmodified lines | ||
| 73 | 73 | MLX5_FLOW_NAMESPACE_SNIFFER_RX, |
| 74 | 74 | MLX5_FLOW_NAMESPACE_SNIFFER_TX, |
| 75 | 75 | MLX5_FLOW_NAMESPACE_EGRESS, |
| 76 | + MLX5_FLOW_NAMESPACE_RDMA_RX, | |
| 77 | +}; | |
| 78 | + | |
| 79 | +enum { | |
| 80 | + FDB_BYPASS_PATH, | |
| 81 | + FDB_FAST_PATH, | |
| 82 | + FDB_SLOW_PATH, | |
| 76 | 83 | }; |
| 77 | 84 | |
| 78 | 85 | struct mlx5_flow_table; |
| @@ -80,6 +80,19 @@ enum { · 79 unmodified lines | ||
| 80 | 80 | MLX5_SHARED_RESOURCE_UID = 0xffff, |
| 81 | 81 | }; |
| 82 | 82 | |
| 83 | +enum { | |
| 84 | + MLX5_OBJ_TYPE_SW_ICM = 0x0008, | |
| 85 | +}; | |
| 86 | + | |
| 87 | +enum { | |
| 88 | + MLX5_GENERAL_OBJ_TYPES_CAP_SW_ICM = (1ULL << MLX5_OBJ_TYPE_SW_ICM), | |
| 89 | + MLX5_GENERAL_OBJ_TYPES_CAP_GENEVE_TLV_OPT = (1ULL << 11), | |
| 90 | +}; | |
| 91 | + | |
| 92 | +enum { | |
| 93 | + MLX5_OBJ_TYPE_GENEVE_TLV_OPT = 0x000b, | |
| 94 | +}; | |
| 95 | + | |
| 83 | 96 | enum { |
| 84 | 97 | MLX5_CMD_OP_QUERY_HCA_CAP = 0x100, |
| 85 | 98 | MLX5_CMD_OP_QUERY_ADAPTER = 0x101, |
| @@ -299,7 +312,11 @@ struct mlx5_ifc_flow_table_fields_supported_bits { · 213 unmodified lines | ||
| 299 | 312 | u8 outer_gre_protocol[0x1]; |
| 300 | 313 | u8 outer_gre_key[0x1]; |
| 301 | 314 | u8 outer_vxlan_vni[0x1]; |
| 302 | − u8 reserved_at_1a[0x5]; | |
| 315 | + u8 outer_geneve_vni[0x1]; | |
| 316 | + u8 outer_geneve_oam[0x1]; | |
| 317 | + u8 outer_geneve_protocol_type[0x1]; | |
| 318 | + u8 outer_geneve_opt_len[0x1]; | |
| 319 | + u8 reserved_at_1e[0x1]; | |
| 303 | 320 | u8 source_eswitch_port[0x1]; |
| 304 | 321 | |
| 305 | 322 | u8 inner_dmac[0x1]; |
| @@ -327,7 +344,8 @@ struct mlx5_ifc_flow_table_fields_supported_bits { · 21 unmodified lines | ||
| 327 | 344 | u8 inner_tcp_flags[0x1]; |
| 328 | 345 | u8 reserved_at_37[0x9]; |
| 329 | 346 | |
| 330 | − u8 reserved_at_40[0x5]; | |
| 347 | + u8 geneve_tlv_option_0_data[0x1]; | |
| 348 | + u8 reserved_at_41[0x4]; | |
| 331 | 349 | u8 outer_first_mpls_over_udp[0x4]; |
| 332 | 350 | u8 outer_first_mpls_over_gre[0x4]; |
| 333 | 351 | u8 inner_first_mpls[0x4]; |
| @@ -357,11 +375,14 @@ struct mlx5_ifc_flow_table_prop_layout_bits { · 23 unmodified lines | ||
| 357 | 375 | u8 pop_vlan_2[0x1]; |
| 358 | 376 | u8 push_vlan_2[0x1]; |
| 359 | 377 | u8 reformat_and_vlan_action[0x1]; |
| 360 | − u8 reserved_at_10[0x2]; | |
| 378 | + u8 reserved_at_10[0x1]; | |
| 379 | + u8 sw_owner[0x1]; | |
| 361 | 380 | u8 reformat_l3_tunnel_to_l2[0x1]; |
| 362 | 381 | u8 reformat_l2_to_l3_tunnel[0x1]; |
| 363 | 382 | u8 reformat_and_modify_action[0x1]; |
| 364 | − u8 reserved_at_15[0xb]; | |
| 383 | + u8 reserved_at_15[0x2]; | |
| 384 | + u8 table_miss_action_domain[0x1]; | |
| 385 | + u8 reserved_at_18[0x8]; | |
| 365 | 386 | u8 reserved_at_20[0x2]; |
| 366 | 387 | u8 log_max_ft_size[0x6]; |
| 367 | 388 | u8 log_max_modify_header_context[0x8]; |
| @@ -469,7 +490,9 @@ struct mlx5_ifc_fte_match_set_misc_bits { · 101 unmodified lines | ||
| 469 | 490 | u8 vxlan_vni[0x18]; |
| 470 | 491 | u8 reserved_at_b8[0x8]; |
| 471 | 492 | |
| 472 | − u8 reserved_at_c0[0x20]; | |
| 493 | + u8 geneve_vni[0x18]; | |
| 494 | + u8 reserved_at_d8[0x7]; | |
| 495 | + u8 geneve_oam[0x1]; | |
| 473 | 496 | |
| 474 | 497 | u8 reserved_at_e0[0xc]; |
| 475 | 498 | u8 outer_ipv6_flow_label[0x14]; |
| @@ -477,7 +500,11 @@ struct mlx5_ifc_fte_match_set_misc_bits { · 1 unmodified line | ||
| 477 | 500 | u8 reserved_at_100[0xc]; |
| 478 | 501 | u8 inner_ipv6_flow_label[0x14]; |
| 479 | 502 | |
| 480 | − u8 reserved_at_120[0x28]; | |
| 503 | + u8 reserved_at_120[0xa]; | |
| 504 | + u8 geneve_opt_len[0x6]; | |
| 505 | + u8 geneve_protocol_type[0x10]; | |
| 506 | + | |
| 507 | + u8 reserved_at_140[0x8]; | |
| 481 | 508 | u8 bth_dst_qp[0x18]; |
| 482 | 509 | u8 reserved_at_160[0x20]; |
| 483 | 510 | u8 outer_esp_spi[0x20]; |
| @@ -507,6 +534,12 @@ struct mlx5_ifc_fte_match_set_misc2_bits { · 23 unmodified lines | ||
| 507 | 534 | u8 reserved_at_1a0[0x60]; |
| 508 | 535 | }; |
| 509 | 536 | |
| 537 | +struct mlx5_ifc_fte_match_set_misc3_bits { | |
| 538 | + u8 reserved_at_0[0x120]; | |
| 539 | + u8 geneve_tlv_option_0_data[0x20]; | |
| 540 | + u8 reserved_at_140[0xc0]; | |
| 541 | +}; | |
| 542 | + | |
| 510 | 543 | struct mlx5_ifc_cmd_pas_bits { |
| 511 | 544 | u8 pa_h[0x20]; |
| 512 | 545 | |
| @@ -589,7 +622,7 @@ struct mlx5_ifc_flow_table_nic_cap_bits { · 76 unmodified lines | ||
| 589 | 622 | |
| 590 | 623 | struct mlx5_ifc_flow_table_prop_layout_bits flow_table_properties_nic_receive; |
| 591 | 624 | |
| 592 | − u8 reserved_at_400[0x200]; | |
| 625 | + struct mlx5_ifc_flow_table_prop_layout_bits flow_table_properties_nic_receive_rdma; | |
| 593 | 626 | |
| 594 | 627 | struct mlx5_ifc_flow_table_prop_layout_bits flow_table_properties_nic_receive_sniffer; |
| 595 | 628 | |
| @@ -770,7 +803,19 @@ struct mlx5_ifc_device_mem_cap_bits { · 174 unmodified lines | ||
| 770 | 803 | |
| 771 | 804 | u8 max_memic_size[0x20]; |
| 772 | 805 | |
| 773 | − u8 reserved_at_c0[0x740]; | |
| 806 | + u8 steering_sw_icm_start_address[0x40]; | |
| 807 | + | |
| 808 | + u8 reserved_at_100[0x8]; | |
| 809 | + u8 log_header_modify_sw_icm_size[0x8]; | |
| 810 | + u8 reserved_at_110[0x2]; | |
| 811 | + u8 log_sw_icm_alloc_granularity[0x6]; | |
| 812 | + u8 log_steering_sw_icm_size[0x8]; | |
| 813 | + | |
| 814 | + u8 reserved_at_120[0x20]; | |
| 815 | + | |
| 816 | + u8 header_modify_sw_icm_start_address[0x40]; | |
| 817 | + | |
| 818 | + u8 reserved_at_180[0x680]; | |
| 774 | 819 | }; |
| 775 | 820 | |
| 776 | 821 | enum { |
| @@ -919,6 +964,7 @@ enum { · 142 unmodified lines | ||
| 919 | 964 | |
| 920 | 965 | enum { |
| 921 | 966 | MLX5_UCTX_CAP_RAW_TX = 1UL << 0, |
| 967 | + MLX5_UCTX_CAP_INTERNAL_DEV_RES = 1UL << 1, | |
| 922 | 968 | }; |
| 923 | 969 | |
| 924 | 970 | struct mlx5_ifc_cmd_hca_cap_bits { |
| @@ -929,7 +975,9 @@ struct mlx5_ifc_cmd_hca_cap_bits { · 4 unmodified lines | ||
| 929 | 975 | |
| 930 | 976 | u8 log_max_srq_sz[0x8]; |
| 931 | 977 | u8 log_max_qp_sz[0x8]; |
| 932 | − u8 reserved_at_90[0xb]; | |
| 978 | + u8 reserved_at_90[0x8]; | |
| 979 | + u8 prio_tag_required[0x1]; | |
| 980 | + u8 reserved_at_99[0x2]; | |
| 933 | 981 | u8 log_max_qp[0x5]; |
| 934 | 982 | |
| 935 | 983 | u8 reserved_at_a0[0xb]; |
| @@ -1211,7 +1259,11 @@ struct mlx5_ifc_cmd_hca_cap_bits { · 275 unmodified lines | ||
| 1211 | 1259 | u8 num_of_uars_per_page[0x20]; |
| 1212 | 1260 | |
| 1213 | 1261 | u8 flex_parser_protocols[0x20]; |
| 1214 | − u8 reserved_at_560[0x20]; | |
| 1262 | + | |
| 1263 | + u8 max_geneve_tlv_options[0x8]; | |
| 1264 | + u8 reserved_at_568[0x3]; | |
| 1265 | + u8 max_geneve_tlv_option_data_len[0x5]; | |
| 1266 | + u8 reserved_at_570[0x10]; | |
| 1215 | 1267 | |
| 1216 | 1268 | u8 reserved_at_580[0x3c]; |
| 1217 | 1269 | u8 mini_cqe_resp_stride_index[0x1]; |
| @@ -1247,7 +1299,9 @@ struct mlx5_ifc_cmd_hca_cap_bits { · 29 unmodified lines | ||
| 1247 | 1299 | |
| 1248 | 1300 | u8 uctx_cap[0x20]; |
| 1249 | 1301 | |
| 1250 | − u8 reserved_at_6c0[0x140]; | |
| 1302 | + u8 reserved_at_6c0[0x4]; | |
| 1303 | + u8 flex_parser_id_geneve_tlv_option_0[0x4]; | |
| 1304 | + u8 reserved_at_6c8[0x138]; | |
| 1251 | 1305 | }; |
| 1252 | 1306 | |
| 1253 | 1307 | enum mlx5_flow_destination_type { |
| @@ -1260,6 +1314,12 @@ enum mlx5_flow_destination_type { · 6 unmodified lines | ||
| 1260 | 1314 | MLX5_FLOW_DESTINATION_TYPE_FLOW_TABLE_NUM = 0x101, |
| 1261 | 1315 | }; |
| 1262 | 1316 | |
| 1317 | +enum mlx5_flow_table_miss_action { | |
| 1318 | + MLX5_FLOW_TABLE_MISS_ACTION_DEF, | |
| 1319 | + MLX5_FLOW_TABLE_MISS_ACTION_FWD, | |
| 1320 | + MLX5_FLOW_TABLE_MISS_ACTION_SWITCH_DOMAIN, | |
| 1321 | +}; | |
| 1322 | + | |
| 1263 | 1323 | struct mlx5_ifc_dest_format_struct_bits { |
| 1264 | 1324 | u8 destination_type[0x8]; |
| 1265 | 1325 | u8 destination_id[0x18]; |
| @@ -1299,7 +1359,9 @@ struct mlx5_ifc_fte_match_param_bits { · 33 unmodified lines | ||
| 1299 | 1359 | |
| 1300 | 1360 | struct mlx5_ifc_fte_match_set_misc2_bits misc_parameters_2; |
| 1301 | 1361 | |
| 1302 | − u8 reserved_at_800[0x800]; | |
| 1362 | + struct mlx5_ifc_fte_match_set_misc3_bits misc_parameters_3; | |
| 1363 | + | |
| 1364 | + u8 reserved_at_a00[0x600]; | |
| 1303 | 1365 | }; |
| 1304 | 1366 | |
| 1305 | 1367 | enum { |
| @@ -2920,6 +2982,7 @@ enum { · 1614 unmodified lines | ||
| 2920 | 2982 | MLX5_MKC_ACCESS_MODE_MTT = 0x1, |
| 2921 | 2983 | MLX5_MKC_ACCESS_MODE_KLMS = 0x2, |
| 2922 | 2984 | MLX5_MKC_ACCESS_MODE_KSM = 0x3, |
| 2985 | + MLX5_MKC_ACCESS_MODE_SW_ICM = 0x4, | |
| 2923 | 2986 | MLX5_MKC_ACCESS_MODE_MEMIC = 0x5, |
| 2924 | 2987 | }; |
| 2925 | 2988 | |
| @@ -4807,6 +4870,7 @@ enum { · 1881 unmodified lines | ||
| 4807 | 4870 | MLX5_QUERY_FLOW_GROUP_OUT_MATCH_CRITERIA_ENABLE_MISC_PARAMETERS = 0x1, |
| 4808 | 4871 | MLX5_QUERY_FLOW_GROUP_OUT_MATCH_CRITERIA_ENABLE_INNER_HEADERS = 0x2, |
| 4809 | 4872 | MLX5_QUERY_FLOW_GROUP_IN_MATCH_CRITERIA_ENABLE_MISC_PARAMETERS_2 = 0x3, |
| 4873 | + MLX5_QUERY_FLOW_GROUP_IN_MATCH_CRITERIA_ENABLE_MISC_PARAMETERS_3 = 0x4, | |
| 4810 | 4874 | }; |
| 4811 | 4875 | |
| 4812 | 4876 | struct mlx5_ifc_query_flow_group_out_bits { |
| @@ -5110,6 +5174,7 @@ enum { · 297 unmodified lines | ||
| 5110 | 5174 | MLX5_ACTION_IN_FIELD_OUT_DIPV6_31_0 = 0x14, |
| 5111 | 5175 | MLX5_ACTION_IN_FIELD_OUT_SIPV4 = 0x15, |
| 5112 | 5176 | MLX5_ACTION_IN_FIELD_OUT_DIPV4 = 0x16, |
| 5177 | + MLX5_ACTION_IN_FIELD_OUT_FIRST_VID = 0x17, | |
| 5113 | 5178 | MLX5_ACTION_IN_FIELD_OUT_IPV6_HOPLIMIT = 0x47, |
| 5114 | 5179 | }; |
| 5115 | 5180 | |
| @@ -6874,14 +6939,14 @@ struct mlx5_ifc_create_tis_in_bits { · 1758 unmodified lines | ||
| 6874 | 6939 | |
| 6875 | 6940 | struct mlx5_ifc_create_tir_out_bits { |
| 6876 | 6941 | u8 status[0x8]; |
| 6877 | − u8 reserved_at_8[0x18]; | |
| 6942 | + u8 icm_address_63_40[0x18]; | |
| 6878 | 6943 | |
| 6879 | 6944 | u8 syndrome[0x20]; |
| 6880 | 6945 | |
| 6881 | − u8 reserved_at_40[0x8]; | |
| 6946 | + u8 icm_address_39_32[0x8]; | |
| 6882 | 6947 | u8 tirn[0x18]; |
| 6883 | 6948 | |
| 6884 | − u8 reserved_at_60[0x20]; | |
| 6949 | + u8 icm_address_31_0[0x20]; | |
| 6885 | 6950 | }; |
| 6886 | 6951 | |
| 6887 | 6952 | struct mlx5_ifc_create_tir_in_bits { |
| @@ -7279,7 +7344,7 @@ struct mlx5_ifc_create_eq_out_bits { · 391 unmodified lines | ||
| 7279 | 7344 | |
| 7280 | 7345 | struct mlx5_ifc_create_eq_in_bits { |
| 7281 | 7346 | u8 opcode[0x10]; |
| 7282 | − u8 reserved_at_10[0x10]; | |
| 7347 | + u8 uid[0x10]; | |
| 7283 | 7348 | |
| 7284 | 7349 | u8 reserved_at_20[0x10]; |
| 7285 | 7350 | u8 op_mod[0x10]; |
| @@ -8026,6 +8091,52 @@ struct mlx5_ifc_ppcnt_reg_bits { · 740 unmodified lines | ||
| 8026 | 8091 | union mlx5_ifc_eth_cntrs_grp_data_layout_auto_bits counter_set; |
| 8027 | 8092 | }; |
| 8028 | 8093 | |
| 8094 | +struct mlx5_ifc_mpein_reg_bits { | |
| 8095 | + u8 reserved_at_0[0x2]; | |
| 8096 | + u8 depth[0x6]; | |
| 8097 | + u8 pcie_index[0x8]; | |
| 8098 | + u8 node[0x8]; | |
| 8099 | + u8 reserved_at_18[0x8]; | |
| 8100 | + | |
| 8101 | + u8 capability_mask[0x20]; | |
| 8102 | + | |
| 8103 | + u8 reserved_at_40[0x8]; | |
| 8104 | + u8 link_width_enabled[0x8]; | |
| 8105 | + u8 link_speed_enabled[0x10]; | |
| 8106 | + | |
| 8107 | + u8 lane0_physical_position[0x8]; | |
| 8108 | + u8 link_width_active[0x8]; | |
| 8109 | + u8 link_speed_active[0x10]; | |
| 8110 | + | |
| 8111 | + u8 num_of_pfs[0x10]; | |
| 8112 | + u8 num_of_vfs[0x10]; | |
| 8113 | + | |
| 8114 | + u8 bdf0[0x10]; | |
| 8115 | + u8 reserved_at_b0[0x10]; | |
| 8116 | + | |
| 8117 | + u8 max_read_request_size[0x4]; | |
| 8118 | + u8 max_payload_size[0x4]; | |
| 8119 | + u8 reserved_at_c8[0x5]; | |
| 8120 | + u8 pwr_status[0x3]; | |
| 8121 | + u8 port_type[0x4]; | |
| 8122 | + u8 reserved_at_d4[0xb]; | |
| 8123 | + u8 lane_reversal[0x1]; | |
| 8124 | + | |
| 8125 | + u8 reserved_at_e0[0x14]; | |
| 8126 | + u8 pci_power[0xc]; | |
| 8127 | + | |
| 8128 | + u8 reserved_at_100[0x20]; | |
| 8129 | + | |
| 8130 | + u8 device_status[0x10]; | |
| 8131 | + u8 port_state[0x8]; | |
| 8132 | + u8 reserved_at_138[0x8]; | |
| 8133 | + | |
| 8134 | + u8 reserved_at_140[0x10]; | |
| 8135 | + u8 receiver_detect_result[0x10]; | |
| 8136 | + | |
| 8137 | + u8 reserved_at_160[0x20]; | |
| 8138 | +}; | |
| 8139 | + | |
| 8029 | 8140 | struct mlx5_ifc_mpcnt_reg_bits { |
| 8030 | 8141 | u8 reserved_at_0[0x8]; |
| 8031 | 8142 | u8 pcie_index[0x8]; |
| @@ -8345,7 +8456,9 @@ struct mlx5_ifc_pcam_reg_bits { · 313 unmodified lines | ||
| 8345 | 8456 | }; |
| 8346 | 8457 | |
| 8347 | 8458 | struct mlx5_ifc_mcam_enhanced_features_bits { |
| 8348 | − u8 reserved_at_0[0x74]; | |
| 8459 | + u8 reserved_at_0[0x6e]; | |
| 8460 | + u8 pci_status_and_power[0x1]; | |
| 8461 | + u8 reserved_at_6f[0x5]; | |
| 8349 | 8462 | u8 mark_tx_action_cnp[0x1]; |
| 8350 | 8463 | u8 mark_tx_action_cqe[0x1]; |
| 8351 | 8464 | u8 dynamic_tx_overflow[0x1]; |
| @@ -8953,6 +9066,7 @@ union mlx5_ifc_ports_control_registers_document_bits { · 601 unmodified lines | ||
| 8953 | 9066 | struct mlx5_ifc_pmtu_reg_bits pmtu_reg; |
| 8954 | 9067 | struct mlx5_ifc_ppad_reg_bits ppad_reg; |
| 8955 | 9068 | struct mlx5_ifc_ppcnt_reg_bits ppcnt_reg; |
| 9069 | + struct mlx5_ifc_mpein_reg_bits mpein_reg; | |
| 8956 | 9070 | struct mlx5_ifc_mpcnt_reg_bits mpcnt_reg; |
| 8957 | 9071 | struct mlx5_ifc_pplm_reg_bits pplm_reg; |
| 8958 | 9072 | struct mlx5_ifc_pplr_reg_bits pplr_reg; |
| @@ -9442,6 +9556,33 @@ struct mlx5_ifc_uctx_bits { · 483 unmodified lines | ||
| 9442 | 9556 | u8 reserved_at_20[0x160]; |
| 9443 | 9557 | }; |
| 9444 | 9558 | |
| 9559 | +struct mlx5_ifc_sw_icm_bits { | |
| 9560 | + u8 modify_field_select[0x40]; | |
| 9561 | + | |
| 9562 | + u8 reserved_at_40[0x18]; | |
| 9563 | + u8 log_sw_icm_size[0x8]; | |
| 9564 | + | |
| 9565 | + u8 reserved_at_60[0x20]; | |
| 9566 | + | |
| 9567 | + u8 sw_icm_start_addr[0x40]; | |
| 9568 | + | |
| 9569 | + u8 reserved_at_c0[0x140]; | |
| 9570 | +}; | |
| 9571 | + | |
| 9572 | +struct mlx5_ifc_geneve_tlv_option_bits { | |
| 9573 | + u8 modify_field_select[0x40]; | |
| 9574 | + | |
| 9575 | + u8 reserved_at_40[0x18]; | |
| 9576 | + u8 geneve_option_fte_index[0x8]; | |
| 9577 | + | |
| 9578 | + u8 option_class[0x10]; | |
| 9579 | + u8 option_type[0x8]; | |
| 9580 | + u8 reserved_at_78[0x3]; | |
| 9581 | + u8 option_data_length[0x5]; | |
| 9582 | + | |
| 9583 | + u8 reserved_at_80[0x180]; | |
| 9584 | +}; | |
| 9585 | + | |
| 9445 | 9586 | struct mlx5_ifc_create_umem_in_bits { |
| 9446 | 9587 | u8 opcode[0x10]; |
| 9447 | 9588 | u8 uid[0x10]; |
| @@ -9479,6 +9620,16 @@ struct mlx5_ifc_destroy_uctx_in_bits { · 31 unmodified lines | ||
| 9479 | 9620 | u8 reserved_at_60[0x20]; |
| 9480 | 9621 | }; |
| 9481 | 9622 | |
| 9623 | +struct mlx5_ifc_create_sw_icm_in_bits { | |
| 9624 | + struct mlx5_ifc_general_obj_in_cmd_hdr_bits hdr; | |
| 9625 | + struct mlx5_ifc_sw_icm_bits sw_icm; | |
| 9626 | +}; | |
| 9627 | + | |
| 9628 | +struct mlx5_ifc_create_geneve_tlv_option_in_bits { | |
| 9629 | + struct mlx5_ifc_general_obj_in_cmd_hdr_bits hdr; | |
| 9630 | + struct mlx5_ifc_geneve_tlv_option_bits geneve_tlv_opt; | |
| 9631 | +}; | |
| 9632 | + | |
| 9482 | 9633 | struct mlx5_ifc_mtrc_string_db_param_bits { |
| 9483 | 9634 | u8 string_db_base_address[0x20]; |
| 9484 | 9635 | |
| @@ -60,6 +60,7 @@ enum mlx5_an_status { · 59 unmodified lines | ||
| 60 | 60 | #define MLX5_I2C_ADDR_LOW 0x50 |
| 61 | 61 | #define MLX5_I2C_ADDR_HIGH 0x51 |
| 62 | 62 | #define MLX5_EEPROM_PAGE_LENGTH 256 |
| 63 | +#define MLX5_EEPROM_HIGH_PAGE_LENGTH 128 | |
| 63 | 64 | |
| 64 | 65 | enum mlx5e_link_mode { |
| 65 | 66 | MLX5E_1000BASE_CX_SGMII = 0, |
| @@ -395,6 +395,7 @@ struct mlx5_wqe_signature_seg { · 394 unmodified lines | ||
| 395 | 395 | |
| 396 | 396 | struct mlx5_wqe_inline_seg { |
| 397 | 397 | __be32 byte_count; |
| 398 | + __be32 data[0]; | |
| 398 | 399 | }; |
| 399 | 400 | |
| 400 | 401 | enum mlx5_sig_type { |
| @@ -50,6 +50,9 @@ int mlx5_core_query_sq(struct mlx5_core_dev *dev, u32 sqn, u32 *out); · 49 unmodified lines | ||
| 50 | 50 | int mlx5_core_query_sq_state(struct mlx5_core_dev *dev, u32 sqn, u8 *state); |
| 51 | 51 | int mlx5_core_create_tir(struct mlx5_core_dev *dev, u32 *in, int inlen, |
| 52 | 52 | u32 *tirn); |
| 53 | +int mlx5_core_create_tir_out(struct mlx5_core_dev *dev, | |
| 54 | + u32 *in, int inlen, | |
| 55 | + u32 *out, int outlen); | |
| 53 | 56 | int mlx5_core_modify_tir(struct mlx5_core_dev *dev, u32 tirn, u32 *in, |
| 54 | 57 | int inlen); |
| 55 | 58 | void mlx5_core_destroy_tir(struct mlx5_core_dev *dev, u32 tirn); |
| @@ -118,10 +118,6 @@ int mlx5_modify_nic_vport_promisc(struct mlx5_core_dev *mdev, · 117 unmodified lines | ||
| 118 | 118 | int promisc_uc, |
| 119 | 119 | int promisc_mc, |
| 120 | 120 | int promisc_all); |
| 121 | −int mlx5_query_nic_vport_vlans(struct mlx5_core_dev *dev, | |
| 122 | − u16 vport, | |
| 123 | − u16 vlans[], | |
| 124 | − int *size); | |
| 125 | 121 | int mlx5_modify_nic_vport_vlans(struct mlx5_core_dev *dev, |
| 126 | 122 | u16 vlans[], |
| 127 | 123 | int list_size); |
| @@ -124,10 +124,45 @@ extern int mmap_rnd_compat_bits __read_mostly; · 123 unmodified lines | ||
| 124 | 124 | |
| 125 | 125 | /* |
| 126 | 126 | * On some architectures it is expensive to call memset() for small sizes. |
| 127 | − * Those architectures should provide their own implementation of "struct page" | |
| 128 | − * zeroing by defining this macro in <asm/pgtable.h>. | |
| 127 | + * If an architecture decides to implement their own version of | |
| 128 | + * mm_zero_struct_page they should wrap the defines below in a #ifndef and | |
| 129 | + * define their own version of this macro in <asm/pgtable.h> | |
| 129 | 130 | */ |
| 130 | −#ifndef mm_zero_struct_page | |
| 131 | +#if BITS_PER_LONG == 64 | |
| 132 | +/* This function must be updated when the size of struct page grows above 80 | |
| 133 | + * or reduces below 56. The idea that compiler optimizes out switch() | |
| 134 | + * statement, and only leaves move/store instructions. Also the compiler can | |
| 135 | + * combine write statments if they are both assignments and can be reordered, | |
| 136 | + * this can result in several of the writes here being dropped. | |
| 137 | + */ | |
| 138 | +#define mm_zero_struct_page(pp) __mm_zero_struct_page(pp) | |
| 139 | +static inline void __mm_zero_struct_page(struct page *page) | |
| 140 | +{ | |
| 141 | + unsigned long *_pp = (void *)page; | |
| 142 | + | |
| 143 | + /* Check that struct page is either 56, 64, 72, or 80 bytes */ | |
| 144 | + BUILD_BUG_ON(sizeof(struct page) & 7); | |
| 145 | + BUILD_BUG_ON(sizeof(struct page) < 56); | |
| 146 | + BUILD_BUG_ON(sizeof(struct page) > 80); | |
| 147 | + | |
| 148 | + switch (sizeof(struct page)) { | |
| 149 | + case 80: | |
| 150 | + _pp[9] = 0; /* fallthrough */ | |
| 151 | + case 72: | |
| 152 | + _pp[8] = 0; /* fallthrough */ | |
| 153 | + case 64: | |
| 154 | + _pp[7] = 0; /* fallthrough */ | |
| 155 | + case 56: | |
| 156 | + _pp[6] = 0; | |
| 157 | + _pp[5] = 0; | |
| 158 | + _pp[4] = 0; | |
| 159 | + _pp[3] = 0; | |
| 160 | + _pp[2] = 0; | |
| 161 | + _pp[1] = 0; | |
| 162 | + _pp[0] = 0; | |
| 163 | + } | |
| 164 | +} | |
| 165 | +#else | |
| 131 | 166 | #define mm_zero_struct_page(pp) ((void)memset((pp), 0, sizeof(struct page))) |
| 132 | 167 | #endif |
| 133 | 168 | |
| @@ -501,9 +536,6 @@ static inline void vma_set_anonymous(struct vm_area_struct *vma) · 367 unmodified lines | ||
| 501 | 536 | struct mmu_gather; |
| 502 | 537 | struct inode; |
| 503 | 538 | |
| 504 | −#define page_private(page) ((page)->private) | |
| 505 | −#define set_page_private(page, v) ((page)->private = (v)) | |
| 506 | − | |
| 507 | 539 | #if !defined(__HAVE_ARCH_PTE_DEVMAP) || !defined(CONFIG_TRANSPARENT_HUGEPAGE) |
| 508 | 540 | static inline int pmd_devmap(pmd_t pmd) |
| 509 | 541 | { |
| @@ -1007,6 +1039,30 @@ static inline void put_page(struct page *page) · 497 unmodified lines | ||
| 1007 | 1039 | __put_page(page); |
| 1008 | 1040 | } |
| 1009 | 1041 | |
| 1042 | +/** | |
| 1043 | + * put_user_page() - release a gup-pinned page | |
| 1044 | + * @page: pointer to page to be released | |
| 1045 | + * | |
| 1046 | + * Pages that were pinned via get_user_pages*() must be released via | |
| 1047 | + * either put_user_page(), or one of the put_user_pages*() routines | |
| 1048 | + * below. This is so that eventually, pages that are pinned via | |
| 1049 | + * get_user_pages*() can be separately tracked and uniquely handled. In | |
| 1050 | + * particular, interactions with RDMA and filesystems need special | |
| 1051 | + * handling. | |
| 1052 | + * | |
| 1053 | + * put_user_page() and put_page() are not interchangeable, despite this early | |
| 1054 | + * implementation that makes them look the same. put_user_page() calls must | |
| 1055 | + * be perfectly matched up with get_user_page() calls. | |
| 1056 | + */ | |
| 1057 | +static inline void put_user_page(struct page *page) | |
| 1058 | +{ | |
| 1059 | + put_page(page); | |
| 1060 | +} | |
| 1061 | + | |
| 1062 | +void put_user_pages_dirty(struct page **pages, unsigned long npages); | |
| 1063 | +void put_user_pages_dirty_lock(struct page **pages, unsigned long npages); | |
| 1064 | +void put_user_pages(struct page **pages, unsigned long npages); | |
| 1065 | + | |
| 1010 | 1066 | #if defined(CONFIG_SPARSEMEM) && !defined(CONFIG_SPARSEMEM_VMEMMAP) |
| 1011 | 1067 | #define SECTION_IN_PAGE_FLAGS |
| 1012 | 1068 | #endif |
| @@ -1505,21 +1561,8 @@ long get_user_pages_locked(unsigned long start, unsigned long nr_pages, · 492 unmodified lines | ||
| 1505 | 1561 | long get_user_pages_unlocked(unsigned long start, unsigned long nr_pages, |
| 1506 | 1562 | struct page **pages, unsigned int gup_flags); |
| 1507 | 1563 | |
| 1508 | −#if defined(CONFIG_FS_DAX) || defined(CONFIG_CMA) | |
| 1509 | −long get_user_pages_longterm(unsigned long start, unsigned long nr_pages, | |
| 1510 | − unsigned int gup_flags, struct page **pages, | |
| 1511 | − struct vm_area_struct **vmas); | |
| 1512 | −#else | |
| 1513 | −static inline long get_user_pages_longterm(unsigned long start, | |
| 1514 | − unsigned long nr_pages, unsigned int gup_flags, | |
| 1515 | − struct page **pages, struct vm_area_struct **vmas) | |
| 1516 | −{ | |
| 1517 | − return get_user_pages(start, nr_pages, gup_flags, pages, vmas); | |
| 1518 | −} | |
| 1519 | −#endif /* CONFIG_FS_DAX */ | |
| 1520 | − | |
| 1521 | −int get_user_pages_fast(unsigned long start, int nr_pages, int write, | |
| 1522 | − struct page **pages); | |
| 1564 | +int get_user_pages_fast(unsigned long start, int nr_pages, | |
| 1565 | + unsigned int gup_flags, struct page **pages); | |
| 1523 | 1566 | |
| 1524 | 1567 | /* Container for pinned pfns / pages */ |
| 1525 | 1568 | struct frame_vector { |
| @@ -2533,6 +2576,10 @@ struct vm_area_struct *find_extend_vma(struct mm_struct *, unsigned long addr); · 1007 unmodified lines | ||
| 2533 | 2576 | int remap_pfn_range(struct vm_area_struct *, unsigned long addr, |
| 2534 | 2577 | unsigned long pfn, unsigned long size, pgprot_t); |
| 2535 | 2578 | int vm_insert_page(struct vm_area_struct *, unsigned long addr, struct page *); |
| 2579 | +int vm_map_pages(struct vm_area_struct *vma, struct page **pages, | |
| 2580 | + unsigned long num); | |
| 2581 | +int vm_map_pages_zero(struct vm_area_struct *vma, struct page **pages, | |
| 2582 | + unsigned long num); | |
| 2536 | 2583 | vm_fault_t vmf_insert_pfn(struct vm_area_struct *vma, unsigned long addr, |
| 2537 | 2584 | unsigned long pfn); |
| 2538 | 2585 | vm_fault_t vmf_insert_pfn_prot(struct vm_area_struct *vma, unsigned long addr, |
| @@ -2583,6 +2630,34 @@ struct page *follow_page(struct vm_area_struct *vma, unsigned long address, · 44 unmodified lines | ||
| 2583 | 2630 | #define FOLL_REMOTE 0x2000 /* we are working on non-current tsk/mm */ |
| 2584 | 2631 | #define FOLL_COW 0x4000 /* internal GUP flag */ |
| 2585 | 2632 | #define FOLL_ANON 0x8000 /* don't do file mappings */ |
| 2633 | +#define FOLL_LONGTERM 0x10000 /* mapping lifetime is indefinite: see below */ | |
| 2634 | + | |
| 2635 | +/* | |
| 2636 | + * NOTE on FOLL_LONGTERM: | |
| 2637 | + * | |
| 2638 | + * FOLL_LONGTERM indicates that the page will be held for an indefinite time | |
| 2639 | + * period _often_ under userspace control. This is contrasted with | |
| 2640 | + * iov_iter_get_pages() where usages which are transient. | |
| 2641 | + * | |
| 2642 | + * FIXME: For pages which are part of a filesystem, mappings are subject to the | |
| 2643 | + * lifetime enforced by the filesystem and we need guarantees that longterm | |
| 2644 | + * users like RDMA and V4L2 only establish mappings which coordinate usage with | |
| 2645 | + * the filesystem. Ideas for this coordination include revoking the longterm | |
| 2646 | + * pin, delaying writeback, bounce buffer page writeback, etc. As FS DAX was | |
| 2647 | + * added after the problem with filesystems was found FS DAX VMAs are | |
| 2648 | + * specifically failed. Filesystem pages are still subject to bugs and use of | |
| 2649 | + * FOLL_LONGTERM should be avoided on those pages. | |
| 2650 | + * | |
| 2651 | + * FIXME: Also NOTE that FOLL_LONGTERM is not supported in every GUP call. | |
| 2652 | + * Currently only get_user_pages() and get_user_pages_fast() support this flag | |
| 2653 | + * and calls to get_user_pages_[un]locked are specifically not allowed. This | |
| 2654 | + * is due to an incompatibility with the FS DAX check and | |
| 2655 | + * FAULT_FLAG_ALLOW_RETRY | |
| 2656 | + * | |
| 2657 | + * In the CMA case: longterm pins in a CMA region would unnecessarily fragment | |
| 2658 | + * that region. And so CMA attempts to migrate the page before pinning when | |
| 2659 | + * FOLL_LONGTERM is specified. | |
| 2660 | + */ | |
| 2586 | 2661 | |
| 2587 | 2662 | static inline int vm_fault_to_errno(vm_fault_t vm_fault, int foll_flags) |
| 2588 | 2663 | { |
| @@ -2610,37 +2685,31 @@ static inline void kernel_poison_pages(struct page *page, int numpages, · 21 unmodified lines | ||
| 2610 | 2685 | int enable) { } |
| 2611 | 2686 | #endif |
| 2612 | 2687 | |
| 2613 | −#ifdef CONFIG_DEBUG_PAGEALLOC | |
| 2614 | 2688 | extern bool _debug_pagealloc_enabled; |
| 2615 | −extern void __kernel_map_pages(struct page *page, int numpages, int enable); | |
| 2616 | 2689 | |
| 2617 | 2690 | static inline bool debug_pagealloc_enabled(void) |
| 2618 | 2691 | { |
| 2619 | − return _debug_pagealloc_enabled; | |
| 2692 | + return IS_ENABLED(CONFIG_DEBUG_PAGEALLOC) && _debug_pagealloc_enabled; | |
| 2620 | 2693 | } |
| 2621 | 2694 | |
| 2695 | +#if defined(CONFIG_DEBUG_PAGEALLOC) || defined(CONFIG_ARCH_HAS_SET_DIRECT_MAP) | |
| 2696 | +extern void __kernel_map_pages(struct page *page, int numpages, int enable); | |
| 2697 | + | |
| 2622 | 2698 | static inline void |
| 2623 | 2699 | kernel_map_pages(struct page *page, int numpages, int enable) |
| 2624 | 2700 | { |
| 2625 | − if (!debug_pagealloc_enabled()) | |
| 2626 | − return; | |
| 2627 | − | |
| 2628 | 2701 | __kernel_map_pages(page, numpages, enable); |
| 2629 | 2702 | } |
| 2630 | 2703 | #ifdef CONFIG_HIBERNATION |
| 2631 | 2704 | extern bool kernel_page_present(struct page *page); |
| 2632 | 2705 | #endif /* CONFIG_HIBERNATION */ |
| 2633 | −#else /* CONFIG_DEBUG_PAGEALLOC */ | |
| 2706 | +#else /* CONFIG_DEBUG_PAGEALLOC || CONFIG_ARCH_HAS_SET_DIRECT_MAP */ | |
| 2634 | 2707 | static inline void |
| 2635 | 2708 | kernel_map_pages(struct page *page, int numpages, int enable) {} |
| 2636 | 2709 | #ifdef CONFIG_HIBERNATION |
| 2637 | 2710 | static inline bool kernel_page_present(struct page *page) { return true; } |
| 2638 | 2711 | #endif /* CONFIG_HIBERNATION */ |
| 2639 | −static inline bool debug_pagealloc_enabled(void) | |
| 2640 | −{ | |
| 2641 | − return false; | |
| 2642 | −} | |
| 2643 | −#endif /* CONFIG_DEBUG_PAGEALLOC */ | |
| 2712 | +#endif /* CONFIG_DEBUG_PAGEALLOC || CONFIG_ARCH_HAS_SET_DIRECT_MAP */ | |
| 2644 | 2713 | |
| 2645 | 2714 | #ifdef __HAVE_ARCH_GATE_AREA |
| 2646 | 2715 | extern struct vm_area_struct *get_gate_vma(struct mm_struct *mm); |
| @@ -29,7 +29,7 @@ static __always_inline void __update_lru_size(struct lruvec *lruvec, · 28 unmodified lines | ||
| 29 | 29 | { |
| 30 | 30 | struct pglist_data *pgdat = lruvec_pgdat(lruvec); |
| 31 | 31 | |
| 32 | − __mod_node_page_state(pgdat, NR_LRU_BASE + lru, nr_pages); | |
| 32 | + __mod_lruvec_state(lruvec, NR_LRU_BASE + lru, nr_pages); | |
| 33 | 33 | __mod_zone_page_state(&pgdat->node_zones[zid], |
| 34 | 34 | NR_ZONE_LRU_BASE + lru, nr_pages); |
| 35 | 35 | } |
| @@ -103,7 +103,7 @@ struct page { · 102 unmodified lines | ||
| 103 | 103 | }; |
| 104 | 104 | struct { /* slab, slob and slub */ |
| 105 | 105 | union { |
| 106 | − struct list_head slab_list; /* uses lru */ | |
| 106 | + struct list_head slab_list; | |
| 107 | 107 | struct { /* Partial pages */ |
| 108 | 108 | struct page *next; |
| 109 | 109 | #ifdef CONFIG_64BIT |
| @@ -220,6 +220,9 @@ struct page { · 110 unmodified lines | ||
| 220 | 220 | #define PAGE_FRAG_CACHE_MAX_SIZE __ALIGN_MASK(32768, ~PAGE_MASK) |
| 221 | 221 | #define PAGE_FRAG_CACHE_MAX_ORDER get_order(PAGE_FRAG_CACHE_MAX_SIZE) |
| 222 | 222 | |
| 223 | +#define page_private(page) ((page)->private) | |
| 224 | +#define set_page_private(page, v) ((page)->private = (v)) | |
| 225 | + | |
| 223 | 226 | struct page_frag_cache { |
| 224 | 227 | void * va; |
| 225 | 228 | #if (PAGE_SIZE < PAGE_FRAG_CACHE_MAX_SIZE) |
| @@ -111,6 +111,18 @@ struct sdio_driver { · 110 unmodified lines | ||
| 111 | 111 | extern int sdio_register_driver(struct sdio_driver *); |
| 112 | 112 | extern void sdio_unregister_driver(struct sdio_driver *); |
| 113 | 113 | |
| 114 | +/** | |
| 115 | + * module_sdio_driver() - Helper macro for registering a SDIO driver | |
| 116 | + * @__sdio_driver: sdio_driver struct | |
| 117 | + * | |
| 118 | + * Helper macro for SDIO drivers which do not do anything special in module | |
| 119 | + * init/exit. This eliminates a lot of boilerplate. Each module may only | |
| 120 | + * use this macro once, and calling it replaces module_init() and module_exit() | |
| 121 | + */ | |
| 122 | +#define module_sdio_driver(__sdio_driver) \ | |
| 123 | + module_driver(__sdio_driver, sdio_register_driver, \ | |
| 124 | + sdio_unregister_driver) | |
| 125 | + | |
| 114 | 126 | /* |
| 115 | 127 | * SDIO I/O operations |
| 116 | 128 | */ |
| @@ -59,6 +59,8 @@ · 58 unmodified lines | ||
| 59 | 59 | #define SDIO_DEVICE_ID_MARVELL_8797_F0 0x9128 |
| 60 | 60 | #define SDIO_DEVICE_ID_MARVELL_8887WLAN 0x9134 |
| 61 | 61 | |
| 62 | +#define SDIO_VENDOR_ID_MEDIATEK 0x037a | |
| 63 | + | |
| 62 | 64 | #define SDIO_VENDOR_ID_SIANO 0x039a |
| 63 | 65 | #define SDIO_DEVICE_ID_SIANO_NOVA_B0 0x0201 |
| 64 | 66 | #define SDIO_DEVICE_ID_SIANO_NICE 0x0202 |
| @@ -10,6 +10,36 @@ · 9 unmodified lines | ||
| 10 | 10 | struct mmu_notifier; |
| 11 | 11 | struct mmu_notifier_ops; |
| 12 | 12 | |
| 13 | +/** | |
| 14 | + * enum mmu_notifier_event - reason for the mmu notifier callback | |
| 15 | + * @MMU_NOTIFY_UNMAP: either munmap() that unmap the range or a mremap() that | |
| 16 | + * move the range | |
| 17 | + * | |
| 18 | + * @MMU_NOTIFY_CLEAR: clear page table entry (many reasons for this like | |
| 19 | + * madvise() or replacing a page by another one, ...). | |
| 20 | + * | |
| 21 | + * @MMU_NOTIFY_PROTECTION_VMA: update is due to protection change for the range | |
| 22 | + * ie using the vma access permission (vm_page_prot) to update the whole range | |
| 23 | + * is enough no need to inspect changes to the CPU page table (mprotect() | |
| 24 | + * syscall) | |
| 25 | + * | |
| 26 | + * @MMU_NOTIFY_PROTECTION_PAGE: update is due to change in read/write flag for | |
| 27 | + * pages in the range so to mirror those changes the user must inspect the CPU | |
| 28 | + * page table (from the end callback). | |
| 29 | + * | |
| 30 | + * @MMU_NOTIFY_SOFT_DIRTY: soft dirty accounting (still same page and same | |
| 31 | + * access flags). User should soft dirty the page in the end callback to make | |
| 32 | + * sure that anyone relying on soft dirtyness catch pages that might be written | |
| 33 | + * through non CPU mappings. | |
| 34 | + */ | |
| 35 | +enum mmu_notifier_event { | |
| 36 | + MMU_NOTIFY_UNMAP = 0, | |
| 37 | + MMU_NOTIFY_CLEAR, | |
| 38 | + MMU_NOTIFY_PROTECTION_VMA, | |
| 39 | + MMU_NOTIFY_PROTECTION_PAGE, | |
| 40 | + MMU_NOTIFY_SOFT_DIRTY, | |
| 41 | +}; | |
| 42 | + | |
| 13 | 43 | #ifdef CONFIG_MMU_NOTIFIER |
| 14 | 44 | |
| 15 | 45 | /* |
| @@ -25,11 +55,15 @@ struct mmu_notifier_mm { · 9 unmodified lines | ||
| 25 | 55 | spinlock_t lock; |
| 26 | 56 | }; |
| 27 | 57 | |
| 58 | +#define MMU_NOTIFIER_RANGE_BLOCKABLE (1 << 0) | |
| 59 | + | |
| 28 | 60 | struct mmu_notifier_range { |
| 61 | + struct vm_area_struct *vma; | |
| 29 | 62 | struct mm_struct *mm; |
| 30 | 63 | unsigned long start; |
| 31 | 64 | unsigned long end; |
| 32 | − bool blockable; | |
| 65 | + unsigned flags; | |
| 66 | + enum mmu_notifier_event event; | |
| 33 | 67 | }; |
| 34 | 68 | |
| 35 | 69 | struct mmu_notifier_ops { |
| @@ -225,6 +259,14 @@ extern void __mmu_notifier_invalidate_range_end(struct mmu_notifier_range *r, · 189 unmodified lines | ||
| 225 | 259 | bool only_end); |
| 226 | 260 | extern void __mmu_notifier_invalidate_range(struct mm_struct *mm, |
| 227 | 261 | unsigned long start, unsigned long end); |
| 262 | +extern bool | |
| 263 | +mmu_notifier_range_update_to_read_only(const struct mmu_notifier_range *range); | |
| 264 | + | |
| 265 | +static inline bool | |
| 266 | +mmu_notifier_range_blockable(const struct mmu_notifier_range *range) | |
| 267 | +{ | |
| 268 | + return (range->flags & MMU_NOTIFIER_RANGE_BLOCKABLE); | |
| 269 | +} | |
| 228 | 270 | |
| 229 | 271 | static inline void mmu_notifier_release(struct mm_struct *mm) |
| 230 | 272 | { |
| @@ -269,7 +311,7 @@ static inline void · 38 unmodified lines | ||
| 269 | 311 | mmu_notifier_invalidate_range_start(struct mmu_notifier_range *range) |
| 270 | 312 | { |
| 271 | 313 | if (mm_has_notifiers(range->mm)) { |
| 272 | − range->blockable = true; | |
| 314 | + range->flags |= MMU_NOTIFIER_RANGE_BLOCKABLE; | |
| 273 | 315 | __mmu_notifier_invalidate_range_start(range); |
| 274 | 316 | } |
| 275 | 317 | } |
| @@ -278,7 +320,7 @@ static inline int · 2 unmodified lines | ||
| 278 | 320 | mmu_notifier_invalidate_range_start_nonblock(struct mmu_notifier_range *range) |
| 279 | 321 | { |
| 280 | 322 | if (mm_has_notifiers(range->mm)) { |
| 281 | − range->blockable = false; | |
| 323 | + range->flags &= ~MMU_NOTIFIER_RANGE_BLOCKABLE; | |
| 282 | 324 | return __mmu_notifier_invalidate_range_start(range); |
| 283 | 325 | } |
| 284 | 326 | return 0; |
| @@ -318,13 +360,19 @@ static inline void mmu_notifier_mm_destroy(struct mm_struct *mm) · 33 unmodified lines | ||
| 318 | 360 | |
| 319 | 361 | |
| 320 | 362 | static inline void mmu_notifier_range_init(struct mmu_notifier_range *range, |
| 363 | + enum mmu_notifier_event event, | |
| 364 | + unsigned flags, | |
| 365 | + struct vm_area_struct *vma, | |
| 321 | 366 | struct mm_struct *mm, |
| 322 | 367 | unsigned long start, |
| 323 | 368 | unsigned long end) |
| 324 | 369 | { |
| 370 | + range->vma = vma; | |
| 371 | + range->event = event; | |
| 325 | 372 | range->mm = mm; |
| 326 | 373 | range->start = start; |
| 327 | 374 | range->end = end; |
| 375 | + range->flags = flags; | |
| 328 | 376 | } |
| 329 | 377 | |
| 330 | 378 | #define ptep_clear_flush_young_notify(__vma, __address, __ptep) \ |
| @@ -452,9 +500,14 @@ static inline void _mmu_notifier_range_init(struct mmu_notifier_range *range, · 121 unmodified lines | ||
| 452 | 500 | range->end = end; |
| 453 | 501 | } |
| 454 | 502 | |
| 455 | −#define mmu_notifier_range_init(range, mm, start, end) \ | |
| 503 | +#define mmu_notifier_range_init(range,event,flags,vma,mm,start,end) \ | |
| 456 | 504 | _mmu_notifier_range_init(range, start, end) |
| 457 | 505 | |
| 506 | +static inline bool | |
| 507 | +mmu_notifier_range_blockable(const struct mmu_notifier_range *range) | |
| 508 | +{ | |
| 509 | + return true; | |
| 510 | +} | |
| 458 | 511 | |
| 459 | 512 | static inline int mm_has_notifiers(struct mm_struct *mm) |
| 460 | 513 | { |
| @@ -517,6 +570,8 @@ static inline void mmu_notifier_mm_destroy(struct mm_struct *mm) · 56 unmodified lines | ||
| 517 | 570 | { |
| 518 | 571 | } |
| 519 | 572 | |
| 573 | +#define mmu_notifier_range_update_to_read_only(r) false | |
| 574 | + | |
| 520 | 575 | #define ptep_clear_flush_young_notify ptep_clear_flush_young |
| 521 | 576 | #define pmdp_clear_flush_young_notify pmdp_clear_flush_young |
| 522 | 577 | #define ptep_clear_young_notify ptep_test_and_clear_young |
| @@ -18,6 +18,8 @@ · 17 unmodified lines | ||
| 18 | 18 | #include <linux/pageblock-flags.h> |
| 19 | 19 | #include <linux/page-flags-layout.h> |
| 20 | 20 | #include <linux/atomic.h> |
| 21 | +#include <linux/mm_types.h> | |
| 22 | +#include <linux/page-flags.h> | |
| 21 | 23 | #include <asm/page.h> |
| 22 | 24 | |
| 23 | 25 | /* Free memory management - zoned buddy allocator. */ |
| @@ -98,6 +100,62 @@ struct free_area { · 74 unmodified lines | ||
| 98 | 100 | unsigned long nr_free; |
| 99 | 101 | }; |
| 100 | 102 | |
| 103 | +/* Used for pages not on another list */ | |
| 104 | +static inline void add_to_free_area(struct page *page, struct free_area *area, | |
| 105 | + int migratetype) | |
| 106 | +{ | |
| 107 | + list_add(&page->lru, &area->free_list[migratetype]); | |
| 108 | + area->nr_free++; | |
| 109 | +} | |
| 110 | + | |
| 111 | +/* Used for pages not on another list */ | |
| 112 | +static inline void add_to_free_area_tail(struct page *page, struct free_area *area, | |
| 113 | + int migratetype) | |
| 114 | +{ | |
| 115 | + list_add_tail(&page->lru, &area->free_list[migratetype]); | |
| 116 | + area->nr_free++; | |
| 117 | +} | |
| 118 | + | |
| 119 | +#ifdef CONFIG_SHUFFLE_PAGE_ALLOCATOR | |
| 120 | +/* Used to preserve page allocation order entropy */ | |
| 121 | +void add_to_free_area_random(struct page *page, struct free_area *area, | |
| 122 | + int migratetype); | |
| 123 | +#else | |
| 124 | +static inline void add_to_free_area_random(struct page *page, | |
| 125 | + struct free_area *area, int migratetype) | |
| 126 | +{ | |
| 127 | + add_to_free_area(page, area, migratetype); | |
| 128 | +} | |
| 129 | +#endif | |
| 130 | + | |
| 131 | +/* Used for pages which are on another list */ | |
| 132 | +static inline void move_to_free_area(struct page *page, struct free_area *area, | |
| 133 | + int migratetype) | |
| 134 | +{ | |
| 135 | + list_move(&page->lru, &area->free_list[migratetype]); | |
| 136 | +} | |
| 137 | + | |
| 138 | +static inline struct page *get_page_from_free_area(struct free_area *area, | |
| 139 | + int migratetype) | |
| 140 | +{ | |
| 141 | + return list_first_entry_or_null(&area->free_list[migratetype], | |
| 142 | + struct page, lru); | |
| 143 | +} | |
| 144 | + | |
| 145 | +static inline void del_page_from_free_area(struct page *page, | |
| 146 | + struct free_area *area) | |
| 147 | +{ | |
| 148 | + list_del(&page->lru); | |
| 149 | + __ClearPageBuddy(page); | |
| 150 | + set_page_private(page, 0); | |
| 151 | + area->nr_free--; | |
| 152 | +} | |
| 153 | + | |
| 154 | +static inline bool free_area_empty(struct free_area *area, int migratetype) | |
| 155 | +{ | |
| 156 | + return list_empty(&area->free_list[migratetype]); | |
| 157 | +} | |
| 158 | + | |
| 101 | 159 | struct pglist_data; |
| 102 | 160 | |
| 103 | 161 | /* |
| @@ -247,11 +305,6 @@ struct lruvec { · 143 unmodified lines | ||
| 247 | 305 | #endif |
| 248 | 306 | }; |
| 249 | 307 | |
| 250 | −/* Mask used at gathering information at once (see memcontrol.c) */ | |
| 251 | −#define LRU_ALL_FILE (BIT(LRU_INACTIVE_FILE) | BIT(LRU_ACTIVE_FILE)) | |
| 252 | −#define LRU_ALL_ANON (BIT(LRU_INACTIVE_ANON) | BIT(LRU_ACTIVE_ANON)) | |
| 253 | −#define LRU_ALL ((1 << NR_LRU_LISTS) - 1) | |
| 254 | − | |
| 255 | 308 | /* Isolate unmapped file */ |
| 256 | 309 | #define ISOLATE_UNMAPPED ((__force isolate_mode_t)0x2) |
| 257 | 310 | /* Isolate for asynchronous migration */ |
| @@ -1276,6 +1329,7 @@ void sparse_init(void); · 1018 unmodified lines | ||
| 1276 | 1329 | #else |
| 1277 | 1330 | #define sparse_init() do {} while (0) |
| 1278 | 1331 | #define sparse_index_init(_sec, _nid) do {} while (0) |
| 1332 | +#define pfn_present pfn_valid | |
| 1279 | 1333 | #endif /* CONFIG_SPARSEMEM */ |
| 1280 | 1334 | |
| 1281 | 1335 | /* |
| @@ -253,6 +253,7 @@ extern typeof(name) __mod_##type##__##name##_device_table \ · 252 unmodified lines | ||
| 253 | 253 | #define MODULE_VERSION(_version) MODULE_INFO(version, _version) |
| 254 | 254 | #else |
| 255 | 255 | #define MODULE_VERSION(_version) \ |
| 256 | + MODULE_INFO(version, _version); \ | |
| 256 | 257 | static struct module_version_attribute ___modver_attr = { \ |
| 257 | 258 | .mattr = { \ |
| 258 | 259 | .attr = { \ |
| @@ -331,6 +332,7 @@ struct mod_kallsyms { · 72 unmodified lines | ||
| 331 | 332 | Elf_Sym *symtab; |
| 332 | 333 | unsigned int num_symtab; |
| 333 | 334 | char *strtab; |
| 335 | + char *typetab; | |
| 334 | 336 | }; |
| 335 | 337 | |
| 336 | 338 | #ifdef CONFIG_LIVEPATCH |
| @@ -676,6 +678,7 @@ static inline bool is_livepatch_module(struct module *mod) · 339 unmodified lines | ||
| 676 | 678 | #endif /* CONFIG_LIVEPATCH */ |
| 677 | 679 | |
| 678 | 680 | bool is_module_sig_enforced(void); |
| 681 | +void set_module_sig_enforced(void); | |
| 679 | 682 | |
| 680 | 683 | #else /* !CONFIG_MODULES... */ |
| 681 | 684 | |
| @@ -709,6 +712,23 @@ static inline bool is_module_text_address(unsigned long addr) · 27 unmodified lines | ||
| 709 | 712 | return false; |
| 710 | 713 | } |
| 711 | 714 | |
| 715 | +static inline bool within_module_core(unsigned long addr, | |
| 716 | + const struct module *mod) | |
| 717 | +{ | |
| 718 | + return false; | |
| 719 | +} | |
| 720 | + | |
| 721 | +static inline bool within_module_init(unsigned long addr, | |
| 722 | + const struct module *mod) | |
| 723 | +{ | |
| 724 | + return false; | |
| 725 | +} | |
| 726 | + | |
| 727 | +static inline bool within_module(unsigned long addr, const struct module *mod) | |
| 728 | +{ | |
| 729 | + return false; | |
| 730 | +} | |
| 731 | + | |
| 712 | 732 | /* Get/put a kernel symbol (calls should be symmetric) */ |
| 713 | 733 | #define symbol_get(x) ({ extern typeof(x) x __attribute__((weak)); &(x); }) |
| 714 | 734 | #define symbol_put(x) do { } while (0) |
| @@ -796,6 +816,10 @@ static inline bool is_module_sig_enforced(void) · 81 unmodified lines | ||
| 796 | 816 | return false; |
| 797 | 817 | } |
| 798 | 818 | |
| 819 | +static inline void set_module_sig_enforced(void) | |
| 820 | +{ | |
| 821 | +} | |
| 822 | + | |
| 799 | 823 | /* Dereference module function descriptor */ |
| 800 | 824 | static inline |
| 801 | 825 | void *dereference_module_function_descriptor(struct module *mod, void *ptr) |
| @@ -10,23 +10,21 @@ · 9 unmodified lines | ||
| 10 | 10 | module name. */ |
| 11 | 11 | #ifdef MODULE |
| 12 | 12 | #define MODULE_PARAM_PREFIX /* empty */ |
| 13 | +#define __MODULE_INFO_PREFIX /* empty */ | |
| 13 | 14 | #else |
| 14 | 15 | #define MODULE_PARAM_PREFIX KBUILD_MODNAME "." |
| 16 | +/* We cannot use MODULE_PARAM_PREFIX because some modules override it. */ | |
| 17 | +#define __MODULE_INFO_PREFIX KBUILD_MODNAME "." | |
| 15 | 18 | #endif |
| 16 | 19 | |
| 17 | 20 | /* Chosen so that structs with an unsigned long line up. */ |
| 18 | 21 | #define MAX_PARAM_PREFIX_LEN (64 - sizeof(unsigned long)) |
| 19 | 22 | |
| 20 | −#ifdef MODULE | |
| 21 | 23 | #define __MODULE_INFO(tag, name, info) \ |
| 22 | 24 | static const char __UNIQUE_ID(name)[] \ |
| 23 | 25 | __used __attribute__((section(".modinfo"), unused, aligned(1))) \ |
| 24 | − = __stringify(tag) "=" info | |
| 25 | −#else /* !MODULE */ | |
| 26 | −/* This struct is here for syntactic coherency, it is not used */ | |
| 27 | −#define __MODULE_INFO(tag, name, info) \ | |
| 28 | − struct __UNIQUE_ID(name) {} | |
| 29 | −#endif | |
| 26 | + = __MODULE_INFO_PREFIX __stringify(tag) "=" info | |
| 27 | + | |
| 30 | 28 | #define __MODULE_PARM_TYPE(name, _type) \ |
| 31 | 29 | __MODULE_INFO(parmtype, name##type, #name ":" _type) |
| 32 | 30 | |
| @@ -87,6 +87,8 @@ extern bool mnt_may_suid(struct vfsmount *mnt); · 86 unmodified lines | ||
| 87 | 87 | |
| 88 | 88 | struct path; |
| 89 | 89 | extern struct vfsmount *clone_private_mount(const struct path *path); |
| 90 | +extern int __mnt_want_write(struct vfsmount *); | |
| 91 | +extern void __mnt_drop_write(struct vfsmount *); | |
| 90 | 92 | |
| 91 | 93 | struct file_system_type; |
| 92 | 94 | extern struct vfsmount *fc_mount(struct fs_context *fc); |
| @@ -47,6 +47,14 @@ struct fsl_mc_msi_desc { · 46 unmodified lines | ||
| 47 | 47 | u16 msi_index; |
| 48 | 48 | }; |
| 49 | 49 | |
| 50 | +/** | |
| 51 | + * ti_sci_inta_msi_desc - TISCI based INTA specific msi descriptor data | |
| 52 | + * @dev_index: TISCI device index | |
| 53 | + */ | |
| 54 | +struct ti_sci_inta_msi_desc { | |
| 55 | + u16 dev_index; | |
| 56 | +}; | |
| 57 | + | |
| 50 | 58 | /** |
| 51 | 59 | * struct msi_desc - Descriptor structure for MSI based interrupts |
| 52 | 60 | * @list: List head for management |
| @@ -68,6 +76,7 @@ struct fsl_mc_msi_desc { · 15 unmodified lines | ||
| 68 | 76 | * @mask_base: [PCI MSI-X] Mask register base address |
| 69 | 77 | * @platform: [platform] Platform device specific msi descriptor data |
| 70 | 78 | * @fsl_mc: [fsl-mc] FSL MC device specific msi descriptor data |
| 79 | + * @inta: [INTA] TISCI based INTA specific msi descriptor data | |
| 71 | 80 | */ |
| 72 | 81 | struct msi_desc { |
| 73 | 82 | /* Shared device/bus type independent data */ |
| @@ -77,6 +86,9 @@ struct msi_desc { · 3 unmodified lines | ||
| 77 | 86 | struct device *dev; |
| 78 | 87 | struct msi_msg msg; |
| 79 | 88 | struct irq_affinity_desc *affinity; |
| 89 | +#ifdef CONFIG_IRQ_MSI_IOMMU | |
| 90 | + const void *iommu_cookie; | |
| 91 | +#endif | |
| 80 | 92 | |
| 81 | 93 | union { |
| 82 | 94 | /* PCI MSI/X specific data */ |
| @@ -106,6 +118,7 @@ struct msi_desc { · 23 unmodified lines | ||
| 106 | 118 | */ |
| 107 | 119 | struct platform_msi_desc platform; |
| 108 | 120 | struct fsl_mc_msi_desc fsl_mc; |
| 121 | + struct ti_sci_inta_msi_desc inta; | |
| 109 | 122 | }; |
| 110 | 123 | }; |
| 111 | 124 | |
| @@ -119,6 +132,29 @@ struct msi_desc { · 7 unmodified lines | ||
| 119 | 132 | #define for_each_msi_entry_safe(desc, tmp, dev) \ |
| 120 | 133 | list_for_each_entry_safe((desc), (tmp), dev_to_msi_list((dev)), list) |
| 121 | 134 | |
| 135 | +#ifdef CONFIG_IRQ_MSI_IOMMU | |
| 136 | +static inline const void *msi_desc_get_iommu_cookie(struct msi_desc *desc) | |
| 137 | +{ | |
| 138 | + return desc->iommu_cookie; | |
| 139 | +} | |
| 140 | + | |
| 141 | +static inline void msi_desc_set_iommu_cookie(struct msi_desc *desc, | |
| 142 | + const void *iommu_cookie) | |
| 143 | +{ | |
| 144 | + desc->iommu_cookie = iommu_cookie; | |
| 145 | +} | |
| 146 | +#else | |
| 147 | +static inline const void *msi_desc_get_iommu_cookie(struct msi_desc *desc) | |
| 148 | +{ | |
| 149 | + return NULL; | |
| 150 | +} | |
| 151 | + | |
| 152 | +static inline void msi_desc_set_iommu_cookie(struct msi_desc *desc, | |
| 153 | + const void *iommu_cookie) | |
| 154 | +{ | |
| 155 | +} | |
| 156 | +#endif | |
| 157 | + | |
| 122 | 158 | #ifdef CONFIG_PCI_MSI |
| 123 | 159 | #define first_pci_msi_entry(pdev) first_msi_entry(&(pdev)->dev) |
| 124 | 160 | #define for_each_pci_msi_entry(desc, pdev) \ |
| @@ -148,24 +184,6 @@ u32 __pci_msi_desc_mask_irq(struct msi_desc *desc, u32 mask, u32 flag); · 23 unmodified lines | ||
| 148 | 184 | void pci_msi_mask_irq(struct irq_data *data); |
| 149 | 185 | void pci_msi_unmask_irq(struct irq_data *data); |
| 150 | 186 | |
| 151 | −/* Conversion helpers. Should be removed after merging */ | |
| 152 | −static inline void __write_msi_msg(struct msi_desc *entry, struct msi_msg *msg) | |
| 153 | −{ | |
| 154 | − __pci_write_msi_msg(entry, msg); | |
| 155 | −} | |
| 156 | −static inline void write_msi_msg(int irq, struct msi_msg *msg) | |
| 157 | −{ | |
| 158 | − pci_write_msi_msg(irq, msg); | |
| 159 | −} | |
| 160 | −static inline void mask_msi_irq(struct irq_data *data) | |
| 161 | −{ | |
| 162 | − pci_msi_mask_irq(data); | |
| 163 | −} | |
| 164 | −static inline void unmask_msi_irq(struct irq_data *data) | |
| 165 | −{ | |
| 166 | − pci_msi_unmask_irq(data); | |
| 167 | −} | |
| 168 | − | |
| 169 | 187 | /* |
| 170 | 188 | * The arch hooks to setup up msi irqs. Those functions are |
| 171 | 189 | * implemented as weak symbols so that they /can/ be overriden by |
| @@ -93,10 +93,7 @@ struct nand_bbt_descr { · 92 unmodified lines | ||
| 93 | 93 | #define NAND_BBT_WRITE 0x00002000 |
| 94 | 94 | /* Read and write back block contents when writing bbt */ |
| 95 | 95 | #define NAND_BBT_SAVECONTENT 0x00004000 |
| 96 | −/* Search good / bad pattern on the first and the second page */ | |
| 97 | −#define NAND_BBT_SCAN2NDPAGE 0x00008000 | |
| 98 | −/* Search good / bad pattern on the last page of the eraseblock */ | |
| 99 | −#define NAND_BBT_SCANLASTPAGE 0x00010000 | |
| 96 | + | |
| 100 | 97 | /* |
| 101 | 98 | * Use a flash based bad block table. By default, OOB identifier is saved in |
| 102 | 99 | * OOB area. This option is passed to the default bad block table function. |
| @@ -123,13 +120,6 @@ struct nand_bbt_descr { · 20 unmodified lines | ||
| 123 | 120 | /* The maximum number of blocks to scan for a bbt */ |
| 124 | 121 | #define NAND_BBT_SCAN_MAXBLOCKS 4 |
| 125 | 122 | |
| 126 | −/* | |
| 127 | − * Constants for oob configuration | |
| 128 | − */ | |
| 129 | −#define NAND_SMALL_BADBLOCK_POS 5 | |
| 130 | −#define NAND_LARGE_BADBLOCK_POS 0 | |
| 131 | −#define ONENAND_BADBLOCK_POS 0 | |
| 132 | − | |
| 133 | 123 | /* |
| 134 | 124 | * Bad block scanning errors |
| 135 | 125 | */ |
| @@ -140,7 +130,6 @@ struct nand_bbt_descr { · 4 unmodified lines | ||
| 140 | 130 | /** |
| 141 | 131 | * struct bbm_info - [GENERIC] Bad Block Table data structure |
| 142 | 132 | * @bbt_erase_shift: [INTERN] number of address bits in a bbt entry |
| 143 | − * @badblockpos: [INTERN] position of the bad block marker in the oob area | |
| 144 | 133 | * @options: options for this descriptor |
| 145 | 134 | * @bbt: [INTERN] bad block table pointer |
| 146 | 135 | * @isbad_bbt: function to determine if a block is bad |
| @@ -150,7 +139,6 @@ struct nand_bbt_descr { · 3 unmodified lines | ||
| 150 | 139 | */ |
| 151 | 140 | struct bbm_info { |
| 152 | 141 | int bbt_erase_shift; |
| 153 | − int badblockpos; | |
| 154 | 142 | int options; |
| 155 | 143 | |
| 156 | 144 | uint8_t *bbt; |
| @@ -19,6 +19,7 @@ · 18 unmodified lines | ||
| 19 | 19 | * @oobsize: OOB area size |
| 20 | 20 | * @pages_per_eraseblock: number of pages per eraseblock |
| 21 | 21 | * @eraseblocks_per_lun: number of eraseblocks per LUN (Logical Unit Number) |
| 22 | + * @max_bad_eraseblocks_per_lun: maximum number of eraseblocks per LUN | |
| 22 | 23 | * @planes_per_lun: number of planes per LUN |
| 23 | 24 | * @luns_per_target: number of LUN per target (target is a synonym for die) |
| 24 | 25 | * @ntargets: total number of targets exposed by the NAND device |
| @@ -29,18 +30,20 @@ struct nand_memory_organization { · 4 unmodified lines | ||
| 29 | 30 | unsigned int oobsize; |
| 30 | 31 | unsigned int pages_per_eraseblock; |
| 31 | 32 | unsigned int eraseblocks_per_lun; |
| 33 | + unsigned int max_bad_eraseblocks_per_lun; | |
| 32 | 34 | unsigned int planes_per_lun; |
| 33 | 35 | unsigned int luns_per_target; |
| 34 | 36 | unsigned int ntargets; |
| 35 | 37 | }; |
| 36 | 38 | |
| 37 | −#define NAND_MEMORG(bpc, ps, os, ppe, epl, ppl, lpt, nt) \ | |
| 39 | +#define NAND_MEMORG(bpc, ps, os, ppe, epl, mbb, ppl, lpt, nt) \ | |
| 38 | 40 | { \ |
| 39 | 41 | .bits_per_cell = (bpc), \ |
| 40 | 42 | .pagesize = (ps), \ |
| 41 | 43 | .oobsize = (os), \ |
| 42 | 44 | .pages_per_eraseblock = (ppe), \ |
| 43 | 45 | .eraseblocks_per_lun = (epl), \ |
| 46 | + .max_bad_eraseblocks_per_lun = (mbb), \ | |
| 44 | 47 | .planes_per_lun = (ppl), \ |
| 45 | 48 | .luns_per_target = (lpt), \ |
| 46 | 49 | .ntargets = (nt), \ |
| @@ -268,6 +271,20 @@ nanddev_pages_per_eraseblock(const struct nand_device *nand) · 221 unmodified lines | ||
| 268 | 271 | return nand->memorg.pages_per_eraseblock; |
| 269 | 272 | } |
| 270 | 273 | |
| 274 | +/** | |
| 275 | + * nanddev_pages_per_target() - Get the number of pages per target | |
| 276 | + * @nand: NAND device | |
| 277 | + * | |
| 278 | + * Return: the number of pages per target. | |
| 279 | + */ | |
| 280 | +static inline unsigned int | |
| 281 | +nanddev_pages_per_target(const struct nand_device *nand) | |
| 282 | +{ | |
| 283 | + return nand->memorg.pages_per_eraseblock * | |
| 284 | + nand->memorg.eraseblocks_per_lun * | |
| 285 | + nand->memorg.luns_per_target; | |
| 286 | +} | |
| 287 | + | |
| 271 | 288 | /** |
| 272 | 289 | * nanddev_per_page_oobsize() - Get NAND erase block size |
| 273 | 290 | * @nand: NAND device |
| @@ -291,6 +308,18 @@ nanddev_eraseblocks_per_lun(const struct nand_device *nand) · 17 unmodified lines | ||
| 291 | 308 | return nand->memorg.eraseblocks_per_lun; |
| 292 | 309 | } |
| 293 | 310 | |
| 311 | +/** | |
| 312 | + * nanddev_eraseblocks_per_target() - Get the number of eraseblocks per target | |
| 313 | + * @nand: NAND device | |
| 314 | + * | |
| 315 | + * Return: the number of eraseblocks per target. | |
| 316 | + */ | |
| 317 | +static inline unsigned int | |
| 318 | +nanddev_eraseblocks_per_target(const struct nand_device *nand) | |
| 319 | +{ | |
| 320 | + return nand->memorg.eraseblocks_per_lun * nand->memorg.luns_per_target; | |
| 321 | +} | |
| 322 | + | |
| 294 | 323 | /** |
| 295 | 324 | * nanddev_target_size() - Get the total size provided by a single target/die |
| 296 | 325 | * @nand: NAND device |
| @@ -729,5 +758,6 @@ static inline bool nanddev_bbt_is_initialized(struct nand_device *nand) · 432 unmodified lines | ||
| 729 | 758 | |
| 730 | 759 | /* MTD -> NAND helper functions. */ |
| 731 | 760 | int nanddev_mtd_erase(struct mtd_info *mtd, struct erase_info *einfo); |
| 761 | +int nanddev_mtd_max_bad_blocks(struct mtd_info *mtd, loff_t offs, size_t len); | |
| 732 | 762 | |
| 733 | 763 | #endif /* __LINUX_MTD_NAND_H */ |
| @@ -15,7 +15,7 @@ struct mtd_info; · 14 unmodified lines | ||
| 15 | 15 | struct nand_chip; |
| 16 | 16 | struct nand_bch_control; |
| 17 | 17 | |
| 18 | −#if defined(CONFIG_MTD_NAND_ECC_BCH) | |
| 18 | +#if IS_ENABLED(CONFIG_MTD_NAND_ECC_SW_BCH) | |
| 19 | 19 | |
| 20 | 20 | static inline int mtd_nand_has_bch(void) { return 1; } |
| 21 | 21 | |
| @@ -39,7 +39,7 @@ struct nand_bch_control *nand_bch_init(struct mtd_info *mtd); · 17 unmodified lines | ||
| 39 | 39 | */ |
| 40 | 40 | void nand_bch_free(struct nand_bch_control *nbc); |
| 41 | 41 | |
| 42 | −#else /* !CONFIG_MTD_NAND_ECC_BCH */ | |
| 42 | +#else /* !CONFIG_MTD_NAND_ECC_SW_BCH */ | |
| 43 | 43 | |
| 44 | 44 | static inline int mtd_nand_has_bch(void) { return 0; } |
| 45 | 45 | |
| @@ -64,6 +64,6 @@ static inline struct nand_bch_control *nand_bch_init(struct mtd_info *mtd) · 18 unmodified lines | ||
| 64 | 64 | |
| 65 | 65 | static inline void nand_bch_free(struct nand_bch_control *nbc) {} |
| 66 | 66 | |
| 67 | −#endif /* CONFIG_MTD_NAND_ECC_BCH */ | |
| 67 | +#endif /* CONFIG_MTD_NAND_ECC_SW_BCH */ | |
| 68 | 68 | |
| 69 | 69 | #endif /* __MTD_NAND_BCH_H__ */ |
| @@ -94,6 +94,7 @@ struct onenand_chip { · 93 unmodified lines | ||
| 94 | 94 | unsigned int technology; |
| 95 | 95 | unsigned int density_mask; |
| 96 | 96 | unsigned int options; |
| 97 | + unsigned int badblockpos; | |
| 97 | 98 | |
| 98 | 99 | unsigned int erase_shift; |
| 99 | 100 | unsigned int page_shift; |
| @@ -188,6 +189,8 @@ struct onenand_chip { · 88 unmodified lines | ||
| 188 | 189 | /* Check byte access in OneNAND */ |
| 189 | 190 | #define ONENAND_CHECK_BYTE_ACCESS(addr) (addr & 0x1) |
| 190 | 191 | |
| 192 | +#define ONENAND_BADBLOCK_POS 0 | |
| 193 | + | |
| 191 | 194 | /* |
| 192 | 195 | * Options bits |
| 193 | 196 | */ |
| @@ -20,6 +20,7 @@ · 19 unmodified lines | ||
| 20 | 20 | #include <linux/mtd/flashchip.h> |
| 21 | 21 | #include <linux/mtd/bbm.h> |
| 22 | 22 | #include <linux/mtd/jedec.h> |
| 23 | +#include <linux/mtd/nand.h> | |
| 23 | 24 | #include <linux/mtd/onfi.h> |
| 24 | 25 | #include <linux/mutex.h> |
| 25 | 26 | #include <linux/of.h> |
| @@ -168,6 +169,21 @@ enum nand_ecc_algo { · 142 unmodified lines | ||
| 168 | 169 | /* Macros to identify the above */ |
| 169 | 170 | #define NAND_HAS_SUBPAGE_READ(chip) ((chip->options & NAND_SUBPAGE_READ)) |
| 170 | 171 | |
| 172 | +/* | |
| 173 | + * There are different places where the manufacturer stores the factory bad | |
| 174 | + * block markers. | |
| 175 | + * | |
| 176 | + * Position within the block: Each of these pages needs to be checked for a | |
| 177 | + * bad block marking pattern. | |
| 178 | + */ | |
| 179 | +#define NAND_BBM_FIRSTPAGE 0x01000000 | |
| 180 | +#define NAND_BBM_SECONDPAGE 0x02000000 | |
| 181 | +#define NAND_BBM_LASTPAGE 0x04000000 | |
| 182 | + | |
| 183 | +/* Position within the OOB data of the page */ | |
| 184 | +#define NAND_BBM_POS_SMALL 5 | |
| 185 | +#define NAND_BBM_POS_LARGE 0 | |
| 186 | + | |
| 171 | 187 | /* Non chip related options */ |
| 172 | 188 | /* This option skips the bbt scan during initialization. */ |
| 173 | 189 | #define NAND_SKIP_BBTSCAN 0x00010000 |
| @@ -805,7 +821,7 @@ struct nand_op_parser_pattern { · 631 unmodified lines | ||
| 805 | 821 | #define NAND_OP_PARSER_PATTERN(_exec, ...) \ |
| 806 | 822 | { \ |
| 807 | 823 | .exec = _exec, \ |
| 808 | − .elems = (struct nand_op_parser_pattern_elem[]) { __VA_ARGS__ }, \ | |
| 824 | + .elems = (const struct nand_op_parser_pattern_elem[]) { __VA_ARGS__ }, \ | |
| 809 | 825 | .nelems = sizeof((struct nand_op_parser_pattern_elem[]) { __VA_ARGS__ }) / \ |
| 810 | 826 | sizeof(struct nand_op_parser_pattern_elem), \ |
| 811 | 827 | } |
| @@ -831,7 +847,7 @@ struct nand_op_parser { · 19 unmodified lines | ||
| 831 | 847 | |
| 832 | 848 | #define NAND_OP_PARSER(...) \ |
| 833 | 849 | { \ |
| 834 | − .patterns = (struct nand_op_parser_pattern[]) { __VA_ARGS__ }, \ | |
| 850 | + .patterns = (const struct nand_op_parser_pattern[]) { __VA_ARGS__ }, \ | |
| 835 | 851 | .npatterns = sizeof((struct nand_op_parser_pattern[]) { __VA_ARGS__ }) / \ |
| 836 | 852 | sizeof(struct nand_op_parser_pattern), \ |
| 837 | 853 | } |
| @@ -860,6 +876,7 @@ struct nand_operation { · 22 unmodified lines | ||
| 860 | 876 | int nand_op_parser_exec_op(struct nand_chip *chip, |
| 861 | 877 | const struct nand_op_parser *parser, |
| 862 | 878 | const struct nand_operation *op, bool check_only); |
| 879 | + | |
| 863 | 880 | /** |
| 864 | 881 | * struct nand_controller_ops - Controller operations |
| 865 | 882 | * |
| @@ -962,7 +979,7 @@ struct nand_legacy { · 96 unmodified lines | ||
| 962 | 979 | |
| 963 | 980 | /** |
| 964 | 981 | * struct nand_chip - NAND Private Flash Chip Data |
| 965 | − * @mtd: MTD device registered to the MTD framework | |
| 982 | + * @base: Inherit from the generic NAND device | |
| 966 | 983 | * @legacy: All legacy fields/hooks. If you develop a new driver, |
| 967 | 984 | * don't even try to use any of these fields/hooks, and if |
| 968 | 985 | * you're modifying an existing driver that is using those |
| @@ -990,37 +1007,26 @@ struct nand_legacy { · 21 unmodified lines | ||
| 990 | 1007 | * @badblockbits: [INTERN] minimum number of set bits in a good block's |
| 991 | 1008 | * bad block marker position; i.e., BBM == 11110111b is |
| 992 | 1009 | * not bad when badblockbits == 7 |
| 993 | − * @bits_per_cell: [INTERN] number of bits per cell. i.e., 1 means SLC. | |
| 994 | − * @ecc_strength_ds: [INTERN] ECC correctability from the datasheet. | |
| 995 | − * Minimum amount of bit errors per @ecc_step_ds guaranteed | |
| 996 | − * to be correctable. If unknown, set to zero. | |
| 997 | − * @ecc_step_ds: [INTERN] ECC step required by the @ecc_strength_ds, | |
| 998 | − * also from the datasheet. It is the recommended ECC step | |
| 999 | − * size, if known; if unknown, set to zero. | |
| 1000 | 1010 | * @onfi_timing_mode_default: [INTERN] default ONFI timing mode. This field is |
| 1001 | 1011 | * set to the actually used ONFI mode if the chip is |
| 1002 | 1012 | * ONFI compliant or deduced from the datasheet if |
| 1003 | 1013 | * the NAND chip is not ONFI compliant. |
| 1004 | − * @numchips: [INTERN] number of physical chips | |
| 1005 | − * @chipsize: [INTERN] the size of one chip for multichip arrays | |
| 1006 | 1014 | * @pagemask: [INTERN] page number mask = number of (pages / chip) - 1 |
| 1007 | 1015 | * @data_buf: [INTERN] buffer for data, size is (page size + oobsize). |
| 1008 | − * @pagebuf: [INTERN] holds the pagenumber which is currently in | |
| 1009 | − * data_buf. | |
| 1010 | − * @pagebuf_bitflips: [INTERN] holds the bitflip count for the page which is | |
| 1011 | − * currently in data_buf. | |
| 1016 | + * @pagecache: Structure containing page cache related fields | |
| 1017 | + * @pagecache.bitflips: Number of bitflips of the cached page | |
| 1018 | + * @pagecache.page: Page number currently in the cache. -1 means no page is | |
| 1019 | + * currently cached | |
| 1012 | 1020 | * @subpagesize: [INTERN] holds the subpagesize |
| 1013 | 1021 | * @id: [INTERN] holds NAND ID |
| 1014 | 1022 | * @parameters: [INTERN] holds generic parameters under an easily |
| 1015 | 1023 | * readable form. |
| 1016 | − * @max_bb_per_die: [INTERN] the max number of bad blocks each die of a | |
| 1017 | − * this nand device will encounter their life times. | |
| 1018 | − * @blocks_per_die: [INTERN] The number of PEBs in a die | |
| 1019 | 1024 | * @data_interface: [INTERN] NAND interface timing information |
| 1020 | 1025 | * @cur_cs: currently selected target. -1 means no target selected, |
| 1021 | 1026 | * otherwise we should always have cur_cs >= 0 && |
| 1022 | − * cur_cs < numchips. NAND Controller drivers should not | |
| 1023 | − * modify this value, but they're allowed to read it. | |
| 1027 | + * cur_cs < nanddev_ntargets(). NAND Controller drivers | |
| 1028 | + * should not modify this value, but they're allowed to | |
| 1029 | + * read it. | |
| 1024 | 1030 | * @read_retries: [INTERN] the number of read retry modes supported |
| 1025 | 1031 | * @lock: lock protecting the suspended field. Also used to |
| 1026 | 1032 | * serialize accesses to the NAND device. |
| @@ -1041,7 +1047,7 @@ struct nand_legacy { · 14 unmodified lines | ||
| 1041 | 1047 | */ |
| 1042 | 1048 | |
| 1043 | 1049 | struct nand_chip { |
| 1044 | − struct mtd_info mtd; | |
| 1050 | + struct nand_device base; | |
| 1045 | 1051 | |
| 1046 | 1052 | struct nand_legacy legacy; |
| 1047 | 1053 | |
| @@ -1054,24 +1060,21 @@ struct nand_chip { · 6 unmodified lines | ||
| 1054 | 1060 | int phys_erase_shift; |
| 1055 | 1061 | int bbt_erase_shift; |
| 1056 | 1062 | int chip_shift; |
| 1057 | − int numchips; | |
| 1058 | − uint64_t chipsize; | |
| 1059 | 1063 | int pagemask; |
| 1060 | 1064 | u8 *data_buf; |
| 1061 | − int pagebuf; | |
| 1062 | − unsigned int pagebuf_bitflips; | |
| 1065 | + | |
| 1066 | + struct { | |
| 1067 | + unsigned int bitflips; | |
| 1068 | + int page; | |
| 1069 | + } pagecache; | |
| 1070 | + | |
| 1063 | 1071 | int subpagesize; |
| 1064 | − uint8_t bits_per_cell; | |
| 1065 | − uint16_t ecc_strength_ds; | |
| 1066 | − uint16_t ecc_step_ds; | |
| 1067 | 1072 | int onfi_timing_mode_default; |
| 1068 | − int badblockpos; | |
| 1073 | + unsigned int badblockpos; | |
| 1069 | 1074 | int badblockbits; |
| 1070 | 1075 | |
| 1071 | 1076 | struct nand_id id; |
| 1072 | 1077 | struct nand_parameters parameters; |
| 1073 | − u16 max_bb_per_die; | |
| 1074 | − u32 blocks_per_die; | |
| 1075 | 1078 | |
| 1076 | 1079 | struct nand_data_interface data_interface; |
| 1077 | 1080 | |
| @@ -1105,25 +1108,14 @@ struct nand_chip { · 27 unmodified lines | ||
| 1105 | 1108 | extern const struct mtd_ooblayout_ops nand_ooblayout_sp_ops; |
| 1106 | 1109 | extern const struct mtd_ooblayout_ops nand_ooblayout_lp_ops; |
| 1107 | 1110 | |
| 1108 | −static inline void nand_set_flash_node(struct nand_chip *chip, | |
| 1109 | − struct device_node *np) | |
| 1110 | −{ | |
| 1111 | − mtd_set_of_node(&chip->mtd, np); | |
| 1112 | −} | |
| 1113 | − | |
| 1114 | −static inline struct device_node *nand_get_flash_node(struct nand_chip *chip) | |
| 1115 | −{ | |
| 1116 | − return mtd_get_of_node(&chip->mtd); | |
| 1117 | −} | |
| 1118 | − | |
| 1119 | 1111 | static inline struct nand_chip *mtd_to_nand(struct mtd_info *mtd) |
| 1120 | 1112 | { |
| 1121 | − return container_of(mtd, struct nand_chip, mtd); | |
| 1113 | + return container_of(mtd, struct nand_chip, base.mtd); | |
| 1122 | 1114 | } |
| 1123 | 1115 | |
| 1124 | 1116 | static inline struct mtd_info *nand_to_mtd(struct nand_chip *chip) |
| 1125 | 1117 | { |
| 1126 | − return &chip->mtd; | |
| 1118 | + return &chip->base.mtd; | |
| 1127 | 1119 | } |
| 1128 | 1120 | |
| 1129 | 1121 | static inline void *nand_get_controller_data(struct nand_chip *chip) |
| @@ -1147,6 +1139,17 @@ static inline void *nand_get_manufacturer_data(struct nand_chip *chip) · 17 unmodified lines | ||
| 1147 | 1139 | return chip->manufacturer.priv; |
| 1148 | 1140 | } |
| 1149 | 1141 | |
| 1142 | +static inline void nand_set_flash_node(struct nand_chip *chip, | |
| 1143 | + struct device_node *np) | |
| 1144 | +{ | |
| 1145 | + mtd_set_of_node(nand_to_mtd(chip), np); | |
| 1146 | +} | |
| 1147 | + | |
| 1148 | +static inline struct device_node *nand_get_flash_node(struct nand_chip *chip) | |
| 1149 | +{ | |
| 1150 | + return mtd_get_of_node(nand_to_mtd(chip)); | |
| 1151 | +} | |
| 1152 | + | |
| 1150 | 1153 | /* |
| 1151 | 1154 | * A helper for defining older NAND chips where the second ID byte fully |
| 1152 | 1155 | * defined the chip, including the geometry (chip size, eraseblock size, page |
| @@ -1180,9 +1183,9 @@ static inline void *nand_get_manufacturer_data(struct nand_chip *chip) · 27 unmodified lines | ||
| 1180 | 1183 | * @name: a human-readable name of the NAND chip |
| 1181 | 1184 | * @dev_id: the device ID (the second byte of the full chip ID array) |
| 1182 | 1185 | * @mfr_id: manufecturer ID part of the full chip ID array (refers the same |
| 1183 | − * memory address as @id[0]) | |
| 1186 | + * memory address as ``id[0]``) | |
| 1184 | 1187 | * @dev_id: device ID part of the full chip ID array (refers the same memory |
| 1185 | − * address as @id[1]) | |
| 1188 | + * address as ``id[1]``) | |
| 1186 | 1189 | * @id: full device ID array |
| 1187 | 1190 | * @pagesize: size of the NAND page in bytes; if 0, then the real page size (as |
| 1188 | 1191 | * well as the eraseblock size) is determined from the extended NAND |
| @@ -1235,9 +1238,9 @@ int nand_create_bbt(struct nand_chip *chip); · 46 unmodified lines | ||
| 1235 | 1238 | */ |
| 1236 | 1239 | static inline bool nand_is_slc(struct nand_chip *chip) |
| 1237 | 1240 | { |
| 1238 | − WARN(chip->bits_per_cell == 0, | |
| 1241 | + WARN(nanddev_bits_per_cell(&chip->base) == 0, | |
| 1239 | 1242 | "chip->bits_per_cell is used uninitialized\n"); |
| 1240 | − return chip->bits_per_cell == 1; | |
| 1243 | + return nanddev_bits_per_cell(&chip->base) == 1; | |
| 1241 | 1244 | } |
| 1242 | 1245 | |
| 1243 | 1246 | /** |
| @@ -1348,4 +1351,25 @@ int nand_gpio_waitrdy(struct nand_chip *chip, struct gpio_desc *gpiod, · 104 unmodified lines | ||
| 1348 | 1351 | void nand_select_target(struct nand_chip *chip, unsigned int cs); |
| 1349 | 1352 | void nand_deselect_target(struct nand_chip *chip); |
| 1350 | 1353 | |
| 1354 | +/** | |
| 1355 | + * nand_get_data_buf() - Get the internal page buffer | |
| 1356 | + * @chip: NAND chip object | |
| 1357 | + * | |
| 1358 | + * Returns the pre-allocated page buffer after invalidating the cache. This | |
| 1359 | + * function should be used by drivers that do not want to allocate their own | |
| 1360 | + * bounce buffer and still need such a buffer for specific operations (most | |
| 1361 | + * commonly when reading OOB data only). | |
| 1362 | + * | |
| 1363 | + * Be careful to never call this function in the write/write_oob path, because | |
| 1364 | + * the core may have placed the data to be written out in this buffer. | |
| 1365 | + * | |
| 1366 | + * Return: pointer to the page cache buffer | |
| 1367 | + */ | |
| 1368 | +static inline void *nand_get_data_buf(struct nand_chip *chip) | |
| 1369 | +{ | |
| 1370 | + chip->pagecache.page = -1; | |
| 1371 | + | |
| 1372 | + return chip->data_buf; | |
| 1373 | +} | |
| 1374 | + | |
| 1351 | 1375 | #endif /* __LINUX_MTD_RAWNAND_H */ |
| @@ -302,6 +302,11 @@ struct spinand_info { · 301 unmodified lines | ||
| 302 | 302 | __VA_ARGS__ \ |
| 303 | 303 | } |
| 304 | 304 | |
| 305 | +struct spinand_dirmap { | |
| 306 | + struct spi_mem_dirmap_desc *wdesc; | |
| 307 | + struct spi_mem_dirmap_desc *rdesc; | |
| 308 | +}; | |
| 309 | + | |
| 305 | 310 | /** |
| 306 | 311 | * struct spinand_device - SPI NAND device instance |
| 307 | 312 | * @base: NAND device instance |
| @@ -341,6 +346,8 @@ struct spinand_device { · 33 unmodified lines | ||
| 341 | 346 | const struct spi_mem_op *update_cache; |
| 342 | 347 | } op_templates; |
| 343 | 348 | |
| 349 | + struct spinand_dirmap *dirmaps; | |
| 350 | + | |
| 344 | 351 | int (*select_target)(struct spinand_device *spinand, |
| 345 | 352 | unsigned int target); |
| 346 | 353 | unsigned int cur_target; |
| @@ -161,6 +161,8 @@ struct proto_ops { · 160 unmodified lines | ||
| 161 | 161 | int (*compat_ioctl) (struct socket *sock, unsigned int cmd, |
| 162 | 162 | unsigned long arg); |
| 163 | 163 | #endif |
| 164 | + int (*gettstamp) (struct socket *sock, void __user *userstamp, | |
| 165 | + bool timeval, bool time32); | |
| 164 | 166 | int (*listen) (struct socket *sock, int len); |
| 165 | 167 | int (*shutdown) (struct socket *sock, int flags); |
| 166 | 168 | int (*setsockopt)(struct socket *sock, int level, |
| @@ -194,8 +194,8 @@ struct net_device_stats { · 193 unmodified lines | ||
| 194 | 194 | |
| 195 | 195 | #ifdef CONFIG_RPS |
| 196 | 196 | #include <linux/static_key.h> |
| 197 | −extern struct static_key rps_needed; | |
| 198 | −extern struct static_key rfs_needed; | |
| 197 | +extern struct static_key_false rps_needed; | |
| 198 | +extern struct static_key_false rfs_needed; | |
| 199 | 199 | #endif |
| 200 | 200 | |
| 201 | 201 | struct neighbour; |
| @@ -914,34 +914,13 @@ struct xfrmdev_ops { · 712 unmodified lines | ||
| 914 | 914 | }; |
| 915 | 915 | #endif |
| 916 | 916 | |
| 917 | −#if IS_ENABLED(CONFIG_TLS_DEVICE) | |
| 918 | −enum tls_offload_ctx_dir { | |
| 919 | − TLS_OFFLOAD_CTX_DIR_RX, | |
| 920 | − TLS_OFFLOAD_CTX_DIR_TX, | |
| 921 | −}; | |
| 922 | − | |
| 923 | −struct tls_crypto_info; | |
| 924 | −struct tls_context; | |
| 925 | − | |
| 926 | −struct tlsdev_ops { | |
| 927 | − int (*tls_dev_add)(struct net_device *netdev, struct sock *sk, | |
| 928 | − enum tls_offload_ctx_dir direction, | |
| 929 | − struct tls_crypto_info *crypto_info, | |
| 930 | − u32 start_offload_tcp_sn); | |
| 931 | − void (*tls_dev_del)(struct net_device *netdev, | |
| 932 | − struct tls_context *ctx, | |
| 933 | − enum tls_offload_ctx_dir direction); | |
| 934 | − void (*tls_dev_resync_rx)(struct net_device *netdev, | |
| 935 | − struct sock *sk, u32 seq, u64 rcd_sn); | |
| 936 | −}; | |
| 937 | −#endif | |
| 938 | − | |
| 939 | 917 | struct dev_ifalias { |
| 940 | 918 | struct rcu_head rcuhead; |
| 941 | 919 | char ifalias[]; |
| 942 | 920 | }; |
| 943 | 921 | |
| 944 | 922 | struct devlink; |
| 923 | +struct tlsdev_ops; | |
| 945 | 924 | |
| 946 | 925 | /* |
| 947 | 926 | * This structure defines the management hooks for network devices. |
| @@ -986,8 +965,7 @@ struct devlink; · 38 unmodified lines | ||
| 986 | 965 | * those the driver believes to be appropriate. |
| 987 | 966 | * |
| 988 | 967 | * u16 (*ndo_select_queue)(struct net_device *dev, struct sk_buff *skb, |
| 989 | − * struct net_device *sb_dev, | |
| 990 | − * select_queue_fallback_t fallback); | |
| 968 | + * struct net_device *sb_dev); | |
| 991 | 969 | * Called to decide which queue to use when device supports multiple |
| 992 | 970 | * transmit queues. |
| 993 | 971 | * |
| @@ -1251,8 +1229,8 @@ struct devlink; · 257 unmodified lines | ||
| 1251 | 1229 | * that got dropped are freed/returned via xdp_return_frame(). |
| 1252 | 1230 | * Returns negative number, means general error invoking ndo, meaning |
| 1253 | 1231 | * no frames were xmit'ed and core-caller will free all frames. |
| 1254 | − * struct devlink *(*ndo_get_devlink)(struct net_device *dev); | |
| 1255 | − * Get devlink instance associated with a given netdev. | |
| 1232 | + * struct devlink_port *(*ndo_get_devlink_port)(struct net_device *dev); | |
| 1233 | + * Get devlink port instance associated with a given netdev. | |
| 1256 | 1234 | * Called with a reference on the netdevice and devlink locks only, |
| 1257 | 1235 | * rtnl_lock is not held. |
| 1258 | 1236 | */ |
| @@ -1268,8 +1246,7 @@ struct net_device_ops { · 9 unmodified lines | ||
| 1268 | 1246 | netdev_features_t features); |
| 1269 | 1247 | u16 (*ndo_select_queue)(struct net_device *dev, |
| 1270 | 1248 | struct sk_buff *skb, |
| 1271 | − struct net_device *sb_dev, | |
| 1272 | − select_queue_fallback_t fallback); | |
| 1249 | + struct net_device *sb_dev); | |
| 1273 | 1250 | void (*ndo_change_rx_flags)(struct net_device *dev, |
| 1274 | 1251 | int flags); |
| 1275 | 1252 | void (*ndo_set_rx_mode)(struct net_device *dev); |
| @@ -1453,7 +1430,7 @@ struct net_device_ops { · 177 unmodified lines | ||
| 1453 | 1430 | u32 flags); |
| 1454 | 1431 | int (*ndo_xsk_async_xmit)(struct net_device *dev, |
| 1455 | 1432 | u32 queue_id); |
| 1456 | − struct devlink * (*ndo_get_devlink)(struct net_device *dev); | |
| 1433 | + struct devlink_port * (*ndo_get_devlink_port)(struct net_device *dev); | |
| 1457 | 1434 | }; |
| 1458 | 1435 | |
| 1459 | 1436 | /** |
| @@ -1500,6 +1477,7 @@ struct net_device_ops { · 40 unmodified lines | ||
| 1500 | 1477 | * @IFF_FAILOVER: device is a failover master device |
| 1501 | 1478 | * @IFF_FAILOVER_SLAVE: device is lower dev of a failover master device |
| 1502 | 1479 | * @IFF_L3MDEV_RX_HANDLER: only invoke the rx handler of L3 master device |
| 1480 | + * @IFF_LIVE_RENAME_OK: rename is allowed while device is up and running | |
| 1503 | 1481 | */ |
| 1504 | 1482 | enum netdev_priv_flags { |
| 1505 | 1483 | IFF_802_1Q_VLAN = 1<<0, |
| @@ -1532,6 +1510,7 @@ enum netdev_priv_flags { · 26 unmodified lines | ||
| 1532 | 1510 | IFF_FAILOVER = 1<<27, |
| 1533 | 1511 | IFF_FAILOVER_SLAVE = 1<<28, |
| 1534 | 1512 | IFF_L3MDEV_RX_HANDLER = 1<<29, |
| 1513 | + IFF_LIVE_RENAME_OK = 1<<30, | |
| 1535 | 1514 | }; |
| 1536 | 1515 | |
| 1537 | 1516 | #define IFF_802_1Q_VLAN IFF_802_1Q_VLAN |
| @@ -1563,6 +1542,7 @@ enum netdev_priv_flags { · 25 unmodified lines | ||
| 1563 | 1542 | #define IFF_FAILOVER IFF_FAILOVER |
| 1564 | 1543 | #define IFF_FAILOVER_SLAVE IFF_FAILOVER_SLAVE |
| 1565 | 1544 | #define IFF_L3MDEV_RX_HANDLER IFF_L3MDEV_RX_HANDLER |
| 1545 | +#define IFF_LIVE_RENAME_OK IFF_LIVE_RENAME_OK | |
| 1566 | 1546 | |
| 1567 | 1547 | /** |
| 1568 | 1548 | * struct net_device - The DEVICE structure. |
| @@ -2152,9 +2132,11 @@ static inline void netdev_for_each_tx_queue(struct net_device *dev, · 583 unmodified lines | ||
| 2152 | 2132 | &qdisc_xmit_lock_key); \ |
| 2153 | 2133 | } |
| 2154 | 2134 | |
| 2155 | −struct netdev_queue *netdev_pick_tx(struct net_device *dev, | |
| 2156 | − struct sk_buff *skb, | |
| 2157 | − struct net_device *sb_dev); | |
| 2135 | +u16 netdev_pick_tx(struct net_device *dev, struct sk_buff *skb, | |
| 2136 | + struct net_device *sb_dev); | |
| 2137 | +struct netdev_queue *netdev_core_pick_tx(struct net_device *dev, | |
| 2138 | + struct sk_buff *skb, | |
| 2139 | + struct net_device *sb_dev); | |
| 2158 | 2140 | |
| 2159 | 2141 | /* returns the headroom that the master device needs to take in account |
| 2160 | 2142 | * when forwarding to this dev |
| @@ -2639,11 +2621,9 @@ void dev_close_many(struct list_head *head, bool unlink); · 478 unmodified lines | ||
| 2639 | 2621 | void dev_disable_lro(struct net_device *dev); |
| 2640 | 2622 | int dev_loopback_xmit(struct net *net, struct sock *sk, struct sk_buff *newskb); |
| 2641 | 2623 | u16 dev_pick_tx_zero(struct net_device *dev, struct sk_buff *skb, |
| 2642 | − struct net_device *sb_dev, | |
| 2643 | − select_queue_fallback_t fallback); | |
| 2624 | + struct net_device *sb_dev); | |
| 2644 | 2625 | u16 dev_pick_tx_cpu_id(struct net_device *dev, struct sk_buff *skb, |
| 2645 | − struct net_device *sb_dev, | |
| 2646 | − select_queue_fallback_t fallback); | |
| 2626 | + struct net_device *sb_dev); | |
| 2647 | 2627 | int dev_queue_xmit(struct sk_buff *skb); |
| 2648 | 2628 | int dev_queue_xmit_accel(struct sk_buff *skb, struct net_device *sb_dev); |
| 2649 | 2629 | int dev_direct_xmit(struct sk_buff *skb, u16 queue_id); |
| @@ -2661,14 +2641,6 @@ void netdev_freemem(struct net_device *dev); · 11 unmodified lines | ||
| 2661 | 2641 | void synchronize_net(void); |
| 2662 | 2642 | int init_dummy_netdev(struct net_device *dev); |
| 2663 | 2643 | |
| 2664 | −DECLARE_PER_CPU(int, xmit_recursion); | |
| 2665 | −#define XMIT_RECURSION_LIMIT 10 | |
| 2666 | − | |
| 2667 | −static inline int dev_recursion_level(void) | |
| 2668 | −{ | |
| 2669 | − return this_cpu_read(xmit_recursion); | |
| 2670 | −} | |
| 2671 | − | |
| 2672 | 2644 | struct net_device *dev_get_by_index(struct net *net, int ifindex); |
| 2673 | 2645 | struct net_device *__dev_get_by_index(struct net *net, int ifindex); |
| 2674 | 2646 | struct net_device *dev_get_by_index_rcu(struct net *net, int ifindex); |
| @@ -3017,6 +2989,11 @@ struct softnet_data { · 342 unmodified lines | ||
| 3017 | 2989 | #ifdef CONFIG_XFRM_OFFLOAD |
| 3018 | 2990 | struct sk_buff_head xfrm_backlog; |
| 3019 | 2991 | #endif |
| 2992 | + /* written and read only by owning cpu: */ | |
| 2993 | + struct { | |
| 2994 | + u16 recursion; | |
| 2995 | + u8 more; | |
| 2996 | + } xmit; | |
| 3020 | 2997 | #ifdef CONFIG_RPS |
| 3021 | 2998 | /* input_queue_head should be written by cpu owning this struct, |
| 3022 | 2999 | * and only read by other cpus. Worth using a cache line. |
| @@ -3052,6 +3029,28 @@ static inline void input_queue_tail_incr_save(struct softnet_data *sd, · 29 unmodified lines | ||
| 3052 | 3029 | |
| 3053 | 3030 | DECLARE_PER_CPU_ALIGNED(struct softnet_data, softnet_data); |
| 3054 | 3031 | |
| 3032 | +static inline int dev_recursion_level(void) | |
| 3033 | +{ | |
| 3034 | + return this_cpu_read(softnet_data.xmit.recursion); | |
| 3035 | +} | |
| 3036 | + | |
| 3037 | +#define XMIT_RECURSION_LIMIT 10 | |
| 3038 | +static inline bool dev_xmit_recursion(void) | |
| 3039 | +{ | |
| 3040 | + return unlikely(__this_cpu_read(softnet_data.xmit.recursion) > | |
| 3041 | + XMIT_RECURSION_LIMIT); | |
| 3042 | +} | |
| 3043 | + | |
| 3044 | +static inline void dev_xmit_recursion_inc(void) | |
| 3045 | +{ | |
| 3046 | + __this_cpu_inc(softnet_data.xmit.recursion); | |
| 3047 | +} | |
| 3048 | + | |
| 3049 | +static inline void dev_xmit_recursion_dec(void) | |
| 3050 | +{ | |
| 3051 | + __this_cpu_dec(softnet_data.xmit.recursion); | |
| 3052 | +} | |
| 3053 | + | |
| 3055 | 3054 | void __netif_schedule(struct Qdisc *q); |
| 3056 | 3055 | void netif_schedule_queue(struct netdev_queue *txq); |
| 3057 | 3056 | |
| @@ -4407,10 +4406,15 @@ static inline netdev_tx_t __netdev_start_xmit(const struct net_device_ops *ops, · 1349 unmodified lines | ||
| 4407 | 4406 | struct sk_buff *skb, struct net_device *dev, |
| 4408 | 4407 | bool more) |
| 4409 | 4408 | { |
| 4410 | − skb->xmit_more = more ? 1 : 0; | |
| 4409 | + __this_cpu_write(softnet_data.xmit.more, more); | |
| 4411 | 4410 | return ops->ndo_start_xmit(skb, dev); |
| 4412 | 4411 | } |
| 4413 | 4412 | |
| 4413 | +static inline bool netdev_xmit_more(void) | |
| 4414 | +{ | |
| 4415 | + return __this_cpu_read(softnet_data.xmit.more); | |
| 4416 | +} | |
| 4417 | + | |
| 4414 | 4418 | static inline netdev_tx_t netdev_start_xmit(struct sk_buff *skb, struct net_device *dev, |
| 4415 | 4419 | struct netdev_queue *txq, bool more) |
| 4416 | 4420 | { |
| @@ -24,20 +24,36 @@ static inline int NF_DROP_GETERR(int verdict) · 23 unmodified lines | ||
| 24 | 24 | static inline int nf_inet_addr_cmp(const union nf_inet_addr *a1, |
| 25 | 25 | const union nf_inet_addr *a2) |
| 26 | 26 | { |
| 27 | +#if defined(CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS) && BITS_PER_LONG == 64 | |
| 28 | + const unsigned long *ul1 = (const unsigned long *)a1; | |
| 29 | + const unsigned long *ul2 = (const unsigned long *)a2; | |
| 30 | + | |
| 31 | + return ((ul1[0] ^ ul2[0]) | (ul1[1] ^ ul2[1])) == 0UL; | |
| 32 | +#else | |
| 27 | 33 | return a1->all[0] == a2->all[0] && |
| 28 | 34 | a1->all[1] == a2->all[1] && |
| 29 | 35 | a1->all[2] == a2->all[2] && |
| 30 | 36 | a1->all[3] == a2->all[3]; |
| 37 | +#endif | |
| 31 | 38 | } |
| 32 | 39 | |
| 33 | 40 | static inline void nf_inet_addr_mask(const union nf_inet_addr *a1, |
| 34 | 41 | union nf_inet_addr *result, |
| 35 | 42 | const union nf_inet_addr *mask) |
| 36 | 43 | { |
| 44 | +#if defined(CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS) && BITS_PER_LONG == 64 | |
| 45 | + const unsigned long *ua = (const unsigned long *)a1; | |
| 46 | + unsigned long *ur = (unsigned long *)result; | |
| 47 | + const unsigned long *um = (const unsigned long *)mask; | |
| 48 | + | |
| 49 | + ur[0] = ua[0] & um[0]; | |
| 50 | + ur[1] = ua[1] & um[1]; | |
| 51 | +#else | |
| 37 | 52 | result->all[0] = a1->all[0] & mask->all[0]; |
| 38 | 53 | result->all[1] = a1->all[1] & mask->all[1]; |
| 39 | 54 | result->all[2] = a1->all[2] & mask->all[2]; |
| 40 | 55 | result->all[3] = a1->all[3] & mask->all[3]; |
| 56 | +#endif | |
| 41 | 57 | } |
| 42 | 58 | |
| 43 | 59 | int netfilter_init(void); |
| @@ -360,7 +376,7 @@ extern struct nf_nat_hook __rcu *nf_nat_hook; · 316 unmodified lines | ||
| 360 | 376 | static inline void |
| 361 | 377 | nf_nat_decode_session(struct sk_buff *skb, struct flowi *fl, u_int8_t family) |
| 362 | 378 | { |
| 363 | −#ifdef CONFIG_NF_NAT_NEEDED | |
| 379 | +#if IS_ENABLED(CONFIG_NF_NAT) | |
| 364 | 380 | struct nf_nat_hook *nat_hook; |
| 365 | 381 | |
| 366 | 382 | rcu_read_lock(); |
| @@ -401,33 +401,30 @@ ip_set_get_h16(const struct nlattr *attr) · 400 unmodified lines | ||
| 401 | 401 | return ntohs(nla_get_be16(attr)); |
| 402 | 402 | } |
| 403 | 403 | |
| 404 | −#define ipset_nest_start(skb, attr) nla_nest_start(skb, attr | NLA_F_NESTED) | |
| 405 | −#define ipset_nest_end(skb, start) nla_nest_end(skb, start) | |
| 406 | − | |
| 407 | 404 | static inline int nla_put_ipaddr4(struct sk_buff *skb, int type, __be32 ipaddr) |
| 408 | 405 | { |
| 409 | − struct nlattr *__nested = ipset_nest_start(skb, type); | |
| 406 | + struct nlattr *__nested = nla_nest_start(skb, type); | |
| 410 | 407 | int ret; |
| 411 | 408 | |
| 412 | 409 | if (!__nested) |
| 413 | 410 | return -EMSGSIZE; |
| 414 | 411 | ret = nla_put_in_addr(skb, IPSET_ATTR_IPADDR_IPV4, ipaddr); |
| 415 | 412 | if (!ret) |
| 416 | − ipset_nest_end(skb, __nested); | |
| 413 | + nla_nest_end(skb, __nested); | |
| 417 | 414 | return ret; |
| 418 | 415 | } |
| 419 | 416 | |
| 420 | 417 | static inline int nla_put_ipaddr6(struct sk_buff *skb, int type, |
| 421 | 418 | const struct in6_addr *ipaddrptr) |
| 422 | 419 | { |
| 423 | − struct nlattr *__nested = ipset_nest_start(skb, type); | |
| 420 | + struct nlattr *__nested = nla_nest_start(skb, type); | |
| 424 | 421 | int ret; |
| 425 | 422 | |
| 426 | 423 | if (!__nested) |
| 427 | 424 | return -EMSGSIZE; |
| 428 | 425 | ret = nla_put_in6_addr(skb, IPSET_ATTR_IPADDR_IPV6, ipaddrptr); |
| 429 | 426 | if (!ret) |
| 430 | − ipset_nest_end(skb, __nested); | |
| 427 | + nla_nest_end(skb, __nested); | |
| 431 | 428 | return ret; |
| 432 | 429 | } |
| 433 | 430 | |
| @@ -21,13 +21,18 @@ struct nf_osf_finger { · 20 unmodified lines | ||
| 21 | 21 | struct nf_osf_user_finger finger; |
| 22 | 22 | }; |
| 23 | 23 | |
| 24 | +struct nf_osf_data { | |
| 25 | + const char *genre; | |
| 26 | + const char *version; | |
| 27 | +}; | |
| 28 | + | |
| 24 | 29 | bool nf_osf_match(const struct sk_buff *skb, u_int8_t family, |
| 25 | 30 | int hooknum, struct net_device *in, struct net_device *out, |
| 26 | 31 | const struct nf_osf_info *info, struct net *net, |
| 27 | 32 | const struct list_head *nf_osf_fingers); |
| 28 | 33 | |
| 29 | −const char *nf_osf_find(const struct sk_buff *skb, | |
| 30 | − const struct list_head *nf_osf_fingers, | |
| 31 | − const int ttl_check); | |
| 34 | +bool nf_osf_find(const struct sk_buff *skb, | |
| 35 | + const struct list_head *nf_osf_fingers, | |
| 36 | + const int ttl_check, struct nf_osf_data *data); | |
| 32 | 37 | |
| 33 | 38 | #endif /* _NFOSF_H */ |
| @@ -317,7 +317,6 @@ struct xt_table_info *xt_replace_table(struct xt_table *table, · 316 unmodified lines | ||
| 317 | 317 | int *error); |
| 318 | 318 | |
| 319 | 319 | struct xt_match *xt_find_match(u8 af, const char *name, u8 revision); |
| 320 | −struct xt_target *xt_find_target(u8 af, const char *name, u8 revision); | |
| 321 | 320 | struct xt_match *xt_request_find_match(u8 af, const char *name, u8 revision); |
| 322 | 321 | struct xt_target *xt_request_find_target(u8 af, const char *name, u8 revision); |
| 323 | 322 | int xt_find_revision(u8 af, const char *name, u8 revision, int target, |
| @@ -87,6 +87,21 @@ static inline int nf_ip6_route(struct net *net, struct dst_entry **dst, · 86 unmodified lines | ||
| 87 | 87 | } |
| 88 | 88 | |
| 89 | 89 | int ip6_route_me_harder(struct net *net, struct sk_buff *skb); |
| 90 | + | |
| 91 | +static inline int nf_ip6_route_me_harder(struct net *net, struct sk_buff *skb) | |
| 92 | +{ | |
| 93 | +#if IS_MODULE(CONFIG_IPV6) | |
| 94 | + const struct nf_ipv6_ops *v6_ops = nf_get_ipv6_ops(); | |
| 95 | + | |
| 96 | + if (!v6_ops) | |
| 97 | + return -EHOSTUNREACH; | |
| 98 | + | |
| 99 | + return v6_ops->route_me_harder(net, skb); | |
| 100 | +#else | |
| 101 | + return ip6_route_me_harder(net, skb); | |
| 102 | +#endif | |
| 103 | +} | |
| 104 | + | |
| 90 | 105 | __sum16 nf_ip6_checksum(struct sk_buff *skb, unsigned int hook, |
| 91 | 106 | unsigned int dataoff, u_int8_t protocol); |
| 92 | 107 | |
| @@ -76,7 +76,6 @@ struct nfs_open_context { · 75 unmodified lines | ||
| 76 | 76 | fmode_t mode; |
| 77 | 77 | |
| 78 | 78 | unsigned long flags; |
| 79 | −#define NFS_CONTEXT_ERROR_WRITE (0) | |
| 80 | 79 | #define NFS_CONTEXT_RESEND_WRITES (1) |
| 81 | 80 | #define NFS_CONTEXT_BAD (2) |
| 82 | 81 | #define NFS_CONTEXT_UNLOCK (3) |
| @@ -139,6 +139,16 @@ struct nfs_server { · 138 unmodified lines | ||
| 139 | 139 | struct nfs_iostats __percpu *io_stats; /* I/O statistics */ |
| 140 | 140 | atomic_long_t writeback; /* number of writeback pages */ |
| 141 | 141 | int flags; /* various flags */ |
| 142 | + | |
| 143 | +/* The following are for internal use only. Also see uapi/linux/nfs_mount.h */ | |
| 144 | +#define NFS_MOUNT_LOOKUP_CACHE_NONEG 0x10000 | |
| 145 | +#define NFS_MOUNT_LOOKUP_CACHE_NONE 0x20000 | |
| 146 | +#define NFS_MOUNT_NORESVPORT 0x40000 | |
| 147 | +#define NFS_MOUNT_LEGACY_INTERFACE 0x80000 | |
| 148 | +#define NFS_MOUNT_LOCAL_FLOCK 0x100000 | |
| 149 | +#define NFS_MOUNT_LOCAL_FCNTL 0x200000 | |
| 150 | +#define NFS_MOUNT_SOFTERR 0x400000 | |
| 151 | + | |
| 142 | 152 | unsigned int caps; /* server capabilities */ |
| 143 | 153 | unsigned int rsize; /* read size */ |
| 144 | 154 | unsigned int rpages; /* read size (in pages) */ |
| @@ -231,6 +241,9 @@ struct nfs_server { · 86 unmodified lines | ||
| 231 | 241 | |
| 232 | 242 | /* XDR related information */ |
| 233 | 243 | unsigned int read_hdrsize; |
| 244 | + | |
| 245 | + /* User namespace info */ | |
| 246 | + const struct cred *cred; | |
| 234 | 247 | }; |
| 235 | 248 | |
| 236 | 249 | /* Server capabilities */ |
| @@ -42,7 +42,6 @@ struct nfs_inode; · 41 unmodified lines | ||
| 42 | 42 | struct nfs_page { |
| 43 | 43 | struct list_head wb_list; /* Defines state of page: */ |
| 44 | 44 | struct page *wb_page; /* page to read in/write out */ |
| 45 | − struct nfs_open_context *wb_context; /* File state context info */ | |
| 46 | 45 | struct nfs_lock_context *wb_lock_context; /* lock context info */ |
| 47 | 46 | pgoff_t wb_index; /* Offset >> PAGE_SHIFT */ |
| 48 | 47 | unsigned int wb_offset, /* Offset & ~PAGE_MASK */ |
| @@ -53,6 +52,7 @@ struct nfs_page { · 4 unmodified lines | ||
| 53 | 52 | struct nfs_write_verifier wb_verf; /* Commit cookie */ |
| 54 | 53 | struct nfs_page *wb_this_page; /* list of reqs for this page */ |
| 55 | 54 | struct nfs_page *wb_head; /* head pointer for req list */ |
| 55 | + unsigned short wb_nio; /* Number of I/O attempts */ | |
| 56 | 56 | }; |
| 57 | 57 | |
| 58 | 58 | struct nfs_pageio_descriptor; |
| @@ -87,7 +87,6 @@ struct nfs_pgio_mirror { · 28 unmodified lines | ||
| 87 | 87 | }; |
| 88 | 88 | |
| 89 | 89 | struct nfs_pageio_descriptor { |
| 90 | − unsigned char pg_moreio : 1; | |
| 91 | 90 | struct inode *pg_inode; |
| 92 | 91 | const struct nfs_pageio_ops *pg_ops; |
| 93 | 92 | const struct nfs_rw_ops *pg_rw_ops; |
| @@ -105,6 +104,8 @@ struct nfs_pageio_descriptor { · 11 unmodified lines | ||
| 105 | 104 | struct nfs_pgio_mirror pg_mirrors_static[1]; |
| 106 | 105 | struct nfs_pgio_mirror *pg_mirrors_dynamic; |
| 107 | 106 | u32 pg_mirror_idx; /* current mirror */ |
| 107 | + unsigned short pg_maxretrans; | |
| 108 | + unsigned char pg_moreio : 1; | |
| 108 | 109 | }; |
| 109 | 110 | |
| 110 | 111 | /* arbitrarily selected limit to number of mirrors */ |
| @@ -114,7 +115,6 @@ struct nfs_pageio_descriptor { · 3 unmodified lines | ||
| 114 | 115 | |
| 115 | 116 | extern struct nfs_page *nfs_create_request(struct nfs_open_context *ctx, |
| 116 | 117 | struct page *page, |
| 117 | − struct nfs_page *last, | |
| 118 | 118 | unsigned int offset, |
| 119 | 119 | unsigned int count); |
| 120 | 120 | extern void nfs_release_request(struct nfs_page *); |
| @@ -199,4 +199,10 @@ loff_t req_offset(struct nfs_page *req) · 78 unmodified lines | ||
| 199 | 199 | return (((loff_t)req->wb_index) << PAGE_SHIFT) + req->wb_offset; |
| 200 | 200 | } |
| 201 | 201 | |
| 202 | +static inline struct nfs_open_context * | |
| 203 | +nfs_req_openctx(struct nfs_page *req) | |
| 204 | +{ | |
| 205 | + return req->wb_lock_context->open_context; | |
| 206 | +} | |
| 207 | + | |
| 202 | 208 | #endif /* _LINUX_NFS_PAGE_H */ |
| @@ -17,14 +17,81 @@ · 16 unmodified lines | ||
| 17 | 17 | |
| 18 | 18 | #include <linux/device.h> |
| 19 | 19 | #include <linux/cpumask.h> |
| 20 | +#include <linux/list.h> | |
| 20 | 21 | #include <linux/workqueue.h> |
| 21 | 22 | |
| 23 | +/** | |
| 24 | + * struct node_hmem_attrs - heterogeneous memory performance attributes | |
| 25 | + * | |
| 26 | + * @read_bandwidth: Read bandwidth in MB/s | |
| 27 | + * @write_bandwidth: Write bandwidth in MB/s | |
| 28 | + * @read_latency: Read latency in nanoseconds | |
| 29 | + * @write_latency: Write latency in nanoseconds | |
| 30 | + */ | |
| 31 | +struct node_hmem_attrs { | |
| 32 | + unsigned int read_bandwidth; | |
| 33 | + unsigned int write_bandwidth; | |
| 34 | + unsigned int read_latency; | |
| 35 | + unsigned int write_latency; | |
| 36 | +}; | |
| 37 | + | |
| 38 | +enum cache_indexing { | |
| 39 | + NODE_CACHE_DIRECT_MAP, | |
| 40 | + NODE_CACHE_INDEXED, | |
| 41 | + NODE_CACHE_OTHER, | |
| 42 | +}; | |
| 43 | + | |
| 44 | +enum cache_write_policy { | |
| 45 | + NODE_CACHE_WRITE_BACK, | |
| 46 | + NODE_CACHE_WRITE_THROUGH, | |
| 47 | + NODE_CACHE_WRITE_OTHER, | |
| 48 | +}; | |
| 49 | + | |
| 50 | +/** | |
| 51 | + * struct node_cache_attrs - system memory caching attributes | |
| 52 | + * | |
| 53 | + * @indexing: The ways memory blocks may be placed in cache | |
| 54 | + * @write_policy: Write back or write through policy | |
| 55 | + * @size: Total size of cache in bytes | |
| 56 | + * @line_size: Number of bytes fetched on a cache miss | |
| 57 | + * @level: The cache hierarchy level | |
| 58 | + */ | |
| 59 | +struct node_cache_attrs { | |
| 60 | + enum cache_indexing indexing; | |
| 61 | + enum cache_write_policy write_policy; | |
| 62 | + u64 size; | |
| 63 | + u16 line_size; | |
| 64 | + u8 level; | |
| 65 | +}; | |
| 66 | + | |
| 67 | +#ifdef CONFIG_HMEM_REPORTING | |
| 68 | +void node_add_cache(unsigned int nid, struct node_cache_attrs *cache_attrs); | |
| 69 | +void node_set_perf_attrs(unsigned int nid, struct node_hmem_attrs *hmem_attrs, | |
| 70 | + unsigned access); | |
| 71 | +#else | |
| 72 | +static inline void node_add_cache(unsigned int nid, | |
| 73 | + struct node_cache_attrs *cache_attrs) | |
| 74 | +{ | |
| 75 | +} | |
| 76 | + | |
| 77 | +static inline void node_set_perf_attrs(unsigned int nid, | |
| 78 | + struct node_hmem_attrs *hmem_attrs, | |
| 79 | + unsigned access) | |
| 80 | +{ | |
| 81 | +} | |
| 82 | +#endif | |
| 83 | + | |
| 22 | 84 | struct node { |
| 23 | 85 | struct device dev; |
| 86 | + struct list_head access_list; | |
| 24 | 87 | |
| 25 | 88 | #if defined(CONFIG_MEMORY_HOTPLUG_SPARSE) && defined(CONFIG_HUGETLBFS) |
| 26 | 89 | struct work_struct node_work; |
| 27 | 90 | #endif |
| 91 | +#ifdef CONFIG_HMEM_REPORTING | |
| 92 | + struct list_head cache_attrs; | |
| 93 | + struct device *cache_dev; | |
| 94 | +#endif | |
| 28 | 95 | }; |
| 29 | 96 | |
| 30 | 97 | struct memory_block; |
| @@ -75,6 +142,10 @@ extern int register_mem_sect_under_node(struct memory_block *mem_blk, · 44 unmodified lines | ||
| 75 | 142 | extern int unregister_mem_sect_under_nodes(struct memory_block *mem_blk, |
| 76 | 143 | unsigned long phys_index); |
| 77 | 144 | |
| 145 | +extern int register_memory_node_under_compute_node(unsigned int mem_nid, | |
| 146 | + unsigned int cpu_nid, | |
| 147 | + unsigned access); | |
| 148 | + | |
| 78 | 149 | #ifdef CONFIG_HUGETLBFS |
| 79 | 150 | extern void register_hugetlbfs_with_node(node_registration_func_t doregister, |
| 80 | 151 | node_registration_func_t unregister); |
| @@ -17,12 +17,6 @@ · 16 unmodified lines | ||
| 17 | 17 | |
| 18 | 18 | |
| 19 | 19 | |
| 20 | −/* FC Port role bitmask - can merge with FC Port Roles in fc transport */ | |
| 21 | −#define FC_PORT_ROLE_NVME_INITIATOR 0x10 | |
| 22 | −#define FC_PORT_ROLE_NVME_TARGET 0x20 | |
| 23 | −#define FC_PORT_ROLE_NVME_DISCOVERY 0x40 | |
| 24 | − | |
| 25 | − | |
| 26 | 20 | /** |
| 27 | 21 | * struct nvme_fc_port_info - port-specific ids and FC connection-specific |
| 28 | 22 | * data element used during NVME Host role |
| @@ -77,7 +77,7 @@ struct nvme_rdma_cm_rep { · 76 unmodified lines | ||
| 77 | 77 | * struct nvme_rdma_cm_rej - rdma connect reject |
| 78 | 78 | * |
| 79 | 79 | * @recfmt: format of the RDMA Private Data |
| 80 | − * @fsts: error status for the associated connect request | |
| 80 | + * @sts: error status for the associated connect request | |
| 81 | 81 | */ |
| 82 | 82 | struct nvme_rdma_cm_rej { |
| 83 | 83 | __le16 recfmt; |
| @@ -1246,9 +1246,9 @@ enum { · 1245 unmodified lines | ||
| 1246 | 1246 | NVME_SC_FW_NEEDS_SUBSYS_RESET = 0x110, |
| 1247 | 1247 | NVME_SC_FW_NEEDS_RESET = 0x111, |
| 1248 | 1248 | NVME_SC_FW_NEEDS_MAX_TIME = 0x112, |
| 1249 | − NVME_SC_FW_ACIVATE_PROHIBITED = 0x113, | |
| 1249 | + NVME_SC_FW_ACTIVATE_PROHIBITED = 0x113, | |
| 1250 | 1250 | NVME_SC_OVERLAPPING_RANGE = 0x114, |
| 1251 | − NVME_SC_NS_INSUFFICENT_CAP = 0x115, | |
| 1251 | + NVME_SC_NS_INSUFFICIENT_CAP = 0x115, | |
| 1252 | 1252 | NVME_SC_NS_ID_UNAVAILABLE = 0x116, |
| 1253 | 1253 | NVME_SC_NS_ALREADY_ATTACHED = 0x118, |
| 1254 | 1254 | NVME_SC_NS_IS_PRIVATE = 0x119, |
| @@ -61,6 +61,7 @@ void nvmem_cell_put(struct nvmem_cell *cell); · 60 unmodified lines | ||
| 61 | 61 | void devm_nvmem_cell_put(struct device *dev, struct nvmem_cell *cell); |
| 62 | 62 | void *nvmem_cell_read(struct nvmem_cell *cell, size_t *len); |
| 63 | 63 | int nvmem_cell_write(struct nvmem_cell *cell, void *buf, size_t len); |
| 64 | +int nvmem_cell_read_u16(struct device *dev, const char *cell_id, u16 *val); | |
| 64 | 65 | int nvmem_cell_read_u32(struct device *dev, const char *cell_id, u32 *val); |
| 65 | 66 | |
| 66 | 67 | /* direct nvmem device read/write interface */ |
| @@ -122,6 +123,12 @@ static inline int nvmem_cell_write(struct nvmem_cell *cell, · 55 unmodified lines | ||
| 122 | 123 | return -EOPNOTSUPP; |
| 123 | 124 | } |
| 124 | 125 | |
| 126 | +static inline int nvmem_cell_read_u16(struct device *dev, | |
| 127 | + const char *cell_id, u16 *val) | |
| 128 | +{ | |
| 129 | + return -EOPNOTSUPP; | |
| 130 | +} | |
| 131 | + | |
| 125 | 132 | static inline int nvmem_cell_read_u32(struct device *dev, |
| 126 | 133 | const char *cell_id, u32 *val) |
| 127 | 134 | { |
| @@ -234,8 +234,8 @@ extern struct device_node *of_find_all_nodes(struct device_node *prev); · 233 unmodified lines | ||
| 234 | 234 | static inline u64 of_read_number(const __be32 *cell, int size) |
| 235 | 235 | { |
| 236 | 236 | u64 r = 0; |
| 237 | − while (size--) | |
| 238 | − r = (r << 32) | be32_to_cpu(*(cell++)); | |
| 237 | + for (; size--; cell++) | |
| 238 | + r = (r << 32) | be32_to_cpu(*cell); | |
| 239 | 239 | return r; |
| 240 | 240 | } |
| 241 | 241 | |
| @@ -1449,7 +1449,8 @@ int of_overlay_notifier_unregister(struct notifier_block *nb); · 1207 unmodified lines | ||
| 1449 | 1449 | |
| 1450 | 1450 | #else |
| 1451 | 1451 | |
| 1452 | −static inline int of_overlay_fdt_apply(void *overlay_fdt, int *ovcs_id) | |
| 1452 | +static inline int of_overlay_fdt_apply(void *overlay_fdt, u32 overlay_fdt_size, | |
| 1453 | + int *ovcs_id) | |
| 1453 | 1454 | { |
| 1454 | 1455 | return -ENOTSUPP; |
| 1455 | 1456 | } |
| @@ -93,6 +93,24 @@ enum OID { · 92 unmodified lines | ||
| 93 | 93 | OID_authorityKeyIdentifier, /* 2.5.29.35 */ |
| 94 | 94 | OID_extKeyUsage, /* 2.5.29.37 */ |
| 95 | 95 | |
| 96 | + /* EC-RDSA */ | |
| 97 | + OID_gostCPSignA, /* 1.2.643.2.2.35.1 */ | |
| 98 | + OID_gostCPSignB, /* 1.2.643.2.2.35.2 */ | |
| 99 | + OID_gostCPSignC, /* 1.2.643.2.2.35.3 */ | |
| 100 | + OID_gost2012PKey256, /* 1.2.643.7.1.1.1.1 */ | |
| 101 | + OID_gost2012PKey512, /* 1.2.643.7.1.1.1.2 */ | |
| 102 | + OID_gost2012Digest256, /* 1.2.643.7.1.1.2.2 */ | |
| 103 | + OID_gost2012Digest512, /* 1.2.643.7.1.1.2.3 */ | |
| 104 | + OID_gost2012Signature256, /* 1.2.643.7.1.1.3.2 */ | |
| 105 | + OID_gost2012Signature512, /* 1.2.643.7.1.1.3.3 */ | |
| 106 | + OID_gostTC26Sign256A, /* 1.2.643.7.1.2.1.1.1 */ | |
| 107 | + OID_gostTC26Sign256B, /* 1.2.643.7.1.2.1.1.2 */ | |
| 108 | + OID_gostTC26Sign256C, /* 1.2.643.7.1.2.1.1.3 */ | |
| 109 | + OID_gostTC26Sign256D, /* 1.2.643.7.1.2.1.1.4 */ | |
| 110 | + OID_gostTC26Sign512A, /* 1.2.643.7.1.2.1.2.1 */ | |
| 111 | + OID_gostTC26Sign512B, /* 1.2.643.7.1.2.1.2.2 */ | |
| 112 | + OID_gostTC26Sign512C, /* 1.2.643.7.1.2.1.2.3 */ | |
| 113 | + | |
| 96 | 114 | OID__NR |
| 97 | 115 | }; |
| 98 | 116 | |
| @@ -36,6 +36,12 @@ · 35 unmodified lines | ||
| 36 | 36 | #define type_max(T) ((T)((__type_half_max(T) - 1) + __type_half_max(T))) |
| 37 | 37 | #define type_min(T) ((T)((T)-type_max(T)-(T)1)) |
| 38 | 38 | |
| 39 | +/* | |
| 40 | + * Avoids triggering -Wtype-limits compilation warning, | |
| 41 | + * while using unsigned data types to check a < 0. | |
| 42 | + */ | |
| 43 | +#define is_non_negative(a) ((a) > 0 || (a) == 0) | |
| 44 | +#define is_negative(a) (!(is_non_negative(a))) | |
| 39 | 45 | |
| 40 | 46 | #ifdef COMPILER_HAS_GENERIC_BUILTIN_OVERFLOW |
| 41 | 47 | /* |
| @@ -227,10 +233,10 @@ · 185 unmodified lines | ||
| 227 | 233 | typeof(d) _d = d; \ |
| 228 | 234 | u64 _a_full = _a; \ |
| 229 | 235 | unsigned int _to_shift = \ |
| 230 | − _s >= 0 && _s < 8 * sizeof(*d) ? _s : 0; \ | |
| 236 | + is_non_negative(_s) && _s < 8 * sizeof(*d) ? _s : 0; \ | |
| 231 | 237 | *_d = (_a_full << _to_shift); \ |
| 232 | − (_to_shift != _s || *_d < 0 || _a < 0 || \ | |
| 233 | − (*_d >> _to_shift) != _a); \ | |
| 238 | + (_to_shift != _s || is_negative(*_d) || is_negative(_a) || \ | |
| 239 | + (*_d >> _to_shift) != _a); \ | |
| 234 | 240 | }) |
| 235 | 241 | |
| 236 | 242 | /** |
| @@ -278,11 +284,15 @@ static inline __must_check size_t array3_size(size_t a, size_t b, size_t c) · 41 unmodified lines | ||
| 278 | 284 | return bytes; |
| 279 | 285 | } |
| 280 | 286 | |
| 281 | −static inline __must_check size_t __ab_c_size(size_t n, size_t size, size_t c) | |
| 287 | +/* | |
| 288 | + * Compute a*b+c, returning SIZE_MAX on overflow. Internal helper for | |
| 289 | + * struct_size() below. | |
| 290 | + */ | |
| 291 | +static inline __must_check size_t __ab_c_size(size_t a, size_t b, size_t c) | |
| 282 | 292 | { |
| 283 | 293 | size_t bytes; |
| 284 | 294 | |
| 285 | − if (check_mul_overflow(n, size, &bytes)) | |
| 295 | + if (check_mul_overflow(a, b, &bytes)) | |
| 286 | 296 | return SIZE_MAX; |
| 287 | 297 | if (check_add_overflow(bytes, c, &bytes)) |
| 288 | 298 | return SIZE_MAX; |
| @@ -0,0 +1,49 @@ | ||
| 1 | +/* SPDX-License-Identifier: BSD-3-Clause | |
| 2 | + * Copyright (c) 2016-2018, NXP Semiconductors | |
| 3 | + * Copyright (c) 2018-2019, Vladimir Oltean <olteanv@gmail.com> | |
| 4 | + */ | |
| 5 | +#ifndef _LINUX_PACKING_H | |
| 6 | +#define _LINUX_PACKING_H | |
| 7 | + | |
| 8 | +#include <linux/types.h> | |
| 9 | +#include <linux/bitops.h> | |
| 10 | + | |
| 11 | +#define QUIRK_MSB_ON_THE_RIGHT BIT(0) | |
| 12 | +#define QUIRK_LITTLE_ENDIAN BIT(1) | |
| 13 | +#define QUIRK_LSW32_IS_FIRST BIT(2) | |
| 14 | + | |
| 15 | +enum packing_op { | |
| 16 | + PACK, | |
| 17 | + UNPACK, | |
| 18 | +}; | |
| 19 | + | |
| 20 | +/** | |
| 21 | + * packing - Convert numbers (currently u64) between a packed and an unpacked | |
| 22 | + * format. Unpacked means laid out in memory in the CPU's native | |
| 23 | + * understanding of integers, while packed means anything else that | |
| 24 | + * requires translation. | |
| 25 | + * | |
| 26 | + * @pbuf: Pointer to a buffer holding the packed value. | |
| 27 | + * @uval: Pointer to an u64 holding the unpacked value. | |
| 28 | + * @startbit: The index (in logical notation, compensated for quirks) where | |
| 29 | + * the packed value starts within pbuf. Must be larger than, or | |
| 30 | + * equal to, endbit. | |
| 31 | + * @endbit: The index (in logical notation, compensated for quirks) where | |
| 32 | + * the packed value ends within pbuf. Must be smaller than, or equal | |
| 33 | + * to, startbit. | |
| 34 | + * @op: If PACK, then uval will be treated as const pointer and copied (packed) | |
| 35 | + * into pbuf, between startbit and endbit. | |
| 36 | + * If UNPACK, then pbuf will be treated as const pointer and the logical | |
| 37 | + * value between startbit and endbit will be copied (unpacked) to uval. | |
| 38 | + * @quirks: A bit mask of QUIRK_LITTLE_ENDIAN, QUIRK_LSW32_IS_FIRST and | |
| 39 | + * QUIRK_MSB_ON_THE_RIGHT. | |
| 40 | + * | |
| 41 | + * Return: 0 on success, EINVAL or ERANGE if called incorrectly. Assuming | |
| 42 | + * correct usage, return code may be discarded. | |
| 43 | + * If op is PACK, pbuf is modified. | |
| 44 | + * If op is UNPACK, uval is modified. | |
| 45 | + */ | |
| 46 | +int packing(void *pbuf, u64 *uval, int startbit, int endbit, size_t pbuflen, | |
| 47 | + enum packing_op op, u8 quirks); | |
| 48 | + | |
| 49 | +#endif | |
| @@ -333,6 +333,19 @@ static inline struct page *grab_cache_page_nowait(struct address_space *mapping, · 332 unmodified lines | ||
| 333 | 333 | mapping_gfp_mask(mapping)); |
| 334 | 334 | } |
| 335 | 335 | |
| 336 | +static inline struct page *find_subpage(struct page *page, pgoff_t offset) | |
| 337 | +{ | |
| 338 | + unsigned long mask; | |
| 339 | + | |
| 340 | + if (PageHuge(page)) | |
| 341 | + return page; | |
| 342 | + | |
| 343 | + VM_BUG_ON_PAGE(PageTail(page), page); | |
| 344 | + | |
| 345 | + mask = (1UL << compound_order(page)) - 1; | |
| 346 | + return page + (offset & mask); | |
| 347 | +} | |
| 348 | + | |
| 336 | 349 | struct page *find_get_entry(struct address_space *mapping, pgoff_t offset); |
| 337 | 350 | struct page *find_lock_entry(struct address_space *mapping, pgoff_t offset); |
| 338 | 351 | unsigned find_get_entries(struct address_space *mapping, pgoff_t start, |
| @@ -360,9 +373,6 @@ static inline unsigned find_get_pages_tag(struct address_space *mapping, · 21 unmodified lines | ||
| 360 | 373 | return find_get_pages_range_tag(mapping, index, (pgoff_t)-1, tag, |
| 361 | 374 | nr_pages, pages); |
| 362 | 375 | } |
| 363 | −unsigned find_get_entries_tag(struct address_space *mapping, pgoff_t start, | |
| 364 | − xa_mark_t tag, unsigned int nr_entries, | |
| 365 | − struct page **entries, pgoff_t *indices); | |
| 366 | 376 | |
| 367 | 377 | struct page *grab_cache_page_write_begin(struct address_space *mapping, |
| 368 | 378 | pgoff_t index, unsigned flags); |
| @@ -527,15 +537,7 @@ static inline int wait_on_page_locked_killable(struct page *page) · 158 unmodified lines | ||
| 527 | 537 | |
| 528 | 538 | extern void put_and_wait_on_page_locked(struct page *page); |
| 529 | 539 | |
| 530 | −/* | |
| 531 | − * Wait for a page to complete writeback | |
| 532 | − */ | |
| 533 | −static inline void wait_on_page_writeback(struct page *page) | |
| 534 | −{ | |
| 535 | − if (PageWriteback(page)) | |
| 536 | − wait_on_page_bit(page, PG_writeback); | |
| 537 | −} | |
| 538 | − | |
| 540 | +void wait_on_page_writeback(struct page *page); | |
| 539 | 541 | extern void end_page_writeback(struct page *page); |
| 540 | 542 | void wait_for_stable_page(struct page *page); |
| 541 | 543 | |
| @@ -56,6 +56,7 @@ extern struct pci_ecam_ops thunder_pem_ecam_ops; /* Cavium ThunderX 1.x & 2.x */ · 55 unmodified lines | ||
| 56 | 56 | extern struct pci_ecam_ops pci_thunder_ecam_ops; /* Cavium ThunderX 1.x */ |
| 57 | 57 | extern struct pci_ecam_ops xgene_v1_pcie_ecam_ops; /* APM X-Gene PCIe v1 */ |
| 58 | 58 | extern struct pci_ecam_ops xgene_v2_pcie_ecam_ops; /* APM X-Gene PCIe v2.x */ |
| 59 | +extern struct pci_ecam_ops al_pcie_ops; /* Amazon Annapurna Labs PCIe */ | |
| 59 | 60 | #endif |
| 60 | 61 | |
| 61 | 62 | #ifdef CONFIG_PCI_HOST_COMMON |
| @@ -109,6 +109,7 @@ struct pci_epc { · 108 unmodified lines | ||
| 109 | 109 | * @reserved_bar: bitmap to indicate reserved BAR unavailable to function driver |
| 110 | 110 | * @bar_fixed_64bit: bitmap to indicate fixed 64bit BARs |
| 111 | 111 | * @bar_fixed_size: Array specifying the size supported by each BAR |
| 112 | + * @align: alignment size required for BAR buffer allocation | |
| 112 | 113 | */ |
| 113 | 114 | struct pci_epc_features { |
| 114 | 115 | unsigned int linkup_notifier : 1; |
| @@ -117,6 +118,7 @@ struct pci_epc_features { · 2 unmodified lines | ||
| 117 | 118 | u8 reserved_bar; |
| 118 | 119 | u8 bar_fixed_64bit; |
| 119 | 120 | u64 bar_fixed_size[BAR_5 + 1]; |
| 121 | + size_t align; | |
| 120 | 122 | }; |
| 121 | 123 | |
| 122 | 124 | #define to_pci_epc(device) container_of((device), struct pci_epc, dev) |
| @@ -149,7 +149,8 @@ void pci_epf_destroy(struct pci_epf *epf); · 148 unmodified lines | ||
| 149 | 149 | int __pci_epf_register_driver(struct pci_epf_driver *driver, |
| 150 | 150 | struct module *owner); |
| 151 | 151 | void pci_epf_unregister_driver(struct pci_epf_driver *driver); |
| 152 | −void *pci_epf_alloc_space(struct pci_epf *epf, size_t size, enum pci_barno bar); | |
| 152 | +void *pci_epf_alloc_space(struct pci_epf *epf, size_t size, enum pci_barno bar, | |
| 153 | + size_t align); | |
| 153 | 154 | void pci_epf_free_space(struct pci_epf *epf, void *addr, enum pci_barno bar); |
| 154 | 155 | int pci_epf_bind(struct pci_epf *epf); |
| 155 | 156 | void pci_epf_unbind(struct pci_epf *epf); |
| @@ -348,6 +348,8 @@ struct pci_dev { · 347 unmodified lines | ||
| 348 | 348 | unsigned int hotplug_user_indicators:1; /* SlotCtl indicators |
| 349 | 349 | controlled exclusively by |
| 350 | 350 | user sysfs */ |
| 351 | + unsigned int clear_retrain_link:1; /* Need to clear Retrain Link | |
| 352 | + bit manually */ | |
| 351 | 353 | unsigned int d3_delay; /* D3->D0 transition time in ms */ |
| 352 | 354 | unsigned int d3cold_delay; /* D3cold->D0 transition time in ms */ |
| 353 | 355 | |
| @@ -490,6 +492,7 @@ struct pci_host_bridge { · 136 unmodified lines | ||
| 490 | 492 | void *sysdata; |
| 491 | 493 | int busnr; |
| 492 | 494 | struct list_head windows; /* resource_entry */ |
| 495 | + struct list_head dma_ranges; /* dma ranges resource list */ | |
| 493 | 496 | u8 (*swizzle_irq)(struct pci_dev *, u8 *); /* Platform IRQ swizzler */ |
| 494 | 497 | int (*map_irq)(const struct pci_dev *, u8, u8); |
| 495 | 498 | void (*release_fn)(struct pci_host_bridge *); |
| @@ -596,6 +599,11 @@ struct pci_bus { · 100 unmodified lines | ||
| 596 | 599 | |
| 597 | 600 | #define to_pci_bus(n) container_of(n, struct pci_bus, dev) |
| 598 | 601 | |
| 602 | +static inline u16 pci_dev_id(struct pci_dev *dev) | |
| 603 | +{ | |
| 604 | + return PCI_DEVID(dev->bus->number, dev->devfn); | |
| 605 | +} | |
| 606 | + | |
| 599 | 607 | /* |
| 600 | 608 | * Returns true if the PCI bus is root (behind host-PCI bridge), |
| 601 | 609 | * false otherwise |
| @@ -1233,7 +1241,6 @@ int __must_check pci_request_regions(struct pci_dev *, const char *); · 631 unmodified lines | ||
| 1233 | 1241 | int __must_check pci_request_regions_exclusive(struct pci_dev *, const char *); |
| 1234 | 1242 | void pci_release_regions(struct pci_dev *); |
| 1235 | 1243 | int __must_check pci_request_region(struct pci_dev *, int, const char *); |
| 1236 | −int __must_check pci_request_region_exclusive(struct pci_dev *, int, const char *); | |
| 1237 | 1244 | void pci_release_region(struct pci_dev *, int); |
| 1238 | 1245 | int pci_request_selected_regions(struct pci_dev *, int, const char *); |
| 1239 | 1246 | int pci_request_selected_regions_exclusive(struct pci_dev *, int, const char *); |
| @@ -1521,21 +1528,6 @@ static inline void pcie_ecrc_get_policy(char *str) { } · 281 unmodified lines | ||
| 1521 | 1528 | |
| 1522 | 1529 | bool pci_ats_disabled(void); |
| 1523 | 1530 | |
| 1524 | −#ifdef CONFIG_PCI_ATS | |
| 1525 | −/* Address Translation Service */ | |
| 1526 | −void pci_ats_init(struct pci_dev *dev); | |
| 1527 | −int pci_enable_ats(struct pci_dev *dev, int ps); | |
| 1528 | −void pci_disable_ats(struct pci_dev *dev); | |
| 1529 | −int pci_ats_queue_depth(struct pci_dev *dev); | |
| 1530 | −int pci_ats_page_aligned(struct pci_dev *dev); | |
| 1531 | −#else | |
| 1532 | −static inline void pci_ats_init(struct pci_dev *d) { } | |
| 1533 | −static inline int pci_enable_ats(struct pci_dev *d, int ps) { return -ENODEV; } | |
| 1534 | −static inline void pci_disable_ats(struct pci_dev *d) { } | |
| 1535 | −static inline int pci_ats_queue_depth(struct pci_dev *d) { return -ENODEV; } | |
| 1536 | −static inline int pci_ats_page_aligned(struct pci_dev *dev) { return 0; } | |
| 1537 | −#endif | |
| 1538 | − | |
| 1539 | 1531 | #ifdef CONFIG_PCIE_PTM |
| 1540 | 1532 | int pci_enable_ptm(struct pci_dev *dev, u8 *granularity); |
| 1541 | 1533 | #else |
| @@ -1728,8 +1720,24 @@ static inline int pci_irqd_intx_xlate(struct irq_domain *d, · 186 unmodified lines | ||
| 1728 | 1720 | static inline const struct pci_device_id *pci_match_id(const struct pci_device_id *ids, |
| 1729 | 1721 | struct pci_dev *dev) |
| 1730 | 1722 | { return NULL; } |
| 1723 | +static inline bool pci_ats_disabled(void) { return true; } | |
| 1731 | 1724 | #endif /* CONFIG_PCI */ |
| 1732 | 1725 | |
| 1726 | +#ifdef CONFIG_PCI_ATS | |
| 1727 | +/* Address Translation Service */ | |
| 1728 | +void pci_ats_init(struct pci_dev *dev); | |
| 1729 | +int pci_enable_ats(struct pci_dev *dev, int ps); | |
| 1730 | +void pci_disable_ats(struct pci_dev *dev); | |
| 1731 | +int pci_ats_queue_depth(struct pci_dev *dev); | |
| 1732 | +int pci_ats_page_aligned(struct pci_dev *dev); | |
| 1733 | +#else | |
| 1734 | +static inline void pci_ats_init(struct pci_dev *d) { } | |
| 1735 | +static inline int pci_enable_ats(struct pci_dev *d, int ps) { return -ENODEV; } | |
| 1736 | +static inline void pci_disable_ats(struct pci_dev *d) { } | |
| 1737 | +static inline int pci_ats_queue_depth(struct pci_dev *d) { return -ENODEV; } | |
| 1738 | +static inline int pci_ats_page_aligned(struct pci_dev *dev) { return 0; } | |
| 1739 | +#endif | |
| 1740 | + | |
| 1733 | 1741 | /* Include architecture-dependent settings and functions */ |
| 1734 | 1742 | |
| 1735 | 1743 | #include <asm/pci.h> |
| @@ -2363,4 +2371,7 @@ void pci_uevent_ers(struct pci_dev *pdev, enum pci_ers_result err_type); · 627 unmodified lines | ||
| 2363 | 2371 | #define pci_info(pdev, fmt, arg...) dev_info(&(pdev)->dev, fmt, ##arg) |
| 2364 | 2372 | #define pci_dbg(pdev, fmt, arg...) dev_dbg(&(pdev)->dev, fmt, ##arg) |
| 2365 | 2373 | |
| 2374 | +#define pci_notice_ratelimited(pdev, fmt, arg...) \ | |
| 2375 | + dev_notice_ratelimited(&(pdev)->dev, fmt, ##arg) | |
| 2376 | + | |
| 2366 | 2377 | #endif /* LINUX_PCI_H */ |
| @@ -124,26 +124,72 @@ struct hpp_type2 { · 123 unmodified lines | ||
| 124 | 124 | u32 sec_unc_err_mask_or; |
| 125 | 125 | }; |
| 126 | 126 | |
| 127 | −struct hotplug_params { | |
| 128 | − struct hpp_type0 *t0; /* Type0: NULL if not available */ | |
| 129 | − struct hpp_type1 *t1; /* Type1: NULL if not available */ | |
| 130 | − struct hpp_type2 *t2; /* Type2: NULL if not available */ | |
| 131 | − struct hpp_type0 type0_data; | |
| 132 | − struct hpp_type1 type1_data; | |
| 133 | − struct hpp_type2 type2_data; | |
| 127 | +/* | |
| 128 | + * _HPX PCI Express Setting Record (Type 3) | |
| 129 | + */ | |
| 130 | +struct hpx_type3 { | |
| 131 | + u16 device_type; | |
| 132 | + u16 function_type; | |
| 133 | + u16 config_space_location; | |
| 134 | + u16 pci_exp_cap_id; | |
| 135 | + u16 pci_exp_cap_ver; | |
| 136 | + u16 pci_exp_vendor_id; | |
| 137 | + u16 dvsec_id; | |
| 138 | + u16 dvsec_rev; | |
| 139 | + u16 match_offset; | |
| 140 | + u32 match_mask_and; | |
| 141 | + u32 match_value; | |
| 142 | + u16 reg_offset; | |
| 143 | + u32 reg_mask_and; | |
| 144 | + u32 reg_mask_or; | |
| 145 | +}; | |
| 146 | + | |
| 147 | +struct hotplug_program_ops { | |
| 148 | + void (*program_type0)(struct pci_dev *dev, struct hpp_type0 *hpp); | |
| 149 | + void (*program_type1)(struct pci_dev *dev, struct hpp_type1 *hpp); | |
| 150 | + void (*program_type2)(struct pci_dev *dev, struct hpp_type2 *hpp); | |
| 151 | + void (*program_type3)(struct pci_dev *dev, struct hpx_type3 *hpp); | |
| 152 | +}; | |
| 153 | + | |
| 154 | +enum hpx_type3_dev_type { | |
| 155 | + HPX_TYPE_ENDPOINT = BIT(0), | |
| 156 | + HPX_TYPE_LEG_END = BIT(1), | |
| 157 | + HPX_TYPE_RC_END = BIT(2), | |
| 158 | + HPX_TYPE_RC_EC = BIT(3), | |
| 159 | + HPX_TYPE_ROOT_PORT = BIT(4), | |
| 160 | + HPX_TYPE_UPSTREAM = BIT(5), | |
| 161 | + HPX_TYPE_DOWNSTREAM = BIT(6), | |
| 162 | + HPX_TYPE_PCI_BRIDGE = BIT(7), | |
| 163 | + HPX_TYPE_PCIE_BRIDGE = BIT(8), | |
| 164 | +}; | |
| 165 | + | |
| 166 | +enum hpx_type3_fn_type { | |
| 167 | + HPX_FN_NORMAL = BIT(0), | |
| 168 | + HPX_FN_SRIOV_PHYS = BIT(1), | |
| 169 | + HPX_FN_SRIOV_VIRT = BIT(2), | |
| 170 | +}; | |
| 171 | + | |
| 172 | +enum hpx_type3_cfg_loc { | |
| 173 | + HPX_CFG_PCICFG = 0, | |
| 174 | + HPX_CFG_PCIE_CAP = 1, | |
| 175 | + HPX_CFG_PCIE_CAP_EXT = 2, | |
| 176 | + HPX_CFG_VEND_CAP = 3, | |
| 177 | + HPX_CFG_DVSEC = 4, | |
| 178 | + HPX_CFG_MAX, | |
| 134 | 179 | }; |
| 135 | 180 | |
| 136 | 181 | #ifdef CONFIG_ACPI |
| 137 | 182 | #include <linux/acpi.h> |
| 138 | −int pci_get_hp_params(struct pci_dev *dev, struct hotplug_params *hpp); | |
| 183 | +int pci_acpi_program_hp_params(struct pci_dev *dev, | |
| 184 | + const struct hotplug_program_ops *hp_ops); | |
| 139 | 185 | bool pciehp_is_native(struct pci_dev *bridge); |
| 140 | 186 | int acpi_get_hp_hw_control_from_firmware(struct pci_dev *bridge); |
| 141 | 187 | bool shpchp_is_native(struct pci_dev *bridge); |
| 142 | 188 | int acpi_pci_check_ejectable(struct pci_bus *pbus, acpi_handle handle); |
| 143 | 189 | int acpi_pci_detect_ejectable(acpi_handle handle); |
| 144 | 190 | #else |
| 145 | −static inline int pci_get_hp_params(struct pci_dev *dev, | |
| 146 | − struct hotplug_params *hpp) | |
| 191 | +static inline int pci_acpi_program_hp_params(struct pci_dev *dev, | |
| 192 | + const struct hotplug_program_ops *hp_ops) | |
| 147 | 193 | { |
| 148 | 194 | return -ENODEV; |
| 149 | 195 | } |
| @@ -26,16 +26,10 @@ · 25 unmodified lines | ||
| 26 | 26 | #define PCPU_MIN_ALLOC_SHIFT 2 |
| 27 | 27 | #define PCPU_MIN_ALLOC_SIZE (1 << PCPU_MIN_ALLOC_SHIFT) |
| 28 | 28 | |
| 29 | −/* number of bits per page, used to trigger a scan if blocks are > PAGE_SIZE */ | |
| 30 | −#define PCPU_BITS_PER_PAGE (PAGE_SIZE >> PCPU_MIN_ALLOC_SHIFT) | |
| 31 | − | |
| 32 | 29 | /* |
| 33 | − * This determines the size of each metadata block. There are several subtle | |
| 34 | − * constraints around this constant. The reserved region must be a multiple of | |
| 35 | − * PCPU_BITMAP_BLOCK_SIZE. Additionally, PCPU_BITMAP_BLOCK_SIZE must be a | |
| 36 | − * multiple of PAGE_SIZE or PAGE_SIZE must be a multiple of | |
| 37 | − * PCPU_BITMAP_BLOCK_SIZE to align with the populated page map. The unit_size | |
| 38 | − * also has to be a multiple of PCPU_BITMAP_BLOCK_SIZE to ensure full blocks. | |
| 30 | + * The PCPU_BITMAP_BLOCK_SIZE must be the same size as PAGE_SIZE as the | |
| 31 | + * updating of hints is used to manage the nr_empty_pop_pages in both | |
| 32 | + * the chunk and globally. | |
| 39 | 33 | */ |
| 40 | 34 | #define PCPU_BITMAP_BLOCK_SIZE PAGE_SIZE |
| 41 | 35 | #define PCPU_BITMAP_BLOCK_BITS (PCPU_BITMAP_BLOCK_SIZE >> \ |
| @@ -30,6 +30,7 @@ struct perf_guest_info_callbacks { · 29 unmodified lines | ||
| 30 | 30 | int (*is_in_guest)(void); |
| 31 | 31 | int (*is_user_mode)(void); |
| 32 | 32 | unsigned long (*get_guest_ip)(void); |
| 33 | + void (*handle_intel_pt_intr)(void); | |
| 33 | 34 | }; |
| 34 | 35 | |
| 35 | 36 | #ifdef CONFIG_HAVE_HW_BREAKPOINT |
| @@ -240,7 +241,6 @@ struct perf_event; · 204 unmodified lines | ||
| 240 | 241 | #define PERF_PMU_CAP_NO_INTERRUPT 0x01 |
| 241 | 242 | #define PERF_PMU_CAP_NO_NMI 0x02 |
| 242 | 243 | #define PERF_PMU_CAP_AUX_NO_SG 0x04 |
| 243 | −#define PERF_PMU_CAP_AUX_SW_DOUBLEBUF 0x08 | |
| 244 | 244 | #define PERF_PMU_CAP_EXCLUSIVE 0x10 |
| 245 | 245 | #define PERF_PMU_CAP_ITRACE 0x20 |
| 246 | 246 | #define PERF_PMU_CAP_HETEROGENEOUS_CPUS 0x40 |
| @@ -464,7 +464,7 @@ enum perf_addr_filter_action_t { · 217 unmodified lines | ||
| 464 | 464 | /** |
| 465 | 465 | * struct perf_addr_filter - address range filter definition |
| 466 | 466 | * @entry: event's filter list linkage |
| 467 | − * @inode: object file's inode for file-based filters | |
| 467 | + * @path: object file's path for file-based filters | |
| 468 | 468 | * @offset: filter range offset |
| 469 | 469 | * @size: filter range size (size==0 means single address trigger) |
| 470 | 470 | * @action: filter/start/stop |
| @@ -888,6 +888,9 @@ extern void perf_sched_cb_dec(struct pmu *pmu); · 417 unmodified lines | ||
| 888 | 888 | extern void perf_sched_cb_inc(struct pmu *pmu); |
| 889 | 889 | extern int perf_event_task_disable(void); |
| 890 | 890 | extern int perf_event_task_enable(void); |
| 891 | + | |
| 892 | +extern void perf_pmu_resched(struct pmu *pmu); | |
| 893 | + | |
| 891 | 894 | extern int perf_event_refresh(struct perf_event *event, int refresh); |
| 892 | 895 | extern void perf_event_update_userpage(struct perf_event *event); |
| 893 | 896 | extern int perf_event_release_kernel(struct perf_event *event); |
| @@ -1055,12 +1058,18 @@ static inline void perf_arch_fetch_caller_regs(struct pt_regs *regs, unsigned lo · 161 unmodified lines | ||
| 1055 | 1058 | #endif |
| 1056 | 1059 | |
| 1057 | 1060 | /* |
| 1058 | − * Take a snapshot of the regs. Skip ip and frame pointer to | |
| 1059 | − * the nth caller. We only need a few of the regs: | |
| 1061 | + * When generating a perf sample in-line, instead of from an interrupt / | |
| 1062 | + * exception, we lack a pt_regs. This is typically used from software events | |
| 1063 | + * like: SW_CONTEXT_SWITCHES, SW_MIGRATIONS and the tie-in with tracepoints. | |
| 1064 | + * | |
| 1065 | + * We typically don't need a full set, but (for x86) do require: | |
| 1060 | 1066 | * - ip for PERF_SAMPLE_IP |
| 1061 | 1067 | * - cs for user_mode() tests |
| 1062 | − * - bp for callchains | |
| 1063 | − * - eflags, for future purposes, just in case | |
| 1068 | + * - sp for PERF_SAMPLE_CALLCHAIN | |
| 1069 | + * - eflags for MISC bits and CALLCHAIN (see: perf_hw_regs()) | |
| 1070 | + * | |
| 1071 | + * NOTE: assumes @regs is otherwise already 0 filled; this is important for | |
| 1072 | + * things like PERF_SAMPLE_REGS_INTR. | |
| 1064 | 1073 | */ |
| 1065 | 1074 | static inline void perf_fetch_caller_regs(struct pt_regs *regs) |
| 1066 | 1075 | { |
| @@ -308,13 +308,7 @@ struct phy_device *mdiobus_scan(struct mii_bus *bus, int addr); · 307 unmodified lines | ||
| 308 | 308 | * |
| 309 | 309 | * HALTED: PHY is up, but no polling or interrupts are done. Or |
| 310 | 310 | * PHY is in an error state. |
| 311 | − * | |
| 312 | − * - phy_start moves to RESUMING | |
| 313 | − * | |
| 314 | − * RESUMING: PHY was halted, but now wants to run again. | |
| 315 | − * - If we are forcing, or aneg is done, timer moves to RUNNING | |
| 316 | − * - If aneg is not done, timer moves to AN | |
| 317 | − * - phy_stop moves to HALTED | |
| 311 | + * - phy_start moves to UP | |
| 318 | 312 | */ |
| 319 | 313 | enum phy_state { |
| 320 | 314 | PHY_DOWN = 0, |
| @@ -324,7 +318,6 @@ enum phy_state { · 3 unmodified lines | ||
| 324 | 318 | PHY_RUNNING, |
| 325 | 319 | PHY_NOLINK, |
| 326 | 320 | PHY_FORCING, |
| 327 | − PHY_RESUMING | |
| 328 | 321 | }; |
| 329 | 322 | |
| 330 | 323 | /** |
| @@ -345,6 +338,7 @@ struct phy_c45_device_ids { · 14 unmodified lines | ||
| 345 | 338 | * is_c45: Set to true if this phy uses clause 45 addressing. |
| 346 | 339 | * is_internal: Set to true if this phy is internal to a MAC. |
| 347 | 340 | * is_pseudo_fixed_link: Set to true if this phy is an Ethernet switch, etc. |
| 341 | + * is_gigabit_capable: Set to true if PHY supports 1000Mbps | |
| 348 | 342 | * has_fixups: Set to true if this phy has fixups/quirks. |
| 349 | 343 | * suspended: Set to true if this phy has been suspended successfully. |
| 350 | 344 | * sysfs_links: Internal boolean tracking sysfs symbolic links setup/removal. |
| @@ -382,6 +376,7 @@ struct phy_device { · 31 unmodified lines | ||
| 382 | 376 | unsigned is_c45:1; |
| 383 | 377 | unsigned is_internal:1; |
| 384 | 378 | unsigned is_pseudo_fixed_link:1; |
| 379 | + unsigned is_gigabit_capable:1; | |
| 385 | 380 | unsigned has_fixups:1; |
| 386 | 381 | unsigned suspended:1; |
| 387 | 382 | unsigned sysfs_links:1; |
| @@ -390,6 +385,7 @@ struct phy_device { · 2 unmodified lines | ||
| 390 | 385 | unsigned autoneg:1; |
| 391 | 386 | /* The most recently read link state */ |
| 392 | 387 | unsigned link:1; |
| 388 | + unsigned autoneg_complete:1; | |
| 393 | 389 | |
| 394 | 390 | /* Interrupts are enabled */ |
| 395 | 391 | unsigned interrupts:1; |
| @@ -1075,6 +1071,7 @@ void phy_attached_info(struct phy_device *phydev); · 679 unmodified lines | ||
| 1075 | 1071 | |
| 1076 | 1072 | /* Clause 22 PHY */ |
| 1077 | 1073 | int genphy_config_init(struct phy_device *phydev); |
| 1074 | +int genphy_read_abilities(struct phy_device *phydev); | |
| 1078 | 1075 | int genphy_setup_forced(struct phy_device *phydev); |
| 1079 | 1076 | int genphy_restart_aneg(struct phy_device *phydev); |
| 1080 | 1077 | int genphy_config_eee_advert(struct phy_device *phydev); |
| @@ -1150,6 +1147,7 @@ void phy_request_interrupt(struct phy_device *phydev); · 69 unmodified lines | ||
| 1150 | 1147 | void phy_print_status(struct phy_device *phydev); |
| 1151 | 1148 | int phy_set_max_speed(struct phy_device *phydev, u32 max_speed); |
| 1152 | 1149 | void phy_remove_link_mode(struct phy_device *phydev, u32 link_mode); |
| 1150 | +void phy_advertise_supported(struct phy_device *phydev); | |
| 1153 | 1151 | void phy_support_sym_pause(struct phy_device *phydev); |
| 1154 | 1152 | void phy_support_asym_pause(struct phy_device *phydev); |
| 1155 | 1153 | void phy_set_sym_pause(struct phy_device *phydev, bool rx, bool tx, |
| @@ -64,6 +64,7 @@ union phy_configure_opts { · 63 unmodified lines | ||
| 64 | 64 | * @set_mode: set the mode of the phy |
| 65 | 65 | * @reset: resetting the phy |
| 66 | 66 | * @calibrate: calibrate the phy |
| 67 | + * @release: ops to be performed while the consumer relinquishes the PHY | |
| 67 | 68 | * @owner: the module owner containing the ops |
| 68 | 69 | */ |
| 69 | 70 | struct phy_ops { |
| @@ -105,6 +106,7 @@ struct phy_ops { · 35 unmodified lines | ||
| 105 | 106 | union phy_configure_opts *opts); |
| 106 | 107 | int (*reset)(struct phy *phy); |
| 107 | 108 | int (*calibrate)(struct phy *phy); |
| 109 | + void (*release)(struct phy *phy); | |
| 108 | 110 | struct module *owner; |
| 109 | 111 | }; |
| 110 | 112 | |
| @@ -66,6 +66,8 @@ struct pid · 65 unmodified lines | ||
| 66 | 66 | |
| 67 | 67 | extern struct pid init_struct_pid; |
| 68 | 68 | |
| 69 | +extern const struct file_operations pidfd_fops; | |
| 70 | + | |
| 69 | 71 | static inline struct pid *get_pid(struct pid *pid) |
| 70 | 72 | { |
| 71 | 73 | if (pid) |
| @@ -176,6 +176,7 @@ void free_pipe_info(struct pipe_inode_info *); · 175 unmodified lines | ||
| 176 | 176 | bool generic_pipe_buf_get(struct pipe_inode_info *, struct pipe_buffer *); |
| 177 | 177 | int generic_pipe_buf_confirm(struct pipe_inode_info *, struct pipe_buffer *); |
| 178 | 178 | int generic_pipe_buf_steal(struct pipe_inode_info *, struct pipe_buffer *); |
| 179 | +int generic_pipe_buf_nosteal(struct pipe_inode_info *, struct pipe_buffer *); | |
| 179 | 180 | void generic_pipe_buf_release(struct pipe_inode_info *, struct pipe_buffer *); |
| 180 | 181 | void pipe_buf_mark_unmergeable(struct pipe_buffer *buf); |
| 181 | 182 | |
| @@ -4,7 +4,7 @@ · 3 unmodified lines | ||
| 4 | 4 | * Copyright (c) 2012 Savoir-faire Linux Inc. |
| 5 | 5 | * Vivien Didelot <vivien.didelot@savoirfairelinux.com> |
| 6 | 6 | * |
| 7 | − * For further information, see the Documentation/hwmon/ads7828 file. | |
| 7 | + * For further information, see the Documentation/hwmon/ads7828.rst file. | |
| 8 | 8 | * |
| 9 | 9 | * This program is free software; you can redistribute it and/or modify |
| 10 | 10 | * it under the terms of the GNU General Public License version 2 as |
| @@ -14,7 +14,7 @@ struct ds620_platform_data { · 13 unmodified lines | ||
| 14 | 14 | * 1 = PO_LOW |
| 15 | 15 | * 2 = PO_HIGH |
| 16 | 16 | * |
| 17 | − * (see Documentation/hwmon/ds620) | |
| 17 | + * (see Documentation/hwmon/ds620.rst) | |
| 18 | 18 | */ |
| 19 | 19 | int pomode; |
| 20 | 20 | }; |
| @@ -60,6 +60,6 @@ static inline int elm_config(struct device *dev, enum bch_ecc bch_type, · 59 unmodified lines | ||
| 60 | 60 | { |
| 61 | 61 | return -ENOSYS; |
| 62 | 62 | } |
| 63 | −#endif /* CONFIG_MTD_NAND_ECC_BCH */ | |
| 63 | +#endif /* CONFIG_MTD_NAND_OMAP_BCH */ | |
| 64 | 64 | |
| 65 | 65 | #endif /* __ELM_H */ |
| @@ -0,0 +1,10 @@ | ||
| 1 | +/* SPDX-License-Identifier: GPL-2.0 */ | |
| 2 | +#ifndef _LINUX_PLATFORM_DATA_ETH_EP93XX | |
| 3 | +#define _LINUX_PLATFORM_DATA_ETH_EP93XX | |
| 4 | + | |
| 5 | +struct ep93xx_eth_data { | |
| 6 | + unsigned char dev_addr[6]; | |
| 7 | + unsigned char phy_id; | |
| 8 | +}; | |
| 9 | + | |
| 10 | +#endif | |
| @@ -200,8 +200,6 @@ struct omap_gpio_platform_data { · 199 unmodified lines | ||
| 200 | 200 | bool is_mpuio; /* whether the bank is of type MPUIO */ |
| 201 | 201 | u32 non_wakeup_gpios; |
| 202 | 202 | |
| 203 | − u32 quirks; /* Version specific quirks mask */ | |
| 204 | − | |
| 205 | 203 | struct omap_gpio_reg_offs *regs; |
| 206 | 204 | |
| 207 | 205 | /* Return context loss count due to PM states changing */ |
| @@ -7,7 +7,7 @@ · 6 unmodified lines | ||
| 7 | 7 | * it under the terms of the GNU General Public License version 2 as |
| 8 | 8 | * published by the Free Software Foundation. |
| 9 | 9 | * |
| 10 | − * For further information, see the Documentation/hwmon/ina2xx file. | |
| 10 | + * For further information, see the Documentation/hwmon/ina2xx.rst file. | |
| 11 | 11 | */ |
| 12 | 12 | |
| 13 | 13 | /** |
| @@ -9,8 +9,7 @@ struct matrix_keymap_data; · 8 unmodified lines | ||
| 9 | 9 | #define EP93XX_KEYPAD_DIAG_MODE (1<<1) /* diagnostic mode */ |
| 10 | 10 | #define EP93XX_KEYPAD_BACK_DRIVE (1<<2) /* back driving mode */ |
| 11 | 11 | #define EP93XX_KEYPAD_TEST_MODE (1<<3) /* scan only column 0 */ |
| 12 | −#define EP93XX_KEYPAD_KDIV (1<<4) /* 1/4 clock or 1/16 clock */ | |
| 13 | −#define EP93XX_KEYPAD_AUTOREPEAT (1<<5) /* enable key autorepeat */ | |
| 12 | +#define EP93XX_KEYPAD_AUTOREPEAT (1<<4) /* enable key autorepeat */ | |
| 14 | 13 | |
| 15 | 14 | /** |
| 16 | 15 | * struct ep93xx_keypad_platform_data - platform specific device structure |
| @@ -24,6 +23,7 @@ struct ep93xx_keypad_platform_data { · 7 unmodified lines | ||
| 24 | 23 | unsigned int debounce; |
| 25 | 24 | unsigned int prescale; |
| 26 | 25 | unsigned int flags; |
| 26 | + unsigned int clk_rate; | |
| 27 | 27 | }; |
| 28 | 28 | |
| 29 | 29 | #define EP93XX_MATRIX_ROWS (8) |
| @@ -38,9 +38,11 @@ enum lm3630a_ledb_ctrl { · 37 unmodified lines | ||
| 38 | 38 | |
| 39 | 39 | #define LM3630A_MAX_BRIGHTNESS 255 |
| 40 | 40 | /* |
| 41 | + *@leda_label : optional led a label. | |
| 41 | 42 | *@leda_init_brt : led a init brightness. 4~255 |
| 42 | 43 | *@leda_max_brt : led a max brightness. 4~255 |
| 43 | 44 | *@leda_ctrl : led a disable, enable linear, enable exponential |
| 45 | + *@ledb_label : optional led b label. | |
| 44 | 46 | *@ledb_init_brt : led b init brightness. 4~255 |
| 45 | 47 | *@ledb_max_brt : led b max brightness. 4~255 |
| 46 | 48 | *@ledb_ctrl : led b disable, enable linear, enable exponential |
| @@ -50,10 +52,12 @@ enum lm3630a_ledb_ctrl { · 3 unmodified lines | ||
| 50 | 52 | struct lm3630a_platform_data { |
| 51 | 53 | |
| 52 | 54 | /* led a config. */ |
| 55 | + const char *leda_label; | |
| 53 | 56 | int leda_init_brt; |
| 54 | 57 | int leda_max_brt; |
| 55 | 58 | enum lm3630a_leda_ctrl leda_ctrl; |
| 56 | 59 | /* led b config. */ |
| 60 | + const char *ledb_label; | |
| 57 | 61 | int ledb_init_brt; |
| 58 | 62 | int ledb_max_brt; |
| 59 | 63 | enum lm3630a_ledb_ctrl ledb_ctrl; |
| @@ -12,19 +12,10 @@ · 11 unmodified lines | ||
| 12 | 12 | |
| 13 | 13 | /** |
| 14 | 14 | * struct macb_platform_data - platform data for MACB Ethernet |
| 15 | − * @phy_mask: phy mask passed when register the MDIO bus | |
| 16 | − * within the driver | |
| 17 | − * @phy_irq_pin: PHY IRQ | |
| 18 | − * @is_rmii: using RMII interface? | |
| 19 | − * @rev_eth_addr: reverse Ethernet address byte order | |
| 20 | 15 | * @pclk: platform clock |
| 21 | 16 | * @hclk: AHB clock |
| 22 | 17 | */ |
| 23 | 18 | struct macb_platform_data { |
| 24 | − u32 phy_mask; | |
| 25 | − int phy_irq_pin; | |
| 26 | − u8 is_rmii; | |
| 27 | − u8 rev_eth_addr; | |
| 28 | 19 | struct clk *pclk; |
| 29 | 20 | struct clk *hclk; |
| 30 | 21 | }; |
| @@ -8,7 +8,7 @@ · 7 unmodified lines | ||
| 8 | 8 | * it under the terms of the GNU General Public License version 2 as |
| 9 | 9 | * published by the Free Software Foundation. |
| 10 | 10 | * |
| 11 | − * For further information, see the Documentation/hwmon/max197 file. | |
| 11 | + * For further information, see the Documentation/hwmon/max197.rst file. | |
| 12 | 12 | */ |
| 13 | 13 | |
| 14 | 14 | #ifndef _PDATA_MAX197_H |
| @@ -13,6 +13,7 @@ struct dsa_mv88e6xxx_pdata { · 12 unmodified lines | ||
| 13 | 13 | unsigned int enabled_ports; |
| 14 | 14 | struct net_device *netdev; |
| 15 | 15 | u32 eeprom_len; |
| 16 | + int irq; | |
| 16 | 17 | }; |
| 17 | 18 | |
| 18 | 19 | #endif |
| @@ -42,7 +42,7 @@ struct ntc_thermistor_platform_data { · 41 unmodified lines | ||
| 42 | 42 | * read_uV() |
| 43 | 43 | * |
| 44 | 44 | * How to setup pullup_ohm, pulldown_ohm, and connect is |
| 45 | − * described at Documentation/hwmon/ntc_thermistor | |
| 45 | + * described at Documentation/hwmon/ntc_thermistor.rst | |
| 46 | 46 | * |
| 47 | 47 | * pullup/down_ohm: 0 for infinite / not-connected |
| 48 | 48 | * |
| @@ -1,48 +0,0 @@ | ||
| 1 | −/* | |
| 2 | − * | |
| 3 | − * pca954x.h - I2C multiplexer/switch support | |
| 4 | − * | |
| 5 | − * Copyright (c) 2008-2009 Rodolfo Giometti <giometti@linux.it> | |
| 6 | − * Copyright (c) 2008-2009 Eurotech S.p.A. <info@eurotech.it> | |
| 7 | − * Michael Lawnick <michael.lawnick.ext@nsn.com> | |
| 8 | − * | |
| 9 | − * This program is free software; you can redistribute it and/or modify | |
| 10 | − * it under the terms of the GNU General Public License as published by | |
| 11 | − * the Free Software Foundation; either version 2 of the License, or | |
| 12 | − * (at your option) any later version. | |
| 13 | − * | |
| 14 | − * This program is distributed in the hope that it will be useful, | |
| 15 | − * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 16 | − * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
| 17 | − * GNU General Public License for more details. | |
| 18 | − * | |
| 19 | − * You should have received a copy of the GNU General Public License | |
| 20 | − * along with this program; if not, write to the Free Software | |
| 21 | − * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | |
| 22 | − */ | |
| 23 | − | |
| 24 | − | |
| 25 | −#ifndef _LINUX_I2C_PCA954X_H | |
| 26 | −#define _LINUX_I2C_PCA954X_H | |
| 27 | − | |
| 28 | −/* Platform data for the PCA954x I2C multiplexers */ | |
| 29 | − | |
| 30 | −/* Per channel initialisation data: | |
| 31 | − * @adap_id: bus number for the adapter. 0 = don't care | |
| 32 | − * @deselect_on_exit: set this entry to 1, if your H/W needs deselection | |
| 33 | − * of this channel after transaction. | |
| 34 | − * | |
| 35 | − */ | |
| 36 | −struct pca954x_platform_mode { | |
| 37 | − int adap_id; | |
| 38 | − unsigned int deselect_on_exit:1; | |
| 39 | − unsigned int class; | |
| 40 | −}; | |
| 41 | − | |
| 42 | −/* Per mux/switch data, used with i2c_register_board_info */ | |
| 43 | −struct pca954x_platform_data { | |
| 44 | − struct pca954x_platform_mode *modes; | |
| 45 | − int num_modes; | |
| 46 | −}; | |
| 47 | − | |
| 48 | −#endif /* _LINUX_I2C_PCA954X_H */ | |
| @@ -51,6 +51,11 @@ struct am33xx_pm_platform_data { · 50 unmodified lines | ||
| 51 | 51 | unsigned long args); |
| 52 | 52 | struct am33xx_pm_sram_addr *(*get_sram_addrs)(void); |
| 53 | 53 | void __iomem *(*get_rtc_base_addr)(void); |
| 54 | + void (*save_context)(void); | |
| 55 | + void (*restore_context)(void); | |
| 56 | + void (*prepare_rtc_suspend)(void); | |
| 57 | + void (*prepare_rtc_resume)(void); | |
| 58 | + int (*check_off_mode_enable)(void); | |
| 54 | 59 | }; |
| 55 | 60 | |
| 56 | 61 | struct am33xx_pm_sram_data { |
| @@ -6,13 +6,9 @@ struct spi_device; · 5 unmodified lines | ||
| 6 | 6 | |
| 7 | 7 | /** |
| 8 | 8 | * struct ep93xx_spi_info - EP93xx specific SPI descriptor |
| 9 | − * @chipselect: array of gpio numbers to use as chip selects | |
| 10 | − * @num_chipselect: ARRAY_SIZE(chipselect) | |
| 11 | 9 | * @use_dma: use DMA for the transfers |
| 12 | 10 | */ |
| 13 | 11 | struct ep93xx_spi_info { |
| 14 | − int *chipselect; | |
| 15 | − int num_chipselect; | |
| 16 | 12 | bool use_dma; |
| 17 | 13 | }; |
| 18 | 14 | |
| @@ -46,8 +46,13 @@ struct sysc_regbits { · 45 unmodified lines | ||
| 46 | 46 | s8 emufree_shift; |
| 47 | 47 | }; |
| 48 | 48 | |
| 49 | −#define SYSC_QUIRK_LEGACY_IDLE BIT(8) | |
| 50 | −#define SYSC_QUIRK_RESET_STATUS BIT(7) | |
| 49 | +#define SYSC_QUIRK_SWSUP_MSTANDBY BIT(13) | |
| 50 | +#define SYSC_QUIRK_SWSUP_SIDLE_ACT BIT(12) | |
| 51 | +#define SYSC_QUIRK_SWSUP_SIDLE BIT(11) | |
| 52 | +#define SYSC_QUIRK_EXT_OPT_CLOCK BIT(10) | |
| 53 | +#define SYSC_QUIRK_LEGACY_IDLE BIT(9) | |
| 54 | +#define SYSC_QUIRK_RESET_STATUS BIT(8) | |
| 55 | +#define SYSC_QUIRK_NO_IDLE BIT(7) | |
| 51 | 56 | #define SYSC_QUIRK_NO_IDLE_ON_INIT BIT(6) |
| 52 | 57 | #define SYSC_QUIRK_NO_RESET_ON_INIT BIT(5) |
| 53 | 58 | #define SYSC_QUIRK_OPT_CLKS_NEEDED BIT(4) |
| @@ -0,0 +1,11 @@ | ||
| 1 | +/* SPDX-License-Identifier: GPL-2.0 */ | |
| 2 | +#ifndef __TIMER_IXP4XX_H | |
| 3 | +#define __TIMER_IXP4XX_H | |
| 4 | + | |
| 5 | +#include <linux/ioport.h> | |
| 6 | + | |
| 7 | +void __init ixp4xx_timer_setup(resource_size_t timerbase, | |
| 8 | + int timer_irq, | |
| 9 | + unsigned int timer_freq); | |
| 10 | + | |
| 11 | +#endif | |
| @@ -14,10 +14,6 @@ · 13 unmodified lines | ||
| 14 | 14 | /* Message flags for using the mailbox() interface */ |
| 15 | 15 | #define WILCO_EC_FLAG_NO_RESPONSE BIT(0) /* EC does not respond */ |
| 16 | 16 | #define WILCO_EC_FLAG_EXTENDED_DATA BIT(1) /* EC returns 256 data bytes */ |
| 17 | −#define WILCO_EC_FLAG_RAW_REQUEST BIT(2) /* Do not trim request data */ | |
| 18 | −#define WILCO_EC_FLAG_RAW_RESPONSE BIT(3) /* Do not trim response data */ | |
| 19 | −#define WILCO_EC_FLAG_RAW (WILCO_EC_FLAG_RAW_REQUEST | \ | |
| 20 | − WILCO_EC_FLAG_RAW_RESPONSE) | |
| 21 | 17 | |
| 22 | 18 | /* Normal commands have a maximum 32 bytes of data */ |
| 23 | 19 | #define EC_MAILBOX_DATA_SIZE 32 |
| @@ -56,10 +52,7 @@ struct wilco_ec_device { · 32 unmodified lines | ||
| 56 | 52 | * @mailbox_id: Mailbox identifier, specifies the command set. |
| 57 | 53 | * @mailbox_version: Mailbox interface version %EC_MAILBOX_VERSION |
| 58 | 54 | * @reserved: Set to zero. |
| 59 | − * @data_size: Length of request, data + last 2 bytes of the header. | |
| 60 | − * @command: Mailbox command code, unique for each mailbox_id set. | |
| 61 | − * @reserved_raw: Set to zero for most commands, but is used by | |
| 62 | − * some command types and for raw commands. | |
| 55 | + * @data_size: Length of following data. | |
| 63 | 56 | */ |
| 64 | 57 | struct wilco_ec_request { |
| 65 | 58 | u8 struct_version; |
| @@ -68,8 +61,6 @@ struct wilco_ec_request { · 2 unmodified lines | ||
| 68 | 61 | u8 mailbox_version; |
| 69 | 62 | u8 reserved; |
| 70 | 63 | u16 data_size; |
| 71 | − u8 command; | |
| 72 | − u8 reserved_raw; | |
| 73 | 64 | } __packed; |
| 74 | 65 | |
| 75 | 66 | /** |
| @@ -79,8 +70,6 @@ struct wilco_ec_request { · 3 unmodified lines | ||
| 79 | 70 | * @result: Result code from the EC. Non-zero indicates an error. |
| 80 | 71 | * @data_size: Length of the response data buffer. |
| 81 | 72 | * @reserved: Set to zero. |
| 82 | − * @mbox0: EC returned data at offset 0 is unused (always 0) so this byte | |
| 83 | − * is treated as part of the header instead of the data. | |
| 84 | 73 | * @data: Response data buffer. Max size is %EC_MAILBOX_DATA_SIZE_EXTENDED. |
| 85 | 74 | */ |
| 86 | 75 | struct wilco_ec_response { |
| @@ -89,7 +78,6 @@ struct wilco_ec_response { · 2 unmodified lines | ||
| 89 | 78 | u16 result; |
| 90 | 79 | u16 data_size; |
| 91 | 80 | u8 reserved[2]; |
| 92 | − u8 mbox0; | |
| 93 | 81 | u8 data[0]; |
| 94 | 82 | } __packed; |
| 95 | 83 | |
| @@ -111,21 +99,15 @@ enum wilco_ec_msg_type { · 15 unmodified lines | ||
| 111 | 99 | * struct wilco_ec_message - Request and response message. |
| 112 | 100 | * @type: Mailbox message type. |
| 113 | 101 | * @flags: Message flags, e.g. %WILCO_EC_FLAG_NO_RESPONSE. |
| 114 | − * @command: Mailbox command code. | |
| 115 | − * @result: Result code from the EC. Non-zero indicates an error. | |
| 116 | 102 | * @request_size: Number of bytes to send to the EC. |
| 117 | 103 | * @request_data: Buffer containing the request data. |
| 118 | − * @response_size: Number of bytes expected from the EC. | |
| 119 | − * This is 32 by default and 256 if the flag | |
| 120 | − * is set for %WILCO_EC_FLAG_EXTENDED_DATA | |
| 104 | + * @response_size: Number of bytes to read from EC. | |
| 121 | 105 | * @response_data: Buffer containing the response data, should be |
| 122 | 106 | * response_size bytes and allocated by caller. |
| 123 | 107 | */ |
| 124 | 108 | struct wilco_ec_message { |
| 125 | 109 | enum wilco_ec_msg_type type; |
| 126 | 110 | u8 flags; |
| 127 | − u8 command; | |
| 128 | − u8 result; | |
| 129 | 111 | size_t request_size; |
| 130 | 112 | void *request_data; |
| 131 | 113 | size_t response_size; |
| @@ -67,6 +67,7 @@ · 66 unmodified lines | ||
| 67 | 67 | /* Input */ |
| 68 | 68 | #define ASUS_WMI_DEVID_TOUCHPAD 0x00100011 |
| 69 | 69 | #define ASUS_WMI_DEVID_TOUCHPAD_LED 0x00100012 |
| 70 | +#define ASUS_WMI_DEVID_FNLOCK 0x00100023 | |
| 70 | 71 | |
| 71 | 72 | /* Fan, Thermal */ |
| 72 | 73 | #define ASUS_WMI_DEVID_THERMAL_CTRL 0x00110011 |
| @@ -0,0 +1,32 @@ | ||
| 1 | +/* SPDX-License-Identifier: GPL-2.0 */ | |
| 2 | +#ifndef __LINUX_XILINX_LL_TEMAC_H | |
| 3 | +#define __LINUX_XILINX_LL_TEMAC_H | |
| 4 | + | |
| 5 | +#include <linux/if_ether.h> | |
| 6 | +#include <linux/phy.h> | |
| 7 | + | |
| 8 | +struct ll_temac_platform_data { | |
| 9 | + bool txcsum; /* Enable/disable TX checksum */ | |
| 10 | + bool rxcsum; /* Enable/disable RX checksum */ | |
| 11 | + u8 mac_addr[ETH_ALEN]; /* MAC address (6 bytes) */ | |
| 12 | + /* Clock frequency for input to MDIO clock generator */ | |
| 13 | + u32 mdio_clk_freq; | |
| 14 | + unsigned long long mdio_bus_id; /* Unique id for MDIO bus */ | |
| 15 | + int phy_addr; /* Address of the PHY to connect to */ | |
| 16 | + phy_interface_t phy_interface; /* PHY interface mode */ | |
| 17 | + bool reg_little_endian; /* Little endian TEMAC register access */ | |
| 18 | + bool dma_little_endian; /* Little endian DMA register access */ | |
| 19 | + /* Pre-initialized mutex to use for synchronizing indirect | |
| 20 | + * register access. When using both interfaces of a single | |
| 21 | + * TEMAC IP block, the same mutex should be passed here, as | |
| 22 | + * they share the same DCR bus bridge. | |
| 23 | + */ | |
| 24 | + struct mutex *indirect_mutex; | |
| 25 | + /* DMA channel control setup */ | |
| 26 | + u8 tx_irq_timeout; /* TX Interrupt Delay Time-out */ | |
| 27 | + u8 tx_irq_count; /* TX Interrupt Coalescing Threshold Count */ | |
| 28 | + u8 rx_irq_timeout; /* RX Interrupt Delay Time-out */ | |
| 29 | + u8 rx_irq_count; /* RX Interrupt Coalescing Threshold Count */ | |
| 30 | +}; | |
| 31 | + | |
| 32 | +#endif /* __LINUX_XILINX_LL_TEMAC_H */ | |
| @@ -0,0 +1,22 @@ | ||
| 1 | +/* SPDX-License-Identifier: GPL-2.0 */ | |
| 2 | +/* | |
| 3 | + * SGI PCI Xtalk Bridge | |
| 4 | + */ | |
| 5 | + | |
| 6 | +#ifndef PLATFORM_DATA_XTALK_BRIDGE_H | |
| 7 | +#define PLATFORM_DATA_XTALK_BRIDGE_H | |
| 8 | + | |
| 9 | +#include <asm/sn/types.h> | |
| 10 | + | |
| 11 | +struct xtalk_bridge_platform_data { | |
| 12 | + struct resource mem; | |
| 13 | + struct resource io; | |
| 14 | + unsigned long bridge_addr; | |
| 15 | + unsigned long intr_addr; | |
| 16 | + unsigned long mem_offset; | |
| 17 | + unsigned long io_offset; | |
| 18 | + nasid_t nasid; | |
| 19 | + int masterwid; | |
| 20 | +}; | |
| 21 | + | |
| 22 | +#endif /* PLATFORM_DATA_XTALK_BRIDGE_H */ | |
| @@ -231,7 +231,7 @@ static inline int plist_node_empty(const struct plist_node *node) · 230 unmodified lines | ||
| 231 | 231 | * @type: the type of the struct this is embedded in |
| 232 | 232 | * @member: the name of the list_head within the struct |
| 233 | 233 | */ |
| 234 | −#ifdef CONFIG_DEBUG_PI_LIST | |
| 234 | +#ifdef CONFIG_DEBUG_PLIST | |
| 235 | 235 | # define plist_first_entry(head, type, member) \ |
| 236 | 236 | ({ \ |
| 237 | 237 | WARN_ON(plist_head_empty(head)); \ |
| @@ -248,7 +248,7 @@ static inline int plist_node_empty(const struct plist_node *node) · 10 unmodified lines | ||
| 248 | 248 | * @type: the type of the struct this is embedded in |
| 249 | 249 | * @member: the name of the list_head within the struct |
| 250 | 250 | */ |
| 251 | −#ifdef CONFIG_DEBUG_PI_LIST | |
| 251 | +#ifdef CONFIG_DEBUG_PLIST | |
| 252 | 252 | # define plist_last_entry(head, type, member) \ |
| 253 | 253 | ({ \ |
| 254 | 254 | WARN_ON(plist_head_empty(head)); \ |
| @@ -16,6 +16,7 @@ · 15 unmodified lines | ||
| 16 | 16 | #include <linux/of.h> |
| 17 | 17 | #include <linux/notifier.h> |
| 18 | 18 | #include <linux/spinlock.h> |
| 19 | +#include <linux/cpumask.h> | |
| 19 | 20 | |
| 20 | 21 | /* |
| 21 | 22 | * Flags to control the behaviour of a genpd. |
| @@ -42,11 +43,26 @@ · 20 unmodified lines | ||
| 42 | 43 | * GENPD_FLAG_ACTIVE_WAKEUP: Instructs genpd to keep the PM domain powered |
| 43 | 44 | * on, in case any of its attached devices is used |
| 44 | 45 | * in the wakeup path to serve system wakeups. |
| 46 | + * | |
| 47 | + * GENPD_FLAG_CPU_DOMAIN: Instructs genpd that it should expect to get | |
| 48 | + * devices attached, which may belong to CPUs or | |
| 49 | + * possibly have subdomains with CPUs attached. | |
| 50 | + * This flag enables the genpd backend driver to | |
| 51 | + * deploy idle power management support for CPUs | |
| 52 | + * and groups of CPUs. Note that, the backend | |
| 53 | + * driver must then comply with the so called, | |
| 54 | + * last-man-standing algorithm, for the CPUs in the | |
| 55 | + * PM domain. | |
| 56 | + * | |
| 57 | + * GENPD_FLAG_RPM_ALWAYS_ON: Instructs genpd to always keep the PM domain | |
| 58 | + * powered on except for system suspend. | |
| 45 | 59 | */ |
| 46 | 60 | #define GENPD_FLAG_PM_CLK (1U << 0) |
| 47 | 61 | #define GENPD_FLAG_IRQ_SAFE (1U << 1) |
| 48 | 62 | #define GENPD_FLAG_ALWAYS_ON (1U << 2) |
| 49 | 63 | #define GENPD_FLAG_ACTIVE_WAKEUP (1U << 3) |
| 64 | +#define GENPD_FLAG_CPU_DOMAIN (1U << 4) | |
| 65 | +#define GENPD_FLAG_RPM_ALWAYS_ON (1U << 5) | |
| 50 | 66 | |
| 51 | 67 | enum gpd_status { |
| 52 | 68 | GPD_STATE_ACTIVE = 0, /* PM domain is active */ |
| @@ -69,6 +85,7 @@ struct genpd_power_state { · 16 unmodified lines | ||
| 69 | 85 | s64 residency_ns; |
| 70 | 86 | struct fwnode_handle *fwnode; |
| 71 | 87 | ktime_t idle_time; |
| 88 | + void *data; | |
| 72 | 89 | }; |
| 73 | 90 | |
| 74 | 91 | struct genpd_lock_ops; |
| @@ -93,6 +110,7 @@ struct generic_pm_domain { · 18 unmodified lines | ||
| 93 | 110 | unsigned int suspended_count; /* System suspend device counter */ |
| 94 | 111 | unsigned int prepared_count; /* Suspend counter of prepared devices */ |
| 95 | 112 | unsigned int performance_state; /* Aggregated max performance state */ |
| 113 | + cpumask_var_t cpus; /* A cpumask of the attached CPUs */ | |
| 96 | 114 | int (*power_off)(struct generic_pm_domain *domain); |
| 97 | 115 | int (*power_on)(struct generic_pm_domain *domain); |
| 98 | 116 | struct opp_table *opp_table; /* OPP table of the genpd */ |
| @@ -104,15 +122,17 @@ struct generic_pm_domain { · 5 unmodified lines | ||
| 104 | 122 | s64 max_off_time_ns; /* Maximum allowed "suspended" time. */ |
| 105 | 123 | bool max_off_time_changed; |
| 106 | 124 | bool cached_power_down_ok; |
| 125 | + bool cached_power_down_state_idx; | |
| 107 | 126 | int (*attach_dev)(struct generic_pm_domain *domain, |
| 108 | 127 | struct device *dev); |
| 109 | 128 | void (*detach_dev)(struct generic_pm_domain *domain, |
| 110 | 129 | struct device *dev); |
| 111 | 130 | unsigned int flags; /* Bit field of configs for genpd */ |
| 112 | 131 | struct genpd_power_state *states; |
| 132 | + void (*free_states)(struct genpd_power_state *states, | |
| 133 | + unsigned int state_count); | |
| 113 | 134 | unsigned int state_count; /* number of states */ |
| 114 | 135 | unsigned int state_idx; /* state that genpd will go to when off */ |
| 115 | − void *free; /* Free the state that was allocated for default */ | |
| 116 | 136 | ktime_t on_time; |
| 117 | 137 | ktime_t accounting_time; |
| 118 | 138 | const struct genpd_lock_ops *lock_ops; |
| @@ -159,6 +179,7 @@ struct generic_pm_domain_data { · 40 unmodified lines | ||
| 159 | 179 | struct pm_domain_data base; |
| 160 | 180 | struct gpd_timing_data td; |
| 161 | 181 | struct notifier_block nb; |
| 182 | + int cpu; | |
| 162 | 183 | unsigned int performance_state; |
| 163 | 184 | void *data; |
| 164 | 185 | }; |
| @@ -187,6 +208,9 @@ int dev_pm_genpd_set_performance_state(struct device *dev, unsigned int state); · 22 unmodified lines | ||
| 187 | 208 | |
| 188 | 209 | extern struct dev_power_governor simple_qos_governor; |
| 189 | 210 | extern struct dev_power_governor pm_domain_always_on_gov; |
| 211 | +#ifdef CONFIG_CPU_IDLE | |
| 212 | +extern struct dev_power_governor pm_domain_cpu_gov; | |
| 213 | +#endif | |
| 190 | 214 | #else |
| 191 | 215 | |
| 192 | 216 | static inline struct generic_pm_domain_data *dev_gpd_data(struct device *dev) |
| @@ -102,6 +102,8 @@ struct dev_pm_opp *dev_pm_opp_find_freq_exact(struct device *dev, · 101 unmodified lines | ||
| 102 | 102 | |
| 103 | 103 | struct dev_pm_opp *dev_pm_opp_find_freq_floor(struct device *dev, |
| 104 | 104 | unsigned long *freq); |
| 105 | +struct dev_pm_opp *dev_pm_opp_find_freq_ceil_by_volt(struct device *dev, | |
| 106 | + unsigned long u_volt); | |
| 105 | 107 | |
| 106 | 108 | struct dev_pm_opp *dev_pm_opp_find_freq_ceil(struct device *dev, |
| 107 | 109 | unsigned long *freq); |
| @@ -207,6 +209,12 @@ static inline struct dev_pm_opp *dev_pm_opp_find_freq_floor(struct device *dev, · 99 unmodified lines | ||
| 207 | 209 | return ERR_PTR(-ENOTSUPP); |
| 208 | 210 | } |
| 209 | 211 | |
| 212 | +static inline struct dev_pm_opp *dev_pm_opp_find_freq_ceil_by_volt(struct device *dev, | |
| 213 | + unsigned long u_volt) | |
| 214 | +{ | |
| 215 | + return ERR_PTR(-ENOTSUPP); | |
| 216 | +} | |
| 217 | + | |
| 210 | 218 | static inline struct dev_pm_opp *dev_pm_opp_find_freq_ceil(struct device *dev, |
| 211 | 219 | unsigned long *freq) |
| 212 | 220 | { |
| @@ -16,7 +16,11 @@ · 15 unmodified lines | ||
| 16 | 16 | extern struct ctl_table epoll_table[]; /* for sysctl */ |
| 17 | 17 | /* ~832 bytes of stack space used max in sys_select/sys_poll before allocating |
| 18 | 18 | additional memory. */ |
| 19 | +#ifdef __clang__ | |
| 20 | +#define MAX_STACK_ALLOC 768 | |
| 21 | +#else | |
| 19 | 22 | #define MAX_STACK_ALLOC 832 |
| 23 | +#endif | |
| 20 | 24 | #define FRONTEND_STACK_ALLOC 256 |
| 21 | 25 | #define SELECT_STACK_ALLOC FRONTEND_STACK_ALLOC |
| 22 | 26 | #define POLL_STACK_ALLOC FRONTEND_STACK_ALLOC |
| @@ -40,11 +40,15 @@ enum { · 39 unmodified lines | ||
| 40 | 40 | POWER_SUPPLY_STATUS_FULL, |
| 41 | 41 | }; |
| 42 | 42 | |
| 43 | +/* What algorithm is the charger using? */ | |
| 43 | 44 | enum { |
| 44 | 45 | POWER_SUPPLY_CHARGE_TYPE_UNKNOWN = 0, |
| 45 | 46 | POWER_SUPPLY_CHARGE_TYPE_NONE, |
| 46 | − POWER_SUPPLY_CHARGE_TYPE_TRICKLE, | |
| 47 | − POWER_SUPPLY_CHARGE_TYPE_FAST, | |
| 47 | + POWER_SUPPLY_CHARGE_TYPE_TRICKLE, /* slow speed */ | |
| 48 | + POWER_SUPPLY_CHARGE_TYPE_FAST, /* fast speed */ | |
| 49 | + POWER_SUPPLY_CHARGE_TYPE_STANDARD, /* normal speed */ | |
| 50 | + POWER_SUPPLY_CHARGE_TYPE_ADAPTIVE, /* dynamically adjusted speed */ | |
| 51 | + POWER_SUPPLY_CHARGE_TYPE_CUSTOM, /* use CHARGE_CONTROL_* props */ | |
| 48 | 52 | }; |
| 49 | 53 | |
| 50 | 54 | enum { |
| @@ -57,6 +61,7 @@ enum { · 6 unmodified lines | ||
| 57 | 61 | POWER_SUPPLY_HEALTH_COLD, |
| 58 | 62 | POWER_SUPPLY_HEALTH_WATCHDOG_TIMER_EXPIRE, |
| 59 | 63 | POWER_SUPPLY_HEALTH_SAFETY_TIMER_EXPIRE, |
| 64 | + POWER_SUPPLY_HEALTH_OVERCURRENT, | |
| 60 | 65 | }; |
| 61 | 66 | |
| 62 | 67 | enum { |
| @@ -121,6 +126,8 @@ enum power_supply_property { · 58 unmodified lines | ||
| 121 | 126 | POWER_SUPPLY_PROP_CONSTANT_CHARGE_VOLTAGE_MAX, |
| 122 | 127 | POWER_SUPPLY_PROP_CHARGE_CONTROL_LIMIT, |
| 123 | 128 | POWER_SUPPLY_PROP_CHARGE_CONTROL_LIMIT_MAX, |
| 129 | + POWER_SUPPLY_PROP_CHARGE_CONTROL_START_THRESHOLD, /* in percents! */ | |
| 130 | + POWER_SUPPLY_PROP_CHARGE_CONTROL_END_THRESHOLD, /* in percents! */ | |
| 124 | 131 | POWER_SUPPLY_PROP_INPUT_CURRENT_LIMIT, |
| 125 | 132 | POWER_SUPPLY_PROP_ENERGY_FULL_DESIGN, |
| 126 | 133 | POWER_SUPPLY_PROP_ENERGY_EMPTY_DESIGN, |
| @@ -23,10 +23,11 @@ · 22 unmodified lines | ||
| 23 | 23 | #define _PPS_GPIO_H |
| 24 | 24 | |
| 25 | 25 | struct pps_gpio_platform_data { |
| 26 | + struct gpio_desc *gpio_pin; | |
| 27 | + struct gpio_desc *echo_pin; | |
| 26 | 28 | bool assert_falling_edge; |
| 27 | 29 | bool capture_clear; |
| 28 | − unsigned int gpio_pin; | |
| 29 | − const char *gpio_label; | |
| 30 | + unsigned int echo_active_ms; | |
| 30 | 31 | }; |
| 31 | 32 | |
| 32 | 33 | #endif /* _PPS_GPIO_H */ |
| @@ -82,6 +82,8 @@ static inline void console_verbose(void) · 81 unmodified lines | ||
| 82 | 82 | extern char devkmsg_log_str[]; |
| 83 | 83 | struct ctl_table; |
| 84 | 84 | |
| 85 | +extern int suppress_printk; | |
| 86 | + | |
| 85 | 87 | struct va_format { |
| 86 | 88 | const char *fmt; |
| 87 | 89 | va_list *va; |
| @@ -347,7 +349,7 @@ extern int kptr_restrict; · 259 unmodified lines | ||
| 347 | 349 | #ifdef CONFIG_PRINTK |
| 348 | 350 | #define printk_once(fmt, ...) \ |
| 349 | 351 | ({ \ |
| 350 | − static bool __print_once __read_mostly; \ | |
| 352 | + static bool __section(.data.once) __print_once; \ | |
| 351 | 353 | bool __ret_print_once = !__print_once; \ |
| 352 | 354 | \ |
| 353 | 355 | if (!__print_once) { \ |
| @@ -358,7 +360,7 @@ extern int kptr_restrict; · 4 unmodified lines | ||
| 358 | 360 | }) |
| 359 | 361 | #define printk_deferred_once(fmt, ...) \ |
| 360 | 362 | ({ \ |
| 361 | − static bool __print_once __read_mostly; \ | |
| 363 | + static bool __section(.data.once) __print_once; \ | |
| 362 | 364 | bool __ret_print_once = !__print_once; \ |
| 363 | 365 | \ |
| 364 | 366 | if (!__print_once) { \ |
| @@ -13,6 +13,7 @@ · 12 unmodified lines | ||
| 13 | 13 | #ifndef _LINUX_PROPERTY_H_ |
| 14 | 14 | #define _LINUX_PROPERTY_H_ |
| 15 | 15 | |
| 16 | +#include <linux/bits.h> | |
| 16 | 17 | #include <linux/fwnode.h> |
| 17 | 18 | #include <linux/types.h> |
| 18 | 19 | |
| @@ -304,6 +305,23 @@ struct fwnode_handle * · 285 unmodified lines | ||
| 304 | 305 | fwnode_graph_get_remote_node(const struct fwnode_handle *fwnode, u32 port, |
| 305 | 306 | u32 endpoint); |
| 306 | 307 | |
| 308 | +/* | |
| 309 | + * Fwnode lookup flags | |
| 310 | + * | |
| 311 | + * @FWNODE_GRAPH_ENDPOINT_NEXT: In the case of no exact match, look for the | |
| 312 | + * closest endpoint ID greater than the specified | |
| 313 | + * one. | |
| 314 | + * @FWNODE_GRAPH_DEVICE_DISABLED: That the device to which the remote | |
| 315 | + * endpoint of the given endpoint belongs to, | |
| 316 | + * may be disabled. | |
| 317 | + */ | |
| 318 | +#define FWNODE_GRAPH_ENDPOINT_NEXT BIT(0) | |
| 319 | +#define FWNODE_GRAPH_DEVICE_DISABLED BIT(1) | |
| 320 | + | |
| 321 | +struct fwnode_handle * | |
| 322 | +fwnode_graph_get_endpoint_by_id(const struct fwnode_handle *fwnode, | |
| 323 | + u32 port, u32 endpoint, unsigned long flags); | |
| 324 | + | |
| 307 | 325 | #define fwnode_graph_for_each_endpoint(fwnode, child) \ |
| 308 | 326 | for (child = NULL; \ |
| 309 | 327 | (child = fwnode_graph_get_next_endpoint(fwnode, child)); ) |
| @@ -4,6 +4,7 @@ · 3 unmodified lines | ||
| 4 | 4 | #include <linux/jump_label.h> |
| 5 | 5 | #include <linux/psi_types.h> |
| 6 | 6 | #include <linux/sched.h> |
| 7 | +#include <linux/poll.h> | |
| 7 | 8 | |
| 8 | 9 | struct seq_file; |
| 9 | 10 | struct css_set; |
| @@ -11,6 +12,7 @@ struct css_set; · 1 unmodified line | ||
| 11 | 12 | #ifdef CONFIG_PSI |
| 12 | 13 | |
| 13 | 14 | extern struct static_key_false psi_disabled; |
| 15 | +extern struct psi_group psi_system; | |
| 14 | 16 | |
| 15 | 17 | void psi_init(void); |
| 16 | 18 | |
| @@ -26,6 +28,13 @@ int psi_show(struct seq_file *s, struct psi_group *group, enum psi_res res); · 9 unmodified lines | ||
| 26 | 28 | int psi_cgroup_alloc(struct cgroup *cgrp); |
| 27 | 29 | void psi_cgroup_free(struct cgroup *cgrp); |
| 28 | 30 | void cgroup_move_task(struct task_struct *p, struct css_set *to); |
| 31 | + | |
| 32 | +struct psi_trigger *psi_trigger_create(struct psi_group *group, | |
| 33 | + char *buf, size_t nbytes, enum psi_res res); | |
| 34 | +void psi_trigger_replace(void **trigger_ptr, struct psi_trigger *t); | |
| 35 | + | |
| 36 | +__poll_t psi_trigger_poll(void **trigger_ptr, struct file *file, | |
| 37 | + poll_table *wait); | |
| 29 | 38 | #endif |
| 30 | 39 | |
| 31 | 40 | #else /* CONFIG_PSI */ |
| @@ -1,8 +1,11 @@ | ||
| 1 | 1 | #ifndef _LINUX_PSI_TYPES_H |
| 2 | 2 | #define _LINUX_PSI_TYPES_H |
| 3 | 3 | |
| 4 | +#include <linux/kthread.h> | |
| 4 | 5 | #include <linux/seqlock.h> |
| 5 | 6 | #include <linux/types.h> |
| 7 | +#include <linux/kref.h> | |
| 8 | +#include <linux/wait.h> | |
| 6 | 9 | |
| 7 | 10 | #ifdef CONFIG_PSI |
| 8 | 11 | |
| @@ -11,7 +14,7 @@ enum psi_task_count { · 2 unmodified lines | ||
| 11 | 14 | NR_IOWAIT, |
| 12 | 15 | NR_MEMSTALL, |
| 13 | 16 | NR_RUNNING, |
| 14 | − NR_PSI_TASK_COUNTS, | |
| 17 | + NR_PSI_TASK_COUNTS = 3, | |
| 15 | 18 | }; |
| 16 | 19 | |
| 17 | 20 | /* Task state bitmasks */ |
| @@ -24,7 +27,7 @@ enum psi_res { · 6 unmodified lines | ||
| 24 | 27 | PSI_IO, |
| 25 | 28 | PSI_MEM, |
| 26 | 29 | PSI_CPU, |
| 27 | − NR_PSI_RESOURCES, | |
| 30 | + NR_PSI_RESOURCES = 3, | |
| 28 | 31 | }; |
| 29 | 32 | |
| 30 | 33 | /* |
| @@ -41,7 +44,13 @@ enum psi_states { · 10 unmodified lines | ||
| 41 | 44 | PSI_CPU_SOME, |
| 42 | 45 | /* Only per-CPU, to weigh the CPU in the global average: */ |
| 43 | 46 | PSI_NONIDLE, |
| 44 | − NR_PSI_STATES, | |
| 47 | + NR_PSI_STATES = 6, | |
| 48 | +}; | |
| 49 | + | |
| 50 | +enum psi_aggregators { | |
| 51 | + PSI_AVGS = 0, | |
| 52 | + PSI_POLL, | |
| 53 | + NR_PSI_AGGREGATORS, | |
| 45 | 54 | }; |
| 46 | 55 | |
| 47 | 56 | struct psi_group_cpu { |
| @@ -53,6 +62,9 @@ struct psi_group_cpu { · 5 unmodified lines | ||
| 53 | 62 | /* States of the tasks belonging to this group */ |
| 54 | 63 | unsigned int tasks[NR_PSI_TASK_COUNTS]; |
| 55 | 64 | |
| 65 | + /* Aggregate pressure state derived from the tasks */ | |
| 66 | + u32 state_mask; | |
| 67 | + | |
| 56 | 68 | /* Period time sampling buckets for each state of interest (ns) */ |
| 57 | 69 | u32 times[NR_PSI_STATES]; |
| 58 | 70 | |
| @@ -62,25 +74,94 @@ struct psi_group_cpu { · 3 unmodified lines | ||
| 62 | 74 | /* 2nd cacheline updated by the aggregator */ |
| 63 | 75 | |
| 64 | 76 | /* Delta detection against the sampling buckets */ |
| 65 | − u32 times_prev[NR_PSI_STATES] ____cacheline_aligned_in_smp; | |
| 77 | + u32 times_prev[NR_PSI_AGGREGATORS][NR_PSI_STATES] | |
| 78 | + ____cacheline_aligned_in_smp; | |
| 79 | +}; | |
| 80 | + | |
| 81 | +/* PSI growth tracking window */ | |
| 82 | +struct psi_window { | |
| 83 | + /* Window size in ns */ | |
| 84 | + u64 size; | |
| 85 | + | |
| 86 | + /* Start time of the current window in ns */ | |
| 87 | + u64 start_time; | |
| 88 | + | |
| 89 | + /* Value at the start of the window */ | |
| 90 | + u64 start_value; | |
| 91 | + | |
| 92 | + /* Value growth in the previous window */ | |
| 93 | + u64 prev_growth; | |
| 94 | +}; | |
| 95 | + | |
| 96 | +struct psi_trigger { | |
| 97 | + /* PSI state being monitored by the trigger */ | |
| 98 | + enum psi_states state; | |
| 99 | + | |
| 100 | + /* User-spacified threshold in ns */ | |
| 101 | + u64 threshold; | |
| 102 | + | |
| 103 | + /* List node inside triggers list */ | |
| 104 | + struct list_head node; | |
| 105 | + | |
| 106 | + /* Backpointer needed during trigger destruction */ | |
| 107 | + struct psi_group *group; | |
| 108 | + | |
| 109 | + /* Wait queue for polling */ | |
| 110 | + wait_queue_head_t event_wait; | |
| 111 | + | |
| 112 | + /* Pending event flag */ | |
| 113 | + int event; | |
| 114 | + | |
| 115 | + /* Tracking window */ | |
| 116 | + struct psi_window win; | |
| 117 | + | |
| 118 | + /* | |
| 119 | + * Time last event was generated. Used for rate-limiting | |
| 120 | + * events to one per window | |
| 121 | + */ | |
| 122 | + u64 last_event_time; | |
| 123 | + | |
| 124 | + /* Refcounting to prevent premature destruction */ | |
| 125 | + struct kref refcount; | |
| 66 | 126 | }; |
| 67 | 127 | |
| 68 | 128 | struct psi_group { |
| 69 | − /* Protects data updated during an aggregation */ | |
| 70 | − struct mutex stat_lock; | |
| 129 | + /* Protects data used by the aggregator */ | |
| 130 | + struct mutex avgs_lock; | |
| 71 | 131 | |
| 72 | 132 | /* Per-cpu task state & time tracking */ |
| 73 | 133 | struct psi_group_cpu __percpu *pcpu; |
| 74 | 134 | |
| 75 | − /* Periodic aggregation state */ | |
| 76 | − u64 total_prev[NR_PSI_STATES - 1]; | |
| 77 | − u64 last_update; | |
| 78 | − u64 next_update; | |
| 79 | − struct delayed_work clock_work; | |
| 135 | + /* Running pressure averages */ | |
| 136 | + u64 avg_total[NR_PSI_STATES - 1]; | |
| 137 | + u64 avg_last_update; | |
| 138 | + u64 avg_next_update; | |
| 139 | + | |
| 140 | + /* Aggregator work control */ | |
| 141 | + struct delayed_work avgs_work; | |
| 80 | 142 | |
| 81 | 143 | /* Total stall times and sampled pressure averages */ |
| 82 | − u64 total[NR_PSI_STATES - 1]; | |
| 144 | + u64 total[NR_PSI_AGGREGATORS][NR_PSI_STATES - 1]; | |
| 83 | 145 | unsigned long avg[NR_PSI_STATES - 1][3]; |
| 146 | + | |
| 147 | + /* Monitor work control */ | |
| 148 | + atomic_t poll_scheduled; | |
| 149 | + struct kthread_worker __rcu *poll_kworker; | |
| 150 | + struct kthread_delayed_work poll_work; | |
| 151 | + | |
| 152 | + /* Protects data used by the monitor */ | |
| 153 | + struct mutex trigger_lock; | |
| 154 | + | |
| 155 | + /* Configured polling triggers */ | |
| 156 | + struct list_head triggers; | |
| 157 | + u32 nr_triggers[NR_PSI_STATES - 1]; | |
| 158 | + u32 poll_states; | |
| 159 | + u64 poll_min_period; | |
| 160 | + | |
| 161 | + /* Total stall times at the start of monitor activation */ | |
| 162 | + u64 polling_total[NR_PSI_STATES - 1]; | |
| 163 | + u64 polling_next_update; | |
| 164 | + u64 polling_until; | |
| 84 | 165 | }; |
| 85 | 166 | |
| 86 | 167 | #else /* CONFIG_PSI */ |
| @@ -5,8 +5,7 @@ · 4 unmodified lines | ||
| 5 | 5 | * |
| 6 | 6 | * Author: Brijesh Singh <brijesh.singh@amd.com> |
| 7 | 7 | * |
| 8 | − * SEV spec 0.14 is available at: | |
| 9 | − * http://support.amd.com/TechDocs/55766_SEV-KM API_Specification.pdf | |
| 8 | + * SEV API spec is available at https://developer.amd.com/sev | |
| 10 | 9 | * |
| 11 | 10 | * This program is free software; you can redistribute it and/or modify |
| 12 | 11 | * it under the terms of the GNU General Public License version 2 as |
| @@ -596,7 +596,6 @@ static inline void pwm_remove_table(struct pwm_lookup *table, size_t num) · 595 unmodified lines | ||
| 596 | 596 | #ifdef CONFIG_PWM_SYSFS |
| 597 | 597 | void pwmchip_sysfs_export(struct pwm_chip *chip); |
| 598 | 598 | void pwmchip_sysfs_unexport(struct pwm_chip *chip); |
| 599 | −void pwmchip_sysfs_unexport_children(struct pwm_chip *chip); | |
| 600 | 599 | #else |
| 601 | 600 | static inline void pwmchip_sysfs_export(struct pwm_chip *chip) |
| 602 | 601 | { |
| @@ -605,10 +604,6 @@ static inline void pwmchip_sysfs_export(struct pwm_chip *chip) · 2 unmodified lines | ||
| 605 | 604 | static inline void pwmchip_sysfs_unexport(struct pwm_chip *chip) |
| 606 | 605 | { |
| 607 | 606 | } |
| 608 | − | |
| 609 | −static inline void pwmchip_sysfs_unexport_children(struct pwm_chip *chip) | |
| 610 | −{ | |
| 611 | −} | |
| 612 | 607 | #endif /* CONFIG_PWM_SYSFS */ |
| 613 | 608 | |
| 614 | 609 | #endif /* __LINUX_PWM_H */ |
| @@ -1,4 +1,4 @@ | ||
| 1 | −/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ | |
| 1 | +/* SPDX-License-Identifier: GPL-2.0 */ | |
| 2 | 2 | /* |
| 3 | 3 | * Copyright (c) 2017-2018, The Linux Foundation. All rights reserved. |
| 4 | 4 | */ |
| @@ -1338,7 +1338,6 @@ static inline u16 qed_sb_update_sb_idx(struct qed_sb_info *sb_info) · 1337 unmodified lines | ||
| 1338 | 1338 | } |
| 1339 | 1339 | |
| 1340 | 1340 | /* Let SB update */ |
| 1341 | − mmiowb(); | |
| 1342 | 1341 | return rc; |
| 1343 | 1342 | } |
| 1344 | 1343 | |
| @@ -1374,7 +1373,6 @@ static inline void qed_sb_ack(struct qed_sb_info *sb_info, · 29 unmodified lines | ||
| 1374 | 1373 | /* Both segments (interrupts & acks) are written to same place address; |
| 1375 | 1374 | * Need to guarantee all commands will be received (in-order) by HW. |
| 1376 | 1375 | */ |
| 1377 | − mmiowb(); | |
| 1378 | 1376 | barrier(); |
| 1379 | 1377 | } |
| 1380 | 1378 | |
| @@ -20,7 +20,7 @@ struct random_ready_callback { · 19 unmodified lines | ||
| 20 | 20 | |
| 21 | 21 | extern void add_device_randomness(const void *, unsigned int); |
| 22 | 22 | |
| 23 | −#if defined(CONFIG_GCC_PLUGIN_LATENT_ENTROPY) && !defined(__CHECKER__) | |
| 23 | +#if defined(LATENT_ENTROPY_PLUGIN) && !defined(__CHECKER__) | |
| 24 | 24 | static inline void add_latent_entropy(void) |
| 25 | 25 | { |
| 26 | 26 | add_device_randomness((const void *)&latent_entropy, |
| @@ -36,6 +36,7 @@ extern void add_interrupt_randomness(int irq, int irq_flags) __latent_entropy; · 9 unmodified lines | ||
| 36 | 36 | |
| 37 | 37 | extern void get_random_bytes(void *buf, int nbytes); |
| 38 | 38 | extern int wait_for_random_bytes(void); |
| 39 | +extern int __init rand_initialize(void); | |
| 39 | 40 | extern bool rng_is_initialized(void); |
| 40 | 41 | extern int add_random_ready_callback(struct random_ready_callback *rdy); |
| 41 | 42 | extern void del_random_ready_callback(struct random_ready_callback *rdy); |
| @@ -878,9 +878,11 @@ static inline void rcu_head_init(struct rcu_head *rhp) · 877 unmodified lines | ||
| 878 | 878 | static inline bool |
| 879 | 879 | rcu_head_after_call_rcu(struct rcu_head *rhp, rcu_callback_t f) |
| 880 | 880 | { |
| 881 | − if (READ_ONCE(rhp->func) == f) | |
| 881 | + rcu_callback_t func = READ_ONCE(rhp->func); | |
| 882 | + | |
| 883 | + if (func == f) | |
| 882 | 884 | return true; |
| 883 | − WARN_ON_ONCE(READ_ONCE(rhp->func) != (rcu_callback_t)~0L); | |
| 885 | + WARN_ON_ONCE(func != (rcu_callback_t)~0L); | |
| 884 | 886 | return false; |
| 885 | 887 | } |
| 886 | 888 | |
| @@ -18,7 +18,7 @@ · 17 unmodified lines | ||
| 18 | 18 | * awoken. |
| 19 | 19 | */ |
| 20 | 20 | struct rcuwait { |
| 21 | − struct task_struct *task; | |
| 21 | + struct task_struct __rcu *task; | |
| 22 | 22 | }; |
| 23 | 23 | |
| 24 | 24 | #define __RCUWAIT_INITIALIZER(name) \ |
| @@ -14,6 +14,7 @@ struct device; · 13 unmodified lines | ||
| 14 | 14 | #define SYS_POWER_OFF 0x0003 /* Notify of system power off */ |
| 15 | 15 | |
| 16 | 16 | enum reboot_mode { |
| 17 | + REBOOT_UNDEFINED = -1, | |
| 17 | 18 | REBOOT_COLD = 0, |
| 18 | 19 | REBOOT_WARM, |
| 19 | 20 | REBOOT_HARD, |
| @@ -21,6 +22,7 @@ enum reboot_mode { · 1 unmodified line | ||
| 21 | 22 | REBOOT_GPIO, |
| 22 | 23 | }; |
| 23 | 24 | extern enum reboot_mode reboot_mode; |
| 25 | +extern enum reboot_mode panic_reboot_mode; | |
| 24 | 26 | |
| 25 | 27 | enum reboot_type { |
| 26 | 28 | BOOT_TRIPLE = 't', |
| @@ -478,6 +478,11 @@ static inline int regulator_is_supported_voltage(struct regulator *regulator, · 477 unmodified lines | ||
| 478 | 478 | return 0; |
| 479 | 479 | } |
| 480 | 480 | |
| 481 | +static inline unsigned int regulator_get_linear_step(struct regulator *regulator) | |
| 482 | +{ | |
| 483 | + return 0; | |
| 484 | +} | |
| 485 | + | |
| 481 | 486 | static inline int regulator_set_current_limit(struct regulator *regulator, |
| 482 | 487 | int min_uA, int max_uA) |
| 483 | 488 | { |
| @@ -2,6 +2,8 @@ · 1 unmodified line | ||
| 2 | 2 | #ifndef _LINUX_RESET_H_ |
| 3 | 3 | #define _LINUX_RESET_H_ |
| 4 | 4 | |
| 5 | +#include <linux/err.h> | |
| 6 | +#include <linux/errno.h> | |
| 5 | 7 | #include <linux/types.h> |
| 6 | 8 | |
| 7 | 9 | struct device; |
| @@ -48,7 +48,6 @@ typedef int (*rht_obj_cmpfn_t)(struct rhashtable_compare_arg *arg, · 47 unmodified lines | ||
| 48 | 48 | * @head_offset: Offset of rhash_head in struct to be hashed |
| 49 | 49 | * @max_size: Maximum size while expanding |
| 50 | 50 | * @min_size: Minimum size while shrinking |
| 51 | − * @locks_mul: Number of bucket locks to allocate per cpu (default: 32) | |
| 52 | 51 | * @automatic_shrinking: Enable automatic shrinking of tables |
| 53 | 52 | * @hashfn: Hash function (default: jhash2 if !(key_len % 4), or jhash) |
| 54 | 53 | * @obj_hashfn: Function to hash object |
| @@ -62,7 +61,6 @@ struct rhashtable_params { · 7 unmodified lines | ||
| 62 | 61 | unsigned int max_size; |
| 63 | 62 | u16 min_size; |
| 64 | 63 | bool automatic_shrinking; |
| 65 | − u8 locks_mul; | |
| 66 | 64 | rht_hashfn_t hashfn; |
| 67 | 65 | rht_obj_hashfn_t obj_hashfn; |
| 68 | 66 | rht_obj_cmpfn_t obj_cmpfn; |
| @@ -24,12 +24,27 @@ · 23 unmodified lines | ||
| 24 | 24 | #include <linux/list_nulls.h> |
| 25 | 25 | #include <linux/workqueue.h> |
| 26 | 26 | #include <linux/rculist.h> |
| 27 | +#include <linux/bit_spinlock.h> | |
| 27 | 28 | |
| 28 | 29 | #include <linux/rhashtable-types.h> |
| 29 | 30 | /* |
| 31 | + * Objects in an rhashtable have an embedded struct rhash_head | |
| 32 | + * which is linked into as hash chain from the hash table - or one | |
| 33 | + * of two or more hash tables when the rhashtable is being resized. | |
| 30 | 34 | * The end of the chain is marked with a special nulls marks which has |
| 31 | − * the least significant bit set. | |
| 35 | + * the least significant bit set but otherwise stores the address of | |
| 36 | + * the hash bucket. This allows us to be be sure we've found the end | |
| 37 | + * of the right list. | |
| 38 | + * The value stored in the hash bucket has BIT(0) used as a lock bit. | |
| 39 | + * This bit must be atomically set before any changes are made to | |
| 40 | + * the chain. To avoid dereferencing this pointer without clearing | |
| 41 | + * the bit first, we use an opaque 'struct rhash_lock_head *' for the | |
| 42 | + * pointer stored in the bucket. This struct needs to be defined so | |
| 43 | + * that rcu_dereference() works on it, but it has no content so a | |
| 44 | + * cast is needed for it to be useful. This ensures it isn't | |
| 45 | + * used by mistake with clearing the lock bit first. | |
| 32 | 46 | */ |
| 47 | +struct rhash_lock_head {}; | |
| 33 | 48 | |
| 34 | 49 | /* Maximum chain length before rehash |
| 35 | 50 | * |
| @@ -52,8 +67,6 @@ · 16 unmodified lines | ||
| 52 | 67 | * @nest: Number of bits of first-level nested table. |
| 53 | 68 | * @rehash: Current bucket being rehashed |
| 54 | 69 | * @hash_rnd: Random seed to fold into hash |
| 55 | − * @locks_mask: Mask to apply before accessing locks[] | |
| 56 | − * @locks: Array of spinlocks protecting individual buckets | |
| 57 | 70 | * @walkers: List of active walkers |
| 58 | 71 | * @rcu: RCU structure for freeing the table |
| 59 | 72 | * @future_tbl: Table under construction during rehashing |
| @@ -63,31 +76,34 @@ · 3 unmodified lines | ||
| 63 | 76 | struct bucket_table { |
| 64 | 77 | unsigned int size; |
| 65 | 78 | unsigned int nest; |
| 66 | − unsigned int rehash; | |
| 67 | 79 | u32 hash_rnd; |
| 68 | − unsigned int locks_mask; | |
| 69 | − spinlock_t *locks; | |
| 70 | 80 | struct list_head walkers; |
| 71 | 81 | struct rcu_head rcu; |
| 72 | 82 | |
| 73 | 83 | struct bucket_table __rcu *future_tbl; |
| 74 | 84 | |
| 75 | − struct rhash_head __rcu *buckets[] ____cacheline_aligned_in_smp; | |
| 85 | + struct lockdep_map dep_map; | |
| 86 | + | |
| 87 | + struct rhash_lock_head __rcu *buckets[] ____cacheline_aligned_in_smp; | |
| 76 | 88 | }; |
| 77 | 89 | |
| 78 | 90 | /* |
| 79 | 91 | * NULLS_MARKER() expects a hash value with the low |
| 80 | 92 | * bits mostly likely to be significant, and it discards |
| 81 | 93 | * the msb. |
| 82 | − * We git it an address, in which the bottom 2 bits are | |
| 94 | + * We give it an address, in which the bottom bit is | |
| 83 | 95 | * always 0, and the msb might be significant. |
| 84 | 96 | * So we shift the address down one bit to align with |
| 85 | 97 | * expectations and avoid losing a significant bit. |
| 98 | + * | |
| 99 | + * We never store the NULLS_MARKER in the hash table | |
| 100 | + * itself as we need the lsb for locking. | |
| 101 | + * Instead we store a NULL | |
| 86 | 102 | */ |
| 87 | 103 | #define RHT_NULLS_MARKER(ptr) \ |
| 88 | 104 | ((void *)NULLS_MARKER(((unsigned long) (ptr)) >> 1)) |
| 89 | 105 | #define INIT_RHT_NULLS_HEAD(ptr) \ |
| 90 | − ((ptr) = RHT_NULLS_MARKER(&(ptr))) | |
| 106 | + ((ptr) = NULL) | |
| 91 | 107 | |
| 92 | 108 | static inline bool rht_is_a_nulls(const struct rhash_head *ptr) |
| 93 | 109 | { |
| @@ -207,25 +223,6 @@ static inline bool rht_grow_above_max(const struct rhashtable *ht, · 113 unmodified lines | ||
| 207 | 223 | return atomic_read(&ht->nelems) >= ht->max_elems; |
| 208 | 224 | } |
| 209 | 225 | |
| 210 | −/* The bucket lock is selected based on the hash and protects mutations | |
| 211 | − * on a group of hash buckets. | |
| 212 | − * | |
| 213 | − * A maximum of tbl->size/2 bucket locks is allocated. This ensures that | |
| 214 | − * a single lock always covers both buckets which may both contains | |
| 215 | − * entries which link to the same bucket of the old table during resizing. | |
| 216 | − * This allows to simplify the locking as locking the bucket in both | |
| 217 | − * tables during resize always guarantee protection. | |
| 218 | − * | |
| 219 | − * IMPORTANT: When holding the bucket lock of both the old and new table | |
| 220 | − * during expansions and shrinking, the old bucket lock must always be | |
| 221 | − * acquired first. | |
| 222 | − */ | |
| 223 | −static inline spinlock_t *rht_bucket_lock(const struct bucket_table *tbl, | |
| 224 | − unsigned int hash) | |
| 225 | −{ | |
| 226 | − return &tbl->locks[hash & tbl->locks_mask]; | |
| 227 | −} | |
| 228 | − | |
| 229 | 226 | #ifdef CONFIG_PROVE_LOCKING |
| 230 | 227 | int lockdep_rht_mutex_is_held(struct rhashtable *ht); |
| 231 | 228 | int lockdep_rht_bucket_is_held(const struct bucket_table *tbl, u32 hash); |
| @@ -264,11 +261,13 @@ void rhashtable_free_and_destroy(struct rhashtable *ht, · 32 unmodified lines | ||
| 264 | 261 | void *arg); |
| 265 | 262 | void rhashtable_destroy(struct rhashtable *ht); |
| 266 | 263 | |
| 267 | −struct rhash_head __rcu **rht_bucket_nested(const struct bucket_table *tbl, | |
| 268 | − unsigned int hash); | |
| 269 | −struct rhash_head __rcu **rht_bucket_nested_insert(struct rhashtable *ht, | |
| 270 | − struct bucket_table *tbl, | |
| 264 | +struct rhash_lock_head __rcu **rht_bucket_nested(const struct bucket_table *tbl, | |
| 265 | + unsigned int hash); | |
| 266 | +struct rhash_lock_head __rcu **__rht_bucket_nested(const struct bucket_table *tbl, | |
| 271 | 267 | unsigned int hash); |
| 268 | +struct rhash_lock_head __rcu **rht_bucket_nested_insert(struct rhashtable *ht, | |
| 269 | + struct bucket_table *tbl, | |
| 270 | + unsigned int hash); | |
| 272 | 271 | |
| 273 | 272 | #define rht_dereference(p, ht) \ |
| 274 | 273 | rcu_dereference_protected(p, lockdep_rht_mutex_is_held(ht)) |
| @@ -285,37 +284,136 @@ struct rhash_head __rcu **rht_bucket_nested_insert(struct rhashtable *ht, · 10 unmodified lines | ||
| 285 | 284 | #define rht_entry(tpos, pos, member) \ |
| 286 | 285 | ({ tpos = container_of(pos, typeof(*tpos), member); 1; }) |
| 287 | 286 | |
| 288 | −static inline struct rhash_head __rcu *const *rht_bucket( | |
| 287 | +static inline struct rhash_lock_head __rcu *const *rht_bucket( | |
| 289 | 288 | const struct bucket_table *tbl, unsigned int hash) |
| 290 | 289 | { |
| 291 | 290 | return unlikely(tbl->nest) ? rht_bucket_nested(tbl, hash) : |
| 292 | 291 | &tbl->buckets[hash]; |
| 293 | 292 | } |
| 294 | 293 | |
| 295 | −static inline struct rhash_head __rcu **rht_bucket_var( | |
| 294 | +static inline struct rhash_lock_head __rcu **rht_bucket_var( | |
| 296 | 295 | struct bucket_table *tbl, unsigned int hash) |
| 297 | 296 | { |
| 298 | − return unlikely(tbl->nest) ? rht_bucket_nested(tbl, hash) : | |
| 297 | + return unlikely(tbl->nest) ? __rht_bucket_nested(tbl, hash) : | |
| 299 | 298 | &tbl->buckets[hash]; |
| 300 | 299 | } |
| 301 | 300 | |
| 302 | −static inline struct rhash_head __rcu **rht_bucket_insert( | |
| 301 | +static inline struct rhash_lock_head __rcu **rht_bucket_insert( | |
| 303 | 302 | struct rhashtable *ht, struct bucket_table *tbl, unsigned int hash) |
| 304 | 303 | { |
| 305 | 304 | return unlikely(tbl->nest) ? rht_bucket_nested_insert(ht, tbl, hash) : |
| 306 | 305 | &tbl->buckets[hash]; |
| 307 | 306 | } |
| 308 | 307 | |
| 308 | +/* | |
| 309 | + * We lock a bucket by setting BIT(0) in the pointer - this is always | |
| 310 | + * zero in real pointers. The NULLS mark is never stored in the bucket, | |
| 311 | + * rather we store NULL if the bucket is empty. | |
| 312 | + * bit_spin_locks do not handle contention well, but the whole point | |
| 313 | + * of the hashtable design is to achieve minimum per-bucket contention. | |
| 314 | + * A nested hash table might not have a bucket pointer. In that case | |
| 315 | + * we cannot get a lock. For remove and replace the bucket cannot be | |
| 316 | + * interesting and doesn't need locking. | |
| 317 | + * For insert we allocate the bucket if this is the last bucket_table, | |
| 318 | + * and then take the lock. | |
| 319 | + * Sometimes we unlock a bucket by writing a new pointer there. In that | |
| 320 | + * case we don't need to unlock, but we do need to reset state such as | |
| 321 | + * local_bh. For that we have rht_assign_unlock(). As rcu_assign_pointer() | |
| 322 | + * provides the same release semantics that bit_spin_unlock() provides, | |
| 323 | + * this is safe. | |
| 324 | + * When we write to a bucket without unlocking, we use rht_assign_locked(). | |
| 325 | + */ | |
| 326 | + | |
| 327 | +static inline void rht_lock(struct bucket_table *tbl, | |
| 328 | + struct rhash_lock_head **bkt) | |
| 329 | +{ | |
| 330 | + local_bh_disable(); | |
| 331 | + bit_spin_lock(0, (unsigned long *)bkt); | |
| 332 | + lock_map_acquire(&tbl->dep_map); | |
| 333 | +} | |
| 334 | + | |
| 335 | +static inline void rht_lock_nested(struct bucket_table *tbl, | |
| 336 | + struct rhash_lock_head **bucket, | |
| 337 | + unsigned int subclass) | |
| 338 | +{ | |
| 339 | + local_bh_disable(); | |
| 340 | + bit_spin_lock(0, (unsigned long *)bucket); | |
| 341 | + lock_acquire_exclusive(&tbl->dep_map, subclass, 0, NULL, _THIS_IP_); | |
| 342 | +} | |
| 343 | + | |
| 344 | +static inline void rht_unlock(struct bucket_table *tbl, | |
| 345 | + struct rhash_lock_head **bkt) | |
| 346 | +{ | |
| 347 | + lock_map_release(&tbl->dep_map); | |
| 348 | + bit_spin_unlock(0, (unsigned long *)bkt); | |
| 349 | + local_bh_enable(); | |
| 350 | +} | |
| 351 | + | |
| 352 | +/* | |
| 353 | + * Where 'bkt' is a bucket and might be locked: | |
| 354 | + * rht_ptr() dereferences that pointer and clears the lock bit. | |
| 355 | + * rht_ptr_exclusive() dereferences in a context where exclusive | |
| 356 | + * access is guaranteed, such as when destroying the table. | |
| 357 | + */ | |
| 358 | +static inline struct rhash_head *rht_ptr( | |
| 359 | + struct rhash_lock_head __rcu * const *bkt, | |
| 360 | + struct bucket_table *tbl, | |
| 361 | + unsigned int hash) | |
| 362 | +{ | |
| 363 | + const struct rhash_lock_head *p = | |
| 364 | + rht_dereference_bucket_rcu(*bkt, tbl, hash); | |
| 365 | + | |
| 366 | + if ((((unsigned long)p) & ~BIT(0)) == 0) | |
| 367 | + return RHT_NULLS_MARKER(bkt); | |
| 368 | + return (void *)(((unsigned long)p) & ~BIT(0)); | |
| 369 | +} | |
| 370 | + | |
| 371 | +static inline struct rhash_head *rht_ptr_exclusive( | |
| 372 | + struct rhash_lock_head __rcu * const *bkt) | |
| 373 | +{ | |
| 374 | + const struct rhash_lock_head *p = | |
| 375 | + rcu_dereference_protected(*bkt, 1); | |
| 376 | + | |
| 377 | + if (!p) | |
| 378 | + return RHT_NULLS_MARKER(bkt); | |
| 379 | + return (void *)(((unsigned long)p) & ~BIT(0)); | |
| 380 | +} | |
| 381 | + | |
| 382 | +static inline void rht_assign_locked(struct rhash_lock_head __rcu **bkt, | |
| 383 | + struct rhash_head *obj) | |
| 384 | +{ | |
| 385 | + struct rhash_head __rcu **p = (struct rhash_head __rcu **)bkt; | |
| 386 | + | |
| 387 | + if (rht_is_a_nulls(obj)) | |
| 388 | + obj = NULL; | |
| 389 | + rcu_assign_pointer(*p, (void *)((unsigned long)obj | BIT(0))); | |
| 390 | +} | |
| 391 | + | |
| 392 | +static inline void rht_assign_unlock(struct bucket_table *tbl, | |
| 393 | + struct rhash_lock_head __rcu **bkt, | |
| 394 | + struct rhash_head *obj) | |
| 395 | +{ | |
| 396 | + struct rhash_head __rcu **p = (struct rhash_head __rcu **)bkt; | |
| 397 | + | |
| 398 | + if (rht_is_a_nulls(obj)) | |
| 399 | + obj = NULL; | |
| 400 | + lock_map_release(&tbl->dep_map); | |
| 401 | + rcu_assign_pointer(*p, obj); | |
| 402 | + preempt_enable(); | |
| 403 | + __release(bitlock); | |
| 404 | + local_bh_enable(); | |
| 405 | +} | |
| 406 | + | |
| 309 | 407 | /** |
| 310 | − * rht_for_each_continue - continue iterating over hash chain | |
| 408 | + * rht_for_each_from - iterate over hash chain from given head | |
| 311 | 409 | * @pos: the &struct rhash_head to use as a loop cursor. |
| 312 | − * @head: the previous &struct rhash_head to continue from | |
| 410 | + * @head: the &struct rhash_head to start from | |
| 313 | 411 | * @tbl: the &struct bucket_table |
| 314 | 412 | * @hash: the hash value / bucket index |
| 315 | 413 | */ |
| 316 | −#define rht_for_each_continue(pos, head, tbl, hash) \ | |
| 317 | − for (pos = rht_dereference_bucket(head, tbl, hash); \ | |
| 318 | − !rht_is_a_nulls(pos); \ | |
| 414 | +#define rht_for_each_from(pos, head, tbl, hash) \ | |
| 415 | + for (pos = head; \ | |
| 416 | + !rht_is_a_nulls(pos); \ | |
| 319 | 417 | pos = rht_dereference_bucket((pos)->next, tbl, hash)) |
| 320 | 418 | |
| 321 | 419 | /** |
| @@ -325,19 +423,20 @@ static inline struct rhash_head __rcu **rht_bucket_insert( · 3 unmodified lines | ||
| 325 | 423 | * @hash: the hash value / bucket index |
| 326 | 424 | */ |
| 327 | 425 | #define rht_for_each(pos, tbl, hash) \ |
| 328 | − rht_for_each_continue(pos, *rht_bucket(tbl, hash), tbl, hash) | |
| 426 | + rht_for_each_from(pos, rht_ptr(rht_bucket(tbl, hash), tbl, hash), \ | |
| 427 | + tbl, hash) | |
| 329 | 428 | |
| 330 | 429 | /** |
| 331 | − * rht_for_each_entry_continue - continue iterating over hash chain | |
| 430 | + * rht_for_each_entry_from - iterate over hash chain from given head | |
| 332 | 431 | * @tpos: the type * to use as a loop cursor. |
| 333 | 432 | * @pos: the &struct rhash_head to use as a loop cursor. |
| 334 | − * @head: the previous &struct rhash_head to continue from | |
| 433 | + * @head: the &struct rhash_head to start from | |
| 335 | 434 | * @tbl: the &struct bucket_table |
| 336 | 435 | * @hash: the hash value / bucket index |
| 337 | 436 | * @member: name of the &struct rhash_head within the hashable struct. |
| 338 | 437 | */ |
| 339 | −#define rht_for_each_entry_continue(tpos, pos, head, tbl, hash, member) \ | |
| 340 | − for (pos = rht_dereference_bucket(head, tbl, hash); \ | |
| 438 | +#define rht_for_each_entry_from(tpos, pos, head, tbl, hash, member) \ | |
| 439 | + for (pos = head; \ | |
| 341 | 440 | (!rht_is_a_nulls(pos)) && rht_entry(tpos, pos, member); \ |
| 342 | 441 | pos = rht_dereference_bucket((pos)->next, tbl, hash)) |
| 343 | 442 | |
| @@ -350,8 +449,9 @@ static inline struct rhash_head __rcu **rht_bucket_insert( · 6 unmodified lines | ||
| 350 | 449 | * @member: name of the &struct rhash_head within the hashable struct. |
| 351 | 450 | */ |
| 352 | 451 | #define rht_for_each_entry(tpos, pos, tbl, hash, member) \ |
| 353 | − rht_for_each_entry_continue(tpos, pos, *rht_bucket(tbl, hash), \ | |
| 354 | − tbl, hash, member) | |
| 452 | + rht_for_each_entry_from(tpos, pos, \ | |
| 453 | + rht_ptr(rht_bucket(tbl, hash), tbl, hash), \ | |
| 454 | + tbl, hash, member) | |
| 355 | 455 | |
| 356 | 456 | /** |
| 357 | 457 | * rht_for_each_entry_safe - safely iterate over hash chain of given type |
| @@ -366,7 +466,7 @@ static inline struct rhash_head __rcu **rht_bucket_insert( · 8 unmodified lines | ||
| 366 | 466 | * remove the loop cursor from the list. |
| 367 | 467 | */ |
| 368 | 468 | #define rht_for_each_entry_safe(tpos, pos, next, tbl, hash, member) \ |
| 369 | − for (pos = rht_dereference_bucket(*rht_bucket(tbl, hash), tbl, hash), \ | |
| 469 | + for (pos = rht_ptr(rht_bucket(tbl, hash), tbl, hash), \ | |
| 370 | 470 | next = !rht_is_a_nulls(pos) ? \ |
| 371 | 471 | rht_dereference_bucket(pos->next, tbl, hash) : NULL; \ |
| 372 | 472 | (!rht_is_a_nulls(pos)) && rht_entry(tpos, pos, member); \ |
| @@ -375,9 +475,9 @@ static inline struct rhash_head __rcu **rht_bucket_insert( · 2 unmodified lines | ||
| 375 | 475 | rht_dereference_bucket(pos->next, tbl, hash) : NULL) |
| 376 | 476 | |
| 377 | 477 | /** |
| 378 | − * rht_for_each_rcu_continue - continue iterating over rcu hash chain | |
| 478 | + * rht_for_each_rcu_from - iterate over rcu hash chain from given head | |
| 379 | 479 | * @pos: the &struct rhash_head to use as a loop cursor. |
| 380 | − * @head: the previous &struct rhash_head to continue from | |
| 480 | + * @head: the &struct rhash_head to start from | |
| 381 | 481 | * @tbl: the &struct bucket_table |
| 382 | 482 | * @hash: the hash value / bucket index |
| 383 | 483 | * |
| @@ -385,9 +485,9 @@ static inline struct rhash_head __rcu **rht_bucket_insert( · 1 unmodified line | ||
| 385 | 485 | * the _rcu mutation primitives such as rhashtable_insert() as long as the |
| 386 | 486 | * traversal is guarded by rcu_read_lock(). |
| 387 | 487 | */ |
| 388 | −#define rht_for_each_rcu_continue(pos, head, tbl, hash) \ | |
| 488 | +#define rht_for_each_rcu_from(pos, head, tbl, hash) \ | |
| 389 | 489 | for (({barrier(); }), \ |
| 390 | − pos = rht_dereference_bucket_rcu(head, tbl, hash); \ | |
| 490 | + pos = head; \ | |
| 391 | 491 | !rht_is_a_nulls(pos); \ |
| 392 | 492 | pos = rcu_dereference_raw(pos->next)) |
| 393 | 493 | |
| @@ -401,14 +501,17 @@ static inline struct rhash_head __rcu **rht_bucket_insert( · 7 unmodified lines | ||
| 401 | 501 | * the _rcu mutation primitives such as rhashtable_insert() as long as the |
| 402 | 502 | * traversal is guarded by rcu_read_lock(). |
| 403 | 503 | */ |
| 404 | −#define rht_for_each_rcu(pos, tbl, hash) \ | |
| 405 | − rht_for_each_rcu_continue(pos, *rht_bucket(tbl, hash), tbl, hash) | |
| 504 | +#define rht_for_each_rcu(pos, tbl, hash) \ | |
| 505 | + for (({barrier(); }), \ | |
| 506 | + pos = rht_ptr(rht_bucket(tbl, hash), tbl, hash); \ | |
| 507 | + !rht_is_a_nulls(pos); \ | |
| 508 | + pos = rcu_dereference_raw(pos->next)) | |
| 406 | 509 | |
| 407 | 510 | /** |
| 408 | − * rht_for_each_entry_rcu_continue - continue iterating over rcu hash chain | |
| 511 | + * rht_for_each_entry_rcu_from - iterated over rcu hash chain from given head | |
| 409 | 512 | * @tpos: the type * to use as a loop cursor. |
| 410 | 513 | * @pos: the &struct rhash_head to use as a loop cursor. |
| 411 | − * @head: the previous &struct rhash_head to continue from | |
| 514 | + * @head: the &struct rhash_head to start from | |
| 412 | 515 | * @tbl: the &struct bucket_table |
| 413 | 516 | * @hash: the hash value / bucket index |
| 414 | 517 | * @member: name of the &struct rhash_head within the hashable struct. |
| @@ -417,9 +520,9 @@ static inline struct rhash_head __rcu **rht_bucket_insert( · 2 unmodified lines | ||
| 417 | 520 | * the _rcu mutation primitives such as rhashtable_insert() as long as the |
| 418 | 521 | * traversal is guarded by rcu_read_lock(). |
| 419 | 522 | */ |
| 420 | −#define rht_for_each_entry_rcu_continue(tpos, pos, head, tbl, hash, member) \ | |
| 523 | +#define rht_for_each_entry_rcu_from(tpos, pos, head, tbl, hash, member) \ | |
| 421 | 524 | for (({barrier(); }), \ |
| 422 | − pos = rht_dereference_bucket_rcu(head, tbl, hash); \ | |
| 525 | + pos = head; \ | |
| 423 | 526 | (!rht_is_a_nulls(pos)) && rht_entry(tpos, pos, member); \ |
| 424 | 527 | pos = rht_dereference_bucket_rcu(pos->next, tbl, hash)) |
| 425 | 528 | |
| @@ -436,8 +539,10 @@ static inline struct rhash_head __rcu **rht_bucket_insert( · 10 unmodified lines | ||
| 436 | 539 | * traversal is guarded by rcu_read_lock(). |
| 437 | 540 | */ |
| 438 | 541 | #define rht_for_each_entry_rcu(tpos, pos, tbl, hash, member) \ |
| 439 | − rht_for_each_entry_rcu_continue(tpos, pos, *rht_bucket(tbl, hash), \ | |
| 440 | − tbl, hash, member) | |
| 542 | + rht_for_each_entry_rcu_from(tpos, pos, \ | |
| 543 | + rht_ptr(rht_bucket(tbl, hash), \ | |
| 544 | + tbl, hash), \ | |
| 545 | + tbl, hash, member) | |
| 441 | 546 | |
| 442 | 547 | /** |
| 443 | 548 | * rhl_for_each_rcu - iterate over rcu hash table list |
| @@ -482,7 +587,7 @@ static inline struct rhash_head *__rhashtable_lookup( · 38 unmodified lines | ||
| 482 | 587 | .ht = ht, |
| 483 | 588 | .key = key, |
| 484 | 589 | }; |
| 485 | − struct rhash_head __rcu * const *head; | |
| 590 | + struct rhash_lock_head __rcu * const *bkt; | |
| 486 | 591 | struct bucket_table *tbl; |
| 487 | 592 | struct rhash_head *he; |
| 488 | 593 | unsigned int hash; |
| @@ -490,9 +595,9 @@ static inline struct rhash_head *__rhashtable_lookup( · 1 unmodified line | ||
| 490 | 595 | tbl = rht_dereference_rcu(ht->tbl, ht); |
| 491 | 596 | restart: |
| 492 | 597 | hash = rht_key_hashfn(ht, tbl, key, params); |
| 493 | − head = rht_bucket(tbl, hash); | |
| 598 | + bkt = rht_bucket(tbl, hash); | |
| 494 | 599 | do { |
| 495 | − rht_for_each_rcu_continue(he, *head, tbl, hash) { | |
| 600 | + rht_for_each_rcu_from(he, rht_ptr(bkt, tbl, hash), tbl, hash) { | |
| 496 | 601 | if (params.obj_cmpfn ? |
| 497 | 602 | params.obj_cmpfn(&arg, rht_obj(ht, he)) : |
| 498 | 603 | rhashtable_compare(&arg, rht_obj(ht, he))) |
| @@ -502,7 +607,7 @@ restart: · 3 unmodified lines | ||
| 502 | 607 | /* An object might have been moved to a different hash chain, |
| 503 | 608 | * while we walk along it - better check and retry. |
| 504 | 609 | */ |
| 505 | − } while (he != RHT_NULLS_MARKER(head)); | |
| 610 | + } while (he != RHT_NULLS_MARKER(bkt)); | |
| 506 | 611 | |
| 507 | 612 | /* Ensure we see any new tables. */ |
| 508 | 613 | smp_rmb(); |
| @@ -598,10 +703,10 @@ static inline void *__rhashtable_insert_fast( · 89 unmodified lines | ||
| 598 | 703 | .ht = ht, |
| 599 | 704 | .key = key, |
| 600 | 705 | }; |
| 706 | + struct rhash_lock_head __rcu **bkt; | |
| 601 | 707 | struct rhash_head __rcu **pprev; |
| 602 | 708 | struct bucket_table *tbl; |
| 603 | 709 | struct rhash_head *head; |
| 604 | − spinlock_t *lock; | |
| 605 | 710 | unsigned int hash; |
| 606 | 711 | int elasticity; |
| 607 | 712 | void *data; |
| @@ -610,23 +715,22 @@ static inline void *__rhashtable_insert_fast( · 2 unmodified lines | ||
| 610 | 715 | |
| 611 | 716 | tbl = rht_dereference_rcu(ht->tbl, ht); |
| 612 | 717 | hash = rht_head_hashfn(ht, tbl, obj, params); |
| 613 | − lock = rht_bucket_lock(tbl, hash); | |
| 614 | − spin_lock_bh(lock); | |
| 718 | + elasticity = RHT_ELASTICITY; | |
| 719 | + bkt = rht_bucket_insert(ht, tbl, hash); | |
| 720 | + data = ERR_PTR(-ENOMEM); | |
| 721 | + if (!bkt) | |
| 722 | + goto out; | |
| 723 | + pprev = NULL; | |
| 724 | + rht_lock(tbl, bkt); | |
| 615 | 725 | |
| 616 | 726 | if (unlikely(rcu_access_pointer(tbl->future_tbl))) { |
| 617 | 727 | slow_path: |
| 618 | − spin_unlock_bh(lock); | |
| 728 | + rht_unlock(tbl, bkt); | |
| 619 | 729 | rcu_read_unlock(); |
| 620 | 730 | return rhashtable_insert_slow(ht, key, obj); |
| 621 | 731 | } |
| 622 | 732 | |
| 623 | − elasticity = RHT_ELASTICITY; | |
| 624 | − pprev = rht_bucket_insert(ht, tbl, hash); | |
| 625 | − data = ERR_PTR(-ENOMEM); | |
| 626 | − if (!pprev) | |
| 627 | − goto out; | |
| 628 | − | |
| 629 | − rht_for_each_continue(head, *pprev, tbl, hash) { | |
| 733 | + rht_for_each_from(head, rht_ptr(bkt, tbl, hash), tbl, hash) { | |
| 630 | 734 | struct rhlist_head *plist; |
| 631 | 735 | struct rhlist_head *list; |
| 632 | 736 | |
| @@ -642,7 +746,7 @@ slow_path: · 9 unmodified lines | ||
| 642 | 746 | data = rht_obj(ht, head); |
| 643 | 747 | |
| 644 | 748 | if (!rhlist) |
| 645 | − goto out; | |
| 749 | + goto out_unlock; | |
| 646 | 750 | |
| 647 | 751 | |
| 648 | 752 | list = container_of(obj, struct rhlist_head, rhead); |
| @@ -651,9 +755,13 @@ slow_path: · 2 unmodified lines | ||
| 651 | 755 | RCU_INIT_POINTER(list->next, plist); |
| 652 | 756 | head = rht_dereference_bucket(head->next, tbl, hash); |
| 653 | 757 | RCU_INIT_POINTER(list->rhead.next, head); |
| 654 | − rcu_assign_pointer(*pprev, obj); | |
| 655 | − | |
| 656 | − goto good; | |
| 758 | + if (pprev) { | |
| 759 | + rcu_assign_pointer(*pprev, obj); | |
| 760 | + rht_unlock(tbl, bkt); | |
| 761 | + } else | |
| 762 | + rht_assign_unlock(tbl, bkt, obj); | |
| 763 | + data = NULL; | |
| 764 | + goto out; | |
| 657 | 765 | } |
| 658 | 766 | |
| 659 | 767 | if (elasticity <= 0) |
| @@ -661,12 +769,13 @@ slow_path: · 1 unmodified line | ||
| 661 | 769 | |
| 662 | 770 | data = ERR_PTR(-E2BIG); |
| 663 | 771 | if (unlikely(rht_grow_above_max(ht, tbl))) |
| 664 | − goto out; | |
| 772 | + goto out_unlock; | |
| 665 | 773 | |
| 666 | 774 | if (unlikely(rht_grow_above_100(ht, tbl))) |
| 667 | 775 | goto slow_path; |
| 668 | 776 | |
| 669 | − head = rht_dereference_bucket(*pprev, tbl, hash); | |
| 777 | + /* Inserting at head of list makes unlocking free. */ | |
| 778 | + head = rht_ptr(bkt, tbl, hash); | |
| 670 | 779 | |
| 671 | 780 | RCU_INIT_POINTER(obj->next, head); |
| 672 | 781 | if (rhlist) { |
| @@ -676,20 +785,21 @@ slow_path: · 3 unmodified lines | ||
| 676 | 785 | RCU_INIT_POINTER(list->next, NULL); |
| 677 | 786 | } |
| 678 | 787 | |
| 679 | − rcu_assign_pointer(*pprev, obj); | |
| 680 | − | |
| 681 | 788 | atomic_inc(&ht->nelems); |
| 789 | + rht_assign_unlock(tbl, bkt, obj); | |
| 790 | + | |
| 682 | 791 | if (rht_grow_above_75(ht, tbl)) |
| 683 | 792 | schedule_work(&ht->run_work); |
| 684 | 793 | |
| 685 | −good: | |
| 686 | 794 | data = NULL; |
| 687 | − | |
| 688 | 795 | out: |
| 689 | − spin_unlock_bh(lock); | |
| 690 | 796 | rcu_read_unlock(); |
| 691 | 797 | |
| 692 | 798 | return data; |
| 799 | + | |
| 800 | +out_unlock: | |
| 801 | + rht_unlock(tbl, bkt); | |
| 802 | + goto out; | |
| 693 | 803 | } |
| 694 | 804 | |
| 695 | 805 | /** |
| @@ -698,9 +808,9 @@ out: · 2 unmodified lines | ||
| 698 | 808 | * @obj: pointer to hash head inside object |
| 699 | 809 | * @params: hash table parameters |
| 700 | 810 | * |
| 701 | − * Will take a per bucket spinlock to protect against mutual mutations | |
| 811 | + * Will take the per bucket bitlock to protect against mutual mutations | |
| 702 | 812 | * on the same bucket. Multiple insertions may occur in parallel unless |
| 703 | − * they map to the same bucket lock. | |
| 813 | + * they map to the same bucket. | |
| 704 | 814 | * |
| 705 | 815 | * It is safe to call this function from atomic context. |
| 706 | 816 | * |
| @@ -727,9 +837,9 @@ static inline int rhashtable_insert_fast( · 20 unmodified lines | ||
| 727 | 837 | * @list: pointer to hash list head inside object |
| 728 | 838 | * @params: hash table parameters |
| 729 | 839 | * |
| 730 | − * Will take a per bucket spinlock to protect against mutual mutations | |
| 840 | + * Will take the per bucket bitlock to protect against mutual mutations | |
| 731 | 841 | * on the same bucket. Multiple insertions may occur in parallel unless |
| 732 | − * they map to the same bucket lock. | |
| 842 | + * they map to the same bucket. | |
| 733 | 843 | * |
| 734 | 844 | * It is safe to call this function from atomic context. |
| 735 | 845 | * |
| @@ -750,9 +860,9 @@ static inline int rhltable_insert_key( · 14 unmodified lines | ||
| 750 | 860 | * @list: pointer to hash list head inside object |
| 751 | 861 | * @params: hash table parameters |
| 752 | 862 | * |
| 753 | − * Will take a per bucket spinlock to protect against mutual mutations | |
| 863 | + * Will take the per bucket bitlock to protect against mutual mutations | |
| 754 | 864 | * on the same bucket. Multiple insertions may occur in parallel unless |
| 755 | − * they map to the same bucket lock. | |
| 865 | + * they map to the same bucket. | |
| 756 | 866 | * |
| 757 | 867 | * It is safe to call this function from atomic context. |
| 758 | 868 | * |
| @@ -776,12 +886,6 @@ static inline int rhltable_insert( · 17 unmodified lines | ||
| 776 | 886 | * @obj: pointer to hash head inside object |
| 777 | 887 | * @params: hash table parameters |
| 778 | 888 | * |
| 779 | − * Locks down the bucket chain in both the old and new table if a resize | |
| 780 | − * is in progress to ensure that writers can't remove from the old table | |
| 781 | − * and can't insert to the new table during the atomic operation of search | |
| 782 | − * and insertion. Searches for duplicates in both the old and new table if | |
| 783 | − * a resize is in progress. | |
| 784 | − * | |
| 785 | 889 | * This lookup function may only be used for fixed key hash table (key_len |
| 786 | 890 | * parameter set). It will BUG() if used inappropriately. |
| 787 | 891 | * |
| @@ -837,12 +941,6 @@ static inline void *rhashtable_lookup_get_insert_fast( · 49 unmodified lines | ||
| 837 | 941 | * @obj: pointer to hash head inside object |
| 838 | 942 | * @params: hash table parameters |
| 839 | 943 | * |
| 840 | − * Locks down the bucket chain in both the old and new table if a resize | |
| 841 | − * is in progress to ensure that writers can't remove from the old table | |
| 842 | − * and can't insert to the new table during the atomic operation of search | |
| 843 | − * and insertion. Searches for duplicates in both the old and new table if | |
| 844 | − * a resize is in progress. | |
| 845 | − * | |
| 846 | 944 | * Lookups may occur in parallel with hashtable mutations and resizing. |
| 847 | 945 | * |
| 848 | 946 | * Will trigger an automatic deferred table resizing if residency in the |
| @@ -891,19 +989,20 @@ static inline int __rhashtable_remove_fast_one( · 42 unmodified lines | ||
| 891 | 989 | struct rhash_head *obj, const struct rhashtable_params params, |
| 892 | 990 | bool rhlist) |
| 893 | 991 | { |
| 992 | + struct rhash_lock_head __rcu **bkt; | |
| 894 | 993 | struct rhash_head __rcu **pprev; |
| 895 | 994 | struct rhash_head *he; |
| 896 | − spinlock_t * lock; | |
| 897 | 995 | unsigned int hash; |
| 898 | 996 | int err = -ENOENT; |
| 899 | 997 | |
| 900 | 998 | hash = rht_head_hashfn(ht, tbl, obj, params); |
| 901 | − lock = rht_bucket_lock(tbl, hash); | |
| 902 | − | |
| 903 | − spin_lock_bh(lock); | |
| 999 | + bkt = rht_bucket_var(tbl, hash); | |
| 1000 | + if (!bkt) | |
| 1001 | + return -ENOENT; | |
| 1002 | + pprev = NULL; | |
| 1003 | + rht_lock(tbl, bkt); | |
| 904 | 1004 | |
| 905 | − pprev = rht_bucket_var(tbl, hash); | |
| 906 | − rht_for_each_continue(he, *pprev, tbl, hash) { | |
| 1005 | + rht_for_each_from(he, rht_ptr(bkt, tbl, hash), tbl, hash) { | |
| 907 | 1006 | struct rhlist_head *list; |
| 908 | 1007 | |
| 909 | 1008 | list = container_of(he, struct rhlist_head, rhead); |
| @@ -943,12 +1042,17 @@ static inline int __rhashtable_remove_fast_one( · 33 unmodified lines | ||
| 943 | 1042 | } |
| 944 | 1043 | } |
| 945 | 1044 | |
| 946 | − rcu_assign_pointer(*pprev, obj); | |
| 947 | − break; | |
| 1045 | + if (pprev) { | |
| 1046 | + rcu_assign_pointer(*pprev, obj); | |
| 1047 | + rht_unlock(tbl, bkt); | |
| 1048 | + } else { | |
| 1049 | + rht_assign_unlock(tbl, bkt, obj); | |
| 1050 | + } | |
| 1051 | + goto unlocked; | |
| 948 | 1052 | } |
| 949 | 1053 | |
| 950 | − spin_unlock_bh(lock); | |
| 951 | − | |
| 1054 | + rht_unlock(tbl, bkt); | |
| 1055 | +unlocked: | |
| 952 | 1056 | if (err > 0) { |
| 953 | 1057 | atomic_dec(&ht->nelems); |
| 954 | 1058 | if (unlikely(ht->p.automatic_shrinking && |
| @@ -1037,9 +1141,9 @@ static inline int __rhashtable_replace_fast( · 82 unmodified lines | ||
| 1037 | 1141 | struct rhash_head *obj_old, struct rhash_head *obj_new, |
| 1038 | 1142 | const struct rhashtable_params params) |
| 1039 | 1143 | { |
| 1144 | + struct rhash_lock_head __rcu **bkt; | |
| 1040 | 1145 | struct rhash_head __rcu **pprev; |
| 1041 | 1146 | struct rhash_head *he; |
| 1042 | − spinlock_t *lock; | |
| 1043 | 1147 | unsigned int hash; |
| 1044 | 1148 | int err = -ENOENT; |
| 1045 | 1149 | |
| @@ -1050,25 +1154,33 @@ static inline int __rhashtable_replace_fast( · 4 unmodified lines | ||
| 1050 | 1154 | if (hash != rht_head_hashfn(ht, tbl, obj_new, params)) |
| 1051 | 1155 | return -EINVAL; |
| 1052 | 1156 | |
| 1053 | − lock = rht_bucket_lock(tbl, hash); | |
| 1157 | + bkt = rht_bucket_var(tbl, hash); | |
| 1158 | + if (!bkt) | |
| 1159 | + return -ENOENT; | |
| 1054 | 1160 | |
| 1055 | − spin_lock_bh(lock); | |
| 1161 | + pprev = NULL; | |
| 1162 | + rht_lock(tbl, bkt); | |
| 1056 | 1163 | |
| 1057 | − pprev = rht_bucket_var(tbl, hash); | |
| 1058 | − rht_for_each_continue(he, *pprev, tbl, hash) { | |
| 1164 | + rht_for_each_from(he, rht_ptr(bkt, tbl, hash), tbl, hash) { | |
| 1059 | 1165 | if (he != obj_old) { |
| 1060 | 1166 | pprev = &he->next; |
| 1061 | 1167 | continue; |
| 1062 | 1168 | } |
| 1063 | 1169 | |
| 1064 | 1170 | rcu_assign_pointer(obj_new->next, obj_old->next); |
| 1065 | − rcu_assign_pointer(*pprev, obj_new); | |
| 1171 | + if (pprev) { | |
| 1172 | + rcu_assign_pointer(*pprev, obj_new); | |
| 1173 | + rht_unlock(tbl, bkt); | |
| 1174 | + } else { | |
| 1175 | + rht_assign_unlock(tbl, bkt, obj_new); | |
| 1176 | + } | |
| 1066 | 1177 | err = 0; |
| 1067 | − break; | |
| 1178 | + goto unlocked; | |
| 1068 | 1179 | } |
| 1069 | 1180 | |
| 1070 | − spin_unlock_bh(lock); | |
| 1181 | + rht_unlock(tbl, bkt); | |
| 1071 | 1182 | |
| 1183 | +unlocked: | |
| 1072 | 1184 | return err; |
| 1073 | 1185 | } |
| 1074 | 1186 | |
| @@ -79,8 +79,6 @@ struct rtc_class_ops { · 78 unmodified lines | ||
| 79 | 79 | int (*read_alarm)(struct device *, struct rtc_wkalrm *); |
| 80 | 80 | int (*set_alarm)(struct device *, struct rtc_wkalrm *); |
| 81 | 81 | int (*proc)(struct device *, struct seq_file *); |
| 82 | − int (*set_mmss64)(struct device *, time64_t secs); | |
| 83 | − int (*set_mmss)(struct device *, unsigned long secs); | |
| 84 | 82 | int (*alarm_irq_enable)(struct device *, unsigned int enabled); |
| 85 | 83 | int (*read_offset)(struct device *, long *offset); |
| 86 | 84 | int (*set_offset)(struct device *, long offset); |
| @@ -162,9 +160,11 @@ struct rtc_device { · 75 unmodified lines | ||
| 162 | 160 | #define to_rtc_device(d) container_of(d, struct rtc_device, dev) |
| 163 | 161 | |
| 164 | 162 | /* useful timestamps */ |
| 165 | −#define RTC_TIMESTAMP_BEGIN_1900 -2208989361LL /* 1900-01-01 00:00:00 */ | |
| 163 | +#define RTC_TIMESTAMP_BEGIN_1900 -2208988800LL /* 1900-01-01 00:00:00 */ | |
| 166 | 164 | #define RTC_TIMESTAMP_BEGIN_2000 946684800LL /* 2000-01-01 00:00:00 */ |
| 165 | +#define RTC_TIMESTAMP_END_2063 2966371199LL /* 2063-12-31 23:59:59 */ | |
| 167 | 166 | #define RTC_TIMESTAMP_END_2099 4102444799LL /* 2099-12-31 23:59:59 */ |
| 167 | +#define RTC_TIMESTAMP_END_9999 253402300799LL /* 9999-12-31 23:59:59 */ | |
| 168 | 168 | |
| 169 | 169 | extern struct rtc_device *devm_rtc_device_register(struct device *dev, |
| 170 | 170 | const char *name, |
| @@ -48,8 +48,6 @@ struct ds1685_priv { · 47 unmodified lines | ||
| 48 | 48 | u32 regstep; |
| 49 | 49 | resource_size_t baseaddr; |
| 50 | 50 | size_t size; |
| 51 | − spinlock_t lock; | |
| 52 | − struct work_struct work; | |
| 53 | 51 | int irq_num; |
| 54 | 52 | bool bcd_mode; |
| 55 | 53 | bool no_irq; |
| @@ -0,0 +1,7 @@ | ||
| 1 | +/* SPDX-License-Identifier: GPL-2.0 */ | |
| 2 | + | |
| 3 | +#ifndef _LINUX_RTCOMAP_H_ | |
| 4 | +#define _LINUX_RTCOMAP_H_ | |
| 5 | + | |
| 6 | +int omap_rtc_power_off_program(struct device *dev); | |
| 7 | +#endif /* _LINUX_RTCOMAP_H_ */ | |
| @@ -1,47 +0,0 @@ | ||
| 1 | −/* SPDX-License-Identifier: GPL-2.0 */ | |
| 2 | −/* rwsem-spinlock.h: fallback C implementation | |
| 3 | − * | |
| 4 | − * Copyright (c) 2001 David Howells (dhowells@redhat.com). | |
| 5 | − * - Derived partially from ideas by Andrea Arcangeli <andrea@suse.de> | |
| 6 | − * - Derived also from comments by Linus | |
| 7 | − */ | |
| 8 | − | |
| 9 | −#ifndef _LINUX_RWSEM_SPINLOCK_H | |
| 10 | −#define _LINUX_RWSEM_SPINLOCK_H | |
| 11 | − | |
| 12 | −#ifndef _LINUX_RWSEM_H | |
| 13 | −#error "please don't include linux/rwsem-spinlock.h directly, use linux/rwsem.h instead" | |
| 14 | −#endif | |
| 15 | − | |
| 16 | −#ifdef __KERNEL__ | |
| 17 | −/* | |
| 18 | − * the rw-semaphore definition | |
| 19 | − * - if count is 0 then there are no active readers or writers | |
| 20 | − * - if count is +ve then that is the number of active readers | |
| 21 | − * - if count is -1 then there is one active writer | |
| 22 | − * - if wait_list is not empty, then there are processes waiting for the semaphore | |
| 23 | − */ | |
| 24 | −struct rw_semaphore { | |
| 25 | − __s32 count; | |
| 26 | − raw_spinlock_t wait_lock; | |
| 27 | − struct list_head wait_list; | |
| 28 | −#ifdef CONFIG_DEBUG_LOCK_ALLOC | |
| 29 | − struct lockdep_map dep_map; | |
| 30 | −#endif | |
| 31 | −}; | |
| 32 | − | |
| 33 | −#define RWSEM_UNLOCKED_VALUE 0x00000000 | |
| 34 | − | |
| 35 | −extern void __down_read(struct rw_semaphore *sem); | |
| 36 | −extern int __must_check __down_read_killable(struct rw_semaphore *sem); | |
| 37 | −extern int __down_read_trylock(struct rw_semaphore *sem); | |
| 38 | −extern void __down_write(struct rw_semaphore *sem); | |
| 39 | −extern int __must_check __down_write_killable(struct rw_semaphore *sem); | |
| 40 | −extern int __down_write_trylock(struct rw_semaphore *sem); | |
| 41 | −extern void __up_read(struct rw_semaphore *sem); | |
| 42 | −extern void __up_write(struct rw_semaphore *sem); | |
| 43 | −extern void __downgrade_write(struct rw_semaphore *sem); | |
| 44 | −extern int rwsem_is_locked(struct rw_semaphore *sem); | |
| 45 | − | |
| 46 | −#endif /* __KERNEL__ */ | |
| 47 | −#endif /* _LINUX_RWSEM_SPINLOCK_H */ | |
| @@ -20,25 +20,30 @@ · 19 unmodified lines | ||
| 20 | 20 | #include <linux/osq_lock.h> |
| 21 | 21 | #endif |
| 22 | 22 | |
| 23 | −struct rw_semaphore; | |
| 24 | − | |
| 25 | −#ifdef CONFIG_RWSEM_GENERIC_SPINLOCK | |
| 26 | −#include <linux/rwsem-spinlock.h> /* use a generic implementation */ | |
| 27 | −#define __RWSEM_INIT_COUNT(name) .count = RWSEM_UNLOCKED_VALUE | |
| 28 | −#else | |
| 29 | −/* All arch specific implementations share the same struct */ | |
| 23 | +/* | |
| 24 | + * For an uncontended rwsem, count and owner are the only fields a task | |
| 25 | + * needs to touch when acquiring the rwsem. So they are put next to each | |
| 26 | + * other to increase the chance that they will share the same cacheline. | |
| 27 | + * | |
| 28 | + * In a contended rwsem, the owner is likely the most frequently accessed | |
| 29 | + * field in the structure as the optimistic waiter that holds the osq lock | |
| 30 | + * will spin on owner. For an embedded rwsem, other hot fields in the | |
| 31 | + * containing structure should be moved further away from the rwsem to | |
| 32 | + * reduce the chance that they will share the same cacheline causing | |
| 33 | + * cacheline bouncing problem. | |
| 34 | + */ | |
| 30 | 35 | struct rw_semaphore { |
| 31 | 36 | atomic_long_t count; |
| 32 | − struct list_head wait_list; | |
| 33 | − raw_spinlock_t wait_lock; | |
| 34 | 37 | #ifdef CONFIG_RWSEM_SPIN_ON_OWNER |
| 35 | − struct optimistic_spin_queue osq; /* spinner MCS lock */ | |
| 36 | 38 | /* |
| 37 | 39 | * Write owner. Used as a speculative check to see |
| 38 | 40 | * if the owner is running on the cpu. |
| 39 | 41 | */ |
| 40 | 42 | struct task_struct *owner; |
| 43 | + struct optimistic_spin_queue osq; /* spinner MCS lock */ | |
| 41 | 44 | #endif |
| 45 | + raw_spinlock_t wait_lock; | |
| 46 | + struct list_head wait_list; | |
| 42 | 47 | #ifdef CONFIG_DEBUG_LOCK_ALLOC |
| 43 | 48 | struct lockdep_map dep_map; |
| 44 | 49 | #endif |
| @@ -50,24 +55,14 @@ struct rw_semaphore { · 5 unmodified lines | ||
| 50 | 55 | */ |
| 51 | 56 | #define RWSEM_OWNER_UNKNOWN ((struct task_struct *)-2L) |
| 52 | 57 | |
| 53 | −extern struct rw_semaphore *rwsem_down_read_failed(struct rw_semaphore *sem); | |
| 54 | −extern struct rw_semaphore *rwsem_down_read_failed_killable(struct rw_semaphore *sem); | |
| 55 | −extern struct rw_semaphore *rwsem_down_write_failed(struct rw_semaphore *sem); | |
| 56 | −extern struct rw_semaphore *rwsem_down_write_failed_killable(struct rw_semaphore *sem); | |
| 57 | −extern struct rw_semaphore *rwsem_wake(struct rw_semaphore *); | |
| 58 | −extern struct rw_semaphore *rwsem_downgrade_wake(struct rw_semaphore *sem); | |
| 59 | − | |
| 60 | −/* Include the arch specific part */ | |
| 61 | −#include <asm/rwsem.h> | |
| 62 | − | |
| 63 | 58 | /* In all implementations count != 0 means locked */ |
| 64 | 59 | static inline int rwsem_is_locked(struct rw_semaphore *sem) |
| 65 | 60 | { |
| 66 | 61 | return atomic_long_read(&sem->count) != 0; |
| 67 | 62 | } |
| 68 | 63 | |
| 64 | +#define RWSEM_UNLOCKED_VALUE 0L | |
| 69 | 65 | #define __RWSEM_INIT_COUNT(name) .count = ATOMIC_LONG_INIT(RWSEM_UNLOCKED_VALUE) |
| 70 | −#endif | |
| 71 | 66 | |
| 72 | 67 | /* Common initializer macros and functions */ |
| 73 | 68 | |
| @@ -340,11 +340,11 @@ int sg_alloc_table_chained(struct sg_table *table, int nents, · 339 unmodified lines | ||
| 340 | 340 | * sg page iterator |
| 341 | 341 | * |
| 342 | 342 | * Iterates over sg entries page-by-page. On each successful iteration, you |
| 343 | − * can call sg_page_iter_page(@piter) to get the current page and its dma | |
| 344 | − * address. @piter->sg will point to the sg holding this page and | |
| 345 | − * @piter->sg_pgoffset to the page's page offset within the sg. The iteration | |
| 346 | − * will stop either when a maximum number of sg entries was reached or a | |
| 347 | − * terminating sg (sg_last(sg) == true) was reached. | |
| 343 | + * can call sg_page_iter_page(@piter) to get the current page. | |
| 344 | + * @piter->sg will point to the sg holding this page and @piter->sg_pgoffset to | |
| 345 | + * the page's page offset within the sg. The iteration will stop either when a | |
| 346 | + * maximum number of sg entries was reached or a terminating sg | |
| 347 | + * (sg_last(sg) == true) was reached. | |
| 348 | 348 | */ |
| 349 | 349 | struct sg_page_iter { |
| 350 | 350 | struct scatterlist *sg; /* sg holding the page */ |
| @@ -26,7 +26,6 @@ · 25 unmodified lines | ||
| 26 | 26 | #include <linux/latencytop.h> |
| 27 | 27 | #include <linux/sched/prio.h> |
| 28 | 28 | #include <linux/signal_types.h> |
| 29 | −#include <linux/psi_types.h> | |
| 30 | 29 | #include <linux/mm_types_task.h> |
| 31 | 30 | #include <linux/task_io_accounting.h> |
| 32 | 31 | #include <linux/rseq.h> |
| @@ -726,6 +725,8 @@ struct task_struct { · 693 unmodified lines | ||
| 726 | 725 | #ifdef CONFIG_CGROUPS |
| 727 | 726 | /* disallow userland-initiated cgroup migration */ |
| 728 | 727 | unsigned no_cgroup_migration:1; |
| 728 | + /* task is frozen/stopped (used by the cgroup freezer) */ | |
| 729 | + unsigned frozen:1; | |
| 729 | 730 | #endif |
| 730 | 731 | #ifdef CONFIG_BLK_CGROUP |
| 731 | 732 | /* to be used once the psi infrastructure lands upstream. */ |
| @@ -1057,7 +1058,6 @@ struct task_struct { · 325 unmodified lines | ||
| 1057 | 1058 | |
| 1058 | 1059 | #ifdef CONFIG_RSEQ |
| 1059 | 1060 | struct rseq __user *rseq; |
| 1060 | − u32 rseq_len; | |
| 1061 | 1061 | u32 rseq_sig; |
| 1062 | 1062 | /* |
| 1063 | 1063 | * RmW on rseq_event_mask must be performed atomically |
| @@ -1855,12 +1855,10 @@ static inline void rseq_fork(struct task_struct *t, unsigned long clone_flags) · 791 unmodified lines | ||
| 1855 | 1855 | { |
| 1856 | 1856 | if (clone_flags & CLONE_THREAD) { |
| 1857 | 1857 | t->rseq = NULL; |
| 1858 | − t->rseq_len = 0; | |
| 1859 | 1858 | t->rseq_sig = 0; |
| 1860 | 1859 | t->rseq_event_mask = 0; |
| 1861 | 1860 | } else { |
| 1862 | 1861 | t->rseq = current->rseq; |
| 1863 | − t->rseq_len = current->rseq_len; | |
| 1864 | 1862 | t->rseq_sig = current->rseq_sig; |
| 1865 | 1863 | t->rseq_event_mask = current->rseq_event_mask; |
| 1866 | 1864 | } |
| @@ -1869,7 +1867,6 @@ static inline void rseq_fork(struct task_struct *t, unsigned long clone_flags) · 2 unmodified lines | ||
| 1869 | 1867 | static inline void rseq_execve(struct task_struct *t) |
| 1870 | 1868 | { |
| 1871 | 1869 | t->rseq = NULL; |
| 1872 | − t->rseq_len = 0; | |
| 1873 | 1870 | t->rseq_sig = 0; |
| 1874 | 1871 | t->rseq_event_mask = 0; |
| 1875 | 1872 | } |
| @@ -18,6 +18,7 @@ struct task_struct; · 17 unmodified lines | ||
| 18 | 18 | #define JOBCTL_TRAP_NOTIFY_BIT 20 /* trap for NOTIFY */ |
| 19 | 19 | #define JOBCTL_TRAPPING_BIT 21 /* switching to TRACED */ |
| 20 | 20 | #define JOBCTL_LISTENING_BIT 22 /* ptracer is listening for events */ |
| 21 | +#define JOBCTL_TRAP_FREEZE_BIT 23 /* trap for cgroup freezer */ | |
| 21 | 22 | |
| 22 | 23 | #define JOBCTL_STOP_DEQUEUED (1UL << JOBCTL_STOP_DEQUEUED_BIT) |
| 23 | 24 | #define JOBCTL_STOP_PENDING (1UL << JOBCTL_STOP_PENDING_BIT) |
| @@ -26,6 +27,7 @@ struct task_struct; · 2 unmodified lines | ||
| 26 | 27 | #define JOBCTL_TRAP_NOTIFY (1UL << JOBCTL_TRAP_NOTIFY_BIT) |
| 27 | 28 | #define JOBCTL_TRAPPING (1UL << JOBCTL_TRAPPING_BIT) |
| 28 | 29 | #define JOBCTL_LISTENING (1UL << JOBCTL_LISTENING_BIT) |
| 30 | +#define JOBCTL_TRAP_FREEZE (1UL << JOBCTL_TRAP_FREEZE_BIT) | |
| 29 | 31 | |
| 30 | 32 | #define JOBCTL_TRAP_MASK (JOBCTL_TRAP_STOP | JOBCTL_TRAP_NOTIFY) |
| 31 | 33 | #define JOBCTL_PENDING_MASK (JOBCTL_STOP_PENDING | JOBCTL_TRAP_MASK) |
| @@ -49,6 +49,27 @@ static inline void mmdrop(struct mm_struct *mm) · 48 unmodified lines | ||
| 49 | 49 | __mmdrop(mm); |
| 50 | 50 | } |
| 51 | 51 | |
| 52 | +/* | |
| 53 | + * This has to be called after a get_task_mm()/mmget_not_zero() | |
| 54 | + * followed by taking the mmap_sem for writing before modifying the | |
| 55 | + * vmas or anything the coredump pretends not to change from under it. | |
| 56 | + * | |
| 57 | + * NOTE: find_extend_vma() called from GUP context is the only place | |
| 58 | + * that can modify the "mm" (notably the vm_start/end) under mmap_sem | |
| 59 | + * for reading and outside the context of the process, so it is also | |
| 60 | + * the only case that holds the mmap_sem for reading that must call | |
| 61 | + * this function. Generally if the mmap_sem is hold for reading | |
| 62 | + * there's no need of this check after get_task_mm()/mmget_not_zero(). | |
| 63 | + * | |
| 64 | + * This function can be obsoleted and the check can be removed, after | |
| 65 | + * the coredump code will hold the mmap_sem for writing before | |
| 66 | + * invoking the ->core_dump methods. | |
| 67 | + */ | |
| 68 | +static inline bool mmget_still_valid(struct mm_struct *mm) | |
| 69 | +{ | |
| 70 | + return likely(!mm->core_state); | |
| 71 | +} | |
| 72 | + | |
| 52 | 73 | /** |
| 53 | 74 | * mmget() - Pin the address space associated with a &struct mm_struct. |
| 54 | 75 | * @mm: The address space to pin. |
| @@ -271,17 +271,18 @@ static inline int signal_group_exit(const struct signal_struct *sig) · 270 unmodified lines | ||
| 271 | 271 | extern void flush_signals(struct task_struct *); |
| 272 | 272 | extern void ignore_signals(struct task_struct *); |
| 273 | 273 | extern void flush_signal_handlers(struct task_struct *, int force_default); |
| 274 | −extern int dequeue_signal(struct task_struct *tsk, sigset_t *mask, kernel_siginfo_t *info); | |
| 274 | +extern int dequeue_signal(struct task_struct *task, | |
| 275 | + sigset_t *mask, kernel_siginfo_t *info); | |
| 275 | 276 | |
| 276 | 277 | static inline int kernel_dequeue_signal(void) |
| 277 | 278 | { |
| 278 | − struct task_struct *tsk = current; | |
| 279 | + struct task_struct *task = current; | |
| 279 | 280 | kernel_siginfo_t __info; |
| 280 | 281 | int ret; |
| 281 | 282 | |
| 282 | − spin_lock_irq(&tsk->sighand->siglock); | |
| 283 | − ret = dequeue_signal(tsk, &tsk->blocked, &__info); | |
| 284 | − spin_unlock_irq(&tsk->sighand->siglock); | |
| 283 | + spin_lock_irq(&task->sighand->siglock); | |
| 284 | + ret = dequeue_signal(task, &task->blocked, &__info); | |
| 285 | + spin_unlock_irq(&task->sighand->siglock); | |
| 285 | 286 | |
| 286 | 287 | return ret; |
| 287 | 288 | } |
| @@ -419,18 +420,18 @@ static inline void set_restore_sigmask(void) · 131 unmodified lines | ||
| 419 | 420 | WARN_ON(!test_thread_flag(TIF_SIGPENDING)); |
| 420 | 421 | } |
| 421 | 422 | |
| 422 | −static inline void clear_tsk_restore_sigmask(struct task_struct *tsk) | |
| 423 | +static inline void clear_tsk_restore_sigmask(struct task_struct *task) | |
| 423 | 424 | { |
| 424 | − clear_tsk_thread_flag(tsk, TIF_RESTORE_SIGMASK); | |
| 425 | + clear_tsk_thread_flag(task, TIF_RESTORE_SIGMASK); | |
| 425 | 426 | } |
| 426 | 427 | |
| 427 | 428 | static inline void clear_restore_sigmask(void) |
| 428 | 429 | { |
| 429 | 430 | clear_thread_flag(TIF_RESTORE_SIGMASK); |
| 430 | 431 | } |
| 431 | −static inline bool test_tsk_restore_sigmask(struct task_struct *tsk) | |
| 432 | +static inline bool test_tsk_restore_sigmask(struct task_struct *task) | |
| 432 | 433 | { |
| 433 | − return test_tsk_thread_flag(tsk, TIF_RESTORE_SIGMASK); | |
| 434 | + return test_tsk_thread_flag(task, TIF_RESTORE_SIGMASK); | |
| 434 | 435 | } |
| 435 | 436 | static inline bool test_restore_sigmask(void) |
| 436 | 437 | { |
| @@ -449,9 +450,9 @@ static inline void set_restore_sigmask(void) · 12 unmodified lines | ||
| 449 | 450 | current->restore_sigmask = true; |
| 450 | 451 | WARN_ON(!test_thread_flag(TIF_SIGPENDING)); |
| 451 | 452 | } |
| 452 | −static inline void clear_tsk_restore_sigmask(struct task_struct *tsk) | |
| 453 | +static inline void clear_tsk_restore_sigmask(struct task_struct *task) | |
| 453 | 454 | { |
| 454 | − tsk->restore_sigmask = false; | |
| 455 | + task->restore_sigmask = false; | |
| 455 | 456 | } |
| 456 | 457 | static inline void clear_restore_sigmask(void) |
| 457 | 458 | { |
| @@ -461,9 +462,9 @@ static inline bool test_restore_sigmask(void) · 3 unmodified lines | ||
| 461 | 462 | { |
| 462 | 463 | return current->restore_sigmask; |
| 463 | 464 | } |
| 464 | −static inline bool test_tsk_restore_sigmask(struct task_struct *tsk) | |
| 465 | +static inline bool test_tsk_restore_sigmask(struct task_struct *task) | |
| 465 | 466 | { |
| 466 | − return tsk->restore_sigmask; | |
| 467 | + return task->restore_sigmask; | |
| 467 | 468 | } |
| 468 | 469 | static inline bool test_and_clear_restore_sigmask(void) |
| 469 | 470 | { |
| @@ -617,9 +618,9 @@ static inline struct pid *task_session(struct task_struct *task) · 147 unmodified lines | ||
| 617 | 618 | return task->signal->pids[PIDTYPE_SID]; |
| 618 | 619 | } |
| 619 | 620 | |
| 620 | −static inline int get_nr_threads(struct task_struct *tsk) | |
| 621 | +static inline int get_nr_threads(struct task_struct *task) | |
| 621 | 622 | { |
| 622 | − return tsk->signal->nr_threads; | |
| 623 | + return task->signal->nr_threads; | |
| 623 | 624 | } |
| 624 | 625 | |
| 625 | 626 | static inline bool thread_group_leader(struct task_struct *p) |
| @@ -658,35 +659,35 @@ static inline int thread_group_empty(struct task_struct *p) · 32 unmodified lines | ||
| 658 | 659 | #define delay_group_leader(p) \ |
| 659 | 660 | (thread_group_leader(p) && !thread_group_empty(p)) |
| 660 | 661 | |
| 661 | −extern struct sighand_struct *__lock_task_sighand(struct task_struct *tsk, | |
| 662 | +extern struct sighand_struct *__lock_task_sighand(struct task_struct *task, | |
| 662 | 663 | unsigned long *flags); |
| 663 | 664 | |
| 664 | −static inline struct sighand_struct *lock_task_sighand(struct task_struct *tsk, | |
| 665 | +static inline struct sighand_struct *lock_task_sighand(struct task_struct *task, | |
| 665 | 666 | unsigned long *flags) |
| 666 | 667 | { |
| 667 | 668 | struct sighand_struct *ret; |
| 668 | 669 | |
| 669 | − ret = __lock_task_sighand(tsk, flags); | |
| 670 | − (void)__cond_lock(&tsk->sighand->siglock, ret); | |
| 670 | + ret = __lock_task_sighand(task, flags); | |
| 671 | + (void)__cond_lock(&task->sighand->siglock, ret); | |
| 671 | 672 | return ret; |
| 672 | 673 | } |
| 673 | 674 | |
| 674 | −static inline void unlock_task_sighand(struct task_struct *tsk, | |
| 675 | +static inline void unlock_task_sighand(struct task_struct *task, | |
| 675 | 676 | unsigned long *flags) |
| 676 | 677 | { |
| 677 | − spin_unlock_irqrestore(&tsk->sighand->siglock, *flags); | |
| 678 | + spin_unlock_irqrestore(&task->sighand->siglock, *flags); | |
| 678 | 679 | } |
| 679 | 680 | |
| 680 | −static inline unsigned long task_rlimit(const struct task_struct *tsk, | |
| 681 | +static inline unsigned long task_rlimit(const struct task_struct *task, | |
| 681 | 682 | unsigned int limit) |
| 682 | 683 | { |
| 683 | − return READ_ONCE(tsk->signal->rlim[limit].rlim_cur); | |
| 684 | + return READ_ONCE(task->signal->rlim[limit].rlim_cur); | |
| 684 | 685 | } |
| 685 | 686 | |
| 686 | −static inline unsigned long task_rlimit_max(const struct task_struct *tsk, | |
| 687 | +static inline unsigned long task_rlimit_max(const struct task_struct *task, | |
| 687 | 688 | unsigned int limit) |
| 688 | 689 | { |
| 689 | − return READ_ONCE(tsk->signal->rlim[limit].rlim_max); | |
| 690 | + return READ_ONCE(task->signal->rlim[limit].rlim_max); | |
| 690 | 691 | } |
| 691 | 692 | |
| 692 | 693 | static inline unsigned long rlimit(unsigned int limit) |
| @@ -76,6 +76,7 @@ extern void exit_itimers(struct signal_struct *); · 75 unmodified lines | ||
| 76 | 76 | extern long _do_fork(unsigned long, unsigned long, unsigned long, int __user *, int __user *, unsigned long); |
| 77 | 77 | extern long do_fork(unsigned long, unsigned long, unsigned long, int __user *, int __user *); |
| 78 | 78 | struct task_struct *fork_idle(int); |
| 79 | +struct mm_struct *copy_init_mm(void); | |
| 79 | 80 | extern pid_t kernel_thread(int (*fn)(void *), void *arg, unsigned long flags); |
| 80 | 81 | extern long kernel_wait4(pid_t, int __user *, int, struct rusage *); |
| 81 | 82 | |
| @@ -76,8 +76,8 @@ struct sched_domain_shared { · 75 unmodified lines | ||
| 76 | 76 | |
| 77 | 77 | struct sched_domain { |
| 78 | 78 | /* These fields must be setup */ |
| 79 | − struct sched_domain *parent; /* top domain must be null terminated */ | |
| 80 | − struct sched_domain *child; /* bottom domain must be null terminated */ | |
| 79 | + struct sched_domain __rcu *parent; /* top domain must be null terminated */ | |
| 80 | + struct sched_domain __rcu *child; /* bottom domain must be null terminated */ | |
| 81 | 81 | struct sched_group *groups; /* the balancing groups of the domain */ |
| 82 | 82 | unsigned long min_interval; /* Minimum balance interval ms */ |
| 83 | 83 | unsigned long max_interval; /* Maximum balance interval ms */ |
| @@ -31,6 +31,13 @@ struct user_struct { · 30 unmodified lines | ||
| 31 | 31 | atomic_long_t pipe_bufs; /* how many pages are allocated in pipe buffers */ |
| 32 | 32 | |
| 33 | 33 | #ifdef CONFIG_KEYS |
| 34 | + /* | |
| 35 | + * These pointers can only change from NULL to a non-NULL value once. | |
| 36 | + * Writes are protected by key_user_keyring_mutex. | |
| 37 | + * Unlocked readers should use READ_ONCE() unless they know that | |
| 38 | + * install_user_keyrings() has been called successfully (which sets | |
| 39 | + * these members to non-NULL values, preventing further modifications). | |
| 40 | + */ | |
| 34 | 41 | struct key *uid_keyring; /* UID specific keyring */ |
| 35 | 42 | struct key *session_keyring; /* UID's default session keyring */ |
| 36 | 43 | #endif |
| @@ -51,6 +51,7 @@ struct fown_struct; · 50 unmodified lines | ||
| 51 | 51 | struct file_operations; |
| 52 | 52 | struct msg_msg; |
| 53 | 53 | struct xattr; |
| 54 | +struct kernfs_node; | |
| 54 | 55 | struct xfrm_sec_ctx; |
| 55 | 56 | struct mm_struct; |
| 56 | 57 | struct fs_context; |
| @@ -250,6 +251,7 @@ int security_sb_clone_mnt_opts(const struct super_block *oldsb, · 193 unmodified lines | ||
| 250 | 251 | unsigned long *set_kern_flags); |
| 251 | 252 | int security_add_mnt_opt(const char *option, const char *val, |
| 252 | 253 | int len, void **mnt_opts); |
| 254 | +int security_move_mount(const struct path *from_path, const struct path *to_path); | |
| 253 | 255 | int security_dentry_init_security(struct dentry *dentry, int mode, |
| 254 | 256 | const struct qstr *name, void **ctx, |
| 255 | 257 | u32 *ctxlen); |
| @@ -299,6 +301,8 @@ int security_inode_listsecurity(struct inode *inode, char *buffer, size_t buffer · 43 unmodified lines | ||
| 299 | 301 | void security_inode_getsecid(struct inode *inode, u32 *secid); |
| 300 | 302 | int security_inode_copy_up(struct dentry *src, struct cred **new); |
| 301 | 303 | int security_inode_copy_up_xattr(const char *name); |
| 304 | +int security_kernfs_init_security(struct kernfs_node *kn_dir, | |
| 305 | + struct kernfs_node *kn); | |
| 302 | 306 | int security_file_permission(struct file *file, int mask); |
| 303 | 307 | int security_file_alloc(struct file *file); |
| 304 | 308 | void security_file_free(struct file *file); |
| @@ -611,6 +615,12 @@ static inline int security_add_mnt_opt(const char *option, const char *val, · 306 unmodified lines | ||
| 611 | 615 | return 0; |
| 612 | 616 | } |
| 613 | 617 | |
| 618 | +static inline int security_move_mount(const struct path *from_path, | |
| 619 | + const struct path *to_path) | |
| 620 | +{ | |
| 621 | + return 0; | |
| 622 | +} | |
| 623 | + | |
| 614 | 624 | static inline int security_inode_alloc(struct inode *inode) |
| 615 | 625 | { |
| 616 | 626 | return 0; |
| @@ -801,6 +811,12 @@ static inline int security_inode_copy_up(struct dentry *src, struct cred **new) · 184 unmodified lines | ||
| 801 | 811 | return 0; |
| 802 | 812 | } |
| 803 | 813 | |
| 814 | +static inline int security_kernfs_init_security(struct kernfs_node *kn_dir, | |
| 815 | + struct kernfs_node *kn) | |
| 816 | +{ | |
| 817 | + return 0; | |
| 818 | +} | |
| 819 | + | |
| 804 | 820 | static inline int security_inode_copy_up_xattr(const char *name) |
| 805 | 821 | { |
| 806 | 822 | return -EOPNOTSUPP; |
| @@ -1,18 +1,10 @@ | ||
| 1 | +/* SPDX-License-Identifier: GPL-2.0 */ | |
| 1 | 2 | /* |
| 2 | 3 | * Copyright © 2016 Intel Corporation |
| 3 | 4 | * |
| 4 | 5 | * Authors: |
| 5 | 6 | * Rafael Antognolli <rafael.antognolli@intel.com> |
| 6 | 7 | * Scott Bauer <scott.bauer@intel.com> |
| 7 | − * | |
| 8 | − * This program is free software; you can redistribute it and/or modify it | |
| 9 | − * under the terms and conditions of the GNU General Public License, | |
| 10 | − * version 2, as published by the Free Software Foundation. | |
| 11 | − * | |
| 12 | − * This program is distributed in the hope it will be useful, but WITHOUT | |
| 13 | − * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |
| 14 | − * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for | |
| 15 | − * more details. | |
| 16 | 8 | */ |
| 17 | 9 | |
| 18 | 10 | #ifndef LINUX_OPAL_H |
| @@ -11,13 +11,14 @@ · 10 unmodified lines | ||
| 11 | 11 | #include <linux/tiocl.h> |
| 12 | 12 | #include <linux/vt_buffer.h> |
| 13 | 13 | |
| 14 | −struct tty_struct; | |
| 15 | − | |
| 16 | 14 | extern struct vc_data *sel_cons; |
| 17 | 15 | struct tty_struct; |
| 18 | 16 | |
| 19 | 17 | extern void clear_selection(void); |
| 20 | −extern int set_selection(const struct tiocl_selection __user *sel, struct tty_struct *tty); | |
| 18 | +extern int set_selection_user(const struct tiocl_selection __user *sel, | |
| 19 | + struct tty_struct *tty); | |
| 20 | +extern int set_selection_kernel(struct tiocl_selection *v, | |
| 21 | + struct tty_struct *tty); | |
| 21 | 22 | extern int paste_selection(struct tty_struct *tty); |
| 22 | 23 | extern int sel_loadlut(char __user *p); |
| 23 | 24 | extern int mouse_reporting(void); |
| @@ -45,7 +45,7 @@ struct device; · 44 unmodified lines | ||
| 45 | 45 | |
| 46 | 46 | /* |
| 47 | 47 | * This structure describes all the operations that can be done on the |
| 48 | − * physical hardware. See Documentation/serial/driver for details. | |
| 48 | + * physical hardware. See Documentation/serial/driver.rst for details. | |
| 49 | 49 | */ |
| 50 | 50 | struct uart_ops { |
| 51 | 51 | unsigned int (*tx_empty)(struct uart_port *); |
| @@ -17,6 +17,17 @@ static inline int set_memory_x(unsigned long addr, int numpages) { return 0; } · 16 unmodified lines | ||
| 17 | 17 | static inline int set_memory_nx(unsigned long addr, int numpages) { return 0; } |
| 18 | 18 | #endif |
| 19 | 19 | |
| 20 | +#ifndef CONFIG_ARCH_HAS_SET_DIRECT_MAP | |
| 21 | +static inline int set_direct_map_invalid_noflush(struct page *page) | |
| 22 | +{ | |
| 23 | + return 0; | |
| 24 | +} | |
| 25 | +static inline int set_direct_map_default_noflush(struct page *page) | |
| 26 | +{ | |
| 27 | + return 0; | |
| 28 | +} | |
| 29 | +#endif | |
| 30 | + | |
| 20 | 31 | #ifndef set_mce_nospec |
| 21 | 32 | static inline int set_mce_nospec(unsigned long pfn) |
| 22 | 33 | { |
| @@ -21,6 +21,7 @@ struct shmem_inode_info { · 20 unmodified lines | ||
| 21 | 21 | struct list_head swaplist; /* chain of maybes on swap */ |
| 22 | 22 | struct shared_policy policy; /* NUMA memory alloc policy */ |
| 23 | 23 | struct simple_xattrs xattrs; /* list of xattrs */ |
| 24 | + atomic_t stop_eviction; /* hold when working on inode */ | |
| 24 | 25 | struct inode vfs_inode; |
| 25 | 26 | }; |
| 26 | 27 | |
| @@ -21,6 +21,11 @@ typedef struct { · 20 unmodified lines | ||
| 21 | 21 | u64 key[2]; |
| 22 | 22 | } siphash_key_t; |
| 23 | 23 | |
| 24 | +static inline bool siphash_key_is_zero(const siphash_key_t *key) | |
| 25 | +{ | |
| 26 | + return !(key->key[0] | key->key[1]); | |
| 27 | +} | |
| 28 | + | |
| 24 | 29 | u64 __siphash_aligned(const void *data, size_t len, const siphash_key_t *key); |
| 25 | 30 | #ifndef CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS |
| 26 | 31 | u64 __siphash_unaligned(const void *data, size_t len, const siphash_key_t *key); |
| @@ -657,7 +657,6 @@ typedef unsigned char *sk_buff_data_t; · 656 unmodified lines | ||
| 657 | 657 | * @tc_index: Traffic control index |
| 658 | 658 | * @hash: the packet hash |
| 659 | 659 | * @queue_mapping: Queue mapping for multiqueue devices |
| 660 | − * @xmit_more: More SKBs are pending for this queue | |
| 661 | 660 | * @pfmemalloc: skbuff was allocated from PFMEMALLOC reserves |
| 662 | 661 | * @active_extensions: active extensions (skb_ext_id types) |
| 663 | 662 | * @ndisc_nodetype: router type (from link layer) |
| @@ -764,7 +763,6 @@ struct sk_buff { · 100 unmodified lines | ||
| 764 | 763 | fclone:2, |
| 765 | 764 | peeked:1, |
| 766 | 765 | head_frag:1, |
| 767 | − xmit_more:1, | |
| 768 | 766 | pfmemalloc:1; |
| 769 | 767 | #ifdef CONFIG_SKB_EXTENSIONS |
| 770 | 768 | __u8 active_extensions; |
| @@ -1044,6 +1042,8 @@ struct sk_buff *__alloc_skb(unsigned int size, gfp_t priority, int flags, · 273 unmodified lines | ||
| 1044 | 1042 | int node); |
| 1045 | 1043 | struct sk_buff *__build_skb(void *data, unsigned int frag_size); |
| 1046 | 1044 | struct sk_buff *build_skb(void *data, unsigned int frag_size); |
| 1045 | +struct sk_buff *build_skb_around(struct sk_buff *skb, | |
| 1046 | + void *data, unsigned int frag_size); | |
| 1047 | 1047 | |
| 1048 | 1048 | /** |
| 1049 | 1049 | * alloc_skb - allocate a network buffer |
| @@ -1258,11 +1258,19 @@ void skb_flow_dissector_init(struct flow_dissector *flow_dissector, · 208 unmodified lines | ||
| 1258 | 1258 | unsigned int key_count); |
| 1259 | 1259 | |
| 1260 | 1260 | #ifdef CONFIG_NET |
| 1261 | +int skb_flow_dissector_prog_query(const union bpf_attr *attr, | |
| 1262 | + union bpf_attr __user *uattr); | |
| 1261 | 1263 | int skb_flow_dissector_bpf_prog_attach(const union bpf_attr *attr, |
| 1262 | 1264 | struct bpf_prog *prog); |
| 1263 | 1265 | |
| 1264 | 1266 | int skb_flow_dissector_bpf_prog_detach(const union bpf_attr *attr); |
| 1265 | 1267 | #else |
| 1268 | +static inline int skb_flow_dissector_prog_query(const union bpf_attr *attr, | |
| 1269 | + union bpf_attr __user *uattr) | |
| 1270 | +{ | |
| 1271 | + return -EOPNOTSUPP; | |
| 1272 | +} | |
| 1273 | + | |
| 1266 | 1274 | static inline int skb_flow_dissector_bpf_prog_attach(const union bpf_attr *attr, |
| 1267 | 1275 | struct bpf_prog *prog) |
| 1268 | 1276 | { |
| @@ -1275,12 +1283,12 @@ static inline int skb_flow_dissector_bpf_prog_detach(const union bpf_attr *attr) · 6 unmodified lines | ||
| 1275 | 1283 | } |
| 1276 | 1284 | #endif |
| 1277 | 1285 | |
| 1278 | −struct bpf_flow_keys; | |
| 1279 | −bool __skb_flow_bpf_dissect(struct bpf_prog *prog, | |
| 1280 | − const struct sk_buff *skb, | |
| 1281 | − struct flow_dissector *flow_dissector, | |
| 1282 | − struct bpf_flow_keys *flow_keys); | |
| 1283 | −bool __skb_flow_dissect(const struct sk_buff *skb, | |
| 1286 | +struct bpf_flow_dissector; | |
| 1287 | +bool bpf_flow_dissect(struct bpf_prog *prog, struct bpf_flow_dissector *ctx, | |
| 1288 | + __be16 proto, int nhoff, int hlen); | |
| 1289 | + | |
| 1290 | +bool __skb_flow_dissect(const struct net *net, | |
| 1291 | + const struct sk_buff *skb, | |
| 1284 | 1292 | struct flow_dissector *flow_dissector, |
| 1285 | 1293 | void *target_container, |
| 1286 | 1294 | void *data, __be16 proto, int nhoff, int hlen, |
| @@ -1290,8 +1298,8 @@ static inline bool skb_flow_dissect(const struct sk_buff *skb, · 3 unmodified lines | ||
| 1290 | 1298 | struct flow_dissector *flow_dissector, |
| 1291 | 1299 | void *target_container, unsigned int flags) |
| 1292 | 1300 | { |
| 1293 | − return __skb_flow_dissect(skb, flow_dissector, target_container, | |
| 1294 | − NULL, 0, 0, 0, flags); | |
| 1301 | + return __skb_flow_dissect(NULL, skb, flow_dissector, | |
| 1302 | + target_container, NULL, 0, 0, 0, flags); | |
| 1295 | 1303 | } |
| 1296 | 1304 | |
| 1297 | 1305 | static inline bool skb_flow_dissect_flow_keys(const struct sk_buff *skb, |
| @@ -1299,18 +1307,19 @@ static inline bool skb_flow_dissect_flow_keys(const struct sk_buff *skb, · 1 unmodified line | ||
| 1299 | 1307 | unsigned int flags) |
| 1300 | 1308 | { |
| 1301 | 1309 | memset(flow, 0, sizeof(*flow)); |
| 1302 | − return __skb_flow_dissect(skb, &flow_keys_dissector, flow, | |
| 1303 | − NULL, 0, 0, 0, flags); | |
| 1310 | + return __skb_flow_dissect(NULL, skb, &flow_keys_dissector, | |
| 1311 | + flow, NULL, 0, 0, 0, flags); | |
| 1304 | 1312 | } |
| 1305 | 1313 | |
| 1306 | 1314 | static inline bool |
| 1307 | −skb_flow_dissect_flow_keys_basic(const struct sk_buff *skb, | |
| 1315 | +skb_flow_dissect_flow_keys_basic(const struct net *net, | |
| 1316 | + const struct sk_buff *skb, | |
| 1308 | 1317 | struct flow_keys_basic *flow, void *data, |
| 1309 | 1318 | __be16 proto, int nhoff, int hlen, |
| 1310 | 1319 | unsigned int flags) |
| 1311 | 1320 | { |
| 1312 | 1321 | memset(flow, 0, sizeof(*flow)); |
| 1313 | − return __skb_flow_dissect(skb, &flow_keys_basic_dissector, flow, | |
| 1322 | + return __skb_flow_dissect(net, skb, &flow_keys_basic_dissector, flow, | |
| 1314 | 1323 | data, proto, nhoff, hlen, flags); |
| 1315 | 1324 | } |
| 1316 | 1325 | |
| @@ -2102,8 +2111,6 @@ void skb_add_rx_frag(struct sk_buff *skb, int i, struct page *page, int off, · 785 unmodified lines | ||
| 2102 | 2111 | void skb_coalesce_rx_frag(struct sk_buff *skb, int i, int size, |
| 2103 | 2112 | unsigned int truesize); |
| 2104 | 2113 | |
| 2105 | −#define SKB_PAGE_ASSERT(skb) BUG_ON(skb_shinfo(skb)->nr_frags) | |
| 2106 | −#define SKB_FRAG_ASSERT(skb) BUG_ON(skb_has_frag_list(skb)) | |
| 2107 | 2114 | #define SKB_LINEAR_ASSERT(skb) BUG_ON(skb_is_nonlinear(skb)) |
| 2108 | 2115 | |
| 2109 | 2116 | #ifdef NET_SKBUFF_DATA_USES_OFFSET |
| @@ -2490,7 +2497,8 @@ static inline void skb_probe_transport_header(struct sk_buff *skb) · 380 unmodified lines | ||
| 2490 | 2497 | if (skb_transport_header_was_set(skb)) |
| 2491 | 2498 | return; |
| 2492 | 2499 | |
| 2493 | − if (skb_flow_dissect_flow_keys_basic(skb, &keys, NULL, 0, 0, 0, 0)) | |
| 2500 | + if (skb_flow_dissect_flow_keys_basic(NULL, skb, &keys, | |
| 2501 | + NULL, 0, 0, 0, 0)) | |
| 2494 | 2502 | skb_set_transport_header(skb, keys.control.thoff); |
| 2495 | 2503 | } |
| 2496 | 2504 | |
| @@ -3372,17 +3380,17 @@ struct sk_buff *__skb_try_recv_from_queue(struct sock *sk, · 875 unmodified lines | ||
| 3372 | 3380 | unsigned int flags, |
| 3373 | 3381 | void (*destructor)(struct sock *sk, |
| 3374 | 3382 | struct sk_buff *skb), |
| 3375 | − int *peeked, int *off, int *err, | |
| 3383 | + int *off, int *err, | |
| 3376 | 3384 | struct sk_buff **last); |
| 3377 | 3385 | struct sk_buff *__skb_try_recv_datagram(struct sock *sk, unsigned flags, |
| 3378 | 3386 | void (*destructor)(struct sock *sk, |
| 3379 | 3387 | struct sk_buff *skb), |
| 3380 | − int *peeked, int *off, int *err, | |
| 3388 | + int *off, int *err, | |
| 3381 | 3389 | struct sk_buff **last); |
| 3382 | 3390 | struct sk_buff *__skb_recv_datagram(struct sock *sk, unsigned flags, |
| 3383 | 3391 | void (*destructor)(struct sock *sk, |
| 3384 | 3392 | struct sk_buff *skb), |
| 3385 | − int *peeked, int *off, int *err); | |
| 3393 | + int *off, int *err); | |
| 3386 | 3394 | struct sk_buff *skb_recv_datagram(struct sock *sk, unsigned flags, int noblock, |
| 3387 | 3395 | int *err); |
| 3388 | 3396 | __poll_t datagram_poll(struct file *file, struct socket *sock, |
| @@ -61,9 +61,6 @@ struct kmem_cache { · 60 unmodified lines | ||
| 61 | 61 | atomic_t allocmiss; |
| 62 | 62 | atomic_t freehit; |
| 63 | 63 | atomic_t freemiss; |
| 64 | −#ifdef CONFIG_DEBUG_SLAB_LEAK | |
| 65 | − atomic_t store_user_clean; | |
| 66 | −#endif | |
| 67 | 64 | |
| 68 | 65 | /* |
| 69 | 66 | * If debugging is enabled, then the allocator can add additional |
| @@ -29,7 +29,7 @@ struct smpboot_thread_data; · 28 unmodified lines | ||
| 29 | 29 | * @thread_comm: The base name of the thread |
| 30 | 30 | */ |
| 31 | 31 | struct smp_hotplug_thread { |
| 32 | − struct task_struct __percpu **store; | |
| 32 | + struct task_struct * __percpu *store; | |
| 33 | 33 | struct list_head list; |
| 34 | 34 | int (*thread_should_run)(unsigned int cpu); |
| 35 | 35 | void (*thread_fn)(unsigned int cpu); |
| @@ -0,0 +1,37 @@ | ||
| 1 | +/* SPDX-License-Identifier: GPL-2.0 */ | |
| 2 | +#ifndef _SOC_EP93XX_H | |
| 3 | +#define _SOC_EP93XX_H | |
| 4 | + | |
| 5 | +struct platform_device; | |
| 6 | + | |
| 7 | +#define EP93XX_CHIP_REV_D0 3 | |
| 8 | +#define EP93XX_CHIP_REV_D1 4 | |
| 9 | +#define EP93XX_CHIP_REV_E0 5 | |
| 10 | +#define EP93XX_CHIP_REV_E1 6 | |
| 11 | +#define EP93XX_CHIP_REV_E2 7 | |
| 12 | + | |
| 13 | +#ifdef CONFIG_ARCH_EP93XX | |
| 14 | +int ep93xx_pwm_acquire_gpio(struct platform_device *pdev); | |
| 15 | +void ep93xx_pwm_release_gpio(struct platform_device *pdev); | |
| 16 | +int ep93xx_ide_acquire_gpio(struct platform_device *pdev); | |
| 17 | +void ep93xx_ide_release_gpio(struct platform_device *pdev); | |
| 18 | +int ep93xx_keypad_acquire_gpio(struct platform_device *pdev); | |
| 19 | +void ep93xx_keypad_release_gpio(struct platform_device *pdev); | |
| 20 | +int ep93xx_i2s_acquire(void); | |
| 21 | +void ep93xx_i2s_release(void); | |
| 22 | +unsigned int ep93xx_chip_revision(void); | |
| 23 | + | |
| 24 | +#else | |
| 25 | +static inline int ep93xx_pwm_acquire_gpio(struct platform_device *pdev) { return 0; } | |
| 26 | +static inline void ep93xx_pwm_release_gpio(struct platform_device *pdev) {} | |
| 27 | +static inline int ep93xx_ide_acquire_gpio(struct platform_device *pdev) { return 0; } | |
| 28 | +static inline void ep93xx_ide_release_gpio(struct platform_device *pdev) {} | |
| 29 | +static inline int ep93xx_keypad_acquire_gpio(struct platform_device *pdev) { return 0; } | |
| 30 | +static inline void ep93xx_keypad_release_gpio(struct platform_device *pdev) {} | |
| 31 | +static inline int ep93xx_i2s_acquire(void) { return 0; } | |
| 32 | +static inline void ep93xx_i2s_release(void) {} | |
| 33 | +static inline unsigned int ep93xx_chip_revision(void) { return 0; } | |
| 34 | + | |
| 35 | +#endif | |
| 36 | + | |
| 37 | +#endif | |
| @@ -0,0 +1,38 @@ | ||
| 1 | +/* SPDX-License-Identifier: GPL-2.0 */ | |
| 2 | +#ifndef __IXP4XX_NPE_H | |
| 3 | +#define __IXP4XX_NPE_H | |
| 4 | + | |
| 5 | +#include <linux/kernel.h> | |
| 6 | + | |
| 7 | +extern const char *npe_names[]; | |
| 8 | + | |
| 9 | +struct npe_regs { | |
| 10 | + u32 exec_addr, exec_data, exec_status_cmd, exec_count; | |
| 11 | + u32 action_points[4]; | |
| 12 | + u32 watchpoint_fifo, watch_count; | |
| 13 | + u32 profile_count; | |
| 14 | + u32 messaging_status, messaging_control; | |
| 15 | + u32 mailbox_status, /*messaging_*/ in_out_fifo; | |
| 16 | +}; | |
| 17 | + | |
| 18 | +struct npe { | |
| 19 | + struct npe_regs __iomem *regs; | |
| 20 | + int id; | |
| 21 | + int valid; | |
| 22 | +}; | |
| 23 | + | |
| 24 | + | |
| 25 | +static inline const char *npe_name(struct npe *npe) | |
| 26 | +{ | |
| 27 | + return npe_names[npe->id]; | |
| 28 | +} | |
| 29 | + | |
| 30 | +int npe_running(struct npe *npe); | |
| 31 | +int npe_send_message(struct npe *npe, const void *msg, const char *what); | |
| 32 | +int npe_recv_message(struct npe *npe, void *msg, const char *what); | |
| 33 | +int npe_send_recv_message(struct npe *npe, void *msg, const char *what); | |
| 34 | +int npe_load_firmware(struct npe *npe, const char *name, struct device *dev); | |
| 35 | +struct npe *npe_request(unsigned id); | |
| 36 | +void npe_release(struct npe *npe); | |
| 37 | + | |
| 38 | +#endif /* __IXP4XX_NPE_H */ | |
| @@ -0,0 +1,91 @@ | ||
| 1 | +/* | |
| 2 | + * Copyright (C) 2007 Krzysztof Halasa <khc@pm.waw.pl> | |
| 3 | + * | |
| 4 | + * This program is free software; you can redistribute it and/or modify it | |
| 5 | + * under the terms of version 2 of the GNU General Public License | |
| 6 | + * as published by the Free Software Foundation. | |
| 7 | + */ | |
| 8 | + | |
| 9 | +#ifndef IXP4XX_QMGR_H | |
| 10 | +#define IXP4XX_QMGR_H | |
| 11 | + | |
| 12 | +#include <linux/io.h> | |
| 13 | +#include <linux/kernel.h> | |
| 14 | + | |
| 15 | +#define DEBUG_QMGR 0 | |
| 16 | + | |
| 17 | +#define HALF_QUEUES 32 | |
| 18 | +#define QUEUES 64 | |
| 19 | +#define MAX_QUEUE_LENGTH 4 /* in dwords */ | |
| 20 | + | |
| 21 | +#define QUEUE_STAT1_EMPTY 1 /* queue status bits */ | |
| 22 | +#define QUEUE_STAT1_NEARLY_EMPTY 2 | |
| 23 | +#define QUEUE_STAT1_NEARLY_FULL 4 | |
| 24 | +#define QUEUE_STAT1_FULL 8 | |
| 25 | +#define QUEUE_STAT2_UNDERFLOW 1 | |
| 26 | +#define QUEUE_STAT2_OVERFLOW 2 | |
| 27 | + | |
| 28 | +#define QUEUE_WATERMARK_0_ENTRIES 0 | |
| 29 | +#define QUEUE_WATERMARK_1_ENTRY 1 | |
| 30 | +#define QUEUE_WATERMARK_2_ENTRIES 2 | |
| 31 | +#define QUEUE_WATERMARK_4_ENTRIES 3 | |
| 32 | +#define QUEUE_WATERMARK_8_ENTRIES 4 | |
| 33 | +#define QUEUE_WATERMARK_16_ENTRIES 5 | |
| 34 | +#define QUEUE_WATERMARK_32_ENTRIES 6 | |
| 35 | +#define QUEUE_WATERMARK_64_ENTRIES 7 | |
| 36 | + | |
| 37 | +/* queue interrupt request conditions */ | |
| 38 | +#define QUEUE_IRQ_SRC_EMPTY 0 | |
| 39 | +#define QUEUE_IRQ_SRC_NEARLY_EMPTY 1 | |
| 40 | +#define QUEUE_IRQ_SRC_NEARLY_FULL 2 | |
| 41 | +#define QUEUE_IRQ_SRC_FULL 3 | |
| 42 | +#define QUEUE_IRQ_SRC_NOT_EMPTY 4 | |
| 43 | +#define QUEUE_IRQ_SRC_NOT_NEARLY_EMPTY 5 | |
| 44 | +#define QUEUE_IRQ_SRC_NOT_NEARLY_FULL 6 | |
| 45 | +#define QUEUE_IRQ_SRC_NOT_FULL 7 | |
| 46 | + | |
| 47 | +struct qmgr_regs { | |
| 48 | + u32 acc[QUEUES][MAX_QUEUE_LENGTH]; /* 0x000 - 0x3FF */ | |
| 49 | + u32 stat1[4]; /* 0x400 - 0x40F */ | |
| 50 | + u32 stat2[2]; /* 0x410 - 0x417 */ | |
| 51 | + u32 statne_h; /* 0x418 - queue nearly empty */ | |
| 52 | + u32 statf_h; /* 0x41C - queue full */ | |
| 53 | + u32 irqsrc[4]; /* 0x420 - 0x42F IRC source */ | |
| 54 | + u32 irqen[2]; /* 0x430 - 0x437 IRQ enabled */ | |
| 55 | + u32 irqstat[2]; /* 0x438 - 0x43F - IRQ access only */ | |
| 56 | + u32 reserved[1776]; | |
| 57 | + u32 sram[2048]; /* 0x2000 - 0x3FFF - config and buffer */ | |
| 58 | +}; | |
| 59 | + | |
| 60 | +void qmgr_put_entry(unsigned int queue, u32 val); | |
| 61 | +u32 qmgr_get_entry(unsigned int queue); | |
| 62 | +int qmgr_stat_empty(unsigned int queue); | |
| 63 | +int qmgr_stat_below_low_watermark(unsigned int queue); | |
| 64 | +int qmgr_stat_full(unsigned int queue); | |
| 65 | +int qmgr_stat_overflow(unsigned int queue); | |
| 66 | +void qmgr_release_queue(unsigned int queue); | |
| 67 | +void qmgr_set_irq(unsigned int queue, int src, | |
| 68 | + void (*handler)(void *pdev), void *pdev); | |
| 69 | +void qmgr_enable_irq(unsigned int queue); | |
| 70 | +void qmgr_disable_irq(unsigned int queue); | |
| 71 | + | |
| 72 | +/* request_ and release_queue() must be called from non-IRQ context */ | |
| 73 | + | |
| 74 | +#if DEBUG_QMGR | |
| 75 | +extern char qmgr_queue_descs[QUEUES][32]; | |
| 76 | + | |
| 77 | +int qmgr_request_queue(unsigned int queue, unsigned int len /* dwords */, | |
| 78 | + unsigned int nearly_empty_watermark, | |
| 79 | + unsigned int nearly_full_watermark, | |
| 80 | + const char *desc_format, const char* name); | |
| 81 | +#else | |
| 82 | +int __qmgr_request_queue(unsigned int queue, unsigned int len /* dwords */, | |
| 83 | + unsigned int nearly_empty_watermark, | |
| 84 | + unsigned int nearly_full_watermark); | |
| 85 | +#define qmgr_request_queue(queue, len, nearly_empty_watermark, \ | |
| 86 | + nearly_full_watermark, desc_format, name) \ | |
| 87 | + __qmgr_request_queue(queue, len, nearly_empty_watermark, \ | |
| 88 | + nearly_full_watermark) | |
| 89 | +#endif | |
| 90 | + | |
| 91 | +#endif | |
| @@ -0,0 +1,23 @@ | ||
| 1 | +/* SPDX-License-Identifier: GPL-2.0 */ | |
| 2 | +/* | |
| 3 | + * Texas Instruments' K3 TI SCI INTA MSI helper | |
| 4 | + * | |
| 5 | + * Copyright (C) 2018-2019 Texas Instruments Incorporated - http://www.ti.com/ | |
| 6 | + * Lokesh Vutla <lokeshvutla@ti.com> | |
| 7 | + */ | |
| 8 | + | |
| 9 | +#ifndef __INCLUDE_LINUX_TI_SCI_INTA_MSI_H | |
| 10 | +#define __INCLUDE_LINUX_TI_SCI_INTA_MSI_H | |
| 11 | + | |
| 12 | +#include <linux/msi.h> | |
| 13 | +#include <linux/soc/ti/ti_sci_protocol.h> | |
| 14 | + | |
| 15 | +struct irq_domain | |
| 16 | +*ti_sci_inta_msi_create_irq_domain(struct fwnode_handle *fwnode, | |
| 17 | + struct msi_domain_info *info, | |
| 18 | + struct irq_domain *parent); | |
| 19 | +int ti_sci_inta_msi_domain_alloc_irqs(struct device *dev, | |
| 20 | + struct ti_sci_resource *res); | |
| 21 | +unsigned int ti_sci_inta_msi_get_virq(struct device *dev, u32 index); | |
| 22 | +void ti_sci_inta_msi_domain_free_irqs(struct device *dev); | |
| 23 | +#endif /* __INCLUDE_LINUX_IRQCHIP_TI_SCI_INTA_H */ | |
| @@ -192,15 +192,68 @@ struct ti_sci_clk_ops { · 191 unmodified lines | ||
| 192 | 192 | u64 *current_freq); |
| 193 | 193 | }; |
| 194 | 194 | |
| 195 | +/** | |
| 196 | + * struct ti_sci_rm_core_ops - Resource management core operations | |
| 197 | + * @get_range: Get a range of resources belonging to ti sci host. | |
| 198 | + * @get_rage_from_shost: Get a range of resources belonging to | |
| 199 | + * specified host id. | |
| 200 | + * - s_host: Host processing entity to which the | |
| 201 | + * resources are allocated | |
| 202 | + * | |
| 203 | + * NOTE: for these functions, all the parameters are consolidated and defined | |
| 204 | + * as below: | |
| 205 | + * - handle: Pointer to TISCI handle as retrieved by *ti_sci_get_handle | |
| 206 | + * - dev_id: TISCI device ID. | |
| 207 | + * - subtype: Resource assignment subtype that is being requested | |
| 208 | + * from the given device. | |
| 209 | + * - range_start: Start index of the resource range | |
| 210 | + * - range_end: Number of resources in the range | |
| 211 | + */ | |
| 212 | +struct ti_sci_rm_core_ops { | |
| 213 | + int (*get_range)(const struct ti_sci_handle *handle, u32 dev_id, | |
| 214 | + u8 subtype, u16 *range_start, u16 *range_num); | |
| 215 | + int (*get_range_from_shost)(const struct ti_sci_handle *handle, | |
| 216 | + u32 dev_id, u8 subtype, u8 s_host, | |
| 217 | + u16 *range_start, u16 *range_num); | |
| 218 | +}; | |
| 219 | + | |
| 220 | +/** | |
| 221 | + * struct ti_sci_rm_irq_ops: IRQ management operations | |
| 222 | + * @set_irq: Set an IRQ route between the requested source | |
| 223 | + * and destination | |
| 224 | + * @set_event_map: Set an Event based peripheral irq to Interrupt | |
| 225 | + * Aggregator. | |
| 226 | + * @free_irq: Free an an IRQ route between the requested source | |
| 227 | + * destination. | |
| 228 | + * @free_event_map: Free an event based peripheral irq to Interrupt | |
| 229 | + * Aggregator. | |
| 230 | + */ | |
| 231 | +struct ti_sci_rm_irq_ops { | |
| 232 | + int (*set_irq)(const struct ti_sci_handle *handle, u16 src_id, | |
| 233 | + u16 src_index, u16 dst_id, u16 dst_host_irq); | |
| 234 | + int (*set_event_map)(const struct ti_sci_handle *handle, u16 src_id, | |
| 235 | + u16 src_index, u16 ia_id, u16 vint, | |
| 236 | + u16 global_event, u8 vint_status_bit); | |
| 237 | + int (*free_irq)(const struct ti_sci_handle *handle, u16 src_id, | |
| 238 | + u16 src_index, u16 dst_id, u16 dst_host_irq); | |
| 239 | + int (*free_event_map)(const struct ti_sci_handle *handle, u16 src_id, | |
| 240 | + u16 src_index, u16 ia_id, u16 vint, | |
| 241 | + u16 global_event, u8 vint_status_bit); | |
| 242 | +}; | |
| 243 | + | |
| 195 | 244 | /** |
| 196 | 245 | * struct ti_sci_ops - Function support for TI SCI |
| 197 | 246 | * @dev_ops: Device specific operations |
| 198 | 247 | * @clk_ops: Clock specific operations |
| 248 | + * @rm_core_ops: Resource management core operations. | |
| 249 | + * @rm_irq_ops: IRQ management specific operations | |
| 199 | 250 | */ |
| 200 | 251 | struct ti_sci_ops { |
| 201 | 252 | struct ti_sci_core_ops core_ops; |
| 202 | 253 | struct ti_sci_dev_ops dev_ops; |
| 203 | 254 | struct ti_sci_clk_ops clk_ops; |
| 255 | + struct ti_sci_rm_core_ops rm_core_ops; | |
| 256 | + struct ti_sci_rm_irq_ops rm_irq_ops; | |
| 204 | 257 | }; |
| 205 | 258 | |
| 206 | 259 | /** |
| @@ -213,10 +266,47 @@ struct ti_sci_handle { · 6 unmodified lines | ||
| 213 | 266 | struct ti_sci_ops ops; |
| 214 | 267 | }; |
| 215 | 268 | |
| 269 | +#define TI_SCI_RESOURCE_NULL 0xffff | |
| 270 | + | |
| 271 | +/** | |
| 272 | + * struct ti_sci_resource_desc - Description of TI SCI resource instance range. | |
| 273 | + * @start: Start index of the resource. | |
| 274 | + * @num: Number of resources. | |
| 275 | + * @res_map: Bitmap to manage the allocation of these resources. | |
| 276 | + */ | |
| 277 | +struct ti_sci_resource_desc { | |
| 278 | + u16 start; | |
| 279 | + u16 num; | |
| 280 | + unsigned long *res_map; | |
| 281 | +}; | |
| 282 | + | |
| 283 | +/** | |
| 284 | + * struct ti_sci_resource - Structure representing a resource assigned | |
| 285 | + * to a device. | |
| 286 | + * @sets: Number of sets available from this resource type | |
| 287 | + * @lock: Lock to guard the res map in each set. | |
| 288 | + * @desc: Array of resource descriptors. | |
| 289 | + */ | |
| 290 | +struct ti_sci_resource { | |
| 291 | + u16 sets; | |
| 292 | + raw_spinlock_t lock; | |
| 293 | + struct ti_sci_resource_desc *desc; | |
| 294 | +}; | |
| 295 | + | |
| 216 | 296 | #if IS_ENABLED(CONFIG_TI_SCI_PROTOCOL) |
| 217 | 297 | const struct ti_sci_handle *ti_sci_get_handle(struct device *dev); |
| 218 | 298 | int ti_sci_put_handle(const struct ti_sci_handle *handle); |
| 219 | 299 | const struct ti_sci_handle *devm_ti_sci_get_handle(struct device *dev); |
| 300 | +const struct ti_sci_handle *ti_sci_get_by_phandle(struct device_node *np, | |
| 301 | + const char *property); | |
| 302 | +const struct ti_sci_handle *devm_ti_sci_get_by_phandle(struct device *dev, | |
| 303 | + const char *property); | |
| 304 | +u16 ti_sci_get_free_resource(struct ti_sci_resource *res); | |
| 305 | +void ti_sci_release_resource(struct ti_sci_resource *res, u16 id); | |
| 306 | +u32 ti_sci_get_num_resources(struct ti_sci_resource *res); | |
| 307 | +struct ti_sci_resource * | |
| 308 | +devm_ti_sci_get_of_resource(const struct ti_sci_handle *handle, | |
| 309 | + struct device *dev, u32 dev_id, char *of_prop); | |
| 220 | 310 | |
| 221 | 311 | #else /* CONFIG_TI_SCI_PROTOCOL */ |
| 222 | 312 | |
| @@ -236,6 +326,40 @@ const struct ti_sci_handle *devm_ti_sci_get_handle(struct device *dev) · 13 unmodified lines | ||
| 236 | 326 | return ERR_PTR(-EINVAL); |
| 237 | 327 | } |
| 238 | 328 | |
| 329 | +static inline | |
| 330 | +const struct ti_sci_handle *ti_sci_get_by_phandle(struct device_node *np, | |
| 331 | + const char *property) | |
| 332 | +{ | |
| 333 | + return ERR_PTR(-EINVAL); | |
| 334 | +} | |
| 335 | + | |
| 336 | +static inline | |
| 337 | +const struct ti_sci_handle *devm_ti_sci_get_by_phandle(struct device *dev, | |
| 338 | + const char *property) | |
| 339 | +{ | |
| 340 | + return ERR_PTR(-EINVAL); | |
| 341 | +} | |
| 342 | + | |
| 343 | +static inline u16 ti_sci_get_free_resource(struct ti_sci_resource *res) | |
| 344 | +{ | |
| 345 | + return TI_SCI_RESOURCE_NULL; | |
| 346 | +} | |
| 347 | + | |
| 348 | +static inline void ti_sci_release_resource(struct ti_sci_resource *res, u16 id) | |
| 349 | +{ | |
| 350 | +} | |
| 351 | + | |
| 352 | +static inline u32 ti_sci_get_num_resources(struct ti_sci_resource *res) | |
| 353 | +{ | |
| 354 | + return 0; | |
| 355 | +} | |
| 356 | + | |
| 357 | +static inline struct ti_sci_resource * | |
| 358 | +devm_ti_sci_get_of_resource(const struct ti_sci_handle *handle, | |
| 359 | + struct device *dev, u32 dev_id, char *of_prop) | |
| 360 | +{ | |
| 361 | + return ERR_PTR(-EINVAL); | |
| 362 | +} | |
| 239 | 363 | #endif /* CONFIG_TI_SCI_PROTOCOL */ |
| 240 | 364 | |
| 241 | 365 | #endif /* __TISCI_PROTOCOL_H */ |
| @@ -1,5 +1,5 @@ | ||
| 1 | −// SPDX-License-Identifier: (GPL-2.0 OR BSD-3-Clause) | |
| 2 | −// Copyright(c) 2015-17 Intel Corporation. | |
| 1 | +/* SPDX-License-Identifier: (GPL-2.0 OR BSD-3-Clause) */ | |
| 2 | +/* Copyright(c) 2015-17 Intel Corporation. */ | |
| 3 | 3 | |
| 4 | 4 | #ifndef __SOUNDWIRE_H |
| 5 | 5 | #define __SOUNDWIRE_H |
| @@ -36,7 +36,7 @@ struct sdw_slave; · 30 unmodified lines | ||
| 36 | 36 | #define SDW_FRAME_CTRL_BITS 48 |
| 37 | 37 | #define SDW_MAX_DEVICES 11 |
| 38 | 38 | |
| 39 | −#define SDW_VALID_PORT_RANGE(n) (n <= 14 && n >= 1) | |
| 39 | +#define SDW_VALID_PORT_RANGE(n) ((n) <= 14 && (n) >= 1) | |
| 40 | 40 | |
| 41 | 41 | #define SDW_DAI_ID_RANGE_START 100 |
| 42 | 42 | #define SDW_DAI_ID_RANGE_END 200 |
| @@ -470,14 +470,14 @@ struct sdw_bus_params { · 427 unmodified lines | ||
| 470 | 470 | struct sdw_slave_ops { |
| 471 | 471 | int (*read_prop)(struct sdw_slave *sdw); |
| 472 | 472 | int (*interrupt_callback)(struct sdw_slave *slave, |
| 473 | − struct sdw_slave_intr_status *status); | |
| 473 | + struct sdw_slave_intr_status *status); | |
| 474 | 474 | int (*update_status)(struct sdw_slave *slave, |
| 475 | − enum sdw_slave_status status); | |
| 475 | + enum sdw_slave_status status); | |
| 476 | 476 | int (*bus_config)(struct sdw_slave *slave, |
| 477 | − struct sdw_bus_params *params); | |
| 477 | + struct sdw_bus_params *params); | |
| 478 | 478 | int (*port_prep)(struct sdw_slave *slave, |
| 479 | − struct sdw_prepare_ch *prepare_ch, | |
| 480 | − enum sdw_port_prep_ops pre_ops); | |
| 479 | + struct sdw_prepare_ch *prepare_ch, | |
| 480 | + enum sdw_port_prep_ops pre_ops); | |
| 481 | 481 | }; |
| 482 | 482 | |
| 483 | 483 | /** |
| @@ -1,5 +1,5 @@ | ||
| 1 | −// SPDX-License-Identifier: (GPL-2.0 OR BSD-3-Clause) | |
| 2 | −// Copyright(c) 2015-17 Intel Corporation. | |
| 1 | +/* SPDX-License-Identifier: (GPL-2.0 OR BSD-3-Clause) */ | |
| 2 | +/* Copyright(c) 2015-17 Intel Corporation. */ | |
| 3 | 3 | |
| 4 | 4 | #ifndef __SDW_INTEL_H |
| 5 | 5 | #define __SDW_INTEL_H |
| @@ -11,7 +11,7 @@ · 5 unmodified lines | ||
| 11 | 11 | */ |
| 12 | 12 | struct sdw_intel_ops { |
| 13 | 13 | int (*config_stream)(void *arg, void *substream, |
| 14 | − void *dai, void *hw_params, int stream_num); | |
| 14 | + void *dai, void *hw_params, int stream_num); | |
| 15 | 15 | }; |
| 16 | 16 | |
| 17 | 17 | /** |
| @@ -1,5 +1,5 @@ | ||
| 1 | −// SPDX-License-Identifier: (GPL-2.0 OR BSD-3-Clause) | |
| 2 | −// Copyright(c) 2015-17 Intel Corporation. | |
| 1 | +/* SPDX-License-Identifier: (GPL-2.0 OR BSD-3-Clause) */ | |
| 2 | +/* Copyright(c) 2015-17 Intel Corporation. */ | |
| 3 | 3 | |
| 4 | 4 | #ifndef __SDW_REGISTERS_H |
| 5 | 5 | #define __SDW_REGISTERS_H |
| @@ -73,7 +73,6 @@ · 67 unmodified lines | ||
| 73 | 73 | #define SDW_SCP_INTSTAT2_SCP3_CASCADE BIT(7) |
| 74 | 74 | #define SDW_SCP_INTSTAT2_PORT4_10 GENMASK(6, 0) |
| 75 | 75 | |
| 76 | − | |
| 77 | 76 | #define SDW_SCP_INTSTAT3 0x43 |
| 78 | 77 | #define SDW_SCP_INTSTAT3_PORT11_14 GENMASK(3, 0) |
| 79 | 78 | |
| @@ -1,5 +1,5 @@ | ||
| 1 | −// SPDX-License-Identifier: GPL-2.0 | |
| 2 | −// Copyright(c) 2015-17 Intel Corporation. | |
| 1 | +/* SPDX-License-Identifier: GPL-2.0 */ | |
| 2 | +/* Copyright(c) 2015-17 Intel Corporation. */ | |
| 3 | 3 | |
| 4 | 4 | #ifndef __SOUNDWIRE_TYPES_H |
| 5 | 5 | #define __SOUNDWIRE_TYPES_H |
| @@ -11,7 +11,7 @@ extern struct bus_type sdw_bus_type; · 5 unmodified lines | ||
| 11 | 11 | #define sdw_register_driver(drv) \ |
| 12 | 12 | __sdw_register_driver(drv, THIS_MODULE) |
| 13 | 13 | |
| 14 | −int __sdw_register_driver(struct sdw_driver *drv, struct module *); | |
| 14 | +int __sdw_register_driver(struct sdw_driver *drv, struct module *owner); | |
| 15 | 15 | void sdw_unregister_driver(struct sdw_driver *drv); |
| 16 | 16 | |
| 17 | 17 | int sdw_slave_modalias(const struct sdw_slave *slave, char *buf, size_t size); |
| @@ -25,6 +25,7 @@ struct dma_chan; · 24 unmodified lines | ||
| 25 | 25 | struct pxa2xx_spi_controller { |
| 26 | 26 | u16 num_chipselect; |
| 27 | 27 | u8 enable_dma; |
| 28 | + u8 dma_burst_size; | |
| 28 | 29 | bool is_slave; |
| 29 | 30 | |
| 30 | 31 | /* DMA engine specific config */ |
| @@ -295,6 +295,10 @@ int spi_controller_dma_map_mem_op_data(struct spi_controller *ctlr, · 294 unmodified lines | ||
| 295 | 295 | void spi_controller_dma_unmap_mem_op_data(struct spi_controller *ctlr, |
| 296 | 296 | const struct spi_mem_op *op, |
| 297 | 297 | struct sg_table *sg); |
| 298 | + | |
| 299 | +bool spi_mem_default_supports_op(struct spi_mem *mem, | |
| 300 | + const struct spi_mem_op *op); | |
| 301 | + | |
| 298 | 302 | #else |
| 299 | 303 | static inline int |
| 300 | 304 | spi_controller_dma_map_mem_op_data(struct spi_controller *ctlr, |
| @@ -310,6 +314,14 @@ spi_controller_dma_unmap_mem_op_data(struct spi_controller *ctlr, · 9 unmodified lines | ||
| 310 | 314 | struct sg_table *sg) |
| 311 | 315 | { |
| 312 | 316 | } |
| 317 | + | |
| 318 | +static inline | |
| 319 | +bool spi_mem_default_supports_op(struct spi_mem *mem, | |
| 320 | + const struct spi_mem_op *op) | |
| 321 | +{ | |
| 322 | + return false; | |
| 323 | +} | |
| 324 | + | |
| 313 | 325 | #endif /* CONFIG_SPI_MEM */ |
| 314 | 326 | |
| 315 | 327 | int spi_mem_adjust_op_size(struct spi_mem *mem, struct spi_mem_op *op); |
| @@ -143,7 +143,7 @@ struct spi_device { · 142 unmodified lines | ||
| 143 | 143 | u32 max_speed_hz; |
| 144 | 144 | u8 chip_select; |
| 145 | 145 | u8 bits_per_word; |
| 146 | − u16 mode; | |
| 146 | + u32 mode; | |
| 147 | 147 | #define SPI_CPHA 0x01 /* clock phase */ |
| 148 | 148 | #define SPI_CPOL 0x02 /* clock polarity */ |
| 149 | 149 | #define SPI_MODE_0 (0|0) /* (original MicroWire) */ |
| @@ -330,6 +330,9 @@ static inline void spi_unregister_driver(struct spi_driver *sdrv) · 180 unmodified lines | ||
| 330 | 330 | * must fail if an unrecognized or unsupported mode is requested. |
| 331 | 331 | * It's always safe to call this unless transfers are pending on |
| 332 | 332 | * the device whose settings are being modified. |
| 333 | + * @set_cs_timing: optional hook for SPI devices to request SPI master | |
| 334 | + * controller for configuring specific CS setup time, hold time and inactive | |
| 335 | + * delay interms of clock counts | |
| 333 | 336 | * @transfer: adds a message to the controller's transfer queue. |
| 334 | 337 | * @cleanup: frees controller-specific state |
| 335 | 338 | * @can_dma: determine whether this controller supports DMA |
| @@ -363,6 +366,7 @@ static inline void spi_unregister_driver(struct spi_driver *sdrv) · 27 unmodified lines | ||
| 363 | 366 | * @unprepare_transfer_hardware: there are currently no more messages on the |
| 364 | 367 | * queue so the subsystem notifies the driver that it may relax the |
| 365 | 368 | * hardware by issuing this call |
| 369 | + * | |
| 366 | 370 | * @set_cs: set the logic level of the chip select line. May be called |
| 367 | 371 | * from interrupt context. |
| 368 | 372 | * @prepare_message: set up the controller to transfer a single message, |
| @@ -439,13 +443,12 @@ struct spi_controller { · 70 unmodified lines | ||
| 439 | 443 | u16 dma_alignment; |
| 440 | 444 | |
| 441 | 445 | /* spi_device.mode flags understood by this controller driver */ |
| 442 | − u16 mode_bits; | |
| 446 | + u32 mode_bits; | |
| 443 | 447 | |
| 444 | 448 | /* bitmask of supported bits_per_word for transfers */ |
| 445 | 449 | u32 bits_per_word_mask; |
| 446 | 450 | #define SPI_BPW_MASK(bits) BIT((bits) - 1) |
| 447 | −#define SPI_BIT_MASK(bits) (((bits) == 32) ? ~0U : (BIT(bits) - 1)) | |
| 448 | −#define SPI_BPW_RANGE_MASK(min, max) (SPI_BIT_MASK(max) - SPI_BIT_MASK(min - 1)) | |
| 451 | +#define SPI_BPW_RANGE_MASK(min, max) GENMASK((max) - 1, (min) - 1) | |
| 449 | 452 | |
| 450 | 453 | /* limits on transfer speed */ |
| 451 | 454 | u32 min_speed_hz; |
| @@ -489,6 +492,17 @@ struct spi_controller { · 37 unmodified lines | ||
| 489 | 492 | */ |
| 490 | 493 | int (*setup)(struct spi_device *spi); |
| 491 | 494 | |
| 495 | + /* | |
| 496 | + * set_cs_timing() method is for SPI controllers that supports | |
| 497 | + * configuring CS timing. | |
| 498 | + * | |
| 499 | + * This hook allows SPI client drivers to request SPI controllers | |
| 500 | + * to configure specific CS timing through spi_set_cs_timing() after | |
| 501 | + * spi_setup(). | |
| 502 | + */ | |
| 503 | + void (*set_cs_timing)(struct spi_device *spi, u8 setup_clk_cycles, | |
| 504 | + u8 hold_clk_cycles, u8 inactive_clk_cycles); | |
| 505 | + | |
| 492 | 506 | /* bidirectional bulk transfers |
| 493 | 507 | * |
| 494 | 508 | * + The transfer() method may not sleep; its main role is |
| @@ -1277,7 +1291,7 @@ struct spi_board_info { · 782 unmodified lines | ||
| 1277 | 1291 | /* mode becomes spi_device.mode, and is essential for chips |
| 1278 | 1292 | * where the default of SPI_CS_HIGH = 0 is wrong. |
| 1279 | 1293 | */ |
| 1280 | − u16 mode; | |
| 1294 | + u32 mode; | |
| 1281 | 1295 | |
| 1282 | 1296 | /* ... may need additional spi_device chip config data here. |
| 1283 | 1297 | * avoid stuff protocol drivers can set; but include stuff |
| @@ -44,6 +44,7 @@ extern int spi_bitbang_setup_transfer(struct spi_device *spi, · 43 unmodified lines | ||
| 44 | 44 | |
| 45 | 45 | /* start or stop queue processing */ |
| 46 | 46 | extern int spi_bitbang_start(struct spi_bitbang *spi); |
| 47 | +extern int spi_bitbang_init(struct spi_bitbang *spi); | |
| 47 | 48 | extern void spi_bitbang_stop(struct spi_bitbang *spi); |
| 48 | 49 | |
| 49 | 50 | #endif /* __SPI_BITBANG_H */ |
| @@ -57,6 +57,7 @@ · 56 unmodified lines | ||
| 57 | 57 | #include <linux/stringify.h> |
| 58 | 58 | #include <linux/bottom_half.h> |
| 59 | 59 | #include <asm/barrier.h> |
| 60 | +#include <asm/mmiowb.h> | |
| 60 | 61 | |
| 61 | 62 | |
| 62 | 63 | /* |
| @@ -178,6 +179,7 @@ static inline void do_raw_spin_lock(raw_spinlock_t *lock) __acquires(lock) · 115 unmodified lines | ||
| 178 | 179 | { |
| 179 | 180 | __acquire(lock); |
| 180 | 181 | arch_spin_lock(&lock->raw_lock); |
| 182 | + mmiowb_spin_lock(); | |
| 181 | 183 | } |
| 182 | 184 | |
| 183 | 185 | #ifndef arch_spin_lock_flags |
| @@ -189,15 +191,22 @@ do_raw_spin_lock_flags(raw_spinlock_t *lock, unsigned long *flags) __acquires(lo · 5 unmodified lines | ||
| 189 | 191 | { |
| 190 | 192 | __acquire(lock); |
| 191 | 193 | arch_spin_lock_flags(&lock->raw_lock, *flags); |
| 194 | + mmiowb_spin_lock(); | |
| 192 | 195 | } |
| 193 | 196 | |
| 194 | 197 | static inline int do_raw_spin_trylock(raw_spinlock_t *lock) |
| 195 | 198 | { |
| 196 | − return arch_spin_trylock(&(lock)->raw_lock); | |
| 199 | + int ret = arch_spin_trylock(&(lock)->raw_lock); | |
| 200 | + | |
| 201 | + if (ret) | |
| 202 | + mmiowb_spin_lock(); | |
| 203 | + | |
| 204 | + return ret; | |
| 197 | 205 | } |
| 198 | 206 | |
| 199 | 207 | static inline void do_raw_spin_unlock(raw_spinlock_t *lock) __releases(lock) |
| 200 | 208 | { |
| 209 | + mmiowb_spin_unlock(); | |
| 201 | 210 | arch_spin_unlock(&lock->raw_lock); |
| 202 | 211 | __release(lock); |
| 203 | 212 | } |
| @@ -56,45 +56,11 @@ struct srcu_struct { }; · 55 unmodified lines | ||
| 56 | 56 | |
| 57 | 57 | void call_srcu(struct srcu_struct *ssp, struct rcu_head *head, |
| 58 | 58 | void (*func)(struct rcu_head *head)); |
| 59 | −void _cleanup_srcu_struct(struct srcu_struct *ssp, bool quiesced); | |
| 59 | +void cleanup_srcu_struct(struct srcu_struct *ssp); | |
| 60 | 60 | int __srcu_read_lock(struct srcu_struct *ssp) __acquires(ssp); |
| 61 | 61 | void __srcu_read_unlock(struct srcu_struct *ssp, int idx) __releases(ssp); |
| 62 | 62 | void synchronize_srcu(struct srcu_struct *ssp); |
| 63 | 63 | |
| 64 | −/** | |
| 65 | − * cleanup_srcu_struct - deconstruct a sleep-RCU structure | |
| 66 | − * @ssp: structure to clean up. | |
| 67 | − * | |
| 68 | − * Must invoke this after you are finished using a given srcu_struct that | |
| 69 | − * was initialized via init_srcu_struct(), else you leak memory. | |
| 70 | − */ | |
| 71 | −static inline void cleanup_srcu_struct(struct srcu_struct *ssp) | |
| 72 | −{ | |
| 73 | − _cleanup_srcu_struct(ssp, false); | |
| 74 | −} | |
| 75 | − | |
| 76 | −/** | |
| 77 | − * cleanup_srcu_struct_quiesced - deconstruct a quiesced sleep-RCU structure | |
| 78 | − * @ssp: structure to clean up. | |
| 79 | − * | |
| 80 | − * Must invoke this after you are finished using a given srcu_struct that | |
| 81 | − * was initialized via init_srcu_struct(), else you leak memory. Also, | |
| 82 | − * all grace-period processing must have completed. | |
| 83 | − * | |
| 84 | − * "Completed" means that the last synchronize_srcu() and | |
| 85 | − * synchronize_srcu_expedited() calls must have returned before the call | |
| 86 | − * to cleanup_srcu_struct_quiesced(). It also means that the callback | |
| 87 | − * from the last call_srcu() must have been invoked before the call to | |
| 88 | − * cleanup_srcu_struct_quiesced(), but you can use srcu_barrier() to help | |
| 89 | − * with this last. Violating these rules will get you a WARN_ON() splat | |
| 90 | − * (with high probability, anyway), and will also cause the srcu_struct | |
| 91 | − * to be leaked. | |
| 92 | − */ | |
| 93 | −static inline void cleanup_srcu_struct_quiesced(struct srcu_struct *ssp) | |
| 94 | −{ | |
| 95 | − _cleanup_srcu_struct(ssp, true); | |
| 96 | −} | |
| 97 | − | |
| 98 | 64 | #ifdef CONFIG_DEBUG_LOCK_ALLOC |
| 99 | 65 | |
| 100 | 66 | /** |
| @@ -23,10 +23,10 @@ · 22 unmodified lines | ||
| 23 | 23 | |
| 24 | 24 | typedef u32 depot_stack_handle_t; |
| 25 | 25 | |
| 26 | −struct stack_trace; | |
| 26 | +depot_stack_handle_t stack_depot_save(unsigned long *entries, | |
| 27 | + unsigned int nr_entries, gfp_t gfp_flags); | |
| 27 | 28 | |
| 28 | −depot_stack_handle_t depot_save_stack(struct stack_trace *trace, gfp_t flags); | |
| 29 | − | |
| 30 | −void depot_fetch_stack(depot_stack_handle_t handle, struct stack_trace *trace); | |
| 29 | +unsigned int stack_depot_fetch(depot_stack_handle_t handle, | |
| 30 | + unsigned long **entries); | |
| 31 | 31 | |
| 32 | 32 | #endif |
| @@ -3,11 +3,64 @@ · 2 unmodified lines | ||
| 3 | 3 | #define __LINUX_STACKTRACE_H |
| 4 | 4 | |
| 5 | 5 | #include <linux/types.h> |
| 6 | +#include <asm/errno.h> | |
| 6 | 7 | |
| 7 | 8 | struct task_struct; |
| 8 | 9 | struct pt_regs; |
| 9 | 10 | |
| 10 | 11 | #ifdef CONFIG_STACKTRACE |
| 12 | +void stack_trace_print(unsigned long *trace, unsigned int nr_entries, | |
| 13 | + int spaces); | |
| 14 | +int stack_trace_snprint(char *buf, size_t size, unsigned long *entries, | |
| 15 | + unsigned int nr_entries, int spaces); | |
| 16 | +unsigned int stack_trace_save(unsigned long *store, unsigned int size, | |
| 17 | + unsigned int skipnr); | |
| 18 | +unsigned int stack_trace_save_tsk(struct task_struct *task, | |
| 19 | + unsigned long *store, unsigned int size, | |
| 20 | + unsigned int skipnr); | |
| 21 | +unsigned int stack_trace_save_regs(struct pt_regs *regs, unsigned long *store, | |
| 22 | + unsigned int size, unsigned int skipnr); | |
| 23 | +unsigned int stack_trace_save_user(unsigned long *store, unsigned int size); | |
| 24 | + | |
| 25 | +/* Internal interfaces. Do not use in generic code */ | |
| 26 | +#ifdef CONFIG_ARCH_STACKWALK | |
| 27 | + | |
| 28 | +/** | |
| 29 | + * stack_trace_consume_fn - Callback for arch_stack_walk() | |
| 30 | + * @cookie: Caller supplied pointer handed back by arch_stack_walk() | |
| 31 | + * @addr: The stack entry address to consume | |
| 32 | + * @reliable: True when the stack entry is reliable. Required by | |
| 33 | + * some printk based consumers. | |
| 34 | + * | |
| 35 | + * Return: True, if the entry was consumed or skipped | |
| 36 | + * False, if there is no space left to store | |
| 37 | + */ | |
| 38 | +typedef bool (*stack_trace_consume_fn)(void *cookie, unsigned long addr, | |
| 39 | + bool reliable); | |
| 40 | +/** | |
| 41 | + * arch_stack_walk - Architecture specific function to walk the stack | |
| 42 | + * @consume_entry: Callback which is invoked by the architecture code for | |
| 43 | + * each entry. | |
| 44 | + * @cookie: Caller supplied pointer which is handed back to | |
| 45 | + * @consume_entry | |
| 46 | + * @task: Pointer to a task struct, can be NULL | |
| 47 | + * @regs: Pointer to registers, can be NULL | |
| 48 | + * | |
| 49 | + * ============ ======= ============================================ | |
| 50 | + * task regs | |
| 51 | + * ============ ======= ============================================ | |
| 52 | + * task NULL Stack trace from task (can be current) | |
| 53 | + * current regs Stack trace starting on regs->stackpointer | |
| 54 | + * ============ ======= ============================================ | |
| 55 | + */ | |
| 56 | +void arch_stack_walk(stack_trace_consume_fn consume_entry, void *cookie, | |
| 57 | + struct task_struct *task, struct pt_regs *regs); | |
| 58 | +int arch_stack_walk_reliable(stack_trace_consume_fn consume_entry, void *cookie, | |
| 59 | + struct task_struct *task); | |
| 60 | +void arch_stack_walk_user(stack_trace_consume_fn consume_entry, void *cookie, | |
| 61 | + const struct pt_regs *regs); | |
| 62 | + | |
| 63 | +#else /* CONFIG_ARCH_STACKWALK */ | |
| 11 | 64 | struct stack_trace { |
| 12 | 65 | unsigned int nr_entries, max_entries; |
| 13 | 66 | unsigned long *entries; |
| @@ -21,24 +74,20 @@ extern void save_stack_trace_tsk(struct task_struct *tsk, · 7 unmodified lines | ||
| 21 | 74 | struct stack_trace *trace); |
| 22 | 75 | extern int save_stack_trace_tsk_reliable(struct task_struct *tsk, |
| 23 | 76 | struct stack_trace *trace); |
| 24 | − | |
| 25 | −extern void print_stack_trace(struct stack_trace *trace, int spaces); | |
| 26 | −extern int snprint_stack_trace(char *buf, size_t size, | |
| 27 | − struct stack_trace *trace, int spaces); | |
| 28 | − | |
| 29 | −#ifdef CONFIG_USER_STACKTRACE_SUPPORT | |
| 30 | 77 | extern void save_stack_trace_user(struct stack_trace *trace); |
| 78 | +#endif /* !CONFIG_ARCH_STACKWALK */ | |
| 79 | +#endif /* CONFIG_STACKTRACE */ | |
| 80 | + | |
| 81 | +#if defined(CONFIG_STACKTRACE) && defined(CONFIG_HAVE_RELIABLE_STACKTRACE) | |
| 82 | +int stack_trace_save_tsk_reliable(struct task_struct *tsk, unsigned long *store, | |
| 83 | + unsigned int size); | |
| 31 | 84 | #else |
| 32 | −# define save_stack_trace_user(trace) do { } while (0) | |
| 85 | +static inline int stack_trace_save_tsk_reliable(struct task_struct *tsk, | |
| 86 | + unsigned long *store, | |
| 87 | + unsigned int size) | |
| 88 | +{ | |
| 89 | + return -ENOSYS; | |
| 90 | +} | |
| 33 | 91 | #endif |
| 34 | 92 | |
| 35 | −#else /* !CONFIG_STACKTRACE */ | |
| 36 | −# define save_stack_trace(trace) do { } while (0) | |
| 37 | −# define save_stack_trace_tsk(tsk, trace) do { } while (0) | |
| 38 | −# define save_stack_trace_user(trace) do { } while (0) | |
| 39 | −# define print_stack_trace(trace, spaces) do { } while (0) | |
| 40 | −# define snprint_stack_trace(buf, size, trace, spaces) do { } while (0) | |
| 41 | −# define save_stack_trace_tsk_reliable(tsk, trace) ({ -ENOSYS; }) | |
| 42 | −#endif /* CONFIG_STACKTRACE */ | |
| 43 | − | |
| 44 | 93 | #endif /* __LINUX_STACKTRACE_H */ |
| @@ -31,6 +31,10 @@ size_t strlcpy(char *, const char *, size_t); · 30 unmodified lines | ||
| 31 | 31 | #ifndef __HAVE_ARCH_STRSCPY |
| 32 | 32 | ssize_t strscpy(char *, const char *, size_t); |
| 33 | 33 | #endif |
| 34 | + | |
| 35 | +/* Wraps calls to strscpy()/memset(), no arch specific code required */ | |
| 36 | +ssize_t strscpy_pad(char *dest, const char *src, size_t count); | |
| 37 | + | |
| 34 | 38 | #ifndef __HAVE_ARCH_STRCAT |
| 35 | 39 | extern char * strcat(char *, const char *); |
| 36 | 40 | #endif |
| @@ -50,6 +50,7 @@ struct rpc_clnt { · 49 unmodified lines | ||
| 50 | 50 | struct rpc_iostats * cl_metrics; /* per-client statistics */ |
| 51 | 51 | |
| 52 | 52 | unsigned int cl_softrtry : 1,/* soft timeouts */ |
| 53 | + cl_softerr : 1,/* Timeouts return errors */ | |
| 53 | 54 | cl_discrtry : 1,/* disconnect before retry */ |
| 54 | 55 | cl_noretranstimeo: 1,/* No retransmit timeouts */ |
| 55 | 56 | cl_autobind : 1,/* use getport() */ |
| @@ -71,6 +72,7 @@ struct rpc_clnt { · 15 unmodified lines | ||
| 71 | 72 | struct dentry *cl_debugfs; /* debugfs directory */ |
| 72 | 73 | #endif |
| 73 | 74 | struct rpc_xprt_iter cl_xpi; |
| 75 | + const struct cred *cl_cred; | |
| 74 | 76 | }; |
| 75 | 77 | |
| 76 | 78 | /* |
| @@ -125,6 +127,7 @@ struct rpc_create_args { · 48 unmodified lines | ||
| 125 | 127 | unsigned long flags; |
| 126 | 128 | char *client_name; |
| 127 | 129 | struct svc_xprt *bc_xprt; /* NFSv4.1 backchannel */ |
| 130 | + const struct cred *cred; | |
| 128 | 131 | }; |
| 129 | 132 | |
| 130 | 133 | struct rpc_add_xprt_test { |
| @@ -144,6 +147,7 @@ struct rpc_add_xprt_test { · 13 unmodified lines | ||
| 144 | 147 | #define RPC_CLNT_CREATE_INFINITE_SLOTS (1UL << 7) |
| 145 | 148 | #define RPC_CLNT_CREATE_NO_IDLE_TIMEOUT (1UL << 8) |
| 146 | 149 | #define RPC_CLNT_CREATE_NO_RETRANS_TIMEOUT (1UL << 9) |
| 150 | +#define RPC_CLNT_CREATE_SOFTERR (1UL << 10) | |
| 147 | 151 | |
| 148 | 152 | struct rpc_clnt *rpc_create(struct rpc_create_args *args); |
| 149 | 153 | struct rpc_clnt *rpc_bind_new_program(struct rpc_clnt *, |
| @@ -35,7 +35,6 @@ struct rpc_wait { · 34 unmodified lines | ||
| 35 | 35 | struct list_head list; /* wait queue links */ |
| 36 | 36 | struct list_head links; /* Links to related tasks */ |
| 37 | 37 | struct list_head timer_list; /* Timer list */ |
| 38 | − unsigned long expires; | |
| 39 | 38 | }; |
| 40 | 39 | |
| 41 | 40 | /* |
| @@ -62,6 +61,8 @@ struct rpc_task { · 20 unmodified lines | ||
| 62 | 61 | struct rpc_wait tk_wait; /* RPC wait */ |
| 63 | 62 | } u; |
| 64 | 63 | |
| 64 | + int tk_rpc_status; /* Result of last RPC operation */ | |
| 65 | + | |
| 65 | 66 | /* |
| 66 | 67 | * RPC call state |
| 67 | 68 | */ |
| @@ -125,7 +126,6 @@ struct rpc_task_setup { · 57 unmodified lines | ||
| 125 | 126 | #define RPC_CALL_MAJORSEEN 0x0020 /* major timeout seen */ |
| 126 | 127 | #define RPC_TASK_ROOTCREDS 0x0040 /* force root creds */ |
| 127 | 128 | #define RPC_TASK_DYNAMIC 0x0080 /* task was kmalloc'ed */ |
| 128 | −#define RPC_TASK_KILLED 0x0100 /* task was killed */ | |
| 129 | 129 | #define RPC_TASK_SOFT 0x0200 /* Use soft timeouts */ |
| 130 | 130 | #define RPC_TASK_SOFTCONN 0x0400 /* Fail if can't connect */ |
| 131 | 131 | #define RPC_TASK_SENT 0x0800 /* message was sent */ |
| @@ -135,7 +135,6 @@ struct rpc_task_setup { · 3 unmodified lines | ||
| 135 | 135 | |
| 136 | 136 | #define RPC_IS_ASYNC(t) ((t)->tk_flags & RPC_TASK_ASYNC) |
| 137 | 137 | #define RPC_IS_SWAPPER(t) ((t)->tk_flags & RPC_TASK_SWAPPER) |
| 138 | −#define RPC_ASSASSINATED(t) ((t)->tk_flags & RPC_TASK_KILLED) | |
| 139 | 138 | #define RPC_IS_SOFT(t) ((t)->tk_flags & (RPC_TASK_SOFT|RPC_TASK_TIMEOUT)) |
| 140 | 139 | #define RPC_IS_SOFTCONN(t) ((t)->tk_flags & RPC_TASK_SOFTCONN) |
| 141 | 140 | #define RPC_WAS_SENT(t) ((t)->tk_flags & RPC_TASK_SENT) |
| @@ -146,6 +145,7 @@ struct rpc_task_setup { · 4 unmodified lines | ||
| 146 | 145 | #define RPC_TASK_NEED_XMIT 3 |
| 147 | 146 | #define RPC_TASK_NEED_RECV 4 |
| 148 | 147 | #define RPC_TASK_MSG_PIN_WAIT 5 |
| 148 | +#define RPC_TASK_SIGNALLED 6 | |
| 149 | 149 | |
| 150 | 150 | #define RPC_IS_RUNNING(t) test_bit(RPC_TASK_RUNNING, &(t)->tk_runstate) |
| 151 | 151 | #define rpc_set_running(t) set_bit(RPC_TASK_RUNNING, &(t)->tk_runstate) |
| @@ -169,6 +169,8 @@ struct rpc_task_setup { · 17 unmodified lines | ||
| 169 | 169 | |
| 170 | 170 | #define RPC_IS_ACTIVATED(t) test_bit(RPC_TASK_ACTIVE, &(t)->tk_runstate) |
| 171 | 171 | |
| 172 | +#define RPC_SIGNALLED(t) test_bit(RPC_TASK_SIGNALLED, &(t)->tk_runstate) | |
| 173 | + | |
| 172 | 174 | /* |
| 173 | 175 | * Task priorities. |
| 174 | 176 | * Note: if you change these, you must also change |
| @@ -183,7 +185,6 @@ struct rpc_task_setup { · 8 unmodified lines | ||
| 183 | 185 | struct rpc_timer { |
| 184 | 186 | struct timer_list timer; |
| 185 | 187 | struct list_head list; |
| 186 | − unsigned long expires; | |
| 187 | 188 | }; |
| 188 | 189 | |
| 189 | 190 | /* |
| @@ -217,6 +218,7 @@ struct rpc_task *rpc_run_task(const struct rpc_task_setup *); · 27 unmodified lines | ||
| 217 | 218 | struct rpc_task *rpc_run_bc_task(struct rpc_rqst *req); |
| 218 | 219 | void rpc_put_task(struct rpc_task *); |
| 219 | 220 | void rpc_put_task_async(struct rpc_task *); |
| 221 | +void rpc_signal_task(struct rpc_task *); | |
| 220 | 222 | void rpc_exit_task(struct rpc_task *); |
| 221 | 223 | void rpc_exit(struct rpc_task *, int); |
| 222 | 224 | void rpc_release_calldata(const struct rpc_call_ops *, void *); |
| @@ -225,11 +227,19 @@ void rpc_execute(struct rpc_task *); · 2 unmodified lines | ||
| 225 | 227 | void rpc_init_priority_wait_queue(struct rpc_wait_queue *, const char *); |
| 226 | 228 | void rpc_init_wait_queue(struct rpc_wait_queue *, const char *); |
| 227 | 229 | void rpc_destroy_wait_queue(struct rpc_wait_queue *); |
| 230 | +unsigned long rpc_task_timeout(const struct rpc_task *task); | |
| 231 | +void rpc_sleep_on_timeout(struct rpc_wait_queue *queue, | |
| 232 | + struct rpc_task *task, | |
| 233 | + rpc_action action, | |
| 234 | + unsigned long timeout); | |
| 228 | 235 | void rpc_sleep_on(struct rpc_wait_queue *, struct rpc_task *, |
| 229 | 236 | rpc_action action); |
| 237 | +void rpc_sleep_on_priority_timeout(struct rpc_wait_queue *queue, | |
| 238 | + struct rpc_task *task, | |
| 239 | + unsigned long timeout, | |
| 240 | + int priority); | |
| 230 | 241 | void rpc_sleep_on_priority(struct rpc_wait_queue *, |
| 231 | 242 | struct rpc_task *, |
| 232 | − rpc_action action, | |
| 233 | 243 | int priority); |
| 234 | 244 | void rpc_wake_up_queued_task_on_wq(struct workqueue_struct *wq, |
| 235 | 245 | struct rpc_wait_queue *queue, |
| @@ -271,6 +271,7 @@ struct svc_rqst { · 270 unmodified lines | ||
| 271 | 271 | #define RQ_VICTIM (5) /* about to be shut down */ |
| 272 | 272 | #define RQ_BUSY (6) /* request is busy */ |
| 273 | 273 | #define RQ_DATA (7) /* request has data */ |
| 274 | +#define RQ_AUTHERR (8) /* Request status is auth error */ | |
| 274 | 275 | unsigned long rq_flags; /* flags field */ |
| 275 | 276 | ktime_t rq_qtime; /* enqueue time */ |
| 276 | 277 | |
| @@ -382,6 +383,16 @@ struct svc_deferred_req { · 105 unmodified lines | ||
| 382 | 383 | __be32 args[0]; |
| 383 | 384 | }; |
| 384 | 385 | |
| 386 | +struct svc_process_info { | |
| 387 | + union { | |
| 388 | + int (*dispatch)(struct svc_rqst *, __be32 *); | |
| 389 | + struct { | |
| 390 | + unsigned int lovers; | |
| 391 | + unsigned int hivers; | |
| 392 | + } mismatch; | |
| 393 | + }; | |
| 394 | +}; | |
| 395 | + | |
| 385 | 396 | /* |
| 386 | 397 | * List of RPC programs on the same transport endpoint |
| 387 | 398 | */ |
| @@ -396,6 +407,14 @@ struct svc_program { · 8 unmodified lines | ||
| 396 | 407 | char * pg_class; /* class name: services sharing authentication */ |
| 397 | 408 | struct svc_stat * pg_stats; /* rpc statistics */ |
| 398 | 409 | int (*pg_authenticate)(struct svc_rqst *); |
| 410 | + __be32 (*pg_init_request)(struct svc_rqst *, | |
| 411 | + const struct svc_program *, | |
| 412 | + struct svc_process_info *); | |
| 413 | + int (*pg_rpcbind_set)(struct net *net, | |
| 414 | + const struct svc_program *, | |
| 415 | + u32 version, int family, | |
| 416 | + unsigned short proto, | |
| 417 | + unsigned short port); | |
| 399 | 418 | }; |
| 400 | 419 | |
| 401 | 420 | /* |
| @@ -504,6 +523,20 @@ unsigned int svc_fill_write_vector(struct svc_rqst *rqstp, · 102 unmodified lines | ||
| 504 | 523 | char *svc_fill_symlink_pathname(struct svc_rqst *rqstp, |
| 505 | 524 | struct kvec *first, void *p, |
| 506 | 525 | size_t total); |
| 526 | +__be32 svc_return_autherr(struct svc_rqst *rqstp, __be32 auth_err); | |
| 527 | +__be32 svc_generic_init_request(struct svc_rqst *rqstp, | |
| 528 | + const struct svc_program *progp, | |
| 529 | + struct svc_process_info *procinfo); | |
| 530 | +int svc_generic_rpcbind_set(struct net *net, | |
| 531 | + const struct svc_program *progp, | |
| 532 | + u32 version, int family, | |
| 533 | + unsigned short proto, | |
| 534 | + unsigned short port); | |
| 535 | +int svc_rpcbind_set_version(struct net *net, | |
| 536 | + const struct svc_program *progp, | |
| 537 | + u32 version, int family, | |
| 538 | + unsigned short proto, | |
| 539 | + unsigned short port); | |
| 507 | 540 | |
| 508 | 541 | #define RPC_MAX_ADDRBUFLEN (63U) |
| 509 | 542 | |
| @@ -86,6 +86,7 @@ struct svc_xprt { · 85 unmodified lines | ||
| 86 | 86 | struct list_head xpt_users; /* callbacks on free */ |
| 87 | 87 | |
| 88 | 88 | struct net *xpt_net; |
| 89 | + const struct cred *xpt_cred; | |
| 89 | 90 | struct rpc_xprt *xpt_bc_xprt; /* NFSv4.1 backchannel */ |
| 90 | 91 | struct rpc_xprt_switch *xpt_bc_xps; /* NFSv4.1 backchannel */ |
| 91 | 92 | }; |
| @@ -119,7 +120,8 @@ void svc_unreg_xprt_class(struct svc_xprt_class *); · 27 unmodified lines | ||
| 119 | 120 | void svc_xprt_init(struct net *, struct svc_xprt_class *, struct svc_xprt *, |
| 120 | 121 | struct svc_serv *); |
| 121 | 122 | int svc_create_xprt(struct svc_serv *, const char *, struct net *, |
| 122 | − const int, const unsigned short, int); | |
| 123 | + const int, const unsigned short, int, | |
| 124 | + const struct cred *); | |
| 123 | 125 | void svc_xprt_do_enqueue(struct svc_xprt *xprt); |
| 124 | 126 | void svc_xprt_enqueue(struct svc_xprt *xprt); |
| 125 | 127 | void svc_xprt_put(struct svc_xprt *xprt); |
| @@ -59,7 +59,8 @@ void svc_drop(struct svc_rqst *); · 58 unmodified lines | ||
| 59 | 59 | void svc_sock_update_bufs(struct svc_serv *serv); |
| 60 | 60 | bool svc_alien_sock(struct net *net, int fd); |
| 61 | 61 | int svc_addsock(struct svc_serv *serv, const int fd, |
| 62 | − char *name_return, const size_t len); | |
| 62 | + char *name_return, const size_t len, | |
| 63 | + const struct cred *cred); | |
| 63 | 64 | void svc_init_xprt_sock(void); |
| 64 | 65 | void svc_cleanup_xprt_sock(void); |
| 65 | 66 | struct svc_xprt *svc_sock_create(struct svc_serv *serv, int prot); |
| @@ -143,7 +143,7 @@ struct rpc_xprt_ops { · 142 unmodified lines | ||
| 143 | 143 | void (*buf_free)(struct rpc_task *task); |
| 144 | 144 | void (*prepare_request)(struct rpc_rqst *req); |
| 145 | 145 | int (*send_request)(struct rpc_rqst *req); |
| 146 | − void (*set_retrans_timeout)(struct rpc_task *task); | |
| 146 | + void (*wait_for_reply_request)(struct rpc_task *task); | |
| 147 | 147 | void (*timer)(struct rpc_xprt *xprt, struct rpc_task *task); |
| 148 | 148 | void (*release_request)(struct rpc_task *task); |
| 149 | 149 | void (*close)(struct rpc_xprt *xprt); |
| @@ -378,8 +378,8 @@ xprt_disable_swap(struct rpc_xprt *xprt) · 228 unmodified lines | ||
| 378 | 378 | int xprt_register_transport(struct xprt_class *type); |
| 379 | 379 | int xprt_unregister_transport(struct xprt_class *type); |
| 380 | 380 | int xprt_load_transport(const char *); |
| 381 | −void xprt_set_retrans_timeout_def(struct rpc_task *task); | |
| 382 | −void xprt_set_retrans_timeout_rtt(struct rpc_task *task); | |
| 381 | +void xprt_wait_for_reply_request_def(struct rpc_task *task); | |
| 382 | +void xprt_wait_for_reply_request_rtt(struct rpc_task *task); | |
| 383 | 383 | void xprt_wake_pending_tasks(struct rpc_xprt *xprt, int status); |
| 384 | 384 | void xprt_wait_for_buffer_space(struct rpc_xprt *xprt); |
| 385 | 385 | bool xprt_write_space(struct rpc_xprt *xprt); |
| @@ -425,6 +425,7 @@ void restore_processor_state(void); · 424 unmodified lines | ||
| 425 | 425 | /* kernel/power/main.c */ |
| 426 | 426 | extern int register_pm_notifier(struct notifier_block *nb); |
| 427 | 427 | extern int unregister_pm_notifier(struct notifier_block *nb); |
| 428 | +extern void ksys_sync_helper(void); | |
| 428 | 429 | |
| 429 | 430 | #define pm_notifier(fn, pri) { \ |
| 430 | 431 | static struct notifier_block fn##_nb = \ |
| @@ -462,6 +463,8 @@ static inline int unregister_pm_notifier(struct notifier_block *nb) · 31 unmodified lines | ||
| 462 | 463 | return 0; |
| 463 | 464 | } |
| 464 | 465 | |
| 466 | +static inline void ksys_sync_helper(void) {} | |
| 467 | + | |
| 465 | 468 | #define pm_notifier(fn, pri) do { (void)(fn); } while (0) |
| 466 | 469 | |
| 467 | 470 | static inline bool pm_wakeup_pending(void) { return false; } |
| @@ -20,7 +20,7 @@ · 19 unmodified lines | ||
| 20 | 20 | #include <linux/cdev.h> |
| 21 | 21 | |
| 22 | 22 | #define SWITCHTEC_MRPC_PAYLOAD_SIZE 1024 |
| 23 | −#define SWITCHTEC_MAX_PFF_CSR 48 | |
| 23 | +#define SWITCHTEC_MAX_PFF_CSR 255 | |
| 24 | 24 | |
| 25 | 25 | #define SWITCHTEC_EVENT_OCCURRED BIT(0) |
| 26 | 26 | #define SWITCHTEC_EVENT_CLEAR BIT(0) |
| @@ -985,6 +985,15 @@ asmlinkage long sys_statx(int dfd, const char __user *path, unsigned flags, · 984 unmodified lines | ||
| 985 | 985 | unsigned mask, struct statx __user *buffer); |
| 986 | 986 | asmlinkage long sys_rseq(struct rseq __user *rseq, uint32_t rseq_len, |
| 987 | 987 | int flags, uint32_t sig); |
| 988 | +asmlinkage long sys_open_tree(int dfd, const char __user *path, unsigned flags); | |
| 989 | +asmlinkage long sys_move_mount(int from_dfd, const char __user *from_path, | |
| 990 | + int to_dfd, const char __user *to_path, | |
| 991 | + unsigned int ms_flags); | |
| 992 | +asmlinkage long sys_fsopen(const char __user *fs_name, unsigned int flags); | |
| 993 | +asmlinkage long sys_fsconfig(int fs_fd, unsigned int cmd, const char __user *key, | |
| 994 | + const void __user *value, int aux); | |
| 995 | +asmlinkage long sys_fsmount(int fs_fd, unsigned int flags, unsigned int ms_flags); | |
| 996 | +asmlinkage long sys_fspick(int dfd, const char __user *path, unsigned int flags); | |
| 988 | 997 | asmlinkage long sys_pidfd_send_signal(int pidfd, int sig, |
| 989 | 998 | siginfo_t __user *info, |
| 990 | 999 | unsigned int flags); |
| @@ -442,11 +442,16 @@ void thermal_zone_device_update(struct thermal_zone_device *, · 441 unmodified lines | ||
| 442 | 442 | enum thermal_notify_event); |
| 443 | 443 | void thermal_zone_set_trips(struct thermal_zone_device *); |
| 444 | 444 | |
| 445 | −struct thermal_cooling_device *thermal_cooling_device_register(char *, void *, | |
| 446 | − const struct thermal_cooling_device_ops *); | |
| 445 | +struct thermal_cooling_device *thermal_cooling_device_register(const char *, | |
| 446 | + void *, const struct thermal_cooling_device_ops *); | |
| 447 | 447 | struct thermal_cooling_device * |
| 448 | −thermal_of_cooling_device_register(struct device_node *np, char *, void *, | |
| 448 | +thermal_of_cooling_device_register(struct device_node *np, const char *, void *, | |
| 449 | 449 | const struct thermal_cooling_device_ops *); |
| 450 | +struct thermal_cooling_device * | |
| 451 | +devm_thermal_of_cooling_device_register(struct device *dev, | |
| 452 | + struct device_node *np, | |
| 453 | + char *type, void *devdata, | |
| 454 | + const struct thermal_cooling_device_ops *ops); | |
| 450 | 455 | void thermal_cooling_device_unregister(struct thermal_cooling_device *); |
| 451 | 456 | struct thermal_zone_device *thermal_zone_get_zone_by_name(const char *name); |
| 452 | 457 | int thermal_zone_get_temp(struct thermal_zone_device *tz, int *temp); |
| @@ -503,6 +508,14 @@ static inline struct thermal_cooling_device * · 50 unmodified lines | ||
| 503 | 508 | thermal_of_cooling_device_register(struct device_node *np, |
| 504 | 509 | char *type, void *devdata, const struct thermal_cooling_device_ops *ops) |
| 505 | 510 | { return ERR_PTR(-ENODEV); } |
| 511 | +static inline struct thermal_cooling_device * | |
| 512 | +devm_thermal_of_cooling_device_register(struct device *dev, | |
| 513 | + struct device_node *np, | |
| 514 | + char *type, void *devdata, | |
| 515 | + const struct thermal_cooling_device_ops *ops) | |
| 516 | +{ | |
| 517 | + return ERR_PTR(-ENODEV); | |
| 518 | +} | |
| 506 | 519 | static inline void thermal_cooling_device_unregister( |
| 507 | 520 | struct thermal_cooling_device *cdev) |
| 508 | 521 | { } |
| @@ -181,6 +181,8 @@ void tb_unregister_property_dir(const char *key, struct tb_property_dir *dir); · 180 unmodified lines | ||
| 181 | 181 | * @device_name: Name of the device (or %NULL if not known) |
| 182 | 182 | * @is_unplugged: The XDomain is unplugged |
| 183 | 183 | * @resume: The XDomain is being resumed |
| 184 | + * @needs_uuid: If the XDomain does not have @remote_uuid it will be | |
| 185 | + * queried first | |
| 184 | 186 | * @transmit_path: HopID which the remote end expects us to transmit |
| 185 | 187 | * @transmit_ring: Local ring (hop) where outgoing packets are pushed |
| 186 | 188 | * @receive_path: HopID which we expect the remote end to transmit |
| @@ -189,6 +191,9 @@ void tb_unregister_property_dir(const char *key, struct tb_property_dir *dir); · 2 unmodified lines | ||
| 189 | 191 | * @properties: Properties exported by the remote domain |
| 190 | 192 | * @property_block_gen: Generation of @properties |
| 191 | 193 | * @properties_lock: Lock protecting @properties. |
| 194 | + * @get_uuid_work: Work used to retrieve @remote_uuid | |
| 195 | + * @uuid_retries: Number of times left @remote_uuid is requested before | |
| 196 | + * giving up | |
| 192 | 197 | * @get_properties_work: Work used to get remote domain properties |
| 193 | 198 | * @properties_retries: Number of times left to read properties |
| 194 | 199 | * @properties_changed_work: Work used to notify the remote domain that |
| @@ -220,6 +225,7 @@ struct tb_xdomain { · 25 unmodified lines | ||
| 220 | 225 | const char *device_name; |
| 221 | 226 | bool is_unplugged; |
| 222 | 227 | bool resume; |
| 228 | + bool needs_uuid; | |
| 223 | 229 | u16 transmit_path; |
| 224 | 230 | u16 transmit_ring; |
| 225 | 231 | u16 receive_path; |
| @@ -227,6 +233,8 @@ struct tb_xdomain { · 1 unmodified line | ||
| 227 | 233 | struct ida service_ids; |
| 228 | 234 | struct tb_property_dir *properties; |
| 229 | 235 | u32 property_block_gen; |
| 236 | + struct delayed_work get_uuid_work; | |
| 237 | + int uuid_retries; | |
| 230 | 238 | struct delayed_work get_properties_work; |
| 231 | 239 | int properties_retries; |
| 232 | 240 | struct delayed_work properties_changed_work; |
| @@ -55,6 +55,7 @@ struct ti_emif_pm_data { · 54 unmodified lines | ||
| 55 | 55 | struct ti_emif_pm_functions { |
| 56 | 56 | u32 save_context; |
| 57 | 57 | u32 restore_context; |
| 58 | + u32 run_hw_leveling; | |
| 58 | 59 | u32 enter_sr; |
| 59 | 60 | u32 exit_sr; |
| 60 | 61 | u32 abort_sr; |
| @@ -126,6 +127,8 @@ static inline void ti_emif_asm_offsets(void) · 65 unmodified lines | ||
| 126 | 127 | offsetof(struct ti_emif_pm_functions, save_context)); |
| 127 | 128 | DEFINE(EMIF_PM_RESTORE_CONTEXT_OFFSET, |
| 128 | 129 | offsetof(struct ti_emif_pm_functions, restore_context)); |
| 130 | + DEFINE(EMIF_PM_RUN_HW_LEVELING, | |
| 131 | + offsetof(struct ti_emif_pm_functions, run_hw_leveling)); | |
| 129 | 132 | DEFINE(EMIF_PM_ENTER_SR_OFFSET, |
| 130 | 133 | offsetof(struct ti_emif_pm_functions, enter_sr)); |
| 131 | 134 | DEFINE(EMIF_PM_EXIT_SR_OFFSET, |
| @@ -68,6 +68,12 @@ extern void tick_broadcast_control(enum tick_broadcast_mode mode); · 67 unmodified lines | ||
| 68 | 68 | static inline void tick_broadcast_control(enum tick_broadcast_mode mode) { } |
| 69 | 69 | #endif /* BROADCAST */ |
| 70 | 70 | |
| 71 | +#if defined(CONFIG_GENERIC_CLOCKEVENTS_BROADCAST) && defined(CONFIG_HOTPLUG_CPU) | |
| 72 | +extern void tick_offline_cpu(unsigned int cpu); | |
| 73 | +#else | |
| 74 | +static inline void tick_offline_cpu(unsigned int cpu) { } | |
| 75 | +#endif | |
| 76 | + | |
| 71 | 77 | #ifdef CONFIG_GENERIC_CLOCKEVENTS |
| 72 | 78 | extern int tick_broadcast_oneshot_control(enum tick_broadcast_state state); |
| 73 | 79 | #else |
| @@ -122,6 +128,7 @@ extern void tick_nohz_idle_enter(void); · 48 unmodified lines | ||
| 122 | 128 | extern void tick_nohz_idle_exit(void); |
| 123 | 129 | extern void tick_nohz_irq_exit(void); |
| 124 | 130 | extern bool tick_nohz_idle_got_tick(void); |
| 131 | +extern ktime_t tick_nohz_get_next_hrtimer(void); | |
| 125 | 132 | extern ktime_t tick_nohz_get_sleep_length(ktime_t *delta_next); |
| 126 | 133 | extern unsigned long tick_nohz_get_idle_calls(void); |
| 127 | 134 | extern unsigned long tick_nohz_get_idle_calls_cpu(int cpu); |
| @@ -145,7 +152,11 @@ static inline void tick_nohz_idle_restart_tick(void) { } · 17 unmodified lines | ||
| 145 | 152 | static inline void tick_nohz_idle_enter(void) { } |
| 146 | 153 | static inline void tick_nohz_idle_exit(void) { } |
| 147 | 154 | static inline bool tick_nohz_idle_got_tick(void) { return false; } |
| 148 | − | |
| 155 | +static inline ktime_t tick_nohz_get_next_hrtimer(void) | |
| 156 | +{ | |
| 157 | + /* Next wake up is the tick period, assume it starts now */ | |
| 158 | + return ktime_add(ktime_get(), TICK_NSEC); | |
| 159 | +} | |
| 149 | 160 | static inline ktime_t tick_nohz_get_sleep_length(ktime_t *delta_next) |
| 150 | 161 | { |
| 151 | 162 | *delta_next = TICK_NSEC; |
| @@ -33,6 +33,17 @@ struct itimerspec64 { · 32 unmodified lines | ||
| 33 | 33 | #define KTIME_MAX ((s64)~((u64)1 << 63)) |
| 34 | 34 | #define KTIME_SEC_MAX (KTIME_MAX / NSEC_PER_SEC) |
| 35 | 35 | |
| 36 | +/* | |
| 37 | + * Limits for settimeofday(): | |
| 38 | + * | |
| 39 | + * To prevent setting the time close to the wraparound point time setting | |
| 40 | + * is limited so a reasonable uptime can be accomodated. Uptime of 30 years | |
| 41 | + * should be really sufficient, which means the cutoff is 2232. At that | |
| 42 | + * point the cutoff is just a small part of the larger problem. | |
| 43 | + */ | |
| 44 | +#define TIME_UPTIME_SEC_MAX (30LL * 365 * 24 *3600) | |
| 45 | +#define TIME_SETTOD_SEC_MAX (KTIME_SEC_MAX - TIME_UPTIME_SEC_MAX) | |
| 46 | + | |
| 36 | 47 | static inline int timespec64_equal(const struct timespec64 *a, |
| 37 | 48 | const struct timespec64 *b) |
| 38 | 49 | { |
| @@ -100,6 +111,16 @@ static inline bool timespec64_valid_strict(const struct timespec64 *ts) · 61 unmodified lines | ||
| 100 | 111 | return true; |
| 101 | 112 | } |
| 102 | 113 | |
| 114 | +static inline bool timespec64_valid_settod(const struct timespec64 *ts) | |
| 115 | +{ | |
| 116 | + if (!timespec64_valid(ts)) | |
| 117 | + return false; | |
| 118 | + /* Disallow values which cause overflow issues vs. CLOCK_REALTIME */ | |
| 119 | + if ((unsigned long long)ts->tv_sec >= TIME_SETTOD_SEC_MAX) | |
| 120 | + return false; | |
| 121 | + return true; | |
| 122 | +} | |
| 123 | + | |
| 103 | 124 | /** |
| 104 | 125 | * timespec64_to_ns - Convert timespec64 to nanoseconds |
| 105 | 126 | * @ts: pointer to the timespec64 variable to be converted |
| @@ -45,6 +45,7 @@ struct bpf_raw_event_map { · 44 unmodified lines | ||
| 45 | 45 | struct tracepoint *tp; |
| 46 | 46 | void *bpf_func; |
| 47 | 47 | u32 num_args; |
| 48 | + u32 writable_size; | |
| 48 | 49 | } __aligned(32); |
| 49 | 50 | |
| 50 | 51 | #endif |
| @@ -548,4 +548,19 @@ static inline struct tracepoint *tracepoint_ptr_deref(tracepoint_ptr_t *p) · 547 unmodified lines | ||
| 548 | 548 | |
| 549 | 549 | #define TRACE_EVENT_PERF_PERM(event, expr...) |
| 550 | 550 | |
| 551 | +#define DECLARE_EVENT_NOP(name, proto, args) \ | |
| 552 | + static inline void trace_##name(proto) \ | |
| 553 | + { } \ | |
| 554 | + static inline bool trace_##name##_enabled(void) \ | |
| 555 | + { \ | |
| 556 | + return false; \ | |
| 557 | + } | |
| 558 | + | |
| 559 | +#define TRACE_EVENT_NOP(name, proto, args, struct, assign, print) \ | |
| 560 | + DECLARE_EVENT_NOP(name, PARAMS(proto), PARAMS(args)) | |
| 561 | + | |
| 562 | +#define DECLARE_EVENT_CLASS_NOP(name, proto, args, tstruct, assign, print) | |
| 563 | +#define DEFINE_EVENT_NOP(template, name, proto, args) \ | |
| 564 | + DECLARE_EVENT_NOP(name, PARAMS(proto), PARAMS(args)) | |
| 565 | + | |
| 551 | 566 | #endif /* ifdef TRACE_EVENT (see note above) */ |
| @@ -127,13 +127,8 @@ typedef s64 int64_t; · 126 unmodified lines | ||
| 127 | 127 | * |
| 128 | 128 | * blkcnt_t is the type of the inode's block count. |
| 129 | 129 | */ |
| 130 | −#ifdef CONFIG_LBDAF | |
| 131 | 130 | typedef u64 sector_t; |
| 132 | 131 | typedef u64 blkcnt_t; |
| 133 | −#else | |
| 134 | −typedef unsigned long sector_t; | |
| 135 | −typedef unsigned long blkcnt_t; | |
| 136 | −#endif | |
| 137 | 132 | |
| 138 | 133 | /* |
| 139 | 134 | * The type of an index into the pagecache. |
| @@ -268,6 +268,8 @@ extern long strncpy_from_unsafe(char *dst, const void *unsafe_addr, long count); · 267 unmodified lines | ||
| 268 | 268 | #define user_access_end() do { } while (0) |
| 269 | 269 | #define unsafe_get_user(x, ptr, err) do { if (unlikely(__get_user(x, ptr))) goto err; } while (0) |
| 270 | 270 | #define unsafe_put_user(x, ptr, err) do { if (unlikely(__put_user(x, ptr))) goto err; } while (0) |
| 271 | +static inline unsigned long user_access_save(void) { return 0UL; } | |
| 272 | +static inline void user_access_restore(unsigned long flags) { } | |
| 271 | 273 | #endif |
| 272 | 274 | |
| 273 | 275 | #ifdef CONFIG_HARDENED_USERCOPY |
| @@ -60,7 +60,7 @@ struct iov_iter { · 59 unmodified lines | ||
| 60 | 60 | |
| 61 | 61 | static inline enum iter_type iov_iter_type(const struct iov_iter *i) |
| 62 | 62 | { |
| 63 | − return i->type & ~(READ | WRITE); | |
| 63 | + return i->type & ~(READ | WRITE | ITER_BVEC_FLAG_NO_REF); | |
| 64 | 64 | } |
| 65 | 65 | |
| 66 | 66 | static inline bool iter_is_iovec(const struct iov_iter *i) |
| @@ -0,0 +1,30 @@ | ||
| 1 | +/* SPDX-License-Identifier: GPL-2.0 */ | |
| 2 | +#ifndef _LINUX_UNICODE_H | |
| 3 | +#define _LINUX_UNICODE_H | |
| 4 | + | |
| 5 | +#include <linux/init.h> | |
| 6 | +#include <linux/dcache.h> | |
| 7 | + | |
| 8 | +struct unicode_map { | |
| 9 | + const char *charset; | |
| 10 | + int version; | |
| 11 | +}; | |
| 12 | + | |
| 13 | +int utf8_validate(const struct unicode_map *um, const struct qstr *str); | |
| 14 | + | |
| 15 | +int utf8_strncmp(const struct unicode_map *um, | |
| 16 | + const struct qstr *s1, const struct qstr *s2); | |
| 17 | + | |
| 18 | +int utf8_strncasecmp(const struct unicode_map *um, | |
| 19 | + const struct qstr *s1, const struct qstr *s2); | |
| 20 | + | |
| 21 | +int utf8_normalize(const struct unicode_map *um, const struct qstr *str, | |
| 22 | + unsigned char *dest, size_t dlen); | |
| 23 | + | |
| 24 | +int utf8_casefold(const struct unicode_map *um, const struct qstr *str, | |
| 25 | + unsigned char *dest, size_t dlen); | |
| 26 | + | |
| 27 | +struct unicode_map *utf8_load(const char *version); | |
| 28 | +void utf8_unload(struct unicode_map *um); | |
| 29 | + | |
| 30 | +#endif /* _LINUX_UNICODE_H */ | |
| @@ -115,6 +115,7 @@ struct uprobes_state { · 114 unmodified lines | ||
| 115 | 115 | struct xol_area *xol_area; |
| 116 | 116 | }; |
| 117 | 117 | |
| 118 | +extern void __init uprobes_init(void); | |
| 118 | 119 | extern int set_swbp(struct arch_uprobe *aup, struct mm_struct *mm, unsigned long vaddr); |
| 119 | 120 | extern int set_orig_insn(struct arch_uprobe *aup, struct mm_struct *mm, unsigned long vaddr); |
| 120 | 121 | extern bool is_swbp_insn(uprobe_opcode_t *insn); |
| @@ -154,6 +155,10 @@ extern void arch_uprobe_copy_ixol(struct page *page, unsigned long vaddr, · 33 unmodified lines | ||
| 154 | 155 | struct uprobes_state { |
| 155 | 156 | }; |
| 156 | 157 | |
| 158 | +static inline void uprobes_init(void) | |
| 159 | +{ | |
| 160 | +} | |
| 161 | + | |
| 157 | 162 | #define uprobe_get_trap_addr(regs) instruction_pointer(regs) |
| 158 | 163 | |
| 159 | 164 | static inline int |
| @@ -200,7 +200,6 @@ usb_find_last_int_out_endpoint(struct usb_host_interface *alt, · 199 unmodified lines | ||
| 200 | 200 | * @dev: driver model's view of this device |
| 201 | 201 | * @usb_dev: if an interface is bound to the USB major, this will point |
| 202 | 202 | * to the sysfs representation for that device. |
| 203 | − * @pm_usage_cnt: PM usage counter for this interface | |
| 204 | 203 | * @reset_ws: Used for scheduling resets from atomic context. |
| 205 | 204 | * @resetting_device: USB core reset the device, so use alt setting 0 as |
| 206 | 205 | * current; needs bandwidth alloc after reset. |
| @@ -257,7 +256,6 @@ struct usb_interface { · 50 unmodified lines | ||
| 257 | 256 | |
| 258 | 257 | struct device dev; /* interface specific device info */ |
| 259 | 258 | struct device *usb_dev; |
| 260 | − atomic_t pm_usage_cnt; /* usage counter for autosuspend */ | |
| 261 | 259 | struct work_struct reset_ws; /* for resets in atomic context */ |
| 262 | 260 | }; |
| 263 | 261 | #define to_usb_interface(d) container_of(d, struct usb_interface, dev) |
| @@ -1545,10 +1543,10 @@ typedef void (*usb_complete_t)(struct urb *); · 1281 unmodified lines | ||
| 1545 | 1543 | struct urb { |
| 1546 | 1544 | /* private: usb core and host controller only fields in the urb */ |
| 1547 | 1545 | struct kref kref; /* reference count of the URB */ |
| 1546 | + int unlinked; /* unlink error code */ | |
| 1548 | 1547 | void *hcpriv; /* private data for host controller */ |
| 1549 | 1548 | atomic_t use_count; /* concurrent submissions counter */ |
| 1550 | 1549 | atomic_t reject; /* submissions will fail */ |
| 1551 | − int unlinked; /* unlink error code */ | |
| 1552 | 1550 | |
| 1553 | 1551 | /* public: documented fields in the urb that can be used by drivers */ |
| 1554 | 1552 | struct list_head urb_list; /* list head for use by the urb's |
| @@ -36,6 +36,14 @@ · 35 unmodified lines | ||
| 36 | 36 | #include <linux/device.h> |
| 37 | 37 | #include <uapi/linux/usb/ch9.h> |
| 38 | 38 | |
| 39 | +/** | |
| 40 | + * usb_ep_type_string() - Returns human readable-name of the endpoint type. | |
| 41 | + * @ep_type: The endpoint type to return human-readable name for. If it's not | |
| 42 | + * any of the types: USB_ENDPOINT_XFER_{CONTROL, ISOC, BULK, INT}, | |
| 43 | + * usually got by usb_endpoint_type(), the string 'unknown' will be returned. | |
| 44 | + */ | |
| 45 | +extern const char *usb_ep_type_string(int ep_type); | |
| 46 | + | |
| 39 | 47 | /** |
| 40 | 48 | * usb_speed_string() - Returns human readable-name of the speed. |
| 41 | 49 | * @speed: The speed to return human-readable name for. If it's not |
| @@ -98,6 +98,7 @@ struct usb_hcd { · 97 unmodified lines | ||
| 98 | 98 | #ifdef CONFIG_PM |
| 99 | 99 | struct work_struct wakeup_work; /* for remote wakeup */ |
| 100 | 100 | #endif |
| 101 | + struct work_struct died_work; /* for when the device dies */ | |
| 101 | 102 | |
| 102 | 103 | /* |
| 103 | 104 | * hardware info/state |
| @@ -652,11 +653,16 @@ extern wait_queue_head_t usb_kill_urb_queue; · 548 unmodified lines | ||
| 652 | 653 | #define usb_endpoint_out(ep_dir) (!((ep_dir) & USB_DIR_IN)) |
| 653 | 654 | |
| 654 | 655 | #ifdef CONFIG_PM |
| 656 | +extern unsigned usb_wakeup_enabled_descendants(struct usb_device *udev); | |
| 655 | 657 | extern void usb_root_hub_lost_power(struct usb_device *rhdev); |
| 656 | 658 | extern int hcd_bus_suspend(struct usb_device *rhdev, pm_message_t msg); |
| 657 | 659 | extern int hcd_bus_resume(struct usb_device *rhdev, pm_message_t msg); |
| 658 | 660 | extern void usb_hcd_resume_root_hub(struct usb_hcd *hcd); |
| 659 | 661 | #else |
| 662 | +static inline unsigned usb_wakeup_enabled_descendants(struct usb_device *udev) | |
| 663 | +{ | |
| 664 | + return 0; | |
| 665 | +} | |
| 660 | 666 | static inline void usb_hcd_resume_root_hub(struct usb_hcd *hcd) |
| 661 | 667 | { |
| 662 | 668 | return; |
| @@ -23,11 +23,9 @@ · 22 unmodified lines | ||
| 23 | 23 | /* The maximum number of ports one device can grab at once */ |
| 24 | 24 | #define MAX_NUM_PORTS 16 |
| 25 | 25 | |
| 26 | −/* parity check flag */ | |
| 27 | −#define RELEVANT_IFLAG(iflag) (iflag & (IGNBRK|BRKINT|IGNPAR|PARMRK|INPCK)) | |
| 28 | − | |
| 29 | 26 | /* USB serial flags */ |
| 30 | 27 | #define USB_SERIAL_WRITE_BUSY 0 |
| 28 | +#define USB_SERIAL_THROTTLED 1 | |
| 31 | 29 | |
| 32 | 30 | /** |
| 33 | 31 | * usb_serial_port: structure for the specific ports of a device. |
| @@ -67,8 +65,6 @@ · 33 unmodified lines | ||
| 67 | 65 | * @flags: usb serial port flags |
| 68 | 66 | * @write_wait: a wait_queue_head_t used by the port. |
| 69 | 67 | * @work: work queue entry for the line discipline waking up. |
| 70 | − * @throttled: nonzero if the read urb is inactive to throttle the device | |
| 71 | − * @throttle_req: nonzero if the tty wants to throttle us | |
| 72 | 68 | * @dev: pointer to the serial device |
| 73 | 69 | * |
| 74 | 70 | * This structure is used by the usb-serial core and drivers for the specific |
| @@ -115,8 +111,6 @@ struct usb_serial_port { · 40 unmodified lines | ||
| 115 | 111 | unsigned long flags; |
| 116 | 112 | wait_queue_head_t write_wait; |
| 117 | 113 | struct work_struct work; |
| 118 | − char throttled; | |
| 119 | − char throttle_req; | |
| 120 | 114 | unsigned long sysrq; /* sysrq timeout */ |
| 121 | 115 | struct device dev; |
| 122 | 116 | }; |
| @@ -121,10 +121,10 @@ struct tcpc_config { · 120 unmodified lines | ||
| 121 | 121 | * with partner. |
| 122 | 122 | * @set_pd_rx: Called to enable or disable reception of PD messages |
| 123 | 123 | * @set_roles: Called to set power and data roles |
| 124 | − * @start_drp_toggling: | |
| 125 | − * Optional; if supported by hardware, called to start DRP | |
| 126 | − * toggling. DRP toggling is stopped automatically if | |
| 127 | − * a connection is established. | |
| 124 | + * @start_toggling: | |
| 125 | + * Optional; if supported by hardware, called to start dual-role | |
| 126 | + * toggling or single-role connection detection. Toggling stops | |
| 127 | + * automatically if a connection is established. | |
| 128 | 128 | * @try_role: Optional; called to set a preferred role |
| 129 | 129 | * @pd_transmit:Called to transmit PD message |
| 130 | 130 | * @mux: Pointer to multiplexer data |
| @@ -147,8 +147,9 @@ struct tcpc_dev { · 16 unmodified lines | ||
| 147 | 147 | int (*set_pd_rx)(struct tcpc_dev *dev, bool on); |
| 148 | 148 | int (*set_roles)(struct tcpc_dev *dev, bool attached, |
| 149 | 149 | enum typec_role role, enum typec_data_role data); |
| 150 | − int (*start_drp_toggling)(struct tcpc_dev *dev, | |
| 151 | − enum typec_cc_status cc); | |
| 150 | + int (*start_toggling)(struct tcpc_dev *dev, | |
| 151 | + enum typec_port_type port_type, | |
| 152 | + enum typec_cc_status cc); | |
| 152 | 153 | int (*try_role)(struct tcpc_dev *dev, int role); |
| 153 | 154 | int (*pd_transmit)(struct tcpc_dev *dev, enum tcpm_transmit_type type, |
| 154 | 155 | const struct pd_message *msg); |
| @@ -5,6 +5,11 @@ · 4 unmodified lines | ||
| 5 | 5 | #include <linux/usb/typec_altmode.h> |
| 6 | 6 | |
| 7 | 7 | #define USB_TYPEC_DP_SID 0xff01 |
| 8 | +/* USB IF has not assigned a Standard ID (SID) for VirtualLink, | |
| 9 | + * so the manufacturers of VirtualLink adapters use their Vendor | |
| 10 | + * IDs as the SVID. | |
| 11 | + */ | |
| 12 | +#define USB_TYPEC_NVIDIA_VLINK_SID 0x955 /* NVIDIA VirtualLink */ | |
| 8 | 13 | #define USB_TYPEC_DP_MODE 1 |
| 9 | 14 | |
| 10 | 15 | /* |
| @@ -28,6 +28,8 @@ · 27 unmodified lines | ||
| 28 | 28 | #define UFFD_SHARED_FCNTL_FLAGS (O_CLOEXEC | O_NONBLOCK) |
| 29 | 29 | #define UFFD_FLAGS_SET (EFD_SHARED_FCNTL_FLAGS) |
| 30 | 30 | |
| 31 | +extern int sysctl_unprivileged_userfaultfd; | |
| 32 | + | |
| 31 | 33 | extern vm_fault_t handle_userfault(struct vm_fault *vmf, unsigned long reason); |
| 32 | 34 | |
| 33 | 35 | extern ssize_t mcopy_atomic(struct mm_struct *dst_mm, unsigned long dst_start, |
| @@ -90,23 +90,6 @@ dma_addr_t virtqueue_get_desc_addr(struct virtqueue *vq); · 89 unmodified lines | ||
| 90 | 90 | dma_addr_t virtqueue_get_avail_addr(struct virtqueue *vq); |
| 91 | 91 | dma_addr_t virtqueue_get_used_addr(struct virtqueue *vq); |
| 92 | 92 | |
| 93 | −/* | |
| 94 | − * Legacy accessors -- in almost all cases, these are the wrong functions | |
| 95 | − * to use. | |
| 96 | − */ | |
| 97 | −static inline void *virtqueue_get_desc(struct virtqueue *vq) | |
| 98 | −{ | |
| 99 | − return virtqueue_get_vring(vq)->desc; | |
| 100 | −} | |
| 101 | −static inline void *virtqueue_get_avail(struct virtqueue *vq) | |
| 102 | −{ | |
| 103 | − return virtqueue_get_vring(vq)->avail; | |
| 104 | −} | |
| 105 | −static inline void *virtqueue_get_used(struct virtqueue *vq) | |
| 106 | −{ | |
| 107 | − return virtqueue_get_vring(vq)->used; | |
| 108 | −} | |
| 109 | − | |
| 110 | 93 | /** |
| 111 | 94 | * virtio_device - representation of a device using virtio |
| 112 | 95 | * @index: unique position on the virtio bus |
| @@ -21,6 +21,11 @@ struct notifier_block; /* in notifier.h */ · 20 unmodified lines | ||
| 21 | 21 | #define VM_UNINITIALIZED 0x00000020 /* vm_struct is not fully initialized */ |
| 22 | 22 | #define VM_NO_GUARD 0x00000040 /* don't add guard page */ |
| 23 | 23 | #define VM_KASAN 0x00000080 /* has allocated kasan shadow memory */ |
| 24 | +/* | |
| 25 | + * Memory with VM_FLUSH_RESET_PERMS cannot be freed in an interrupt or with | |
| 26 | + * vfree_atomic(). | |
| 27 | + */ | |
| 28 | +#define VM_FLUSH_RESET_PERMS 0x00000100 /* Reset direct map and flush TLB on unmap */ | |
| 24 | 29 | /* bits [20..32] reserved for arch specific ioremap internals */ |
| 25 | 30 | |
| 26 | 31 | /* |
| @@ -45,12 +50,16 @@ struct vm_struct { · 18 unmodified lines | ||
| 45 | 50 | struct vmap_area { |
| 46 | 51 | unsigned long va_start; |
| 47 | 52 | unsigned long va_end; |
| 53 | + | |
| 54 | + /* | |
| 55 | + * Largest available free size in subtree. | |
| 56 | + */ | |
| 57 | + unsigned long subtree_max_size; | |
| 48 | 58 | unsigned long flags; |
| 49 | 59 | struct rb_node rb_node; /* address sorted rbtree */ |
| 50 | 60 | struct list_head list; /* address sorted list */ |
| 51 | 61 | struct llist_node purge_list; /* "lazy purge" list */ |
| 52 | 62 | struct vm_struct *vm; |
| 53 | − struct rcu_head rcu_head; | |
| 54 | 63 | }; |
| 55 | 64 | |
| 56 | 65 | /* |
| @@ -142,6 +151,13 @@ extern int map_kernel_range_noflush(unsigned long start, unsigned long size, · 85 unmodified lines | ||
| 142 | 151 | pgprot_t prot, struct page **pages); |
| 143 | 152 | extern void unmap_kernel_range_noflush(unsigned long addr, unsigned long size); |
| 144 | 153 | extern void unmap_kernel_range(unsigned long addr, unsigned long size); |
| 154 | +static inline void set_vm_flush_reset_perms(void *addr) | |
| 155 | +{ | |
| 156 | + struct vm_struct *vm = find_vm_area(addr); | |
| 157 | + | |
| 158 | + if (vm) | |
| 159 | + vm->flags |= VM_FLUSH_RESET_PERMS; | |
| 160 | +} | |
| 145 | 161 | #else |
| 146 | 162 | static inline int |
| 147 | 163 | map_kernel_range_noflush(unsigned long start, unsigned long size, |
| @@ -157,6 +173,9 @@ static inline void · 9 unmodified lines | ||
| 157 | 173 | unmap_kernel_range(unsigned long addr, unsigned long size) |
| 158 | 174 | { |
| 159 | 175 | } |
| 176 | +static inline void set_vm_flush_reset_perms(void *addr) | |
| 177 | +{ | |
| 178 | +} | |
| 160 | 179 | #endif |
| 161 | 180 | |
| 162 | 181 | /* Allocate/destroy a 'vmalloc' VM area. */ |
| @@ -26,7 +26,7 @@ struct reclaim_stat { · 25 unmodified lines | ||
| 26 | 26 | unsigned nr_congested; |
| 27 | 27 | unsigned nr_writeback; |
| 28 | 28 | unsigned nr_immediate; |
| 29 | − unsigned nr_activate; | |
| 29 | + unsigned nr_activate[2]; | |
| 30 | 30 | unsigned nr_ref_keep; |
| 31 | 31 | unsigned nr_unmap_fail; |
| 32 | 32 | }; |
| @@ -17,6 +17,7 @@ · 16 unmodified lines | ||
| 17 | 17 | #define _VMW_VMCI_DEF_H_ |
| 18 | 18 | |
| 19 | 19 | #include <linux/atomic.h> |
| 20 | +#include <linux/bits.h> | |
| 20 | 21 | |
| 21 | 22 | /* Register offsets. */ |
| 22 | 23 | #define VMCI_STATUS_ADDR 0x00 |
| @@ -33,27 +34,27 @@ · 10 unmodified lines | ||
| 33 | 34 | #define VMCI_MAX_DEVICES 1 |
| 34 | 35 | |
| 35 | 36 | /* Status register bits. */ |
| 36 | −#define VMCI_STATUS_INT_ON 0x1 | |
| 37 | +#define VMCI_STATUS_INT_ON BIT(0) | |
| 37 | 38 | |
| 38 | 39 | /* Control register bits. */ |
| 39 | −#define VMCI_CONTROL_RESET 0x1 | |
| 40 | −#define VMCI_CONTROL_INT_ENABLE 0x2 | |
| 41 | −#define VMCI_CONTROL_INT_DISABLE 0x4 | |
| 40 | +#define VMCI_CONTROL_RESET BIT(0) | |
| 41 | +#define VMCI_CONTROL_INT_ENABLE BIT(1) | |
| 42 | +#define VMCI_CONTROL_INT_DISABLE BIT(2) | |
| 42 | 43 | |
| 43 | 44 | /* Capabilities register bits. */ |
| 44 | −#define VMCI_CAPS_HYPERCALL 0x1 | |
| 45 | −#define VMCI_CAPS_GUESTCALL 0x2 | |
| 46 | −#define VMCI_CAPS_DATAGRAM 0x4 | |
| 47 | −#define VMCI_CAPS_NOTIFICATIONS 0x8 | |
| 48 | −#define VMCI_CAPS_PPN64 0x10 | |
| 45 | +#define VMCI_CAPS_HYPERCALL BIT(0) | |
| 46 | +#define VMCI_CAPS_GUESTCALL BIT(1) | |
| 47 | +#define VMCI_CAPS_DATAGRAM BIT(2) | |
| 48 | +#define VMCI_CAPS_NOTIFICATIONS BIT(3) | |
| 49 | +#define VMCI_CAPS_PPN64 BIT(4) | |
| 49 | 50 | |
| 50 | 51 | /* Interrupt Cause register bits. */ |
| 51 | −#define VMCI_ICR_DATAGRAM 0x1 | |
| 52 | −#define VMCI_ICR_NOTIFICATION 0x2 | |
| 52 | +#define VMCI_ICR_DATAGRAM BIT(0) | |
| 53 | +#define VMCI_ICR_NOTIFICATION BIT(1) | |
| 53 | 54 | |
| 54 | 55 | /* Interrupt Mask register bits. */ |
| 55 | −#define VMCI_IMR_DATAGRAM 0x1 | |
| 56 | −#define VMCI_IMR_NOTIFICATION 0x2 | |
| 56 | +#define VMCI_IMR_DATAGRAM BIT(0) | |
| 57 | +#define VMCI_IMR_NOTIFICATION BIT(1) | |
| 57 | 58 | |
| 58 | 59 | /* Maximum MSI/MSI-X interrupt vectors in the device. */ |
| 59 | 60 | #define VMCI_MAX_INTRS 2 |
| @@ -463,9 +464,9 @@ struct vmci_datagram { · 403 unmodified lines | ||
| 463 | 464 | * datagram callback is invoked in a delayed context (not interrupt context). |
| 464 | 465 | */ |
| 465 | 466 | #define VMCI_FLAG_DG_NONE 0 |
| 466 | −#define VMCI_FLAG_WELLKNOWN_DG_HND 0x1 | |
| 467 | −#define VMCI_FLAG_ANYCID_DG_HND 0x2 | |
| 468 | −#define VMCI_FLAG_DG_DELAYED_CB 0x4 | |
| 467 | +#define VMCI_FLAG_WELLKNOWN_DG_HND BIT(0) | |
| 468 | +#define VMCI_FLAG_ANYCID_DG_HND BIT(1) | |
| 469 | +#define VMCI_FLAG_DG_DELAYED_CB BIT(2) | |
| 469 | 470 | |
| 470 | 471 | /* |
| 471 | 472 | * Maximum supported size of a VMCI datagram for routable datagrams. |
| @@ -694,7 +695,7 @@ struct vmci_qp_detach_msg { · 222 unmodified lines | ||
| 694 | 695 | }; |
| 695 | 696 | |
| 696 | 697 | /* VMCI Doorbell API. */ |
| 697 | −#define VMCI_FLAG_DELAYED_CB 0x01 | |
| 698 | +#define VMCI_FLAG_DELAYED_CB BIT(0) | |
| 698 | 699 | |
| 699 | 700 | typedef void (*vmci_callback) (void *client_data); |
| 700 | 701 | |
| @@ -101,7 +101,7 @@ init_waitqueue_func_entry(struct wait_queue_entry *wq_entry, wait_queue_func_t f · 100 unmodified lines | ||
| 101 | 101 | * lead to sporadic and non-obvious failure. |
| 102 | 102 | * |
| 103 | 103 | * Use either while holding wait_queue_head::lock or when used for wakeups |
| 104 | − * with an extra smp_mb() like: | |
| 104 | + * with an extra smp_mb() like:: | |
| 105 | 105 | * |
| 106 | 106 | * CPU0 - waker CPU1 - waiter |
| 107 | 107 | * |
| @@ -305,6 +305,19 @@ do { \ · 304 unmodified lines | ||
| 305 | 305 | __ret; \ |
| 306 | 306 | }) |
| 307 | 307 | |
| 308 | +#define __wait_var_event_interruptible(var, condition) \ | |
| 309 | + ___wait_var_event(var, condition, TASK_INTERRUPTIBLE, 0, 0, \ | |
| 310 | + schedule()) | |
| 311 | + | |
| 312 | +#define wait_var_event_interruptible(var, condition) \ | |
| 313 | +({ \ | |
| 314 | + int __ret = 0; \ | |
| 315 | + might_sleep(); \ | |
| 316 | + if (!(condition)) \ | |
| 317 | + __ret = __wait_var_event_interruptible(var, condition); \ | |
| 318 | + __ret; \ | |
| 319 | +}) | |
| 320 | + | |
| 308 | 321 | /** |
| 309 | 322 | * clear_and_wake_up_bit - clear a bit and wake up anyone waiting on that bit |
| 310 | 323 | * |