WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

Re: [Xen-devel] [PATCH 14/18] Nested Virtualization: svm specific implem

To: Christoph Egger <Christoph.Egger@xxxxxxx>
Subject: Re: [Xen-devel] [PATCH 14/18] Nested Virtualization: svm specific implementation
From: Tim Deegan <Tim.Deegan@xxxxxxxxxx>
Date: Fri, 16 Apr 2010 14:22:22 +0100
Cc: "xen-devel@xxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxx>
Delivery-date: Sun, 18 Apr 2010 07:44:27 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
In-reply-to: <201004151439.15634.Christoph.Egger@xxxxxxx>
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
References: <201004151439.15634.Christoph.Egger@xxxxxxx>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
User-agent: Mutt/1.5.18 (2008-05-17)
> +static int nsvm_vmrun_permissionmap(struct vcpu *v)
> +{
> +    struct arch_svm_struct *arch_svm = &v->arch.hvm_svm;
> +    struct vmcb_struct *ns_vmcb = VCPU_NESTEDHVM(v).nh_vmcb;
> +    struct vmcb_struct *host_vmcb = arch_svm->vmcb;
> +    unsigned long *ns_iopm_ptr, *ns_msrpm_ptr;
> +    unsigned int i;
> +    /* Must be static or hvm_copy_from_guest_phys fails, otherwise. */
> +    static uint8_t ns_iopm[IOPM_SIZE] __attribute__((__aligned__));
> +    static uint8_t ns_msrpm[MSRPM_SIZE] __attribute__((__aligned__));

*boggle*  

Maybe I missed the locking that makes this safe.

Tim.

> +
> +    ns_iopm_ptr = (unsigned long *)ns_iopm;
> +    ns_msrpm_ptr = (unsigned long *)ns_msrpm;
> +
> +    hvm_copy_from_guest_phys(ns_iopm, ns_vmcb->iopm_base_pa, IOPM_SIZE);
> +    hvm_copy_from_guest_phys(ns_msrpm, ns_vmcb->msrpm_base_pa, MSRPM_SIZE);
> +    /* hvm_io_bitmap has type unsigned long, thus
> +     * BYTES_PER_LONG.
> +     */
> +    for (i = 0; i < IOPM_SIZE / BYTES_PER_LONG; i++)
> +        VCPU_NESTEDHVM(v).nh_iopm[i] = hvm_io_bitmap[i] | ns_iopm_ptr[i];
> +
> +    /* v->arch.hvm_svm.msrpm has type unsigned long, thus
> +     * BYTES_PER_LONG.
> +     */
> +    for (i = 0; i < MSRPM_SIZE / BYTES_PER_LONG; i++)
> +        VCPU_NESTEDHVM(v).nh_msrpm[i] = arch_svm->msrpm[i] | ns_msrpm_ptr[i];
> +
> +    host_vmcb->iopm_base_pa =
> +        (uint64_t)virt_to_maddr(VCPU_NESTEDHVM(v).nh_iopm);
> +    host_vmcb->msrpm_base_pa =
> +        (uint64_t)virt_to_maddr(VCPU_NESTEDHVM(v).nh_msrpm);
> +
> +    return 0;
> +}

-- 
Tim Deegan <Tim.Deegan@xxxxxxxxxx>
Principal Software Engineer, XenServer Engineering
Citrix Systems UK Ltd.  (Company #02937203, SL9 0BG)

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel

<Prev in Thread] Current Thread [Next in Thread>