From patchwork Wed Jul 15 05:33:39 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pekka Enberg X-Patchwork-Id: 11664219 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 719161392 for ; Wed, 15 Jul 2020 05:33:54 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 3D3C42068F for ; Wed, 15 Jul 2020 05:33:54 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="evNZ8y0A" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 3D3C42068F Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 47D2D6B0005; Wed, 15 Jul 2020 01:33:53 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 406716B0006; Wed, 15 Jul 2020 01:33:53 -0400 (EDT) X-Original-To: int-list-linux-mm@kvack.org X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 2CECC6B0007; Wed, 15 Jul 2020 01:33:53 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0163.hostedemail.com [216.40.44.163]) by kanga.kvack.org (Postfix) with ESMTP id 16AC86B0005 for ; Wed, 15 Jul 2020 01:33:53 -0400 (EDT) Received: from smtpin06.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id 95FF31EE6 for ; Wed, 15 Jul 2020 05:33:52 +0000 (UTC) X-FDA: 77039193504.06.jam01_43156f526ef7 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin06.hostedemail.com (Postfix) with ESMTP id 6688D10040F3E for ; Wed, 15 Jul 2020 05:33:52 +0000 (UTC) X-Spam-Summary: 1,0,0,9c23743442f80c73,d41d8cd98f00b204,penberg@gmail.com,,RULES_HIT:41:69:355:379:541:800:960:968:973:988:989:1260:1311:1314:1345:1437:1515:1535:1543:1711:1730:1747:1777:1792:1978:1981:2194:2199:2393:2559:2562:2897:3138:3139:3140:3141:3142:3354:3865:3866:3867:3868:3871:3874:4117:4250:4321:4419:4605:5007:6261:6653:7576:7875:7903:9121:9413:9592:10004:11026:11658:11914:12043:12291:12296:12297:12438:12517:12519:12555:12679:12683:12895:13161:13229:13894:14096:14181:14394:14687:14721:14819:21080:21444:21451:21627:21666:21990:30003:30054:30064,0,RBL:209.85.208.195:@gmail.com:.lbl8.mailshell.net-66.100.201.100 62.18.0.100;04yf31zw6a5ynuj16eqkspjz8z8ajyp6rst5rm6reb8dq3357qsfbtyxpo7hfpe.pnap6tzm9tkg1ud57g93buak899rrkunopapoo5gc66sta6rp91gc47rwhnmeu9.g-lbl8.mailshell.net-223.238.255.100,CacheIP:none,Bayesian:0.5,0.5,0.5,Netcheck:none,DomainCache:0,MSF:not bulk,SPF:fp,MSBL:0,DNSBL:none,Custom_rules:0:0:0,LFtime:24,LUA_SUMMARY:none X-HE-Tag: jam01_43156f526ef7 X-Filterd-Recvd-Size: 6551 Received: from mail-lj1-f195.google.com (mail-lj1-f195.google.com [209.85.208.195]) by imf45.hostedemail.com (Postfix) with ESMTP for ; Wed, 15 Jul 2020 05:33:51 +0000 (UTC) Received: by mail-lj1-f195.google.com with SMTP id e4so1171252ljn.4 for ; Tue, 14 Jul 2020 22:33:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=sAvmQZqWID7UVdhehRS2dX6KN23mXR/R3FvuzsykU1c=; b=evNZ8y0AD6ZnSFXihIqOJmoKao2t12ADCFj9fiWCMvBzpJ/V9QJOYzt4yRN9uJF4Uc UtNCYqIGMxqzMT6GPG5RHUhdpOh9uxj5kIcwpcOWfrGE7fLq2irACW1Z9q0gjMIP+gDA HNTvLI2aEcdM2veYQFjCyQXZ8+icYbdKrab2WFQ07W6nOTXah8oJQbEBwpQ7tr9QSYse qroZBJS6LOStfRrT+wg8VGZxsLFq/f29KrDmhNLJGasjS7Md1xAupyqFgdVxPTiuBddo NQRaC4dCvQeFRy+qhOy+WYG1ReYcdcCPkgaTWw8caNUERFL82Yo7ydeLjtIJuul/7O/B kUWw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=sAvmQZqWID7UVdhehRS2dX6KN23mXR/R3FvuzsykU1c=; b=BFTN6GWAKKMUKCc22H1cu8cf5N+TUzxsclN/94bklaEJPIvGnyMxPjn2U6iElwS1jz 6xgHk40mgiyLRkgcZE7Oaqs+ZHvTqRr06D6zs8GbBN7MfI+vo3i+Mg8NOoTBtrByZY6r LNBVvLQwsy/BOO8l9ai5J1hIFgZAEhD5sBKIHWP0hgb01+t4+OyjPLwRTkJzEDksjqwd kCbjYIjLlztaRdIiZJjvctXQtyAoboRiCtifpTj+4CwKIl9abC9H46rr/6oOOYK9zFsb Gb52OQZB/nb8Bgx7bxUTfa/NWdM1HCe7Fj8AeO/fvLg3wMeh6nA/UTTKsjx1PUbIfzc6 qr8Q== X-Gm-Message-State: AOAM530L5rCi1ZkFb/lSdILxaN8g+xMsYkcZeXPUckV42XFA8svm4661 MGVoKPnOQ1s7g5Cipw+RooU= X-Google-Smtp-Source: ABdhPJzdV9s5/3zfxjQZJb9nSURTEpoixudxUzM4aWQJxU50kgnQTY9vKfs1It6Ve59W+JZV3UKFzQ== X-Received: by 2002:a2e:b5c8:: with SMTP id g8mr3765583ljn.38.1594791230225; Tue, 14 Jul 2020 22:33:50 -0700 (PDT) Received: from nero.bb.dnainternet.fi (dyn9cmyyyyyyyyyyyyyft-3.rev.dnainternet.fi. [2001:14ba:2fa:2500::9]) by smtp.gmail.com with ESMTPSA id h14sm233916ljb.53.2020.07.14.22.33.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 14 Jul 2020 22:33:49 -0700 (PDT) From: Pekka Enberg To: linux-riscv@lists.infradead.org, linux-mm@kvack.org Cc: Pekka Enberg , Palmer Dabbelt , Mike Rapoport , Tom Lendacky Subject: [PATCH v2 1/2] mm: pgtable: Make generic pgprot_* macros available for no-MMU Date: Wed, 15 Jul 2020 08:33:39 +0300 Message-Id: <20200715053340.576300-1-penberg@gmail.com> X-Mailer: git-send-email 2.26.2 MIME-Version: 1.0 X-Rspamd-Queue-Id: 6688D10040F3E X-Spamd-Result: default: False [0.00 / 100.00] X-Rspamd-Server: rspam03 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: From: Pekka Enberg The header defines some generic pgprot_* implementations, but they are only available when CONFIG_MMU is enabled. The RISC-V architecture, for example, therefore defines some of these pgprot_* macros for !NOMMU. Let's make the pgprot_* generic available even for !NOMMU so we can remove the RISC-V specific definitions. Compile-tested with x86 defconfig, and riscv defconfig and !MMU defconfig. Suggested-by: Palmer Dabbelt Reviewed-by: Mike Rapoport Cc: Tom Lendacky Signed-off-by: Pekka Enberg Acked-by: David Rientjes --- v1 -> v2: Wrap pgprot_modify() -- which is specific to mmap -- with CONFIG_MMU to fix a build issue on ARM reported by kernel test robot . include/linux/pgtable.h | 71 +++++++++++++++++++++-------------------- 1 file changed, 37 insertions(+), 34 deletions(-) diff --git a/include/linux/pgtable.h b/include/linux/pgtable.h index 56c1e8eb7bb0..53e97da1e8e2 100644 --- a/include/linux/pgtable.h +++ b/include/linux/pgtable.h @@ -647,40 +647,6 @@ static inline int arch_unmap_one(struct mm_struct *mm, #define flush_tlb_fix_spurious_fault(vma, address) flush_tlb_page(vma, address) #endif -#ifndef pgprot_nx -#define pgprot_nx(prot) (prot) -#endif - -#ifndef pgprot_noncached -#define pgprot_noncached(prot) (prot) -#endif - -#ifndef pgprot_writecombine -#define pgprot_writecombine pgprot_noncached -#endif - -#ifndef pgprot_writethrough -#define pgprot_writethrough pgprot_noncached -#endif - -#ifndef pgprot_device -#define pgprot_device pgprot_noncached -#endif - -#ifndef pgprot_modify -#define pgprot_modify pgprot_modify -static inline pgprot_t pgprot_modify(pgprot_t oldprot, pgprot_t newprot) -{ - if (pgprot_val(oldprot) == pgprot_val(pgprot_noncached(oldprot))) - newprot = pgprot_noncached(newprot); - if (pgprot_val(oldprot) == pgprot_val(pgprot_writecombine(oldprot))) - newprot = pgprot_writecombine(newprot); - if (pgprot_val(oldprot) == pgprot_val(pgprot_device(oldprot))) - newprot = pgprot_device(newprot); - return newprot; -} -#endif - /* * When walking page tables, get the address of the next boundary, * or the end address of the range if that comes earlier. Although no @@ -840,6 +806,43 @@ static inline void ptep_modify_prot_commit(struct vm_area_struct *vma, * No-op macros that just return the current protection value. Defined here * because these macros can be used used even if CONFIG_MMU is not defined. */ + +#ifndef pgprot_nx +#define pgprot_nx(prot) (prot) +#endif + +#ifndef pgprot_noncached +#define pgprot_noncached(prot) (prot) +#endif + +#ifndef pgprot_writecombine +#define pgprot_writecombine pgprot_noncached +#endif + +#ifndef pgprot_writethrough +#define pgprot_writethrough pgprot_noncached +#endif + +#ifndef pgprot_device +#define pgprot_device pgprot_noncached +#endif + +#ifdef CONFIG_MMU +#ifndef pgprot_modify +#define pgprot_modify pgprot_modify +static inline pgprot_t pgprot_modify(pgprot_t oldprot, pgprot_t newprot) +{ + if (pgprot_val(oldprot) == pgprot_val(pgprot_noncached(oldprot))) + newprot = pgprot_noncached(newprot); + if (pgprot_val(oldprot) == pgprot_val(pgprot_writecombine(oldprot))) + newprot = pgprot_writecombine(newprot); + if (pgprot_val(oldprot) == pgprot_val(pgprot_device(oldprot))) + newprot = pgprot_device(newprot); + return newprot; +} +#endif +#endif /* CONFIG_MMU */ + #ifndef pgprot_encrypted #define pgprot_encrypted(prot) (prot) #endif From patchwork Wed Jul 15 05:33:40 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pekka Enberg X-Patchwork-Id: 11664221 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 CFA851392 for ; Wed, 15 Jul 2020 05:33:57 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 92EFD206F4 for ; Wed, 15 Jul 2020 05:33:57 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="NhrtZKIz" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 92EFD206F4 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 93A706B0006; Wed, 15 Jul 2020 01:33:56 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 8C2698D0001; Wed, 15 Jul 2020 01:33:56 -0400 (EDT) X-Original-To: int-list-linux-mm@kvack.org X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 78B316B0008; Wed, 15 Jul 2020 01:33:56 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0079.hostedemail.com [216.40.44.79]) by kanga.kvack.org (Postfix) with ESMTP id 63B546B0006 for ; Wed, 15 Jul 2020 01:33:56 -0400 (EDT) Received: from smtpin16.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id 20D6F180AD801 for ; Wed, 15 Jul 2020 05:33:56 +0000 (UTC) X-FDA: 77039193672.16.stew47_4a1859a26ef7 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin16.hostedemail.com (Postfix) with ESMTP id E63D6100E6903 for ; Wed, 15 Jul 2020 05:33:55 +0000 (UTC) X-Spam-Summary: 1,0,0,7c2468af26a8288e,d41d8cd98f00b204,penberg@gmail.com,,RULES_HIT:41:355:379:541:800:960:973:988:989:1260:1311:1314:1345:1359:1431:1437:1515:1534:1540:1711:1714:1730:1747:1777:1792:1978:1981:2194:2199:2393:2559:2562:3138:3139:3140:3141:3142:3351:3865:4250:4321:5007:6261:6653:6691:7576:9413:9592:10004:11657:11658:11914:12043:12296:12297:12517:12519:12555:12679:12895:13069:13161:13229:13311:13357:13894:14096:14181:14384:14394:14687:14721:21080:21444:21451:21627:21666:30054,0,RBL:209.85.208.195:@gmail.com:.lbl8.mailshell.net-66.100.201.100 62.18.0.100;04yrfrwh4aptz3pbzjnwxrxp39oo8ycasho7ipb89ba7gu5c3k5iuctxzkpwoit.mydeznh6ybocezhbkdwx97sc4q9nbcoxtohazmsxyx4gnc6ofou7x7gs9zg4p51.c-lbl8.mailshell.net-223.238.255.100,CacheIP:none,Bayesian:0.5,0.5,0.5,Netcheck:none,DomainCache:0,MSF:not bulk,SPF:fp,MSBL:0,DNSBL:neutral,Custom_rules:0:0:0,LFtime:24,LUA_SUMMARY:none X-HE-Tag: stew47_4a1859a26ef7 X-Filterd-Recvd-Size: 3922 Received: from mail-lj1-f195.google.com (mail-lj1-f195.google.com [209.85.208.195]) by imf28.hostedemail.com (Postfix) with ESMTP for ; Wed, 15 Jul 2020 05:33:55 +0000 (UTC) Received: by mail-lj1-f195.google.com with SMTP id x9so1157015ljc.5 for ; Tue, 14 Jul 2020 22:33:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=Eq+bIFfgQTb97v8yD8SXsGZ7hBTmnEuGWYIyVfq/yxU=; b=NhrtZKIz219V8XewG3GrAyE4wvFUTWamVgOH1iFD5I6vYqGbd/xWjMf3DBuRBDXFUu AXBf/X+5ho3Fin4BARKYvy8mpg/su+KFhTCFdzXDqAxwuGxzgbhnxY1ZWyNG//hdYIs2 t8ogbKWtDU6ojupKtFlLMmbUBj+nkGIXvav6el2oADN5Xg/NDwOUR3WQDR7f37Qgs2vV TNRXBSk9f82C6F9IigQ+hMbrXRjE71KVVyt5HTVU0Sul03Q9U7VVwdYY40HjnK9qhz3s 2oVwy0Bj9czZMApw+0lrSY/O1EmBMyDPtDKPo0D1E277zHnHrhDp21H0KSb+ZeNCXkf7 lLwA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=Eq+bIFfgQTb97v8yD8SXsGZ7hBTmnEuGWYIyVfq/yxU=; b=ooii6BpLMwSQTYdOihNXz6tKX7gfU1JIdvI1M5yGcpSZVbdE1bMCK03sOvaOd2bSTA 9xHyu8gmbjJwdTheAOAzStppoFHSIeJ2mvqkJBCtjAUsKrdrU82FbPqwqRweB7ynpaLk q6RmMKWRrefv0MJ2RsGmI9qq26C8jkWjmuD7FoivXTNn+vPxaYE4dQrT531nwGmpPo0u AktyUkHSFx9RuoRYBHmM/Zo6/y2i4Qgg1keTCfAOKEwtkdE4zaI7WBP3Vf72O2m3NFOH gpZWt4ZqibzPhgwqikE9rFqGnTj2cMuW9nx2unisa+35qzTNnvCWThACFrhZ620o4vbt 2zJw== X-Gm-Message-State: AOAM532KYHBPlqT1MZfX+Z84Jd5fv10TvyHPr+XIA6H1kA9cQB5idy6i wlw+6X6dPS3Ijhd9OlSEEdU= X-Google-Smtp-Source: ABdhPJw4nXKRH3xtt7VpkL3GFt2dkC7cG8GVkF0QkUyyTu7bZeWyycYtFmUcCvNlyA/TpM3UcgYB0g== X-Received: by 2002:a2e:9acc:: with SMTP id p12mr4276964ljj.363.1594791234334; Tue, 14 Jul 2020 22:33:54 -0700 (PDT) Received: from nero.bb.dnainternet.fi (dyn9cmyyyyyyyyyyyyyft-3.rev.dnainternet.fi. [2001:14ba:2fa:2500::9]) by smtp.gmail.com with ESMTPSA id h14sm233916ljb.53.2020.07.14.22.33.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 14 Jul 2020 22:33:53 -0700 (PDT) From: Pekka Enberg To: linux-riscv@lists.infradead.org, linux-mm@kvack.org Cc: Pekka Enberg , Palmer Dabbelt Subject: [PATCH v2 2/2] riscv: Use generic pgprot_* macros from Date: Wed, 15 Jul 2020 08:33:40 +0300 Message-Id: <20200715053340.576300-2-penberg@gmail.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200715053340.576300-1-penberg@gmail.com> References: <20200715053340.576300-1-penberg@gmail.com> MIME-Version: 1.0 X-Rspamd-Queue-Id: E63D6100E6903 X-Spamd-Result: default: False [0.00 / 100.00] X-Rspamd-Server: rspam01 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: From: Pekka Enberg The header now defines generic pgprot_ macros also for the no-MMU configuration, so let's use them. Cc: Palmer Dabbelt Signed-off-by: Pekka Enberg --- arch/riscv/include/asm/mmio.h | 6 ------ 1 file changed, 6 deletions(-) diff --git a/arch/riscv/include/asm/mmio.h b/arch/riscv/include/asm/mmio.h index 56053c9838b2..aff6c33ab0c0 100644 --- a/arch/riscv/include/asm/mmio.h +++ b/arch/riscv/include/asm/mmio.h @@ -14,12 +14,6 @@ #include #include -#ifndef CONFIG_MMU -#define pgprot_noncached(x) (x) -#define pgprot_writecombine(x) (x) -#define pgprot_device(x) (x) -#endif /* CONFIG_MMU */ - /* Generic IO read/write. These perform native-endian accesses. */ #define __raw_writeb __raw_writeb static inline void __raw_writeb(u8 val, volatile void __iomem *addr)