This is a note to let you know that I've just added the patch titled
membarrier: Disable preemption when calling smp_call_function_many()
to the 4.14-stable tree which can be found at:
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=sum…
The filename of the patch is:
membarrier-disable-preemption-when-calling-smp_call_function_many.patch
and it can be found in the queue-4.14 subdirectory.
If you, or anyone else, feels it should not be added to the stable tree,
please let <stable(a)vger.kernel.org> know about it.
>From 541676078b52f365f53d46ee5517d305cd1b6350 Mon Sep 17 00:00:00 2001
From: Mathieu Desnoyers <mathieu.desnoyers(a)efficios.com>
Date: Fri, 15 Dec 2017 14:23:10 -0500
Subject: membarrier: Disable preemption when calling smp_call_function_many()
From: Mathieu Desnoyers <mathieu.desnoyers(a)efficios.com>
commit 541676078b52f365f53d46ee5517d305cd1b6350 upstream.
smp_call_function_many() requires disabling preemption around the call.
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers(a)efficios.com>
Cc: Andrea Parri <parri.andrea(a)gmail.com>
Cc: Andrew Hunter <ahh(a)google.com>
Cc: Avi Kivity <avi(a)scylladb.com>
Cc: Benjamin Herrenschmidt <benh(a)kernel.crashing.org>
Cc: Boqun Feng <boqun.feng(a)gmail.com>
Cc: Dave Watson <davejwatson(a)fb.com>
Cc: H. Peter Anvin <hpa(a)zytor.com>
Cc: Linus Torvalds <torvalds(a)linux-foundation.org>
Cc: Maged Michael <maged.michael(a)gmail.com>
Cc: Michael Ellerman <mpe(a)ellerman.id.au>
Cc: Paul E . McKenney <paulmck(a)linux.vnet.ibm.com>
Cc: Paul E. McKenney <paulmck(a)linux.vnet.ibm.com>
Cc: Paul Mackerras <paulus(a)samba.org>
Cc: Peter Zijlstra <peterz(a)infradead.org>
Cc: Thomas Gleixner <tglx(a)linutronix.de>
Link: http://lkml.kernel.org/r/20171215192310.25293-1-mathieu.desnoyers@efficios.…
Signed-off-by: Ingo Molnar <mingo(a)kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh(a)linuxfoundation.org>
---
kernel/sched/membarrier.c | 2 ++
1 file changed, 2 insertions(+)
--- a/kernel/sched/membarrier.c
+++ b/kernel/sched/membarrier.c
@@ -89,7 +89,9 @@ static int membarrier_private_expedited(
rcu_read_unlock();
}
if (!fallback) {
+ preempt_disable();
smp_call_function_many(tmpmask, ipi_mb, NULL, 1);
+ preempt_enable();
free_cpumask_var(tmpmask);
}
cpus_read_unlock();
Patches currently in stable-queue which might be from mathieu.desnoyers(a)efficios.com are
queue-4.14/membarrier-disable-preemption-when-calling-smp_call_function_many.patch
queue-4.14/kvm-fix-stack-out-of-bounds-read-in-write_mmio.patch
This is a note to let you know that I've just added the patch titled
x86/pti/efi: broken conversion from efi to kernel page table
to the 4.9-stable tree which can be found at:
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=sum…
The filename of the patch is:
x86-pti-efi-broken-conversion-from-efi-to-kernel-page-table.patch
and it can be found in the queue-4.9 subdirectory.
If you, or anyone else, feels it should not be added to the stable tree,
please let <stable(a)vger.kernel.org> know about it.
>From pasha.tatashin(a)oracle.com Sat Jan 13 14:16:28 2018
From: Pavel Tatashin <pasha.tatashin(a)oracle.com>
Date: Thu, 11 Jan 2018 16:58:20 -0500
Subject: x86/pti/efi: broken conversion from efi to kernel page table
To: steven.sistare(a)oracle.com, linux-kernel(a)vger.kernel.org, tglx(a)linutronix.de, mingo(a)redhat.com, hpa(a)zytor.com, x86(a)kernel.org, gregkh(a)linuxfoundation.org, jkosina(a)suse.cz, hughd(a)google.com, dave.hansen(a)linux.intel.com, luto(a)kernel.org, torvalds(a)linux-foundation.org
Message-ID: <20180111215820.29736-1-pasha.tatashin(a)oracle.com>
From: Pavel Tatashin <pasha.tatashin(a)oracle.com>
The page table order must be increased for EFI table in order to avoid a
bug where NMI tries to change the page table to kernel page table, while
efi page table is active.
For more disccussion about this bug, see this thread:
http://lkml.iu.edu/hypermail/linux/kernel/1801.1/00951.html
Signed-off-by: Pavel Tatashin <pasha.tatashin(a)oracle.com>
Reviewed-by: Steven Sistare <steven.sistare(a)oracle.com>
Acked-by: Jiri Kosina <jkosina(a)suse.cz>
---
arch/x86/include/asm/pgalloc.h | 11 +++++++++++
arch/x86/platform/efi/efi_64.c | 2 +-
2 files changed, 12 insertions(+), 1 deletion(-)
--- a/arch/x86/include/asm/pgalloc.h
+++ b/arch/x86/include/asm/pgalloc.h
@@ -27,6 +27,17 @@ static inline void paravirt_release_pud(
*/
extern gfp_t __userpte_alloc_gfp;
+#ifdef CONFIG_PAGE_TABLE_ISOLATION
+/*
+ * Instead of one PGD, we acquire two PGDs. Being order-1, it is
+ * both 8k in size and 8k-aligned. That lets us just flip bit 12
+ * in a pointer to swap between the two 4k halves.
+ */
+#define PGD_ALLOCATION_ORDER 1
+#else
+#define PGD_ALLOCATION_ORDER 0
+#endif
+
/*
* Allocate and free page tables.
*/
--- a/arch/x86/platform/efi/efi_64.c
+++ b/arch/x86/platform/efi/efi_64.c
@@ -142,7 +142,7 @@ int __init efi_alloc_page_tables(void)
return 0;
gfp_mask = GFP_KERNEL | __GFP_NOTRACK | __GFP_ZERO;
- efi_pgd = (pgd_t *)__get_free_page(gfp_mask);
+ efi_pgd = (pgd_t *)__get_free_pages(gfp_mask, PGD_ALLOCATION_ORDER);
if (!efi_pgd)
return -ENOMEM;
Patches currently in stable-queue which might be from pasha.tatashin(a)oracle.com are
queue-4.9/x86-pti-efi-broken-conversion-from-efi-to-kernel-page-table.patch
This is a note to let you know that I've just added the patch titled
x86/pti/efi: broken conversion from efi to kernel page table
to the 4.4-stable tree which can be found at:
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=sum…
The filename of the patch is:
x86-pti-efi-broken-conversion-from-efi-to-kernel-page-table.patch
and it can be found in the queue-4.4 subdirectory.
If you, or anyone else, feels it should not be added to the stable tree,
please let <stable(a)vger.kernel.org> know about it.
>From pasha.tatashin(a)oracle.com Sat Jan 13 14:14:57 2018
From: Pavel Tatashin <pasha.tatashin(a)oracle.com>
Date: Thu, 11 Jan 2018 14:07:46 -0500
Subject: x86/pti/efi: broken conversion from efi to kernel page table
To: steven.sistare(a)oracle.com, linux-kernel(a)vger.kernel.org, tglx(a)linutronix.de, mingo(a)redhat.com, hpa(a)zytor.com, x86(a)kernel.org, gregkh(a)linuxfoundation.org, jkosina(a)suse.cz, hughd(a)google.com, dave.hansen(a)linux.intel.com, luto(a)kernel.org, torvalds(a)linux-foundation.org
Message-ID: <20180111190746.15426-2-pasha.tatashin(a)oracle.com>
From: Pavel Tatashin <pasha.tatashin(a)oracle.com>
In entry_64.S we have code like this:
/* Unconditionally use kernel CR3 for do_nmi() */
/* %rax is saved above, so OK to clobber here */
ALTERNATIVE "jmp 2f", "movq %cr3, %rax", X86_FEATURE_KAISER
/* If PCID enabled, NOFLUSH now and NOFLUSH on return */
ALTERNATIVE "", "bts $63, %rax", X86_FEATURE_PCID
pushq %rax
/* mask off "user" bit of pgd address and 12 PCID bits: */
andq $(~(X86_CR3_PCID_ASID_MASK | KAISER_SHADOW_PGD_OFFSET)), %rax
movq %rax, %cr3
2:
/* paranoidentry do_nmi, 0; without TRACE_IRQS_OFF */
call do_nmi
With this instruction:
andq $(~(X86_CR3_PCID_ASID_MASK | KAISER_SHADOW_PGD_OFFSET)), %rax
We unconditionally switch from whatever our CR3 was to kernel page table.
But, in arch/x86/platform/efi/efi_64.c We temporarily set a different page
table, that does not have the kernel page table with 0x1000 offset from it.
Look in efi_thunk() and efi_thunk_set_virtual_address_map().
So, while CR3 points to the other page table, we get an NMI interrupt,
and clear 0x1000 from CR3, resulting in a bogus CR3 if the 0x1000 bit was
set.
The efi page table comes from realmode/rm/trampoline_64.S:
arch/x86/realmode/rm/trampoline_64.S
141 .bss
142 .balign PAGE_SIZE
143 GLOBAL(trampoline_pgd) .space PAGE_SIZE
Notice: alignment is PAGE_SIZE, so after applying KAISER_SHADOW_PGD_OFFSET
which equal to PAGE_SIZE, we can get a different page table.
But, even if we fix alignment, here the trampoline binary is later copied
into dynamically allocated memory in reserve_real_mode(), so we need to
fix that place as well.
Fixes: 8a43ddfb93a0 ("KAISER: Kernel Address Isolation")
Signed-off-by: Pavel Tatashin <pasha.tatashin(a)oracle.com>
Reviewed-by: Steven Sistare <steven.sistare(a)oracle.com>
Signed-off-by: Greg Kroah-Hartman <gregkh(a)linuxfoundation.org>
---
arch/x86/include/asm/kaiser.h | 8 ++++++++
arch/x86/realmode/init.c | 4 +++-
arch/x86/realmode/rm/trampoline_64.S | 3 ++-
3 files changed, 13 insertions(+), 2 deletions(-)
--- a/arch/x86/include/asm/kaiser.h
+++ b/arch/x86/include/asm/kaiser.h
@@ -19,6 +19,12 @@
#define KAISER_SHADOW_PGD_OFFSET 0x1000
+/*
+ * A page table address must have this alignment to stay the same when
+ * KAISER_SHADOW_PGD_OFFSET mask is applied
+ */
+#define KAISER_KERNEL_PGD_ALIGNMENT (KAISER_SHADOW_PGD_OFFSET << 1)
+
#ifdef __ASSEMBLY__
#ifdef CONFIG_PAGE_TABLE_ISOLATION
@@ -71,6 +77,8 @@ movq PER_CPU_VAR(unsafe_stack_register_b
#else /* CONFIG_PAGE_TABLE_ISOLATION */
+#define KAISER_KERNEL_PGD_ALIGNMENT PAGE_SIZE
+
.macro SWITCH_KERNEL_CR3
.endm
.macro SWITCH_USER_CR3
--- a/arch/x86/realmode/init.c
+++ b/arch/x86/realmode/init.c
@@ -1,5 +1,6 @@
#include <linux/io.h>
#include <linux/memblock.h>
+#include <linux/kaiser.h>
#include <asm/cacheflush.h>
#include <asm/pgtable.h>
@@ -15,7 +16,8 @@ void __init reserve_real_mode(void)
size_t size = PAGE_ALIGN(real_mode_blob_end - real_mode_blob);
/* Has to be under 1M so we can execute real-mode AP code. */
- mem = memblock_find_in_range(0, 1<<20, size, PAGE_SIZE);
+ mem = memblock_find_in_range(0, 1 << 20, size,
+ KAISER_KERNEL_PGD_ALIGNMENT);
if (!mem)
panic("Cannot allocate trampoline\n");
--- a/arch/x86/realmode/rm/trampoline_64.S
+++ b/arch/x86/realmode/rm/trampoline_64.S
@@ -30,6 +30,7 @@
#include <asm/msr.h>
#include <asm/segment.h>
#include <asm/processor-flags.h>
+#include <asm/kaiser.h>
#include "realmode.h"
.text
@@ -139,7 +140,7 @@ tr_gdt:
tr_gdt_end:
.bss
- .balign PAGE_SIZE
+ .balign KAISER_KERNEL_PGD_ALIGNMENT
GLOBAL(trampoline_pgd) .space PAGE_SIZE
.balign 8
Patches currently in stable-queue which might be from pasha.tatashin(a)oracle.com are
queue-4.4/x86-pti-efi-broken-conversion-from-efi-to-kernel-page-table.patch
On Sat, Jan 13, 2018 at 12:30:11PM +0000, David Woodhouse wrote:
> On Sat, 2018-01-13 at 13:08 +0100, Peter Zijlstra wrote:
> >
> > ALTERNATIVE "orq $(PTI_SWITCH_PGTABLE_MASK), \scratch_reg",
> > "orq $(PTI_SWITCH_MASK), \scratch_reg", X86_FEATURE_PCID
> >
> > Is not wanting to compile though; probably that whole alternative vs
> > macro thing again :/
>
> Welcome to my world. Try
>
> ALTERNATIVE __stringify(orq $(PTI_SWITCH_PGTABLE_MASK), \scratch_reg), \
> __stringify(orq $(PTI_SWITCH_MASK), \scratch_reg), \
> X86_FEATURE_PCID
Doesn't seem to work, gets literal __stringy() crud in the .s file.
This is a note to let you know that I've just added the patch titled
Revert "userfaultfd: selftest: vm: allow to build in vm/ directory"
to the 4.4-stable tree which can be found at:
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=sum…
The filename of the patch is:
revert-userfaultfd-selftest-vm-allow-to-build-in-vm.patch
and it can be found in the queue-4.4 subdirectory.
If you, or anyone else, feels it should not be added to the stable tree,
please let <stable(a)vger.kernel.org> know about it.
>From b224975a2c971c773f1211483a1392262fe8fb15 Mon Sep 17 00:00:00 2001
From: Greg Kroah-Hartman <gregkh(a)linuxfoundation.org>
Date: Sat, 13 Jan 2018 11:19:07 +0100
Subject: Revert "userfaultfd: selftest: vm: allow to build in vm/ directory"
From: Greg Kroah-Hartman <gregkh(a)linuxfoundation.org>
This reverts commit b5213e1e9f25ccde958aa6364815ee87fef91100 which was
commit 46aa6a302b53f543f8e8b8e1714dc5e449ad36a6 upstream.
This is being reverted because the affected commit this was trying to
fix, a8ba798bc8ec ("selftests: enable O and KBUILD_OUTPUT"), was never
backported to the 4.4-stable tree.
Reported-by: Ben Hutchings <ben.hutchings(a)codethink.co.uk>
Cc: Andrea Arcangeli <aarcange(a)redhat.com>
Cc: Mike Rapoport <rppt(a)linux.vnet.ibm.com>
Cc: "Dr. David Alan Gilbert" <dgilbert(a)redhat.com>
Cc: Mike Kravetz <mike.kravetz(a)oracle.com>
Cc: Pavel Emelyanov <xemul(a)parallels.com>
Cc: Hillf Danton <hillf.zj(a)alibaba-inc.com>
Cc: Andrew Morton <akpm(a)linux-foundation.org>
Cc: Linus Torvalds <torvalds(a)linux-foundation.org>
Cc: Sasha Levin <alexander.levin(a)verizon.com>
Signed-off-by: Greg Kroah-Hartman <gregkh(a)linuxfoundation.org>
---
tools/testing/selftests/vm/Makefile | 4 ----
1 file changed, 4 deletions(-)
--- a/tools/testing/selftests/vm/Makefile
+++ b/tools/testing/selftests/vm/Makefile
@@ -1,9 +1,5 @@
# Makefile for vm selftests
-ifndef OUTPUT
- OUTPUT := $(shell pwd)
-endif
-
CFLAGS = -Wall -I ../../../../usr/include $(EXTRA_CFLAGS)
BINARIES = compaction_test
BINARIES += hugepage-mmap
Patches currently in stable-queue which might be from gregkh(a)linuxfoundation.org are
queue-4.4/kvm-vmx-scrub-hardware-gprs-at-vm-exit.patch
queue-4.4/net-mac80211-debugfs.c-prevent-build-failure-with-config_ubsan-y.patch
queue-4.4/mips-consistently-handle-buffer-counter-with-ptrace_setregset.patch
queue-4.4/hwrng-core-sleep-interruptible-in-read.patch
queue-4.4/x86-mm-pat-dev-mem-remove-superfluous-error-message.patch
queue-4.4/mm-zswap-use-workqueue-to-destroy-pool.patch
queue-4.4/mm-compaction-pass-only-pageblock-aligned-range-to-pageblock_pfn_to_page.patch
queue-4.4/alsa-pcm-remove-incorrect-snd_bug_on-usages.patch
queue-4.4/lan78xx-use-skb_cow_head-to-deal-with-cloned-skbs.patch
queue-4.4/alsa-aloop-fix-inconsistent-format-due-to-incomplete-rule.patch
queue-4.4/mips-disallow-outsized-ptrace_setregset-nt_prfpreg-regset-accesses.patch
queue-4.4/ib-srpt-disable-rdma-access-by-the-initiator.patch
queue-4.4/mips-guard-against-any-partial-write-attempt-with-ptrace_setregset.patch
queue-4.4/mips-also-verify-sizeof-elf_fpreg_t-with-ptrace_setregset.patch
queue-4.4/mips-factor-out-nt_prfpreg-regset-access-helpers.patch
queue-4.4/locking-mutex-allow-next-waiter-lockless-wakeup.patch
queue-4.4/cx82310_eth-use-skb_cow_head-to-deal-with-cloned-skbs.patch
queue-4.4/r8152-fix-the-wake-event.patch
queue-4.4/mm-compaction-fix-invalid-free_pfn-and-compact_cached_free_pfn.patch
queue-4.4/x86-vsdo-fix-build-on-paravirt_clock-y-kvm_guest-n.patch
queue-4.4/dm-bufio-fix-shrinker-scans-when-nr_to_scan-retain_target.patch
queue-4.4/can-gs_usb-fix-return-value-of-the-set_bittiming-callback.patch
queue-4.4/x86-acpi-handle-sci-interrupts-above-legacy-space-gracefully.patch
queue-4.4/zswap-don-t-param_set_charp-while-holding-spinlock.patch
queue-4.4/mips-validate-pr_set_fp_mode-prctl-2-requests-against-the-abi-of-the-task.patch
queue-4.4/alsa-pcm-add-missing-error-checks-in-oss-emulation-plugin-builder.patch
queue-4.4/sr9700-use-skb_cow_head-to-deal-with-cloned-skbs.patch
queue-4.4/futex-replace-barrier-in-unqueue_me-with-read_once.patch
queue-4.4/iommu-arm-smmu-v3-don-t-free-page-table-ops-twice.patch
queue-4.4/r8152-adjust-aldps-function.patch
queue-4.4/kvm-fix-stack-out-of-bounds-read-in-write_mmio.patch
queue-4.4/revert-userfaultfd-selftest-vm-allow-to-build-in-vm.patch
queue-4.4/smsc75xx-use-skb_cow_head-to-deal-with-cloned-skbs.patch
queue-4.4/alsa-pcm-abort-properly-at-pending-signal-in-oss-read-write-loops.patch
queue-4.4/usbvision-fix-overflow-of-interfaces-array.patch
queue-4.4/mm-page-writeback-fix-dirty_ratelimit-calculation.patch
queue-4.4/alsa-pcm-allow-aborting-mutex-lock-at-oss-read-write-loops.patch
queue-4.4/r8152-use-test_and_clear_bit.patch
queue-4.4/locks-don-t-check-for-race-with-close-when-setting-ofd-lock.patch
queue-4.4/x86-acpi-reduce-code-duplication-in-mp_override_legacy_irq.patch
queue-4.4/mips-fix-an-fcsr-access-api-regression-with-nt_prfpreg-and-msa.patch
queue-4.4/alsa-aloop-fix-racy-hw-constraints-adjustment.patch
queue-4.4/alsa-aloop-release-cable-upon-open-error-path.patch
queue-4.4/sysrq-fix-warning-in-sysrq-generated-crash.patch
queue-4.4/usb-musb-ux500-fix-null-pointer-dereference-at-system-pm.patch
Build reference: v3.18.91-23-g72813f7
gcc version: arm-poky-linux-gnueabi-gcc (GCC) 4.9.1
Building arm:allmodconfig ... failed
--------------
Error log:
/opt/buildbot/slave/stable-queue-3.18/build/drivers/mtd/nand/pxa3xx_nand.c: In function 'prepare_start_command':
/opt/buildbot/slave/stable-queue-3.18/build/drivers/mtd/nand/pxa3xx_nand.c:749:2: error: duplicate case value
case NAND_CMD_READOOB:
^
/opt/buildbot/slave/stable-queue-3.18/build/drivers/mtd/nand/pxa3xx_nand.c:746:2: error: previously used here
case NAND_CMD_READOOB:
^
make[4]: *** [drivers/mtd/nand/pxa3xx_nand.o] Error 1
Guenter
On Fri, Jan 12, 2018 at 11:49 AM, Olof's autobuilder <build(a)lixom.net> wrote:
> Here are the build results from automated periodic testing.
>
> The tree being built was stable-rc, found at:
>
> URL: git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git
>
> Errors:
>
> arm.allmodconfig:
> /work/build/batch/drivers/mtd/nand/pxa3xx_nand.c:749:2: error: duplicate case value
>
> arm.cm_x300_defconfig:
> /work/build/batch/drivers/mtd/nand/pxa3xx_nand.c:749:2: error: duplicate case value
>
> arm.mvebu_v7_defconfig:
> /work/build/batch/drivers/mtd/nand/pxa3xx_nand.c:749:2: error: duplicate case value
>
> arm.pxa3xx_defconfig:
> /work/build/batch/drivers/mtd/nand/pxa3xx_nand.c:749:2: error: duplicate case value
>
> arm.raumfeld_defconfig:
> /work/build/batch/drivers/mtd/nand/pxa3xx_nand.c:749:2: error: duplicate case value
Same problem as with 4.4.y before:
fee4380f368e ("mtd: nand: pxa3xx: Fix READOOB implementation")
was backported as commit fea22562533e but needs to be done differently here.
Arnd
This is a note to let you know that I've just added the patch titled
sh_eth: fix TSU resource handling
to the 4.9-stable tree which can be found at:
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=sum…
The filename of the patch is:
sh_eth-fix-tsu-resource-handling.patch
and it can be found in the queue-4.9 subdirectory.
If you, or anyone else, feels it should not be added to the stable tree,
please let <stable(a)vger.kernel.org> know about it.
>From foo@baz Sat Jan 13 10:51:19 CET 2018
From: Sergei Shtylyov <sergei.shtylyov(a)cogentembedded.com>
Date: Wed, 3 Jan 2018 20:09:49 +0300
Subject: sh_eth: fix TSU resource handling
From: Sergei Shtylyov <sergei.shtylyov(a)cogentembedded.com>
[ Upstream commit dfe8266b8dd10e12a731c985b725fcf7f0e537f0 ]
When switching the driver to the managed device API, I managed to break
the case of a dual Ether devices sharing a single TSU: the 2nd Ether port
wouldn't probe. Iwamatsu-san has tried to fix this but his patch was buggy
and he then dropped the ball...
The solution is to limit calling devm_request_mem_region() to the first
of the two ports sharing the same TSU, so devm_ioremap_resource() can't
be used anymore for the TSU resource...
Fixes: d5e07e69218f ("sh_eth: use managed device API")
Reported-by: Nobuhiro Iwamatsu <nobuhiro.iwamatsu.yj(a)renesas.com>
Signed-off-by: Sergei Shtylyov <sergei.shtylyov(a)cogentembedded.com>
Signed-off-by: David S. Miller <davem(a)davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh(a)linuxfoundation.org>
---
drivers/net/ethernet/renesas/sh_eth.c | 25 ++++++++++++++++++++++---
1 file changed, 22 insertions(+), 3 deletions(-)
--- a/drivers/net/ethernet/renesas/sh_eth.c
+++ b/drivers/net/ethernet/renesas/sh_eth.c
@@ -3087,10 +3087,29 @@ static int sh_eth_drv_probe(struct platf
/* ioremap the TSU registers */
if (mdp->cd->tsu) {
struct resource *rtsu;
+
rtsu = platform_get_resource(pdev, IORESOURCE_MEM, 1);
- mdp->tsu_addr = devm_ioremap_resource(&pdev->dev, rtsu);
- if (IS_ERR(mdp->tsu_addr)) {
- ret = PTR_ERR(mdp->tsu_addr);
+ if (!rtsu) {
+ dev_err(&pdev->dev, "no TSU resource\n");
+ ret = -ENODEV;
+ goto out_release;
+ }
+ /* We can only request the TSU region for the first port
+ * of the two sharing this TSU for the probe to succeed...
+ */
+ if (devno % 2 == 0 &&
+ !devm_request_mem_region(&pdev->dev, rtsu->start,
+ resource_size(rtsu),
+ dev_name(&pdev->dev))) {
+ dev_err(&pdev->dev, "can't request TSU resource.\n");
+ ret = -EBUSY;
+ goto out_release;
+ }
+ mdp->tsu_addr = devm_ioremap(&pdev->dev, rtsu->start,
+ resource_size(rtsu));
+ if (!mdp->tsu_addr) {
+ dev_err(&pdev->dev, "TSU region ioremap() failed.\n");
+ ret = -ENOMEM;
goto out_release;
}
mdp->port = devno % 2;
Patches currently in stable-queue which might be from sergei.shtylyov(a)cogentembedded.com are
queue-4.9/sh_eth-fix-sh7757-gether-initialization.patch
queue-4.9/sh_eth-fix-tsu-resource-handling.patch