Re: [RFC PATCH v2 16/26] KVM: arm64: Prepare Hyp memory protection

2021-02-22 Thread Quentin Perret
Hi Sean, On Friday 19 Feb 2021 at 10:32:58 (-0800), Sean Christopherson wrote: > On Wed, Feb 03, 2021, Will Deacon wrote: > > On Fri, Jan 08, 2021 at 12:15:14PM +, Quentin Perret wrote: > > ... > > > > +static inline unsigned long hyp_s1_pgtable_size(void) > > > +{ > > ... > > > > +

Re: [RFC PATCH v2 16/26] KVM: arm64: Prepare Hyp memory protection

2021-02-19 Thread Sean Christopherson
On Wed, Feb 03, 2021, Will Deacon wrote: > On Fri, Jan 08, 2021 at 12:15:14PM +, Quentin Perret wrote: ... > > +static inline unsigned long hyp_s1_pgtable_size(void) > > +{ ... > > + res += nr_pages << PAGE_SHIFT; > > + } > > + > > + /* Allow 1 GiB for private mappings */ > >

Re: [RFC PATCH v2 16/26] KVM: arm64: Prepare Hyp memory protection

2021-02-09 Thread Will Deacon
On Tue, Feb 09, 2021 at 10:00:29AM +, Quentin Perret wrote: > On Thursday 04 Feb 2021 at 10:47:08 (+), Quentin Perret wrote: > > On Wednesday 03 Feb 2021 at 14:37:10 (+), Will Deacon wrote: > > > > +static void handle___pkvm_init(struct kvm_cpu_context *host_ctxt) > > > > +{ > > > > +

Re: [RFC PATCH v2 16/26] KVM: arm64: Prepare Hyp memory protection

2021-02-09 Thread Quentin Perret
On Thursday 04 Feb 2021 at 10:47:08 (+), Quentin Perret wrote: > On Wednesday 03 Feb 2021 at 14:37:10 (+), Will Deacon wrote: > > > +static void handle___pkvm_init(struct kvm_cpu_context *host_ctxt) > > > +{ > > > + DECLARE_REG(phys_addr_t, phys, host_ctxt, 1); > > > + DECLARE_REG(unsigned

Re: [RFC PATCH v2 16/26] KVM: arm64: Prepare Hyp memory protection

2021-02-05 Thread Will Deacon
On Thu, Feb 04, 2021 at 10:47:08AM +, Quentin Perret wrote: > On Wednesday 03 Feb 2021 at 14:37:10 (+), Will Deacon wrote: > > On Fri, Jan 08, 2021 at 12:15:14PM +, Quentin Perret wrote: > > > +static inline unsigned long __hyp_pgtable_max_pages(unsigned long > > > nr_pages) > > > +{

Re: [RFC PATCH v2 16/26] KVM: arm64: Prepare Hyp memory protection

2021-02-04 Thread Quentin Perret
On Wednesday 03 Feb 2021 at 14:37:10 (+), Will Deacon wrote: > On Fri, Jan 08, 2021 at 12:15:14PM +, Quentin Perret wrote: > > +static inline unsigned long __hyp_pgtable_max_pages(unsigned long nr_pages) > > +{ > > + unsigned long total = 0, i; > > + > > + /* Provision the worst case

Re: [RFC PATCH v2 16/26] KVM: arm64: Prepare Hyp memory protection

2021-02-03 Thread Will Deacon
On Fri, Jan 08, 2021 at 12:15:14PM +, Quentin Perret wrote: > When memory protection is enabled, the Hyp code needs the ability to > create and manage its own page-table. To do so, introduce a new set of > hypercalls to initialize Hyp memory protection. > > During the init hcall, the

[RFC PATCH v2 16/26] KVM: arm64: Prepare Hyp memory protection

2021-01-08 Thread Quentin Perret
When memory protection is enabled, the Hyp code needs the ability to create and manage its own page-table. To do so, introduce a new set of hypercalls to initialize Hyp memory protection. During the init hcall, the hypervisor runs with the host-provided page-table and uses the trivial early page