From: Mark Rutland <mark.rutland@arm.com> To: Marc Zyngier <marc.zyngier@arm.com> Cc: linux-arm-kernel@lists.infradead.org, Catalin Marinas <catalin.marinas@arm.com>, kvmarm@lists.cs.columbia.edu, kvm@vger.kernel.org Subject: Re: [PATCH v2 3/6] arm64: KVM: Avoid marking pages as XN in Stage-2 if CTR_EL0.DIC is set Date: Thu, 31 May 2018 12:52:49 +0100 [thread overview] Message-ID: <20180531115249.uit7ndw22ki32wm3@lakrids.cambridge.arm.com> (raw) In-Reply-To: <20180530124706.25284-4-marc.zyngier@arm.com> On Wed, May 30, 2018 at 01:47:03PM +0100, Marc Zyngier wrote: > On systems where CTR_EL0.DIC is set, we don't need to perform > icache invalidation to guarantee that we'll fetch the right > instruction stream. > > This also means that taking a permission fault to invalidate the > icache is an unnecessary overhead. > > On such systems, we can safely leave the page as being executable. > > Acked-by: Catalin Marinas <catalin.marinas@arm.com> > Signed-off-by: Marc Zyngier <marc.zyngier@arm.com> Acked-by: Mark Rutland <mark.rutland@arm.com> Mark. > --- > arch/arm64/include/asm/pgtable-prot.h | 14 ++++++++++++-- > 1 file changed, 12 insertions(+), 2 deletions(-) > > diff --git a/arch/arm64/include/asm/pgtable-prot.h b/arch/arm64/include/asm/pgtable-prot.h > index c66c3047400e..78b942c1bea4 100644 > --- a/arch/arm64/include/asm/pgtable-prot.h > +++ b/arch/arm64/include/asm/pgtable-prot.h > @@ -77,8 +77,18 @@ > __val; \ > }) > > -#define PAGE_S2 __pgprot(_PROT_DEFAULT | PAGE_S2_MEMATTR(NORMAL) | PTE_S2_RDONLY | PTE_S2_XN) > -#define PAGE_S2_DEVICE __pgprot(_PROT_DEFAULT | PAGE_S2_MEMATTR(DEVICE_nGnRE) | PTE_S2_RDONLY | PTE_S2_XN) > +#define PAGE_S2_XN \ > + ({ \ > + u64 __val; \ > + if (cpus_have_const_cap(ARM64_HAS_CACHE_DIC)) \ > + __val = 0; \ > + else \ > + __val = PTE_S2_XN; \ > + __val; \ > + }) > + > +#define PAGE_S2 __pgprot(_PROT_DEFAULT | PAGE_S2_MEMATTR(NORMAL) | PTE_S2_RDONLY | PAGE_S2_XN) > +#define PAGE_S2_DEVICE __pgprot(_PROT_DEFAULT | PAGE_S2_MEMATTR(DEVICE_nGnRE) | PTE_S2_RDONLY | PAGE_S2_XN) > > #define PAGE_NONE __pgprot(((_PAGE_DEFAULT) & ~PTE_VALID) | PTE_PROT_NONE | PTE_RDONLY | PTE_NG | PTE_PXN | PTE_UXN) > #define PAGE_SHARED __pgprot(_PAGE_DEFAULT | PTE_USER | PTE_NG | PTE_PXN | PTE_UXN | PTE_WRITE) > -- > 2.17.1 >
WARNING: multiple messages have this Message-ID (diff)
From: mark.rutland@arm.com (Mark Rutland) To: linux-arm-kernel@lists.infradead.org Subject: [PATCH v2 3/6] arm64: KVM: Avoid marking pages as XN in Stage-2 if CTR_EL0.DIC is set Date: Thu, 31 May 2018 12:52:49 +0100 [thread overview] Message-ID: <20180531115249.uit7ndw22ki32wm3@lakrids.cambridge.arm.com> (raw) In-Reply-To: <20180530124706.25284-4-marc.zyngier@arm.com> On Wed, May 30, 2018 at 01:47:03PM +0100, Marc Zyngier wrote: > On systems where CTR_EL0.DIC is set, we don't need to perform > icache invalidation to guarantee that we'll fetch the right > instruction stream. > > This also means that taking a permission fault to invalidate the > icache is an unnecessary overhead. > > On such systems, we can safely leave the page as being executable. > > Acked-by: Catalin Marinas <catalin.marinas@arm.com> > Signed-off-by: Marc Zyngier <marc.zyngier@arm.com> Acked-by: Mark Rutland <mark.rutland@arm.com> Mark. > --- > arch/arm64/include/asm/pgtable-prot.h | 14 ++++++++++++-- > 1 file changed, 12 insertions(+), 2 deletions(-) > > diff --git a/arch/arm64/include/asm/pgtable-prot.h b/arch/arm64/include/asm/pgtable-prot.h > index c66c3047400e..78b942c1bea4 100644 > --- a/arch/arm64/include/asm/pgtable-prot.h > +++ b/arch/arm64/include/asm/pgtable-prot.h > @@ -77,8 +77,18 @@ > __val; \ > }) > > -#define PAGE_S2 __pgprot(_PROT_DEFAULT | PAGE_S2_MEMATTR(NORMAL) | PTE_S2_RDONLY | PTE_S2_XN) > -#define PAGE_S2_DEVICE __pgprot(_PROT_DEFAULT | PAGE_S2_MEMATTR(DEVICE_nGnRE) | PTE_S2_RDONLY | PTE_S2_XN) > +#define PAGE_S2_XN \ > + ({ \ > + u64 __val; \ > + if (cpus_have_const_cap(ARM64_HAS_CACHE_DIC)) \ > + __val = 0; \ > + else \ > + __val = PTE_S2_XN; \ > + __val; \ > + }) > + > +#define PAGE_S2 __pgprot(_PROT_DEFAULT | PAGE_S2_MEMATTR(NORMAL) | PTE_S2_RDONLY | PAGE_S2_XN) > +#define PAGE_S2_DEVICE __pgprot(_PROT_DEFAULT | PAGE_S2_MEMATTR(DEVICE_nGnRE) | PTE_S2_RDONLY | PAGE_S2_XN) > > #define PAGE_NONE __pgprot(((_PAGE_DEFAULT) & ~PTE_VALID) | PTE_PROT_NONE | PTE_RDONLY | PTE_NG | PTE_PXN | PTE_UXN) > #define PAGE_SHARED __pgprot(_PAGE_DEFAULT | PTE_USER | PTE_NG | PTE_PXN | PTE_UXN | PTE_WRITE) > -- > 2.17.1 >
next prev parent reply other threads:[~2018-05-31 11:52 UTC|newest] Thread overview: 48+ messages / expand[flat|nested] mbox.gz Atom feed top 2018-05-30 12:47 [PATCH v2 0/6] KVM/arm64: Cache maintenance relaxations Marc Zyngier 2018-05-30 12:47 ` Marc Zyngier 2018-05-30 12:47 ` [PATCH v2 1/6] arm64: KVM: Add support for Stage-2 control of memory types and cacheability Marc Zyngier 2018-05-30 12:47 ` Marc Zyngier 2018-05-31 11:49 ` Mark Rutland 2018-05-31 11:49 ` Mark Rutland 2018-05-31 12:38 ` Marc Zyngier 2018-05-31 12:38 ` Marc Zyngier 2018-06-12 12:55 ` Marc Zyngier 2018-06-12 12:55 ` Marc Zyngier 2018-05-30 12:47 ` [PATCH v2 2/6] arm64: KVM: Handle Set/Way CMOs as NOPs if FWB is present Marc Zyngier 2018-05-30 12:47 ` Marc Zyngier 2018-05-31 11:51 ` Mark Rutland 2018-05-31 11:51 ` Mark Rutland 2018-05-31 13:00 ` Marc Zyngier 2018-05-31 13:00 ` Marc Zyngier 2018-05-31 16:00 ` Mark Rutland 2018-05-31 16:00 ` Mark Rutland 2018-06-09 9:26 ` Christoffer Dall 2018-06-09 9:26 ` Christoffer Dall 2018-06-09 12:31 ` Marc Zyngier 2018-06-09 12:31 ` Marc Zyngier 2018-05-30 12:47 ` [PATCH v2 3/6] arm64: KVM: Avoid marking pages as XN in Stage-2 if CTR_EL0.DIC is set Marc Zyngier 2018-05-30 12:47 ` Marc Zyngier 2018-05-31 11:52 ` Mark Rutland [this message] 2018-05-31 11:52 ` Mark Rutland 2018-06-09 9:29 ` Christoffer Dall 2018-06-09 9:29 ` Christoffer Dall 2018-05-30 12:47 ` [PATCH v2 4/6] KVM: arm/arm64: Consolidate page-table accessors Marc Zyngier 2018-05-30 12:47 ` Marc Zyngier 2018-05-31 11:55 ` Mark Rutland 2018-05-31 11:55 ` Mark Rutland 2018-06-09 9:31 ` Christoffer Dall 2018-06-09 9:31 ` Christoffer Dall 2018-06-09 12:34 ` Marc Zyngier 2018-06-09 12:34 ` Marc Zyngier 2018-05-30 12:47 ` [PATCH v2 5/6] KVM: arm/arm64: Stop using {pmd,pud,pgd}_populate Marc Zyngier 2018-05-30 12:47 ` Marc Zyngier 2018-05-31 12:01 ` Mark Rutland 2018-05-31 12:01 ` Mark Rutland 2018-06-09 9:57 ` Christoffer Dall 2018-06-09 9:57 ` Christoffer Dall 2018-05-30 12:47 ` [PATCH v2 6/6] KVM: arm/arm64: Remove unnecessary CMOs when creating HYP page tables Marc Zyngier 2018-05-30 12:47 ` Marc Zyngier 2018-05-31 12:01 ` Mark Rutland 2018-05-31 12:01 ` Mark Rutland 2018-06-09 9:58 ` Christoffer Dall 2018-06-09 9:58 ` Christoffer Dall
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20180531115249.uit7ndw22ki32wm3@lakrids.cambridge.arm.com \ --to=mark.rutland@arm.com \ --cc=catalin.marinas@arm.com \ --cc=kvm@vger.kernel.org \ --cc=kvmarm@lists.cs.columbia.edu \ --cc=linux-arm-kernel@lists.infradead.org \ --cc=marc.zyngier@arm.com \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.