linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: Scott Wood <scottwood@freescale.com>
To: Bharat Bhushan <r65777@freescale.com>
Cc: kvm@vger.kernel.org, agraf@suse.de, kvm-ppc@vger.kernel.org,
	Bharat Bhushan <Bharat.Bhushan@freescale.com>,
	linuxppc-dev@lists.ozlabs.org
Subject: Re: [PATCH 6/6 v2] kvm: powerpc: use caching attributes as per linux pte
Date: Fri, 2 Aug 2013 18:34:52 -0500	[thread overview]
Message-ID: <20130802233452.GA27636@home.buserror.net> (raw)
In-Reply-To: <1375355558-19187-7-git-send-email-Bharat.Bhushan@freescale.com>

On Thu, Aug 01, 2013 at 04:42:38PM +0530, Bharat Bhushan wrote:
> diff --git a/arch/powerpc/kvm/booke.c b/arch/powerpc/kvm/booke.c
> index 17722d8..ebcccc2 100644
> --- a/arch/powerpc/kvm/booke.c
> +++ b/arch/powerpc/kvm/booke.c
> @@ -697,7 +697,7 @@ int kvmppc_vcpu_run(struct kvm_run *kvm_run, struct kvm_vcpu *vcpu)
>  #endif
>  
>  	kvmppc_fix_ee_before_entry();
> -
> +	vcpu->arch.pgdir = current->mm->pgd;
>  	ret = __kvmppc_vcpu_run(kvm_run, vcpu);

kvmppc_fix_ee_before_entry() is supposed to be the last thing that
happens before __kvmppc_vcpu_run().

> @@ -332,6 +324,8 @@ static inline int kvmppc_e500_shadow_map(struct kvmppc_vcpu_e500 *vcpu_e500,
>  	unsigned long hva;
>  	int pfnmap = 0;
>  	int tsize = BOOK3E_PAGESZ_4K;
> +	pte_t pte;
> +	int wimg = 0;
>  
>  	/*
>  	 * Translate guest physical to true physical, acquiring
> @@ -437,6 +431,8 @@ static inline int kvmppc_e500_shadow_map(struct kvmppc_vcpu_e500 *vcpu_e500,
>  
>  	if (likely(!pfnmap)) {
>  		unsigned long tsize_pages = 1 << (tsize + 10 - PAGE_SHIFT);
> +		pgd_t *pgdir;
> +
>  		pfn = gfn_to_pfn_memslot(slot, gfn);
>  		if (is_error_noslot_pfn(pfn)) {
>  			printk(KERN_ERR "Couldn't get real page for gfn %lx!\n",
> @@ -447,9 +443,18 @@ static inline int kvmppc_e500_shadow_map(struct kvmppc_vcpu_e500 *vcpu_e500,
>  		/* Align guest and physical address to page map boundaries */
>  		pfn &= ~(tsize_pages - 1);
>  		gvaddr &= ~((tsize_pages << PAGE_SHIFT) - 1);
> +		pgdir = vcpu_e500->vcpu.arch.pgdir;
> +		pte = lookup_linux_pte(pgdir, hva, 1, &tsize_pages);
> +		if (pte_present(pte)) {
> +			wimg = (pte >> PTE_WIMGE_SHIFT) & MAS2_WIMGE_MASK;
> +		} else {
> +			printk(KERN_ERR "pte not present: gfn %lx, pfn %lx\n",
> +					(long)gfn, pfn);
> +			return -EINVAL;
> +		}
>  	}

How does wimg get set in the pfnmap case?

Could you explain why we need to set dirty/referenced on the PTE, when we
didn't need to do that before?  All we're getting from the PTE is wimg. 
We have MMU notifiers to take care of the page being unmapped, and we've
already marked the page itself as dirty if the TLB entry is writeable.

-Scott

  parent reply	other threads:[~2013-08-02 23:35 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-08-01 11:12 [PATCH 0/6 v2] kvm: powerpc: use cache attributes from linux pte Bharat Bhushan
2013-08-01 11:12 ` [PATCH 1/6 v2] powerpc: book3e: _PAGE_LENDIAN must be _PAGE_ENDIAN Bharat Bhushan
2013-08-01 11:12 ` [PATCH 2/6 v2] kvm: powerpc: allow guest control "E" attribute in mas2 Bharat Bhushan
2013-08-01 11:12 ` [PATCH 3/6 v2] kvm: powerpc: allow guest control "G" " Bharat Bhushan
2013-08-02  6:39   ` "“tiejun.chen”"
2013-08-01 11:12 ` [PATCH 4/6 v2] powerpc: move linux pte/hugepte search to more generic file Bharat Bhushan
2013-08-01 11:12 ` [PATCH 5/6 v2] kvm: powerpc: booke: Add linux pte lookup like booke3s Bharat Bhushan
2013-08-02  6:37   ` "“tiejun.chen”"
2013-08-02 22:58   ` Scott Wood
2013-08-02 23:16     ` Benjamin Herrenschmidt
2013-08-03  2:58       ` Bhushan Bharat-R65777
2013-08-03  4:24         ` Benjamin Herrenschmidt
2013-08-05 14:27           ` Bhushan Bharat-R65777
2013-08-05 19:19             ` Scott Wood
2013-08-06  1:12               ` Bhushan Bharat-R65777
2013-08-06  7:02               ` Bhushan Bharat-R65777
2013-08-07  0:24                 ` Paul Mackerras
2013-08-07  1:11                   ` Scott Wood
2013-08-07  1:47                     ` Paul Mackerras
2013-08-06 14:46               ` Bhushan Bharat-R65777
2013-08-01 11:12 ` [PATCH 6/6 v2] kvm: powerpc: use caching attributes as per linux pte Bharat Bhushan
2013-08-02  6:24   ` "“tiejun.chen”"
2013-08-02 23:34   ` Scott Wood [this message]
2013-08-03  3:11     ` Bhushan Bharat-R65777
2013-08-03  4:25       ` Benjamin Herrenschmidt
2013-08-05 16:28         ` Scott Wood
2013-08-05 16:30       ` Scott Wood

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20130802233452.GA27636@home.buserror.net \
    --to=scottwood@freescale.com \
    --cc=Bharat.Bhushan@freescale.com \
    --cc=agraf@suse.de \
    --cc=kvm-ppc@vger.kernel.org \
    --cc=kvm@vger.kernel.org \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=r65777@freescale.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).