From patchwork Sun Dec 29 17:17:42 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg Kroah-Hartman X-Patchwork-Id: 11312273 X-Patchwork-Delegate: paulburton@kernel.org Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id B5225930 for ; Sun, 29 Dec 2019 17:29:56 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 9488F222C2 for ; Sun, 29 Dec 2019 17:29:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1577640596; bh=FoAkvQ84Aqr7ov3qxU+UYFel2j4aZ8kOa2zDHZChO/M=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=g1BLpuIBcm9X413vhTAEc6r1VWa1XEHUWcikoYqMFYpRA9shcgR+JLSN8Jq0oBGUb rgBws4X3+MtAF2khwsJMqNWpXI6wHl+X+gKKh+6whJm06sD2JLJe0kZGNgXFBHXejr 1+FIQ09B57U/+UzMlfvbNwOUe7Uom6k9Yx1E0vlo= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728899AbfL2R3z (ORCPT ); Sun, 29 Dec 2019 12:29:55 -0500 Received: from mail.kernel.org ([198.145.29.99]:55070 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728892AbfL2R3y (ORCPT ); Sun, 29 Dec 2019 12:29:54 -0500 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 0B37220722; Sun, 29 Dec 2019 17:29:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1577640593; bh=FoAkvQ84Aqr7ov3qxU+UYFel2j4aZ8kOa2zDHZChO/M=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=xITgH2RjjCPOHwbVSaYDgQlyhUREQ/FNu1CoD1KMYO8I2Tb3jpbi636fnlilXV1RL YioMeZTgwPkgGd7luyL3F7yx/WLQDvYzhRPZwVOyzivqB1z13peBgVuW1TqoP37Dp8 MEVZIgLm7J54fGBm8gfxYqaUOITOnwDhx0hMgGCo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Paul Burton , linux-mips@vger.kernel.org, Huacai Chen , Jiaxun Yang , Sasha Levin Subject: [PATCH 4.19 060/219] MIPS: syscall: Emit Loongson3 sync workarounds within asm Date: Sun, 29 Dec 2019 18:17:42 +0100 Message-Id: <20191229162515.892321194@linuxfoundation.org> X-Mailer: git-send-email 2.24.1 In-Reply-To: <20191229162508.458551679@linuxfoundation.org> References: <20191229162508.458551679@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Sender: linux-mips-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-mips@vger.kernel.org From: Paul Burton [ Upstream commit e84957e6ae043bb83ad6ae7e949a1ce97b6bbfef ] Generate the sync instructions required to workaround Loongson3 LL/SC errata within inline asm blocks, which feels a little safer than doing it from C where strictly speaking the compiler would be well within its rights to insert a memory access between the separate asm statements we previously had, containing sync & ll instructions respectively. Signed-off-by: Paul Burton Cc: linux-mips@vger.kernel.org Cc: Huacai Chen Cc: Jiaxun Yang Cc: linux-kernel@vger.kernel.org Signed-off-by: Sasha Levin --- arch/mips/kernel/syscall.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/arch/mips/kernel/syscall.c b/arch/mips/kernel/syscall.c index 69c17b549fd3..10990434bf94 100644 --- a/arch/mips/kernel/syscall.c +++ b/arch/mips/kernel/syscall.c @@ -37,6 +37,7 @@ #include #include #include +#include #include #include @@ -135,6 +136,7 @@ static inline int mips_atomic_set(unsigned long addr, unsigned long new) " .set "MIPS_ISA_ARCH_LEVEL" \n" " li %[err], 0 \n" "1: \n" + " " __SYNC(full, loongson3_war) " \n" user_ll("%[old]", "(%[addr])") " move %[tmp], %[new] \n" "2: \n" From patchwork Sun Dec 29 17:19:47 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg Kroah-Hartman X-Patchwork-Id: 11312287 X-Patchwork-Delegate: paulburton@kernel.org Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id D76DB138C for ; Sun, 29 Dec 2019 17:37:56 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id B6436207FD for ; Sun, 29 Dec 2019 17:37:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1577641076; bh=fNiXTEGDcvUF3M392SCaoc00rIAL2EBcPiYfH/i1u/w=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=0OuiycMctOMroH9DSjngRK280m6OHAhH0eTecdQQPIynomb3L3vZa/Jy6Zj19g3Fq pHXHXixGEY9w5wPu85oBe13BRnQLGe9J25QCz4WE0u5ll4mpPvSxVIfBIeUehF6Evm hKY+7Iorv9g0YEmn9MkW5odKc0Uqs+bIFK0fmXr0= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729747AbfL2Re7 (ORCPT ); Sun, 29 Dec 2019 12:34:59 -0500 Received: from mail.kernel.org ([198.145.29.99]:38774 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729745AbfL2Re7 (ORCPT ); Sun, 29 Dec 2019 12:34:59 -0500 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 7A587206DB; Sun, 29 Dec 2019 17:34:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1577640897; bh=fNiXTEGDcvUF3M392SCaoc00rIAL2EBcPiYfH/i1u/w=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=FiSLG2Vbbf6ZNGwu0u4vVr6AIw7rs8D3YeFUEvItJer6bkH+hlpu2YOgiAoHWDNEO jZ4w57tKXJzLDpK9lJX6gvwmHOwzlLdUaRWsc72JJH6ibJSaOASuATvu/YpdhZXaIp 9CCuzCooguOmqqdvVuWOoyvHkYGyRjE9OBaGXEeI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Mike Rapoport , Paul Burton , Ralf Baechle , James Hogan , linux-mips@vger.kernel.org, linux-mm@kvack.org, Mike Rapoport , Sasha Levin Subject: [PATCH 4.19 185/219] mips: fix build when "48 bits virtual memory" is enabled Date: Sun, 29 Dec 2019 18:19:47 +0100 Message-Id: <20191229162537.238599739@linuxfoundation.org> X-Mailer: git-send-email 2.24.1 In-Reply-To: <20191229162508.458551679@linuxfoundation.org> References: <20191229162508.458551679@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Sender: linux-mips-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-mips@vger.kernel.org From: Mike Rapoport [ Upstream commit 3ed6751bb8fa89c3014399bb0414348499ee202a ] With CONFIG_MIPS_VA_BITS_48=y the build fails miserably: CC arch/mips/kernel/asm-offsets.s In file included from arch/mips/include/asm/pgtable.h:644, from include/linux/mm.h:99, from arch/mips/kernel/asm-offsets.c:15: include/asm-generic/pgtable.h:16:2: error: #error CONFIG_PGTABLE_LEVELS is not consistent with __PAGETABLE_{P4D,PUD,PMD}_FOLDED #error CONFIG_PGTABLE_LEVELS is not consistent with __PAGETABLE_{P4D,PUD,PMD}_FOLDED ^~~~~ include/asm-generic/pgtable.h:390:28: error: unknown type name 'p4d_t'; did you mean 'pmd_t'? static inline int p4d_same(p4d_t p4d_a, p4d_t p4d_b) ^~~~~ pmd_t [ ... more such errors ... ] scripts/Makefile.build:99: recipe for target 'arch/mips/kernel/asm-offsets.s' failed make[2]: *** [arch/mips/kernel/asm-offsets.s] Error 1 This happens because when CONFIG_MIPS_VA_BITS_48 enables 4th level of the page tables, but neither pgtable-nop4d.h nor 5level-fixup.h are included to cope with the 5th level. Replace #ifdef conditions around includes of the pgtable-nop{m,u}d.h with explicit CONFIG_PGTABLE_LEVELS and add include of 5level-fixup.h for the case when CONFIG_PGTABLE_LEVELS==4 Signed-off-by: Mike Rapoport Signed-off-by: Paul Burton Cc: Ralf Baechle Cc: James Hogan Cc: linux-mips@vger.kernel.org Cc: linux-kernel@vger.kernel.org Cc: linux-mm@kvack.org Cc: Mike Rapoport Signed-off-by: Sasha Levin --- arch/mips/include/asm/pgtable-64.h | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/arch/mips/include/asm/pgtable-64.h b/arch/mips/include/asm/pgtable-64.h index 93a9dce31f25..813dfe5f45a5 100644 --- a/arch/mips/include/asm/pgtable-64.h +++ b/arch/mips/include/asm/pgtable-64.h @@ -18,10 +18,12 @@ #include #define __ARCH_USE_5LEVEL_HACK -#if defined(CONFIG_PAGE_SIZE_64KB) && !defined(CONFIG_MIPS_VA_BITS_48) +#if CONFIG_PGTABLE_LEVELS == 2 #include -#elif !(defined(CONFIG_PAGE_SIZE_4KB) && defined(CONFIG_MIPS_VA_BITS_48)) +#elif CONFIG_PGTABLE_LEVELS == 3 #include +#else +#include #endif /* @@ -216,6 +218,9 @@ static inline unsigned long pgd_page_vaddr(pgd_t pgd) return pgd_val(pgd); } +#define pgd_phys(pgd) virt_to_phys((void *)pgd_val(pgd)) +#define pgd_page(pgd) (pfn_to_page(pgd_phys(pgd) >> PAGE_SHIFT)) + static inline pud_t *pud_offset(pgd_t *pgd, unsigned long address) { return (pud_t *)pgd_page_vaddr(*pgd) + pud_index(address);