Re: [Xen-devel] [PATCH RFC 06/10] passthrough/amd: remove guest iommu support

2018-05-02 Thread Suravee Suthikulpanit

Wei,

On 2/21/18 3:46 PM, Wei Liu wrote:

It is never used and it is getting in the way of cleaning up.

The only callsite of guest_iommu_add_ppr_log has no effect because
guest iommu is not initialised.

Signed-off-by: Wei Liu
---
Cc: Suravee Suthikulpanit
---
  xen/drivers/passthrough/x86/amd/Makefile  |   1 -
  xen/drivers/passthrough/x86/amd/iommu_guest.c | 927 --
  xen/drivers/passthrough/x86/amd/iommu_init.c  |  21 +-
  xen/include/asm-x86/amd-iommu.h   |  51 --
  xen/include/asm-x86/hvm/svm/amd-iommu-proto.h |   8 -
  xen/include/asm-x86/iommu.h   |   1 -
  6 files changed, 6 insertions(+), 1003 deletions(-)
  delete mode 100644 xen/drivers/passthrough/x86/amd/iommu_guest.c


Would it be too much trouble if we keep this code for now. There is a plan to 
support
IOMMU in guest in the near future. This could be clean up at that point if no 
longer
needed.

Thanks,
Suravee

___
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

[Xen-devel] [PATCH RFC 06/10] passthrough/amd: remove guest iommu support

2018-02-21 Thread Wei Liu
It is never used and it is getting in the way of cleaning up.

The only callsite of guest_iommu_add_ppr_log has no effect because
guest iommu is not initialised.

Signed-off-by: Wei Liu 
---
Cc: Suravee Suthikulpanit 
---
 xen/drivers/passthrough/x86/amd/Makefile  |   1 -
 xen/drivers/passthrough/x86/amd/iommu_guest.c | 927 --
 xen/drivers/passthrough/x86/amd/iommu_init.c  |  21 +-
 xen/include/asm-x86/amd-iommu.h   |  51 --
 xen/include/asm-x86/hvm/svm/amd-iommu-proto.h |   8 -
 xen/include/asm-x86/iommu.h   |   1 -
 6 files changed, 6 insertions(+), 1003 deletions(-)
 delete mode 100644 xen/drivers/passthrough/x86/amd/iommu_guest.c

diff --git a/xen/drivers/passthrough/x86/amd/Makefile 
b/xen/drivers/passthrough/x86/amd/Makefile
index 95c04ed237..415146fcdb 100644
--- a/xen/drivers/passthrough/x86/amd/Makefile
+++ b/xen/drivers/passthrough/x86/amd/Makefile
@@ -5,4 +5,3 @@ obj-y += pci_amd_iommu.o
 obj-bin-y += iommu_acpi.init.o
 obj-y += iommu_intr.o
 obj-y += iommu_cmd.o
-obj-y += iommu_guest.o
diff --git a/xen/drivers/passthrough/x86/amd/iommu_guest.c 
b/xen/drivers/passthrough/x86/amd/iommu_guest.c
deleted file mode 100644
index 96175bb9ac..00
--- a/xen/drivers/passthrough/x86/amd/iommu_guest.c
+++ /dev/null
@@ -1,927 +0,0 @@
-/*
- * Copyright (C) 2011 Advanced Micro Devices, Inc.
- * Author: Wei Wang 
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * 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 .
- */
-
-#include 
-#include 
-#include 
-#include 
-
-
-#define IOMMU_MMIO_SIZE 0x8000
-#define IOMMU_MMIO_PAGE_NR  0x8
-#define RING_BF_LENGTH_MASK 0x0F00
-#define RING_BF_LENGTH_SHIFT24
-
-#define PASMAX_9_bit0x8
-#define GUEST_CR3_1_LEVEL   0x0
-#define GUEST_ADDRESS_SIZE_6_LEVEL  0x2
-#define HOST_ADDRESS_SIZE_6_LEVEL   0x2
-
-#define guest_iommu_set_status(iommu, bit) \
-iommu_set_bit(&((iommu)->reg_status.lo), bit)
-
-#define guest_iommu_clear_status(iommu, bit) \
-iommu_clear_bit(&((iommu)->reg_status.lo), bit)
-
-#define reg_to_u64(reg) (((uint64_t)reg.hi << 32) | reg.lo )
-#define u64_to_reg(reg, val) \
-do \
-{ \
-(reg)->lo = (u32)(val); \
-(reg)->hi = (val) >> 32; \
-} while (0)
-
-static unsigned int machine_bdf(struct domain *d, uint16_t guest_bdf)
-{
-return guest_bdf;
-}
-
-static uint16_t guest_bdf(struct domain *d, uint16_t machine_bdf)
-{
-return machine_bdf;
-}
-
-static inline struct guest_iommu *domain_iommu(struct domain *d)
-{
-return dom_iommu(d)->arch.g_iommu;
-}
-
-static inline struct guest_iommu *vcpu_iommu(struct vcpu *v)
-{
-return dom_iommu(v->domain)->arch.g_iommu;
-}
-
-static void guest_iommu_enable(struct guest_iommu *iommu)
-{
-iommu->enabled = 1;
-}
-
-static void guest_iommu_disable(struct guest_iommu *iommu)
-{
-iommu->enabled = 0;
-}
-
-static uint64_t get_guest_cr3_from_dte(dev_entry_t *dte)
-{
-uint64_t gcr3_1, gcr3_2, gcr3_3;
-
-gcr3_1 = get_field_from_reg_u32(dte->data[1],
-IOMMU_DEV_TABLE_GCR3_1_MASK,
-IOMMU_DEV_TABLE_GCR3_1_SHIFT);
-gcr3_2 = get_field_from_reg_u32(dte->data[2],
-IOMMU_DEV_TABLE_GCR3_2_MASK,
-IOMMU_DEV_TABLE_GCR3_2_SHIFT);
-gcr3_3 = get_field_from_reg_u32(dte->data[3],
-IOMMU_DEV_TABLE_GCR3_3_MASK,
-IOMMU_DEV_TABLE_GCR3_3_SHIFT);
-
-return ((gcr3_3 << 31) | (gcr3_2 << 15 ) | (gcr3_1 << 12)) >> PAGE_SHIFT;
-}
-
-static uint16_t get_domid_from_dte(dev_entry_t *dte)
-{
-return get_field_from_reg_u32(dte->data[2], IOMMU_DEV_TABLE_DOMAIN_ID_MASK,
-  IOMMU_DEV_TABLE_DOMAIN_ID_SHIFT);
-}
-
-static uint16_t get_glx_from_dte(dev_entry_t *dte)
-{
-return get_field_from_reg_u32(dte->data[1], IOMMU_DEV_TABLE_GLX_MASK,
-  IOMMU_DEV_TABLE_GLX_SHIFT);
-}
-
-static uint16_t get_gv_from_dte(dev_entry_t *dte)
-{
-return get_field_from_reg_u32(dte->data[1],IOMMU_DEV_TABLE_GV_MASK,
-  IOMMU_DEV_TABLE_GV_SHIFT);
-}
-