All of lore.kernel.org
 help / color / mirror / Atom feed
From: Avi Kivity <avi@redhat.com>
To: Christoffer Dall <cdall@cs.columbia.edu>
Cc: kvm@vger.kernel.org, catalin.marinas@arm.com,
	tech@virtualopensystems.com, android-virt@lists.cs.columbia.edu
Subject: Re: [PATCH v4 08/10] ARM: KVM: Handle guest faults in KVM
Date: Tue, 09 Aug 2011 14:24:50 +0300	[thread overview]
Message-ID: <4E411902.9010406@redhat.com> (raw)
In-Reply-To: <20110806103957.27198.28802.stgit@localhost6.localdomain6>

On 08/06/2011 01:39 PM, Christoffer Dall wrote:
> Handles the guest faults in KVM by mapping in corresponding user pages
> in the 2nd stage page tables.
>
> Introduces new ARM-specific kernel memory types, PAGE_KVM_GUEST and
> pgprot_guest variables used to map 2nd stage memory for KVM guests.
>
>
>
> +static int user_mem_abort(struct kvm_vcpu *vcpu, phys_addr_t fault_ipa,
> +			  gfn_t gfn, struct kvm_memory_slot *memslot)
> +{
> +	pfn_t pfn;
> +	pgd_t *pgd;
> +	pud_t *pud;
> +	pmd_t *pmd;
> +	pte_t *pte, new_pte;
> +
> +	pfn = gfn_to_pfn(vcpu->kvm, gfn);
> +
> +	if (is_error_pfn(pfn)) {
> +		kvm_err(-EFAULT, "Guest gfn %u (0x%08lx) does not have "
> +				"corresponding host mapping",
> +				gfn, gfn<<  PAGE_SHIFT);
> +		return -EFAULT;
> +	}
> +
> +	/* Create 2nd stage page table mapping - Level 1 */
> +	pgd = vcpu->kvm->arch.pgd + pgd_index(fault_ipa);
> +	pud = pud_offset(pgd, fault_ipa);
> +	if (pud_none(*pud)) {
> +		pmd = pmd_alloc_one(NULL, fault_ipa);
> +		if (!pmd) {
> +			kvm_err(-ENOMEM, "Cannot allocate 2nd stage pmd");
> +			return -ENOMEM;
> +		}
> +		pud_populate(NULL, pud, pmd);
> +		pmd += pmd_index(fault_ipa);

Don't we need locking here?  Another vcpu may have executed pud_populate 
concurrently.

> +	} else
> +		pmd = pmd_offset(pud, fault_ipa);
> +
> +	/* Create 2nd stage page table mapping - Level 2 */
> +	if (pmd_none(*pmd)) {
> +		pte = pte_alloc_one_kernel(NULL, fault_ipa);
> +		if (!pte) {
> +			kvm_err(-ENOMEM, "Cannot allocate 2nd stage pte");
> +			return -ENOMEM;
> +		}
> +		pmd_populate_kernel(NULL, pmd, pte);
> +		pte += pte_index(fault_ipa);
> +	} else
> +		pte = pte_offset_kernel(pmd, fault_ipa);
> +
> +	/* Create 2nd stage page table mapping - Level 3 */
> +	new_pte = pfn_pte(pfn, PAGE_KVM_GUEST);
> +	set_pte_ext(pte, new_pte, 0);
> +
> +	return 0;
> +}
> +
> +#define HSR_ABT_FS	(0x3f)
>

-- 
error compiling committee.c: too many arguments to function


  reply	other threads:[~2011-08-09 11:25 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-08-06 10:38 [PATCH v4 00/10] KVM/ARM Implementation Christoffer Dall
2011-08-06 10:39 ` [PATCH v4 01/10] ARM: KVM: Initial skeleton to compile KVM support Christoffer Dall
2011-08-06 10:39 ` [PATCH v4 02/10] ARM: KVM: Hypervisor identity mapping Christoffer Dall
2011-08-09  9:20   ` Avi Kivity
2011-08-09  9:29     ` Catalin Marinas
2011-08-09  9:29     ` Christoffer Dall
2011-08-09 10:23       ` [Android-virt] " Alexey Smirnov
2011-08-09 11:23         ` Christoffer Dall
2011-08-06 10:39 ` [PATCH v4 03/10] ARM: KVM: Add hypervisor inititalization Christoffer Dall
2011-08-06 10:39 ` [PATCH v4 04/10] ARM: KVM: Memory virtualization setup Christoffer Dall
2011-08-09  9:57   ` Avi Kivity
2011-08-09 11:24     ` [Android-virt] " Christoffer Dall
2011-08-06 10:39 ` [PATCH v4 05/10] ARM: KVM: Inject IRQs and FIQs from userspace Christoffer Dall
2011-08-09 10:07   ` Avi Kivity
2011-08-09 11:27     ` [Android-virt] " Christoffer Dall
2011-08-09 11:37       ` Avi Kivity
2011-08-09 11:40         ` Christoffer Dall
2011-08-06 10:39 ` [PATCH v4 06/10] ARM: KVM: World-switch implementation Christoffer Dall
2011-08-09 11:09   ` Avi Kivity
2011-08-09 11:29     ` Christoffer Dall
2011-08-06 10:39 ` [PATCH v4 07/10] ARM: KVM: Emulation framework and CP15 emulation Christoffer Dall
2011-08-09 11:17   ` Avi Kivity
2011-08-09 11:34     ` Christoffer Dall
2011-08-09 11:39       ` Avi Kivity
2011-08-09 11:40         ` Christoffer Dall
2011-08-06 10:39 ` [PATCH v4 08/10] ARM: KVM: Handle guest faults in KVM Christoffer Dall
2011-08-09 11:24   ` Avi Kivity [this message]
2011-08-09 11:35     ` Christoffer Dall
2011-08-06 10:40 ` [PATCH v4 09/10] ARM: KVM: Handle I/O aborts Christoffer Dall
2011-08-09 11:34   ` Avi Kivity
2011-08-09 11:39     ` Christoffer Dall
2011-08-09 11:46       ` Avi Kivity
2011-08-06 10:40 ` [PATCH v4 10/10] ARM: KVM: Guest wait-for-interrupts (WFI) support Christoffer Dall
2011-08-09 11:43 ` [PATCH v4 00/10] KVM/ARM Implementation Avi Kivity

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=4E411902.9010406@redhat.com \
    --to=avi@redhat.com \
    --cc=android-virt@lists.cs.columbia.edu \
    --cc=catalin.marinas@arm.com \
    --cc=cdall@cs.columbia.edu \
    --cc=kvm@vger.kernel.org \
    --cc=tech@virtualopensystems.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.