diff mbox series

[Xen-devel] xen: passthrough/amd: Remove unused function guest_iommu_set_base

Message ID 20190319232130.24172-2-julien.grall@arm.com
State New
Headers show
Series [Xen-devel] xen: passthrough/amd: Remove unused function guest_iommu_set_base | expand

Commit Message

Julien Grall March 19, 2019, 11:21 p.m. UTC
The function is unused and could potentially lead a to trigger the
BUG_ON() in p2m_change_type_one if misused as the p2m type is not
sanitized.

So remove it.

Signed-off-by: Julien Grall <julien.grall@arm.com>
---
 xen/drivers/passthrough/amd/iommu_guest.c     | 23 -----------------------
 xen/include/asm-x86/hvm/svm/amd-iommu-proto.h |  1 -
 2 files changed, 24 deletions(-)

Comments

Julien Grall March 19, 2019, 11:23 p.m. UTC | #1
Hi,

Hmmm, I mistakenly resent this patch. Please ignore this version and 
review <20190319232055.23993-1-julien.grall@arm.com>

Sorry for the noise.

Cheers,

On 3/19/19 11:21 PM, Julien Grall wrote:
> The function is unused and could potentially lead a to trigger the
> BUG_ON() in p2m_change_type_one if misused as the p2m type is not
> sanitized.
> 
> So remove it.
> 
> Signed-off-by: Julien Grall <julien.grall@arm.com>
> ---
>   xen/drivers/passthrough/amd/iommu_guest.c     | 23 -----------------------
>   xen/include/asm-x86/hvm/svm/amd-iommu-proto.h |  1 -
>   2 files changed, 24 deletions(-)
> 
> diff --git a/xen/drivers/passthrough/amd/iommu_guest.c b/xen/drivers/passthrough/amd/iommu_guest.c
> index 96175bb9ac..dbb7526025 100644
> --- a/xen/drivers/passthrough/amd/iommu_guest.c
> +++ b/xen/drivers/passthrough/amd/iommu_guest.c
> @@ -805,29 +805,6 @@ static int guest_iommu_mmio_write(struct vcpu *v, unsigned long addr,
>       return X86EMUL_OKAY;
>   }
>   
> -int guest_iommu_set_base(struct domain *d, uint64_t base)
> -{
> -    p2m_type_t t;
> -    struct guest_iommu *iommu = domain_iommu(d);
> -
> -    if ( !iommu )
> -        return -EACCES;
> -
> -    iommu->mmio_base = base;
> -    base >>= PAGE_SHIFT;
> -
> -    for ( int i = 0; i < IOMMU_MMIO_PAGE_NR; i++ )
> -    {
> -        unsigned long gfn = base + i;
> -
> -        get_gfn_query(d, gfn, &t);
> -        p2m_change_type_one(d, gfn, t, p2m_mmio_dm);
> -        put_gfn(d, gfn);
> -    }
> -
> -    return 0;
> -}
> -
>   /* Initialize mmio read only bits */
>   static void guest_iommu_reg_init(struct guest_iommu *iommu)
>   {
> diff --git a/xen/include/asm-x86/hvm/svm/amd-iommu-proto.h b/xen/include/asm-x86/hvm/svm/amd-iommu-proto.h
> index c5697565d6..0129ffe5a9 100644
> --- a/xen/include/asm-x86/hvm/svm/amd-iommu-proto.h
> +++ b/xen/include/asm-x86/hvm/svm/amd-iommu-proto.h
> @@ -142,7 +142,6 @@ void guest_iommu_add_ppr_log(struct domain *d, u32 entry[]);
>   void guest_iommu_add_event_log(struct domain *d, u32 entry[]);
>   int guest_iommu_init(struct domain* d);
>   void guest_iommu_destroy(struct domain *d);
> -int guest_iommu_set_base(struct domain *d, uint64_t base);
>   
>   static inline u32 get_field_from_reg_u32(u32 reg_value, u32 mask, u32 shift)
>   {
>
diff mbox series

Patch

diff --git a/xen/drivers/passthrough/amd/iommu_guest.c b/xen/drivers/passthrough/amd/iommu_guest.c
index 96175bb9ac..dbb7526025 100644
--- a/xen/drivers/passthrough/amd/iommu_guest.c
+++ b/xen/drivers/passthrough/amd/iommu_guest.c
@@ -805,29 +805,6 @@  static int guest_iommu_mmio_write(struct vcpu *v, unsigned long addr,
     return X86EMUL_OKAY;
 }
 
-int guest_iommu_set_base(struct domain *d, uint64_t base)
-{
-    p2m_type_t t;
-    struct guest_iommu *iommu = domain_iommu(d);
-
-    if ( !iommu )
-        return -EACCES;
-
-    iommu->mmio_base = base;
-    base >>= PAGE_SHIFT;
-
-    for ( int i = 0; i < IOMMU_MMIO_PAGE_NR; i++ )
-    {
-        unsigned long gfn = base + i;
-
-        get_gfn_query(d, gfn, &t);
-        p2m_change_type_one(d, gfn, t, p2m_mmio_dm);
-        put_gfn(d, gfn);
-    }
-
-    return 0;
-}
-
 /* Initialize mmio read only bits */
 static void guest_iommu_reg_init(struct guest_iommu *iommu)
 {
diff --git a/xen/include/asm-x86/hvm/svm/amd-iommu-proto.h b/xen/include/asm-x86/hvm/svm/amd-iommu-proto.h
index c5697565d6..0129ffe5a9 100644
--- a/xen/include/asm-x86/hvm/svm/amd-iommu-proto.h
+++ b/xen/include/asm-x86/hvm/svm/amd-iommu-proto.h
@@ -142,7 +142,6 @@  void guest_iommu_add_ppr_log(struct domain *d, u32 entry[]);
 void guest_iommu_add_event_log(struct domain *d, u32 entry[]);
 int guest_iommu_init(struct domain* d);
 void guest_iommu_destroy(struct domain *d);
-int guest_iommu_set_base(struct domain *d, uint64_t base);
 
 static inline u32 get_field_from_reg_u32(u32 reg_value, u32 mask, u32 shift)
 {