Re: [PATCH] arm64: KVM: VHE: reset PSTATE.UAO when switch to host

2017-09-08 Thread gengdongjiu
Hi Marc, > > On 08/09/17 10:05, gengdongjiu wrote: > > Marc, > >Thanks for reply. > > > > On 2017/9/8 16:21, Marc Zyngier wrote: > >>> Marc, > >>> > >>> sorry I have another question for the PAN. [...] > There cannot be any userspace mapping at EL2 when non-VHE, so there cannot be > any

Re: [PATCH] arm64: KVM: VHE: reset PSTATE.UAO when switch to host

2017-09-08 Thread gengdongjiu
Hi Marc, > > On 08/09/17 10:05, gengdongjiu wrote: > > Marc, > >Thanks for reply. > > > > On 2017/9/8 16:21, Marc Zyngier wrote: > >>> Marc, > >>> > >>> sorry I have another question for the PAN. [...] > There cannot be any userspace mapping at EL2 when non-VHE, so there cannot be > any

Re: [PATCH] arm64: KVM: VHE: reset PSTATE.UAO when switch to host

2017-09-08 Thread Marc Zyngier
On 08/09/17 10:05, gengdongjiu wrote: > Marc, >Thanks for reply. > > On 2017/9/8 16:21, Marc Zyngier wrote: >>> Marc, >>> >>> sorry I have another question for the PAN. >>> >>> In the non-VHE mode, The host kernel is running in the EL1. Before >>> host kernel enter guest, host OS will call

Re: [PATCH] arm64: KVM: VHE: reset PSTATE.UAO when switch to host

2017-09-08 Thread Marc Zyngier
On 08/09/17 10:05, gengdongjiu wrote: > Marc, >Thanks for reply. > > On 2017/9/8 16:21, Marc Zyngier wrote: >>> Marc, >>> >>> sorry I have another question for the PAN. >>> >>> In the non-VHE mode, The host kernel is running in the EL1. Before >>> host kernel enter guest, host OS will call

Re: [PATCH] arm64: KVM: VHE: reset PSTATE.UAO when switch to host

2017-09-08 Thread gengdongjiu
Marc, Thanks for reply. On 2017/9/8 16:21, Marc Zyngier wrote: >> Marc, >> >> sorry I have another question for the PAN. >> >> In the non-VHE mode, The host kernel is running in the EL1. Before >> host kernel enter guest, host OS will call 'HVC' instruction to do >> the world-switch, and the

Re: [PATCH] arm64: KVM: VHE: reset PSTATE.UAO when switch to host

2017-09-08 Thread gengdongjiu
Marc, Thanks for reply. On 2017/9/8 16:21, Marc Zyngier wrote: >> Marc, >> >> sorry I have another question for the PAN. >> >> In the non-VHE mode, The host kernel is running in the EL1. Before >> host kernel enter guest, host OS will call 'HVC' instruction to do >> the world-switch, and the

Re: [PATCH] arm64: KVM: VHE: reset PSTATE.UAO when switch to host

2017-09-08 Thread Marc Zyngier
On Fri, 8 Sep 2017 15:19:21 +0800 gengdongjiu wrote: > On 2017/9/7 23:23, Marc Zyngier wrote: > > On 07/09/17 16:03, gengdongjiu wrote: > >>> On 07/09/17 12:49, gengdongjiu wrote: > > [...] > > > > > I really cannot think of a good reason why we'd want to do

Re: [PATCH] arm64: KVM: VHE: reset PSTATE.UAO when switch to host

2017-09-08 Thread Marc Zyngier
On Fri, 8 Sep 2017 15:19:21 +0800 gengdongjiu wrote: > On 2017/9/7 23:23, Marc Zyngier wrote: > > On 07/09/17 16:03, gengdongjiu wrote: > >>> On 07/09/17 12:49, gengdongjiu wrote: > > [...] > > > > > I really cannot think of a good reason why we'd want to do that. Playing > > with

Re: [PATCH] arm64: KVM: VHE: reset PSTATE.UAO when switch to host

2017-09-08 Thread gengdongjiu
On 2017/9/7 23:23, Marc Zyngier wrote: > On 07/09/17 16:03, gengdongjiu wrote: >>> On 07/09/17 12:49, gengdongjiu wrote: [...] > > I really cannot think of a good reason why we'd want to do that. Playing > with set_fs() is almost universally wrong, and I'm certainly going to > oppose to

Re: [PATCH] arm64: KVM: VHE: reset PSTATE.UAO when switch to host

2017-09-08 Thread gengdongjiu
On 2017/9/7 23:23, Marc Zyngier wrote: > On 07/09/17 16:03, gengdongjiu wrote: >>> On 07/09/17 12:49, gengdongjiu wrote: [...] > > I really cannot think of a good reason why we'd want to do that. Playing > with set_fs() is almost universally wrong, and I'm certainly going to > oppose to

Re: [PATCH] arm64: KVM: VHE: reset PSTATE.UAO when switch to host

2017-09-07 Thread Marc Zyngier
On 07/09/17 16:03, gengdongjiu wrote: >> On 07/09/17 12:49, gengdongjiu wrote: >>> >>> >>> On 2017/9/7 18:13, Marc Zyngier wrote: On 07/09/17 11:05, gengdongjiu wrote: > Hi James, > > On 2017/9/7 17:20, James Morse wrote: >> Hi Dongjiu Geng, >> >> On 07/09/17 06:54,

Re: [PATCH] arm64: KVM: VHE: reset PSTATE.UAO when switch to host

2017-09-07 Thread Marc Zyngier
On 07/09/17 16:03, gengdongjiu wrote: >> On 07/09/17 12:49, gengdongjiu wrote: >>> >>> >>> On 2017/9/7 18:13, Marc Zyngier wrote: On 07/09/17 11:05, gengdongjiu wrote: > Hi James, > > On 2017/9/7 17:20, James Morse wrote: >> Hi Dongjiu Geng, >> >> On 07/09/17 06:54,

Re: [PATCH] arm64: KVM: VHE: reset PSTATE.UAO when switch to host

2017-09-07 Thread gengdongjiu
> On 07/09/17 12:49, gengdongjiu wrote: > > > > > > On 2017/9/7 18:13, Marc Zyngier wrote: > >> On 07/09/17 11:05, gengdongjiu wrote: > >>> Hi James, > >>> > >>> On 2017/9/7 17:20, James Morse wrote: > Hi Dongjiu Geng, > > On 07/09/17 06:54, Dongjiu Geng wrote: > > In VHE mode,

Re: [PATCH] arm64: KVM: VHE: reset PSTATE.UAO when switch to host

2017-09-07 Thread gengdongjiu
> On 07/09/17 12:49, gengdongjiu wrote: > > > > > > On 2017/9/7 18:13, Marc Zyngier wrote: > >> On 07/09/17 11:05, gengdongjiu wrote: > >>> Hi James, > >>> > >>> On 2017/9/7 17:20, James Morse wrote: > Hi Dongjiu Geng, > > On 07/09/17 06:54, Dongjiu Geng wrote: > > In VHE mode,

Re: [PATCH] arm64: KVM: VHE: reset PSTATE.UAO when switch to host

2017-09-07 Thread Marc Zyngier
On 07/09/17 12:49, gengdongjiu wrote: > > > On 2017/9/7 18:13, Marc Zyngier wrote: >> On 07/09/17 11:05, gengdongjiu wrote: >>> Hi James, >>> >>> On 2017/9/7 17:20, James Morse wrote: Hi Dongjiu Geng, On 07/09/17 06:54, Dongjiu Geng wrote: > In VHE mode, host kernel runs in

Re: [PATCH] arm64: KVM: VHE: reset PSTATE.UAO when switch to host

2017-09-07 Thread Marc Zyngier
On 07/09/17 12:49, gengdongjiu wrote: > > > On 2017/9/7 18:13, Marc Zyngier wrote: >> On 07/09/17 11:05, gengdongjiu wrote: >>> Hi James, >>> >>> On 2017/9/7 17:20, James Morse wrote: Hi Dongjiu Geng, On 07/09/17 06:54, Dongjiu Geng wrote: > In VHE mode, host kernel runs in

Re: [PATCH] arm64: KVM: VHE: reset PSTATE.UAO when switch to host

2017-09-07 Thread gengdongjiu
On 2017/9/7 18:13, Marc Zyngier wrote: > On 07/09/17 11:05, gengdongjiu wrote: >> Hi James, >> >> On 2017/9/7 17:20, James Morse wrote: >>> Hi Dongjiu Geng, >>> >>> On 07/09/17 06:54, Dongjiu Geng wrote: In VHE mode, host kernel runs in the EL2 and can enable 'User Access Override'

Re: [PATCH] arm64: KVM: VHE: reset PSTATE.UAO when switch to host

2017-09-07 Thread gengdongjiu
On 2017/9/7 18:13, Marc Zyngier wrote: > On 07/09/17 11:05, gengdongjiu wrote: >> Hi James, >> >> On 2017/9/7 17:20, James Morse wrote: >>> Hi Dongjiu Geng, >>> >>> On 07/09/17 06:54, Dongjiu Geng wrote: In VHE mode, host kernel runs in the EL2 and can enable 'User Access Override'

Re: [PATCH] arm64: KVM: VHE: reset PSTATE.UAO when switch to host

2017-09-07 Thread Marc Zyngier
On 07/09/17 11:05, gengdongjiu wrote: > Hi James, > > On 2017/9/7 17:20, James Morse wrote: >> Hi Dongjiu Geng, >> >> On 07/09/17 06:54, Dongjiu Geng wrote: >>> In VHE mode, host kernel runs in the EL2 and can enable >>> 'User Access Override' when fs==KERNEL_DS so that it can >>> access kernel

Re: [PATCH] arm64: KVM: VHE: reset PSTATE.UAO when switch to host

2017-09-07 Thread Marc Zyngier
On 07/09/17 11:05, gengdongjiu wrote: > Hi James, > > On 2017/9/7 17:20, James Morse wrote: >> Hi Dongjiu Geng, >> >> On 07/09/17 06:54, Dongjiu Geng wrote: >>> In VHE mode, host kernel runs in the EL2 and can enable >>> 'User Access Override' when fs==KERNEL_DS so that it can >>> access kernel

Re: [PATCH] arm64: KVM: VHE: reset PSTATE.UAO when switch to host

2017-09-07 Thread gengdongjiu
Hi James, On 2017/9/7 17:20, James Morse wrote: > Hi Dongjiu Geng, > > On 07/09/17 06:54, Dongjiu Geng wrote: >> In VHE mode, host kernel runs in the EL2 and can enable >> 'User Access Override' when fs==KERNEL_DS so that it can >> access kernel memory. However, PSTATE.UAO is set to 0 on >> an

Re: [PATCH] arm64: KVM: VHE: reset PSTATE.UAO when switch to host

2017-09-07 Thread gengdongjiu
Hi James, On 2017/9/7 17:20, James Morse wrote: > Hi Dongjiu Geng, > > On 07/09/17 06:54, Dongjiu Geng wrote: >> In VHE mode, host kernel runs in the EL2 and can enable >> 'User Access Override' when fs==KERNEL_DS so that it can >> access kernel memory. However, PSTATE.UAO is set to 0 on >> an

Re: [PATCH] arm64: KVM: VHE: reset PSTATE.UAO when switch to host

2017-09-07 Thread James Morse
Hi Dongjiu Geng, On 07/09/17 06:54, Dongjiu Geng wrote: > In VHE mode, host kernel runs in the EL2 and can enable > 'User Access Override' when fs==KERNEL_DS so that it can > access kernel memory. However, PSTATE.UAO is set to 0 on > an exception taken from EL1 to EL2. Thus when VHE is used > and

Re: [PATCH] arm64: KVM: VHE: reset PSTATE.UAO when switch to host

2017-09-07 Thread James Morse
Hi Dongjiu Geng, On 07/09/17 06:54, Dongjiu Geng wrote: > In VHE mode, host kernel runs in the EL2 and can enable > 'User Access Override' when fs==KERNEL_DS so that it can > access kernel memory. However, PSTATE.UAO is set to 0 on > an exception taken from EL1 to EL2. Thus when VHE is used > and

[PATCH] arm64: KVM: VHE: reset PSTATE.UAO when switch to host

2017-09-06 Thread Dongjiu Geng
In VHE mode, host kernel runs in the EL2 and can enable 'User Access Override' when fs==KERNEL_DS so that it can access kernel memory. However, PSTATE.UAO is set to 0 on an exception taken from EL1 to EL2. Thus when VHE is used and exception taken from a guest UAO will be disabled and host will

[PATCH] arm64: KVM: VHE: reset PSTATE.UAO when switch to host

2017-09-06 Thread Dongjiu Geng
In VHE mode, host kernel runs in the EL2 and can enable 'User Access Override' when fs==KERNEL_DS so that it can access kernel memory. However, PSTATE.UAO is set to 0 on an exception taken from EL1 to EL2. Thus when VHE is used and exception taken from a guest UAO will be disabled and host will