Re: [PATCH v5] arm64: fix VTTBR_BADDR_MASK

2014-08-29 Thread Marc Zyngier
On Tue, Aug 26 2014 at 7:35:21 pm BST, Joel Schopp joel.sch...@amd.com wrote: diff --git a/arch/arm/include/asm/kvm_mmu.h b/arch/arm/include/asm/kvm_mmu.h index 5c7aa3c..73f6ff6 100644 --- a/arch/arm/include/asm/kvm_mmu.h +++ b/arch/arm/include/asm/kvm_mmu.h @@ -166,6 +166,18 @@ static

Re: [PATCH v5] arm64: fix VTTBR_BADDR_MASK

2014-08-26 Thread Marc Zyngier
Hi Joel, On Mon, Aug 18 2014 at 9:36:04 pm BST, Joel Schopp joel.sch...@amd.com wrote: The current VTTBR_BADDR_MASK only masks 39 bits, which is broken on current systems. Rather than just add a bit it seems like a good time to also set things at run-time instead of compile time to

Re: [PATCH v5] arm64: fix VTTBR_BADDR_MASK

2014-08-26 Thread Joel Schopp
diff --git a/arch/arm/include/asm/kvm_mmu.h b/arch/arm/include/asm/kvm_mmu.h index 5c7aa3c..73f6ff6 100644 --- a/arch/arm/include/asm/kvm_mmu.h +++ b/arch/arm/include/asm/kvm_mmu.h @@ -166,6 +166,18 @@ static inline void coherent_cache_guest_page(struct kvm_vcpu *vcpu, hva_t hva, void

Re: [PATCH v5] arm64: fix VTTBR_BADDR_MASK

2014-08-19 Thread Christoffer Dall
On Mon, Aug 18, 2014 at 03:36:04PM -0500, Joel Schopp wrote: The current VTTBR_BADDR_MASK only masks 39 bits, which is broken on current systems. Rather than just add a bit it seems like a good time to also set things at run-time instead of compile time to accomodate more hardware. This

Re: [PATCH v5] arm64: fix VTTBR_BADDR_MASK

2014-08-19 Thread Joel Schopp
On 08/19/2014 07:24 AM, Christoffer Dall wrote: On Mon, Aug 18, 2014 at 03:36:04PM -0500, Joel Schopp wrote: The current VTTBR_BADDR_MASK only masks 39 bits, which is broken on current systems. Rather than just add a bit it seems like a good time to also set things at run-time instead of

Re: [PATCH v5] arm64: fix VTTBR_BADDR_MASK

2014-08-19 Thread Christoffer Dall
On Tue, Aug 19, 2014 at 09:23:57AM -0500, Joel Schopp wrote: On 08/19/2014 07:24 AM, Christoffer Dall wrote: On Mon, Aug 18, 2014 at 03:36:04PM -0500, Joel Schopp wrote: The current VTTBR_BADDR_MASK only masks 39 bits, which is broken on current systems. Rather than just add a bit it

Re: [PATCH v5] arm64: fix VTTBR_BADDR_MASK

2014-08-19 Thread Joel Schopp
The return is a value,not just an error code. Because of this returning an error overloads that value. 0 just seemed like a convenient invalid value to check since a vttbr_x of 0 is invalid, but returning a negative error code would be as equally invalid. If this is the only issue it

Re: [PATCH v5] arm64: fix VTTBR_BADDR_MASK

2014-08-19 Thread Christoffer Dall
On Tue, Aug 19, 2014 at 09:49:07AM -0500, Joel Schopp wrote: The return is a value,not just an error code. Because of this returning an error overloads that value. 0 just seemed like a convenient invalid value to check since a vttbr_x of 0 is invalid, but returning a negative error code

Re: [PATCH v5] arm64: fix VTTBR_BADDR_MASK

2014-08-19 Thread Joel Schopp
hmmm, the point is that we need to ensure that we have a properly aligned allocated PGD, that's what this patch currently addresses, and as you pointed out, the BUG_ON() just before trying to run a VM is not the nicest solution - we should really be dealing with this properly at allocation

[PATCH v5] arm64: fix VTTBR_BADDR_MASK

2014-08-18 Thread Joel Schopp
The current VTTBR_BADDR_MASK only masks 39 bits, which is broken on current systems. Rather than just add a bit it seems like a good time to also set things at run-time instead of compile time to accomodate more hardware. This patch sets TCR_EL2.PS, VTCR_EL2.T0SZ and vttbr_baddr_mask in runtime,