[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [RFC PATCH V2 11/26] x86/hvm: Introduce a emulated VTD for HVM



On Thu, May 18, 2017 at 01:34:41AM -0400, Lan Tianyu wrote:
> From: Chao Gao <chao.gao@xxxxxxxxx>
> 
> This patch adds create/destroy/query function for the emulated VTD
> and adapts it to the common VIOMMU abstraction.
> 
> Signed-off-by: Chao Gao <chao.gao@xxxxxxxxx>
> Signed-off-by: Lan Tianyu <tianyu.lan@xxxxxxxxx>
> ---
>  xen/arch/x86/hvm/Makefile           |   1 +
>  xen/arch/x86/hvm/vvtd.c             | 176 
> ++++++++++++++++++++++++++++++++++++
>  xen/drivers/passthrough/vtd/iommu.h | 102 ++++++++++++++++-----
>  xen/include/asm-x86/viommu.h        |   3 +
>  4 files changed, 259 insertions(+), 23 deletions(-)
>  create mode 100644 xen/arch/x86/hvm/vvtd.c
> 
> diff --git a/xen/arch/x86/hvm/Makefile b/xen/arch/x86/hvm/Makefile
> index 0a3d0f4..82a2030 100644
> --- a/xen/arch/x86/hvm/Makefile
> +++ b/xen/arch/x86/hvm/Makefile
> @@ -22,6 +22,7 @@ obj-y += rtc.o
>  obj-y += save.o
>  obj-y += stdvga.o
>  obj-y += vioapic.o
> +obj-y += vvtd.o

Please sort this.

>  obj-y += viridian.o
>  obj-y += vlapic.o
>  obj-y += vmsi.o
> diff --git a/xen/arch/x86/hvm/vvtd.c b/xen/arch/x86/hvm/vvtd.c
> new file mode 100644
> index 0000000..e364f2b
> --- /dev/null
> +++ b/xen/arch/x86/hvm/vvtd.c
> @@ -0,0 +1,176 @@
> +/*
> + * vvtd.c
> + *
> + * virtualize VTD for HVM.
> + *
> + * Copyright (C) 2017 Chao Gao, Intel Corporation.
> + *
> + * This program is free software; you can redistribute it and/or
> + * modify it under the terms and conditions of the GNU General Public
> + * License, version 2, as published by the Free Software Foundation.
> + *
> + * This program is distributed in the hope that it will be useful,
> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
> + * General Public License for more details.
> + *
> + * You should have received a copy of the GNU General Public
> + * License along with this program; If not, see 
> <http://www.gnu.org/licenses/>.
> + */
> +
> +#include <xen/domain_page.h>
> +#include <xen/sched.h>
> +#include <xen/types.h>
> +#include <xen/viommu.h>
> +#include <xen/xmalloc.h>
> +#include <asm/current.h>
> +#include <asm/hvm/domain.h>
> +#include <asm/page.h>
> +#include <public/viommu.h>
> +
> +#include "../../../drivers/passthrough/vtd/iommu.h"
> +

Maybe you should move this header to include/asm-x86?

> +struct hvm_hw_vvtd_regs {
> +    uint8_t data[1024];
> +};
> +
> +/* Status field of struct vvtd */
> +#define VIOMMU_STATUS_IRQ_REMAPPING_ENABLED     (1 << 0)
> +#define VIOMMU_STATUS_DMA_REMAPPING_ENABLED     (1 << 1)
[...]
> diff --git a/xen/drivers/passthrough/vtd/iommu.h 
> b/xen/drivers/passthrough/vtd/iommu.h
> index 72c1a2e..2e9dcaa 100644
> --- a/xen/drivers/passthrough/vtd/iommu.h
> +++ b/xen/drivers/passthrough/vtd/iommu.h
> @@ -23,31 +23,54 @@
>  #include <asm/msi.h>
>  
>  /*
> - * Intel IOMMU register specification per version 1.0 public spec.
> + * Intel IOMMU register specification per version 2.4 public spec.
>   */
>  

It would be better to have a separate patch to update the spec.

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
https://lists.xen.org/xen-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.