Mailing List Archive

[PATCH 09/12] xen: only map PV guest grants via iommu if HAS_PASSTHROUGH
Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
---
xen/Rules.mk | 1 +
xen/arch/arm/dummy.S | 2 --
xen/common/grant_table.c | 6 ++++++
3 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/xen/Rules.mk b/xen/Rules.mk
index e25e8d4..ce88316 100644
--- a/xen/Rules.mk
+++ b/xen/Rules.mk
@@ -52,6 +52,7 @@ CFLAGS-$(perfc_arrays) += -DPERF_ARRAYS
CFLAGS-$(lock_profile) += -DLOCK_PROFILE
CFLAGS-$(HAS_ACPI) += -DHAS_ACPI
CFLAGS-$(HAS_TMEM) += -DHAS_TMEM
+CFLAGS-$(HAS_PASSTHROUGH) += -DHAS_PASSTHROUGH
CFLAGS-$(frame_pointer) += -fno-omit-frame-pointer -DCONFIG_FRAME_POINTER

ifneq ($(max_phys_cpus),)
diff --git a/xen/arch/arm/dummy.S b/xen/arch/arm/dummy.S
index 5010619..e858613 100644
--- a/xen/arch/arm/dummy.S
+++ b/xen/arch/arm/dummy.S
@@ -27,8 +27,6 @@ DUMMY(gmfn_to_mfn);
DUMMY(gnttab_clear_flag);
DUMMY(gnttab_mark_dirty);
DUMMY(hypercall_create_continuation);
-DUMMY(iommu_map_page);
-DUMMY(iommu_unmap_page);
DUMMY(is_iomem_page);
DUMMY(max_page);
DUMMY(node_online_map);
diff --git a/xen/common/grant_table.c b/xen/common/grant_table.c
index b024016..1798fcd 100644
--- a/xen/common/grant_table.c
+++ b/xen/common/grant_table.c
@@ -434,6 +434,7 @@ static int _set_status(unsigned gt_version,
return _set_status_v2(domid, readonly, mapflag, shah, act, status);
}

+#ifdef HAS_PASSTHROUGH
static void mapcount(
struct domain *ld, unsigned long mfn,
unsigned int *wrc, unsigned int *rdc)
@@ -456,6 +457,7 @@ static void mapcount(
rcu_unlock_domain(rd);
}
}
+#endif

/*
* Returns 0 if TLB flush / invalidate required by caller.
@@ -662,6 +664,7 @@ __gnttab_map_grant_ref(
goto undo_out;
}

+#ifdef HAS_PASSTHROUGH
if ( !is_hvm_domain(ld) && need_iommu(ld) )
{
unsigned int wrc, rdc;
@@ -689,6 +692,7 @@ __gnttab_map_grant_ref(
goto undo_out;
}
}
+#endif

TRACE_1D(TRC_MEM_PAGE_GRANT_MAP, op->dom);

@@ -858,6 +862,7 @@ __gnttab_unmap_common(
act->pin -= GNTPIN_hstw_inc;
}

+#ifdef HAS_PASSTHROUGH
if ( !is_hvm_domain(ld) && need_iommu(ld) )
{
unsigned int wrc, rdc;
@@ -874,6 +879,7 @@ __gnttab_unmap_common(
goto unmap_out;
}
}
+#endif

/* If just unmapped a writable mapping, mark as dirtied */
if ( !(op->flags & GNTMAP_readonly) )
--
1.7.2.5


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xensource.com
http://lists.xensource.com/xen-devel
Re: [PATCH 09/12] xen: only map PV guest grants via iommu if HAS_PASSTHROUGH [ In reply to ]
>>> On 20.01.12 at 13:06, Ian Campbell <ian.campbell@citrix.com> wrote:
> Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
> ---
> xen/Rules.mk | 1 +
> xen/arch/arm/dummy.S | 2 --
> xen/common/grant_table.c | 6 ++++++
> 3 files changed, 7 insertions(+), 2 deletions(-)
>
> diff --git a/xen/Rules.mk b/xen/Rules.mk
> index e25e8d4..ce88316 100644
> --- a/xen/Rules.mk
> +++ b/xen/Rules.mk
> @@ -52,6 +52,7 @@ CFLAGS-$(perfc_arrays) += -DPERF_ARRAYS
> CFLAGS-$(lock_profile) += -DLOCK_PROFILE
> CFLAGS-$(HAS_ACPI) += -DHAS_ACPI
> CFLAGS-$(HAS_TMEM) += -DHAS_TMEM
> +CFLAGS-$(HAS_PASSTHROUGH) += -DHAS_PASSTHROUGH
> CFLAGS-$(frame_pointer) += -fno-omit-frame-pointer -DCONFIG_FRAME_POINTER
>
> ifneq ($(max_phys_cpus),)
> diff --git a/xen/arch/arm/dummy.S b/xen/arch/arm/dummy.S
> index 5010619..e858613 100644
> --- a/xen/arch/arm/dummy.S
> +++ b/xen/arch/arm/dummy.S
> @@ -27,8 +27,6 @@ DUMMY(gmfn_to_mfn);
> DUMMY(gnttab_clear_flag);
> DUMMY(gnttab_mark_dirty);
> DUMMY(hypercall_create_continuation);
> -DUMMY(iommu_map_page);
> -DUMMY(iommu_unmap_page);
> DUMMY(is_iomem_page);
> DUMMY(max_page);
> DUMMY(node_online_map);
> diff --git a/xen/common/grant_table.c b/xen/common/grant_table.c
> index b024016..1798fcd 100644
> --- a/xen/common/grant_table.c
> +++ b/xen/common/grant_table.c
> @@ -434,6 +434,7 @@ static int _set_status(unsigned gt_version,
> return _set_status_v2(domid, readonly, mapflag, shah, act, status);
> }
>
> +#ifdef HAS_PASSTHROUGH
> static void mapcount(
> struct domain *ld, unsigned long mfn,
> unsigned int *wrc, unsigned int *rdc)
> @@ -456,6 +457,7 @@ static void mapcount(
> rcu_unlock_domain(rd);
> }
> }
> +#endif
>
> /*
> * Returns 0 if TLB flush / invalidate required by caller.
> @@ -662,6 +664,7 @@ __gnttab_map_grant_ref(
> goto undo_out;
> }
>
> +#ifdef HAS_PASSTHROUGH
> if ( !is_hvm_domain(ld) && need_iommu(ld) )

Wouldn't #define-ing need_iommu() to 0 in the ARM headers achieve
the same effect, without cluttering common code?

Jan

> {
> unsigned int wrc, rdc;
> @@ -689,6 +692,7 @@ __gnttab_map_grant_ref(
> goto undo_out;
> }
> }
> +#endif
>
> TRACE_1D(TRC_MEM_PAGE_GRANT_MAP, op->dom);
>
> @@ -858,6 +862,7 @@ __gnttab_unmap_common(
> act->pin -= GNTPIN_hstw_inc;
> }
>
> +#ifdef HAS_PASSTHROUGH
> if ( !is_hvm_domain(ld) && need_iommu(ld) )
> {
> unsigned int wrc, rdc;
> @@ -874,6 +879,7 @@ __gnttab_unmap_common(
> goto unmap_out;
> }
> }
> +#endif
>
> /* If just unmapped a writable mapping, mark as dirtied */
> if ( !(op->flags & GNTMAP_readonly) )
> --
> 1.7.2.5
>
>
> _______________________________________________
> Xen-devel mailing list
> Xen-devel@lists.xensource.com
> http://lists.xensource.com/xen-devel




_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xensource.com
http://lists.xensource.com/xen-devel
Re: [PATCH 09/12] xen: only map PV guest grants via iommu if HAS_PASSTHROUGH [ In reply to ]
On Fri, 2012-01-20 at 12:38 +0000, Jan Beulich wrote:
> >>> On 20.01.12 at 13:06, Ian Campbell <ian.campbell@citrix.com> wrote:
> > Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
> > ---
> > xen/Rules.mk | 1 +
> > xen/arch/arm/dummy.S | 2 --
> > xen/common/grant_table.c | 6 ++++++
> > 3 files changed, 7 insertions(+), 2 deletions(-)
> >
> > diff --git a/xen/Rules.mk b/xen/Rules.mk
> > index e25e8d4..ce88316 100644
> > --- a/xen/Rules.mk
> > +++ b/xen/Rules.mk
> > @@ -52,6 +52,7 @@ CFLAGS-$(perfc_arrays) += -DPERF_ARRAYS
> > CFLAGS-$(lock_profile) += -DLOCK_PROFILE
> > CFLAGS-$(HAS_ACPI) += -DHAS_ACPI
> > CFLAGS-$(HAS_TMEM) += -DHAS_TMEM
> > +CFLAGS-$(HAS_PASSTHROUGH) += -DHAS_PASSTHROUGH
> > CFLAGS-$(frame_pointer) += -fno-omit-frame-pointer -DCONFIG_FRAME_POINTER
> >
> > ifneq ($(max_phys_cpus),)
> > diff --git a/xen/arch/arm/dummy.S b/xen/arch/arm/dummy.S
> > index 5010619..e858613 100644
> > --- a/xen/arch/arm/dummy.S
> > +++ b/xen/arch/arm/dummy.S
> > @@ -27,8 +27,6 @@ DUMMY(gmfn_to_mfn);
> > DUMMY(gnttab_clear_flag);
> > DUMMY(gnttab_mark_dirty);
> > DUMMY(hypercall_create_continuation);
> > -DUMMY(iommu_map_page);
> > -DUMMY(iommu_unmap_page);
> > DUMMY(is_iomem_page);
> > DUMMY(max_page);
> > DUMMY(node_online_map);
> > diff --git a/xen/common/grant_table.c b/xen/common/grant_table.c
> > index b024016..1798fcd 100644
> > --- a/xen/common/grant_table.c
> > +++ b/xen/common/grant_table.c
> > @@ -434,6 +434,7 @@ static int _set_status(unsigned gt_version,
> > return _set_status_v2(domid, readonly, mapflag, shah, act, status);
> > }
> >
> > +#ifdef HAS_PASSTHROUGH
> > static void mapcount(
> > struct domain *ld, unsigned long mfn,
> > unsigned int *wrc, unsigned int *rdc)
> > @@ -456,6 +457,7 @@ static void mapcount(
> > rcu_unlock_domain(rd);
> > }
> > }
> > +#endif
> >
> > /*
> > * Returns 0 if TLB flush / invalidate required by caller.
> > @@ -662,6 +664,7 @@ __gnttab_map_grant_ref(
> > goto undo_out;
> > }
> >
> > +#ifdef HAS_PASSTHROUGH
> > if ( !is_hvm_domain(ld) && need_iommu(ld) )
>
> Wouldn't #define-ing need_iommu() to 0 in the ARM headers achieve
> the same effect, without cluttering common code?

Yes. I'd thought there were other uses of need_iommu but in fact they
are all in x86.

Ian.



_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xensource.com
http://lists.xensource.com/xen-devel
Re: [PATCH 09/12] xen: only map PV guest grants via iommu if HAS_PASSTHROUGH [ In reply to ]
>>> On 20.01.12 at 13:40, Ian Campbell <Ian.Campbell@citrix.com> wrote:
> On Fri, 2012-01-20 at 12:38 +0000, Jan Beulich wrote:
>> >>> On 20.01.12 at 13:06, Ian Campbell <ian.campbell@citrix.com> wrote:
>> > Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
>> > ---
>> > xen/Rules.mk | 1 +
>> > xen/arch/arm/dummy.S | 2 --
>> > xen/common/grant_table.c | 6 ++++++
>> > 3 files changed, 7 insertions(+), 2 deletions(-)
>> >
>> > diff --git a/xen/Rules.mk b/xen/Rules.mk
>> > index e25e8d4..ce88316 100644
>> > --- a/xen/Rules.mk
>> > +++ b/xen/Rules.mk
>> > @@ -52,6 +52,7 @@ CFLAGS-$(perfc_arrays) += -DPERF_ARRAYS
>> > CFLAGS-$(lock_profile) += -DLOCK_PROFILE
>> > CFLAGS-$(HAS_ACPI) += -DHAS_ACPI
>> > CFLAGS-$(HAS_TMEM) += -DHAS_TMEM
>> > +CFLAGS-$(HAS_PASSTHROUGH) += -DHAS_PASSTHROUGH
>> > CFLAGS-$(frame_pointer) += -fno-omit-frame-pointer -DCONFIG_FRAME_POINTER
>> >
>> > ifneq ($(max_phys_cpus),)
>> > diff --git a/xen/arch/arm/dummy.S b/xen/arch/arm/dummy.S
>> > index 5010619..e858613 100644
>> > --- a/xen/arch/arm/dummy.S
>> > +++ b/xen/arch/arm/dummy.S
>> > @@ -27,8 +27,6 @@ DUMMY(gmfn_to_mfn);
>> > DUMMY(gnttab_clear_flag);
>> > DUMMY(gnttab_mark_dirty);
>> > DUMMY(hypercall_create_continuation);
>> > -DUMMY(iommu_map_page);
>> > -DUMMY(iommu_unmap_page);
>> > DUMMY(is_iomem_page);
>> > DUMMY(max_page);
>> > DUMMY(node_online_map);
>> > diff --git a/xen/common/grant_table.c b/xen/common/grant_table.c
>> > index b024016..1798fcd 100644
>> > --- a/xen/common/grant_table.c
>> > +++ b/xen/common/grant_table.c
>> > @@ -434,6 +434,7 @@ static int _set_status(unsigned gt_version,
>> > return _set_status_v2(domid, readonly, mapflag, shah, act,
> status);
>> > }
>> >
>> > +#ifdef HAS_PASSTHROUGH
>> > static void mapcount(
>> > struct domain *ld, unsigned long mfn,
>> > unsigned int *wrc, unsigned int *rdc)
>> > @@ -456,6 +457,7 @@ static void mapcount(
>> > rcu_unlock_domain(rd);
>> > }
>> > }
>> > +#endif
>> >
>> > /*
>> > * Returns 0 if TLB flush / invalidate required by caller.
>> > @@ -662,6 +664,7 @@ __gnttab_map_grant_ref(
>> > goto undo_out;
>> > }
>> >
>> > +#ifdef HAS_PASSTHROUGH
>> > if ( !is_hvm_domain(ld) && need_iommu(ld) )
>>
>> Wouldn't #define-ing need_iommu() to 0 in the ARM headers achieve
>> the same effect, without cluttering common code?
>
> Yes. I'd thought there were other uses of need_iommu but in fact they
> are all in x86.

And even if there were, you'd want them to resolve to 0 too until you
have an IOMMU implementation.

Jan


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