From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-10.0 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 37D68C433E1 for ; Tue, 14 Jul 2020 11:54:10 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id F27CA22224 for ; Tue, 14 Jul 2020 11:54:09 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org F27CA22224 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linux.ibm.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 7DF1D6B0002; Tue, 14 Jul 2020 07:54:09 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 78FF66B0003; Tue, 14 Jul 2020 07:54:09 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 67F888D0001; Tue, 14 Jul 2020 07:54:09 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0120.hostedemail.com [216.40.44.120]) by kanga.kvack.org (Postfix) with ESMTP id 525FC6B0002 for ; Tue, 14 Jul 2020 07:54:09 -0400 (EDT) Received: from smtpin27.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id 02AD12DFA for ; Tue, 14 Jul 2020 11:54:09 +0000 (UTC) X-FDA: 77036523018.27.stop51_5502d6326ef0 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin27.hostedemail.com (Postfix) with ESMTP id C414C3D663 for ; Tue, 14 Jul 2020 11:54:08 +0000 (UTC) X-HE-Tag: stop51_5502d6326ef0 X-Filterd-Recvd-Size: 7240 Received: from mx0b-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) by imf42.hostedemail.com (Postfix) with ESMTP for ; Tue, 14 Jul 2020 11:54:08 +0000 (UTC) Received: from pps.filterd (m0098417.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id 06EB2nZE053842; Tue, 14 Jul 2020 07:54:05 -0400 Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com with ESMTP id 3298wueepw-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 14 Jul 2020 07:54:04 -0400 Received: from m0098417.ppops.net (m0098417.ppops.net [127.0.0.1]) by pps.reinject (8.16.0.36/8.16.0.36) with SMTP id 06EBs4S3070499; Tue, 14 Jul 2020 07:54:04 -0400 Received: from ppma04ams.nl.ibm.com (63.31.33a9.ip4.static.sl-reverse.com [169.51.49.99]) by mx0a-001b2d01.pphosted.com with ESMTP id 3298wueenm-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 14 Jul 2020 07:54:04 -0400 Received: from pps.filterd (ppma04ams.nl.ibm.com [127.0.0.1]) by ppma04ams.nl.ibm.com (8.16.0.42/8.16.0.42) with SMTP id 06EBnqI5031118; Tue, 14 Jul 2020 11:54:02 GMT Received: from b06avi18626390.portsmouth.uk.ibm.com (b06avi18626390.portsmouth.uk.ibm.com [9.149.26.192]) by ppma04ams.nl.ibm.com with ESMTP id 32752839te-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 14 Jul 2020 11:54:02 +0000 Received: from d06av25.portsmouth.uk.ibm.com (d06av25.portsmouth.uk.ibm.com [9.149.105.61]) by b06avi18626390.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 06EBqbSA43712804 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 14 Jul 2020 11:52:37 GMT Received: from d06av25.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 45F7811C04C; Tue, 14 Jul 2020 11:54:00 +0000 (GMT) Received: from d06av25.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 8C9FF11C050; Tue, 14 Jul 2020 11:53:59 +0000 (GMT) Received: from linux.ibm.com (unknown [9.148.206.228]) by d06av25.portsmouth.uk.ibm.com (Postfix) with ESMTPS; Tue, 14 Jul 2020 11:53:59 +0000 (GMT) Date: Tue, 14 Jul 2020 14:53:57 +0300 From: Mike Rapoport To: Pekka Enberg Cc: linux-riscv@lists.infradead.org, linux-mm@kvack.org, Pekka Enberg , Palmer Dabbelt , Tom Lendacky Subject: Re: [PATCH 1/2] mm: pgtable: Make generic pgprot_* macros available for no-MMU Message-ID: <20200714115357.GB1166045@linux.ibm.com> References: <20200714100051.345018-1-penberg@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200714100051.345018-1-penberg@gmail.com> X-TM-AS-GCONF: 00 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.235,18.0.687 definitions=2020-07-14_02:2020-07-14,2020-07-14 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 bulkscore=0 priorityscore=1501 lowpriorityscore=0 suspectscore=1 adultscore=0 impostorscore=0 spamscore=0 phishscore=0 malwarescore=0 mlxscore=0 mlxlogscore=999 clxscore=1011 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2006250000 definitions=main-2007140085 X-Rspamd-Queue-Id: C414C3D663 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: On Tue, Jul 14, 2020 at 01:00:50PM +0300, Pekka Enberg wrote: > 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 > --- > 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 > -- > 2.26.2 > -- Sincerely yours, Mike.