[PATCH v2 07/17] sh: Passing FDT address on zImage
Signed-off-by: Yoshinori Sato --- arch/sh/boot/compressed/head_32.S | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/arch/sh/boot/compressed/head_32.S b/arch/sh/boot/compressed/head_32.S index 3e15032..ef70454 100644 --- a/arch/sh/boot/compressed/head_32.S +++ b/arch/sh/boot/compressed/head_32.S @@ -11,10 +11,11 @@ .global startup startup: + /* Save FDT address */ + mov r4, r13 /* Load initial status register */ mov.l init_sr, r1 ldc r1, sr - /* Move myself to proper location if necessary */ mova1f, r0 mov.l 1f, r2 @@ -83,7 +84,7 @@ l1: /* Jump to the start of the decompressed kernel */ mov.l kernel_start_addr, r0 jmp @r0 - nop + mov r13,r4 .align 2 bss_start_addr: -- 2.7.0
[PATCH v2 03/17] sh: set preset_lpj
Generic callibrate delay required this value. Signed-off-by: Yoshinori Sato --- arch/sh/boards/of-generic.c | 6 ++ 1 file changed, 6 insertions(+) diff --git a/arch/sh/boards/of-generic.c b/arch/sh/boards/of-generic.c index d24bc02..e2b4d98 100644 --- a/arch/sh/boards/of-generic.c +++ b/arch/sh/boards/of-generic.c @@ -128,6 +128,8 @@ static void __init sh_of_time_init(void) static void __init sh_of_setup(char **cmdline_p) { struct device_node *root; + struct device_node *cpu; + u32 freq; board_time_init = sh_of_time_init; @@ -139,6 +141,10 @@ static void __init sh_of_setup(char **cmdline_p) } sh_of_smp_probe(); + + cpu = of_find_node_by_name(NULL, "cpu"); + if (!of_property_read_u32(cpu, "clock-frequency", &freq)) + preset_lpj = freq / CONFIG_HZ / 2; } static int sh_of_irq_demux(int irq) -- 2.7.0
[PATCH v2 08/17] sh: Disable board specific code on device tree mode
Signed-off-by: Yoshinori Sato --- arch/sh/Makefile| 2 ++ arch/sh/kernel/cpu/sh4/Makefile | 2 ++ 2 files changed, 4 insertions(+) diff --git a/arch/sh/Makefile b/arch/sh/Makefile index 3b2c8b4..8adffa8 100644 --- a/arch/sh/Makefile +++ b/arch/sh/Makefile @@ -132,6 +132,7 @@ core-$(CONFIG_SH_FPU_EMU) += arch/sh/math-emu/ core-$(CONFIG_USE_BUILTIN_DTB) += arch/sh/boot/dts/ +ifneq ($(CONFIG_SH_DEVICE_TREE),y) # Mach groups machdir-$(CONFIG_SOLUTION_ENGINE) += mach-se machdir-$(CONFIG_SH_HP6XX) += mach-hp6xx @@ -152,6 +153,7 @@ machdir-$(CONFIG_SH_LANDISK)+= mach-landisk machdir-$(CONFIG_SH_LBOX_RE2) += mach-lboxre2 machdir-$(CONFIG_SH_CAYMAN)+= mach-cayman machdir-$(CONFIG_SH_RSK) += mach-rsk +endif ifneq ($(machdir-y),) core-y += $(addprefix arch/sh/boards/, \ diff --git a/arch/sh/kernel/cpu/sh4/Makefile b/arch/sh/kernel/cpu/sh4/Makefile index 3a1dbc7..b822c0c 100644 --- a/arch/sh/kernel/cpu/sh4/Makefile +++ b/arch/sh/kernel/cpu/sh4/Makefile @@ -14,6 +14,7 @@ perf-$(CONFIG_CPU_SUBTYPE_SH7750) := perf_event.o perf-$(CONFIG_CPU_SUBTYPE_SH7750S) := perf_event.o perf-$(CONFIG_CPU_SUBTYPE_SH7091) := perf_event.o +ifndef CONFIG_OF # CPU subtype setup obj-$(CONFIG_CPU_SUBTYPE_SH7750) += setup-sh7750.o obj-$(CONFIG_CPU_SUBTYPE_SH7750R) += setup-sh7750.o @@ -31,6 +32,7 @@ endif # Additional clocks by subtype clock-$(CONFIG_CPU_SUBTYPE_SH4_202)+= clock-sh4-202.o +endif obj-y += $(clock-y) obj-$(CONFIG_PERF_EVENTS) += $(perf-y) -- 2.7.0
Re: [PATCH] iio: as3935: improve error reporting in as3935_event_work
Also important to note these warnings are environment related (e.g. room with lot of EMI noise) and unlikely a chip misconfiguration. Unless the tuning capacitor setting is wrong of course > On Jun 11, 2016, at 09:32, Jonathan Cameron wrote: > >> On 31/05/16 15:53, Andrew F. Davis wrote: >>> On 05/30/2016 09:52 AM, Arnd Bergmann wrote: >>> gcc warns about a potentially uninitialized variable use >>> in as3935_event_work: >>> >>> drivers/iio/proximity/as3935.c: In function ‘as3935_event_work’: >>> drivers/iio/proximity/as3935.c:231:6: error: ‘val’ may be used >>> uninitialized in this function [-Werror=maybe-uninitialized] >>> >>> This case specifically happens when spi_w8r8() fails with a >>> negative return code. We check all other users of this function >>> except this one. >>> >>> As the error is rather unlikely to happen after the device >>> has already been initialized, this just adds a dev_warn(). >>> Another warning already existst in the same function, but is >> >>^^ typo >> >>> missing a trailing '\n' character, so I'm fixing that too. >>> >>> Signed-off-by: Arnd Bergmann >>> --- >>> drivers/iio/proximity/as3935.c | 10 -- >>> 1 file changed, 8 insertions(+), 2 deletions(-) >>> >>> diff --git a/drivers/iio/proximity/as3935.c b/drivers/iio/proximity/as3935.c >>> index f4d29d5dbd5f..b49e3ab5730a 100644 >>> --- a/drivers/iio/proximity/as3935.c >>> +++ b/drivers/iio/proximity/as3935.c >>> @@ -224,10 +224,16 @@ static void as3935_event_work(struct work_struct >>> *work) >>> { >>>struct as3935_state *st; >>>int val; >>> +int ret; >>> >>>st = container_of(work, struct as3935_state, work.work); >>> >>> -as3935_read(st, AS3935_INT, &val); >>> +ret = as3935_read(st, AS3935_INT, &val); >>> +if (ret) { >>> +dev_warn(&st->spi->dev, "read error\n"); >> >> Maybe I'm misunderstanding the commit message, why does this error not >> use dev_err()? A read error here would be rather serious, it might even >> be worth it to return a code and fail through the caller too. > They are unusual and typically result in momentary corruption. Hmm. > As this is in a work function, there is no easy way of actually > passing the error upstream.. dev_err is a little brutal so perhaps > this is the best option... >> >>> +return; >>> +} >>> + >>>val &= AS3935_INT_MASK; >>> >>>switch (val) { >>> @@ -235,7 +241,7 @@ static void as3935_event_work(struct work_struct *work) >>>iio_trigger_poll(st->trig); >>>break; >>>case AS3935_NOISE_INT: >>> -dev_warn(&st->spi->dev, "noise level is too high"); >>> +dev_warn(&st->spi->dev, "noise level is too high\n"); >>>break; >>>} >>> } >> -- >> To unsubscribe from this list: send the line "unsubscribe linux-iio" in >> the body of a message to majord...@vger.kernel.org >> More majordomo info at http://vger.kernel.org/majordomo-info.html > > -- > To unsubscribe from this list: send the line "unsubscribe linux-iio" in > the body of a message to majord...@vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v2 09/17] sh: Use GENERIC_IOMAP on device tree mode
Signed-off-by: Yoshinori Sato --- arch/sh/boards/Kconfig | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/sh/boards/Kconfig b/arch/sh/boards/Kconfig index 5e52d53..9e4ccd0 100644 --- a/arch/sh/boards/Kconfig +++ b/arch/sh/boards/Kconfig @@ -12,6 +12,7 @@ config SH_DEVICE_TREE select OF_EARLY_FLATTREE select CLKSRC_OF select GENERIC_CALIBRATE_DELAY + select GENERIC_IOMAP help Select Board Described by Device Tree to build a kernel that does not hard-code any board-specific knowledge but instead uses -- 2.7.0
[PATCH v2 11/17] sh: SH7750/51 clock driver
Signed-off-by: Yoshinori Sato --- .../bindings/clock/renesas,sh7750-div-clock.txt| 27 +++ .../bindings/clock/renesas,sh7750-pll-clock.txt| 26 +++ drivers/clk/sh/clk-sh7750.c| 240 + 3 files changed, 293 insertions(+) create mode 100644 Documentation/devicetree/bindings/clock/renesas,sh7750-div-clock.txt create mode 100644 Documentation/devicetree/bindings/clock/renesas,sh7750-pll-clock.txt create mode 100644 drivers/clk/sh/clk-sh7750.c diff --git a/Documentation/devicetree/bindings/clock/renesas,sh7750-div-clock.txt b/Documentation/devicetree/bindings/clock/renesas,sh7750-div-clock.txt new file mode 100644 index 000..8c57ab5 --- /dev/null +++ b/Documentation/devicetree/bindings/clock/renesas,sh7750-div-clock.txt @@ -0,0 +1,27 @@ +* Renesas SH7750/51 divider clock + +Required Properties: + + - compatible: Must be "renesas,sh7750-div-clock" + + - clocks: Reference to the parent clocks (mostly PLL) + + - #clock-cells: Must be 0 + + - reg: Base address and length of the divide rate selector + + - renesas,offset: bit offset of selector + + - clock-output-names: The names of the clocks. + +Example +--- + +iclk: iclk { +compatible = "renesas,sh7750-div-clock"; +clocks = <&pllclk>; +#clock-cells = <0>; +reg = <0xffc0 2>; + renesas,offset = <6>; + clock-output-names = "ick"; +}; diff --git a/Documentation/devicetree/bindings/clock/renesas,sh7750-pll-clock.txt b/Documentation/devicetree/bindings/clock/renesas,sh7750-pll-clock.txt new file mode 100644 index 000..06a3d31 --- /dev/null +++ b/Documentation/devicetree/bindings/clock/renesas,sh7750-pll-clock.txt @@ -0,0 +1,26 @@ +Renesas SH7750/51 PLL clock + +This device is Clock multiplyer + +Required Properties: + + - compatible: Must be "renesas,sh7750-pll-clock" + + - clocks: Reference to the parent clocks + + - #clock-cells: Must be 0 + + - renesas,mult: PLL1 multiply rate + + - reg: Two rate selector (FRQCR / WDT) register address + +Example +--- + +pllclk: pllclk { +compatible = "renesas,sh7750-pll-clock"; +clocks = <&oclk>; +#clock-cells = <0>; + renesas,mult = <12>; +reg = <0xffc0 2>, <0xffc8 4>; +}; diff --git a/drivers/clk/sh/clk-sh7750.c b/drivers/clk/sh/clk-sh7750.c new file mode 100644 index 000..259f1bb --- /dev/null +++ b/drivers/clk/sh/clk-sh7750.c @@ -0,0 +1,240 @@ +/* + * Renesas SH7750/51 clock driver + * + * Copyright 2016 Yoshinori Sato + */ + +#include +#include +#include +#include +#include +#include +#include +#include "clk-shdiv.h" + +static DEFINE_SPINLOCK(clklock); + +static struct clk_div_table pdiv_table[] = { + { .val = 0, .div = 2, }, + { .val = 1, .div = 3, }, + { .val = 2, .div = 4, }, + { .val = 3, .div = 6, }, + { .val = 4, .div = 8, }, + { .val = 0, .div = 0, }, +}; + +static struct clk_div_table div_table[] = { + { .val = 0, .div = 1, }, + { .val = 1, .div = 2, }, + { .val = 2, .div = 3, }, + { .val = 3, .div = 4, }, + { .val = 4, .div = 6, }, + { .val = 5, .div = 8, }, + { .val = 0, .div = 0, }, +}; + +struct pll_clock { + struct clk_hw hw; + void __iomem *freqcr; + void __iomem *wdt; + int mult; +}; + +#define to_pll_clock(_hw) container_of(_hw, struct pll_clock, hw) + +static unsigned long pll_recalc_rate(struct clk_hw *hw, + unsigned long parent_rate) +{ + struct pll_clock *pll_clock = to_pll_clock(hw); + + if ((ioread16(pll_clock->freqcr) >> 9) & 1) + return parent_rate * pll_clock->mult; + else + return parent_rate; +} + +static long pll_round_rate(struct clk_hw *hw, unsigned long rate, + unsigned long *prate) +{ + struct pll_clock *pll_clock = to_pll_clock(hw); + int mul; + + mul = rate / *prate; + mul = (pll_clock->mult / 2 < mul)?pll_clock->mult:1; + return *prate * mul; +} + +static int pll_set_rate(struct clk_hw *hw, unsigned long rate, + unsigned long parent_rate) +{ + int mult; + unsigned char val; + unsigned long flags; + struct pll_clock *pll_clock = to_pll_clock(hw); + + mult = rate / parent_rate; + if (mult > 1) { + /* PLL enable */ + /* required stable time */ + spin_lock_irqsave(&clklock, flags); + iowrite16(0x5a00, pll_clock->wdt); + iowrite16(0xa503, pll_clock->wdt + 2); + val = ioread16(pll_clock->freqcr); + val |= 0x0200; + iowrite16(val, pll_clock->freqcr); + spin_unlock_irqrestore(&clklock, flags); + } else { + /* PLL disable */ + /* not required stable time */ +
[PATCH v2 01/17] sh: Add sh-specific early_init_dt_reserve_memory_arch
sh used P1 address space in early device tree. So need convert P1 to physical address before reserve memory. Signed-off-by: Yoshinori Sato --- arch/sh/boards/of-generic.c | 12 1 file changed, 12 insertions(+) diff --git a/arch/sh/boards/of-generic.c b/arch/sh/boards/of-generic.c index 57d45dc..fe2d917 100644 --- a/arch/sh/boards/of-generic.c +++ b/arch/sh/boards/of-generic.c @@ -15,6 +15,7 @@ #include #include #include +#include #include #include @@ -203,3 +204,14 @@ static int __init sh_of_device_init(void) return 0; } arch_initcall_sync(sh_of_device_init); + +int __init early_init_dt_reserve_memory_arch(phys_addr_t base, +phys_addr_t size, bool nomap) +{ + if (nomap) + return memblock_remove(base, size); + + if (base >= P1SEG) + base = base & ~P1SEG; + return memblock_reserve(base, size); +} -- 2.7.0
[PATCH v2 14/17] sh: SH3/4 Generic IRQCHIP driever
IPR based IRQ chip driver. Signed-off-by: Yoshinori Sato --- .../interrupt-controller/renesas,sh7751-intc.txt | 25 arch/sh/Kconfig| 6 +- arch/sh/boards/Kconfig | 1 + drivers/irqchip/Kconfig| 5 + drivers/irqchip/Makefile | 1 + drivers/irqchip/irq-renesas-sh7751.c | 141 + 6 files changed, 176 insertions(+), 3 deletions(-) create mode 100644 Documentation/devicetree/bindings/interrupt-controller/renesas,sh7751-intc.txt create mode 100644 drivers/irqchip/irq-renesas-sh7751.c diff --git a/Documentation/devicetree/bindings/interrupt-controller/renesas,sh7751-intc.txt b/Documentation/devicetree/bindings/interrupt-controller/renesas,sh7751-intc.txt new file mode 100644 index 000..2bc6f22f --- /dev/null +++ b/Documentation/devicetree/bindings/interrupt-controller/renesas,sh7751-intc.txt @@ -0,0 +1,25 @@ +DT bindings for the SH7751 interrupt controller + +Required properties: + + - compatible: has to be "renesas,sh7751-intc". + + - reg: Base address and length of interrupt controller register + and extend register. + + - interrupt-controller: Identifies the node as an interrupt controller. + + - #interrupt-cells: has to be <2>: an interrupt index and flags, as defined +in interrupts.txt in this directory. + +Example +--- + + shintc: interrupt-controller@ffd0 { + compatible = "renesas,sh7751-intc"; + #interrupt-cells = <2>; + #address-cells = <1>; + #size-cells = <1>; + interrupt-controller; + reg = <0xffd0 14>, <0xfe08 128>; + }; diff --git a/arch/sh/Kconfig b/arch/sh/Kconfig index 4fa5894..f268277 100644 --- a/arch/sh/Kconfig +++ b/arch/sh/Kconfig @@ -28,7 +28,7 @@ config SUPERH select ARCH_WANT_IPC_PARSE_VERSION select HAVE_SYSCALL_TRACEPOINTS select HAVE_REGS_AND_STACK_ACCESS_API - select MAY_HAVE_SPARSE_IRQ + select MAY_HAVE_SPARSE_IRQ if !SH_DEVICE_TREE select IRQ_FORCED_THREADING select RTC_LIB select GENERIC_ATOMIC64 @@ -67,7 +67,7 @@ config SUPERH32 select HAVE_MIXED_BREAKPOINTS_REGS select PERF_EVENTS select ARCH_HIBERNATION_POSSIBLE if MMU - select SPARSE_IRQ + select SPARSE_IRQ if !SH_DEVICE_TREE select HAVE_CC_STACKPROTECTOR config SUPERH64 @@ -860,7 +860,7 @@ config PCI depends on SYS_SUPPORTS_PCI select PCI_DOMAINS select GENERIC_PCI_IOMAP - select NO_GENERIC_PCI_IOPORT_MAP + select NO_GENERIC_PCI_IOPORT_MAP if !SH_DEVICE_TREE help Find out whether you have a PCI motherboard. PCI is the name of a bus system, i.e. the way the CPU talks to the other stuff inside diff --git a/arch/sh/boards/Kconfig b/arch/sh/boards/Kconfig index cfde921..d33ae46 100644 --- a/arch/sh/boards/Kconfig +++ b/arch/sh/boards/Kconfig @@ -15,6 +15,7 @@ config SH_DEVICE_TREE select GENERIC_IOMAP select COMMON_CLK select SYS_SUPPORTS_PCI + select GENERIC_IRQ_CHIP help Select Board Described by Device Tree to build a kernel that does not hard-code any board-specific knowledge but instead uses diff --git a/drivers/irqchip/Kconfig b/drivers/irqchip/Kconfig index 3e12479..273f19d 100644 --- a/drivers/irqchip/Kconfig +++ b/drivers/irqchip/Kconfig @@ -244,3 +244,8 @@ config IRQ_MXS config MVEBU_ODMI bool select GENERIC_MSI_IRQ_DOMAIN + +config RENESAS_SH_INTC + def_bool y if SH_DEVICE_TREE + select IRQ_DOMAIN + select IRQ_DOMAIN_HIERARCHY diff --git a/drivers/irqchip/Makefile b/drivers/irqchip/Makefile index b03cfcb..dac7e90 100644 --- a/drivers/irqchip/Makefile +++ b/drivers/irqchip/Makefile @@ -65,3 +65,4 @@ obj-$(CONFIG_INGENIC_IRQ) += irq-ingenic.o obj-$(CONFIG_IMX_GPCV2)+= irq-imx-gpcv2.o obj-$(CONFIG_PIC32_EVIC) += irq-pic32-evic.o obj-$(CONFIG_MVEBU_ODMI) += irq-mvebu-odmi.o +obj-$(CONFIG_RENESAS_SH_INTC) += irq-renesas-sh7751.o irq-io-landisk.o diff --git a/drivers/irqchip/irq-renesas-sh7751.c b/drivers/irqchip/irq-renesas-sh7751.c new file mode 100644 index 000..ea7002a --- /dev/null +++ b/drivers/irqchip/irq-renesas-sh7751.c @@ -0,0 +1,141 @@ +/* + * SH7751 interrupt contoller driver + * + * Copyright 2016 Yoshinori Sato + */ + +#include +#include +#include +#include +#include +#include + +static struct sh7751_intc_regs { + void *icr; + void *ipr; + void *intpri00; + void *intreq00; + void *intmsk00; + void *intmskclr00; +} sh7751_regs; + +static const unsigned int ipr_table[] = { + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, /* 0 - 7 */ + 0x41, 0xff, 0xff, 0x40, 0xff, 0xff, 0xff, 0xff, /* 8 - 15 */ + 0x03, 0x02, 0x01, 0x01
[PATCH v2 12/17] sh: Add PCI host bridge driver for SH7751
This is alternative SH7751 PCI driver. Existing driver (arch/sh/drivers/pci/pci-sh7751) use SH specific interface. But this driver using common PCI interface. It more mordan and generic. Signed-off-by: Yoshinori Sato --- .../devicetree/bindings/pci/sh7751-pci.txt | 51 +++ arch/sh/boards/Kconfig | 1 + drivers/pci/host/Kconfig | 7 + drivers/pci/host/Makefile | 1 + drivers/pci/host/pci-sh7751.c | 443 + 5 files changed, 503 insertions(+) create mode 100644 Documentation/devicetree/bindings/pci/sh7751-pci.txt create mode 100644 drivers/pci/host/pci-sh7751.c diff --git a/Documentation/devicetree/bindings/pci/sh7751-pci.txt b/Documentation/devicetree/bindings/pci/sh7751-pci.txt new file mode 100644 index 000..c3ec71a --- /dev/null +++ b/Documentation/devicetree/bindings/pci/sh7751-pci.txt @@ -0,0 +1,51 @@ +* Renesas SH7751 PCI host interfaces + +Required properties: + - compatible: "renesas,sh7751-pci" is required. +And board specific compatible if fixup required. + + - reg: base address and length of the PCI controller registers. + - #address-cells: set to <2> + - #size-cells: set to <1> + - bus-range: PCI bus numbers covered + - device_type: set to "pci" + - ranges: ranges for the PCI memory and I/O regions. + - interrupt-map-mask and interrupt-map: standard PCI properties + to define the mapping of the PCI interface to interrupt + numbers. + +Example: + pci: pci-controller@fe20 { + compatible = "renesas,sh7751-pci", "iodata,landisk"; + device_type = "pci"; + bus-range = <0 0>; + #address-cells = <2>; + #size-cells = <1>; + ranges = <0x0200 0x 0xfd00 0xfd00 0x 0x0100>, +<0x0100 0x 0xfe24 0x 0x 0x0004>; + reg = <0xfe20 0x0400>, + <0x0c00 0x0400>, + <0xff80 0x0030>; + #interrupt-cells = <1>; + interrupt-map-mask = <0x1800 0 7>; + interrupt-map = <0x 0 1 &cpldintc evt2irq(0x2a0) 0 +0x 0 2 &cpldintc evt2irq(0x2c0) 0 +0x 0 3 &cpldintc evt2irq(0x2e0) 0 +0x 0 4 &cpldintc evt2irq(0x300) 0 + +0x0800 0 1 &cpldintc evt2irq(0x2c0) 0 +0x0800 0 2 &cpldintc evt2irq(0x2e0) 0 +0x0800 0 3 &cpldintc evt2irq(0x300) 0 +0x0800 0 4 &cpldintc evt2irq(0x2a0) 0 + +0x1000 0 1 &cpldintc evt2irq(0x2e0) 0 +0x1000 0 2 &cpldintc evt2irq(0x300) 0 +0x1000 0 3 &cpldintc evt2irq(0x2a0) 0 +0x1000 0 4 &cpldintc evt2irq(0x2c0) 0 + +0x1800 0 1 &cpldintc evt2irq(0x300) 0 +0x1800 0 2 &cpldintc evt2irq(0x2a0) 0 +0x1800 0 3 &cpldintc evt2irq(0x2c0) 0 +0x1800 0 4 &cpldintc evt2irq(0x2e0) 0>; + }; +}; diff --git a/arch/sh/boards/Kconfig b/arch/sh/boards/Kconfig index b6ff9df..cfde921 100644 --- a/arch/sh/boards/Kconfig +++ b/arch/sh/boards/Kconfig @@ -14,6 +14,7 @@ config SH_DEVICE_TREE select GENERIC_CALIBRATE_DELAY select GENERIC_IOMAP select COMMON_CLK + select SYS_SUPPORTS_PCI help Select Board Described by Device Tree to build a kernel that does not hard-code any board-specific knowledge but instead uses diff --git a/drivers/pci/host/Kconfig b/drivers/pci/host/Kconfig index 7a0780d..a8596db 100644 --- a/drivers/pci/host/Kconfig +++ b/drivers/pci/host/Kconfig @@ -231,4 +231,11 @@ config PCI_HOST_THUNDER_ECAM help Say Y here if you want ECAM support for CN88XX-Pass-1.x Cavium Thunder SoCs. +config PCI_SH7751 + bool "Renesas SH7751 On-Chip PCI controller" + depends on OF && SUPERH + select PCI_HOST_COMMON + help + Say Y here if you want PCI support on SH7751. + endmenu diff --git a/drivers/pci/host/Makefile b/drivers/pci/host/Makefile index d85b5fa..91268cb 100644 --- a/drivers/pci/host/Makefile +++ b/drivers/pci/host/Makefile @@ -28,3 +28,4 @@ obj-$(CONFIG_PCI_HISI) += pcie-hisi.o obj-$(CONFIG_PCIE_QCOM) += pcie-qcom.o obj-$(CONFIG_PCI_HOST_THUNDER_ECAM) += pci-thunder-ecam.o obj-$(CONFIG_PCI_HOST_THUNDER_PEM) += pci-thunder-pem.o +obj-$(CONFIG_PCI_SH7751) += pci-sh7751.o diff --git a/drivers/pci/host/pci-sh7751.c b/drivers/pci/host/pci-sh7751.c new file mode 100644 index 000..c029e5b --- /dev/null +++ b/drivers/pci/host/pci-sh7751.c @@ -0,0 +1,443 @@ +/* + * SH7751 PCI driver +
[PATCH v2 15/17] sh: SH-INTC helper files
Signed-off-by: Yoshinori Sato --- arch/sh/boot/dts/include/dt-bindings | 1 + include/dt-bindings/interrupt-controller/sh_intc.h | 2 ++ 2 files changed, 3 insertions(+) create mode 12 arch/sh/boot/dts/include/dt-bindings create mode 100644 include/dt-bindings/interrupt-controller/sh_intc.h diff --git a/arch/sh/boot/dts/include/dt-bindings b/arch/sh/boot/dts/include/dt-bindings new file mode 12 index 000..08c00e4 --- /dev/null +++ b/arch/sh/boot/dts/include/dt-bindings @@ -0,0 +1 @@ +../../../../../include/dt-bindings \ No newline at end of file diff --git a/include/dt-bindings/interrupt-controller/sh_intc.h b/include/dt-bindings/interrupt-controller/sh_intc.h new file mode 100644 index 000..8c9dcdc --- /dev/null +++ b/include/dt-bindings/interrupt-controller/sh_intc.h @@ -0,0 +1,2 @@ +#define evt2irq(evt) (((evt) >> 5) - 16) +#define irq2evt(irq) (((irq) + 16) << 5) -- 2.7.0
[PATCH v2 16/17] sh: I/O DATA HDL-U (a.k.a. landisk) Device Tree
Signed-off-by: Yoshinori Sato --- arch/sh/boot/dts/landisk.dts | 150 +++ 1 file changed, 150 insertions(+) create mode 100644 arch/sh/boot/dts/landisk.dts diff --git a/arch/sh/boot/dts/landisk.dts b/arch/sh/boot/dts/landisk.dts new file mode 100644 index 000..23396a0 --- /dev/null +++ b/arch/sh/boot/dts/landisk.dts @@ -0,0 +1,150 @@ +#include + +/dts-v1/; +/ { + model = "I/O DATA HDL-U"; + compatible = "iodata,hdl-u"; + #address-cells = <1>; + #size-cells = <1>; + interrupt-parent = <&shintc>; + chosen { + stdout-path = &sci1; + bootargs = "console=ttySC1,115200"; + }; + aliases { + serial0 = &sci0; + serial1 = &sci1; + }; + + oclk: oscillator { +#clock-cells = <0>; +compatible = "fixed-clock"; +clock-frequency = <>; +}; +pllclk: pllclk { +compatible = "renesas,sh7750-pll-clock"; +clocks = <&oclk>; +#clock-cells = <0>; + renesas,mult = <12>; +reg = <0xffc0 2>, <0xffc8 4>; +}; +iclk: iclk { +compatible = "renesas,sh7750-div-clock"; +clocks = <&pllclk>; +#clock-cells = <0>; +reg = <0xffc0 2>; + renesas,offset = <6>; + clock-output-names = "ick"; +}; +bclk: bclk { +compatible = "renesas,sh7750-div-clock"; +clocks = <&pllclk>; +#clock-cells = <0>; +reg = <0xffc0 2>; + renesas,offset = <3>; + clock-output-names = "bck"; +}; +fclk: fclk { +compatible = "renesas,sh7750-div-clock"; +clocks = <&pllclk>; +#clock-cells = <0>; +reg = <0xffc0 2>; + renesas,offset = <0>; + clock-output-names = "fck"; +}; + cpus { + #address-cells = <1>; + #size-cells = <0>; + cpu@0 { + compatible = "renesas,sh4", "renesas,sh"; + clock-frequency = <2>; + }; + }; + memory@0c00 { + device_type = "memory"; + reg = <0x0c00 0x400>; + }; + shintc: interrupt-controller@ffd0 { + compatible = "renesas,sh7751-intc"; + #interrupt-cells = <2>; + #address-cells = <1>; + #size-cells = <1>; + interrupt-controller; + reg = <0xffd0 14>, <0xfe08 128>; + + }; + cpldintc: cpld@b000 { + compatible = "iodata,landisk-intc"; + #interrupt-cells = <2>; + interrupt-controller; + reg = <0xb000 8>; + interrupt-map=<0 &shintc 0 0>, <1 &shintc 1 0>, + <2 &shintc 2 0>, <3 &shintc 3 0>, + <4 &shintc 4 0>, <5 &shintc 5 0>, + <6 &shintc 6 0>, <7 &shintc 7 0>; + }; + sci0: serial@ffe0 { + compatible = "renesas,scif"; + reg = <0xffe0 0x20>; + interrupts = ; + clocks = <&fclk>; + clock-names = "fck"; + }; + sci1: serial@ffe8 { + compatible = "renesas,scif"; + reg = <0xffe8 0x100>; + interrupts = ; + clocks = <&fclk>; + clock-names = "fck"; + }; + tmu: timer@ffd8 { + compatible = "renesas,tmu"; + reg = <0xffd8 12>; + interrupts = ; + clocks = <&fclk>; + clock-names = "fck"; + renesas,channels-mask = <0x03>; + }; + + pci: pci-controller@fe20 { + compatible = "renesas,sh7751-pci", "iodata,landisk"; + device_type = "pci"; + bus-range = <0 0>; + #address-cells = <2>; + #size-cells = <1>; + ranges = <0x0200 0x 0xfd00 0xfd00 0x 0x0100>, +<0x0100 0x 0xfe24 0x 0x 0x0004>; + reg = <0xfe20 0x0400>, + <0x0c00 0x0400>, + <0xff80 0x0030>; + #interrupt-cells = <1>; + interrupt-map-mask = <0x1800 0 7>; + interrupt-map = <0x 0 1 &cpldintc evt2irq(0x2a0) 0 +0x 0 2 &cpldintc evt2irq(0x2c0) 0 +0x 0 3 &cpldintc evt2irq(0x2e0) 0 +0x 0 4 &cpldintc evt2irq(0x300) 0 + +0x0800 0 1 &cpldintc
[PATCH v2 13/17] sh: Add PCI definetion
Signed-off-by: Yoshinori Sato --- arch/sh/include/asm/io.h | 6 ++ 1 file changed, 6 insertions(+) diff --git a/arch/sh/include/asm/io.h b/arch/sh/include/asm/io.h index 3280a6b..df62a9f 100644 --- a/arch/sh/include/asm/io.h +++ b/arch/sh/include/asm/io.h @@ -387,6 +387,12 @@ static inline int iounmap_fixed(void __iomem *addr) { return -EINVAL; } int valid_phys_addr_range(phys_addr_t addr, size_t size); int valid_mmap_phys_addr_range(unsigned long pfn, size_t size); +#define PCI_IOBASE 0xfe24UL + +#define HAVE_ARCH_PIO_SIZE +#define PIO_OFFSET PCI_IOBASE +#define PIO_MASK 0x3UL +#define PIO_RESERVED 0x4UL #endif /* __KERNEL__ */ #endif /* __ASM_SH_IO_H */ -- 2.7.0
[PATCH v2 10/17] sh: convert generic drivers framework
Use common PCI host framework and Common Clock Freamework. Signed-off-by: Yoshinori Sato --- arch/sh/boards/Kconfig | 1 + arch/sh/drivers/Makefile| 2 + arch/sh/kernel/cpu/Makefile | 8 +- arch/sh/kernel/cpu/clock.c | 6 +- drivers/clk/Kconfig | 1 + drivers/clk/Makefile| 3 +- drivers/clk/sh/Kconfig | 2 + drivers/clk/sh/Makefile | 2 + drivers/clk/sh/clk-shdiv.c | 344 drivers/clk/sh/clk-shdiv.h | 16 +++ 10 files changed, 381 insertions(+), 4 deletions(-) create mode 100644 drivers/clk/sh/Kconfig create mode 100644 drivers/clk/sh/Makefile create mode 100644 drivers/clk/sh/clk-shdiv.c create mode 100644 drivers/clk/sh/clk-shdiv.h diff --git a/arch/sh/boards/Kconfig b/arch/sh/boards/Kconfig index 9e4ccd0..b6ff9df 100644 --- a/arch/sh/boards/Kconfig +++ b/arch/sh/boards/Kconfig @@ -13,6 +13,7 @@ config SH_DEVICE_TREE select CLKSRC_OF select GENERIC_CALIBRATE_DELAY select GENERIC_IOMAP + select COMMON_CLK help Select Board Described by Device Tree to build a kernel that does not hard-code any board-specific knowledge but instead uses diff --git a/arch/sh/drivers/Makefile b/arch/sh/drivers/Makefile index e13f06b..382e86f 100644 --- a/arch/sh/drivers/Makefile +++ b/arch/sh/drivers/Makefile @@ -4,7 +4,9 @@ obj-y += dma/ +ifndef CONFIG_SH_DEVICE_TREE obj-$(CONFIG_PCI) += pci/ +endif obj-$(CONFIG_SUPERHYWAY) += superhyway/ obj-$(CONFIG_PUSH_SWITCH) += push-switch.o obj-$(CONFIG_HEARTBEAT)+= heartbeat.o diff --git a/arch/sh/kernel/cpu/Makefile b/arch/sh/kernel/cpu/Makefile index accc7ca..22ad0ee 100644 --- a/arch/sh/kernel/cpu/Makefile +++ b/arch/sh/kernel/cpu/Makefile @@ -16,6 +16,10 @@ obj-$(CONFIG_ARCH_SHMOBILE) += shmobile/ # Common interfaces. obj-$(CONFIG_SH_ADC) += adc.o +ifndef CONFIG_COMMON_CLK obj-$(CONFIG_SH_CLK_CPG_LEGACY)+= clock-cpg.o - -obj-y += irq/ init.o clock.o fpu.o pfc.o proc.o +endif +ifndef CONFIG_GENERIC_IRQ_CHIP +obj-y += irq/ +endif +obj-y += init.o clock.o fpu.o pfc.o proc.o diff --git a/arch/sh/kernel/cpu/clock.c b/arch/sh/kernel/cpu/clock.c index 4187cf4..8e66e23 100644 --- a/arch/sh/kernel/cpu/clock.c +++ b/arch/sh/kernel/cpu/clock.c @@ -22,13 +22,15 @@ int __init clk_init(void) { - int ret; + int ret = 0; +#ifndef CONFIG_COMMON_CLK ret = arch_clk_init(); if (unlikely(ret)) { pr_err("%s: CPU clock registration failed.\n", __func__); return ret; } +#endif if (sh_mv.mv_clk_init) { ret = sh_mv.mv_clk_init(); @@ -39,11 +41,13 @@ int __init clk_init(void) } } +#ifndef CONFIG_COMMON_CLK /* Kick the child clocks.. */ recalculate_root_clocks(); /* Enable the necessary init clocks */ clk_enable_init_clocks(); +#endif return ret; } diff --git a/drivers/clk/Kconfig b/drivers/clk/Kconfig index 16f7d33..19b0cd3 100644 --- a/drivers/clk/Kconfig +++ b/drivers/clk/Kconfig @@ -202,6 +202,7 @@ source "drivers/clk/hisilicon/Kconfig" source "drivers/clk/mvebu/Kconfig" source "drivers/clk/qcom/Kconfig" source "drivers/clk/samsung/Kconfig" +source "drivers/clk/sh/Kconfig" source "drivers/clk/tegra/Kconfig" source "drivers/clk/ti/Kconfig" diff --git a/drivers/clk/Makefile b/drivers/clk/Makefile index 46869d6..c75d9c8 100644 --- a/drivers/clk/Makefile +++ b/drivers/clk/Makefile @@ -83,4 +83,5 @@ obj-$(CONFIG_COMMON_CLK_VERSATILE)+= versatile/ obj-$(CONFIG_X86) += x86/ obj-$(CONFIG_ARCH_ZX) += zte/ obj-$(CONFIG_ARCH_ZYNQ)+= zynq/ -obj-$(CONFIG_H8300)+= h8300/ +obj-$(CONFIG_H8300)+= h8300/ +obj-$(CONFIG_SUPERH) += sh/ diff --git a/drivers/clk/sh/Kconfig b/drivers/clk/sh/Kconfig new file mode 100644 index 000..89e28d8 --- /dev/null +++ b/drivers/clk/sh/Kconfig @@ -0,0 +1,2 @@ +config COMMON_CLK_SH7750 + bool "Clcok driver for SH7750/SH7751" diff --git a/drivers/clk/sh/Makefile b/drivers/clk/sh/Makefile new file mode 100644 index 000..468eb9d --- /dev/null +++ b/drivers/clk/sh/Makefile @@ -0,0 +1,2 @@ +obj-y += clk-shdiv.o +obj-$(CONFIG_COMMON_CLK_SH7750) += clk-sh7750.o \ No newline at end of file diff --git a/drivers/clk/sh/clk-shdiv.c b/drivers/clk/sh/clk-shdiv.c new file mode 100644 index 000..be19ffa --- /dev/null +++ b/drivers/clk/sh/clk-shdiv.c @@ -0,0 +1,344 @@ +/* + * SuperH divider clock driver + */ + +#include +#include +#include +#include +#include +#include +#include "clk-shdiv.h" + +#define div_mask(width) ((1 << (width)) - 1) +#define to_sh_clk_div(_divider)\ + container_of(_divider, struct sh_clk_div, divider) + +static unsigned int _get_table_maxdiv(const struct clk_div_table *table, +
[PATCH v2 17/17] sh: landisk CPLD interrupt controller driver
Signed-off-by: Yoshinori Sato --- .../interrupt-controller/iodata-landisk.txt| 28 + drivers/irqchip/irq-io-landisk.c | 72 ++ 2 files changed, 100 insertions(+) create mode 100644 Documentation/devicetree/bindings/interrupt-controller/iodata-landisk.txt create mode 100644 drivers/irqchip/irq-io-landisk.c diff --git a/Documentation/devicetree/bindings/interrupt-controller/iodata-landisk.txt b/Documentation/devicetree/bindings/interrupt-controller/iodata-landisk.txt new file mode 100644 index 000..d398538 --- /dev/null +++ b/Documentation/devicetree/bindings/interrupt-controller/iodata-landisk.txt @@ -0,0 +1,28 @@ +DT bindings for the I/O DATA HDL-U interrupt controller + +Required properties: + + - compatible: has to be "iodata,landisk-intc". + + - reg: Base address and length of interrupt controller register. + + - interrupt-controller: Identifies the node as an interrupt controller. + + - #interrupt-cells: has to be <2>: an interrupt index and flags, as defined +in interrupts.txt in this directory. + + - interrupt-map: Interrupt mapping on parent controller. + +Example +--- + + cpldintc: cpld@b000 { + compatible = "iodata,landisk-intc"; + #interrupt-cells = <2>; + interrupt-controller; + reg = <0xb000 8>; + interrupt-map=<0 &shintc 0 0>, <1 &shintc 1 0>, + <2 &shintc 2 0>, <3 &shintc 3 0>, + <4 &shintc 4 0>, <5 &shintc 5 0>, + <6 &shintc 6 0>, <7 &shintc 7 0>; + }; diff --git a/drivers/irqchip/irq-io-landisk.c b/drivers/irqchip/irq-io-landisk.c new file mode 100644 index 000..973c4fb --- /dev/null +++ b/drivers/irqchip/irq-io-landisk.c @@ -0,0 +1,72 @@ +/* + * IO-DATA LANDISK CPLD IRQ driver + * + * Copyright 2016 Yoshinori Sato + */ + +#include +#include +#include +#include +#include +#include +#include + +static void landisk_mask_irq(struct irq_data *data) +{ + u8 mask = __raw_readb(data->chip_data + 5); + + mask &= !(1 << (data->irq - 5)); + __raw_writeb(mask, data->chip_data + 5); +} + +static void landisk_unmask_irq(struct irq_data *data) +{ + u8 mask = __raw_readb(data->chip_data + 5); + + mask |= (1 << (data->irq - 5)); + __raw_writeb(mask, data->chip_data + 5); +} + +static struct irq_chip cpld_irq_chip = { + .name = "LANDISK-CPLD", + .irq_unmask = landisk_unmask_irq, + .irq_mask = landisk_mask_irq, +}; + +static int cpld_map(struct irq_domain *d, unsigned int virq, + irq_hw_number_t hw_irq_num) +{ + irq_set_chip_and_handler(virq, &cpld_irq_chip, +handle_simple_irq); + irq_set_chip_data(virq, d->host_data); + + return 0; +} + +static struct irq_domain_ops irq_ops = { + .xlate = irq_domain_xlate_twocell, + .map= cpld_map, +}; + +static int __init landisk_intc_of_init(struct device_node *intc, + struct device_node *parent) +{ + struct irq_domain *domain, *pdomain; + int num_irqpin; + void *baseaddr; + + baseaddr = of_iomap(intc, 0); + pdomain = irq_find_host(parent); + of_get_property(intc, "interrupt-map", &num_irqpin); + num_irqpin /= sizeof(u32) * 3; + domain = irq_domain_create_hierarchy(pdomain, 0, num_irqpin, +of_node_to_fwnode(intc), +&irq_ops, baseaddr); + if (!domain) + panic"%s: unable to create IRQ domain\n", intc->full_name); + irq_domain_associate_many(domain, 0, 0, 8); + return 0; +} + +IRQCHIP_DECLARE(cpld_intc, "iodata,landisk-intc", landisk_intc_of_init); -- 2.7.0
[PATCH v2 04/17] sh: Use P1SEGADDR
FDT address is P1SEG. So not virtual address. Signed-off-by: Yoshinori Sato --- arch/sh/kernel/setup.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/sh/kernel/setup.c b/arch/sh/kernel/setup.c index 86f2792..8e3b099 100644 --- a/arch/sh/kernel/setup.c +++ b/arch/sh/kernel/setup.c @@ -254,7 +254,7 @@ void __ref sh_fdt_init(phys_addr_t dt_phys) #ifdef CONFIG_USE_BUILTIN_DTB dt_virt = __dtb_start; #else - dt_virt = phys_to_virt(dt_phys); + dt_virt = (void *)P1SEGADDR(dt_phys); #endif if (!dt_virt || !early_init_dt_scan(dt_virt)) { -- 2.7.0
[PATCH v2 00/17] sh: LANDISK convert to device tree
SH get devicetree support. But it not working on existing H/W. IO-DATA HDL-U (aka landisk) currentry supported. This H/W like SH7751 evalution board. It's a best to use this as a change base H/W. Changes V2 - split DeviceTree suppoty update. - PCI driver update. - Some cleanup. Yoshinori Sato (17): sh: Add sh-specific early_init_dt_reserve_memory_arch sh: More early unflatten device tree sh: set preset_lpj sh: Use P1SEGADDR sh: command line passing chosen/bootargs in devicetree sh: FDT address save before bank change sh: Passing FDT address on zImage sh: Disable board specific code on device tree mode sh: Use GENERIC_IOMAP on device tree mode sh: convert generic drivers framework sh: SH7750/51 clock driver sh: Add PCI host bridge driver for SH7751 sh: Add PCI definetion sh: SH3/4 Generic IRQCHIP driever sh: SH-INTC helper files sh: I/O DATA HDL-U (a.k.a. landisk) Device Tree sh: landisk CPLD interrupt controller driver .../bindings/clock/renesas,sh7750-div-clock.txt| 27 ++ .../bindings/clock/renesas,sh7750-pll-clock.txt| 26 ++ .../interrupt-controller/iodata-landisk.txt| 28 ++ .../interrupt-controller/renesas,sh7751-intc.txt | 25 ++ .../devicetree/bindings/pci/sh7751-pci.txt | 51 +++ arch/sh/Kconfig| 6 +- arch/sh/Makefile | 2 + arch/sh/boards/Kconfig | 4 + arch/sh/boards/of-generic.c| 24 +- arch/sh/boot/compressed/head_32.S | 5 +- arch/sh/boot/dts/include/dt-bindings | 1 + arch/sh/boot/dts/landisk.dts | 150 +++ arch/sh/drivers/Makefile | 2 + arch/sh/include/asm/io.h | 6 + arch/sh/kernel/cpu/Makefile| 8 +- arch/sh/kernel/cpu/clock.c | 6 +- arch/sh/kernel/cpu/sh4/Makefile| 2 + arch/sh/kernel/head_32.S | 7 +- arch/sh/kernel/setup.c | 16 +- drivers/clk/Kconfig| 1 + drivers/clk/Makefile | 3 +- drivers/clk/sh/Kconfig | 2 + drivers/clk/sh/Makefile| 2 + drivers/clk/sh/clk-sh7750.c| 240 +++ drivers/clk/sh/clk-shdiv.c | 344 drivers/clk/sh/clk-shdiv.h | 16 + drivers/irqchip/Kconfig| 5 + drivers/irqchip/Makefile | 1 + drivers/irqchip/irq-io-landisk.c | 72 drivers/irqchip/irq-renesas-sh7751.c | 141 +++ drivers/pci/host/Kconfig | 7 + drivers/pci/host/Makefile | 1 + drivers/pci/host/pci-sh7751.c | 443 + include/dt-bindings/interrupt-controller/sh_intc.h | 2 + 34 files changed, 1656 insertions(+), 20 deletions(-) create mode 100644 Documentation/devicetree/bindings/clock/renesas,sh7750-div-clock.txt create mode 100644 Documentation/devicetree/bindings/clock/renesas,sh7750-pll-clock.txt create mode 100644 Documentation/devicetree/bindings/interrupt-controller/iodata-landisk.txt create mode 100644 Documentation/devicetree/bindings/interrupt-controller/renesas,sh7751-intc.txt create mode 100644 Documentation/devicetree/bindings/pci/sh7751-pci.txt create mode 12 arch/sh/boot/dts/include/dt-bindings create mode 100644 arch/sh/boot/dts/landisk.dts create mode 100644 drivers/clk/sh/Kconfig create mode 100644 drivers/clk/sh/Makefile create mode 100644 drivers/clk/sh/clk-sh7750.c create mode 100644 drivers/clk/sh/clk-shdiv.c create mode 100644 drivers/clk/sh/clk-shdiv.h create mode 100644 drivers/irqchip/irq-io-landisk.c create mode 100644 drivers/irqchip/irq-renesas-sh7751.c create mode 100644 drivers/pci/host/pci-sh7751.c create mode 100644 include/dt-bindings/interrupt-controller/sh_intc.h -- 2.7.0
[PATCH v2 06/17] sh: FDT address save before bank change
SH3/4 have register bank of R0-R7. Preset FDT address assigned bank depend on boot loader. Before setting a bank because we don't depend on a boot loader, it's evacuated. Signed-off-by: Yoshinori Sato --- arch/sh/kernel/head_32.S | 7 +++ 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/arch/sh/kernel/head_32.S b/arch/sh/kernel/head_32.S index 974bc15..fbf5f84 100644 --- a/arch/sh/kernel/head_32.S +++ b/arch/sh/kernel/head_32.S @@ -58,6 +58,9 @@ ENTRY(empty_zero_page) * */ ENTRY(_stext) +#ifdef CONFIG_OF + mov r4, r12 ! Store device tree blob pointer in r12 +#endif ! Initialize Status Register mov.l 1f, r0 ! MD=1, RB=0, BL=0, IMASK=0xF ldc r0, sr @@ -67,10 +70,6 @@ ENTRY(_stext) ldc r0, r6_bank #endif -#ifdef CONFIG_OF - mov r4, r12 ! Store device tree blob pointer in r12 -#endif - /* * Prefetch if possible to reduce cache miss penalty. * -- 2.7.0
Re: [PATCH v9 08/14] usb: otg: add OTG/dual-role core
On Thu, Jun 09, 2016 at 10:24:44AM +0300, Roger Quadros wrote: > On 08/06/16 15:42, Peter Chen wrote: > > On Wed, Jun 08, 2016 at 01:12:10PM +0300, Roger Quadros wrote: > >> Hi, > >> > >> On 08/06/16 12:53, Peter Chen wrote: > >>> On Wed, Jun 08, 2016 at 12:03:40PM +0300, Roger Quadros wrote: > +int usb_otg_unregister(struct device *dev) > +{ > +struct usb_otg *otg; > + > +mutex_lock(&otg_list_mutex); > +otg = usb_otg_get_data(dev); > +if (!otg) { > +dev_err(dev, "otg: %s: device not in otg list\n", > +__func__); > +mutex_unlock(&otg_list_mutex); > +return -EINVAL; > +} > + > +/* prevent unregister till both host & gadget have unregistered > */ > +if (otg->host || otg->gadget) { > +dev_err(dev, "otg: %s: host/gadget still registered\n", > +__func__); > >>> > >>> You need to call mutex_unlock here > >> > >> Indeed. good catch. > >>> > + > +int usb_otg_gadget_ready(struct usb_gadget *gadget, bool ready) > +{ > >>> > >>> What this API is for? Why need it in this version? > >> > >> we moved gadget to otg registration from udc_bind_to_driver() to > >> usb_add_gadget_udc_release(). > >> This means there is a window when gadget function driver (e.g. g_zero) is > >> not loaded. > >> We don't want to start the gadget controller in that window. > >> > >> usb_otg_gadget_ready() is used by gadget core to notify the otg core when > >> the function driver > >> is ready or not-ready. > >> > > > > Why you need to move this from gadget's probe to udc's probe? Currently, > > the sequence of gadget and udc's probe is random, but udc_bind_to_driver > > is called when udc is ready. > > > Because we need to support -EPROBE_DEFER at udc probe. > At udc_bind_to_driver there is no scope for -EPROBE_DEFER. > Why udc_bind_to_driver can't return -EPROBE_DEFER if register to OTG is failed? > Another issue is that we need to register with otg and have otg->caps > available > before driver->bind() is called in udc_bind_to_driver(). Else gadget function > will not have the correct OTG descriptor. > You can do register before calling driver->bind. -- Best Regards, Peter Chen
Re: [PATCH v8 2/5] perf config: Bring declarations about config from util/cache.h to util/config.h
Hi, I have a question about header files. I'm cleaning up source files that used cache.h after moving codes about config from cache.h to config.h. But I found there are header files that are repeatedly declared over all. For example, builtin-report.c include util/sort.h, perf.h, util/util.h, util/cache.h and etc. However, util/sort.h also have #include "cache.h" and cache.h even include util.h and perf.h. Isn't this a problem (but this is minor) ? Of course, this patch don't need to contain codes to fix this above problem. Should we fix this problem ? (If we do, I'd individually send patches for this problem.) Thanks, Taeung On 06/11/2016 09:59 AM, Taeung Song wrote: Good evening :) On 06/11/2016 04:06 AM, Arnaldo Carvalho de Melo wrote: Em Fri, Jun 10, 2016 at 03:20:43PM +0900, Taeung Song escreveu: On 06/09/2016 10:29 PM, Arnaldo Carvalho de Melo wrote: +++ b/tools/perf/util/cache.h @@ -7,6 +7,7 @@ #include +#include "config.h" Why have you added that? Are those config functions used in cache.h? Yes, it does. Many source files include cache.h e.g. builtin-annoate.c, util/color.c, builtin-report.c and etc. And They can use perf_config() function including this header file. So, If I totally eliminate not only declarations about config but also #include "util/config.h" at util/cache.h, we should add '#include "util/config.h"' to each source file that need perf_config() overall. Sure, that is how we should do it. We should not include cache.h just to get what is in config.h, we should instead include config.h. This way when we do a change to cache.h we will not be rebuilding all those files that depend on it just to get config.h. What you're doing, removing from cache.h things that shouldn't be there in the first place is good, among other things, because of that. Granted! I've also experienced the situation all those files which include cache.h are rebuilt after I changed cache.h. It also seems a problem as you mention. So, I'll send this patch that reflect what you said with v9. Have a nice weekend :-D Thanks, Taeung
[PATCH] arm: dts: qcom: Update smem state cells usage
This patch updates the qcom,state-cells to qcom,smem-state-cells to match recent changes to the binding. Signed-off-by: Andy Gross --- arch/arm/boot/dts/qcom-apq8064.dtsi | 2 +- arch/arm/boot/dts/qcom-msm8974.dtsi | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/arch/arm/boot/dts/qcom-apq8064.dtsi b/arch/arm/boot/dts/qcom-apq8064.dtsi index df96ccd..e4437e4 100644 --- a/arch/arm/boot/dts/qcom-apq8064.dtsi +++ b/arch/arm/boot/dts/qcom-apq8064.dtsi @@ -177,7 +177,7 @@ apps_smsm: apps@0 { reg = <0>; - #qcom,state-cells = <1>; + #qcom,smem-state-cells = <1>; }; modem_smsm: modem@1 { diff --git a/arch/arm/boot/dts/qcom-msm8974.dtsi b/arch/arm/boot/dts/qcom-msm8974.dtsi index 6f16426..3a79d3c 100644 --- a/arch/arm/boot/dts/qcom-msm8974.dtsi +++ b/arch/arm/boot/dts/qcom-msm8974.dtsi @@ -182,7 +182,7 @@ modem_smp2p_out: master-kernel { qcom,entry-name = "master-kernel"; - #qcom,state-cells = <1>; + #qcom,smem-state-cells = <1>; }; modem_smp2p_in: slave-kernel { @@ -208,7 +208,7 @@ wcnss_smp2p_out: master-kernel { qcom,entry-name = "master-kernel"; - #qcom,state-cells = <1>; + #qcom,smem-state-cells = <1>; }; wcnss_smp2p_in: slave-kernel { @@ -232,7 +232,7 @@ apps_smsm: apps@0 { reg = <0>; - #qcom,state-cells = <1>; + #qcom,smem-state-cells = <1>; }; modem_smsm: modem@1 { -- 1.9.1
Re: [PATCH V3 1/3] x86/ioapic: Support hot-removal of IOAPICs present during boot
On Saturday, June 11, 2016 12:43 AM, Bjorn Helgaas wrote: > On Wed, Jun 08, 2016 at 05:32:44PM +0800, Rui Wang wrote: > > @@ -1779,8 +1780,12 @@ void __init > > pci_assign_unassigned_resources(void) > > { > > struct pci_bus *root_bus; > > > > - list_for_each_entry(root_bus, &pci_root_buses, node) > > + list_for_each_entry(root_bus, &pci_root_buses, node) { > > pci_assign_unassigned_root_bus_resources(root_bus); > > +#ifdef CONFIG_X86 > > + acpi_ioapic_add(ACPI_HANDLE(root_bus->bridge)); > > +#endif > > This seems like a strange place to call acpi_ioapic_add(). Your object is to > call > acpi_ioapic_add() during root bus enumeration. > > I assume we *can't* call acpi_ioapic_add() from acpi_pci_root_add() at boot > time, for some reason you'll explain. But is there a reason we have to call > it > from pci_assign_unassigned_resources() (where it requires an ifdef) instead > of from pcibios_assign_resources(), which is already x86-specific? > > In acpi_pci_root_add(), we have this: > > acpi_pci_root_add(...) > { > ... > if (hotadd) > acpi_ioapic_add(root); > > So the obvious question is why don't we just remove the "if (hotadd)" > and call acpi_ioapic_add() always. > > I'm sure the reason is some ordering problem, but we need a comment in > acpi_pci_root_add() about why the obvious solution doesn't work. > Hi Bjorn, Yes it's an ording issue. acpi_ioapic_add() and also ioapic_insert_resources() have to be later than pci initialization in order to deal with IOAPICs mapped on a PCI BAR. There's a comment about this inside pcibios_resource_survey() above ioapic_insert_resources(). We can also add a comment inside acpi_pci_root_add(), though. And yes calling acpi_ioapic_add() in pcibios_assign_resources() doesn't require ifdef CONFIG_X86. But it'll require a loop to iterate through the root buses, and call acpi_ioapic_add() within the loop. pci_assign_unassigned_resources() already has that loop. Do you still prefer adding it to pcibios_assign_resources() ? Regards, Rui
Re: [PATCH v2 1/2] mfd: ti-smusbdig: Add support for the TI SM-USB-DIG
Hi, [auto build test ERROR on ljones-mfd/for-mfd-next] [also build test ERROR on v4.7-rc2 next-20160609] [if your patch is applied to the wrong git tree, please drop us a note to help improve the system] url: https://github.com/0day-ci/linux/commits/Andrew-F-Davis/mfd-ti-smusbdig-Add-support-for-the-TI-SM-USB-DIG/20160611-012112 base: https://git.kernel.org/pub/scm/linux/kernel/git/lee/mfd.git for-mfd-next config: i386-randconfig-x016-06120748 (attached as .config) compiler: gcc-6 (Debian 6.1.1-1) 6.1.1 20160430 reproduce: # save the attached .config to linux build tree make ARCH=i386 All errors (new ones prefixed by >>): >> ERROR: "usb_deregister" [drivers/mfd/ti-smusbdig.ko] undefined! >> ERROR: "usb_get_dev" [drivers/mfd/ti-smusbdig.ko] undefined! >> ERROR: "usb_interrupt_msg" [drivers/mfd/ti-smusbdig.ko] undefined! >> ERROR: "usb_register_driver" [drivers/mfd/ti-smusbdig.ko] undefined! --- 0-DAY kernel test infrastructureOpen Source Technology Center https://lists.01.org/pipermail/kbuild-all Intel Corporation .config.gz Description: Binary data
RE: [PATCH] fbcon: warn on invalid cursor blink intervals
> -Original Message- > From: Henrique de Moraes Holschuh [mailto:h...@hmh.eng.br] > Sent: Saturday, May 28, 2016 4:49 AM > To: Scot Doyle > Cc: Tomi Valkeinen ; Jean-Christophe Plagniol- > Villard ; Greg Kroah-Hartman > ; Jeremy Kerr ; Ming Lei > ; Daney, David ; > Dann Frazier ; Peter Hurley > ; Pavel Machek ; Jonathan Liu > ; Alistair Popple ; Jean-Philippe > Brucker ; Chintakuntla, Radha > ; Jiri Slaby ; David > Airlie ; David Daney ; dri- > de...@lists.freedesktop.org; linux-fb...@vger.kernel.org; Linux Kernel > Mailing List ; stable > > Subject: Re: [PATCH] fbcon: warn on invalid cursor blink intervals > > On Fri, 20 May 2016, Scot Doyle wrote: > > On Fri, 20 May 2016, Jeremy Kerr wrote: > > > >Then looks there are two fix patches acked & tested: > > > > > > > > - the patch in this thread > > > > - another one "[PATCH] tty: vt: Fix soft lockup in fbcon cursor > > > >blink timer." > > > > https://lkml.org/lkml/2016/5/17/455 > > > > > > > >So which one will be pushed to linus? > > > > > > Not that it's my call, but we may want both; the first as a safety > > > measure to prevent an invalid cur_blink_jiffies ever being set, and the > > > second one to actually fix the initialisation of vc_cur_blink_ms (and > > > address the warning introduced by the first). > > > > Tomi / Greg, > > > > I'd suggest > > - applying "tty: vt: Fix soft lockup in fbcon cursor blink timer." to 4.7 > > and > stable[4.2] > > - applying "fbcon: warn on invalid cursor blink intervals" to 4.7 > > - ignoring "fbcon: use default if cursor blink interval is not valid" > > > > Note: the patches don't depend on each other > > I applied both recommended patches on top of 4.4.11 for testing, and they > made things a lot better here. > > I suggest the second patch should be backported to stable too, might as well > fix this thing for good *and keep the door closed*. Is this patch available on some tree so that I can point to ? And hope it will make it to linux-next soon ? > > -- > "One disk to rule them all, One disk to find them. One disk to bring > them all and in the darkness grind them. In the Land of Redmond > where the shadows lie." -- The Silicon Valley Tarot > Henrique Holschuh
(.init.text+0x2b8): multiple definition of `plat_irq_setup'
Hi, FYI, the error/warning still remains. tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master head: 8714f8f5fe396ca513ccaaac2304497439c181fb commit: 7480e0aabd5f9e6c3e3b72ed206e89284e90f11f sh: add device tree support and generic board using device tree date: 3 months ago config: sh-allyesconfig (attached as .config) compiler: sh4-linux-gnu-gcc (Debian 5.3.1-8) 5.3.1 20160205 reproduce: wget https://git.kernel.org/cgit/linux/kernel/git/wfg/lkp-tests.git/plain/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross git checkout 7480e0aabd5f9e6c3e3b72ed206e89284e90f11f # save the attached .config to linux build tree make.cross ARCH=sh All errors (new ones prefixed by >>): arch/sh/boards/built-in.o: In function `plat_irq_setup': >> (.init.text+0x2b8): multiple definition of `plat_irq_setup' arch/sh/kernel/built-in.o:(.init.text+0x1250): first defined here arch/sh/boards/built-in.o: In function `arch_init_clk_ops': >> (.init.text+0x294): multiple definition of `arch_init_clk_ops' arch/sh/kernel/built-in.o:(.init.text+0x1300): first defined here --- 0-DAY kernel test infrastructureOpen Source Technology Center https://lists.01.org/pipermail/kbuild-all Intel Corporation .config.gz Description: Binary data
Re: PROBLEM: Resume form hibernate broken by setting NX on gap
Hey, On 11/06/16 07:05 PM, Rafael J. Wysocki wrote: 1) Commit ab76f7b4ab only extends the NX bit between __ex_table and rodata; which, by my understanding, shouldn't be used by anything. And __ex_table and rodata are fixed by the kernel's binary so both symbols should be the same in both the image kernel and the boot kernel given that both are running from the same binary. Well, what if the kernel is relocated? Ah, I'm sure I don't fully grasp the implications of that but I would assume that if the image kernel were located somewhere else it would still be far away from the boot kernel's ex_table/rodata boundary. 2) When ab76f7b4ab is reverted, hibernation seems to work 100%. Though, when it's in place, it only works some of the time. Given that commit is only extending the NX region a bit, if there is some random mismatch, why does it never reach rodata? In other words, why is rodata a magic line that seems to work all the time -- why doesn't this random mismatch ever extend into the rodata region? rodata isn't _that_ far away from the end of ex_table. That's a very good question. :-) Yeah, I guess if we knew the answer we'd understand what was going on and have a fix. Can you please check if the patch below makes any difference? I'm afraid it's no different. The kernel still freezes on resume. Though, no warnings with this one. Thanks, Logan
Re: [PATCH v2 2/2] ARM: dts: sd_600eval: Fix eMMC lockup issue
On Fri 10 Jun 11:19 PDT 2016, Srinivas Kandagatla wrote: > From: Parth Pancholi > > This board locks up if we stress test the eMMC, as the regulator s4 is > unable to supply enough current for all the peripherials attached to it. > As this supply is wired up to most of the peripherials including DDR, > it resulted in such lockup. > > This patch fixes this issue by setting s4 regulator correctly with > Auto power mode. > > Reported-by: Srinivas Kandagatla > [Srinivas Kandagatla: rewrote the change log] > Tested-by: Girish Sharma > Signed-off-by: Parth Pancholi If I read the msm-3.4 tree correctly most (perhaps all) 8064 devices should have this setup. Acked-by: Bjorn Andersson Regards, Bjorn > --- > arch/arm/boot/dts/qcom-apq8064-arrow-sd-600eval.dts | 4 +++- > 1 file changed, 3 insertions(+), 1 deletion(-) > > diff --git a/arch/arm/boot/dts/qcom-apq8064-arrow-sd-600eval.dts > b/arch/arm/boot/dts/qcom-apq8064-arrow-sd-600eval.dts > index 7df0108..39ae2bc 100644 > --- a/arch/arm/boot/dts/qcom-apq8064-arrow-sd-600eval.dts > +++ b/arch/arm/boot/dts/qcom-apq8064-arrow-sd-600eval.dts > @@ -1,6 +1,7 @@ > #include "qcom-apq8064-v2.0.dtsi" > #include "qcom-apq8064-arrow-sd-600eval-pins.dtsi" > #include > +#include > > / { > model = "Arrow Electronics, APQ8064 SD_600eval"; > @@ -82,7 +83,8 @@ > s4 { > regulator-min-microvolt = <180>; > regulator-max-microvolt = <180>; > - qcom,switch-mode-frequency = <320>; > + qcom,switch-mode-frequency = <160>; > + qcom,force-mode = > ; > bias-pull-down; > regulator-always-on; > }; > -- > 2.8.3 >
Re: undefined reference to `printk'
[Adding LKML, linux-arch, and Linus.] On Sun, Jun 12, 2016 at 10:17:01AM +0800, kbuild test robot wrote: > All errors (new ones prefixed by >>): > >arch/m32r/kernel/built-in.o: In function `default_eit_handler': > >> (.text+0x3f8): undefined reference to `printk' >arch/m32r/kernel/built-in.o: In function `default_eit_handler': >(.text+0x3f8): relocation truncated to fit: R_M32R_26_PCREL_RELA against > undefined symbol `printk' As far as I can tell, there has been a patch available for this for months, and it still doesn't seem to have been applied anywhere. m32r is listed in MAINTAINERS as "Orphan", and has been since commit b4174867bee83e79dc155479cb1b67c452da6476 in 2014. And that commit in turn observed no commits from the maintainer since 2009. Looking at the log for arch/m32r, I don't see any activity other than random fixes by others, and based on the signoffs, all of those seem to go through miscellaneous trees. Is anyone using m32r? Is anyone willing to maintain it? And if not, should we consider removing it? - Josh Triplett
[PATCH] perf annotate: ARM64 support
Add basic support to parse ARM64 assembly. This: * enables perf to correctly show the disassembly, rather than chopping some constants off at the '#'. '#' is not the comment character for ARM64. * allows perf to identify ARM64 instructions that branch to other parts within the same function, thereby properly annotating them. * allows perf to identify function calls, allowing called functions to be followed in the annotated view. Signed-off-by: Andrew Pinski --- tools/perf/util/annotate.c | 64 +++--- 1 file changed, 61 insertions(+), 3 deletions(-) diff --git a/tools/perf/util/annotate.c b/tools/perf/util/annotate.c index 7e5a1e8..ea915e8 100644 --- a/tools/perf/util/annotate.c +++ b/tools/perf/util/annotate.c @@ -65,7 +65,7 @@ static int call__parse(struct ins_operands *ops) name++; -#ifdef __arm__ +#if defined(__arm__) || defined(__aarch64__) if (strchr(name, '+')) return -1; #endif @@ -119,9 +119,22 @@ bool ins__is_call(const struct ins *ins) static int jump__parse(struct ins_operands *ops) { - const char *s = strchr(ops->raw, '+'); + const char *raw = ops->raw; + const char *s; +#ifdef __aarch64__ + /* Skip over one or two commas so that cbz and tbz works. */ + const char *comma = strchr(raw, ','); + + if (comma) { + raw = comma + 1; + comma = strchr(raw, ','); + if (comma) + raw = comma + 1; + } +#endif + s = strchr(raw, '+'); - ops->target.addr = strtoull(ops->raw, NULL, 16); + ops->target.addr = strtoull(raw, NULL, 16); if (s++ != NULL) ops->target.offset = strtoull(s, NULL, 16); @@ -134,6 +147,25 @@ static int jump__parse(struct ins_operands *ops) static int jump__scnprintf(struct ins *ins, char *bf, size_t size, struct ins_operands *ops) { +#ifdef __aarch64__ + const char *comma0 = strchr(ops->raw, ','); + + if (comma0) { + const char *comma1 = strchr(comma0 + 1, ','); + + if (comma1) + return scnprintf(bf, size, +"%-6.6s %.*s, %.*s, %" PRIx64, +ins->name, +(int)(comma0 - ops->raw), ops->raw, +(int)(comma1 - comma0 - 1), comma0 + 1, +ops->target.offset); + + return scnprintf(bf, size, "%-6.6s %.*s, %" PRIx64, ins->name, +(int)(comma0 - ops->raw), ops->raw, +ops->target.offset); + } +#endif return scnprintf(bf, size, "%-6.6s %" PRIx64, ins->name, ops->target.offset); } @@ -253,6 +285,8 @@ static int mov__parse(struct ins_operands *ops) target = ++s; #ifdef __arm__ comment = strchr(s, ';'); +#elif defined(__aarch64__) + comment = strstr(s, "//"); #else comment = strchr(s, '#'); #endif @@ -355,6 +389,29 @@ static struct ins_ops nop_ops = { }; static struct ins instructions[] = { +#ifdef __aarch64__ + { .name = "b", .ops = &jump_ops, }, // might also be a call + { .name = "b.cc", .ops = &jump_ops, }, + { .name = "b.cs", .ops = &jump_ops, }, + { .name = "b.eq", .ops = &jump_ops, }, + { .name = "b.ge", .ops = &jump_ops, }, + { .name = "b.gt", .ops = &jump_ops, }, + { .name = "b.hi", .ops = &jump_ops, }, + { .name = "b.le", .ops = &jump_ops, }, + { .name = "b.ls", .ops = &jump_ops, }, + { .name = "b.lt", .ops = &jump_ops, }, + { .name = "b.ne", .ops = &jump_ops, }, + { .name = "b.pl", .ops = &jump_ops, }, + { .name = "bl",.ops = &call_ops, }, + { .name = "cbnz", .ops = &jump_ops, }, + { .name = "cbz", .ops = &jump_ops, }, + { .name = "dec", .ops = &dec_ops, }, + { .name = "lock", .ops = &lock_ops, }, // fake one + { .name = "mov", .ops = &mov_ops, }, + { .name = "nop", .ops = &nop_ops, }, + { .name = "tbnz", .ops = &jump_ops, }, + { .name = "tbz", .ops = &jump_ops, }, +#else { .name = "add", .ops = &mov_ops, }, { .name = "addl", .ops = &mov_ops, }, { .name = "addq", .ops = &mov_ops, }, @@ -444,6 +501,7 @@ static struct ins instructions[] = { { .name = "xadd", .ops = &mov_ops, }, { .name = "xbeginl", .ops = &jump_ops, }, { .name = "xbeginq", .ops = &jump_ops, }, +#endif }; static int ins__key_cmp(const void *name, const void *insp) -- 1.9.1
Re: [PATCH v3,4/5] usb: Add MediaTek USB3 DRD Driver
Hi, [auto build test ERROR on usb/usb-testing] [also build test ERROR on v4.7-rc2 next-20160609] [if your patch is applied to the wrong git tree, please drop us a note to help improve the system] url: https://github.com/0day-ci/linux/commits/Chunfeng-Yun/usb-Add-MediaTek-USB3-DRD-Driver/20160610-153559 base: https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb.git usb-testing config: i386-randconfig-x011-06120748 (attached as .config) compiler: gcc-6 (Debian 6.1.1-1) 6.1.1 20160430 reproduce: # save the attached .config to linux build tree make ARCH=i386 All error/warnings (new ones prefixed by >>): warning: (USB_MTU3) selects USB_XHCI_MTK which has unmet direct dependencies (USB_SUPPORT && USB && USB_XHCI_HCD && (ARCH_MEDIATEK || COMPILE_TEST)) drivers/built-in.o: In function `mtu3_probe': >> mtu3_plat.c:(.text+0x21471d): undefined reference to >> `extcon_get_edev_by_phandle' --- 0-DAY kernel test infrastructureOpen Source Technology Center https://lists.01.org/pipermail/kbuild-all Intel Corporation .config.gz Description: Binary data
Re: [PATCH perf/core v10 09/23] perf probe: Show all cached probes
On Sat, 11 Jun 2016 09:28:09 +0900 Masami Hiramatsu wrote: > On Thu, 9 Jun 2016 11:22:55 -0300 > Arnaldo Carvalho de Melo wrote: > > > Em Wed, Jun 08, 2016 at 06:30:30PM +0900, Masami Hiramatsu escreveu: > > > +char *build_id_cache__origname(const char *sbuild_id) > > > +{ > > > + char *linkname; > > > + char buf[PATH_MAX]; > > > + char *ret = NULL, *p; > > > + size_t offs = 5;/* == strlen("../..") */ > > > + > > > + linkname = build_id_cache__linkname(sbuild_id, NULL, 0); > > > + if (!linkname) > > > + return NULL; > > > + > > > + if (readlink(linkname, buf, PATH_MAX) < 0) > > > + goto out; > > > + /* The link should be "../../" */ > > > + p = strrchr(buf, '/'); /* Cut off the "/" */ > > > + if (p && (p > buf + offs)) { > > > + *p = '\0'; > > > + if (buf[offs + 1] == '[') > > > + offs++; /* > > > + * This is a DSO name, like [kernel.kallsyms]. > > > + * Skip the first '/', since this is not the > > > + * cache of a regular file. > > > + */ > > > + ret = strdup(buf + offs); /* Skip "../..[/]" */ > > > > strdup can fail. > > Ah, right. In this case, build_id_cache__origname() returns ret immediately(see below), so we don't need to take reaction about that :) > > > + } > > > +out: > > > + free(linkname); > > > + return ret; > > > +} here, if strdup() fails, this just return NULL. that is OK. Thanks! -- Masami Hiramatsu
Re: [PATCH] nfsd: Close a race between access checking/setting in nfs4_get_vfs_file
On Jun 11, 2016, at 10:50 PM, Jeff Layton wrote: > On Sat, 2016-06-11 at 22:06 -0400, Oleg Drokin wrote: >> >> Hm. I am trying to lock the newly initialized one and that seems to be >> holding up >> well (but I want 24 hours just to be extra sure). >> Hn, I just noticed a bug in this, so that'll reset the clock back. >> >> But I think we cannot return with locked one if we found existing one due to >> lock >> inversion? >> I see that normally first we lock the state rwsem (now mutex) and then >> lock the fi_lock. >> Now if we make init_open_stateid() to lock the new state mutex while the >> fi_lock >> is locked - that's probably ok, because we can do it before adding it to the >> list, >> so nobody can find it. >> Now the existing state that we find, we cannot really lock while holding >> that fi_lock, >> because what if there's a parallel thread that already holds the mutex and >> now >> wants the fi_lock? >> And so it's probably best to return with existing state unlocked and let >> caller lock it? >> Or do you think it's best to separately lock the found stp outside of >> spinlock >> just for consistency? > > I think we just have to ensure that if the new stateid is hashed that > its mutex is locked prior to being inserted into the hashtable. That > should prevent the race you mentioned. > > If we find an existing one in the hashtable in init_open_stateid, then > we _can_ take the mutex after dropping the spinlocks, since we won't > call release_open_stateid in that case anyway. Yes. > We'll also need to consider what happens if nfs4_get_vfs_file fails > after we hashed the stateid, but then another task finds it while > processing another open. So we might have to have release_open_stateid > unlock the mutex after unhashing the stateid, but before putting the > reference, and then have init_open_stateid check to see if the thing is > still hashed after it gets the mutex. Hm. So what's going to go wrong if another user reuses the unhashed stateid? As long as they drop it once they are done it'll be freed and all is fine, no? Are there other implications? Hm, it looks like free_ol_stateid_reaplist() just frees the thing without any looking into mutexes and stuff? Ok, so we get the mutex, check that the stateid is hashed, it's not anymore (actually unhashing could be done without mutex too, right? so just mutex held is not going to protect us), then we need to drop the mutex and restart the search from scratch (including all relocking), I assume? I guess I'll have it as a separate follow on patch. We'll probably also need some fault-injection here to trigger this case, as triggering it "naturally" will be a tough problem even on my mega-racy setup. Something like: if (swapstp) { … } if (FAULTINJECTION) { msleep(some_random_time); status = nfserr_eio; } else status = nfs4_get_vfs_file(rqstp, fp, current_fh, stp, open); should increase the chance. Ideally there'd be a way to trigger this case more deterministically, how do I have two OPEN requests in parallel in NFS for the same file, just have two threads do it and that would 100% result in two requests, no merging anywhere along the way that I need to be aware of?
[PATCH 1/8] kexec_file: Remove unused members from struct kexec_buf.
kexec_add_buffer uses kexec_buf.buffer and kexec_buf.bufsz to pass along its own arguments buffer and bufsz, but since they aren't used anywhere else, it's pointless. Cc: Eric Biederman Cc: ke...@lists.infradead.org Cc: linux-kernel@vger.kernel.org --- kernel/kexec_file.c | 6 ++ kernel/kexec_internal.h | 2 -- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/kernel/kexec_file.c b/kernel/kexec_file.c index 01ab82a40d22..b6eec7527e9f 100644 --- a/kernel/kexec_file.c +++ b/kernel/kexec_file.c @@ -464,8 +464,6 @@ int kexec_add_buffer(struct kimage *image, char *buffer, unsigned long bufsz, memset(&buf, 0, sizeof(struct kexec_buf)); kbuf = &buf; kbuf->image = image; - kbuf->buffer = buffer; - kbuf->bufsz = bufsz; kbuf->memsz = ALIGN(memsz, PAGE_SIZE); kbuf->buf_align = max(buf_align, PAGE_SIZE); @@ -489,8 +487,8 @@ int kexec_add_buffer(struct kimage *image, char *buffer, unsigned long bufsz, /* Found a suitable memory range */ ksegment = &image->segment[image->nr_segments]; - ksegment->kbuf = kbuf->buffer; - ksegment->bufsz = kbuf->bufsz; + ksegment->kbuf = buffer; + ksegment->bufsz = bufsz; ksegment->mem = kbuf->mem; ksegment->memsz = kbuf->memsz; image->nr_segments++; diff --git a/kernel/kexec_internal.h b/kernel/kexec_internal.h index 0a52315d9c62..eefd5bf960c2 100644 --- a/kernel/kexec_internal.h +++ b/kernel/kexec_internal.h @@ -26,8 +26,6 @@ struct kexec_sha_region { */ struct kexec_buf { struct kimage *image; - char *buffer; - unsigned long bufsz; unsigned long mem; unsigned long memsz; unsigned long buf_align; -- 1.9.1
[PATCH 5/8] powerpc: Add functions to read ELF files of any endianness.
A little endian kernel might need to kexec a big endian kernel (the opposite is less likely but could happen as well), so we can't just cast the buffer with the binary to ELF structs and use them as is done elsewhere. This patch adds functions which do byte-swapping as necessary when populating the ELF structs. These functions will be used in the next patch in the series. Cc: ke...@lists.infradead.org Cc: linux-kernel@vger.kernel.org --- arch/powerpc/include/asm/elf_util.h | 19 ++ arch/powerpc/kernel/Makefile| 2 +- arch/powerpc/kernel/elf_util.c | 476 3 files changed, 496 insertions(+), 1 deletion(-) diff --git a/arch/powerpc/include/asm/elf_util.h b/arch/powerpc/include/asm/elf_util.h index 19ff3335d17d..9cd24bc528b1 100644 --- a/arch/powerpc/include/asm/elf_util.h +++ b/arch/powerpc/include/asm/elf_util.h @@ -20,6 +20,14 @@ #include struct elf_info { + /* +* Where the ELF binary contents are kept. +* Memory managed by the user of the struct. +*/ + const char *buffer; + + const struct elfhdr *ehdr; + const struct elf_phdr *proghdrs; struct elf_shdr *sechdrs; /* Index of stubs section. */ @@ -63,6 +71,17 @@ static inline unsigned long my_r2(const struct elf_info *elf_info) return elf_info->sechdrs[elf_info->toc_section].sh_addr + 0x8000; } +static inline bool elf_is_elf_file(const struct elfhdr *ehdr) +{ + return memcmp(ehdr->e_ident, ELFMAG, SELFMAG) == 0; +} + +int elf_read_from_buffer(const char *buf, size_t len, struct elfhdr *ehdr, +struct elf_info *elf_info); +void elf_init_elf_info(const struct elfhdr *ehdr, struct elf_shdr *sechdrs, + struct elf_info *elf_info); +void elf_free_info(struct elf_info *elf_info); + int elf64_apply_relocate_add(const struct elf_info *elf_info, const char *strtab, const Elf64_Rela *rela, unsigned int num_rela, void *syms_base, diff --git a/arch/powerpc/kernel/Makefile b/arch/powerpc/kernel/Makefile index e99f626acc85..8a53fccaa053 100644 --- a/arch/powerpc/kernel/Makefile +++ b/arch/powerpc/kernel/Makefile @@ -125,7 +125,7 @@ obj-y += iomap.o endif ifeq ($(CONFIG_MODULES)$(CONFIG_WORD_SIZE),y64) -obj-y += elf_util_64.o +obj-y += elf_util.o elf_util_64.o endif obj64-$(CONFIG_PPC_TRANSACTIONAL_MEM) += tm.o diff --git a/arch/powerpc/kernel/elf_util.c b/arch/powerpc/kernel/elf_util.c new file mode 100644 index ..760be6a5c393 --- /dev/null +++ b/arch/powerpc/kernel/elf_util.c @@ -0,0 +1,476 @@ +/* + * Utility functions to work with ELF files. + * + * Copyright (C) 2016, IBM Corporation + * + * Based on kexec-tools' kexec-elf.c. Heavily modified for the + * kernel by Thiago Jung Bauermann . + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation (version 2 of the License). + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + */ + +#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt + +#include +#include +#include + +#if ELF_CLASS == ELFCLASS32 +#define elf_addr_to_cpuelf32_to_cpu + +#ifndef Elf_Rel +#define Elf_RelElf32_Rel +#endif /* Elf_Rel */ +#else /* ELF_CLASS == ELFCLASS32 */ +#define elf_addr_to_cpuelf64_to_cpu + +#ifndef Elf_Rel +#define Elf_RelElf64_Rel +#endif /* Elf_Rel */ + +static uint64_t elf64_to_cpu(const struct elfhdr *ehdr, uint64_t value) +{ + if (ehdr->e_ident[EI_DATA] == ELFDATA2LSB) + value = le64_to_cpu(value); + else if (ehdr->e_ident[EI_DATA] == ELFDATA2MSB) + value = be64_to_cpu(value); + + return value; +} +#endif /* ELF_CLASS == ELFCLASS32 */ + +static uint16_t elf16_to_cpu(const struct elfhdr *ehdr, uint16_t value) +{ + if (ehdr->e_ident[EI_DATA] == ELFDATA2LSB) + value = le16_to_cpu(value); + else if (ehdr->e_ident[EI_DATA] == ELFDATA2MSB) + value = be16_to_cpu(value); + + return value; +} + +static uint32_t elf32_to_cpu(const struct elfhdr *ehdr, uint32_t value) +{ + if (ehdr->e_ident[EI_DATA] == ELFDATA2LSB) + value = le32_to_cpu(value); + else if (ehdr->e_ident[EI_DATA] == ELFDATA2MSB) + value = be32_to_cpu(value); + + return value; +} + +/** + * elf_is_ehdr_sane - check that it is safe to use the ELF header + * @buf_len: size of the buffer in which the ELF file is loaded. + */ +static bool elf_is_ehdr_sane(const struct elfhdr *ehdr, size_t buf_len) +{ + if (ehdr->e_phnum > 0 && ehdr->e_
[PATCH 6/8] powerpc: Implement kexec_file_load.
Adds the machinery needed by kexec_file_load, except actually loading a kernel and initrd. elf64_apply_relocate_add was extended to support relative symbols. This is necessary because before relocation, the module loading mechanism adjusts Elf64_Sym.st_value to point to the absolute memory address, while the kexec purgatory relocation code does that during relocation. We also add relocation types used by the purgatory. Cc: ke...@lists.infradead.org Cc: linux-kernel@vger.kernel.org --- arch/powerpc/Kconfig | 13 +++ arch/powerpc/include/asm/elf_util.h| 1 + arch/powerpc/include/asm/systbl.h | 1 + arch/powerpc/include/asm/unistd.h | 2 +- arch/powerpc/include/uapi/asm/unistd.h | 1 + arch/powerpc/kernel/Makefile | 4 +- arch/powerpc/kernel/elf_util_64.c | 83 +++- arch/powerpc/kernel/machine_kexec_64.c | 139 + arch/powerpc/kernel/module_64.c| 5 +- 9 files changed, 245 insertions(+), 4 deletions(-) diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig index 01f7464d9fea..3ed5770b89e4 100644 --- a/arch/powerpc/Kconfig +++ b/arch/powerpc/Kconfig @@ -457,6 +457,19 @@ config KEXEC interface is strongly in flux, so no good recommendation can be made. +config KEXEC_FILE + bool "kexec file based system call" + select KEXEC_CORE + select BUILD_BIN2C + depends on PPC64 + depends on CRYPTO=y + depends on CRYPTO_SHA256=y + help + This is a new version of the kexec system call. This call is + file based and takes in file descriptors as system call arguments + for kernel and initramfs as opposed to a list of segments as is the + case for the older kexec call. + config CRASH_DUMP bool "Build a kdump crash kernel" depends on PPC64 || 6xx || FSL_BOOKE || (44x && !SMP) diff --git a/arch/powerpc/include/asm/elf_util.h b/arch/powerpc/include/asm/elf_util.h index 9cd24bc528b1..41a172077f9e 100644 --- a/arch/powerpc/include/asm/elf_util.h +++ b/arch/powerpc/include/asm/elf_util.h @@ -86,6 +86,7 @@ int elf64_apply_relocate_add(const struct elf_info *elf_info, const char *strtab, const Elf64_Rela *rela, unsigned int num_rela, void *syms_base, void *loc_base, Elf64_Addr addr_base, +bool relative_symbols, bool check_symbols, const char *obj_name); #endif /* _ASM_POWERPC_ELF_UTIL_H */ diff --git a/arch/powerpc/include/asm/systbl.h b/arch/powerpc/include/asm/systbl.h index 2fc5d4db503c..4b369d83fe9c 100644 --- a/arch/powerpc/include/asm/systbl.h +++ b/arch/powerpc/include/asm/systbl.h @@ -386,3 +386,4 @@ SYSCALL(mlock2) SYSCALL(copy_file_range) COMPAT_SYS_SPU(preadv2) COMPAT_SYS_SPU(pwritev2) +SYSCALL(kexec_file_load) diff --git a/arch/powerpc/include/asm/unistd.h b/arch/powerpc/include/asm/unistd.h index cf12c580f6b2..a01e97d3f305 100644 --- a/arch/powerpc/include/asm/unistd.h +++ b/arch/powerpc/include/asm/unistd.h @@ -12,7 +12,7 @@ #include -#define NR_syscalls382 +#define NR_syscalls383 #define __NR__exit __NR_exit diff --git a/arch/powerpc/include/uapi/asm/unistd.h b/arch/powerpc/include/uapi/asm/unistd.h index e9f5f41aa55a..2f26335a3c42 100644 --- a/arch/powerpc/include/uapi/asm/unistd.h +++ b/arch/powerpc/include/uapi/asm/unistd.h @@ -392,5 +392,6 @@ #define __NR_copy_file_range 379 #define __NR_preadv2 380 #define __NR_pwritev2 381 +#define __NR_kexec_file_load 382 #endif /* _UAPI_ASM_POWERPC_UNISTD_H_ */ diff --git a/arch/powerpc/kernel/Makefile b/arch/powerpc/kernel/Makefile index 8a53fccaa053..c937b8074464 100644 --- a/arch/powerpc/kernel/Makefile +++ b/arch/powerpc/kernel/Makefile @@ -124,9 +124,11 @@ ifneq ($(CONFIG_PPC_INDIRECT_PIO),y) obj-y += iomap.o endif -ifeq ($(CONFIG_MODULES)$(CONFIG_WORD_SIZE),y64) +ifneq ($(CONFIG_MODULES)$(CONFIG_KEXEC_FILE),) +ifeq ($(CONFIG_WORD_SIZE),64) obj-y += elf_util.o elf_util_64.o endif +endif obj64-$(CONFIG_PPC_TRANSACTIONAL_MEM) += tm.o diff --git a/arch/powerpc/kernel/elf_util_64.c b/arch/powerpc/kernel/elf_util_64.c index cde0420add9e..287d381a1a86 100644 --- a/arch/powerpc/kernel/elf_util_64.c +++ b/arch/powerpc/kernel/elf_util_64.c @@ -74,6 +74,8 @@ static void squash_toc_save_inst(const char *name, unsigned long addr) { } * @syms_base: Contents of the associated symbol table. * @loc_base: Contents of the section to which relocations apply. * @addr_base: The address where the section will be loaded in memory. + * @relative_symbols: Are the symbols' st_value members relative? + * @check_symbols: Fail if an unexpected symbol is found? * @obj_name: The name of the ELF binary, for information messages. * * Applies RELA r
[PATCH 3/8] powerpc: Factor out relocation code from module_64.c to elf_util_64.c.
The kexec_file_load system call needs to relocate the purgatory, so factor out the module relocation code so that it can be shared. This patch's purpose is to move the ELF relocation logic from apply_relocate_add to elf_util_64.c with as few changes as possible. The following changes were needed: To avoid having module-specific code in a general purpose utility function, struct elf_info was created to contain the information needed for ELF binaries manipulation. my_r2, stub_for_addr and create_stub were changed to use it instead of having to receive a struct module, since they are called from elf64_apply_relocate_add. local_entry_offset and squash_toc_save_inst were only used by apply_rellocate_add, so they were moved to elf_util_64.c as well. Cc: Benjamin Herrenschmidt Cc: Paul Mackerras Cc: Michael Ellerman Cc: Torsten Duwe Cc: ke...@lists.infradead.org Cc: linux-kernel@vger.kernel.org --- arch/powerpc/include/asm/elf_util.h | 70 arch/powerpc/include/asm/module.h | 14 +- arch/powerpc/kernel/Makefile| 4 + arch/powerpc/kernel/elf_util_64.c | 269 +++ arch/powerpc/kernel/module_64.c | 312 5 files changed, 386 insertions(+), 283 deletions(-) diff --git a/arch/powerpc/include/asm/elf_util.h b/arch/powerpc/include/asm/elf_util.h new file mode 100644 index ..13d3ca113299 --- /dev/null +++ b/arch/powerpc/include/asm/elf_util.h @@ -0,0 +1,70 @@ +/* + * Utility functions to work with ELF files. + * + * Copyright (C) 2016, IBM Corporation + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + */ + +#ifndef _ASM_POWERPC_ELF_UTIL_H +#define _ASM_POWERPC_ELF_UTIL_H + +#include + +struct elf_info { + struct elf_shdr *sechdrs; + + /* Index of stubs section. */ + unsigned int stubs_section; + /* Index of TOC section. */ + unsigned int toc_section; +}; + +#ifdef __powerpc64__ +#if defined(_CALL_ELF) && _CALL_ELF == 2 + +/* An address is simply the address of the function. */ +typedef unsigned long func_desc_t; +#else + +/* An address is address of the OPD entry, which contains address of fn. */ +typedef struct ppc64_opd_entry func_desc_t; +#endif + +/* Like PPC32, we need little trampolines to do > 24-bit jumps (into + the kernel itself). But on PPC64, these need to be used for every + jump, actually, to reset r2 (TOC+0x8000). */ +struct ppc64_stub_entry +{ + /* 28 byte jump instruction sequence (7 instructions). We only +* need 6 instructions on ABIv2 but we always allocate 7 so +* so we don't have to modify the trampoline load instruction. */ + u32 jump[7]; + /* Used by ftrace to identify stubs */ + u32 magic; + /* Data for the above code */ + func_desc_t funcdata; +}; +#endif + +/* r2 is the TOC pointer: it actually points 0x8000 into the TOC (this + gives the value maximum span in an instruction which uses a signed + offset) */ +static inline unsigned long my_r2(const struct elf_info *elf_info) +{ + return elf_info->sechdrs[elf_info->toc_section].sh_addr + 0x8000; +} + +int elf64_apply_relocate_add(const struct elf_info *elf_info, +const char *strtab, unsigned int symindex, +unsigned int relsec, const char *obj_name); + +#endif /* _ASM_POWERPC_ELF_UTIL_H */ diff --git a/arch/powerpc/include/asm/module.h b/arch/powerpc/include/asm/module.h index cd4ffd86765f..f2073115d518 100644 --- a/arch/powerpc/include/asm/module.h +++ b/arch/powerpc/include/asm/module.h @@ -12,7 +12,14 @@ #include #include #include +#include +/* Both low and high 16 bits are added as SIGNED additions, so if low + 16 bits has high bit set, high 16 bits must be adjusted. These + macros do that (stolen from binutils). */ +#define PPC_LO(v) ((v) & 0x) +#define PPC_HI(v) (((v) >> 16) & 0x) +#define PPC_HA(v) PPC_HI ((v) + 0x8000) #ifndef __powerpc64__ /* @@ -33,8 +40,7 @@ struct ppc_plt_entry { struct mod_arch_specific { #ifdef __powerpc64__ - unsigned int stubs_section; /* Index of stubs section in module */ - unsigned int toc_section; /* What section is the TOC? */ + struct elf_info elf_info; bool toc_fixed; /* Have we fixed up .TOC.? */ #ifdef CONFIG_DYNAMIC_FTRACE unsigned long toc; @@ -90,6 +96,10 @@ static inline int module_finalize_ftrace(struct module *mod, const Elf_Shdr *sec } #endif +unsigned long stub_for_addr(const struct elf_info *elf_i
[PATCH 8/8] powerpc: Add purgatory for kexec_file_load implementation.
This purgatory implementation comes from kexec-tools, almost unchanged. The only changes were that the sha256_regions global variable was renamed to sha_regions to match what kexec_file_load expects, and to use the sha256.c file from x86's purgatory to avoid adding yet another SHA-256 implementation. Cc: ke...@lists.infradead.org Cc: linux-kernel@vger.kernel.org --- arch/powerpc/Makefile | 4 + arch/powerpc/purgatory/.gitignore | 2 + arch/powerpc/purgatory/Makefile | 36 +++ arch/powerpc/purgatory/console-ppc64.c| 43 arch/powerpc/purgatory/crashdump-ppc64.h | 42 arch/powerpc/purgatory/crashdump_backup.c | 40 +++ arch/powerpc/purgatory/crtsavres.S| 5 + arch/powerpc/purgatory/hvCall.S | 27 + arch/powerpc/purgatory/hvCall.h | 8 ++ arch/powerpc/purgatory/kexec-sha256.h | 11 ++ arch/powerpc/purgatory/ppc64_asm.h| 18 arch/powerpc/purgatory/printf.c | 171 ++ arch/powerpc/purgatory/purgatory-ppc64.c | 46 arch/powerpc/purgatory/purgatory-ppc64.h | 6 ++ arch/powerpc/purgatory/purgatory.c| 66 arch/powerpc/purgatory/purgatory.h| 11 ++ arch/powerpc/purgatory/sha256.c | 6 ++ arch/powerpc/purgatory/sha256.h | 1 + arch/powerpc/purgatory/string.S | 1 + arch/powerpc/purgatory/v2wrap.S | 139 20 files changed, 683 insertions(+) diff --git a/arch/powerpc/Makefile b/arch/powerpc/Makefile index 709a22a3e824..293322855cce 100644 --- a/arch/powerpc/Makefile +++ b/arch/powerpc/Makefile @@ -249,6 +249,7 @@ core-y += arch/powerpc/kernel/ \ core-$(CONFIG_XMON)+= arch/powerpc/xmon/ core-$(CONFIG_KVM) += arch/powerpc/kvm/ core-$(CONFIG_PERF_EVENTS) += arch/powerpc/perf/ +core-$(CONFIG_KEXEC_FILE) += arch/powerpc/purgatory/ drivers-$(CONFIG_OPROFILE) += arch/powerpc/oprofile/ @@ -370,6 +371,9 @@ archclean: $(Q)$(MAKE) $(clean)=$(boot) archprepare: checkbin +ifeq ($(CONFIG_KEXEC_FILE),y) + $(Q)$(MAKE) $(build)=arch/powerpc/purgatory arch/powerpc/purgatory/kexec-purgatory.c +endif # Use the file '.tmp_gas_check' for binutils tests, as gas won't output # to stdout and these checks are run even on install targets. diff --git a/arch/powerpc/purgatory/.gitignore b/arch/powerpc/purgatory/.gitignore new file mode 100644 index ..e9e66f178a6d --- /dev/null +++ b/arch/powerpc/purgatory/.gitignore @@ -0,0 +1,2 @@ +kexec-purgatory.c +purgatory.ro diff --git a/arch/powerpc/purgatory/Makefile b/arch/powerpc/purgatory/Makefile new file mode 100644 index ..63daf95e5703 --- /dev/null +++ b/arch/powerpc/purgatory/Makefile @@ -0,0 +1,36 @@ +purgatory-y := purgatory.o printf.o string.o v2wrap.o hvCall.o \ + purgatory-ppc64.o console-ppc64.o crashdump_backup.o \ + crtsavres.o sha256.o + +targets += $(purgatory-y) +PURGATORY_OBJS = $(addprefix $(obj)/,$(purgatory-y)) + +LDFLAGS_purgatory.ro := -e purgatory_start -r --no-undefined -nostartfiles \ + -nostdlib -nodefaultlibs +targets += purgatory.ro + +# Default KBUILD_CFLAGS can have -pg option set when FTRACE is enabled. That +# in turn leaves some undefined symbols like __fentry__ in purgatory and not +# sure how to relocate those. Like kexec-tools, use custom flags. + +KBUILD_CFLAGS := -Wall -Wstrict-prototypes -fno-strict-aliasing \ + -fno-zero-initialized-in-bss -fno-builtin -ffreestanding \ + -fno-PIC -fno-PIE -fno-stack-protector -fno-exceptions \ + -msoft-float -MD -Os +KBUILD_CFLAGS += -m$(CONFIG_WORD_SIZE) + +$(obj)/purgatory.ro: $(PURGATORY_OBJS) FORCE + $(call if_changed,ld) + +targets += kexec-purgatory.c + +CMD_BIN2C = $(objtree)/scripts/basic/bin2c +quiet_cmd_bin2c = BIN2C $@ + cmd_bin2c = $(CMD_BIN2C) kexec_purgatory < $< > $@ + +$(obj)/kexec-purgatory.c: $(obj)/purgatory.ro FORCE + $(call if_changed,bin2c) + @: + + +obj-$(CONFIG_KEXEC_FILE) += kexec-purgatory.o diff --git a/arch/powerpc/purgatory/console-ppc64.c b/arch/powerpc/purgatory/console-ppc64.c new file mode 100644 index ..a52e043b4813 --- /dev/null +++ b/arch/powerpc/purgatory/console-ppc64.c @@ -0,0 +1,43 @@ +/* + * kexec: Linux boots Linux + * + * Created by: Mohan Kumar M (mo...@in.ibm.com) + * + * Copyright (C) IBM Corporation, 2005. All rights reserved + * + * Code taken from kexec-tools. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation (version 2 of the License). + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR
[PATCH 7/8] powerpc: Add support for loading ELF kernels with kexec_file_load.
This uses all the infrastructure built up by the previous patches in the series to load an ELF vmlinux file and an initrd. It uses the flattened device tree at initial_boot_params as a base and adjusts memory reservations and its /chosen node for the next kernel. Cc: ke...@lists.infradead.org Cc: linux-kernel@vger.kernel.org --- arch/powerpc/include/asm/kexec_elf_64.h | 10 + arch/powerpc/kernel/Makefile| 1 + arch/powerpc/kernel/kexec_elf_64.c | 564 arch/powerpc/kernel/machine_kexec_64.c | 5 +- 4 files changed, 579 insertions(+), 1 deletion(-) diff --git a/arch/powerpc/include/asm/kexec_elf_64.h b/arch/powerpc/include/asm/kexec_elf_64.h new file mode 100644 index ..30da6bc0ccf8 --- /dev/null +++ b/arch/powerpc/include/asm/kexec_elf_64.h @@ -0,0 +1,10 @@ +#ifndef __POWERPC_KEXEC_ELF_64_H__ +#define __POWERPC_KEXEC_ELF_64_H__ + +#ifdef CONFIG_KEXEC_FILE + +extern struct kexec_file_ops kexec_elf64_ops; + +#endif /* CONFIG_KEXEC_FILE */ + +#endif /* __POWERPC_KEXEC_ELF_64_H__ */ diff --git a/arch/powerpc/kernel/Makefile b/arch/powerpc/kernel/Makefile index c937b8074464..b89a2ae1b2a0 100644 --- a/arch/powerpc/kernel/Makefile +++ b/arch/powerpc/kernel/Makefile @@ -110,6 +110,7 @@ obj-$(CONFIG_PCI) += pci_$(CONFIG_WORD_SIZE).o $(pci64-y) \ obj-$(CONFIG_PCI_MSI) += msi.o obj-$(CONFIG_KEXEC)+= machine_kexec.o crash.o \ machine_kexec_$(CONFIG_WORD_SIZE).o +obj-$(CONFIG_KEXEC_FILE) += kexec_elf_$(CONFIG_WORD_SIZE).o obj-$(CONFIG_AUDIT)+= audit.o obj64-$(CONFIG_AUDIT) += compat_audit.o diff --git a/arch/powerpc/kernel/kexec_elf_64.c b/arch/powerpc/kernel/kexec_elf_64.c new file mode 100644 index ..4e71595300ed --- /dev/null +++ b/arch/powerpc/kernel/kexec_elf_64.c @@ -0,0 +1,564 @@ +/* + * Load ELF vmlinux file for the kexec_file_load syscall. + * + * Copyright (C) 2004 Adam Litke (a...@us.ibm.com) + * Copyright (C) 2004 IBM Corp. + * Copyright (C) 2005 R Sharada (shar...@in.ibm.com) + * Copyright (C) 2006 Mohan Kumar M (mo...@in.ibm.com) + * Copyright (C) 2016 IBM Corporation + * + * Based on kexec-tools' kexec-elf-exec.c and kexec-elf-ppc64.c. + * Heavily modified for the kernel by + * Thiago Jung Bauermann . + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation (version 2 of the License). + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#define pr_fmt(fmt)"kexec_elf: " fmt + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +extern size_t kexec_purgatory_size; + +#define PURGATORY_STACK_SIZE (16 * 1024) +#define SLAVE_CODE_SIZE256 + +/** + * build_elf_exec_info - read ELF executable and check that we can use it + */ +static int build_elf_exec_info(const char *buf, size_t len, struct elfhdr *ehdr, + struct elf_info *elf_info) +{ + int i; + int ret; + + ret = elf_read_from_buffer(buf, len, ehdr, elf_info); + if (ret) + return ret; + + if (ehdr->e_type != ET_EXEC) { + pr_err("Not an ELF executable.\n"); + goto error; + } else if (!elf_info->proghdrs) { + pr_err("No ELF program header.\n"); + goto error; + } + + for (i = 0; i < ehdr->e_phnum; i++) { + /* +* Kexec does not support loading interpreters. +* In addition this check keeps us from attempting +* to kexec ordinay executables. +*/ + if (elf_info->proghdrs[i].p_type == PT_INTERP) { + pr_err("Requires an ELF interpreter.\n"); + goto error; + } + } + + return 0; +error: + elf_free_info(elf_info); + return -ENOEXEC; +} + +static int elf64_probe(const char *buf, unsigned long len) +{ + struct elfhdr ehdr; + struct elf_info elf_info; + int ret; + + ret = build_elf_exec_info(buf, len, &ehdr, &elf_info); + if (ret) + return ret; + + elf_free_info(&elf_info); + + return elf_check_arch(&ehdr)? 0 : -ENOEXEC; +} + +static bool find_debug_console(void *fdt, int chosen_node) +{ + int len; + int console_node; + const void *prop, *colon; + + prop = fdt_getprop(fdt, chosen_node, "stdout-path"
[PATCH 2/8] kexec_file: Generalize kexec_add_buffer.
Allow architectures to specify different memory walking functions for kexec_add_buffer. Intel uses iomem to track reserved memory ranges, but PowerPC uses the memblock subsystem. Also, factor kexec_locate_mem_hole out of kexec_add_buffer. It will be used by the PowerPC kexec_file_load implementation to find free memory for the purgatory stack. Cc: Eric Biederman Cc: ke...@lists.infradead.org Cc: linux-kernel@vger.kernel.org --- include/linux/kexec.h | 10 ++ kernel/kexec_file.c | 96 +-- 2 files changed, 81 insertions(+), 25 deletions(-) diff --git a/include/linux/kexec.h b/include/linux/kexec.h index e8acb2b43dd9..920e2cbe5bdd 100644 --- a/include/linux/kexec.h +++ b/include/linux/kexec.h @@ -210,6 +210,10 @@ extern asmlinkage long sys_kexec_load(unsigned long entry, struct kexec_segment __user *segments, unsigned long flags); extern int kernel_kexec(void); +int kexec_locate_mem_hole(struct kimage *image, unsigned long size, + unsigned long align, unsigned long start, + unsigned long end, bool top_down, + unsigned long *addr); extern int kexec_add_buffer(struct kimage *image, char *buffer, unsigned long bufsz, unsigned long memsz, unsigned long buf_align, unsigned long buf_min, @@ -315,6 +319,12 @@ int __weak arch_kexec_apply_relocations_add(const Elf_Ehdr *ehdr, Elf_Shdr *sechdrs, unsigned int relsec); int __weak arch_kexec_apply_relocations(const Elf_Ehdr *ehdr, Elf_Shdr *sechdrs, unsigned int relsec); +int __weak arch_walk_iomem(unsigned long desc, unsigned long start, + unsigned long end, bool top_down, void *data, + int (*func)(u64, u64, void *)); +int __weak arch_walk_system_ram(unsigned long start, unsigned long end, + bool top_down, void *data, + int (*func)(u64, u64, void *)); void arch_kexec_protect_crashkres(void); void arch_kexec_unprotect_crashkres(void); diff --git a/kernel/kexec_file.c b/kernel/kexec_file.c index b6eec7527e9f..300f71cb4f72 100644 --- a/kernel/kexec_file.c +++ b/kernel/kexec_file.c @@ -428,6 +428,68 @@ static int locate_mem_hole_callback(u64 start, u64 end, void *arg) return locate_mem_hole_bottom_up(start, end, kbuf); } +int __weak arch_walk_iomem(unsigned long desc, unsigned long start, + unsigned long end, bool top_down, void *data, + int (*func)(u64, u64, void *)) +{ + return walk_iomem_res_desc(desc, + IORESOURCE_SYSTEM_RAM | IORESOURCE_BUSY, + start, end, data, func); +} + +int __weak arch_walk_system_ram(unsigned long start, unsigned long end, + bool top_down, void *data, + int (*func)(u64, u64, void *)) +{ + return walk_system_ram_res(start, end, data, func); +} + +/** + * kexec_locate_mem_hole - find free memory to load segment or use in purgatory + * @image: kexec image being updated. + * @size: Memory size. + * @align: Minimum alignment needed. + * @start: Minimum starting address. + * @end: Maximum end address. + * @top_down Find the highest free memory region? + * @addr On success, will have start address of the memory region found. + * + * Return: 0 on success, negative erro on failure. + */ +int kexec_locate_mem_hole(struct kimage *image, unsigned long size, + unsigned long align, unsigned long start, + unsigned long end, bool top_down, unsigned long *addr) +{ + int ret; + struct kexec_buf buf; + + memset(&buf, 0, sizeof(struct kexec_buf)); + buf.image = image; + + buf.memsz = size; + buf.buf_align = align; + buf.buf_min = start; + buf.buf_max = end; + buf.top_down = top_down; + + /* Walk the RAM ranges and allocate a suitable range for the buffer */ + if (image->type == KEXEC_TYPE_CRASH) + ret = arch_walk_iomem(crashk_res.desc, crashk_res.start, + crashk_res.end, top_down, &buf, + locate_mem_hole_callback); + else + ret = arch_walk_system_ram(0, -1, top_down, &buf, + locate_mem_hole_callback); + if (ret != 1) { + /* A suitable memory range could not be found for buffer */ + return -EADDRNOTAVAIL; + } + + *addr = buf.mem; + + return 0; +} + /* * Helper function for placing a buffer in a kexec segment. This assumes * that kexec_mutex is held. @@ -439,8 +501,8 @@ int
[PATCH 4/8] powerpc: Generalize elf64_apply_relocate_add.
When apply_relocate_add is called, modules are already loaded at their final location in memory so Elf64_Shdr.sh_addr can be used for accessing the section contents as well as the base address for relocations. This is not the case for kexec's purgatory, because it will only be copied to its final location right before being executed. Therefore, it needs to be relocated while it is still in a temporary buffer. In this case, Elf64_Shdr.sh_addr can't be used to access the sections' contents. This patch allows elf64_apply_relocate_add to be used when the ELF binary is not yet at its final location by adding an addr_base argument to specify the address at which the section will be loaded, and rela, loc_base and syms_base to point to the sections' contents. Cc: Benjamin Herrenschmidt Cc: Paul Mackerras Cc: Michael Ellerman Cc: Torsten Duwe Cc: ke...@lists.infradead.org Cc: linux-kernel@vger.kernel.org --- arch/powerpc/include/asm/elf_util.h | 6 ++-- arch/powerpc/kernel/elf_util_64.c | 63 + arch/powerpc/kernel/module_64.c | 17 -- 3 files changed, 61 insertions(+), 25 deletions(-) diff --git a/arch/powerpc/include/asm/elf_util.h b/arch/powerpc/include/asm/elf_util.h index 13d3ca113299..19ff3335d17d 100644 --- a/arch/powerpc/include/asm/elf_util.h +++ b/arch/powerpc/include/asm/elf_util.h @@ -64,7 +64,9 @@ static inline unsigned long my_r2(const struct elf_info *elf_info) } int elf64_apply_relocate_add(const struct elf_info *elf_info, -const char *strtab, unsigned int symindex, -unsigned int relsec, const char *obj_name); +const char *strtab, const Elf64_Rela *rela, +unsigned int num_rela, void *syms_base, +void *loc_base, Elf64_Addr addr_base, +const char *obj_name); #endif /* _ASM_POWERPC_ELF_UTIL_H */ diff --git a/arch/powerpc/kernel/elf_util_64.c b/arch/powerpc/kernel/elf_util_64.c index b53b3959a605..cde0420add9e 100644 --- a/arch/powerpc/kernel/elf_util_64.c +++ b/arch/powerpc/kernel/elf_util_64.c @@ -69,33 +69,56 @@ static void squash_toc_save_inst(const char *name, unsigned long addr) { } * elf64_apply_relocate_add - apply 64 bit RELA relocations * @elf_info: Support information for the ELF binary being relocated. * @strtab:String table for the associated symbol table. - * @symindex: Section header index for the associated symbol table. - * @relsec:Section header index for the relocations to apply. + * @rela: Contents of the section with the relocations to apply. + * @num_rela: Number of relocation entries in the section. + * @syms_base: Contents of the associated symbol table. + * @loc_base: Contents of the section to which relocations apply. + * @addr_base: The address where the section will be loaded in memory. * @obj_name: The name of the ELF binary, for information messages. + * + * Applies RELA relocations to an ELF file already at its final location + * in memory (in which case loc_base == addr_base), or still in a temporary + * buffer. */ int elf64_apply_relocate_add(const struct elf_info *elf_info, -const char *strtab, unsigned int symindex, -unsigned int relsec, const char *obj_name) +const char *strtab, const Elf64_Rela *rela, +unsigned int num_rela, void *syms_base, +void *loc_base, Elf64_Addr addr_base, +const char *obj_name) { unsigned int i; - Elf64_Shdr *sechdrs = elf_info->sechdrs; - Elf64_Rela *rela = (void *)sechdrs[relsec].sh_addr; - Elf64_Sym *sym; unsigned long *location; + unsigned long address; unsigned long value; + const char *name; + Elf64_Sym *sym; + + for (i = 0; i < num_rela; i++) { + /* +* rels[i].r_offset contains the byte offset from the beginning +* of section to the storage unit affected. +* +* This is the location to update in the temporary buffer where +* the section is currently loaded. The section will finally +* be loaded to a different address later, pointed to by +* addr_base. +*/ + location = loc_base + rela[i].r_offset; + + /* Final address of the location. */ + address = addr_base + rela[i].r_offset; + /* This is the symbol the relocation is referring to. */ + sym = (Elf64_Sym *) syms_base + ELF64_R_SYM(rela[i].r_info); - for (i = 0; i < sechdrs[relsec].sh_size / sizeof(*rela); i++) { - /* This is where to make the change */ - location = (void
[PATCH 0/8] kexec_file_load implementation for PowerPC
Hello, This patch series implements the kexec_file_load system call on PowerPC. It starts by removing an x86 assumption from kexec_file: kexec_add_buffer uses iomem to find reserved memory ranges, but PowerPC uses the memblock subsystem. Hooks are added so that each arch can specify how memory ranges can be found. Also, the memory-walking logic in kexec_add_buffer is useful in this implementation to find a free area for the purgatory's stack, so that same patch moves that logic to kexec_locate_mem_hole. The kexec_file_load system call needs to apply relocations to the purgatory but adding code for that would duplicate functionality with the module loading mechanism, which also needs to apply relocations to the kernel modules. Therefore, this patch series factors out the module relocation code so that it can be shared. One thing that is still missing is crashkernel support, which I intend to submit shortly. This code is based on kexec-tools, but with many modifications to adapt it to the kernel environment and facilities. Except the purgatory, which only has minimal changes. Thiago Jung Bauermann (8): kexec_file: Remove unused members from struct kexec_buf. kexec_file: Generalize kexec_add_buffer. powerpc: Factor out relocation code from module_64.c to elf_util_64.c. powerpc: Generalize elf64_apply_relocate_add. powerpc: Add functions to read ELF files of any endianness. powerpc: Implement kexec_file_load. powerpc: Add support for loading ELF kernels with kexec_file_load. powerpc: Add purgatory for kexec_file_load implementation. arch/powerpc/Kconfig | 13 + arch/powerpc/Makefile | 4 + arch/powerpc/include/asm/elf_util.h | 92 + arch/powerpc/include/asm/kexec_elf_64.h | 10 + arch/powerpc/include/asm/module.h | 14 +- arch/powerpc/include/asm/systbl.h | 1 + arch/powerpc/include/asm/unistd.h | 2 +- arch/powerpc/include/uapi/asm/unistd.h| 1 + arch/powerpc/kernel/Makefile | 7 + arch/powerpc/kernel/elf_util.c| 476 + arch/powerpc/kernel/elf_util_64.c | 373 arch/powerpc/kernel/kexec_elf_64.c| 564 ++ arch/powerpc/kernel/machine_kexec_64.c| 142 arch/powerpc/kernel/module_64.c | 328 +++-- arch/powerpc/purgatory/.gitignore | 2 + arch/powerpc/purgatory/Makefile | 36 ++ arch/powerpc/purgatory/console-ppc64.c| 43 +++ arch/powerpc/purgatory/crashdump-ppc64.h | 42 +++ arch/powerpc/purgatory/crashdump_backup.c | 40 +++ arch/powerpc/purgatory/crtsavres.S| 5 + arch/powerpc/purgatory/hvCall.S | 27 ++ arch/powerpc/purgatory/hvCall.h | 8 + arch/powerpc/purgatory/kexec-sha256.h | 11 + arch/powerpc/purgatory/ppc64_asm.h| 18 + arch/powerpc/purgatory/printf.c | 171 + arch/powerpc/purgatory/purgatory-ppc64.c | 46 +++ arch/powerpc/purgatory/purgatory-ppc64.h | 6 + arch/powerpc/purgatory/purgatory.c| 66 arch/powerpc/purgatory/purgatory.h| 11 + arch/powerpc/purgatory/sha256.c | 6 + arch/powerpc/purgatory/sha256.h | 1 + arch/powerpc/purgatory/string.S | 1 + arch/powerpc/purgatory/v2wrap.S | 139 include/linux/kexec.h | 10 + kernel/kexec_file.c | 102 -- kernel/kexec_internal.h | 2 - 36 files changed, 2504 insertions(+), 316 deletions(-) create mode 100644 arch/powerpc/include/asm/elf_util.h create mode 100644 arch/powerpc/include/asm/kexec_elf_64.h create mode 100644 arch/powerpc/kernel/elf_util.c create mode 100644 arch/powerpc/kernel/elf_util_64.c create mode 100644 arch/powerpc/kernel/kexec_elf_64.c create mode 100644 arch/powerpc/purgatory/.gitignore create mode 100644 arch/powerpc/purgatory/Makefile create mode 100644 arch/powerpc/purgatory/console-ppc64.c create mode 100644 arch/powerpc/purgatory/crashdump-ppc64.h create mode 100644 arch/powerpc/purgatory/crashdump_backup.c create mode 100644 arch/powerpc/purgatory/crtsavres.S create mode 100644 arch/powerpc/purgatory/hvCall.S create mode 100644 arch/powerpc/purgatory/hvCall.h create mode 100644 arch/powerpc/purgatory/kexec-sha256.h create mode 100644 arch/powerpc/purgatory/ppc64_asm.h create mode 100644 arch/powerpc/purgatory/printf.c create mode 100644 arch/powerpc/purgatory/purgatory-ppc64.c create mode 100644 arch/powerpc/purgatory/purgatory-ppc64.h create mode 100644 arch/powerpc/purgatory/purgatory.c create mode 100644 arch/powerpc/purgatory/purgatory.h create mode 100644 arch/powerpc/purgatory/sha256.c create mode 100644 arch/powerpc/purgatory/sha256.h create mode 100644 arch/powerpc/purgatory/string.S create mode 100644 arch/powerpc/purgatory/v2wrap.S -- 1.9.1
Re: [PATCH v4 2/2] [media] atmel-isc: DT binding for Image Sensor Controller driver
On 6/9/2016 05:57, Boris Brezillon wrote: On Tue, 7 Jun 2016 15:11:53 +0800 Songjun Wu wrote: DT binding documentation for ISC driver. Signed-off-by: Songjun Wu --- Changes in v4: - Remove the isc clock nodes. Changes in v3: - Remove the 'atmel,sensor-preferred'. - Modify the isc clock node according to the Rob's remarks. Changes in v2: - Remove the unit address of the endpoint. - Add the unit address to the clock node. - Avoid using underscores in node names. - Drop the "0x" in the unit address of the i2c node. - Modify the description of 'atmel,sensor-preferred'. - Add the description for the ISC internal clock. .../devicetree/bindings/media/atmel-isc.txt| 69 ++ 1 file changed, 69 insertions(+) create mode 100644 Documentation/devicetree/bindings/media/atmel-isc.txt diff --git a/Documentation/devicetree/bindings/media/atmel-isc.txt b/Documentation/devicetree/bindings/media/atmel-isc.txt new file mode 100644 index 000..3f83524 --- /dev/null +++ b/Documentation/devicetree/bindings/media/atmel-isc.txt @@ -0,0 +1,69 @@ +Atmel Image Sensor Controller (ISC) +-- + +Required properties for ISC: +- compatible + Must be "atmel,sama5d2-isc". +- reg + Physical base address and length of the registers set for the device. +- interrupts + Should contain IRQ line for the ISC. +- clocks + List of clock specifiers, corresponding to entries in + the clock-names property; + Please refer to clock-bindings.txt. +- clock-names + Required elements: "hclock". +- #clock-cells + Should be 0. +- clock-output-names + Should contain the name of the clock driving the sensor master clock. +- pinctrl-names, pinctrl-0 + Please refer to pinctrl-bindings.txt. + + +ISC supports a single port node with parallel bus. It should contain one +'port' child node with child 'endpoint' node. Please refer to the bindings +defined in Documentation/devicetree/bindings/media/video-interfaces.txt. + +Example: +isc: isc@f0008000 { + compatible = "atmel,sama5d2-isc"; + reg = <0xf0008000 0x4000>; + interrupts = <46 IRQ_TYPE_LEVEL_HIGH 5>; + clocks = <&isc_clk>, <&iscck>, <&isc_gclk>; + clock-names = "hclock"; You have 3 clocks here and only one name. Are you sure this example is actually working? The isc_clk is mandatory, but the other two clocks are optional, so I did not give their name. This example is tested. Should I add the name for the other two clocks? + #clock-cells = <0>; + clock-output-names = "isc-mck"; + + port { + #address-cells = <1>; + #size-cells = <0>; + + isc_0: endpoint { + remote-endpoint = <&ov7740_0>; + hsync-active = <1>; + vsync-active = <0>; + pclk-sample = <1>; + }; + }; + + +}; + +i2c1: i2c@fc028000 { + ov7740: camera@21 { + compatible = "ovti,ov7740"; + reg = <0x21>; + + clocks = <&isc>; + clock-names = "xvclk"; + assigned-clocks = <&isc>; + assigned-clock-rates = <2400>; + + port { + ov7740_0: endpoint { + remote-endpoint = <&isc_0>; + }; + }; +};
Re: [Qemu-devel] [RFC PATCH 0/3] x86: Add support for guest DMA dirty page tracking
Hi, Alex On 2016/6/9 23:39, Alexander Duyck wrote: On Thu, Jun 9, 2016 at 3:14 AM, Zhou Jie wrote: TO Alex TO Michael In your solution you add a emulate PCI bridge to act as a bridge between direct assigned devices and the host bridge. Do you mean put all direct assigned devices to one emulate PCI bridge? If yes, this maybe bring some problems. We are writing a patchset to support aer feature in qemu. When assigning a vfio device with AER enabled, we must check whether the device supports a host bus reset (ie. hot reset) as this may be used by the guest OS in order to recover the device from an AER error. QEMU must therefore have the ability to perform a physical host bus reset using the existing vfio APIs in response to a virtual bus reset in the VM. A physical bus reset affects all of the devices on the host bus. Therefore all physical devices affected by a bus reset must be configured on the same virtual bus in the VM. And no devices unaffected by the bus reset, be configured on the same virtual bus. http://lists.nongnu.org/archive/html/qemu-devel/2016-05/msg02989.html Sincerely, Zhou Jie That makes sense, but I don't think you have to worry much about this at this point at least on my side as this was mostly just theory and I haven't had a chance to put any of it into practice as of yet. My idea has been evolving on this for a while. One thought I had is that we may want to have something like an emulated IOMMU and if possible we would want to split it up over multiple domains just so we can be certain that the virtual interfaces and the physical ones existed in separate domains. In regards to your concerns perhaps what we could do is put each assigned device into its own domain to prevent them from affecting each other. To that end we could probably break things up so that each device effectively lives in its own PCIe slot in the emulated system. Then when we start a migration of the guest the assigned device domains would then have to be tracked for unmap and sync calls when the direction is from the device. I will keep your concerns in mind in the future when I get some time to look at exploring this solution further. - Alex I am thinking about the practice of migration of passthrough device. In your solution, you use a vendor specific configuration space to negotiate with guest. If you put each assigned device into its own domain, how can qemu negotiate with guest? Add the vendor specific configuration space to every pci bus which is assigned a passthrough device? Sincerely Zhou Jie
Re: [PATCH v2 1/2] mfd: ti-smusbdig: Add support for the TI SM-USB-DIG
Hi, [auto build test ERROR on ljones-mfd/for-mfd-next] [also build test ERROR on v4.7-rc2 next-20160609] [if your patch is applied to the wrong git tree, please drop us a note to help improve the system] url: https://github.com/0day-ci/linux/commits/Andrew-F-Davis/mfd-ti-smusbdig-Add-support-for-the-TI-SM-USB-DIG/20160611-012112 base: https://git.kernel.org/pub/scm/linux/kernel/git/lee/mfd.git for-mfd-next config: i386-randconfig-x012-06120748 (attached as .config) compiler: gcc-6 (Debian 6.1.1-1) 6.1.1 20160430 reproduce: # save the attached .config to linux build tree make ARCH=i386 All errors (new ones prefixed by >>): drivers/built-in.o: In function `ti_smusbdig_xfer': >> (.text+0x3053eb): undefined reference to `usb_interrupt_msg' drivers/built-in.o: In function `ti_smusbdig_xfer': (.text+0x305416): undefined reference to `usb_interrupt_msg' drivers/built-in.o: In function `ti_smusbdig_probe': >> ti-smusbdig.c:(.text+0x3054ac): undefined reference to `usb_get_dev' drivers/built-in.o: In function `ti_smusbdig_driver_init': >> ti-smusbdig.c:(.init.text+0xaf15): undefined reference to >> `usb_register_driver' drivers/built-in.o: In function `ti_smusbdig_driver_exit': >> ti-smusbdig.c:(.exit.text+0x13fc): undefined reference to `usb_deregister' --- 0-DAY kernel test infrastructureOpen Source Technology Center https://lists.01.org/pipermail/kbuild-all Intel Corporation .config.gz Description: Binary data
[PATCH 3/3] befs: remove unused functions
befs_iaddr_is_empty() and befs_brun_size() are unused. Removing them. Signed-off-by: Luis de Bethencourt --- fs/befs/befs.h | 12 1 file changed, 12 deletions(-) diff --git a/fs/befs/befs.h b/fs/befs/befs.h index e0f59263a..c5c6cd1 100644 --- a/fs/befs/befs.h +++ b/fs/befs/befs.h @@ -140,18 +140,6 @@ befs_iaddrs_per_block(struct super_block *sb) return BEFS_SB(sb)->block_size / sizeof (befs_disk_inode_addr); } -static inline int -befs_iaddr_is_empty(const befs_inode_addr *iaddr) -{ - return (!iaddr->allocation_group) && (!iaddr->start) && (!iaddr->len); -} - -static inline size_t -befs_brun_size(struct super_block *sb, befs_block_run run) -{ - return BEFS_SB(sb)->block_size * run.len; -} - #include "endian.h" #endif /* _LINUX_BEFS_H */ -- 2.5.1
[PATCH v3 6/6] drm/panel: simple: Add support for Sharp LQ123P1JX31 2400x1600 panel
The Sharp LQ123P1JX31 is an 12.3", 2400x1600 TFT-LCD panel connected using eDP interfaces. Signed-off-by: Yakir Yang Reviewed-by: Doug Anderson Tested-by: Doug Anderson --- Changes in v3: - Correct the size of panel_desc to active area 259mmx173mm (Doug) - Add the reviewed/tested flag from Doug Changes in v2: - Add detail timing of Sharp LQ123P1JX31 panel in v2 drivers/gpu/drm/panel/panel-simple.c | 26 ++ 1 file changed, 26 insertions(+) diff --git a/drivers/gpu/drm/panel/panel-simple.c b/drivers/gpu/drm/panel/panel-simple.c index 17cc973..412746b 100644 --- a/drivers/gpu/drm/panel/panel-simple.c +++ b/drivers/gpu/drm/panel/panel-simple.c @@ -1314,6 +1314,29 @@ static const struct panel_desc samsung_ltn140at29_301 = { }, }; +static const struct drm_display_mode sharp_lq123p1jx31_mode = { + .clock = 252750, + .hdisplay = 2400, + .hsync_start = 2400 + 48, + .hsync_end = 2400 + 48 + 32, + .htotal = 2400 + 48 + 32 + 80, + .vdisplay = 1600, + .vsync_start = 1600 + 3, + .vsync_end = 1600 + 3 + 10, + .vtotal = 1600 + 3 + 10 + 33, + .vrefresh = 60, + .flags = DRM_MODE_FLAG_NVSYNC | DRM_MODE_FLAG_NHSYNC, +}; + +static const struct panel_desc sharp_lq123p1jx31 = { + .modes = &sharp_lq123p1jx31_mode, + .num_modes = 1, + .size = { + .width = 259, + .height = 173, + }, +}; + static const struct drm_display_mode shelly_sca07010_bfn_lnn_mode = { .clock = 33300, .hdisplay = 800, @@ -1537,6 +1560,9 @@ static const struct of_device_id platform_of_match[] = { .compatible = "samsung,ltn140at29-301", .data = &samsung_ltn140at29_301, }, { + .compatible = "sharp,lq123p1jx31", + .data = &sharp_lq123p1jx31, + }, { .compatible = "shelly,sca07010-bfn-lnn", .data = &shelly_sca07010_bfn_lnn, }, { -- 1.9.1
[PATCH v3 5/6] dt-bindings: add Sharp LQ123P1JX31 panel binding
The Sharp LQ123P1JX31 is an 12.3" 2400x1600 TFT-LCD panel connected using eDP interfaces. Signed-off-by: Yakir Yang Reviewed-by: Douglas Anderson --- Changes in v3: - Drop the extra comma in compatible name (Rob) - Add the reviewed flag from Doug Changes in v2: - Add dt-bindings of Sharp LQ123P1JX31 panel in v2 .../devicetree/bindings/display/panel/sharp,lq123p1jx31.txt| 7 +++ 1 file changed, 7 insertions(+) create mode 100644 Documentation/devicetree/bindings/display/panel/sharp,lq123p1jx31.txt diff --git a/Documentation/devicetree/bindings/display/panel/sharp,lq123p1jx31.txt b/Documentation/devicetree/bindings/display/panel/sharp,lq123p1jx31.txt new file mode 100644 index 000..bcb0e8a --- /dev/null +++ b/Documentation/devicetree/bindings/display/panel/sharp,lq123p1jx31.txt @@ -0,0 +1,7 @@ +Sharp 12.3" (2400x1600 pixels) TFT LCD panel + +Required properties: +- compatible: should be "sharp,lq123p1jx31" + +This binding is compatible with the simple-panel binding, which is specified +in simple-panel.txt in this directory. -- 1.9.1
[PATCH 1/3] befs: check return of sb_min_blocksize
Confirm sb_min_blocksize() succeeded before continuing. Signed-off-by: Luis de Bethencourt --- Hi, This is the main fix I wanted to send. I noticed other file systems check the return of sb_min_blocksize(), it can fail so it is worth checking before continuing. Thanks :) Luis fs/befs/linuxvfs.c | 7 ++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/fs/befs/linuxvfs.c b/fs/befs/linuxvfs.c index c734f21..453bb68 100644 --- a/fs/befs/linuxvfs.c +++ b/fs/befs/linuxvfs.c @@ -756,6 +756,7 @@ befs_fill_super(struct super_block *sb, void *data, int silent) long ret = -EINVAL; const unsigned long sb_block = 0; const off_t x86_sb_off = 512; + int blocksize; save_mount_options(sb, data); @@ -788,7 +789,11 @@ befs_fill_super(struct super_block *sb, void *data, int silent) * least 1k to get the second 512 bytes of the volume. * -WD 10-26-01 */ - sb_min_blocksize(sb, 1024); + blocksize = sb_min_blocksize(sb, 1024); + if (!blocksize) { + befs_error(sb, "unable to set blocksize"); + goto unacquire_priv_sbp; + } if (!(bh = sb_bread(sb, sb_block))) { if (!silent) -- 2.5.1
[PATCH 2/3] befs: fix function name in documentation
Documentation of function befs_load_cb lists it as load_befs_sb. Fixing the misnomer. Signed-off-by: Luis de Bethencourt --- fs/befs/super.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/befs/super.c b/fs/befs/super.c index aeafc4d..9d1b56c 100644 --- a/fs/befs/super.c +++ b/fs/befs/super.c @@ -14,7 +14,7 @@ #include "super.h" /** - * load_befs_sb -- Read from disk and properly byteswap all the fields + * befs_load_sb -- Read from disk and properly byteswap all the fields * of the befs superblock * * -- 2.5.1
[PATCH v3 2/6] drm/panel: simple: Add support for LG LP097QX1-SPA1 2048x1536 panel
The LG LP097QX1-SPA1 is an 9.7", 2048x1536 (QXGA) TFT-LCD panel connected using eDP interfaces. Signed-off-by: Yakir Yang --- Changes in v3: - Correct the size of panel_desc to active area 208mmx147mm (Emil, Stéphane) - Sort the lg_lp097qx1_spa1 before lg_lp120up1 (Emil) Changes in v2: None drivers/gpu/drm/panel/panel-simple.c | 25 + 1 file changed, 25 insertions(+) diff --git a/drivers/gpu/drm/panel/panel-simple.c b/drivers/gpu/drm/panel/panel-simple.c index 3a7bdf1..2d40a21 100644 --- a/drivers/gpu/drm/panel/panel-simple.c +++ b/drivers/gpu/drm/panel/panel-simple.c @@ -1017,6 +1017,28 @@ static const struct panel_desc lg_lb070wv8 = { .bus_format = MEDIA_BUS_FMT_RGB888_1X7X4_SPWG, }; +static const struct drm_display_mode lg_lp097qx1_spa1_mode = { + .clock = 205210, + .hdisplay = 2048, + .hsync_start = 2048 + 150, + .hsync_end = 2048 + 150 + 5, + .htotal = 2048 + 150 + 5 + 5, + .vdisplay = 1536, + .vsync_start = 1536 + 3, + .vsync_end = 1536 + 3 + 1, + .vtotal = 1536 + 3 + 1 + 9, + .vrefresh = 60, +}; + +static const struct panel_desc lg_lp097qx1_spa1 = { + .modes = &lg_lp097qx1_spa1_mode, + .num_modes = 1, + .size = { + .width = 208, + .height = 147, + }, +}; + static const struct drm_display_mode lg_lp120up1_mode = { .clock = 162300, .hdisplay = 1920, @@ -1457,6 +1479,9 @@ static const struct of_device_id platform_of_match[] = { .compatible = "lg,lb070wv8", .data = &lg_lb070wv8, }, { + .compatible = "lg,lp097qx1-spa1", + .data = &lg_lp097qx1_spa1, + }, { .compatible = "lg,lp120up1", .data = &lg_lp120up1, }, { -- 1.9.1
[PATCH v3 3/6] dt-bindings: add Samsung LSN122DL01-C01 panel binding
The Samsung LSN122DL01-C01 is an 12.2" 2560x1600 (WQXGA) TFT-LCD panel connected using eDP interfaces. Signed-off-by: Yakir Yang Acked-by: Rob Herring --- Changes in v3: None Changes in v2: - Add Rob's acked for dt-bindings of Samsung LSN122DL01 panel .../devicetree/bindings/display/panel/samsung,lsn122dl01-c01.txt | 7 +++ 1 file changed, 7 insertions(+) create mode 100644 Documentation/devicetree/bindings/display/panel/samsung,lsn122dl01-c01.txt diff --git a/Documentation/devicetree/bindings/display/panel/samsung,lsn122dl01-c01.txt b/Documentation/devicetree/bindings/display/panel/samsung,lsn122dl01-c01.txt new file mode 100644 index 000..dba298b --- /dev/null +++ b/Documentation/devicetree/bindings/display/panel/samsung,lsn122dl01-c01.txt @@ -0,0 +1,7 @@ +Samsung 12.2" (2560x1600 pixels) TFT LCD panel + +Required properties: +- compatible: should be "samsung,lsn122dl01-c01" + +This binding is compatible with the simple-panel binding, which is specified +in simple-panel.txt in this directory. -- 1.9.1
[PATCH v3 4/6] drm/panel: simple: Add support for Samsung LSN122DL01-C01 2560x1600 panel
The Samsung LSN122DL01-C01 is an 12.2" 2560x1600 (WQXGA) TFT-LCD panel connected using eDP interfaces. Signed-off-by: Yakir Yang --- Changes in v3: - Correct the size of panel_desc to active area 262mmx164mm (Emil, Stéphane) Changes in v2: None drivers/gpu/drm/panel/panel-simple.c | 25 + 1 file changed, 25 insertions(+) diff --git a/drivers/gpu/drm/panel/panel-simple.c b/drivers/gpu/drm/panel/panel-simple.c index 2d40a21..17cc973 100644 --- a/drivers/gpu/drm/panel/panel-simple.c +++ b/drivers/gpu/drm/panel/panel-simple.c @@ -1246,6 +1246,28 @@ static const struct panel_desc qd43003c0_40 = { .bus_format = MEDIA_BUS_FMT_RGB888_1X24, }; +static const struct drm_display_mode samsung_lsn122dl01_c01_mode = { + .clock = 271560, + .hdisplay = 2560, + .hsync_start = 2560 + 48, + .hsync_end = 2560 + 48 + 32, + .htotal = 2560 + 48 + 32 + 80, + .vdisplay = 1600, + .vsync_start = 1600 + 2, + .vsync_end = 1600 + 2 + 5, + .vtotal = 1600 + 2 + 5 + 57, + .vrefresh = 60, +}; + +static const struct panel_desc samsung_lsn122dl01_c01 = { + .modes = &samsung_lsn122dl01_c01_mode, + .num_modes = 1, + .size = { + .width = 262, + .height = 164, + }, +}; + static const struct drm_display_mode samsung_ltn101nt05_mode = { .clock = 54030, .hdisplay = 1024, @@ -1506,6 +1528,9 @@ static const struct of_device_id platform_of_match[] = { .compatible = "qiaodian,qd43003c0-40", .data = &qd43003c0_40, }, { + .compatible = "samsung,lsn122dl01-c01", + .data = &samsung_lsn122dl01_c01, + }, { .compatible = "samsung,ltn101nt05", .data = &samsung_ltn101nt05, }, { -- 1.9.1
[PATCH v3 1/6] dt-bindings: add LG LP097QX1-SPA1 panel binding
The LG LP097QX1-SPA1 is an 9.7", 2048x1536 (QXGA) TFT-LCD panel connected using eDP interfaces. Signed-off-by: Yakir Yang Acked-by: Rob Herring --- Changes in v3: None Changes in v2: - Add Rob's acked for dt-bindings of LG LP097QX1-SPA1 panel .../devicetree/bindings/display/panel/lg,lp097qx1-spa1.txt | 7 +++ 1 file changed, 7 insertions(+) create mode 100644 Documentation/devicetree/bindings/display/panel/lg,lp097qx1-spa1.txt diff --git a/Documentation/devicetree/bindings/display/panel/lg,lp097qx1-spa1.txt b/Documentation/devicetree/bindings/display/panel/lg,lp097qx1-spa1.txt new file mode 100644 index 000..4214151 --- /dev/null +++ b/Documentation/devicetree/bindings/display/panel/lg,lp097qx1-spa1.txt @@ -0,0 +1,7 @@ +LG 9.7" (2048x1536 pixels) TFT LCD panel + +Required properties: +- compatible: should be "lg,lp097qx1-spa1" + +This binding is compatible with the simple-panel binding, which is specified +in simple-panel.txt in this directory. -- 1.9.1
Re: [PATCH] nfsd: Close a race between access checking/setting in nfs4_get_vfs_file
On Sat, 2016-06-11 at 22:06 -0400, Oleg Drokin wrote: > On Jun 11, 2016, at 9:33 PM, Jeff Layton wrote: > > > On Sat, 2016-06-11 at 11:41 -0400, Oleg Drokin wrote: > > > On Jun 10, 2016, at 4:55 PM, J . Bruce Fields wrote: > > > > > > > On Fri, Jun 10, 2016 at 06:50:33AM -0400, Jeff Layton wrote: > > > > > On Fri, 2016-06-10 at 00:18 -0400, Oleg Drokin wrote: > > > > > > On Jun 9, 2016, at 5:01 PM, Oleg Drokin wrote: > > > > > > > > > > > > > Currently there's an unprotected access mode check in > > > > > > > nfs4_upgrade_open > > > > > > > that then calls nfs4_get_vfs_file which in turn assumes whatever > > > > > > > access mode was present in the state is still valid which is racy. > > > > > > > Two nfs4_get_vfs_file van enter the same path as result and get > > > > > > > two > > > > > > > references to nfs4_file, but later drop would only happens once > > > > > > > because > > > > > > > access mode is only denoted by bits, so no refcounting. > > > > > > > > > > > > > > The locking around access mode testing is introduced to avoid this > > > > > > > race. > > > > > > > > > > > > > > Signed-off-by: Oleg Drokin > > > > > > > --- > > > > > > > > > > > > > > This patch performs equally well to the st_rwsem -> mutex > > > > > > > conversion, > > > > > > > but is a bit ligher-weight I imagine. > > > > > > > For one it seems to allow truncates in parallel if we ever want > > > > > > > it. > > > > > > > > > > > > > > fs/nfsd/nfs4state.c | 28 +--- > > > > > > > 1 file changed, 25 insertions(+), 3 deletions(-) > > > > > > > > > > > > > > diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c > > > > > > > index f5f82e1..d4b9eba 100644 > > > > > > > --- a/fs/nfsd/nfs4state.c > > > > > > > +++ b/fs/nfsd/nfs4state.c > > > > > > > @@ -3958,6 +3958,11 @@ static __be32 nfs4_get_vfs_file(struct > > > > > > > svc_rqst *rqstp, struct nfs4_file *fp, > > > > > > > > > > > > > > spin_lock(&fp->fi_lock); > > > > > > > > > > > > > > + if (test_access(open->op_share_access, stp)) { > > > > > > > + spin_unlock(&fp->fi_lock); > > > > > > > + return nfserr_eagain; > > > > > > > + } > > > > > > > + > > > > > > > /* > > > > > > >* Are we trying to set a deny mode that would conflict with > > > > > > >* current access? > > > > > > > @@ -4017,11 +4022,21 @@ nfs4_upgrade_open(struct svc_rqst *rqstp, > > > > > > > struct nfs4_file *fp, struct svc_fh *c > > > > > > > __be32 status; > > > > > > > unsigned char old_deny_bmap = stp->st_deny_bmap; > > > > > > > > > > > > > > - if (!test_access(open->op_share_access, stp)) > > > > > > > - return nfs4_get_vfs_file(rqstp, fp, cur_fh, stp, > > > > > > > open); > > > > > > > +again: > > > > > > > + spin_lock(&fp->fi_lock); > > > > > > > + if (!test_access(open->op_share_access, stp)) { > > > > > > > + spin_unlock(&fp->fi_lock); > > > > > > > + status = nfs4_get_vfs_file(rqstp, fp, cur_fh, stp, > > > > > > > open); > > > > > > > + /* > > > > > > > + * Somebody won the race for access while we did > > > > > > > not hold > > > > > > > + * the lock here > > > > > > > + */ > > > > > > > + if (status == nfserr_eagain) > > > > > > > + goto again; > > > > > > > + return status; > > > > > > > + } > > > > > > > > > > > > > > /* test and set deny mode */ > > > > > > > - spin_lock(&fp->fi_lock); > > > > > > > status = nfs4_file_check_deny(fp, open->op_share_deny); > > > > > > > if (status == nfs_ok) { > > > > > > > set_deny(open->op_share_deny, stp); > > > > > > > @@ -4361,6 +4376,13 @@ nfsd4_process_open2(struct svc_rqst *rqstp, > > > > > > > struct svc_fh *current_fh, struct nf > > > > > > > status = nfs4_get_vfs_file(rqstp, fp, current_fh, stp, > > > > > > > open); > > > > > > > if (status) { > > > > > > > up_read(&stp->st_rwsem); > > > > > > > + /* > > > > > > > + * EAGAIN is returned when there's a > > > > > > > racing access, > > > > > > > + * this should never happen as we are the > > > > > > > only user > > > > > > > + * of this new state, and since it's not > > > > > > > yet hashed, > > > > > > > + * nobody can find it > > > > > > > + */ > > > > > > > + WARN_ON(status == nfserr_eagain); > > > > > > > > > > > > Ok, some more testing shows that this CAN happen. > > > > > > So this patch is inferior to the mutex one after all. > > > > > > > > > > > > > > > > Yeah, that can happen for all sorts of reasons. As Andrew pointed out, > > > > > you can get this when there is a lease break in progress, and that may > > > > > be occurring for a completely different stateid (or because of samba, > > > > > etc...) > > > > > > > > > > It may be possible to do something like this, but we'd need to audit > > > > > all of the handling of st_access_bmap (and the deny bmap) to ensure > > >
arch/x86/kvm/svm.c:3866:10: error: implicit declaration of function '__default_cpu_present_to_apicid'
Hi, FYI, the error/warning still remains. tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master head: 8714f8f5fe396ca513ccaaac2304497439c181fb commit: 340d3bc3664e5d3fb922fe6e3ae2d901d4900d88 svm: Add interrupt injection via AVIC date: 3 weeks ago config: i386-randconfig-x0-06121009 (attached as .config) compiler: gcc-6 (Debian 6.1.1-1) 6.1.1 20160430 reproduce: git checkout 340d3bc3664e5d3fb922fe6e3ae2d901d4900d88 # save the attached .config to linux build tree make ARCH=i386 All errors (new ones prefixed by >>): arch/x86/kvm/svm.c: In function 'svm_deliver_avic_intr': >> arch/x86/kvm/svm.c:3866:10: error: implicit declaration of function >> '__default_cpu_present_to_apicid' [-Werror=implicit-function-declaration] __default_cpu_present_to_apicid(vcpu->cpu)); ^~~ At top level: arch/x86/kvm/svm.c:52:32: warning: 'svm_cpu_id' defined but not used [-Wunused-const-variable=] static const struct x86_cpu_id svm_cpu_id[] = { ^~ cc1: some warnings being treated as errors vim +/__default_cpu_present_to_apicid +3866 arch/x86/kvm/svm.c 3860 { 3861 kvm_lapic_set_irr(vec, vcpu->arch.apic); 3862 smp_mb__after_atomic(); 3863 3864 if (avic_vcpu_is_running(vcpu)) 3865 wrmsrl(SVM_AVIC_DOORBELL, > 3866 __default_cpu_present_to_apicid(vcpu->cpu)); 3867 else 3868 kvm_vcpu_wake_up(vcpu); 3869 } --- 0-DAY kernel test infrastructureOpen Source Technology Center https://lists.01.org/pipermail/kbuild-all Intel Corporation .config.gz Description: Binary data
Re: [PATCH 3/3] ARM: dts: imx7: add Toradex Colibri iMX7S/iMX7D support
On Tue, Jun 07, 2016 at 07:37:09PM -0700, Stefan Agner wrote: > +&lcdif { > + status = "okay"; > + display = <&display0>; Please put 'status' at the bottom of property list. > + > + display0: lcd-display { > + bits-per-pixel = <16>; > + bus-width = <18>; > + > + display-timings { > + native-mode = <&timing_vga>; > + > + /* Standard VGA timing */ > + timing_vga: 640x480 { > + clock-frequency = <25175000>; > + hactive = <640>; > + vactive = <480>; > + hback-porch = <40>; > + hfront-porch = <24>; > + vback-porch = <32>; > + vfront-porch = <11>; > + hsync-len = <96>; > + vsync-len = <2>; > + de-active = <1>; > + hsync-active = <0>; > + vsync-active = <0>; > + pixelclk-active = <0>; > + }; > + }; > + }; > +}; > +&usdhc1 { > + pinctrl-names = "default"; > + pinctrl-0 = <&pinctrl_usdhc1 &pinctrl_cd_usdhc1>; > + no-1-8-v; > + cd-gpios = <&gpio1 0 0>; Use the macro in include/dt-bindings/gpio/gpio.h. > + enable-sdio-wakeup; This is deprecated. Please use wakeup-source instead. > + fsl,tuning-step = <2>; > + keep-power-in-suspend; > + status = "okay"; > +}; > +&fec1 { > + pinctrl-names = "default"; > + pinctrl-0 = <&pinctrl_enet1>; > + clocks = <&clks IMX7D_ENET_AXI_ROOT_CLK>, > + <&clks IMX7D_ENET_AXI_ROOT_CLK>, > + <&clks IMX7D_ENET1_TIME_ROOT_CLK>, > + <&clks IMX7D_PLL_ENET_MAIN_50M_CLK>; > + clock-names = "ipg", "ahb", "ptp", "enet_clk_ref"; > + Drop this newline. > + assigned-clocks = <&clks IMX7D_ENET1_TIME_ROOT_SRC>, > + <&clks IMX7D_ENET1_TIME_ROOT_CLK>; > + assigned-clock-parents = <&clks IMX7D_PLL_ENET_MAIN_100M_CLK>; > + assigned-clock-rates = <0>, <1>; > + phy-mode = "rmii"; > + phy-supply = <®_LDO1>; > + fsl,magic-packet; > +}; > +&uart1 { > + pinctrl-names = "default"; > + pinctrl-0 = <&pinctrl_uart1 &pinctrl_uart1_ctrl1 &pinctrl_uart1_ctrl2>; > + assigned-clocks = <&clks IMX7D_UART1_ROOT_SRC>; > + assigned-clock-parents = <&clks IMX7D_OSC_24M_CLK>; > + fsl,uart-has-rtscts; Please use generic 'uart-has-rtscts' instead. > + fsl,dte-mode; > +}; > + > +&uart2 { > + pinctrl-names = "default"; > + pinctrl-0 = <&pinctrl_uart2>; > + assigned-clocks = <&clks IMX7D_UART2_ROOT_SRC>; > + assigned-clock-parents = <&clks IMX7D_OSC_24M_CLK>; > + fsl,uart-has-rtscts; Ditto > + fsl,dte-mode; > +}; > +/ { > + model = "Toradex Colibri iMX7D on Colibri Evaluation Board V3"; > + compatible = "toradex,colibri_imx7d-eval", "toradex,colibri_imx7d", \ We always use hyphen than underscore in compatible string. > + "fsl,imx7d"; > + > + reg_usb_otg2_vbus: regulator-usb-otg2-vbus { > + compatible = "regulator-fixed"; > + pinctrl-names = "default"; > + pinctrl-0 = <&pinctrl_usbotg2_reg>; > + regulator-name = "VCC_USB[1-4]"; > + regulator-min-microvolt = <500>; > + regulator-max-microvolt = <500>; > + gpio = <&gpio4 7 GPIO_ACTIVE_LOW>; > + }; > +}; > +/ { > + model = "Toradex Colibri iMX7S on Colibri Evaluation Board V3"; > + compatible = "toradex,colibri_imx7s-eval", "toradex,colibri_imx7s", \ > + "fsl,imx7s", "fsl,imx7d"; You may not want to have "fsl,imx7d" here. Otherwise, the detection between imx7s and imx7d colibri-eval-v3 board will be difficult. Shawn > +};
undefined reference to `printk'
Hi, FYI, the error/warning still remains. tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master head: 8714f8f5fe396ca513ccaaac2304497439c181fb commit: 5d2acfc7b974bbd3858b4dd3f2cdc6362dd8843a kconfig: make allnoconfig disable options behind EMBEDDED and EXPERT date: 2 years, 2 months ago config: m32r-allnoconfig (attached as .config) compiler: m32r-linux-gcc (GCC) 4.9.0 reproduce: wget https://git.kernel.org/cgit/linux/kernel/git/wfg/lkp-tests.git/plain/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross git checkout 5d2acfc7b974bbd3858b4dd3f2cdc6362dd8843a # save the attached .config to linux build tree make.cross ARCH=m32r All errors (new ones prefixed by >>): arch/m32r/kernel/built-in.o: In function `default_eit_handler': >> (.text+0x3f8): undefined reference to `printk' arch/m32r/kernel/built-in.o: In function `default_eit_handler': (.text+0x3f8): relocation truncated to fit: R_M32R_26_PCREL_RELA against undefined symbol `printk' --- 0-DAY kernel test infrastructureOpen Source Technology Center https://lists.01.org/pipermail/kbuild-all Intel Corporation .config.gz Description: Binary data
[lkp] [power_supply] 1235baeac8: thermal thermal_zone0: failed to read out thermal zone (-19)
FYI, we noticed the following commit: https://github.com/0day-ci/linux Rhyland-Klein/power_supply-power_supply_read_temp-only-if-use_cnt-0/20160610-053415 commit 1235baeac82d3113a7334f55a3fef160c5a4b983 ("power_supply: power_supply_read_temp only if use_cnt > 0") on test machine: vm-vp-quantal-x86_64: 2 threads qemu-system-x86_64 -enable-kvm with 360M memory caused below changes: [5.908066] __power_supply_register: Expected proper parent device for 'test_ac' [5.911184] __power_supply_register: Expected proper parent device for 'test_battery' [5.915462] thermal thermal_zone0: failed to read out thermal zone (-19) [5.917370] __power_supply_register: Expected proper parent device for 'test_usb' FYI, raw QEMU command line is: qemu-system-x86_64 -enable-kvm -kernel /pkg/linux/x86_64-randconfig-s3-06100451/gcc-6/1235baeac82d3113a7334f55a3fef160c5a4b983/vmlinuz-4.6.0-rc2-6-g1235bae -append 'root=/dev/ram0 user=lkp job=/lkp/scheduled/vm-vp-quantal-x86_64-17/rand_boot-1-quantal-core-x86_64.cgz-x86_64-randconfig-s3-06100451-1235baeac82d3113a7334f55a3fef160c5a4b983-20160610-77925-1xs3hv7-0.yaml~ ARCH=x86_64 kconfig=x86_64-randconfig-s3-06100451 branch=linux-devel/devel-spot-201606100535 commit=1235baeac82d3113a7334f55a3fef160c5a4b983 BOOT_IMAGE=/pkg/linux/x86_64-randconfig-s3-06100451/gcc-6/1235baeac82d3113a7334f55a3fef160c5a4b983/vmlinuz-4.6.0-rc2-6-g1235bae max_uptime=600 RESULT_ROOT=/result/boot/1/vm-vp-quantal-x86_64/quantal-core-x86_64.cgz/x86_64-randconfig-s3-06100451/gcc-6/1235baeac82d3113a7334f55a3fef160c5a4b983/0 LKP_SERVER=inn earlyprintk=ttyS0,115200 systemd.log_level=err debug apic=debug sysrq_always_enabled rcupdate.rcu_cpu_stall_timeout=100 panic=-1 softlockup_panic=1 nmi_watchdog=panic oops=panic load_ramdisk=2 prompt_ramdisk=0 console=ttyS0,115200 console=tty0 vga=normal rw ip=vm-vp-quantal-x86_64-17::dhcp drbd.minor_count=8' -initrd /fs/sdb1/initrd-vm-vp-quantal-x86_64-17 -m 360 -smp 2 -device e1000,netdev=net0 -netdev user,id=net0 -boot order=nc -no-reboot -watchdog i6300esb -rtc base=localtime -pidfile /dev/shm/kboot/pid-vm-vp-quantal-x86_64-17 -serial file:/dev/shm/kboot/serial-vm-vp-quantal-x86_64-17 -daemonize -display none -monitor null Thanks, Xiaolong # # Automatically generated file; DO NOT EDIT. # Linux/x86_64 4.6.0-rc2 Kernel Configuration # CONFIG_64BIT=y CONFIG_X86_64=y CONFIG_X86=y CONFIG_INSTRUCTION_DECODER=y CONFIG_PERF_EVENTS_INTEL_UNCORE=y CONFIG_OUTPUT_FORMAT="elf64-x86-64" CONFIG_ARCH_DEFCONFIG="arch/x86/configs/x86_64_defconfig" CONFIG_LOCKDEP_SUPPORT=y CONFIG_STACKTRACE_SUPPORT=y CONFIG_MMU=y CONFIG_ARCH_MMAP_RND_BITS_MIN=28 CONFIG_ARCH_MMAP_RND_BITS_MAX=32 CONFIG_ARCH_MMAP_RND_COMPAT_BITS_MIN=8 CONFIG_ARCH_MMAP_RND_COMPAT_BITS_MAX=16 CONFIG_NEED_DMA_MAP_STATE=y CONFIG_NEED_SG_DMA_LENGTH=y CONFIG_GENERIC_ISA_DMA=y CONFIG_GENERIC_BUG=y CONFIG_GENERIC_BUG_RELATIVE_POINTERS=y CONFIG_GENERIC_HWEIGHT=y CONFIG_ARCH_MAY_HAVE_PC_FDC=y CONFIG_RWSEM_XCHGADD_ALGORITHM=y CONFIG_GENERIC_CALIBRATE_DELAY=y CONFIG_ARCH_HAS_CPU_RELAX=y CONFIG_ARCH_HAS_CACHE_LINE_SIZE=y CONFIG_HAVE_SETUP_PER_CPU_AREA=y CONFIG_NEED_PER_CPU_EMBED_FIRST_CHUNK=y CONFIG_NEED_PER_CPU_PAGE_FIRST_CHUNK=y CONFIG_ARCH_HIBERNATION_POSSIBLE=y CONFIG_ARCH_SUSPEND_POSSIBLE=y CONFIG_ARCH_WANT_HUGE_PMD_SHARE=y CONFIG_ARCH_WANT_GENERAL_HUGETLB=y CONFIG_ZONE_DMA32=y CONFIG_AUDIT_ARCH=y CONFIG_ARCH_SUPPORTS_OPTIMIZED_INLINING=y CONFIG_ARCH_SUPPORTS_DEBUG_PAGEALLOC=y CONFIG_HAVE_INTEL_TXT=y CONFIG_X86_64_SMP=y CONFIG_ARCH_HWEIGHT_CFLAGS="-fcall-saved-rdi -fcall-saved-rsi -fcall-saved-rdx -fcall-saved-rcx -fcall-saved-r8 -fcall-saved-r9 -fcall-saved-r10 -fcall-saved-r11" CONFIG_ARCH_SUPPORTS_UPROBES=y CONFIG_FIX_EARLYCON_MEM=y CONFIG_DEBUG_RODATA=y CONFIG_PGTABLE_LEVELS=4 CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config" CONFIG_CONSTRUCTORS=y CONFIG_IRQ_WORK=y CONFIG_BUILDTIME_EXTABLE_SORT=y # # General setup # CONFIG_INIT_ENV_ARG_LIMIT=32 CONFIG_CROSS_COMPILE="" # CONFIG_COMPILE_TEST is not set CONFIG_LOCALVERSION="" CONFIG_LOCALVERSION_AUTO=y CONFIG_HAVE_KERNEL_GZIP=y CONFIG_HAVE_KERNEL_BZIP2=y CONFIG_HAVE_KERNEL_LZMA=y CONFIG_HAVE_KERNEL_XZ=y CONFIG_HAVE_KERNEL_LZO=y CONFIG_HAVE_KERNEL_LZ4=y # CONFIG_KERNEL_GZIP is not set CONFIG_KERNEL_BZIP2=y # CONFIG_KERNEL_LZMA is not set # CONFIG_KERNEL_XZ is not set # CONFIG_KERNEL_LZO is not set # CONFIG_KERNEL_LZ4 is not set CONFIG_DEFAULT_HOSTNAME="(none)" # CONFIG_SWAP is not set # CONFIG_SYSVIPC is not set # CONFIG_POSIX_MQUEUE is not set # CONFIG_CROSS_MEMORY_ATTACH is not set CONFIG_FHANDLE=y # CONFIG_USELIB is not set # CONFIG_AUDIT is not set CONFIG_HAVE_ARCH_AUDITSYSCALL=y # # IRQ subsystem # CONFIG_GENERIC_IRQ_PROBE=y CONFIG_GENERIC_IRQ_SHOW=y CONFIG_GENERIC_PENDING_IRQ=y CONFIG_GENERIC_IRQ_CHIP=y CONFIG_IRQ_DOMAIN=y CONFIG_IRQ_DOMAIN_HIERARCHY=y CONFIG_GENERIC_MSI_IRQ=y CONFIG_GENERIC_MSI_IRQ_DOMAIN=y # CONFIG_IRQ_DOMAIN_DEBUG is not set CONFIG_IRQ_FORCED_THREADING=y CONFIG_SPARSE_IRQ=y CON
Re: [PATCH] serial: 8250_early: Add earlycon support for Synopsys DesignWare ABP UART
On 2016/5/20 5:35, Jon Mason wrote: > On Thu, May 19, 2016 at 09:45:33AM +0800, Kefeng Wang wrote: >> +Cc Jon and arm-kernel mailist >> >> Any comments, thanks. > > It works for me. Please feel free to add > > Tested-by: Jon Mason Thanks Jon, hi Greg, ping... BRs, Kefeng > > Thanks, > Jon > >> >> Kefeng >> >> On 2016/5/11 14:06, Kefeng Wang wrote: >>> Some board like Hisilicon D02 uses Synopsys DesignWare ABP UART, declare an >>> OF early console for it, so early console device can be enabled with comand >>> line "earlycon"(without option) via the "stdout-path" property in >>> device-tree. >>> >>> Signed-off-by: Kefeng Wang >>> --- >>> drivers/tty/serial/8250/8250_early.c | 1 + >>> 1 file changed, 1 insertion(+) >>> >>> diff --git a/drivers/tty/serial/8250/8250_early.c >>> b/drivers/tty/serial/8250/8250_early.c >>> index 8d08ff5..85a12f0 100644 >>> --- a/drivers/tty/serial/8250/8250_early.c >>> +++ b/drivers/tty/serial/8250/8250_early.c >>> @@ -150,6 +150,7 @@ EARLYCON_DECLARE(uart, early_serial8250_setup); >>> OF_EARLYCON_DECLARE(ns16550, "ns16550", early_serial8250_setup); >>> OF_EARLYCON_DECLARE(ns16550a, "ns16550a", early_serial8250_setup); >>> OF_EARLYCON_DECLARE(uart, "nvidia,tegra20-uart", early_serial8250_setup); >>> +OF_EARLYCON_DECLARE(uart, "snps,dw-apb-uart", early_serial8250_setup); >>> >>> #ifdef CONFIG_SERIAL_8250_OMAP >>> >>> >> > > . >
Re: [PATCH v2 5/6] dt-bindings: add Sharp LQ123P1JX31 panel binding
On 06/11/2016 12:40 AM, Doug Anderson wrote: Rob, On Fri, Jun 10, 2016 at 6:42 AM, Rob Herring wrote: On Wed, Jun 08, 2016 at 07:52:45PM +0800, Yakir Yang wrote: The Sharp LQ123P1JX31 is an 12.3" 2400x1600 TFT-LCD panel connected using eDP interfaces. Signed-off-by: Yakir Yang --- Changes in v2: - Add dt-bindings of Sharp LQ123P1JX31 panel in v2 .../devicetree/bindings/display/panel/sharp,lq123p1jx31.txt| 7 +++ 1 file changed, 7 insertions(+) create mode 100644 Documentation/devicetree/bindings/display/panel/sharp,lq123p1jx31.txt diff --git a/Documentation/devicetree/bindings/display/panel/sharp,lq123p1jx31.txt b/Documentation/devicetree/bindings/display/panel/sharp,lq123p1jx31.txt new file mode 100644 index 000..81938c0 --- /dev/null +++ b/Documentation/devicetree/bindings/display/panel/sharp,lq123p1jx31.txt @@ -0,0 +1,7 @@ +Sharp 12.3" (2400x1600 pixels) TFT LCD panel + +Required properties: +- compatible: should be "sharp,lq123p1jx31," ^ Need to drop the comma. Thanks for catching! Done, No regulators or resets or pwms? Could be more explicit I guess, but Yakir does say: This binding is compatible with the simple-panel binding, which is specified in simple-panel.txt in this directory. In that document it shows: Required properties: - power-supply: regulator to provide the supply voltage Optional properties: - ddc-i2c-bus: phandle of an I2C controller used for DDC EDID probing - enable-gpios: GPIO pin to enable or disable the panel - backlight: phandle of the backlight device attached to the panel In general Yakir's bindings document match a huge chunk of the current existing bindings. Do this: cd Documentation/devicetree/bindings/display/panel grep -C20 "This binding is compatible with the simple-panel" * You'll find a huge chunk of files which are rather formulaic. It might make sense to just have one file and a list of panels which are simple panels? -Doug
Re: [PATCH 2/2] acpi/pmic: Add opregion driver for Intel BXT WhiskeyCove PMIC
On 06/11/2016 03:25 PM, Bin Gao wrote: > This patch adds operation region driver for Intel BXT WhiskeyCove > PMIC. The register mapping is done as per the BXT WC data sheet. > > Signed-off-by: Ajay Thomas > Signed-off-by: Bin Gao > --- > +static int __init intel_bxtwc_pmic_opregion_driver_init(void) > +{ > + return platform_driver_register(&intel_bxtwc_pmic_opregion_driver); > +} > + > +module_init(intel_bxtwc_pmic_opregion_driver_init); Last time Paul suggests device_initcall instead of module_init here: commit 75829dcf10862966f52716f2d67ac1c1b1eb486b Author: Paul Gortmaker Date: Mon Feb 15 00:27:51 2016 -0500 drivers/acpi: make pmic/intel_pmic_crc.c explicitly non-modular Perhaps you should do the same. Thanks, Aaron > + > +MODULE_DESCRIPTION("BXT WhiskeyCove ACPI opregion driver"); > +MODULE_LICENSE("GPL"); >
Re: [PATCH v2 6/6] drm/panel: simple: Add support for Sharp LQ123P1JX31 2400x1600 panel
Doug, On 06/11/2016 12:11 AM, Doug Anderson wrote: Hi, On Wed, Jun 8, 2016 at 9:35 AM, Doug Anderson wrote: Yakir, On Wed, Jun 8, 2016 at 4:52 AM, Yakir Yang wrote: The Sharp LQ123P1JX31 is an 12.3", 2400x1600 TFT-LCD panel connected using eDP interfaces. Signed-off-by: Yakir Yang --- Changes in v2: - Add detail timing of Sharp LQ123P1JX31 panel in v2 drivers/gpu/drm/panel/panel-simple.c | 26 ++ 1 file changed, 26 insertions(+) Looks good to me. Values in the table match the EDID I see from this panel and everything else looks to be in order. Reviewed-by: Doug Anderson Tested-by: Doug Anderson Sorry for not noticing. :( ...but as others have pointed out for your earlier patches, the size is incorrect. I found the correct size and it should be: .width = 259, .height = 173, Ah, thanks, would correct it now :-D - Yakir -Doug
Re: [PATCH] libnvdimm, nfit: treat volatile virtual CD region as read-only pmem
On Thu, Jun 09, 2016 at 03:34:52PM -0700, Dan Williams wrote: > On Thu, Jun 9, 2016 at 3:08 PM, Linda Knippers wrote: > > On 6/4/2016 7:01 AM, joeyli wrote: > >> Hi Dan, > >> > >> Thanks for your review. > >> > >> On Fri, Jun 03, 2016 at 12:27:34PM -0700, Dan Williams wrote: > >>> On Fri, Jun 3, 2016 at 12:13 AM, Lee, Chun-Yi > >>> wrote: > This patch adds codes to treat a volatile virtual CD region as a > read-only pmem region, then read-only /dev/pmem* device can be mounted > with iso9660. > > It's useful to work with the httpboot in EFI firmware to pull a remote > ISO file to the local memory region for booting and installation. > > Wiki page of UEFI HTTPBoot with OVMF: > https://en.opensuse.org/UEFI_HTTPBoot_with_OVMF > > Signed-off-by: Lee, Chun-Yi > Cc: Gary Lin > Cc: Dan Williams > Cc: Ross Zwisler > Cc: "Rafael J. Wysocki" > --- > drivers/acpi/nfit.c | 8 +++- > drivers/nvdimm/region_devs.c | 26 +- > include/linux/libnvdimm.h| 2 ++ > 3 files changed, 34 insertions(+), 2 deletions(-) > > diff --git a/drivers/acpi/nfit.c b/drivers/acpi/nfit.c > index 2215fc8..b100a17 100644 > --- a/drivers/acpi/nfit.c > +++ b/drivers/acpi/nfit.c > @@ -1949,6 +1949,7 @@ static int acpi_nfit_init_mapping(struct > acpi_nfit_desc *acpi_desc, > switch (nfit_spa_type(spa)) { > case NFIT_SPA_PM: > case NFIT_SPA_VOLATILE: > + case NFIT_SPA_VCD: > nd_mapping->start = memdev->address; > nd_mapping->size = memdev->region_size; > break; > >>> > >>> Why do we need to distinguish NFIT_SPA_VOLATILE vs NFIT_SPA_VCD, i.e. > >>> what happens if something writes to a VCD device? > >> > >> Actually I didn't try to write SPA-VCD device before. Every time I mount it > >> that the system responses read-only: > >> > >> # mount /dev/pmem0 /mnt/ > >> mount: /dev/pmem0 is write-protected, mounting read-only > >> > >> If it can be written, then I think there have no difference between > >> NFIT_SPA_VOLATILE with NFIT_SPA_VCD region. > > > > It's not clear to me what the expectations for this type of device are, or > > whether they should be read-only. The ACPI spec is not helpful here. > > The other Disk Region and CD Region types are also unclear. Anyone > > care to define them? > > > >> I implemented this patch to treat VCD region as read-only pmem because the > >> pmem region generates /dev/pmem* device that it can be mounted. > > > > I'm a bit worried about this type of device showing up as a "pmem" device. > > I realize they're described in the NFIT (not sure why but they are) but do > > any of the operations that we support for other pmem devices work on these? > > It would be just another pmem device, so it would support all of them. > > > Do root device DSMs make any sense? > > Root device DSMs take a physical address so they could apply, but I > assume a firmware could simply refuse to run any operations against > them. > Yes, I pasted the ACPI0012 root device in another mail that it doesn't have _DSM method. > > Are there other DSMs? > > Not that I can think of... > > > What will happen if someone uses ndctl to reconfigure the device? > > It won't know or care about the difference. Unless there's a negative > side effect of allowing writes to a "volatile cd" it would be yet > another pmem device. > I didn't try to using ndctl because the ACPI device doesn't have _DSM method. > > I'm especially concerned on systems that might have one of these devices > > and also have NVDIMMs. Do all the pmem devices get numbered different if > > this device comes and goes across reboots? (I know, we shouldn't rely on > > those names but it will still confuse people.) Can they be some other name > > that better represents what they're trying to be? > > If they all go through the same driver they should have the same > naming scheme. Software should be identifying the block device via > blkid, not kernel device name. Honestly I didn't have machine to test this function with a real NVDIMM memory. This function may also applies to the machines that do not have NVDIMM memory but it provides httpboot function with ISO file for booting or installation. So it only generates a ACPI0012 root device and a simple NFIT that it only contains one SPA range structure. If we don't want to treat VCD type as PMEM device (I will removed the read-only parts in patch), then I think that we need another NVDIMM driver to generate block device for VCD type. Thanks a lot! Joey Lee
Re: [PATCH v2 2/6] drm/panel: simple: Add support for LG LP097QX1-SPA1 2048x1536 panel
Emil, On 06/08/2016 08:20 PM, Emil Velikov wrote: Hi Yakir, On 8 June 2016 at 12:52, Yakir Yang wrote: The LG LP097QX1-SPA1 is an 9.7", 2048x1536 (QXGA) TFT-LCD panel connected using eDP interfaces. Signed-off-by: Yakir Yang --- Changes in v2: None drivers/gpu/drm/panel/panel-simple.c | 25 + 1 file changed, 25 insertions(+) diff --git a/drivers/gpu/drm/panel/panel-simple.c b/drivers/gpu/drm/panel/panel-simple.c index 3a7bdf1..41020e1 100644 --- a/drivers/gpu/drm/panel/panel-simple.c +++ b/drivers/gpu/drm/panel/panel-simple.c @@ -1040,6 +1040,28 @@ static const struct panel_desc lg_lp120up1 = { }, }; +static const struct drm_display_mode lg_lp097qx1_spa1_mode = { I believe that lg_lp097qx1_spa1 should be moved/sorted before lg_lp120up1. Ah, yes, done :) +static const struct panel_desc lg_lp097qx1_spa1 = { + .modes = &lg_lp097qx1_spa1_mode, + .num_modes = 1, + .size = { + .width = 2048, + .height = 1536, These are the physical dimensions of the panel. From the documentation (at the top of the file) @width: width (in millimeters) of the panel's active display area ... Got it, this should be the "display area" Display area 262.656(H) X 164.16(V) (12.2”diagonal) Thanks, - Yakir Thierry, perhaps it's worth renaming 'size' it to "physical_{size,dimensions}" and/or alike to make it clearer ? Looks like we have a few cases were people got confused - innolux_zj070na_01p and samsung_ltn101nt05. Regards, Emil
Re: [PATCH 1/2] acpi/pmic: modify the pen function signature to take bit field
On 06/11/2016 03:22 PM, Bin Gao wrote: > Issue description: On some pmics, the policy enable for thermal alerts > refers to different bit fields of the same registers, whereas on other > pmics, the policy enable refers to the same bit field on different > registers. Previous implementation did not provide the flexibility for > supporting the first approach. > > Solution: Modified the policy enable function to take bit field as well. > The use of bit field is left to the pmic specific opregion driver. > > Signed-off-by: Yegnesh Iyer > Signed-off-by: Bin Gao Acked-by: Aaron Lu Thanks, Aaron > --- > drivers/acpi/pmic/intel_pmic.c | 13 +++-- > drivers/acpi/pmic/intel_pmic.h | 4 ++-- > drivers/acpi/pmic/intel_pmic_crc.c | 5 +++-- > 3 files changed, 12 insertions(+), 10 deletions(-) > > diff --git a/drivers/acpi/pmic/intel_pmic.c b/drivers/acpi/pmic/intel_pmic.c > index bd772cd..410e96f 100644 > --- a/drivers/acpi/pmic/intel_pmic.c > +++ b/drivers/acpi/pmic/intel_pmic.c > @@ -131,7 +131,7 @@ static int pmic_thermal_aux(struct intel_pmic_opregion > *opregion, int reg, > } > > static int pmic_thermal_pen(struct intel_pmic_opregion *opregion, int reg, > - u32 function, u64 *value) > + int bit, u32 function, u64 *value) > { > struct intel_pmic_opregion_data *d = opregion->data; > struct regmap *regmap = opregion->regmap; > @@ -140,12 +140,12 @@ static int pmic_thermal_pen(struct intel_pmic_opregion > *opregion, int reg, > return -ENXIO; > > if (function == ACPI_READ) > - return d->get_policy(regmap, reg, value); > + return d->get_policy(regmap, reg, bit, value); > > if (*value != 0 && *value != 1) > return -EINVAL; > > - return d->update_policy(regmap, reg, *value); > + return d->update_policy(regmap, reg, bit, *value); > } > > static bool pmic_thermal_is_temp(int address) > @@ -170,13 +170,13 @@ static acpi_status intel_pmic_thermal_handler(u32 > function, > { > struct intel_pmic_opregion *opregion = region_context; > struct intel_pmic_opregion_data *d = opregion->data; > - int reg, result; > + int reg, bit, result; > > if (bits != 32 || !value64) > return AE_BAD_PARAMETER; > > result = pmic_get_reg_bit(address, d->thermal_table, > - d->thermal_table_count, ®, NULL); > + d->thermal_table_count, ®, &bit); > if (result == -ENOENT) > return AE_BAD_PARAMETER; > > @@ -187,7 +187,8 @@ static acpi_status intel_pmic_thermal_handler(u32 > function, > else if (pmic_thermal_is_aux(address)) > result = pmic_thermal_aux(opregion, reg, function, value64); > else if (pmic_thermal_is_pen(address)) > - result = pmic_thermal_pen(opregion, reg, function, value64); > + result = pmic_thermal_pen(opregion, reg, bit, > + function, value64); > else > result = -EINVAL; > > diff --git a/drivers/acpi/pmic/intel_pmic.h b/drivers/acpi/pmic/intel_pmic.h > index d4e90af..e8bfa7b 100644 > --- a/drivers/acpi/pmic/intel_pmic.h > +++ b/drivers/acpi/pmic/intel_pmic.h > @@ -12,8 +12,8 @@ struct intel_pmic_opregion_data { > int (*update_power)(struct regmap *r, int reg, int bit, bool on); > int (*get_raw_temp)(struct regmap *r, int reg); > int (*update_aux)(struct regmap *r, int reg, int raw_temp); > - int (*get_policy)(struct regmap *r, int reg, u64 *value); > - int (*update_policy)(struct regmap *r, int reg, int enable); > + int (*get_policy)(struct regmap *r, int reg, int bit, u64 *value); > + int (*update_policy)(struct regmap *r, int reg, int bit, int enable); > struct pmic_table *power_table; > int power_table_count; > struct pmic_table *thermal_table; > diff --git a/drivers/acpi/pmic/intel_pmic_crc.c > b/drivers/acpi/pmic/intel_pmic_crc.c > index fcd1852..d7f1761 100644 > --- a/drivers/acpi/pmic/intel_pmic_crc.c > +++ b/drivers/acpi/pmic/intel_pmic_crc.c > @@ -141,7 +141,8 @@ static int intel_crc_pmic_update_aux(struct regmap > *regmap, int reg, int raw) > regmap_update_bits(regmap, reg - 1, 0x3, raw >> 8) ? -EIO : 0; > } > > -static int intel_crc_pmic_get_policy(struct regmap *regmap, int reg, u64 > *value) > +static int intel_crc_pmic_get_policy(struct regmap *regmap, > + int reg, int bit, u64 *value) > { > int pen; > > @@ -152,7 +153,7 @@ static int intel_crc_pmic_get_policy(struct regmap > *regmap, int reg, u64 *value) > } > > static int intel_crc_pmic_update_policy(struct regmap *regmap, > - int reg, int enable) > + int reg, int bit, int enable) > { > int alert0; > >
Re: [PATCH] nfsd: Close a race between access checking/setting in nfs4_get_vfs_file
On Jun 11, 2016, at 9:33 PM, Jeff Layton wrote: > On Sat, 2016-06-11 at 11:41 -0400, Oleg Drokin wrote: >> On Jun 10, 2016, at 4:55 PM, J . Bruce Fields wrote: >> >>> On Fri, Jun 10, 2016 at 06:50:33AM -0400, Jeff Layton wrote: On Fri, 2016-06-10 at 00:18 -0400, Oleg Drokin wrote: > On Jun 9, 2016, at 5:01 PM, Oleg Drokin wrote: > >> Currently there's an unprotected access mode check in >> nfs4_upgrade_open >> that then calls nfs4_get_vfs_file which in turn assumes whatever >> access mode was present in the state is still valid which is racy. >> Two nfs4_get_vfs_file van enter the same path as result and get two >> references to nfs4_file, but later drop would only happens once >> because >> access mode is only denoted by bits, so no refcounting. >> >> The locking around access mode testing is introduced to avoid this >> race. >> >> Signed-off-by: Oleg Drokin >> --- >> >> This patch performs equally well to the st_rwsem -> mutex >> conversion, >> but is a bit ligher-weight I imagine. >> For one it seems to allow truncates in parallel if we ever want it. >> >> fs/nfsd/nfs4state.c | 28 +--- >> 1 file changed, 25 insertions(+), 3 deletions(-) >> >> diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c >> index f5f82e1..d4b9eba 100644 >> --- a/fs/nfsd/nfs4state.c >> +++ b/fs/nfsd/nfs4state.c >> @@ -3958,6 +3958,11 @@ static __be32 nfs4_get_vfs_file(struct >> svc_rqst *rqstp, struct nfs4_file *fp, >> >> spin_lock(&fp->fi_lock); >> >> +if (test_access(open->op_share_access, stp)) { >> +spin_unlock(&fp->fi_lock); >> +return nfserr_eagain; >> +} >> + >> /* >> * Are we trying to set a deny mode that would conflict with >> * current access? >> @@ -4017,11 +4022,21 @@ nfs4_upgrade_open(struct svc_rqst *rqstp, >> struct nfs4_file *fp, struct svc_fh *c >> __be32 status; >> unsigned char old_deny_bmap = stp->st_deny_bmap; >> >> -if (!test_access(open->op_share_access, stp)) >> -return nfs4_get_vfs_file(rqstp, fp, cur_fh, stp, >> open); >> +again: >> +spin_lock(&fp->fi_lock); >> +if (!test_access(open->op_share_access, stp)) { >> +spin_unlock(&fp->fi_lock); >> +status = nfs4_get_vfs_file(rqstp, fp, cur_fh, stp, >> open); >> +/* >> + * Somebody won the race for access while we did >> not hold >> + * the lock here >> + */ >> +if (status == nfserr_eagain) >> +goto again; >> +return status; >> +} >> >> /* test and set deny mode */ >> -spin_lock(&fp->fi_lock); >> status = nfs4_file_check_deny(fp, open->op_share_deny); >> if (status == nfs_ok) { >> set_deny(open->op_share_deny, stp); >> @@ -4361,6 +4376,13 @@ nfsd4_process_open2(struct svc_rqst *rqstp, >> struct svc_fh *current_fh, struct nf >> status = nfs4_get_vfs_file(rqstp, fp, current_fh, stp, >> open); >> if (status) { >> up_read(&stp->st_rwsem); >> +/* >> + * EAGAIN is returned when there's a >> racing access, >> + * this should never happen as we are the >> only user >> + * of this new state, and since it's not >> yet hashed, >> + * nobody can find it >> + */ >> +WARN_ON(status == nfserr_eagain); > > Ok, some more testing shows that this CAN happen. > So this patch is inferior to the mutex one after all. > Yeah, that can happen for all sorts of reasons. As Andrew pointed out, you can get this when there is a lease break in progress, and that may be occurring for a completely different stateid (or because of samba, etc...) It may be possible to do something like this, but we'd need to audit all of the handling of st_access_bmap (and the deny bmap) to ensure that we get it right. For now, I think just turning that rwsem into a mutex is the best solution. That is a per-stateid mutex so any contention is going to be due to the client sending racing OPEN calls for the same inode anyway. Allowing those to run in parallel again could be useful in some cases, but most use-cases won't be harmed by that serialization. >>> >>> OK, so for now my plan is to take "nfsd: Always lock state exclusively" >>> for 4.7. Thanks to both of you for your work on this…. >> >> >> FYI, I just hit this again with the "Always lock state exclusive
Re: [PATCH v2 4/6] drm/panel: simple: Add support for Samsung LSN122DL01-C01 2560x1600 panel
Stéphane, On 06/10/2016 08:04 AM, Stéphane Marchesin wrote: On Wed, Jun 8, 2016 at 4:52 AM, Yakir Yang wrote: The Samsung LSN122DL01-C01 is an 12.2" 2560x1600 (WQXGA) TFT-LCD panel connected using eDP interfaces. Signed-off-by: Yakir Yang --- Changes in v2: None drivers/gpu/drm/panel/panel-simple.c | 25 + 1 file changed, 25 insertions(+) diff --git a/drivers/gpu/drm/panel/panel-simple.c b/drivers/gpu/drm/panel/panel-simple.c index 41020e1..067a5c4 100644 --- a/drivers/gpu/drm/panel/panel-simple.c +++ b/drivers/gpu/drm/panel/panel-simple.c @@ -1246,6 +1246,28 @@ static const struct panel_desc qd43003c0_40 = { .bus_format = MEDIA_BUS_FMT_RGB888_1X24, }; +static const struct drm_display_mode samsung_lsn122dl01_c01_mode = { + .clock = 271560, + .hdisplay = 2560, + .hsync_start = 2560 + 48, + .hsync_end = 2560 + 48 + 32, + .htotal = 2560 + 48 + 32 + 80, + .vdisplay = 1600, + .vsync_start = 1600 + 2, + .vsync_end = 1600 + 2 + 5, + .vtotal = 1600 + 2 + 5 + 57, + .vrefresh = 60, +}; + +static const struct panel_desc samsung_lsn122dl01_c01 = { + .modes = &samsung_lsn122dl01_c01_mode, + .num_modes = 1, + .size = { + .width = 2560, + .height = 1600, These are meant to be the physical dimensions (same thing for the other patches btw). Got it, so this should be the "active area" in panel book. Display area 262.656(H) X 164.16(V) (12.2”diagonal) Thanks, -Yakir Stéphane + }, +}; + static const struct drm_display_mode samsung_ltn101nt05_mode = { .clock = 54030, .hdisplay = 1024, @@ -1506,6 +1528,9 @@ static const struct of_device_id platform_of_match[] = { .compatible = "qiaodian,qd43003c0-40", .data = &qd43003c0_40, }, { + .compatible = "samsung,lsn122dl01-c01", + .data = &samsung_lsn122dl01_c01, + }, { .compatible = "samsung,ltn101nt05", .data = &samsung_ltn101nt05, }, { -- 1.9.1 ___ dri-devel mailing list dri-de...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH] bcache: Remove deprecated create_workqueue
On 06/11/2016 04:52 PM, Tejun Heo wrote: On Wed, Jun 08, 2016 at 01:57:19AM +0530, Bhaktipriya Shridhar wrote: alloc_workqueue replaces deprecated create_workqueue(). Dedicated workqueues have been used since bcache_wq and moving_gc_wq are workqueues for writes and are being used on a memory reclaim path. WQ_MEM_RECLAIM has been set to ensure forward progress under memory pressure. Since there are only a fixed number of work items, explicit concurrency limit is unnecessary here. Signed-off-by: Bhaktipriya Shridhar Acked-by: Tejun Heo Added to 4.8, thanks. -- Jens Axboe
Re: [PATCH] libnvdimm, nfit: treat volatile virtual CD region as read-only pmem
Hi Linda, Thanks for your review and comments. On Thu, Jun 09, 2016 at 06:08:17PM -0400, Linda Knippers wrote: > On 6/4/2016 7:01 AM, joeyli wrote: > > Hi Dan, > > > > Thanks for your review. > > > > On Fri, Jun 03, 2016 at 12:27:34PM -0700, Dan Williams wrote: > >> On Fri, Jun 3, 2016 at 12:13 AM, Lee, Chun-Yi > >> wrote: > >>> This patch adds codes to treat a volatile virtual CD region as a > >>> read-only pmem region, then read-only /dev/pmem* device can be mounted > >>> with iso9660. > >>> > >>> It's useful to work with the httpboot in EFI firmware to pull a remote > >>> ISO file to the local memory region for booting and installation. > >>> > >>> Wiki page of UEFI HTTPBoot with OVMF: > >>> https://en.opensuse.org/UEFI_HTTPBoot_with_OVMF > >>> > >>> Signed-off-by: Lee, Chun-Yi > >>> Cc: Gary Lin > >>> Cc: Dan Williams > >>> Cc: Ross Zwisler > >>> Cc: "Rafael J. Wysocki" > >>> --- > >>> drivers/acpi/nfit.c | 8 +++- > >>> drivers/nvdimm/region_devs.c | 26 +- > >>> include/linux/libnvdimm.h| 2 ++ > >>> 3 files changed, 34 insertions(+), 2 deletions(-) > >>> > >>> diff --git a/drivers/acpi/nfit.c b/drivers/acpi/nfit.c > >>> index 2215fc8..b100a17 100644 > >>> --- a/drivers/acpi/nfit.c > >>> +++ b/drivers/acpi/nfit.c > >>> @@ -1949,6 +1949,7 @@ static int acpi_nfit_init_mapping(struct > >>> acpi_nfit_desc *acpi_desc, > >>> switch (nfit_spa_type(spa)) { > >>> case NFIT_SPA_PM: > >>> case NFIT_SPA_VOLATILE: > >>> + case NFIT_SPA_VCD: > >>> nd_mapping->start = memdev->address; > >>> nd_mapping->size = memdev->region_size; > >>> break; > >> > >> Why do we need to distinguish NFIT_SPA_VOLATILE vs NFIT_SPA_VCD, i.e. > >> what happens if something writes to a VCD device? > > > > Actually I didn't try to write SPA-VCD device before. Every time I mount it > > that the system responses read-only: > > > > # mount /dev/pmem0 /mnt/ > > mount: /dev/pmem0 is write-protected, mounting read-only > > > > If it can be written, then I think there have no difference between > > NFIT_SPA_VOLATILE with NFIT_SPA_VCD region. > > It's not clear to me what the expectations for this type of device are, or > whether they should be read-only. The ACPI spec is not helpful here. > The other Disk Region and CD Region types are also unclear. Anyone > care to define them? > In ACPI spec 6.1, it said "a volatile memory region that contains an ISO image": This GUID defines a RAM Disk supporting a Virtual CD Region – Volatile (a volatile memory region that contains an ISO image): { 0x3D5ABD30,0x4175,0x87CE,0x6D,0x64,0xD2,0xAD,0xE5,0x23,0xC4,0xBB } I think the behavior that is the same with a volatile memory region but it contains ISO. I agree doesn't have any spec that it mentions the type should be read-only, I will remove the code in patch. I also agree that it doesn't have detail description of those ram disk types. Do you have any idea or comment that you want to add to spec? Either for ACPI or UEFI? > > I implemented this patch to treat VCD region as read-only pmem because the > > pmem region generates /dev/pmem* device that it can be mounted. > > I'm a bit worried about this type of device showing up as a "pmem" device. > I realize they're described in the NFIT (not sure why but they are) but do > any of the operations that we support for other pmem devices work on these? > Do root device DSMs make any sense? Are there other DSMs? What will happen > if someone uses ndctl to reconfigure the device? > By using the Ramdisk function in EDK2/OVMF, it only generates a ACPI0012 root device that it contains a empty _STA but no _DSM support: DefinitionBlock ("ssdt2.aml", "SSDT", 2, "INTEL ", "RamDisk ", 0x1000) { Scope (\_SB) { Device (NVDR) { Name (_HID, "ACPI0012") // _HID: Hardware ID Name (_STR, Unicode ("NVDIMM Root Device")) // _STR: Description String Method (_STA, 0, NotSerialized) // _STA: Status { Return (0x0F) } } } } So there have no way to control this root device through _DSM. The ACPI0012 root device is used to trigger the nfit driver in acpi. I will put the above parser result to the patch description in next version. On the other hand, here is the NFIT that it is generated by OVMF: [000h 4]Signature : "NFIT"[NVDIMM Firmware Interface Table] [004h 0004 4] Table Length : 0060 [008h 0008 1] Revision : 01 [009h 0009 1] Checksum : 0C [00Ah 0010 6] Oem ID : "INTEL " [010h 0016 8] Oem Table ID : "EDK2" [018h 0024 4] Oem Revision : 0002 [01Ch 0028 4] Asl Compiler ID : "" [020h 0032 4]Asl Compiler Revision : 0113 [024h 0036 4]
Re: [PATCH v2 1/2] Documentation: bindings: add dt doc for Rockchip PCIe controller
On 2016/6/9 4:44, Rob Herring wrote: On Wed, Jun 08, 2016 at 04:05:17PM +0800, Shawn Lin wrote: This patch adds a binding that describes the Rockchip PCIe controller found on Rockchip SoCs PCIe interface. Signed-off-by: Shawn Lin --- Changes in v2: - fix lots clk/reset stuff suggested by Heiko - remove msi-parent and add msi-map suggested by Marc - drop phy related stuff - some others minor fixes .../devicetree/bindings/pci/rockchip-pcie.txt | 86 ++ 1 file changed, 86 insertions(+) create mode 100644 Documentation/devicetree/bindings/pci/rockchip-pcie.txt diff --git a/Documentation/devicetree/bindings/pci/rockchip-pcie.txt b/Documentation/devicetree/bindings/pci/rockchip-pcie.txt new file mode 100644 index 000..eb92e29 --- /dev/null +++ b/Documentation/devicetree/bindings/pci/rockchip-pcie.txt @@ -0,0 +1,86 @@ +* Rockchip AXI PCIe Root Port Bridge DT description + +Required properties: +- #address-cells: Address representation for root ports, set to <3> +- #size-cells: Size representation for root ports, set to <2> +- #interrupt-cells: specifies the number of cells needed to encode an + interrupt source. The value must be 1. +- compatible: Should contain "rockchip,rk3399-pcie" +- reg: Two register ranges as listed in the reg-names property +- reg-names: Must include the following names + - "axi-base" + - "apb-base" +- clocks: Must contain an entry for each entry in clock-names. + See ../clocks/clock-bindings.txt for details. +- clock-names: Must include the following entries: + - "aclk" + - "aclk-perf" + - "hclk" + - "pm" +- phys: From PHY bindings: Phandle for the Generic PHY for PCIe. +- phy-names: MUST be "pcie-phy". phy-names is kind of pointless for 1 phy. ok, I will remove it. +- interrupts: Three interrupt entries must be specified. +- interrupt-names: Must include the following names + - "sys" + - "legacy" + - "client" +- resets: Must contain five entries for each entry in reset-names. + See ../reset/reset.txt for details. +- reset-names: Must include the following names + - "core" + - "mgmt" + - "mgmt-sticky" + - "pipe" +- pinctrl-names : The pin control state names +- pinctrl-0: The "default" pinctrl state +- interrupt-map-mask and interrupt-map: standard PCI properties +- interrupt-controller: identifies the node as an interrupt controller + +Optional Property: +- ep-gpios: contain the entry for pre-reset gpio +- num-lanes: number of lanes to use +- vpcie3v3-supply: The phandle to the 3.3v regulator to use for pcie. If this + is specified we'll defer probe until we can find this regulator. +- vpcie1v8-supply: The phandle to the 1.8v regulator to use for pcie. If this + is specified we'll defer probe until we can find this regulator. +- vpcie0v9-supply: The phandle to the 0.9v regulator to use for pcie. If this + is specified we'll defer probe until we can find this regulator. + +Example: + +pcie0: pcie@f800 { + compatible = "rockchip,rk3399-pcie"; + #address-cells = <3>; + #size-cells = <2>; + clocks = <&cru ACLK_PCIE>, <&cru ACLK_PERF_PCIE>, +<&cru PCLK_PCIE>; + clock-names = "aclk", "aclk-perf", + "hclk"; + bus-range = <0x0 0x1>; + interrupts = , , +; + interrupt-names: "sys", "legacy", "client"; + assigned-clocks = <&cru SCLK_PCIEPHY_REF>; + assigned-clock-parents = <&cru SCLK_PCIEPHY_REF100M>; + assigned-clock-rates = <1>; + ep-gpios = <&gpio3 13 GPIO_ACTIVE_HIGH>; + ranges = < 0x8200 0 0xfa00 0x0 0xfa00 0 0x60 + 0x8100 0 0xfa60 0x0 0xfa60 0 0x10 >; No 64-bit memory space? Will fix this example. Thanks for catching this:) + num-lanes = <4>; + reg = < 0x0 0xf800 0x0 0x200 >, < 0x0 0xfd00 0x0 0x100 >; + reg-name = "axi-base", "apb-base"; + resets = <&cru SRST_PCIEPHY>, <&cru SRST_PCIE_CORE>, <&cru SRST_PCIE_MGMT>, +<&cru SRST_PCIE_MGMT_STICKY>, <&cru SRST_PCIE_PIPE>; + reset-names = "core", "mgmt", "mgmt-sticky", "pipe"; + phys = <&pcie_phy>; + phy-names = "pcie-phy"; + pinctrl-names = "default"; + pinctrl-0 = <&pcie_clkreq>; + #interrupt-cells = <1>; + interrupt-controller; + interrupt-map-mask = <0 0 0 7>; + interrupt-map = <0 0 0 1 &pcie0 1>, + <0 0 0 2 &pcie0 2>, + <0 0 0 3 &pcie0 3>, + <0 0 0 4 &pcie0 4>; +}; -- 2.3.7 ___ Linux-rockchip mailing list linux-rockc...@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-rockchip -- Best Regards Shawn Lin
Re: [PATCH 1/3] ARM: dts: imx7d: create i.MX 7Solo base device tree
On Tue, Jun 07, 2016 at 07:37:07PM -0700, Stefan Agner wrote: > The i.MX 7 series currently consists of two SoCs: i.MX 7Solo and > 7Dual. The i.MX 7Solo implements a subset of features available on > i.MX 7Dual, hence create imx7s.dtsi as the base device tree. The > i.MX 7Dual's additional features over i.MX 7Solo are: > - Second Cortex-A7 core > - Second Gigabit Ethernet controller > - EPD (Electronc Paper Display, not yet part of the device tree) > - PCIe (not yet part of the device tree) > - Additional USB2.0 OTG controller > > Signed-off-by: Stefan Agner > --- > arch/arm/boot/dts/imx7d.dtsi | 923 > +++ > arch/arm/boot/dts/imx7s.dtsi | 880 + > 2 files changed, 928 insertions(+), 875 deletions(-) We should probably have a beforehand patch to rename the file, so that we can avoid this dramatic diffstat. Shawn
Re: [PATCH v2 1/2] Documentation: bindings: add dt doc for Rockchip PCIe controller
在 2016/6/10 12:01, Doug Anderson 写道: Shawn, On Wed, Jun 8, 2016 at 1:05 AM, Shawn Lin wrote: +pcie0: pcie@f800 { + compatible = "rockchip,rk3399-pcie"; + #address-cells = <3>; + #size-cells = <2>; + clocks = <&cru ACLK_PCIE>, <&cru ACLK_PERF_PCIE>, +<&cru PCLK_PCIE>; + clock-names = "aclk", "aclk-perf", + "hclk"; Code also requires a "pm" clock. + bus-range = <0x0 0x1>; + interrupts = , , +; + interrupt-names: "sys", "legacy", "client"; Shouldn't be ":", should be "=". + assigned-clocks = <&cru SCLK_PCIEPHY_REF>; + assigned-clock-parents = <&cru SCLK_PCIEPHY_REF100M>; + assigned-clock-rates = <1>; + ep-gpios = <&gpio3 13 GPIO_ACTIVE_HIGH>; + ranges = < 0x8200 0 0xfa00 0x0 0xfa00 0 0x60 + 0x8100 0 0xfa60 0x0 0xfa60 0 0x10 >; nit: I don't thin it's common to have spaces before/after the ">" and "<". nit: Be consistent about 0 vs. 0x0 in ranges. + num-lanes = <4>; + reg = < 0x0 0xf800 0x0 0x200 >, < 0x0 0xfd00 0x0 0x100 >; + reg-name = "axi-base", "apb-base"; Should be "reg-names" (with an "s") + resets = <&cru SRST_PCIEPHY>, <&cru SRST_PCIE_CORE>, <&cru SRST_PCIE_MGMT>, +<&cru SRST_PCIE_MGMT_STICKY>, <&cru SRST_PCIE_PIPE>; + reset-names = "core", "mgmt", "mgmt-sticky", "pipe"; You have 5 resets but 4 reset names. That doesn't seem right. Code shows you only getting 4, so presumably you need to remove the SRST_PCIEPHY one. Thanks for catching these above as I forgot to rework the this sample. -Doug ___ Linux-rockchip mailing list linux-rockc...@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-rockchip -- Best Regards Shawn Lin
[GIT PULL] Block fixes for 4.7-rc3
Hi Linus, A small collection of fixes for the current series. This pull request contains: - Two fixes for xen-blkfront, from Bob Liu. - A bug fix for NVMe, releasing only the specific resources we requested. - Fix for a debugfs flags entry for nbd, from Josef. - Plug fix from Omar, fixing up a case of code being switched between two functions. - A missing bio_put() for the new discard callers of submit_bio_wait(), fixing a regression causing a leak of the bio. From Shaun. - Improve dirty limit calculation precision in the writeback code, fixing a case where setting a limit lower than 1% of memory would end up being zero. From Tejun. Please pull! git://git.kernel.dk/linux-block.git for-linus Bob Liu (2): xen-blkfront: don't call talk_to_blkback when already connected to blkback xen-blkfront: fix resume issues after a migration Jens Axboe (1): Merge branch 'stable/for-jens-4.7' of git://git.kernel.org/.../konrad/xen into for-linus Johannes Thumshirn (1): NVMe: Only release requested regions Josef Bacik (1): nbd: pass the nbd pointer for flags debugfs Omar Sandoval (1): blk-mq: really fix plug list flushing for nomerge queues Shaun Tancheff (1): block: missing bio_put following submit_bio_wait Tejun Heo (1): writeback: use higher precision calculation in domain_dirty_limits() block/blk-lib.c | 12 +--- block/blk-mq.c | 17 - drivers/block/nbd.c | 2 +- drivers/block/xen-blkfront.c | 35 ++- drivers/nvme/host/pci.c | 9 +++-- mm/page-writeback.c | 21 - 6 files changed, 59 insertions(+), 37 deletions(-) -- Jens Axboe
Re: [PATCH] nfsd: Close a race between access checking/setting in nfs4_get_vfs_file
On Sat, 2016-06-11 at 11:41 -0400, Oleg Drokin wrote: > On Jun 10, 2016, at 4:55 PM, J . Bruce Fields wrote: > > > On Fri, Jun 10, 2016 at 06:50:33AM -0400, Jeff Layton wrote: > > > On Fri, 2016-06-10 at 00:18 -0400, Oleg Drokin wrote: > > > > On Jun 9, 2016, at 5:01 PM, Oleg Drokin wrote: > > > > > > > > > Currently there's an unprotected access mode check in > > > > > nfs4_upgrade_open > > > > > that then calls nfs4_get_vfs_file which in turn assumes whatever > > > > > access mode was present in the state is still valid which is racy. > > > > > Two nfs4_get_vfs_file van enter the same path as result and get two > > > > > references to nfs4_file, but later drop would only happens once > > > > > because > > > > > access mode is only denoted by bits, so no refcounting. > > > > > > > > > > The locking around access mode testing is introduced to avoid this > > > > > race. > > > > > > > > > > Signed-off-by: Oleg Drokin > > > > > --- > > > > > > > > > > This patch performs equally well to the st_rwsem -> mutex > > > > > conversion, > > > > > but is a bit ligher-weight I imagine. > > > > > For one it seems to allow truncates in parallel if we ever want it. > > > > > > > > > > fs/nfsd/nfs4state.c | 28 +--- > > > > > 1 file changed, 25 insertions(+), 3 deletions(-) > > > > > > > > > > diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c > > > > > index f5f82e1..d4b9eba 100644 > > > > > --- a/fs/nfsd/nfs4state.c > > > > > +++ b/fs/nfsd/nfs4state.c > > > > > @@ -3958,6 +3958,11 @@ static __be32 nfs4_get_vfs_file(struct > > > > > svc_rqst *rqstp, struct nfs4_file *fp, > > > > > > > > > > spin_lock(&fp->fi_lock); > > > > > > > > > > + if (test_access(open->op_share_access, stp)) { > > > > > + spin_unlock(&fp->fi_lock); > > > > > + return nfserr_eagain; > > > > > + } > > > > > + > > > > > /* > > > > >* Are we trying to set a deny mode that would conflict with > > > > >* current access? > > > > > @@ -4017,11 +4022,21 @@ nfs4_upgrade_open(struct svc_rqst *rqstp, > > > > > struct nfs4_file *fp, struct svc_fh *c > > > > > __be32 status; > > > > > unsigned char old_deny_bmap = stp->st_deny_bmap; > > > > > > > > > > - if (!test_access(open->op_share_access, stp)) > > > > > - return nfs4_get_vfs_file(rqstp, fp, cur_fh, stp, > > > > > open); > > > > > +again: > > > > > + spin_lock(&fp->fi_lock); > > > > > + if (!test_access(open->op_share_access, stp)) { > > > > > + spin_unlock(&fp->fi_lock); > > > > > + status = nfs4_get_vfs_file(rqstp, fp, cur_fh, stp, > > > > > open); > > > > > + /* > > > > > + * Somebody won the race for access while we did > > > > > not hold > > > > > + * the lock here > > > > > + */ > > > > > + if (status == nfserr_eagain) > > > > > + goto again; > > > > > + return status; > > > > > + } > > > > > > > > > > /* test and set deny mode */ > > > > > - spin_lock(&fp->fi_lock); > > > > > status = nfs4_file_check_deny(fp, open->op_share_deny); > > > > > if (status == nfs_ok) { > > > > > set_deny(open->op_share_deny, stp); > > > > > @@ -4361,6 +4376,13 @@ nfsd4_process_open2(struct svc_rqst *rqstp, > > > > > struct svc_fh *current_fh, struct nf > > > > > status = nfs4_get_vfs_file(rqstp, fp, current_fh, stp, > > > > > open); > > > > > if (status) { > > > > > up_read(&stp->st_rwsem); > > > > > + /* > > > > > + * EAGAIN is returned when there's a > > > > > racing access, > > > > > + * this should never happen as we are the > > > > > only user > > > > > + * of this new state, and since it's not > > > > > yet hashed, > > > > > + * nobody can find it > > > > > + */ > > > > > + WARN_ON(status == nfserr_eagain); > > > > > > > > Ok, some more testing shows that this CAN happen. > > > > So this patch is inferior to the mutex one after all. > > > > > > > > > > Yeah, that can happen for all sorts of reasons. As Andrew pointed out, > > > you can get this when there is a lease break in progress, and that may > > > be occurring for a completely different stateid (or because of samba, > > > etc...) > > > > > > It may be possible to do something like this, but we'd need to audit > > > all of the handling of st_access_bmap (and the deny bmap) to ensure > > > that we get it right. > > > > > > For now, I think just turning that rwsem into a mutex is the best > > > solution. That is a per-stateid mutex so any contention is going to be > > > due to the client sending racing OPEN calls for the same inode anyway. > > > Allowing those to run in parallel again could be useful in some cases, > > > but most use-cases won't be harmed by that serialization.
Re: [PATCH 6/8] ntb_tool: Add link status file to debugfs
On Sat, Jun 11, 2016 at 11:28 AM, Logan Gunthorpe wrote: > Hey Allen, > > Thanks for the feedback it's a bit more complicated but I don't object to > that. I'll work something up on Monday. > > I was trying to avoid adding link controls, but if we do, would you say the > module should still enable the link when it's installed? Or would we have > the user explicitly have to enable the link before using it? I would vote to keep the current behavior and enable the link when the module loads. > > Thanks, > > Logan > > > On 10/06/16 08:27 PM, Allen Hubbe wrote: >> >> On Fri, Jun 10, 2016 at 6:54 PM, Logan Gunthorpe >> wrote: >>> >>> In order to more successfully script with ntb_tool it's useful to >>> have a link file to check the link status so that the script >>> doesn't use the other files until the link is up. >>> >>> This commit adds a 'link' file to the debugfs directory which reads >>> 0 or 1 depending on the link status. For scripting convenience, writing >>> will block until the link is up (discarding anything that was written). >>> >>> Signed-off-by: Logan Gunthorpe >>> --- >>> drivers/ntb/test/ntb_tool.c | 45 >>> + >>> 1 file changed, 45 insertions(+) >>> >>> diff --git a/drivers/ntb/test/ntb_tool.c b/drivers/ntb/test/ntb_tool.c >>> index 954e1d5..116352e 100644 >>> --- a/drivers/ntb/test/ntb_tool.c >>> +++ b/drivers/ntb/test/ntb_tool.c >>> @@ -59,6 +59,12 @@ >>>* >>>* Eg: check if clearing the doorbell mask generates an interrupt. >>>* >>> + * # Check the link status >>> + * root@self# cat $DBG_DIR/link >>> + * >>> + * # Block until the link is up >>> + * root@self# echo > $DBG_DIR/link >> >> >> I think a file to get and set the link status is a good idea, but the >> way it is done as proposed here is not in a similar style to other >> ntb_tool operations. Other operations simply read a register and >> format the value, or scan a value and write a register. Similarly, I >> think the link status could be done in the same way: use the read file >> operation to get the current status with ntb_link_is_up(), and use the >> file write operation to enable or disable the link with >> ntb_link_enable() and ntb_link_disable(). >> >> Waiting for link status is an interesting concept, too. Really, one >> might be interested in a change in link status, whether up or down. >> What about a link event file that supports write to arm the event, and >> read to block for the event. Consider an implementation based on >> . It would be used in combination with the link >> status file, above, as follows. >> >> 1: Write 1 to the event file. This arms the event. >>- The event will be disarmed by the next tool_link_event(). >> >> 2: The application may read the link status file if it is interested >> in waiting for a particular event. >> >> 3. The application may wait for an event by reading the event file >>- The application will wait as long as the event is still armed. >>- If the event was disarmed before waiting, the application will not >> block. >> >> 4. The application should read the link status again. >> >> In any case, I think it would be more expected and natural to block >> while reading a file versus writing it. >> >>> + * >>>* # Set the doorbell mask >>>* root@self# echo 's 1' > $DBG_DIR/mask >>>* >>> @@ -127,6 +133,7 @@ struct tool_ctx { >>> struct work_struct link_cleanup; >>> bool link_is_up; >>> struct delayed_work link_work; >>> + wait_queue_head_t link_wq; >>> int mw_count; >>> struct tool_mw mws[MAX_MWS]; >>> }; >>> @@ -237,6 +244,7 @@ static void tool_link_work(struct work_struct *work) >>> "Error setting up memory windows: %d\n", rc); >>> >>> tc->link_is_up = true; >>> + wake_up(&tc->link_wq); >>> } >>> >>> static void tool_link_cleanup(struct work_struct *work) >>> @@ -573,6 +581,39 @@ static TOOL_FOPS_RDWR(tool_peer_spad_fops, >>>tool_peer_spad_read, >>>tool_peer_spad_write); >>> >>> +static ssize_t tool_link_read(struct file *filep, char __user *ubuf, >>> + size_t size, loff_t *offp) >>> +{ >>> + struct tool_ctx *tc = filep->private_data; >>> + char *buf; >>> + ssize_t pos, rc; >>> + >>> + buf = kmalloc(64, GFP_KERNEL); >>> + if (!buf) >>> + return -ENOMEM; >>> + >>> + pos = scnprintf(buf, 64, "%d\n", tc->link_is_up); >>> + rc = simple_read_from_buffer(ubuf, size, offp, buf, pos); >>> + >>> + kfree(buf); >>> + >>> + return rc; >>> +} >>> + >>> +static ssize_t tool_link_write(struct file *filep, const char __user >>> *ubuf, >>> + size_t size, loff_t *offp) >>> +{ >>> + struct tool_ctx *tc = filep->private_data; >>> + >>> + if (wait_event_interruptible(tc->link_wq, tc->link_is_up)) >>> + return -ERESTART; >>> + >>> +
Re: [PATCH v4 1/2] Documentation: bindings: add DT documentation for Rockchip USB2PHY
Hi Bob, On 2016/6/9 4:04, Rob Herring wrote: On Tue, Jun 07, 2016 at 05:15:53PM +0800, Frank Wang wrote: Signed-off-by: Frank Wang --- Changes in v4: - Used 'phy-supply' instead of 'vbus_*-supply'. Changes in v3: - Added 'clocks' and 'clock-names' optional properties. - Specified 'otg-port' and 'host-port' as the sub-node name. Changes in v2: - Changed vbus_host optional property from gpio to regulator. - Specified vbus_otg-supply optional property. - Specified otg_id and otg_bvalid property. .../bindings/phy/phy-rockchip-inno-usb2.txt| 62 1 file changed, 62 insertions(+) create mode 100644 Documentation/devicetree/bindings/phy/phy-rockchip-inno-usb2.txt Acked-by: Rob Herring From the latest comments of Heiko, the devicetree bindings need to add a new property to handle multiple phy, and I will send out a new patch later today. BR. Frank
Re: [PATCH] vfs: add simple direct-mapped dcache lookup front-end
Hi, Just a small typo in Kconfig below.. On 06/11/16 16:51, George Spelvin wrote: > > fs/Kconfig | 28 > fs/dcache.c | 207 > ++-- > 2 files changed, 231 insertions(+), 4 deletions(-) > > diff --git a/fs/Kconfig b/fs/Kconfig > index b8fcb416..3b111b77 100644 > --- a/fs/Kconfig > +++ b/fs/Kconfig > @@ -8,6 +8,34 @@ menu "File systems" > config DCACHE_WORD_ACCESS > bool > > +config L1_DCACHE_BITS > + int "Dcache level-1 cache size (bits)" > + range 0 20 > + default 0 if !EXPERT > + default 0 if NUMA > + default 10 if BASE_SMALL > + default 13 > + help > + The Linus kernel maintains a large cache of "dentries" Linux > + (directory entries) for the performance-critical task of > + converting file names to inodes. This option enables a smaller > + direct-mapped "level-1 cache" in front of the main dcache. > + > + (This software "dcache" is quite different from the CPU's data > + cache, or "D-cache". Sorry for the confusingly similar names.) > + > + This option specifies the size of this cache, as a power of 2. > + For example, 13 means 2^13 = 8192 entries in the L1 dcache. > + Specify 0 to turn off the L1 dcache entirely. > + > + The cost of enabling this is one pointer per entry, plus a > + small amount of code. > + > + This is an experimental feature which hopes to speed up > + single-socket machines. On larger systems, the extra updates > + generated by the L1 dcache probably cause too much cache-line > + bouncing to be worth it. > + > if BLOCK > > source "fs/ext2/Kconfig" -- ~Randy
Re: [PATCH] mmc: core: add auto bkops support
Hi Alex, On 2016/6/8 22:46, Alex Lemberg wrote: Hi Shawn, Is the intention in this patch to stop using MANUAL_BKOPS for all eMMC5.1+ devices, and only use AUTO_BKOPS? Please see several questions inline. Yup, my intention is to use auto bkops for emmc 5.1+ if possible. On 6/6/16, 6:07 AM, "linux-mmc-ow...@vger.kernel.org on behalf of Shawn Lin" wrote: JEDEC eMMC v5.1 introduce an autonomously initiated method for background operations. Host that wants to enable the device to perform background operations during device idle time, should signal the device by setting AUTO_EN in BKOPS_EN field EXT_CSD[163] to 1b. When this bit is set, the device may start or stop background operations whenever it sees fit, without any notification to the host. When AUTO_EN bit is set, the host should keep the device power active. The host may set or clear this bit at any time based on its power constraints or other considerations. Currently the manual bkops is only be used under the async req circumstances and it's a bit complicated to be controlled as the perfect method is that we should do some idle monitor just as rpm and send HPI each time if receiving rd/wr req. But it will impact performance significantly, especially for random iops since the weight of executing HPI against r/w small piece of LBAs is nonnegligible. So we now prefer to select the auto one unconditionally if supported which makes it as simple as possible. It should really good enough for devices to manage its internal policy for bkops rather than the host, which makes us believe that we could achieve the best performance for all the devices implementing auto bkops and the only thing we should do is to disable it when cutting off the power. Signed-off-by: Shawn Lin --- drivers/mmc/core/core.c | 127 +-- drivers/mmc/core/mmc.c | 30 ++- include/linux/mmc/card.h | 1 + include/linux/mmc/core.h | 4 +- include/linux/mmc/mmc.h | 1 + 5 files changed, 133 insertions(+), 30 deletions(-) diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c index e864187..c2e5a66 100644 --- a/drivers/mmc/core/core.c +++ b/drivers/mmc/core/core.c @@ -297,24 +297,13 @@ static int mmc_start_request(struct mmc_host *host, struct mmc_request *mrq) return 0; } -/** - * mmc_start_bkops - start BKOPS for supported cards - * @card: MMC card to start BKOPS - * @form_exception: A flag to indicate if this function was - * called due to an exception raised by the card - * - * Start background operations whenever requested. - * When the urgent BKOPS bit is set in a R1 command response - * then background operations should be started immediately. -*/ -void mmc_start_bkops(struct mmc_card *card, bool from_exception) +static void mmc_start_man_bkops(struct mmc_card *card, +bool from_exception) { int err; int timeout; bool use_busy_signal; - BUG_ON(!card); - if (!card->ext_csd.man_bkops_en || mmc_card_doing_bkops(card)) return; @@ -347,7 +336,7 @@ void mmc_start_bkops(struct mmc_card *card, bool from_exception) EXT_CSD_BKOPS_START, 1, timeout, use_busy_signal, true, false); if (err) { - pr_warn("%s: Error %d starting bkops\n", + pr_warn("%s: Error %d starting manual bkops\n", mmc_hostname(card->host), err); mmc_retune_release(card->host); goto out; @@ -365,6 +354,55 @@ void mmc_start_bkops(struct mmc_card *card, bool from_exception) out: mmc_release_host(card->host); } + +static void mmc_start_auto_bkops(struct mmc_card *card) +{ + int err; + + /* If it's already enable auto_bkops, nothing to do */ + if (card->ext_csd.auto_bkops_en) + return; + + mmc_claim_host(card->host); + + mmc_retune_hold(card->host); + + err = mmc_switch(card, EXT_CSD_CMD_SET_NORMAL, + EXT_CSD_BKOPS_EN, 2, + card->ext_csd.generic_cmd6_time); + if (err) + pr_warn("%s: Error %d starting auto bkops\n", + mmc_hostname(card->host), err); + + card->ext_csd.auto_bkops_en = true; + mmc_card_set_doing_bkops(card); + mmc_retune_release(card->host); + mmc_release_host(card->host); +} + + +/** + * mmc_start_bkops - start BKOPS for supported cards + * @card: MMC card to start BKOPS + * @form_exception: A flag to indicate if this function was + * called due to an exception raised by the card + * @is_auto: A flag to indicate if we should use auto bkops + * + * Start background operations whenever requested. + * When the urgent BKOPS bit is set in a R1 command response + * then background operations should be started immediately, which is + * only ne
fs/xfs/xfs_ondisk.h:79:2: error: call to '__compiletime_assert_79' declared with attribute error: XFS: sizeof(xfs_attr_shortform_t) is wrong, expected 8
Hi, FYI, the error/warning still remains. tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master head: 45b00c94be33db5d00595046663163ce55cbbfb9 commit: ab9d1e4f7b0217948a3b35a64178602ab30ff45d Merge branch 'xfs-misc-fixes-4.6-3' into for-next date: 3 months ago config: cris-allyesconfig (attached as .config) compiler: cris-linux-gcc (GCC) 4.6.3 reproduce: wget https://git.kernel.org/cgit/linux/kernel/git/wfg/lkp-tests.git/plain/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross git checkout ab9d1e4f7b0217948a3b35a64178602ab30ff45d # save the attached .config to linux build tree make.cross ARCH=cris All errors (new ones prefixed by >>): In file included from fs/xfs/xfs_super.c:48:0: In function 'xfs_check_ondisk_structs', inlined from 'init_xfs_fs' at fs/xfs/xfs_super.c:1862:26: >> fs/xfs/xfs_ondisk.h:79:2: error: call to '__compiletime_assert_79' declared >> with attribute error: XFS: sizeof(xfs_attr_shortform_t) is wrong, expected 8 vim +/__compiletime_assert_79 +79 fs/xfs/xfs_ondisk.h 30cbc591 Darrick J. Wong 2016-03-09 73 * definitions are updated to use c99 VLA definitions. 30cbc591 Darrick J. Wong 2016-03-09 74 * 30cbc591 Darrick J. Wong 2016-03-09 75 XFS_CHECK_STRUCT_SIZE(xfs_attr_leaf_name_remote_t, 12); 30cbc591 Darrick J. Wong 2016-03-09 76 */ 30cbc591 Darrick J. Wong 2016-03-09 77 30cbc591 Darrick J. Wong 2016-03-09 78 XFS_CHECK_STRUCT_SIZE(xfs_attr_leafblock_t, 40); 30cbc591 Darrick J. Wong 2016-03-09 @79 XFS_CHECK_STRUCT_SIZE(xfs_attr_shortform_t, 8); 30cbc591 Darrick J. Wong 2016-03-09 80 XFS_CHECK_STRUCT_SIZE(xfs_da_blkinfo_t, 12); 30cbc591 Darrick J. Wong 2016-03-09 81 XFS_CHECK_STRUCT_SIZE(xfs_da_intnode_t, 16); 30cbc591 Darrick J. Wong 2016-03-09 82 XFS_CHECK_STRUCT_SIZE(xfs_da_node_entry_t, 8); :: The code at line 79 was first introduced by commit :: 30cbc591c34e680e8b5d6d675ea49effe42a0570 xfs: check sizes of XFS on-disk structures at compile time :: TO: Darrick J. Wong :: CC: Dave Chinner --- 0-DAY kernel test infrastructureOpen Source Technology Center https://lists.01.org/pipermail/kbuild-all Intel Corporation .config.gz Description: Binary data
RE: [PATCH v2 0/4] ACPI 2.0: Enable TermList interpretion for table loading
Hi, > From: Wysocki, Rafael J > Subject: Re: [PATCH v2 0/4] ACPI 2.0: Enable TermList interpretion for > table loading > > On 5/20/2016 2:57 AM, Zheng, Lv wrote: > > Hi, Rafael > > > >> From: rjwyso...@gmail.com [mailto:rjwyso...@gmail.com] On Behalf > Of > >> Rafael J. Wysocki > >> Subject: Re: [PATCH v2 0/4] ACPI 2.0: Enable TermList interpretion for > table > >> loading > >> > >> On Tue, May 17, 2016 at 2:29 AM, Zheng, Lv > wrote: > >>> Hi, Rafael > >>> > >>> Can we queue this up in linux-next? > >>> ASLTS recursive tests are done in ACPICA upstream and no regressions > can be > >> seen. > >>> We need more tests around this experimental change from the real > users to > >> have the chances to learn the unknown cases. > >>> If they reported regressions, we could stop the regressions by > reverting > >> [PATCH 4/4]. > >>> So it should be safe to do such experiments in the Linux upstream. > >>> Thanks in advance. > >> There is a rule that during a merge window linux-next should only > >> contain material for that merge window. That is, currently linux-next > >> should only contain material targeted at v4.7. > >> > >> For this reason, I can't put the series into linux-next right now, but > >> I'll do that as soon as 4.7-rc1 is released. > > [Lv Zheng] > > Great! > > Thanks for the information. > > Unfortunately, it is reported that the series actually causes problems > to happen. > > I sent you a CC of my response to the report in question earlier today. [Lv Zheng] Could the problem be stopped by reverting PATCH 4/4? Let me check with the reporter to learn the case. Thanks and best regards -Lv
Re: [LKP] [lkp] [mm] 5c0a85fad9: unixbench.score -6.3% regression
On Sat, Jun 11, 2016 at 5:49 PM, Huang, Ying wrote: > > From perf profile, the time spent in page_fault and its children > functions are almost same (7.85% vs 7.81%). So the time spent in page > fault and page table operation itself doesn't changed much. So, you > mean CPU may be slower to load the page table entry to TLB if accessed > bit is not set? So the CPU does take a microfault internally when it needs to set the accessed/dirty bit. It's not architecturally visible, but you can see it when you do timing loops. I've timed it at over a thousand cycles on at least some CPU's, but that's still peanuts compared to a real page fault. It shouldn't be *that* noticeable, ie no way it's a 6% regression on its own. Linus
Re: [PATCH v4 0/2] Add a new Rockchip usb2 phy driver
Hi Heiko, On 2016/6/8 22:33, Heiko Stübner wrote: Hi Frank, Am Dienstag, 7. Juni 2016, 17:15:52 schrieb Frank Wang: The newer SoCs (rk3366, rk3399) of Rock-chip take a different usb-phy IP block than rk3288 and before, and most of phy-related registers are also different from the past, so a new phy driver is required necessarily. These series patches add phy-rockchip-inno-usb2.c and the corresponding documentation. please see the replies on the v3 thread (regarding handling of multiple phy blocks) . OK, I just got back from Dragon Boat Festival (one of the great traditions of my nation's festival), I will correct it and send out later today. BR. Frank Changes in v4: - Used 'phy-supply' instead of 'vbus_*-supply'. Changes in v3: - Supplemented some hardware-description into the devicetree bindings. - Resolved the mapping defect between fixed value in driver and the property in devicetree. - Code cleanup. Changes in v2: - Specified more hardware-description into the devicetree bindings. - Optimized some process of driver. Frank Wang (2): Documentation: bindings: add DT documentation for Rockchip USB2PHY phy: rockchip-inno-usb2: add a new driver for Rockchip usb2phy .../bindings/phy/phy-rockchip-inno-usb2.txt| 62 ++ drivers/phy/Kconfig|7 + drivers/phy/Makefile |1 + drivers/phy/phy-rockchip-inno-usb2.c | 614 4 files changed, 684 insertions(+) create mode 100644 Documentation/devicetree/bindings/phy/phy-rockchip-inno-usb2.txt create mode 100644 drivers/phy/phy-rockchip-inno-usb2.c
Re: PROBLEM: Resume form hibernate broken by setting NX on gap
On Saturday, June 11, 2016 11:39:48 AM Logan Gunthorpe wrote: > Hey Rafael, > > I tried this patch as well and there was no change. > > I have a couple tentative observations to make though. None of this is > 100% clear to me so please correct me if I'm wrong anywhere: > > 1) Commit ab76f7b4ab only extends the NX bit between __ex_table and > rodata; which, by my understanding, shouldn't be used by anything. And > __ex_table and rodata are fixed by the kernel's binary so both symbols > should be the same in both the image kernel and the boot kernel given > that both are running from the same binary. Well, what if the kernel is relocated? > 2) When ab76f7b4ab is reverted, hibernation seems to work 100%. Though, > when it's in place, it only works some of the time. Given that commit is > only extending the NX region a bit, if there is some random mismatch, > why does it never reach rodata? In other words, why is rodata a magic > line that seems to work all the time -- why doesn't this random mismatch > ever extend into the rodata region? rodata isn't _that_ far away from > the end of ex_table. That's a very good question. :-) Overall, it looks like re-using the boot kernel text mapping in the temporary page tables is a bad idea. I guess a temporary kernel text mapping is needed too or at least the existing one has to be modified to cover the trampoline code properly. > Anyway, thanks again for looking into this. No problem. I haven't helped much so far, though ... Can you please check if the patch below makes any difference? --- arch/x86/power/hibernate_64.c | 19 +++ 1 file changed, 15 insertions(+), 4 deletions(-) Index: linux-pm/arch/x86/power/hibernate_64.c === --- linux-pm.orig/arch/x86/power/hibernate_64.c +++ linux-pm/arch/x86/power/hibernate_64.c @@ -12,6 +12,7 @@ #include #include +#include #include #include #include @@ -27,7 +28,7 @@ extern asmlinkage __visible int restore_ * Address to jump to in the last phase of restore in order to get to the image * kernel's text (this value is passed in the image header). */ -unsigned long restore_jump_address __visible; +void *restore_jump_address __visible; /* * Value of the cr3 register from before the hibernation (this value is passed @@ -108,7 +109,7 @@ int pfn_is_nosave(unsigned long pfn) } struct restore_data_record { - unsigned long jump_address; + void *jump_address; unsigned long cr3; unsigned long magic; }; @@ -126,7 +127,7 @@ int arch_hibernation_header_save(void *a if (max_size < sizeof(struct restore_data_record)) return -EOVERFLOW; - rdr->jump_address = restore_jump_address; + rdr->jump_address = &restore_registers; rdr->cr3 = restore_cr3; rdr->magic = RESTORE_MAGIC; return 0; @@ -140,8 +141,18 @@ int arch_hibernation_header_save(void *a int arch_hibernation_header_restore(void *addr) { struct restore_data_record *rdr = addr; + unsigned long text_end, all_end; + + if (rdr->magic != RESTORE_MAGIC) + return -EINVAL; restore_jump_address = rdr->jump_address; restore_cr3 = rdr->cr3; - return (rdr->magic == RESTORE_MAGIC) ? 0 : -EINVAL; + + text_end = PFN_ALIGN(&__stop___ex_table); + all_end = roundup((unsigned long)restore_jump_address, PMD_SIZE); + if (all_end > text_end) + set_memory_x(text_end, (all_end - text_end) >> PAGE_SHIFT); + + return 0; }
include/linux/hrtimer.h:194:1: error: requested alignment is not an integer constant
Hi, FYI, the error/warning still remains. tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master head: 45b00c94be33db5d00595046663163ce55cbbfb9 commit: 6d9a1411393d51f17bee3fe163430b21b2cb2de9 hrtimer: Cache line align the hrtimer cpu base date: 1 year, 2 months ago config: frv-allnoconfig (attached as .config) compiler: frv-linux-gcc (GCC) 4.9.0 reproduce: wget https://git.kernel.org/cgit/linux/kernel/git/wfg/lkp-tests.git/plain/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross git checkout 6d9a1411393d51f17bee3fe163430b21b2cb2de9 # save the attached .config to linux build tree make.cross ARCH=frv All errors (new ones prefixed by >>): kernel/time/Kconfig:157:warning: range is invalid In file included from include/linux/cache.h:5:0, from include/linux/printk.h:8, from include/linux/kernel.h:13, from include/linux/sched.h:17, from arch/frv/kernel/asm-offsets.c:7: arch/frv/include/asm/cache.h:17:26: error: 'CONFIG_FRV_L1_CACHE_SHIFT' undeclared here (not in a function) #define L1_CACHE_SHIFT (CONFIG_FRV_L1_CACHE_SHIFT) ^ arch/frv/include/asm/cache.h:18:31: note: in expansion of macro 'L1_CACHE_SHIFT' #define L1_CACHE_BYTES (1 << L1_CACHE_SHIFT) ^ arch/frv/include/asm/cache.h:21:54: note: in expansion of macro 'L1_CACHE_BYTES' #define cacheline_aligned __attribute__((aligned(L1_CACHE_BYTES))) ^ include/linux/hrtimer.h:194:3: note: in expansion of macro 'cacheline_aligned' } cacheline_aligned; ^ In file included from include/linux/sched.h:53:0, from arch/frv/kernel/asm-offsets.c:7: >> include/linux/hrtimer.h:194:1: error: requested alignment is not an integer >> constant } cacheline_aligned; ^ make[2]: *** [arch/frv/kernel/asm-offsets.s] Error 1 make[2]: Target '__build' not remade because of errors. make[1]: *** [prepare0] Error 2 make[1]: Target 'prepare' not remade because of errors. make: *** [sub-make] Error 2 vim +194 include/linux/hrtimer.h 188 unsigned intnr_events; 189 unsigned intnr_retries; 190 unsigned intnr_hangs; 191 unsigned intmax_hang_time; 192 #endif 193 struct hrtimer_clock_base clock_base[HRTIMER_MAX_CLOCK_BASES]; > 194 } cacheline_aligned; 195 196 static inline void hrtimer_set_expires(struct hrtimer *timer, ktime_t time) 197 { --- 0-DAY kernel test infrastructureOpen Source Technology Center https://lists.01.org/pipermail/kbuild-all Intel Corporation .config.gz Description: Binary data
Re: [LKP] [lkp] [mm] 5c0a85fad9: unixbench.score -6.3% regression
"Kirill A. Shutemov" writes: > On Wed, Jun 08, 2016 at 04:41:37PM +0800, Huang, Ying wrote: >> "Huang, Ying" writes: >> >> > "Kirill A. Shutemov" writes: >> > >> >> On Mon, Jun 06, 2016 at 10:27:24AM +0800, kernel test robot wrote: >> >>> >> >>> FYI, we noticed a -6.3% regression of unixbench.score due to commit: >> >>> >> >>> commit 5c0a85fad949212b3e059692deecdeed74ae7ec7 ("mm: make faultaround >> >>> produce old ptes") >> >>> https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master >> >>> >> >>> in testcase: unixbench >> >>> on test machine: lituya: 16 threads Haswell High-end Desktop (i7-5960X >> >>> 3.0G) with 16G memory >> >>> with following parameters: >> >>> cpufreq_governor=performance/nr_task=1/test=shell8 >> >>> >> >>> >> >>> Details are as below: >> >>> --> >> >>> >> >>> >> >>> = >> >>> compiler/cpufreq_governor/kconfig/nr_task/rootfs/tbox_group/test/testcase: >> >>> >> >>> gcc-4.9/performance/x86_64-rhel/1/debian-x86_64-2015-02-07.cgz/lituya/shell8/unixbench >> >>> >> >>> commit: >> >>> 4b50bcc7eda4d3cc9e3f2a0aa60e590fedf728c5 >> >>> 5c0a85fad949212b3e059692deecdeed74ae7ec7 >> >>> >> >>> 4b50bcc7eda4d3cc 5c0a85fad949212b3e059692de >> >>> -- >> >>>fail:runs %reproductionfail:runs >> >>>| | | >> >>> 3:4 -75%:4 >> >>> kmsg.DHCP/BOOTP:Reply_not_for_us,op[#]xid[#] >> >>> %stddev %change %stddev >> >>> \ |\ >> >>> 14321 . 0% -6.3% 13425 . 0% unixbench.score >> >>>1996897 . 0% -6.1%1874635 . 0% >> >>> unixbench.time.involuntary_context_switches >> >>> 1.721e+08 . 0% -6.2% 1.613e+08 . 0% >> >>> unixbench.time.minor_page_faults >> >>> 758.65 . 0% -3.0% 735.86 . 0% unixbench.time.system_time >> >>> 387.66 . 0% +5.4% 408.49 . 0% unixbench.time.user_time >> >>>5950278 . 0% -6.2%5583456 . 0% >> >>> unixbench.time.voluntary_context_switches >> >> >> >> That's weird. >> >> >> >> I don't understand why the change would reduce number or minor faults. >> >> It should stay the same on x86-64. Rise of user_time is puzzling too. >> > >> > unixbench runs in fixed time mode. That is, the total time to run >> > unixbench is fixed, but the work done varies. So the minor_page_faults >> > change may reflect only the work done. >> > >> >> Hm. Is reproducible? Across reboot? >> > >> >> And FYI, there is no swap setup for test, all root file system including >> benchmark files are in tmpfs, so no real page reclaim will be >> triggered. But it appears that active file cache reduced after the >> commit. >> >> 111331 . 1% -13.3% 96503 . 0% meminfo.Active >> 27603 . 1% -43.9% 15486 . 0% meminfo.Active(file) >> >> I think this is the expected behavior of the commit? > > Yes, it's expected. > > After the change faularound would produce old pte. It means there's more > chance for these pages to be on inactive lru, unless somebody actually > touch them and flip accessed bit. > > I wounder if this regression can attributed to cost of setting accessed > bit. It looks too high, but who knows. >From perf profile, the time spent in page_fault and its children functions are almost same (7.85% vs 7.81%). So the time spent in page fault and page table operation itself doesn't changed much. So, you mean CPU may be slower to load the page table entry to TLB if accessed bit is not set? > I don't have time to do testing myself right now. I will put this on todo > list. Which kind of test your want to do? I want to check whether I can help. Best Regards, Huang, Ying
Re: VFS regression ? Re: disfunctional floppy driver in kernels 4.5, 4.6 and 4.7
On Sat, Jun 11, 2016 at 02:15:01PM +0100, One Thousand Gnomes wrote: > > open(/dev/fd0, O_ACCMODE) = -1 > If you do > > touch foo > > then compile and run the following program does it error on the newer > kernel ? > > #include > #include > > int main(int argc, char *argv[]) > { > if (open("foo", 3) == -1) > perror("foo"); > return 0; > } No errors get printed for kernel 4.4 to 4.7 . Regards, Wim. - w...@djo.tudelft.nl -
[PATCH] vfs: add simple direct-mapped dcache lookup front-end
This is an old patch by Linus that he asked if I could fix the race conditions in. Posted for comment on the RCU abuse (search for "Evil RCU Hack") and performance in general. [Linus speaking, Thu May 31, 2012] I've pushed __d_lookup_rcu() just about as far as I could, and it still had some problems. The problems were mainly due to: - the complexity of the slow-case handling causes register spills, - the hash chain lookup loop causes not only register pressure, but also the extra magic "mask off lock bit from the hash chain head pointer" etc. logic, and - the hash list needs to be dynamically sized (we want *big* caches, but you can't use the same size for big and small machines), which causes the initial hash lookup itself to be more complex. This looks like a viable solution to all three problems, and it is actually surprisingly simple: make a trivial fixed-size direct-mapped L1 dentry cache. No chains, no locking, no nothing. This gives measurable improvement on my microbenchmark, and gets good hit-rates on both kernel compiles and even on something like "updatedb", which I'd have expected to be one of the worst possible cases. Apparently updatedb still ends up looking up the same files (/etc/fstab etc) a lot. So those good hit-rates seem to often be due to really stupid programming, but hey, I think we all agree that "stupid programming" is likely the common case that we generally do need to also optimize for ;) For my kernel compile benchmark ("make -j" on a fully built tree), the profile shows (this is kernel-only profile, so user space overhead removed): 8.19% [k] link_path_walk 7.74% [k] __d_lookup_rcu 5.66% [k] selinux_inode_permission 3.73% [k] do_lookup 2.86% [k] path_lookupat 2.72% [k] avc_has_perm_noaudit 2.71% [k] inode_has_perm.isra.49.constprop.71 2.68% [k] avc_lookup 2.51% [k] generic_permission ... 0.78% [k] __d_lookup_rcu_slow ... where "__d_lookup_rcu_slow()" is the exact same old __d_lookup_rcu(), so it's not really "slow", but it's quite noticeably slower than the new streamlined __d_lookup_rcu(). And as you can tell, that means that we must have a 90%+ hitrate in the new L1 dcache lookup, since we only see 10% as much time in the slow routine as in the L1 front-end. [George Spelvin speaking] I fixed the race conditions in Linus's code, added Kconfig support, and a number of comments. I have two concerns about the performance of this code: 1) Since it was first written, RCU dcache lookup has gone completely lockless and is even faster. 2) By adding a shared data structure that is written randomly by multiple CPUs, this patch undoes a lot of that optimization. Even if it's a win on a single-socket system, it may be a net loss on a larger one. Cc: Al Viro Cc: Nick Piggin Cc: Miklos Szeredi Cc: Paul E. McKenney Signed-off-by: Linus Torvalds Signed-off-by: George Spelvin --- [Damn it, mail aliases screwed up.] fs/Kconfig | 28 fs/dcache.c | 207 ++-- 2 files changed, 231 insertions(+), 4 deletions(-) diff --git a/fs/Kconfig b/fs/Kconfig index b8fcb416..3b111b77 100644 --- a/fs/Kconfig +++ b/fs/Kconfig @@ -8,6 +8,34 @@ menu "File systems" config DCACHE_WORD_ACCESS bool +config L1_DCACHE_BITS + int "Dcache level-1 cache size (bits)" + range 0 20 + default 0 if !EXPERT + default 0 if NUMA + default 10 if BASE_SMALL + default 13 + help + The Linus kernel maintains a large cache of "dentries" + (directory entries) for the performance-critical task of + converting file names to inodes. This option enables a smaller + direct-mapped "level-1 cache" in front of the main dcache. + + (This software "dcache" is quite different from the CPU's data + cache, or "D-cache". Sorry for the confusingly similar names.) + + This option specifies the size of this cache, as a power of 2. + For example, 13 means 2^13 = 8192 entries in the L1 dcache. + Specify 0 to turn off the L1 dcache entirely. + + The cost of enabling this is one pointer per entry, plus a + small amount of code. + + This is an experimental feature which hopes to speed up + single-socket machines. On larger systems, the extra updates + generated by the L1 dcache probably cause too much cache-line + bouncing to be worth it. + if BLOCK source "fs/ext2/Kconfig" diff --git a/fs/dcache.c b/fs/dcache.c index 35c989f2..941f5232 100644 --- a/fs/dcache.c +++ b/fs/dcache.c @@ -278,6 +278,44 @@ static inline int dname_external(const struct dentry *dentry) return dentry->d_name.name != dentry->d_iname; } +#if CONFIG_L1_DCACHE_BITS > 0 +/* + * Reschedule RCU reclamation for the *next* grace period. + * That's a longer wait than usually necessary, but this is so rare + * that optimizing it is not important. + */ +static void __d_free_delayed(struct r
[GIT PULL] GPIO fixes for v4.7 take two
Hi Linus, a new bunch of GPIO fixes for v4.7. This time I am very grateful that Ricardo Ribalda Delgado went in and fixed my stupid refcounting mistakes in the removal path for GPIO chips. I had a feeling something was wrong here and so it was. It exploded on OMAP and it fixes their problem. Now it should be (more) solid. The rest i compilation, Kconfig and driver fixes. Some tagged for stable. Please pull it in! Yours, Linus Walleij The following changes since commit af8c34ce6ae32addda3788d54a7e340cad22516b: Linux 4.7-rc2 (2016-06-05 14:31:26 -0700) are available in the git repository at: git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-gpio.git tags/gpio-v4.7-3 for you to fetch changes up to b66b2a0adf0e48973b582e055758b9907a7eee7c: gpio: bcm-kona: fix bcm_kona_gpio_reset() warnings (2016-06-08 14:04:35 +0200) GPIO fixes for the v4.7 series: - Fix a NULL pointer dereference when we are searching the GPIO device list but one of the devices have been removed (struct gpio_chip pointer is NULL). - Fix unaligned reference counters: we were ending on +3 after all said and done. It should be 0. Remove an extraneous get_device(), and call cdev_del() followed by device_del() in gpiochip_remove() instead and the count goes to zero and calls the release() function properly. - Fix a compile warning due to a missing #include in the OF/device tree portions. - Select ANON_INODES for GPIOLIB, we're using that for our character device. Some randconfig tests disclosed the problem. - Make sure the Zynq driver clock runs also without CONFIG_PM enabled - Fix an off-by-one error in the 104-DIO-48E driver - Fix warnings in bcm_kona_gpio_reset() Ben Dooks (1): gpio: bcm-kona: fix bcm_kona_gpio_reset() warnings Helmut Grohne (1): gpio: zynq: initialize clock even without CONFIG_PM Linus Walleij (2): gpio: include in gpiolib-of gpio: select ANON_INODES Ricardo Ribalda Delgado (2): gpiolib: Fix NULL pointer deference gpiolib: Fix unaligned used of reference counters William Breathitt Gray (1): gpio: 104-dio-48e: Fix control port offset computation off-by-one error drivers/gpio/Kconfig| 1 + drivers/gpio/gpio-104-dio-48e.c | 4 ++-- drivers/gpio/gpio-bcm-kona.c| 4 ++-- drivers/gpio/gpio-zynq.c| 7 +++ drivers/gpio/gpiolib-of.c | 1 + drivers/gpio/gpiolib.c | 6 +++--- 6 files changed, 16 insertions(+), 7 deletions(-)
{standard input}:136: Error: number (0x9000000080000000) larger than 32 bits
Hi, FYI, the error/warning still remains. tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master head: 45b00c94be33db5d00595046663163ce55cbbfb9 commit: de361e8bb9f666235d44ae9770238718be4f0483 MIPS: JZ4740: introduce CONFIG_MACH_INGENIC date: 12 months ago config: mips-jz4740 (attached as .config) compiler: mips-linux-gnu-gcc (Debian 5.3.1-8) 5.3.1 20160205 reproduce: wget https://git.kernel.org/cgit/linux/kernel/git/wfg/lkp-tests.git/plain/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross git checkout de361e8bb9f666235d44ae9770238718be4f0483 # save the attached .config to linux build tree make.cross ARCH=mips All errors (new ones prefixed by >>): {standard input}: Assembler messages: >> {standard input}:136: Error: number (0x90008000) larger than 32 bits {standard input}:161: Error: number (0x90008000) larger than 32 bits --- 0-DAY kernel test infrastructureOpen Source Technology Center https://lists.01.org/pipermail/kbuild-all Intel Corporation .config.gz Description: Binary data
[very-RFC 6/8] Add TSN event-tracing
From: Henrik Austad This needs refactoring and should be updated to use TRACE_CLASS, but for now it provides a fair debug-window into TSN. Cc: "David S. Miller" Cc: Steven Rostedt (maintainer:TRACING) Cc: Ingo Molnar (maintainer:TRACING) Signed-off-by: Henrik Austad --- include/trace/events/tsn.h | 349 + 1 file changed, 349 insertions(+) create mode 100644 include/trace/events/tsn.h diff --git a/include/trace/events/tsn.h b/include/trace/events/tsn.h new file mode 100644 index 000..ac1f31b --- /dev/null +++ b/include/trace/events/tsn.h @@ -0,0 +1,349 @@ +#undef TRACE_SYSTEM +#define TRACE_SYSTEM tsn + +#if !defined(_TRACE_TSN_H) || defined(TRACE_HEADER_MULTI_READ) +#define _TRACE_TSN_H + +#include +#include + +#include +#include +/* #include */ + +/* FIXME: update to TRACE_CLASS to reduce overhead */ +TRACE_EVENT(tsn_buffer_write, + + TP_PROTO(struct tsn_link *link, + size_t bytes), + + TP_ARGS(link, bytes), + + TP_STRUCT__entry( + __field(u64, stream_id) + __field(size_t, size) + __field(size_t, bsize) + __field(size_t, size_left) + __field(void *, buffer) + __field(void *, head) + __field(void *, tail) + __field(void *, end) + ), + + TP_fast_assign( + __entry->stream_id = link->stream_id; + __entry->size = bytes; + __entry->bsize = link->used_buffer_size; + __entry->size_left = (link->head - link->tail) % link->used_buffer_size; + __entry->buffer = link->buffer; + __entry->head = link->head; + __entry->tail = link->tail; + __entry->end = link->end; + ), + + TP_printk("stream_id=%llu, copy=%zd, buffer: %zd, avail=%zd, [buffer=%p, head=%p, tail=%p, end=%p]", + __entry->stream_id, __entry->size, __entry->bsize, __entry->size_left, + __entry->buffer,__entry->head, __entry->tail, __entry->end) + + ); + +TRACE_EVENT(tsn_buffer_write_net, + + TP_PROTO(struct tsn_link *link, + size_t bytes), + + TP_ARGS(link, bytes), + + TP_STRUCT__entry( + __field(u64, stream_id) + __field(size_t, size) + __field(size_t, bsize) + __field(size_t, size_left) + __field(void *, buffer) + __field(void *, head) + __field(void *, tail) + __field(void *, end) + ), + + TP_fast_assign( + __entry->stream_id = link->stream_id; + __entry->size = bytes; + __entry->bsize = link->used_buffer_size; + __entry->size_left = (link->head - link->tail) % link->used_buffer_size; + __entry->buffer = link->buffer; + __entry->head = link->head; + __entry->tail = link->tail; + __entry->end = link->end; + ), + + TP_printk("stream_id=%llu, copy=%zd, buffer: %zd, avail=%zd, [buffer=%p, head=%p, tail=%p, end=%p]", + __entry->stream_id, __entry->size, __entry->bsize, __entry->size_left, + __entry->buffer,__entry->head, __entry->tail, __entry->end) + + ); + + +TRACE_EVENT(tsn_buffer_read, + + TP_PROTO(struct tsn_link *link, + size_t bytes), + + TP_ARGS(link, bytes), + + TP_STRUCT__entry( + __field(u64, stream_id) + __field(size_t, size) + __field(size_t, bsize) + __field(size_t, size_left) + __field(void *, buffer) + __field(void *, head) + __field(void *, tail) + __field(void *, end) + ), + + TP_fast_assign( + __entry->stream_id = link->stream_id; + __entry->size = bytes; + __entry->bsize = link->used_buffer_size; + __entry->size_left = (link->head - link->tail) % link->used_buffer_size; + __entry->buffer = link->buffer; + __entry->head = link->head; + __entry->tail = link->tail; + __entry->end = link->end; + ), + + TP_printk("stream_id=%llu, copy=%zd, buffer: %zd, avail=%zd, [buffer=%p, head=%p, tail=%p, end=%p]", + __entry->stream_id, __entry->size, __entry->bsize, __entry->size_left, + __entry->buffer,__entry->head, __entry->tail, __entry->end) + + ); + +TRACE_EVENT(tsn_refill, + + TP_PROTO(struct tsn_link *link, + size_t reported_avail), + + TP_ARGS(link, reported_avail), + + TP_STRUCT__entry( + __field(u64, stream_id) + __field(size_t, bsize) + __field(size_t, size_left) + __field(size_t, reported_left) +
[very-RFC 4/8] Add TSN header for the driver
From: Henrik Austad This defines the general TSN headers for network packets, the shim-interface and the central 'tsn_list' structure. Cc: "David S. Miller" Signed-off-by: Henrik Austad --- include/linux/tsn.h | 806 1 file changed, 806 insertions(+) create mode 100644 include/linux/tsn.h diff --git a/include/linux/tsn.h b/include/linux/tsn.h new file mode 100644 index 000..0e1f732b --- /dev/null +++ b/include/linux/tsn.h @@ -0,0 +1,806 @@ +/* TSN - Time Sensitive Networking + * + * Copyright (C) 2016- Henrik Austad + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + */ +#ifndef _TSN_H +#define _TSN_H +#include +#include +#include + +/* The naming here can be a bit confusing as we call it TSN but naming + * suggests 'AVB'. Reason: IEE 1722 was written before the working group + * was renamed to Time Sensitive Networking. + * + * To be precise. TSN describes the protocol for shipping data, AVB is a + * medialayer which you can build on top of TSN. + * + * For this reason the frames are given avb-names whereas the functions + * use tsn_-naming. + */ + +/* 7 bit value 0x00 - 0x7F */ +enum avtp_subtype { + AVTP_61883_IIDC = 0, + AVTP_MMA = 0x1, + AVTP_MAAP = 0x7e, + AVTP_EXPERIMENTAL = 0x7f, +}; + +/* NOTE NOTE NOTE !! + * The headers below use bitfields extensively and verifications + * are needed when using little-endian vs big-endian systems. + */ + +/* Common part of avtph header + * + * AVB Transport Protocol Common Header + * + * Defined in 1722-2011 Sec. 5.2 + */ +struct avtp_ch { +#if defined(__LITTLE_ENDIAN_BITFIELD) + /* use avtp_subtype enum. +*/ + u8 subtype:7; + + /* Controlframe: 1 +* Dataframe : 0 +*/ + u8 cd:1; + + /* Type specific data, part 1 */ + u8 tsd_1:4; + + /* In current version of AVB, only 0 is valid, all other values +* are reserved for future versions. +*/ + u8 version:3; + + /* Valid StreamID in frame +* +* ControlData not related to a specific stream should clear +* this (and have stream_id = 0), _all_ other values should set +* this to 1. +*/ + u8 sv:1; +#elif defined(__BIG_ENDIAN_BITFIELD) + u8 cd:1; + u8 subtype:7; + u8 sv:1; + u8 version:3; + u8 tsd_1:4; +#else +#error "Unknown Endianness, cannot determine bitfield ordering" +#endif + /* Type specific data (adjacent to tsd_1, but split due to bitfield) */ + u16 tsd_2; + u64 stream_id; + + /* +* payload by subtype +*/ + u8 pbs[0]; +} __packed; + +/* AVTPDU Common Control header format + * IEEE 1722#5.3 + */ +struct avtpc_header { +#if defined(__LITTLE_ENDIAN_BITFIELD) + u8 subtype:7; + u8 cd:1; + u8 control_data:4; + u8 version:3; + u8 sv:1; + u16 control_data_length:11; + u16 status:5; +#elif defined(__BIG_ENDIAN_BITFIELD) + u8 cd:1; + u8 subtype:7; + u8 sv:1; + u8 version:3; + u8 control_data:4; + u16 status:5; + u16 control_data_length:11; +#else +#error "Unknown Endianness, cannot determine bitfield ordering" +#endif + u64 stream_id; +} __packed; + +/* AVTP common stream data AVTPDU header format + * IEEE 1722#5.4 + */ +struct avtpdu_header { +#if defined(__LITTLE_ENDIAN_BITFIELD) + u8 subtype:7; + u8 cd:1; + + /* avtp_timestamp valid */ + u8 tv: 1; + + /* gateway_info valid */ + u8 gv:1; + + /* reserved */ + u8 r:1; + + /* +* Media clock Restart toggle +*/ + u8 mr:1; + + u8 version:3; + + /* StreamID valid */ + u8 sv:1; + u8 seqnr; + + /* Timestamp uncertain */ + u8 tu:1; + u8 r2:7; +#elif defined(__BIG_ENDIAN_BITFIELD) + u8 cd:1; + u8 subtype:7; + + u8 sv:1; + u8 version:3; + u8 mr:1; + u8 r:1; + u8 gv:1; + u8 tv: 1; + + u8 seqnr; + u8 r2:7; + u8 tu:1; +#else +#error "Unknown Endianness, cannot determine bitfield ordering" +#endif + + u64 stream_id; + + u32 avtp_timestamp; + u32 gateway_info; + + /* Stream Data Length */ + u16 sd_len; + + /* Protocol specific header, derived from avtp_subtype */ + u16 psh; + + /* Stream Payload Data 0 to n octets +* n so that total size < MTU +*/ + u8 data[0];
[very-RFC 5/8] Add TSN machinery to drive the traffic from a shim over the network
From: Henrik Austad In short summary: * tsn_core.c is the main driver of tsn, all new links go through here and all data to/form the shims are handled here core also manages the shim-interface. * tsn_configfs.c is the API to userspace. TSN is driven from userspace and a link is created, configured, enabled, disabled and removed purely from userspace. All attributes requried must be determined by userspace, preferrably via IEEE 1722.1 (discovery and enumeration). * tsn_header.c small part that handles the actual header of the frames we send. Kept out of core for cleanliness. * tsn_net.c handles operations towards the networking layer. The current driver is under development. This means that from the moment it is enabled with a shim, it will send traffic, either 0-traffic (frames of reserved length but with payload 0) or actual traffic. This will change once the driver stabilizes. For more detail, see Documentation/networking/tsn/ Cc: "David S. Miller" Signed-off-by: Henrik Austad --- net/Makefile | 1 + net/tsn/Makefile | 6 + net/tsn/tsn_configfs.c | 623 +++ net/tsn/tsn_core.c | 975 + net/tsn/tsn_header.c | 203 ++ net/tsn/tsn_internal.h | 383 +++ net/tsn/tsn_net.c | 403 7 files changed, 2594 insertions(+) create mode 100644 net/tsn/Makefile create mode 100644 net/tsn/tsn_configfs.c create mode 100644 net/tsn/tsn_core.c create mode 100644 net/tsn/tsn_header.c create mode 100644 net/tsn/tsn_internal.h create mode 100644 net/tsn/tsn_net.c diff --git a/net/Makefile b/net/Makefile index bdd1455..c15482e 100644 --- a/net/Makefile +++ b/net/Makefile @@ -79,3 +79,4 @@ ifneq ($(CONFIG_NET_L3_MASTER_DEV),) obj-y += l3mdev/ endif obj-$(CONFIG_QRTR) += qrtr/ +obj-$(CONFIG_TSN) += tsn/ diff --git a/net/tsn/Makefile b/net/tsn/Makefile new file mode 100644 index 000..0d87687 --- /dev/null +++ b/net/tsn/Makefile @@ -0,0 +1,6 @@ +# +# Makefile for the Linux TSN subsystem +# + +obj-$(CONFIG_TSN) += tsn.o +tsn-objs :=tsn_core.o tsn_configfs.o tsn_net.o tsn_header.o diff --git a/net/tsn/tsn_configfs.c b/net/tsn/tsn_configfs.c new file mode 100644 index 000..f3d0986 --- /dev/null +++ b/net/tsn/tsn_configfs.c @@ -0,0 +1,623 @@ +/* + * ConfigFS interface to TSN + * Copyright (C) 2015- Henrik Austad + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + */ +#include +#include +#include +#include +#include +#include +#include +#include "tsn_internal.h" + +static inline struct tsn_link *to_tsn_link(struct config_item *item) +{ + /* this line causes checkpatch to WARN. making checkpatch happy, +* makes code messy.. +*/ + return item ? container_of(to_config_group(item), struct tsn_link, group) : NULL; +} + +static inline struct tsn_nic *to_tsn_nic(struct config_group *group) +{ + return group ? container_of(group, struct tsn_nic, group) : NULL; +} + +/* --- + * Tier2 attributes + * + * The content of the links userspace can see/modify + * --- +*/ +static ssize_t _tsn_max_payload_size_show(struct config_item *item, + char *page) +{ + struct tsn_link *link = to_tsn_link(item); + + if (!link) + return -EINVAL; + return sprintf(page, "%u\n", (u32)link->max_payload_size); +} + +static ssize_t _tsn_max_payload_size_store(struct config_item *item, + const char *page, size_t count) +{ + struct tsn_link *link = to_tsn_link(item); + u16 mpl_size = 0; + int ret = 0; + + if (!link) + return -EINVAL; + if (tsn_link_is_on(link)) { + pr_err("ERROR: Cannot change Payload size on on enabled link\n"); + return -EINVAL; + } + ret = kstrtou16(page, 0, &mpl_size); + if (ret) + return ret; + + /* 802.1BA-2011 6.4 payload must be <1500 octets (excluding +* headers, tags etc) However, this is not directly mappable to +* how some hw handles things, so to be conservative, we +* restrict it down to [26..1485] +* +* This is also the _payload_ size, which does not include the +* AVTPDU header. This is an upper limit to how much raw data +* th
[very-RFC 0/8] TSN driver for the kernel
Hi all (series based on v4.7-rc2, now with the correct netdev) This is a *very* early RFC for a TSN-driver in the kernel. It has been floating around in my repo for a while and I would appreciate some feedback on the overall design to avoid doing some major blunders. TSN: Time Sensitive Networking, formely known as AVB (Audio/Video Bridging). There are at least one AVB-driver (the AV-part of TSN) in the kernel already, however this driver aims to solve a wider scope as TSN can do much more than just audio. A very basic ALSA-driver is added to the end that allows you to play music between 2 machines using aplay in one end and arecord | aplay on the other (some fiddling required) We have plans for doing the same for v4l2 eventually (but there are other fishes to fry first). The same goes for a TSN_SOCK type approach as well. TSN is all about providing infrastructure. Allthough there are a few very interesting uses for TSN (reliable, deterministic network for audio and video), once you have that reliable link, you can do a lot more. Some notes on the design: The driver is directed via ConfigFS as we need userspace to handle stream-reservation (MSRP), discovery and enumeration (IEEE 1722.1) and whatever other management is needed. Once we have all the required attributes, we can create link using mkdir, and use write() to set the attributes. Once ready, specify the 'shim' (basically a thin wrapper between TSN and another subsystem) and we start pushing out frames. The network part: it ties directly into the rx-handler for receive and writes skb's using netdev_start_xmit(). This could probably be improved. 2 new fields in netdev_ops have been introduced, and the Intel igb-driver has been updated (as this is available as a PCI-e card). The igb-driver works-ish What remains - tie to (g)PTP properly, currently using ktime_get() for presentation time - get time from shim into TSN and vice versa - let shim create/manage buffer Henrik Austad (8): TSN: add documentation TSN: Add the standard formerly known as AVB to the kernel Adding TSN-driver to Intel I210 controller Add TSN header for the driver Add TSN machinery to drive the traffic from a shim over the network Add TSN event-tracing AVB ALSA - Add ALSA shim for TSN MAINTAINERS: add TSN/AVB-entries Documentation/TSN/tsn.txt | 147 + MAINTAINERS | 14 + drivers/media/Kconfig | 15 + drivers/media/Makefile| 3 +- drivers/media/avb/Makefile| 5 + drivers/media/avb/avb_alsa.c | 742 +++ drivers/media/avb/tsn_iec61883.h | 124 drivers/net/ethernet/intel/Kconfig| 18 + drivers/net/ethernet/intel/igb/Makefile | 2 +- drivers/net/ethernet/intel/igb/igb.h | 19 + drivers/net/ethernet/intel/igb/igb_main.c | 10 +- drivers/net/ethernet/intel/igb/igb_tsn.c | 396 include/linux/netdevice.h | 32 + include/linux/tsn.h | 806 include/trace/events/tsn.h| 349 +++ net/Kconfig | 1 + net/Makefile | 1 + net/tsn/Kconfig | 32 + net/tsn/Makefile | 6 + net/tsn/tsn_configfs.c| 623 +++ net/tsn/tsn_core.c| 975 ++ net/tsn/tsn_header.c | 203 +++ net/tsn/tsn_internal.h| 383 net/tsn/tsn_net.c | 403 24 files changed, 5306 insertions(+), 3 deletions(-) create mode 100644 Documentation/TSN/tsn.txt create mode 100644 drivers/media/avb/Makefile create mode 100644 drivers/media/avb/avb_alsa.c create mode 100644 drivers/media/avb/tsn_iec61883.h create mode 100644 drivers/net/ethernet/intel/igb/igb_tsn.c create mode 100644 include/linux/tsn.h create mode 100644 include/trace/events/tsn.h create mode 100644 net/tsn/Kconfig create mode 100644 net/tsn/Makefile create mode 100644 net/tsn/tsn_configfs.c create mode 100644 net/tsn/tsn_core.c create mode 100644 net/tsn/tsn_header.c create mode 100644 net/tsn/tsn_internal.h create mode 100644 net/tsn/tsn_net.c -- 2.7.4
[very-RFC 8/8] MAINTAINERS: add TSN/AVB-entries
From: Henrik Austad Not sure how relevant this is other than making a point about maintaining it. Signed-off-by: Henrik Austad --- MAINTAINERS | 14 ++ 1 file changed, 14 insertions(+) diff --git a/MAINTAINERS b/MAINTAINERS index ed42cb6..ef5d926 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -11634,6 +11634,20 @@ T: git git://linuxtv.org/anttip/media_tree.git S: Maintained F: drivers/media/tuners/tua9001* +TSN CORE DRIVER +M: Henrik Austad +L: linux-kernel@vger.kernel.org +S: Supported +F: drivers/net/tsn/ +F: include/linux/tsn.h +F: include/trace/events/tsn.h + +TSN_AVB_DRIVER +M: Henrik Austad +L: alsa-de...@alsa-project.org (moderated for non-subscribers) +S: Supported +F: drivers/media/avb/ + TULIP NETWORK DRIVERS L: net...@vger.kernel.org L: linux-par...@vger.kernel.org -- 2.7.4
[very-RFC 2/8] TSN: Add the standard formerly known as AVB to the kernel
TSN provides a mechanism to create reliable, jitter-free, low latency guaranteed bandwidth links over a local network. It does this by reserving a path through the network. Support for TSN must be found in both the NIC as well as in the network itself. This adds required hooks into netdev_ops so that the core TSN driver can use this when configuring a new NIC or setting up a new link. Cc: "David S. Miller" Signed-off-by: Henrik Austad --- include/linux/netdevice.h | 32 net/Kconfig | 1 + net/tsn/Kconfig | 32 3 files changed, 65 insertions(+) create mode 100644 net/tsn/Kconfig diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h index f45929c..de025eb 100644 --- a/include/linux/netdevice.h +++ b/include/linux/netdevice.h @@ -109,6 +109,13 @@ enum netdev_tx { }; typedef enum netdev_tx netdev_tx_t; +#if IS_ENABLED(CONFIG_TSN) +enum sr_class { + SR_CLASS_A = 1, + SR_CLASS_B = 2, +}; +#endif + /* * Current order: NETDEV_TX_MASK > NET_XMIT_MASK >= 0 is significant; * hard_start_xmit() return < NET_XMIT_MASK means skb was consumed. @@ -902,6 +909,22 @@ struct tc_to_netdev { * * void (*ndo_poll_controller)(struct net_device *dev); * + * TSN functions (if CONFIG_TSN) + * + * int (*ndo_tsn_capable)(struct net_device *dev); + * If a particular device is capable of sustaining TSN traffic + * provided current configuration + * int (*ndo_tsn_link_configure)(struct net_device *dev, + * enum sr_class class, + * u16 framesize, + * u16 vid); + * - When a new TSN link is either added or removed, this is called to + * update the bandwidth for the particular stream-class + * - The framesize is the size of the _entire_ frame, not just the + * payload since the full size is required to allocate bandwidth through + * the credit based shaper in the NIC + * - the vlan_id is the configured vlan for TSN in this session. + * * SR-IOV management functions. * int (*ndo_set_vf_mac)(struct net_device *dev, int vf, u8* mac); * int (*ndo_set_vf_vlan)(struct net_device *dev, int vf, u16 vlan, u8 qos); @@ -1148,6 +1171,15 @@ struct net_device_ops { #ifdef CONFIG_NET_RX_BUSY_POLL int (*ndo_busy_poll)(struct napi_struct *dev); #endif + +#if IS_ENABLED(CONFIG_TSN) + int (*ndo_tsn_capable)(struct net_device *dev); + int (*ndo_tsn_link_configure)(struct net_device *dev, + enum sr_class class, + u16 framesize, + u16 vid); +#endif /* CONFIG_TSN */ + int (*ndo_set_vf_mac)(struct net_device *dev, int queue, u8 *mac); int (*ndo_set_vf_vlan)(struct net_device *dev, diff --git a/net/Kconfig b/net/Kconfig index ff40562..fa9f691 100644 --- a/net/Kconfig +++ b/net/Kconfig @@ -215,6 +215,7 @@ source "net/802/Kconfig" source "net/bridge/Kconfig" source "net/dsa/Kconfig" source "net/8021q/Kconfig" +source "net/tsn/Kconfig" source "net/decnet/Kconfig" source "net/llc/Kconfig" source "net/ipx/Kconfig" diff --git a/net/tsn/Kconfig b/net/tsn/Kconfig new file mode 100644 index 000..1fc3c1d --- /dev/null +++ b/net/tsn/Kconfig @@ -0,0 +1,32 @@ +# +# Configuration for 802.1 Time Sensitive Networking (TSN) +# + +config TSN + tristate "802.1 TSN Support" + depends on VLAN_8021Q && PTP_1588_CLOCK && CONFIGFS_FS + ---help--- + Select this if you want to enable TSN on capable interfaces. + + TSN allows you to set up deterministic links on your LAN (only + L2 is currently supported). Once loaded, the driver will probe + all available interfaces if they are capable of supporting TSN + links. + + Once loaded, a directory in configfs called tsn/ will expose + the capable NICs and allow userspace to create + links. Userspace must provide us with a StreamID as well as + reserving bandwidth through the network and once this is done, + a new link can be created by issuing a mkdir() in configfs and + updating the attributes for the new link. + + TSN itself does not produce nor consume data, it is dependent + upon 'shims' doing this, which can be virtually anything. ALSA + is a good candidate. + + For more information, refer to the TSN-documentation in the + kernel documentation repository. + + The resulting module will be called 'tsn' + + If unsure, say N. -- 2.7.4
[very-RFC 3/8] Adding TSN-driver to Intel I210 controller
This adds support for loading the igb.ko module with tsn capabilities. This requires a 2-step approach. First enabling TSN in .config, then load the module with use_tsn=1. Once enabled and loaded, the controller will be placed in "Qav-mode" which is when the credit-based shaper is available, 3 of the queues are removed from regular traffic, max payload is set to 1522 octets (no jumboframes allowed). It dumps the registers of interest before and after, so this clutters kern.log a bit. In time this will be reduced / tied to the debug-param for the module. Note: currently this driver is *not* stable, it is still a work in progress. Cc: Jeff Kirsher Cc: intel-wired-...@lists.osuosl.org Cc: "David S. Miller" Signed-off-by: Henrik Austad --- drivers/net/ethernet/intel/Kconfig| 18 ++ drivers/net/ethernet/intel/igb/Makefile | 2 +- drivers/net/ethernet/intel/igb/igb.h | 19 ++ drivers/net/ethernet/intel/igb/igb_main.c | 10 +- drivers/net/ethernet/intel/igb/igb_tsn.c | 396 ++ 5 files changed, 443 insertions(+), 2 deletions(-) create mode 100644 drivers/net/ethernet/intel/igb/igb_tsn.c diff --git a/drivers/net/ethernet/intel/Kconfig b/drivers/net/ethernet/intel/Kconfig index 714bd10..8e620a9 100644 --- a/drivers/net/ethernet/intel/Kconfig +++ b/drivers/net/ethernet/intel/Kconfig @@ -99,6 +99,24 @@ config IGB To compile this driver as a module, choose M here. The module will be called igb. +config IGB_TSN + tristate "TSN Support for Intel(R) 82575/82576 i210 Network Controller" + depends on IGB && TSN + ---help--- + This driver supports TSN (AVB) on Intel I210 network controllers. + + When enabled, it will allow the module to be loaded with + "use_tsn" which will initialize the controller to A/V-mode + instead of legacy-mode. This will take 3 of the tx-queues and + place them in 802.1Q QoS mode and enable the credit-based + shaper for 2 of the queues. + + If built with this option, but not loaded with use_tsn, the + only difference is a slightly larger module, no extra + code paths are called. + + If unsure, say No + config IGB_HWMON bool "Intel(R) PCI-Express Gigabit adapters HWMON support" default y diff --git a/drivers/net/ethernet/intel/igb/Makefile b/drivers/net/ethernet/intel/igb/Makefile index 5bcb2de..1a9b776 100644 --- a/drivers/net/ethernet/intel/igb/Makefile +++ b/drivers/net/ethernet/intel/igb/Makefile @@ -33,4 +33,4 @@ obj-$(CONFIG_IGB) += igb.o igb-objs := igb_main.o igb_ethtool.o e1000_82575.o \ e1000_mac.o e1000_nvm.o e1000_phy.o e1000_mbx.o \ - e1000_i210.o igb_ptp.o igb_hwmon.o + e1000_i210.o igb_ptp.o igb_hwmon.o igb_tsn.o diff --git a/drivers/net/ethernet/intel/igb/igb.h b/drivers/net/ethernet/intel/igb/igb.h index b9609af..708f705 100644 --- a/drivers/net/ethernet/intel/igb/igb.h +++ b/drivers/net/ethernet/intel/igb/igb.h @@ -356,6 +356,7 @@ struct hwmon_buff { #define IGB_RETA_SIZE 128 /* board specific private data structure */ + struct igb_adapter { unsigned long active_vlans[BITS_TO_LONGS(VLAN_N_VID)]; @@ -472,6 +473,13 @@ struct igb_adapter { int copper_tries; struct e1000_info ei; u16 eee_advert; + +#if IS_ENABLED(CONFIG_IGB_TSN) + /* Reserved BW for class A and B */ + u16 sra_idleslope_res; + u16 srb_idleslope_res; + u8 tsn_ready:1; +#endif /* IGB_TSN */ }; #define IGB_FLAG_HAS_MSI BIT(0) @@ -552,6 +560,17 @@ void igb_ptp_rx_pktstamp(struct igb_q_vector *q_vector, unsigned char *va, struct sk_buff *skb); int igb_ptp_set_ts_config(struct net_device *netdev, struct ifreq *ifr); int igb_ptp_get_ts_config(struct net_device *netdev, struct ifreq *ifr); +/* This should be the only place where we add ifdeffery + * to include tsn-stuff or not. Everything else is located in igb_tsn.c + */ +#if IS_ENABLED(CONFIG_IGB_TSN) +void igb_tsn_init(struct igb_adapter *adapter); +int igb_tsn_capable(struct net_device *netdev); +int igb_tsn_link_configure(struct net_device *netdev, enum sr_class sr_class, + u16 framesize, u16 vid); +#else +static inline void igb_tsn_init(struct igb_adapter *adapter) { } +#endif /* CONFIG_IGB_TSN */ void igb_set_flag_queue_pairs(struct igb_adapter *, const u32); #ifdef CONFIG_IGB_HWMON void igb_sysfs_exit(struct igb_adapter *adapter); diff --git a/drivers/net/ethernet/intel/igb/igb_main.c b/drivers/net/ethernet/intel/igb/igb_main.c index ef3d642..4d8789f 100644 --- a/drivers/net/ethernet/intel/igb/igb_main.c +++ b/drivers/net/ethernet/intel/igb/igb_main.c @@ -2142,6 +2142,10 @@ static const struct net_device_ops igb_netdev_ops = { #ifdef CONFIG_NET_POLL_CONTROLLER .ndo_poll_controller= igb_netpoll, #endif +#if IS_ENABLED(CONFIG_IGB_TSN) + .ndo_tsn_capable= igb_tsn_capable, +
[very-RFC 7/8] AVB ALSA - Add ALSA shim for TSN
From: Henrik Austad This exposes a *very* rudimentary and simplistic ALSA driver that hooks into TSN to create a device for userspace. It currently only supports 44.1/48kHz sampling, 2ch, S16_LE Userspace is supposed to reserve bandwidth, find StreamID etc. To use as a Talker: mkdir /config/tsn/test/eth0/talker cd /config/tsn/test/eth0/talker echo 65535 > buffer_size echo 08:00:27:08:9f:c3 > remote_mac echo 42 > stream_id echo alsa > enabled aplay -Ddefault:CARD=avb -c2 -r48000 -fS16_LE /opt/rickroll.wav The same applies to Listener and arecord. Cc: Mauro Carvalho Chehab Cc: Takashi Iwai Cc: Mark Brown Signed-off-by: Henrik Austad --- drivers/media/Kconfig| 15 + drivers/media/Makefile | 3 +- drivers/media/avb/Makefile | 5 + drivers/media/avb/avb_alsa.c | 742 +++ drivers/media/avb/tsn_iec61883.h | 124 +++ 5 files changed, 888 insertions(+), 1 deletion(-) create mode 100644 drivers/media/avb/Makefile create mode 100644 drivers/media/avb/avb_alsa.c create mode 100644 drivers/media/avb/tsn_iec61883.h diff --git a/drivers/media/Kconfig b/drivers/media/Kconfig index a8518fb..14ad1d9 100644 --- a/drivers/media/Kconfig +++ b/drivers/media/Kconfig @@ -217,3 +217,18 @@ source "drivers/media/tuners/Kconfig" source "drivers/media/dvb-frontends/Kconfig" endif # MEDIA_SUPPORT + +config MEDIA_AVB_ALSA + tristate "ALSA part of AVB over TSN" + depends on TSN + help + + Enable the ALSA device that hoooks into TSN and allows the + computer to send ethernet frames over the network carrying + audio-data to selected hosts. + +This must be configured by userspace as MSRP and IEEE 1722.1 +(discovery and enumeration) is not implemented within the +kernel. + +If unsure, say N \ No newline at end of file diff --git a/drivers/media/Makefile b/drivers/media/Makefile index e608bbc..a1ca09e 100644 --- a/drivers/media/Makefile +++ b/drivers/media/Makefile @@ -20,6 +20,7 @@ endif obj-$(CONFIG_VIDEO_DEV) += v4l2-core/ obj-$(CONFIG_DVB_CORE) += dvb-core/ +obj-$(CONFIG_AVB) += avb/ # There are both core and drivers at RC subtree - merge before drivers obj-y += rc/ @@ -30,4 +31,4 @@ obj-y += rc/ obj-y += common/ platform/ pci/ usb/ mmc/ firewire/ obj-$(CONFIG_VIDEO_DEV) += radio/ - +obj-$(CONFIG_MEDIA_AVB_ALSA) += avb/ diff --git a/drivers/media/avb/Makefile b/drivers/media/avb/Makefile new file mode 100644 index 000..5d6302c --- /dev/null +++ b/drivers/media/avb/Makefile @@ -0,0 +1,5 @@ +# +# Makefile for the ALSA shim in AVB/TSN +# + +obj-$(CONFIG_MEDIA_AVB_ALSA) += avb_alsa.o diff --git a/drivers/media/avb/avb_alsa.c b/drivers/media/avb/avb_alsa.c new file mode 100644 index 000..9aff7d3 --- /dev/null +++ b/drivers/media/avb/avb_alsa.c @@ -0,0 +1,742 @@ +/* Copyright 2016 Cisco Systems, Inc. and/or its affiliates. All rights + * reserved. + * + * This program is free software; you may redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; version 2 of the License. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ +#include +#include +#include +#include +#include +#include + +#include +#include "tsn_iec61883.h" + +struct avb_chip { + struct snd_card *card; + struct tsn_link *link; + struct snd_pcm *pcm; + struct snd_pcm_substream *substream; + + /* Need a reference to this when we unregister the platform +* driver. +*/ + struct platform_device *device; + + /* on first copy, we set a few values, use this to make sure we +* only do this once. +*/ + u8 first_copy; + + u8 sample_size; + u8 channels; + + /* current idx in 10ms set of frames +* class A: 80 +* class B: 40 +* +* This is mostly relevant for 44.1kHz samplefreq +*/ + u8 num_10ms_series; + + u32 sample_freq; +}; + +/* currently, only playback is implemented in TSN layer + * + + * FIXMEs: (should be set according to the active TSN link) + * - format + * - rates + * - channels + */ +static struct snd_pcm_hardware snd_avb_hw = { + .info = SNDRV_PCM_INFO_INTERLEAVED, + .formats = SNDRV_PCM_FMTBIT_S16_LE, + .rates = SNDRV_PCM_RATE_44100 | SNDRV_PCM_RATE_48000, + .rate_min = 44100, + .rate_max = 48000, + .channels_min = 2, + .channels_max = 2, + .period_bytes_min = 4096, +
[very-RFC 1/8] TSN: add documentation
From: Henrik Austad Describe the overall design behind the TSN standard, the TSN-driver, requirements to userspace and new functionality introduced. Cc: "David S. Miller" Signed-off-by: Henrik Austad --- Documentation/TSN/tsn.txt | 147 ++ 1 file changed, 147 insertions(+) create mode 100644 Documentation/TSN/tsn.txt Index: linux/Documentation/TSN/tsn.txt === --- /dev/null +++ linux/Documentation/TSN/tsn.txt @@ -0,0 +1,188 @@ + Time Sensitive Networking (TSN) + --- + +[work in progress] + +1. Motivation += + +TSN is a set of open standards, formerly known as 'AVB' (Audio/Video +Bridging). It was renamed to TSN to better reflect that it can do much +more than just media transport. + +TSN is a way to create reliable streams across a network without loss of +frames due to congestion in the network. By using gPTP (a specialized +IEEE-1588v2 PTP profile), the time can be synchronized with sub-us +granularity across all the connected devices in the AVB domain. + +2. Intro to AVB/TSN +=== + +The original standards were written with Audio/Video in mind, so the +initial standards refer to this as 'AVB'. In later standards, this has +changed to TSN, and AVB now refers to a service you can add on top of +TSN. Hopefully it will not be too confusing. + +In this document, we refer to the infrastructure part as TSN and AVB to +the ALSA/V4L2 shim which can be added on top of TSN to provide a +media-service. + +TSN operates with 'streams', and one stream can contain pretty much +whatever you like. Currently, only media has been defined properly +though, which is why you only have media-subtypes for the +avtp_subtype-field. + +For a media-setup, one stream can contain multiple channels, all going +to the same destination. A destination can be a single Listener +(singlecast) or a group of Listeners (multicast). + +2.1 Endpoints + +A TSN 'endpoint' is where a stream either originates or ends -what +others would call sources (Talkers) and sinks (Listeners). Looking back +at pre-TSN when this was called AVB, these names make a bit more sense. + +Common for both types, they need to be PTPv2 capable, i.e. you need to +timestamp gPTP frames upon ingress/egress to improve the accuracy of +PTP. + +2.1.1 Talkers + +Hardware requirements: +- Multiple Tx-queues +- Credit based shaper on at least one of the queues for pacing the + frames onto the network +- VLAN capable + +2.1.2 Listener + +A Listener does not have the same requirements as a Talker as it cannot +control the pace of the incoming frames anyway. It is beneficial if the +NIC understands VLANs and has a few Rx-queues so that you can steer all +TSN-frames to a dedicated queue. + +2.2 Bridges + +What TSN calls switches that are TSN-capable. They must be able to +prioritize TSN-streams, have the credit-based shaper available for that +class, support SRP, support gPTP and so on. + +2.3 Relevant standards + +* IEEE 802.1BA-2011 Audio Video Bridging (AVB) Systems + +* IEEE 802.1Q-2011 sec 34 and 35 + + What is referred to as: + IEEE 802.1Qav (Forwarding and Queueing for Time-sensitive Streams) + IEEE 802.1Qat (Stream Registration protocol) + +* IEEE 802.1AS gPTP + + A PTPv2 profile (from IEEE 1588) tailored for this domain. Notable + changes include the requirement that all nodes in the network must be + gPTP capable (i.e. no traversing non-PTP entities), and it allows + traffic over a wider range of medium that what "pure" PTPv2 allows. + +* IEEE 1722 AVTP Layer 2 Transport Protocol for Time-Sensitive + Applications in Bridged Local Area Networks + +* IEEE 1722.1 Device Discovery, Connection Management and Control for 1722 + + What allows AVB (TSN) devices to handle discovery, enumeration and + control, basically let you connect 2 devices from a 3rd + + In this (in the scope of the Linux kernel TSN driver) must be done + purely from userspace as we do not want the kernel to suddenly attach + to a remote system without the user's knowledge. This is further + reflected in how the attributes for the link is managed via ConfigFS. + + +3. Overview and/or design of the TSN-driver +=== + +The driver handles the shifting of data for TSN-streams. Anything else +is left for userspace to handle. This includes stream reservation (using +some sort of MSRP client), negotiating multicast addresses, finding the +value of the different attributes and connect application(s) to the +exposed devices (currently we only have an ALSA-device). + + /\ + || + | Media application | + || + \/ +|| + +--+++ + |
Re: [very-RFC 2/8] TSN: Add the standard formerly known as AVB to the kernel
Not as a reply, fresh new patch postings. :-/
Re: [very-RFC 4/8] Add TSN header for the driver
Clearing up netdev-typo -H On Sun, Jun 12, 2016 at 12:22:17AM +0200, Henrik Austad wrote: > From: Henrik Austad > > This defines the general TSN headers for network packets, the > shim-interface and the central 'tsn_list' structure. > > Cc: "David S. Miller" > Signed-off-by: Henrik Austad > --- > include/linux/tsn.h | 806 > > 1 file changed, 806 insertions(+) > create mode 100644 include/linux/tsn.h > > diff --git a/include/linux/tsn.h b/include/linux/tsn.h > new file mode 100644 > index 000..0e1f732b > --- /dev/null > +++ b/include/linux/tsn.h > @@ -0,0 +1,806 @@ > +/* TSN - Time Sensitive Networking > + * > + * Copyright (C) 2016- Henrik Austad > + * > + * This program is free software; you can redistribute it and/or modify > + * it under the terms of the GNU General Public License as published by > + * the Free Software Foundation; either version 2 of the License, or > + * (at your option) any later version. > + * > + * This program is distributed in the hope that it will be useful, > + * but WITHOUT ANY WARRANTY; without even the implied warranty of > + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the > + * GNU General Public License for more details. > + */ > +#ifndef _TSN_H > +#define _TSN_H > +#include > +#include > +#include > + > +/* The naming here can be a bit confusing as we call it TSN but naming > + * suggests 'AVB'. Reason: IEE 1722 was written before the working group > + * was renamed to Time Sensitive Networking. > + * > + * To be precise. TSN describes the protocol for shipping data, AVB is a > + * medialayer which you can build on top of TSN. > + * > + * For this reason the frames are given avb-names whereas the functions > + * use tsn_-naming. > + */ > + > +/* 7 bit value 0x00 - 0x7F */ > +enum avtp_subtype { > + AVTP_61883_IIDC = 0, > + AVTP_MMA = 0x1, > + AVTP_MAAP = 0x7e, > + AVTP_EXPERIMENTAL = 0x7f, > +}; > + > +/* NOTE NOTE NOTE !! > + * The headers below use bitfields extensively and verifications > + * are needed when using little-endian vs big-endian systems. > + */ > + > +/* Common part of avtph header > + * > + * AVB Transport Protocol Common Header > + * > + * Defined in 1722-2011 Sec. 5.2 > + */ > +struct avtp_ch { > +#if defined(__LITTLE_ENDIAN_BITFIELD) > + /* use avtp_subtype enum. > + */ > + u8 subtype:7; > + > + /* Controlframe: 1 > + * Dataframe : 0 > + */ > + u8 cd:1; > + > + /* Type specific data, part 1 */ > + u8 tsd_1:4; > + > + /* In current version of AVB, only 0 is valid, all other values > + * are reserved for future versions. > + */ > + u8 version:3; > + > + /* Valid StreamID in frame > + * > + * ControlData not related to a specific stream should clear > + * this (and have stream_id = 0), _all_ other values should set > + * this to 1. > + */ > + u8 sv:1; > +#elif defined(__BIG_ENDIAN_BITFIELD) > + u8 cd:1; > + u8 subtype:7; > + u8 sv:1; > + u8 version:3; > + u8 tsd_1:4; > +#else > +#error "Unknown Endianness, cannot determine bitfield ordering" > +#endif > + /* Type specific data (adjacent to tsd_1, but split due to bitfield) */ > + u16 tsd_2; > + u64 stream_id; > + > + /* > + * payload by subtype > + */ > + u8 pbs[0]; > +} __packed; > + > +/* AVTPDU Common Control header format > + * IEEE 1722#5.3 > + */ > +struct avtpc_header { > +#if defined(__LITTLE_ENDIAN_BITFIELD) > + u8 subtype:7; > + u8 cd:1; > + u8 control_data:4; > + u8 version:3; > + u8 sv:1; > + u16 control_data_length:11; > + u16 status:5; > +#elif defined(__BIG_ENDIAN_BITFIELD) > + u8 cd:1; > + u8 subtype:7; > + u8 sv:1; > + u8 version:3; > + u8 control_data:4; > + u16 status:5; > + u16 control_data_length:11; > +#else > +#error "Unknown Endianness, cannot determine bitfield ordering" > +#endif > + u64 stream_id; > +} __packed; > + > +/* AVTP common stream data AVTPDU header format > + * IEEE 1722#5.4 > + */ > +struct avtpdu_header { > +#if defined(__LITTLE_ENDIAN_BITFIELD) > + u8 subtype:7; > + u8 cd:1; > + > + /* avtp_timestamp valid */ > + u8 tv: 1; > + > + /* gateway_info valid */ > + u8 gv:1; > + > + /* reserved */ > + u8 r:1; > + > + /* > + * Media clock Restart toggle > + */ > + u8 mr:1; > + > + u8 version:3; > + > + /* StreamID valid */ > + u8 sv:1; > + u8 seqnr; > + > + /* Timestamp uncertain */ > + u8 tu:1; > + u8 r2:7; > +#elif defined(__BIG_ENDIAN_BITFIELD) > + u8 cd:1; > + u8 subtype:7; > + > + u8 sv:1; > + u8 version:3; > + u8 mr:1; > + u8 r:1; > + u8 gv:1; > + u8 tv: 1; > + > + u8 seqnr; > + u8 r2:7; > + u8 tu:1; > +#else > +#error "Unknown Endianness, cannot determine bitfield ordering" > +#endif > + > + u64 stream_id; > + >
Re: [very-RFC 5/8] Add TSN machinery to drive the traffic from a shim over the network
clearing up netdev-typo -H On Sun, Jun 12, 2016 at 12:22:18AM +0200, Henrik Austad wrote: > From: Henrik Austad > > In short summary: > > * tsn_core.c is the main driver of tsn, all new links go through > here and all data to/form the shims are handled here > core also manages the shim-interface. > > * tsn_configfs.c is the API to userspace. TSN is driven from userspace > and a link is created, configured, enabled, disabled and removed > purely from userspace. All attributes requried must be determined by > userspace, preferrably via IEEE 1722.1 (discovery and enumeration). > > * tsn_header.c small part that handles the actual header of the frames > we send. Kept out of core for cleanliness. > > * tsn_net.c handles operations towards the networking layer. > > The current driver is under development. This means that from the moment it > is enabled with a shim, it will send traffic, either 0-traffic (frames of > reserved length but with payload 0) or actual traffic. This will change > once the driver stabilizes. > > For more detail, see Documentation/networking/tsn/ > > Cc: "David S. Miller" > Signed-off-by: Henrik Austad > --- > net/Makefile | 1 + > net/tsn/Makefile | 6 + > net/tsn/tsn_configfs.c | 623 +++ > net/tsn/tsn_core.c | 975 > + > net/tsn/tsn_header.c | 203 ++ > net/tsn/tsn_internal.h | 383 +++ > net/tsn/tsn_net.c | 403 > 7 files changed, 2594 insertions(+) > create mode 100644 net/tsn/Makefile > create mode 100644 net/tsn/tsn_configfs.c > create mode 100644 net/tsn/tsn_core.c > create mode 100644 net/tsn/tsn_header.c > create mode 100644 net/tsn/tsn_internal.h > create mode 100644 net/tsn/tsn_net.c > > diff --git a/net/Makefile b/net/Makefile > index bdd1455..c15482e 100644 > --- a/net/Makefile > +++ b/net/Makefile > @@ -79,3 +79,4 @@ ifneq ($(CONFIG_NET_L3_MASTER_DEV),) > obj-y+= l3mdev/ > endif > obj-$(CONFIG_QRTR) += qrtr/ > +obj-$(CONFIG_TSN)+= tsn/ > diff --git a/net/tsn/Makefile b/net/tsn/Makefile > new file mode 100644 > index 000..0d87687 > --- /dev/null > +++ b/net/tsn/Makefile > @@ -0,0 +1,6 @@ > +# > +# Makefile for the Linux TSN subsystem > +# > + > +obj-$(CONFIG_TSN) += tsn.o > +tsn-objs :=tsn_core.o tsn_configfs.o tsn_net.o tsn_header.o > diff --git a/net/tsn/tsn_configfs.c b/net/tsn/tsn_configfs.c > new file mode 100644 > index 000..f3d0986 > --- /dev/null > +++ b/net/tsn/tsn_configfs.c > @@ -0,0 +1,623 @@ > +/* > + * ConfigFS interface to TSN > + * Copyright (C) 2015- Henrik Austad > + * > + * This program is free software; you can redistribute it and/or modify > + * it under the terms of the GNU General Public License as published by > + * the Free Software Foundation; either version 2 of the License, or > + * (at your option) any later version. > + * > + * This program is distributed in the hope that it will be useful, > + * but WITHOUT ANY WARRANTY; without even the implied warranty of > + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the > + * GNU General Public License for more details. > + */ > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include "tsn_internal.h" > + > +static inline struct tsn_link *to_tsn_link(struct config_item *item) > +{ > + /* this line causes checkpatch to WARN. making checkpatch happy, > + * makes code messy.. > + */ > + return item ? container_of(to_config_group(item), struct tsn_link, > group) : NULL; > +} > + > +static inline struct tsn_nic *to_tsn_nic(struct config_group *group) > +{ > + return group ? container_of(group, struct tsn_nic, group) : NULL; > +} > + > +/* --- > + * Tier2 attributes > + * > + * The content of the links userspace can see/modify > + * --- > +*/ > +static ssize_t _tsn_max_payload_size_show(struct config_item *item, > + char *page) > +{ > + struct tsn_link *link = to_tsn_link(item); > + > + if (!link) > + return -EINVAL; > + return sprintf(page, "%u\n", (u32)link->max_payload_size); > +} > + > +static ssize_t _tsn_max_payload_size_store(struct config_item *item, > +const char *page, size_t count) > +{ > + struct tsn_link *link = to_tsn_link(item); > + u16 mpl_size = 0; > + int ret = 0; > + > + if (!link) > + return -EINVAL; > + if (tsn_link_is_on(link)) { > + pr_err("ERROR: Cannot change Payload size on on enabled > link\n"); > + return -EINVAL; > + } > + ret = kstrtou16(page, 0, &mpl_size); > + if (ret) > + return ret; > + > + /* 802.1BA-2011 6.4 payload must be <1500 octets (excluding > + * h