Re: [PATCH 2/3] KVM: arm64: Handle S1PTW translation with TCR_HA set as a write

2022-12-24 Thread Marc Zyngier
On Thu, 22 Dec 2022 20:58:40 +, Oliver Upton wrote: > > On Thu, Dec 22, 2022 at 09:01:15AM +, Marc Zyngier wrote: > > On Wed, 21 Dec 2022 17:46:24 +, Oliver Upton > > wrote: > > > - When UFFD is in use, translation faults are reported to userspace as > > >writes when from a RW

Re: [PATCH 2/3] KVM: arm64: Handle S1PTW translation with TCR_HA set as a write

2022-12-22 Thread Ricardo Koller
On Thu, Dec 22, 2022 at 08:58:40PM +, Oliver Upton wrote: > On Thu, Dec 22, 2022 at 09:01:15AM +, Marc Zyngier wrote: > > On Wed, 21 Dec 2022 17:46:24 +, Oliver Upton > > wrote: > > > - When UFFD is in use, translation faults are reported to userspace as > > >writes when from a

Re: [PATCH 2/3] KVM: arm64: Handle S1PTW translation with TCR_HA set as a write

2022-12-22 Thread Ricardo Koller
Hi Marc, On Wed, Dec 21, 2022 at 05:43:03PM +, Marc Zyngier wrote: > Hi Ricardo, > > On Wed, 21 Dec 2022 16:46:06 +, > Ricardo Koller wrote: > > > > Hello, > > > > On Tue, Dec 20, 2022 at 08:09:22PM +, Marc Zyngier wrote: > > > As a minor optimisation, we can retrofit the "S1PTW

Re: [PATCH 2/3] KVM: arm64: Handle S1PTW translation with TCR_HA set as a write

2022-12-22 Thread Oliver Upton
On Thu, Dec 22, 2022 at 09:01:15AM +, Marc Zyngier wrote: > On Wed, 21 Dec 2022 17:46:24 +, Oliver Upton > wrote: > > - When UFFD is in use, translation faults are reported to userspace as > >writes when from a RW memslot and reads when from an RO memslot. > > Not quite:

Re: [PATCH 2/3] KVM: arm64: Handle S1PTW translation with TCR_HA set as a write

2022-12-22 Thread Marc Zyngier
On Wed, 21 Dec 2022 17:46:24 +, Oliver Upton wrote: > > On Wed, Dec 21, 2022 at 08:46:06AM -0800, Ricardo Koller wrote: > > [...] > > > > - return false; > > > + /* Can't introspect TCR_EL1 with pKVM */ > > > + if

Re: [PATCH 2/3] KVM: arm64: Handle S1PTW translation with TCR_HA set as a write

2022-12-21 Thread Oliver Upton
On Wed, Dec 21, 2022 at 08:46:06AM -0800, Ricardo Koller wrote: [...] > > - return false; > > + /* Can't introspect TCR_EL1 with pKVM */ > > + if (kvm_vm_is_protected(vcpu->kvm)) > > + return false; > > + > > +

Re: [PATCH 2/3] KVM: arm64: Handle S1PTW translation with TCR_HA set as a write

2022-12-21 Thread Marc Zyngier
Hi Ricardo, On Wed, 21 Dec 2022 16:46:06 +, Ricardo Koller wrote: > > Hello, > > On Tue, Dec 20, 2022 at 08:09:22PM +, Marc Zyngier wrote: > > As a minor optimisation, we can retrofit the "S1PTW is a write > > even on translation fault" concept *if* the vcpu is using the > > HW-managed

Re: [PATCH 2/3] KVM: arm64: Handle S1PTW translation with TCR_HA set as a write

2022-12-21 Thread Ricardo Koller
Hello, On Tue, Dec 20, 2022 at 08:09:22PM +, Marc Zyngier wrote: > As a minor optimisation, we can retrofit the "S1PTW is a write > even on translation fault" concept *if* the vcpu is using the > HW-managed Access Flag, as setting TCR_EL1.HA is guaranteed > to result in an update of the PTE.

[PATCH 2/3] KVM: arm64: Handle S1PTW translation with TCR_HA set as a write

2022-12-20 Thread Marc Zyngier
As a minor optimisation, we can retrofit the "S1PTW is a write even on translation fault" concept *if* the vcpu is using the HW-managed Access Flag, as setting TCR_EL1.HA is guaranteed to result in an update of the PTE. However, we cannot do the same thing for DB, as it would require us to parse