linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: catalin.marinas@arm.com (Catalin Marinas)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v6 01/15] ARM: Add page table and page defines needed by KVM
Date: Thu, 24 Jan 2013 17:02:20 +0000	[thread overview]
Message-ID: <20130124170220.GF18233@arm.com> (raw)
In-Reply-To: <CANM98qKYhvb6YVUr_jF0iYrgcmoMqtom+9tsZw1PkWFabRKVNQ@mail.gmail.com>

On Thu, Jan 24, 2013 at 04:05:33PM +0000, Christoffer Dall wrote:
> On Thu, Jan 24, 2013 at 6:39 AM, Catalin Marinas
> <catalin.marinas@arm.com> wrote:
> > On Wed, Jan 16, 2013 at 05:57:26PM +0000, Christoffer Dall wrote:
> >> diff --git a/arch/arm/include/asm/pgtable-3level.h b/arch/arm/include/asm/pgtable-3level.h
> >> index a3f3792..6ef8afd 100644
> >> --- a/arch/arm/include/asm/pgtable-3level.h
> >> +++ b/arch/arm/include/asm/pgtable-3level.h
> >> @@ -104,11 +104,29 @@
> >>   */
> >>  #define L_PGD_SWAPPER                (_AT(pgdval_t, 1) << 55)        /* swapper_pg_dir entry */
> >>
> >> +/*
> >> + * 2nd stage PTE definitions for LPAE.
> >> + */
> >> +#define L_PTE_S2_MT_UNCACHED  (_AT(pteval_t, 0x5) << 2) /* MemAttr[3:0] */
> >> +#define L_PTE_S2_MT_WRITETHROUGH (_AT(pteval_t, 0xa) << 2) /* MemAttr[3:0] */
> >> +#define L_PTE_S2_MT_WRITEBACK         (_AT(pteval_t, 0xf) << 2) /* MemAttr[3:0] */
> >> +#define L_PTE_S2_RDONLY               (_AT(pteval_t, 1) << 6)   /* HAP[1]   */
> >> +#define L_PTE_S2_RDWR                 (_AT(pteval_t, 2) << 6)   /* HAP[2:1] */
> >
> > Why is this called L_PTE_S2_RDWR? The ARM ARM shows HAP[2:1] as 0b11 for
> > read/write and 0b10 for WRONLY.
> 
> it should be
> 
> +#define L_PTE_S2_RDWR                 (_AT(pteval_t, 3) << 6)   /* HAP[2:1] */

OK.

> 
> >> --- a/arch/arm/include/asm/pgtable.h
> >> +++ b/arch/arm/include/asm/pgtable.h
> >> @@ -70,6 +70,9 @@ extern void __pgd_error(const char *file, int line, pgd_t);
> >>
> >>  extern pgprot_t              pgprot_user;
> >>  extern pgprot_t              pgprot_kernel;
> >> +extern pgprot_t              pgprot_hyp_device;
> >> +extern pgprot_t              pgprot_s2;
> >> +extern pgprot_t              pgprot_s2_device;
> >>
> >>  #define _MOD_PROT(p, b)      __pgprot(pgprot_val(p) | (b))
> >>
> >> @@ -82,6 +85,10 @@ extern pgprot_t            pgprot_kernel;
> >>  #define PAGE_READONLY_EXEC   _MOD_PROT(pgprot_user, L_PTE_USER | L_PTE_RDONLY)
> >>  #define PAGE_KERNEL          _MOD_PROT(pgprot_kernel, L_PTE_XN)
> >>  #define PAGE_KERNEL_EXEC     pgprot_kernel
> >> +#define PAGE_HYP             _MOD_PROT(pgprot_kernel, L_PTE_HYP)
> >> +#define PAGE_HYP_DEVICE              _MOD_PROT(pgprot_hyp_device, L_PTE_HYP)
> >> +#define PAGE_S2                      _MOD_PROT(pgprot_s2, L_PTE_S2_RDONLY)
> >> +#define PAGE_S2_DEVICE               _MOD_PROT(pgprot_s2_device, L_PTE_USER | L_PTE_S2_RDONLY)
> >
> > Are these S2 read-only by default?
> 
> not sure I understand what you're asking here?

Why do you pass L_PTE_S2_RDONLY? Do you need to restrict guest writes
via the stage 2 attributes?

-- 
Catalin

  reply	other threads:[~2013-01-24 17:02 UTC|newest]

Thread overview: 46+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-01-16 17:57 [PATCH v6 00/15] KVM/ARM Implementation Christoffer Dall
2013-01-16 17:57 ` [PATCH v6 01/15] ARM: Add page table and page defines needed by KVM Christoffer Dall
2013-01-24 11:39   ` Catalin Marinas
2013-01-24 16:05     ` Christoffer Dall
2013-01-24 17:02       ` Catalin Marinas [this message]
2013-01-24 17:04         ` Christoffer Dall
2013-01-24 17:13           ` Catalin Marinas
2013-01-24 17:25             ` Christoffer Dall
2013-01-16 17:57 ` [PATCH v6 02/15] ARM: Section based HYP idmap Christoffer Dall
2013-01-24 14:32   ` Catalin Marinas
2013-01-24 16:36     ` Christoffer Dall
2013-01-24 17:05       ` Catalin Marinas
2013-01-24 17:10         ` Christoffer Dall
2013-01-16 17:57 ` [PATCH v6 03/15] KVM: ARM: Initial skeleton to compile KVM support Christoffer Dall
2013-01-16 17:57 ` [PATCH v6 04/15] KVM: ARM: Hypervisor initialization Christoffer Dall
2013-01-24 15:45   ` Catalin Marinas
2013-01-24 16:52     ` Christoffer Dall
2013-01-16 17:57 ` [PATCH v6 05/15] KVM: ARM: Memory virtualization setup Christoffer Dall
2013-01-16 17:58 ` [PATCH v6 06/15] KVM: ARM: Inject IRQs and FIQs from userspace Christoffer Dall
2013-01-16 17:58 ` [PATCH v6 07/15] KVM: ARM: World-switch implementation Christoffer Dall
2013-01-16 17:58 ` [PATCH v6 08/15] KVM: ARM: Emulation framework and CP15 emulation Christoffer Dall
2013-01-16 17:58 ` [PATCH v6 09/15] trom: Christoffer Dall <c.dall@virtualopensystems.com> Christoffer Dall
2013-01-16 18:14   ` [RESEND PATCH v6 09/15] KVM: ARM: User space API for getting/setting co-proc registers Christoffer Dall
2013-01-16 17:58 ` [PATCH v6 10/15] KVM: ARM: Demux CCSIDR in the userspace API Christoffer Dall
2013-01-16 17:58 ` [PATCH v6 11/15] KVM: ARM: VFP userspace interface Christoffer Dall
2013-01-16 17:59 ` [PATCH v6 12/15] KVM: ARM: Handle guest faults in KVM Christoffer Dall
2013-01-16 17:59 ` [PATCH v6 13/15] KVM: ARM: Handle I/O aborts Christoffer Dall
2013-01-17 16:37   ` Marc Zyngier
2013-01-17 17:07     ` Christoffer Dall
2013-01-16 17:59 ` [PATCH v6 14/15] KVM: ARM: Power State Coordination Interface implementation Christoffer Dall
2013-01-17 15:55   ` Marc Zyngier
2013-01-20 23:35     ` Christoffer Dall
2013-01-21 10:04       ` [kvmarm] " Marc Zyngier
2013-01-21 14:50         ` Christoffer Dall
2013-01-21 17:43           ` Marc Zyngier
2013-01-21 17:54             ` Christoffer Dall
2013-01-21 18:08               ` Marc Zyngier
2013-01-21 18:17                 ` Peter Maydell
2013-01-21 18:20                 ` Christoffer Dall
2013-01-21 13:52       ` Gleb Natapov
2013-01-16 17:59 ` [PATCH v6 15/15] KVM: ARM: Add maintainer entry for KVM/ARM Christoffer Dall
2013-01-17 16:26   ` Will Deacon
2013-01-20 22:57     ` Christoffer Dall
2013-01-24 16:26 ` [PATCH v6 00/15] KVM/ARM Implementation Catalin Marinas
2013-01-24 16:36   ` Christoffer Dall
2013-01-24 17:14   ` Gleb Natapov

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=20130124170220.GF18233@arm.com \
    --to=catalin.marinas@arm.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    /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: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).