From patchwork Tue Jul 14 10:00:50 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pekka Enberg X-Patchwork-Id: 11662223 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 00DD113B1 for ; Tue, 14 Jul 2020 10:01:04 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id B7FBF21D7A for ; Tue, 14 Jul 2020 10:01:03 +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="YZl4Dt4L" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org B7FBF21D7A 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 96FE86B0006; Tue, 14 Jul 2020 06:01:01 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 8CE916B0007; Tue, 14 Jul 2020 06:01:01 -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 7BFB68D0001; Tue, 14 Jul 2020 06:01:01 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0065.hostedemail.com [216.40.44.65]) by kanga.kvack.org (Postfix) with ESMTP id 5C3FD6B0006 for ; Tue, 14 Jul 2020 06:01:01 -0400 (EDT) Received: from smtpin11.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id 1C747180AD815 for ; Tue, 14 Jul 2020 10:01:01 +0000 (UTC) X-FDA: 77036237922.11.cup70_5c119bc26ef0 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin11.hostedemail.com (Postfix) with ESMTP id 559F9180F8B86 for ; Tue, 14 Jul 2020 10:00:58 +0000 (UTC) X-Spam-Summary: 1,0,0,06f57d36c6fe2d71,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:3868:3871:3874:4117:4321:4419:5007:6261:6653:7576: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.167.65:@gmail.com:.lbl8.mailshell.net-62.18.0.100 66.100.201.100;04yf5isbwyohj8sumsdsjfsryr5f7oc3ephg9r1s7ahkudrebu4r9bh6k9j4r7g.szjjqgskct6epyjx7g93buak85yti8n88ti6fxirnxh83s7g6agm3eq8bjkkbeo.6-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: cup70_5c119bc26ef0 X-Filterd-Recvd-Size: 6321 Received: from mail-lf1-f65.google.com (mail-lf1-f65.google.com [209.85.167.65]) by imf30.hostedemail.com (Postfix) with ESMTP for ; Tue, 14 Jul 2020 10:00:57 +0000 (UTC) Received: by mail-lf1-f65.google.com with SMTP id k17so11004155lfg.3 for ; Tue, 14 Jul 2020 03:00:57 -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=9hegCtgYYonDTxzG2P7M3NgTaesYZp6ZeRypjC7FVkc=; b=YZl4Dt4LbuOWK4kupIrnK8GgFFPA/fKYMQGbAMbl3uRcN4Aiwvdf69mwWowgDFzHfo 8MJOr5LlMd1miUn+6bIOEaPwsXNZHVGPe8ezYZVRKR7bEGRcy4b+l4VGaYWEBjW0Vzat xMklvoavVYl21c0XURmftIPI5DvTqjVaTTPT4OEIFtZ0HjhMmJU2SJJuyYhQfNSJZuJQ huscOIYyukq6anKXEsO2GTn2G9/PNNmn3QHRxbQ+BR7HRjjuw2/APu0D1qad5YTeS1Ft cFtPA/qezDnynGh6DSBmrGpw2NkIAQp+s2xaJwNcBlPwvDrl317iW7xAvb0gjGwq+Dli 9GFg== 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=9hegCtgYYonDTxzG2P7M3NgTaesYZp6ZeRypjC7FVkc=; b=Ymh5RMZgDZrQ/nAaCnNfgks5D8P97+p/NP52C15eJ68AO1hCoCCF/RBcayzR0Xm8th lCSZlAng6guY4BZSYK4HSVEYfmSTY9UO6ug5WLwC4kJcTNbaEP8gtEMmWpC3sMGO8MXv KcuMJw1VrVi+SerZhNXQSriL8LsGxdT96nKySiFzOTGuHLhDI7IW00BrG613KHAoV0BC O1+ip15Rfo9TNES8tegTKFart7QH3AaZVX/LY16PF97SUryJcIdJIAaF+sWgJKhvItZV PpvRt4WNRsDmU6zQt2I8qRndjbl778IiORi0WpotZf23Hi99JtsqkPPjE/GkAmcJmpzt VcbA== X-Gm-Message-State: AOAM531ko3JihUQg3gA6c9BX/SokcGcEYkuxlxn+DG53AGIeS3csVI9/ VecDYEWPQynyryY8jalWL98= X-Google-Smtp-Source: ABdhPJyLCcHVa1MAXGziSZoP1Bpw2XghpI0TwlWE5Hvjgr4PMH4MfVP4HC8mw5tWu8896icrBPdXNQ== X-Received: by 2002:ac2:52ac:: with SMTP id r12mr1808859lfm.175.1594720856307; Tue, 14 Jul 2020 03:00:56 -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 y22sm4560279ljn.2.2020.07.14.03.00.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 14 Jul 2020 03:00:55 -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 1/2] mm: pgtable: Make generic pgprot_* macros available for no-MMU Date: Tue, 14 Jul 2020 13:00:50 +0300 Message-Id: <20200714100051.345018-1-penberg@gmail.com> X-Mailer: git-send-email 2.26.2 MIME-Version: 1.0 X-Rspamd-Queue-Id: 559F9180F8B86 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 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 Cc: Mike Rapoport Cc: Tom Lendacky Signed-off-by: Pekka Enberg Reviewed-by: Mike Rapoport Reported-by: kernel test robot --- include/linux/pgtable.h | 69 +++++++++++++++++++++-------------------- 1 file changed, 35 insertions(+), 34 deletions(-) diff --git a/include/linux/pgtable.h b/include/linux/pgtable.h index 56c1e8eb7bb0..ed9026ad7c31 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,41 @@ 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 + +#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 + #ifndef pgprot_encrypted #define pgprot_encrypted(prot) (prot) #endif From patchwork Tue Jul 14 10:00:51 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pekka Enberg X-Patchwork-Id: 11662221 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 AA40613B4 for ; Tue, 14 Jul 2020 10:01:01 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 69FC921D7A for ; Tue, 14 Jul 2020 10:01:01 +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="bmXTJUa/" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 69FC921D7A 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 91CAB6B0005; Tue, 14 Jul 2020 06:01:00 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 8CD436B0006; Tue, 14 Jul 2020 06:01:00 -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 7BBFF6B0007; Tue, 14 Jul 2020 06:01:00 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0058.hostedemail.com [216.40.44.58]) by kanga.kvack.org (Postfix) with ESMTP id 686976B0005 for ; Tue, 14 Jul 2020 06:01:00 -0400 (EDT) Received: from smtpin15.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id 28CC78248047 for ; Tue, 14 Jul 2020 10:01:00 +0000 (UTC) X-FDA: 77036237880.15.truck50_1701cda26ef0 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin15.hostedemail.com (Postfix) with ESMTP id E24B01814B0C8 for ; Tue, 14 Jul 2020 10:00:59 +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.167.66:@gmail.com:.lbl8.mailshell.net-66.100.201.100 62.18.0.100;04yfm6nn5rhx67n8raek4fx4598hhocasho7ipb89ba7gu5c3k5iuctxzkpwoit.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: truck50_1701cda26ef0 X-Filterd-Recvd-Size: 3918 Received: from mail-lf1-f66.google.com (mail-lf1-f66.google.com [209.85.167.66]) by imf33.hostedemail.com (Postfix) with ESMTP for ; Tue, 14 Jul 2020 10:00:59 +0000 (UTC) Received: by mail-lf1-f66.google.com with SMTP id s16so10969372lfp.12 for ; Tue, 14 Jul 2020 03:00:59 -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=bmXTJUa/NPv6xyRiKkgFitbcpxXaiYXtbbYCjLiWxLc/M7TOu15LRXq7w8Koo1rTsz U9585Xr4NHZ5TACcqihcfUjSUDOW4A/9KPn00CGLB5PAYWUl0qP4zVZ7ZDxSssYQdkSj A6VPDexIAyTOvKHiNepId/o2LEI1duF4LzJ6bfFiaJ4CAn/bjwcK2AB70Y7A17BfAKh7 Ke3IyNUyFjSCh16DfkF5wv20Bm94vvdSpFj9wxtmZBg+6KKzKikB/kucivgQscFXSFHh j/N5cKsoHz7FnJSpvwj1MpUsoh1+ZgyLL8wHVBNuBkeJVGbf6U0Mw9AdIIYqQn1lWNr+ a/lA== 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=qiBRVWGOjQjo4gJWdRmdMMu/gBw9zUsluJRq+mPeeMFpuJaB+Lkc87/Sb7s5MQNoQc ell5qCmTiNyHT9BaV7sWrnulu17x3DKfk7x1x5XLmro7YXNA4zZIpf0BscL+in/wn/gc fNBjwHNBZzIvASBmfrX+g+mwqkW+idYqu/17Xx8biV9C8dl45ve6ctZhcCne+tUV+L3a +s7SMRKFRgrI4KbGqlYk16SnjNpn8vznzWsfSJzvZlkGPDSaZd8/zpbxJpc5jbJYosQR MIq2TJm98CECSRR7s136hmKEmaZImv4UO9HMER3m7piX0Fp3lyXfi/1hsmJgsfzG/y/O 4GNw== X-Gm-Message-State: AOAM532hrIhIQZEaTf//Oi8aZm41ivswZq3zfjXExgZlChf2dw1xnYOQ mnzCpWFsteieYC7TuBV3Sng= X-Google-Smtp-Source: ABdhPJzIfk16yByHSm/GWbMUoJ750bDhxTfXbs7iGoNYmwZcfvr86sgAnBKx57CtXoe3HDMB/oylfQ== X-Received: by 2002:ac2:5a50:: with SMTP id r16mr1898543lfn.170.1594720858025; Tue, 14 Jul 2020 03:00:58 -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 y22sm4560279ljn.2.2020.07.14.03.00.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 14 Jul 2020 03:00:56 -0700 (PDT) From: Pekka Enberg To: linux-riscv@lists.infradead.org, linux-mm@kvack.org Cc: Pekka Enberg , Palmer Dabbelt Subject: [PATCH 2/2] riscv: Use generic pgprot_* macros from Date: Tue, 14 Jul 2020 13:00:51 +0300 Message-Id: <20200714100051.345018-2-penberg@gmail.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200714100051.345018-1-penberg@gmail.com> References: <20200714100051.345018-1-penberg@gmail.com> MIME-Version: 1.0 X-Rspamd-Queue-Id: E24B01814B0C8 X-Spamd-Result: default: False [0.00 / 100.00] X-Rspamd-Server: rspam02 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)