On Tue, Mar 31, 2009 at 03:00:03AM +0300, Izik Eidus wrote:
> this flag notify that the host physical page we are pointing to from
> the spte is write protected, and therefore we cant change its access
> to be write unless we run get_user_pages(write = 1).
> 
> (this is needed for change_pte support in kvm)
> 
> Signed-off-by: Izik Eidus <[email protected]>

> @@ -547,6 +551,7 @@ static void FNAME(prefetch_page)(struct kvm_vcpu *vcpu,
>  static int FNAME(sync_page)(struct kvm_vcpu *vcpu, struct kvm_mmu_page *sp)
>  {
>       int i, offset, nr_present;
> +        bool reset_host_protection = 1;
>  
>       offset = nr_present = 0;
>  
> @@ -584,9 +589,14 @@ static int FNAME(sync_page)(struct kvm_vcpu *vcpu, 
> struct kvm_mmu_page *sp)
>  
>               nr_present++;
>               pte_access = sp->role.access & FNAME(gpte_access)(vcpu, gpte);
> +             if (!(sp->spt[i] & SPTE_HOST_WRITEABLE)) {
> +                     pte_access &= ~PT_WRITABLE_MASK;
> +                        reset_host_protection = 0;
> +              }

                 else
                          reset_host_protection = 1;
                
Otherwise you clear SPTE_HOST_WRITEABLE for all sptes once you find a
single one thats unset.

Also mind the tabs.
--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to