Home Home > GIT Browse
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichal Marek <mmarek@suse.cz>2017-04-06 16:14:07 +0200
committerMichal Marek <mmarek@suse.cz>2017-04-06 16:14:07 +0200
commitdfad6cc7fd5e7295e684475fdd426b0a8065ce7f (patch)
tree98671f5b1bb4df85f9d6212675fe712f36717ad9
parentf9c08cc12febb192b173ed8131bc91613095f92a (diff)
parentd79329f9f391bcd7c922a97028ffea6417a73bbe (diff)
Merge branch 'users/mbrugger/SLE12-SP2/for-next' into SLE12-SP2
Pull ARM64 fixes from Matthias Brugger (bsc#1032681, bsc#1032673).
-rw-r--r--patches.arch/0001-arm64-hugetlb-fix-the-wrong-address-for-several-func.patch67
-rw-r--r--patches.arch/0001-arm64-hugetlb-fix-the-wrong-return-value-for-huge_pt.patch34
-rw-r--r--patches.arch/0001-arm64-hugetlb-remove-the-wrong-pmd-check-in-find_num.patch73
-rw-r--r--patches.drivers/0001-xgene_enet-remove-bogus-forward-declarations.patch190
-rw-r--r--series.conf6
5 files changed, 370 insertions, 0 deletions
diff --git a/patches.arch/0001-arm64-hugetlb-fix-the-wrong-address-for-several-func.patch b/patches.arch/0001-arm64-hugetlb-fix-the-wrong-address-for-several-func.patch
new file mode 100644
index 0000000000..717da73659
--- /dev/null
+++ b/patches.arch/0001-arm64-hugetlb-fix-the-wrong-address-for-several-func.patch
@@ -0,0 +1,67 @@
+From: Huang Shijie <shijie.huang@arm.com>
+Date: Tue, 8 Nov 2016 13:44:39 +0800
+Subject: arm64: hugetlb: fix the wrong address for several functions
+Git-commit: 0c2f0afe3582c58efeef93bc57bc07d502132618
+Patch-mainline: v4.10-rc1
+References: bsc#1032681
+
+The libhugetlbfs meets several failures since the following functions
+do not use the correct address:
+ huge_ptep_get_and_clear()
+ huge_ptep_set_access_flags()
+ huge_ptep_set_wrprotect()
+ huge_ptep_clear_flush()
+
+This patch fixes the wrong address for them.
+
+Signed-off-by: Huang Shijie <shijie.huang@arm.com>
+Reviewed-by: Catalin Marinas <catalin.marinas@arm.com>
+Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
+Signed-off-by: Matthias Brugger <mbrugger@suse.com>
+---
+ arch/arm64/mm/hugetlbpage.c | 8 ++++----
+ 1 file changed, 4 insertions(+), 4 deletions(-)
+
+diff --git a/arch/arm64/mm/hugetlbpage.c b/arch/arm64/mm/hugetlbpage.c
+index 9a1069dd889f..964b7549af5c 100644
+--- a/arch/arm64/mm/hugetlbpage.c
++++ b/arch/arm64/mm/hugetlbpage.c
+@@ -200,7 +200,7 @@ pte_t huge_ptep_get_and_clear(struct mm_struct *mm,
+ ncontig = find_num_contig(mm, addr, cpte, *cpte, &pgsize);
+ /* save the 1st pte to return */
+ pte = ptep_get_and_clear(mm, addr, cpte);
+- for (i = 1; i < ncontig; ++i) {
++ for (i = 1, addr += pgsize; i < ncontig; ++i, addr += pgsize) {
+ /*
+ * If HW_AFDBM is enabled, then the HW could
+ * turn on the dirty bit for any of the page
+@@ -238,7 +238,7 @@ int huge_ptep_set_access_flags(struct vm_area_struct *vma,
+ pfn = pte_pfn(*cpte);
+ ncontig = find_num_contig(vma->vm_mm, addr, cpte,
+ *cpte, &pgsize);
+- for (i = 0; i < ncontig; ++i, ++cpte) {
++ for (i = 0; i < ncontig; ++i, ++cpte, addr += pgsize) {
+ changed = ptep_set_access_flags(vma, addr, cpte,
+ pfn_pte(pfn,
+ hugeprot),
+@@ -261,7 +261,7 @@ void huge_ptep_set_wrprotect(struct mm_struct *mm,
+
+ cpte = huge_pte_offset(mm, addr);
+ ncontig = find_num_contig(mm, addr, cpte, *cpte, &pgsize);
+- for (i = 0; i < ncontig; ++i, ++cpte)
++ for (i = 0; i < ncontig; ++i, ++cpte, addr += pgsize)
+ ptep_set_wrprotect(mm, addr, cpte);
+ } else {
+ ptep_set_wrprotect(mm, addr, ptep);
+@@ -279,7 +279,7 @@ void huge_ptep_clear_flush(struct vm_area_struct *vma,
+ cpte = huge_pte_offset(vma->vm_mm, addr);
+ ncontig = find_num_contig(vma->vm_mm, addr, cpte,
+ *cpte, &pgsize);
+- for (i = 0; i < ncontig; ++i, ++cpte)
++ for (i = 0; i < ncontig; ++i, ++cpte, addr += pgsize)
+ ptep_clear_flush(vma, addr, cpte);
+ } else {
+ ptep_clear_flush(vma, addr, ptep);
+--
+2.12.0
+
diff --git a/patches.arch/0001-arm64-hugetlb-fix-the-wrong-return-value-for-huge_pt.patch b/patches.arch/0001-arm64-hugetlb-fix-the-wrong-return-value-for-huge_pt.patch
new file mode 100644
index 0000000000..4ad1586af7
--- /dev/null
+++ b/patches.arch/0001-arm64-hugetlb-fix-the-wrong-return-value-for-huge_pt.patch
@@ -0,0 +1,34 @@
+From: Huang Shijie <shijie.huang@arm.com>
+Date: Wed, 11 Jan 2017 14:02:00 +0800
+Subject: arm64: hugetlb: fix the wrong return value for
+ huge_ptep_set_access_flags
+Git-commit: 69d012345a1a32d3f03957f14d972efccc106a98
+Patch-mainline: v4.10-rc4
+References: bsc#1032681
+
+In current code, the @changed always returns the last one's status for
+the huge page with the contiguous bit set. This is really not what we
+want. Even one of the PTEs is changed, we should tell it to the caller.
+
+This patch fixes this issue.
+
+Fixes: 66b3923a1a0f ("arm64: hugetlb: add support for PTE contiguous bit")
+Cc: <stable@vger.kernel.org> # 4.5.x-
+Signed-off-by: Huang Shijie <shijie.huang@arm.com>
+Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
+Signed-off-by: Matthias Brugger <mbrugger@suse.com>
+---
+ arch/arm64/mm/hugetlbpage.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+--- a/arch/arm64/mm/hugetlbpage.c
++++ b/arch/arm64/mm/hugetlbpage.c
+@@ -239,7 +239,7 @@ int huge_ptep_set_access_flags(struct vm
+ ncontig = find_num_contig(vma->vm_mm, addr, cpte,
+ *cpte, &pgsize);
+ for (i = 0; i < ncontig; ++i, ++cpte, addr += pgsize) {
+- changed = ptep_set_access_flags(vma, addr, cpte,
++ changed |= ptep_set_access_flags(vma, addr, cpte,
+ pfn_pte(pfn,
+ hugeprot),
+ dirty);
diff --git a/patches.arch/0001-arm64-hugetlb-remove-the-wrong-pmd-check-in-find_num.patch b/patches.arch/0001-arm64-hugetlb-remove-the-wrong-pmd-check-in-find_num.patch
new file mode 100644
index 0000000000..f3d41b18da
--- /dev/null
+++ b/patches.arch/0001-arm64-hugetlb-remove-the-wrong-pmd-check-in-find_num.patch
@@ -0,0 +1,73 @@
+From: Huang Shijie <shijie.huang@arm.com>
+Date: Tue, 8 Nov 2016 13:44:38 +0800
+Subject: arm64: hugetlb: remove the wrong pmd check in find_num_contig()
+Git-commit: 20156ce2365d61beaa6f5a78a7a789044e0e7acc
+Patch-mainline: v4.10-rc1
+References: bsc#1032681
+
+The find_num_contig() will return 1 when the pmd is not present.
+It will cause a kernel dead loop in the following scenaro:
+
+ 1.) pmd entry is not present.
+
+ 2.) the page fault occurs:
+ ... hugetlb_fault() --> hugetlb_no_page() --> set_huge_pte_at()
+
+ 3.) set_huge_pte_at() will only set the first PMD entry, since the
+ find_num_contig just return 1 in this case. So the PMD entries
+ are all empty except the first one.
+
+ 4.) when kernel accesses the address mapped by the second PMD entry,
+ a new page fault occurs:
+ ... hugetlb_fault() --> huge_ptep_set_access_flags()
+
+ The second PMD entry is still empty now.
+
+ 5.) When the kernel returns, the access will cause a page fault again.
+ The kernel will run like the "4)" above.
+ We will see a dead loop since here.
+
+The dead loop is caught in the 32M hugetlb page (2M PMD + Contiguous bit).
+
+This patch removes wrong pmd check, and fixes this dead loop.
+
+This patch also removes the redundant checks for PGD/PUD in
+the find_num_contig().
+
+Acked-by: Steve Capper <steve.capper@arm.com>
+Signed-off-by: Huang Shijie <shijie.huang@arm.com>
+Reviewed-by: Catalin Marinas <catalin.marinas@arm.com>
+Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
+Signed-off-by: Matthias Brugger <mbrugger@suse.com>
+---
+ arch/arm64/mm/hugetlbpage.c | 12 ------------
+ 1 file changed, 12 deletions(-)
+
+diff --git a/arch/arm64/mm/hugetlbpage.c b/arch/arm64/mm/hugetlbpage.c
+index 0a4c97b618ec..9a1069dd889f 100644
+--- a/arch/arm64/mm/hugetlbpage.c
++++ b/arch/arm64/mm/hugetlbpage.c
+@@ -51,20 +51,8 @@ static int find_num_contig(struct mm_struct *mm, unsigned long addr,
+ *pgsize = PAGE_SIZE;
+ if (!pte_cont(pte))
+ return 1;
+- if (!pgd_present(*pgd)) {
+- VM_BUG_ON(!pgd_present(*pgd));
+- return 1;
+- }
+ pud = pud_offset(pgd, addr);
+- if (!pud_present(*pud)) {
+- VM_BUG_ON(!pud_present(*pud));
+- return 1;
+- }
+ pmd = pmd_offset(pud, addr);
+- if (!pmd_present(*pmd)) {
+- VM_BUG_ON(!pmd_present(*pmd));
+- return 1;
+- }
+ if ((pte_t *)pmd == ptep) {
+ *pgsize = PMD_SIZE;
+ return CONT_PMDS;
+--
+2.12.0
+
diff --git a/patches.drivers/0001-xgene_enet-remove-bogus-forward-declarations.patch b/patches.drivers/0001-xgene_enet-remove-bogus-forward-declarations.patch
new file mode 100644
index 0000000000..7491323a3f
--- /dev/null
+++ b/patches.drivers/0001-xgene_enet-remove-bogus-forward-declarations.patch
@@ -0,0 +1,190 @@
+From: Arnd Bergmann <arnd@arndb.de>
+Date: Wed, 1 Feb 2017 17:46:02 +0100
+Subject: xgene_enet: remove bogus forward declarations
+Git-commit: 1f3d62090d3ba4d0c14e5271be87812fc577b197
+Patch-mainline: v4.11-rc1
+References: bsc#1032673
+
+The device match tables for both the xgene_enet driver and its phy driver
+have forward declarations that declare an array without a length, leading
+to a clang warning when they are not followed by an actual defitinition:
+
+drivers/net/ethernet/apm/xgene/../../../phy/mdio-xgene.h:135:34: warning: tentative array definition assumed to have one element
+drivers/net/ethernet/apm/xgene/xgene_enet_main.c:33:36: warning: tentative array definition assumed to have one element
+
+The declarations for the mdio driver are even in a header file, so they
+cause duplicate definitions of the tables for each file that includes
+them.
+
+This removes all four forward declarations and moves the actual
+definitions up a little, so they are in front of their first user. For
+the OF match tables, this means having to remove the #ifdef around them,
+and passing the actual structure into of_match_device(). This has no
+effect on the generated object code though, as the of_match_device
+function has an empty stub that does not evaluate its argument, and
+the symbol gets dropped either way.
+
+Fixes: 43b3cf6634a4 ("drivers: net: phy: xgene: Add MDIO driver")
+Signed-off-by: Arnd Bergmann <arnd@arndb.de>
+Signed-off-by: David S. Miller <davem@davemloft.net>
+Signed-off-by: Matthias Brugger <mbrugger@suse.com>
+---
+ drivers/net/ethernet/apm/xgene/xgene_enet_main.c | 50 ++++++++++++------------
+ drivers/net/phy/mdio-xgene.c | 50 ++++++++++++------------
+ drivers/net/phy/mdio-xgene.h | 4 --
+ 3 files changed, 48 insertions(+), 56 deletions(-)
+
+diff --git a/drivers/net/ethernet/apm/xgene/xgene_enet_main.c b/drivers/net/ethernet/apm/xgene/xgene_enet_main.c
+index ab43c52723df..d0d0d12b531f 100644
+--- a/drivers/net/ethernet/apm/xgene/xgene_enet_main.c
++++ b/drivers/net/ethernet/apm/xgene/xgene_enet_main.c
+@@ -1964,6 +1964,30 @@ static void xgene_enet_napi_add(struct xgene_enet_pdata *pdata)
+ }
+ }
+
++#ifdef CONFIG_ACPI
++static const struct acpi_device_id xgene_enet_acpi_match[] = {
++ { "APMC0D05", XGENE_ENET1},
++ { "APMC0D30", XGENE_ENET1},
++ { "APMC0D31", XGENE_ENET1},
++ { "APMC0D3F", XGENE_ENET1},
++ { "APMC0D26", XGENE_ENET2},
++ { "APMC0D25", XGENE_ENET2},
++ { }
++};
++MODULE_DEVICE_TABLE(acpi, xgene_enet_acpi_match);
++#endif
++
++static const struct of_device_id xgene_enet_of_match[] = {
++ {.compatible = "apm,xgene-enet", .data = (void *)XGENE_ENET1},
++ {.compatible = "apm,xgene1-sgenet", .data = (void *)XGENE_ENET1},
++ {.compatible = "apm,xgene1-xgenet", .data = (void *)XGENE_ENET1},
++ {.compatible = "apm,xgene2-sgenet", .data = (void *)XGENE_ENET2},
++ {.compatible = "apm,xgene2-xgenet", .data = (void *)XGENE_ENET2},
++ {},
++};
++
++MODULE_DEVICE_TABLE(of, xgene_enet_of_match);
++
+ static int xgene_enet_probe(struct platform_device *pdev)
+ {
+ struct net_device *ndev;
+@@ -2110,32 +2134,6 @@ static void xgene_enet_shutdown(struct platform_device *pdev)
+ xgene_enet_remove(pdev);
+ }
+
+-#ifdef CONFIG_ACPI
+-static const struct acpi_device_id xgene_enet_acpi_match[] = {
+- { "APMC0D05", XGENE_ENET1},
+- { "APMC0D30", XGENE_ENET1},
+- { "APMC0D31", XGENE_ENET1},
+- { "APMC0D3F", XGENE_ENET1},
+- { "APMC0D26", XGENE_ENET2},
+- { "APMC0D25", XGENE_ENET2},
+- { }
+-};
+-MODULE_DEVICE_TABLE(acpi, xgene_enet_acpi_match);
+-#endif
+-
+-#ifdef CONFIG_OF
+-static const struct of_device_id xgene_enet_of_match[] = {
+- {.compatible = "apm,xgene-enet", .data = (void *)XGENE_ENET1},
+- {.compatible = "apm,xgene1-sgenet", .data = (void *)XGENE_ENET1},
+- {.compatible = "apm,xgene1-xgenet", .data = (void *)XGENE_ENET1},
+- {.compatible = "apm,xgene2-sgenet", .data = (void *)XGENE_ENET2},
+- {.compatible = "apm,xgene2-xgenet", .data = (void *)XGENE_ENET2},
+- {},
+-};
+-
+-MODULE_DEVICE_TABLE(of, xgene_enet_of_match);
+-#endif
+-
+ static struct platform_driver xgene_enet_driver = {
+ .driver = {
+ .name = "xgene-enet",
+diff --git a/drivers/net/phy/mdio-xgene.c b/drivers/net/phy/mdio-xgene.c
+index 92af182951be..f095051beb54 100644
+--- a/drivers/net/phy/mdio-xgene.c
++++ b/drivers/net/phy/mdio-xgene.c
+@@ -311,6 +311,30 @@ static acpi_status acpi_register_phy(acpi_handle handle, u32 lvl,
+ }
+ #endif
+
++static const struct of_device_id xgene_mdio_of_match[] = {
++ {
++ .compatible = "apm,xgene-mdio-rgmii",
++ .data = (void *)XGENE_MDIO_RGMII
++ },
++ {
++ .compatible = "apm,xgene-mdio-xfi",
++ .data = (void *)XGENE_MDIO_XFI
++ },
++ {},
++};
++MODULE_DEVICE_TABLE(of, xgene_mdio_of_match);
++
++#ifdef CONFIG_ACPI
++static const struct acpi_device_id xgene_mdio_acpi_match[] = {
++ { "APMC0D65", XGENE_MDIO_RGMII },
++ { "APMC0D66", XGENE_MDIO_XFI },
++ { }
++};
++
++MODULE_DEVICE_TABLE(acpi, xgene_mdio_acpi_match);
++#endif
++
++
+ static int xgene_mdio_probe(struct platform_device *pdev)
+ {
+ struct device *dev = &pdev->dev;
+@@ -430,32 +454,6 @@ static int xgene_mdio_remove(struct platform_device *pdev)
+ return 0;
+ }
+
+-#ifdef CONFIG_OF
+-static const struct of_device_id xgene_mdio_of_match[] = {
+- {
+- .compatible = "apm,xgene-mdio-rgmii",
+- .data = (void *)XGENE_MDIO_RGMII
+- },
+- {
+- .compatible = "apm,xgene-mdio-xfi",
+- .data = (void *)XGENE_MDIO_XFI
+- },
+- {},
+-};
+-
+-MODULE_DEVICE_TABLE(of, xgene_mdio_of_match);
+-#endif
+-
+-#ifdef CONFIG_ACPI
+-static const struct acpi_device_id xgene_mdio_acpi_match[] = {
+- { "APMC0D65", XGENE_MDIO_RGMII },
+- { "APMC0D66", XGENE_MDIO_XFI },
+- { }
+-};
+-
+-MODULE_DEVICE_TABLE(acpi, xgene_mdio_acpi_match);
+-#endif
+-
+ static struct platform_driver xgene_mdio_driver = {
+ .driver = {
+ .name = "xgene-mdio",
+diff --git a/drivers/net/phy/mdio-xgene.h b/drivers/net/phy/mdio-xgene.h
+index 354241b53c1d..594a11d42401 100644
+--- a/drivers/net/phy/mdio-xgene.h
++++ b/drivers/net/phy/mdio-xgene.h
+@@ -132,10 +132,6 @@ static inline u64 xgene_enet_get_field_value(int pos, int len, u64 src)
+ #define GET_BIT(field, src) \
+ xgene_enet_get_field_value(field ## _POS, 1, src)
+
+-static const struct of_device_id xgene_mdio_of_match[];
+-#ifdef CONFIG_ACPI
+-static const struct acpi_device_id xgene_mdio_acpi_match[];
+-#endif
+ int xgene_mdio_rgmii_read(struct mii_bus *bus, int phy_id, int reg);
+ int xgene_mdio_rgmii_write(struct mii_bus *bus, int phy_id, int reg, u16 data);
+ struct phy_device *xgene_enet_phy_register(struct mii_bus *bus, int phy_addr);
+--
+2.12.0
+
diff --git a/series.conf b/series.conf
index e6becb0d73..246fb4a33a 100644
--- a/series.conf
+++ b/series.conf
@@ -1038,6 +1038,11 @@
patches.arch/arm64-net-thunderx-bgx-dont-use-mdio.patch
patches.arch/arm64-net-thunderx-Fix-broken-of_node_put-code.patch
+ # bsc#1032681 fix hugepagetlb code
+ patches.arch/0001-arm64-hugetlb-remove-the-wrong-pmd-check-in-find_num.patch
+ patches.arch/0001-arm64-hugetlb-fix-the-wrong-address-for-several-func.patch
+ patches.arch/0001-arm64-hugetlb-fix-the-wrong-return-value-for-huge_pt.patch
+
# APM xgene
patches.arch/arm64-0001-Documentation-EDAC-Update-xgene-binding-for-missing-.patch
patches.arch/arm64-0002-EDAC-xgene-Add-missing-SoC-register-bus-error-handli.patch
@@ -1509,6 +1514,7 @@
patches.drivers/0034-phy-xgene-rename-enum-phy_mode-to-enum-xgene_phy_mod.patch
patches.drivers/0035-mmc-sdhci-of-arasan-Remove-no-hispd-and-no-cmd23-qui.patch
patches.drivers/0036-power-reset-xgene-reboot-Unmap-region-obtained-by-of.patch
+ patches.drivers/0001-xgene_enet-remove-bogus-forward-declarations.patch
# make rpm fix for arm/arm64 (bsc#1010032)
patches.fixes/0001-arm64-Use-full-path-in-KBUILD_IMAGE-definition.patch