All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] xen: move PIRQ EOI map fields to arch_domain
@ 2014-04-08 10:33 Roger Pau Monne
  2014-04-08 11:33 ` Jan Beulich
  0 siblings, 1 reply; 6+ messages in thread
From: Roger Pau Monne @ 2014-04-08 10:33 UTC (permalink / raw)
  To: xen-devel; +Cc: Keir Fraser, Jan Beulich, Roger Pau Monne

This is done so PVH guests can use PHYSDEVOP_pirq_eoi_gmfn_v{1/2}.
Update users of this fields, to reflect that this has been moved and
it is now also available to other kind of guests.

Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
Cc: Mukesh Rathor <mukesh.rathor@oracle.com>
Cc: Jan Beulich <jbeulich@suse.com>
Cc: Keir Fraser <keir@xen.org>
---
This patch is on top of Mukesh PVH Dom0 v8 series, if Mukesh is OK I
don't mind folding it inside of the series.
---
 xen/arch/x86/domain.c        |   15 +++++++--------
 xen/arch/x86/irq.c           |    8 ++++----
 xen/arch/x86/physdev.c       |   13 ++++++-------
 xen/include/asm-x86/domain.h |   14 +++++++-------
 4 files changed, 24 insertions(+), 26 deletions(-)

diff --git a/xen/arch/x86/domain.c b/xen/arch/x86/domain.c
index 0d563de..d624105 100644
--- a/xen/arch/x86/domain.c
+++ b/xen/arch/x86/domain.c
@@ -1909,15 +1909,14 @@ int domain_relinquish_resources(struct domain *d)
                  */
                 destroy_gdt(v);
             }
+        }
 
-            if ( d->arch.pv_domain.pirq_eoi_map != NULL )
-            {
-                unmap_domain_page_global(d->arch.pv_domain.pirq_eoi_map);
-                put_page_and_type(
-                    mfn_to_page(d->arch.pv_domain.pirq_eoi_map_mfn));
-                d->arch.pv_domain.pirq_eoi_map = NULL;
-                d->arch.pv_domain.auto_unmask = 0;
-            }
+        if ( d->arch.pirq_eoi_map != NULL )
+        {
+            unmap_domain_page_global(d->arch.pirq_eoi_map);
+            put_page_and_type(mfn_to_page(d->arch.pirq_eoi_map_mfn));
+            d->arch.pirq_eoi_map = NULL;
+            d->arch.auto_unmask = 0;
         }
 
         d->arch.relmem = RELMEM_shared;
diff --git a/xen/arch/x86/irq.c b/xen/arch/x86/irq.c
index 88444be..60b1a506 100644
--- a/xen/arch/x86/irq.c
+++ b/xen/arch/x86/irq.c
@@ -1068,14 +1068,14 @@ bool_t cpu_has_pending_apic_eoi(void)
 
 static inline void set_pirq_eoi(struct domain *d, unsigned int irq)
 {
-    if ( is_pv_domain(d) && d->arch.pv_domain.pirq_eoi_map )
-        set_bit(irq, d->arch.pv_domain.pirq_eoi_map);
+    if ( d->arch.pirq_eoi_map )
+        set_bit(irq, d->arch.pirq_eoi_map);
 }
 
 static inline void clear_pirq_eoi(struct domain *d, unsigned int irq)
 {
-    if ( is_pv_domain(d) && d->arch.pv_domain.pirq_eoi_map )
-        clear_bit(irq, d->arch.pv_domain.pirq_eoi_map);
+    if ( d->arch.pirq_eoi_map )
+        clear_bit(irq, d->arch.pirq_eoi_map);
 }
 
 static void set_eoi_ready(void *data);
diff --git a/xen/arch/x86/physdev.c b/xen/arch/x86/physdev.c
index bc0634c..f178315 100644
--- a/xen/arch/x86/physdev.c
+++ b/xen/arch/x86/physdev.c
@@ -310,8 +310,7 @@ ret_t do_physdev_op(int cmd, XEN_GUEST_HANDLE_PARAM(void) arg)
             spin_unlock(&v->domain->event_lock);
             break;
         }
-        if ( is_pv_domain(v->domain) &&
-             v->domain->arch.pv_domain.auto_unmask )
+        if ( v->domain->arch.auto_unmask )
             evtchn_unmask(pirq->evtchn);
         if ( is_pv_domain(v->domain) ||
              domain_pirq_to_irq(v->domain, eoi.irq) > 0 )
@@ -354,7 +353,7 @@ ret_t do_physdev_op(int cmd, XEN_GUEST_HANDLE_PARAM(void) arg)
         }
         mfn = page_to_mfn(page);
 
-        if ( cmpxchg(&v->domain->arch.pv_domain.pirq_eoi_map_mfn,
+        if ( cmpxchg(&v->domain->arch.pirq_eoi_map_mfn,
                      0, mfn) != 0 )
         {
             put_page_and_type(mfn_to_page(mfn));
@@ -362,16 +361,16 @@ ret_t do_physdev_op(int cmd, XEN_GUEST_HANDLE_PARAM(void) arg)
             break;
         }
 
-        v->domain->arch.pv_domain.pirq_eoi_map = map_domain_page_global(mfn);
-        if ( v->domain->arch.pv_domain.pirq_eoi_map == NULL )
+        v->domain->arch.pirq_eoi_map = map_domain_page_global(mfn);
+        if ( v->domain->arch.pirq_eoi_map == NULL )
         {
-            v->domain->arch.pv_domain.pirq_eoi_map_mfn = 0;
+            v->domain->arch.pirq_eoi_map_mfn = 0;
             put_page_and_type(mfn_to_page(mfn));
             ret = -ENOSPC;
             break;
         }
         if ( cmd == PHYSDEVOP_pirq_eoi_gmfn_v1 )
-            v->domain->arch.pv_domain.auto_unmask = 1;
+            v->domain->arch.auto_unmask = 1;
 
         ret = 0;
         break;
diff --git a/xen/include/asm-x86/domain.h b/xen/include/asm-x86/domain.h
index 4ff89f0..1524b5f 100644
--- a/xen/include/asm-x86/domain.h
+++ b/xen/include/asm-x86/domain.h
@@ -225,13 +225,6 @@ struct pv_domain
 {
     l1_pgentry_t **gdt_ldt_l1tab;
 
-    /* Shared page for notifying that explicit PIRQ EOI is required. */
-    unsigned long *pirq_eoi_map;
-    unsigned long pirq_eoi_map_mfn;
-    /* set auto_unmask to 1 if you want PHYSDEVOP_eoi to automatically
-     * unmask the event channel */
-    bool_t auto_unmask;
-
     /* map_domain_page() mapping cache. */
     struct mapcache_domain mapcache;
 };
@@ -313,6 +306,13 @@ struct arch_domain
     spinlock_t e820_lock;
     struct e820entry *e820;
     unsigned int nr_e820;
+
+    /* Shared page for notifying that explicit PIRQ EOI is required. */
+    unsigned long *pirq_eoi_map;
+    unsigned long pirq_eoi_map_mfn;
+    /* set auto_unmask to 1 if you want PHYSDEVOP_eoi to automatically
+     * unmask the event channel */
+    bool_t auto_unmask;
 } __cacheline_aligned;
 
 #define has_arch_pdevs(d)    (!list_empty(&(d)->arch.pdev_list))
-- 
1.7.7.5 (Apple Git-26)


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

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH] xen: move PIRQ EOI map fields to arch_domain
  2014-04-08 10:33 [PATCH] xen: move PIRQ EOI map fields to arch_domain Roger Pau Monne
@ 2014-04-08 11:33 ` Jan Beulich
  2014-04-08 12:16   ` Roger Pau Monné
  0 siblings, 1 reply; 6+ messages in thread
From: Jan Beulich @ 2014-04-08 11:33 UTC (permalink / raw)
  To: Roger Pau Monne; +Cc: xen-devel, Keir Fraser

>>> On 08.04.14 at 12:33, <roger.pau@citrix.com> wrote:
> @@ -354,7 +353,7 @@ ret_t do_physdev_op(int cmd, XEN_GUEST_HANDLE_PARAM(void) arg)
>          }
>          mfn = page_to_mfn(page);
>  
> -        if ( cmpxchg(&v->domain->arch.pv_domain.pirq_eoi_map_mfn,
> +        if ( cmpxchg(&v->domain->arch.pirq_eoi_map_mfn,

In order to get here you also need to modify hvm_physdev_op().

Jan

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] xen: move PIRQ EOI map fields to arch_domain
  2014-04-08 11:33 ` Jan Beulich
@ 2014-04-08 12:16   ` Roger Pau Monné
  2014-04-08 13:01     ` Jan Beulich
  0 siblings, 1 reply; 6+ messages in thread
From: Roger Pau Monné @ 2014-04-08 12:16 UTC (permalink / raw)
  To: Jan Beulich; +Cc: xen-devel, Keir Fraser

On 08/04/14 13:33, Jan Beulich wrote:
>>>> On 08.04.14 at 12:33, <roger.pau@citrix.com> wrote:
>> @@ -354,7 +353,7 @@ ret_t do_physdev_op(int cmd, XEN_GUEST_HANDLE_PARAM(void) arg)
>>          }
>>          mfn = page_to_mfn(page);
>>  
>> -        if ( cmpxchg(&v->domain->arch.pv_domain.pirq_eoi_map_mfn,
>> +        if ( cmpxchg(&v->domain->arch.pirq_eoi_map_mfn,
> 
> In order to get here you also need to modify hvm_physdev_op().

This is on top of Mukesh PVH Dom0 v8 series (as stated on the 
description), which has the following in hvm_physdev_op:

static long hvm_physdev_op(int cmd, XEN_GUEST_HANDLE_PARAM(void) arg)
{
    switch ( cmd )
    {
    default:
        if ( !is_pvh_vcpu(current) || !is_hardware_domain(current->domain) )
            return -ENOSYS;
        /* fall through */
    case PHYSDEVOP_map_pirq:
    case PHYSDEVOP_unmap_pirq:
    case PHYSDEVOP_eoi:
    case PHYSDEVOP_irq_status_query:
    case PHYSDEVOP_get_free_pirq:
        return do_physdev_op(cmd, arg);
    }
}

Thus allowing PVH Dom0 to use any PHYSDEVOP_*

Roger.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] xen: move PIRQ EOI map fields to arch_domain
  2014-04-08 12:16   ` Roger Pau Monné
@ 2014-04-08 13:01     ` Jan Beulich
  2014-04-08 13:58       ` Roger Pau Monné
  0 siblings, 1 reply; 6+ messages in thread
From: Jan Beulich @ 2014-04-08 13:01 UTC (permalink / raw)
  To: Roger Pau Monné; +Cc: xen-devel, Keir Fraser

>>> On 08.04.14 at 14:16, <roger.pau@citrix.com> wrote:
> On 08/04/14 13:33, Jan Beulich wrote:
>>>>> On 08.04.14 at 12:33, <roger.pau@citrix.com> wrote:
>>> @@ -354,7 +353,7 @@ ret_t do_physdev_op(int cmd, XEN_GUEST_HANDLE_PARAM(void) 
> arg)
>>>          }
>>>          mfn = page_to_mfn(page);
>>>  
>>> -        if ( cmpxchg(&v->domain->arch.pv_domain.pirq_eoi_map_mfn,
>>> +        if ( cmpxchg(&v->domain->arch.pirq_eoi_map_mfn,
>> 
>> In order to get here you also need to modify hvm_physdev_op().
> 
> This is on top of Mukesh PVH Dom0 v8 series (as stated on the 
> description), which has the following in hvm_physdev_op:
> 
> static long hvm_physdev_op(int cmd, XEN_GUEST_HANDLE_PARAM(void) arg)
> {
>     switch ( cmd )
>     {
>     default:
>         if ( !is_pvh_vcpu(current) || !is_hardware_domain(current->domain) )
>             return -ENOSYS;
>         /* fall through */
>     case PHYSDEVOP_map_pirq:
>     case PHYSDEVOP_unmap_pirq:
>     case PHYSDEVOP_eoi:
>     case PHYSDEVOP_irq_status_query:
>     case PHYSDEVOP_get_free_pirq:
>         return do_physdev_op(cmd, arg);
>     }
> }

I don't recall that series to include a revert of a7ca5c40 ("x86/pvh:
disallow PHYSDEVOP_pirq_eoi_gmfn_v2/v1"), and if it did it would
be wrong, as then it would have to already include the changes you
are doing here.

Jan

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] xen: move PIRQ EOI map fields to arch_domain
  2014-04-08 13:01     ` Jan Beulich
@ 2014-04-08 13:58       ` Roger Pau Monné
  2014-04-08 14:04         ` Jan Beulich
  0 siblings, 1 reply; 6+ messages in thread
From: Roger Pau Monné @ 2014-04-08 13:58 UTC (permalink / raw)
  To: Jan Beulich; +Cc: xen-devel, Keir Fraser

On 08/04/14 15:01, Jan Beulich wrote:
>>>> On 08.04.14 at 14:16, <roger.pau@citrix.com> wrote:
>> On 08/04/14 13:33, Jan Beulich wrote:
>>>>>> On 08.04.14 at 12:33, <roger.pau@citrix.com> wrote:
>>>> @@ -354,7 +353,7 @@ ret_t do_physdev_op(int cmd, XEN_GUEST_HANDLE_PARAM(void) 
>> arg)
>>>>          }
>>>>          mfn = page_to_mfn(page);
>>>>  
>>>> -        if ( cmpxchg(&v->domain->arch.pv_domain.pirq_eoi_map_mfn,
>>>> +        if ( cmpxchg(&v->domain->arch.pirq_eoi_map_mfn,
>>>
>>> In order to get here you also need to modify hvm_physdev_op().
>>
>> This is on top of Mukesh PVH Dom0 v8 series (as stated on the 
>> description), which has the following in hvm_physdev_op:
>>
>> static long hvm_physdev_op(int cmd, XEN_GUEST_HANDLE_PARAM(void) arg)
>> {
>>     switch ( cmd )
>>     {
>>     default:
>>         if ( !is_pvh_vcpu(current) || !is_hardware_domain(current->domain) )
>>             return -ENOSYS;
>>         /* fall through */
>>     case PHYSDEVOP_map_pirq:
>>     case PHYSDEVOP_unmap_pirq:
>>     case PHYSDEVOP_eoi:
>>     case PHYSDEVOP_irq_status_query:
>>     case PHYSDEVOP_get_free_pirq:
>>         return do_physdev_op(cmd, arg);
>>     }
>> }
> 
> I don't recall that series to include a revert of a7ca5c40 ("x86/pvh:
> disallow PHYSDEVOP_pirq_eoi_gmfn_v2/v1"), and if it did it would
> be wrong, as then it would have to already include the changes you
> are doing here.

OK, now I see it, Mukesh Dom0 PVH v8 series is based on top of
b3c0519e019de3fcd993913ab48c327daec35115, which is previous to your
commit of a7ca5c40:

https://oss.oracle.com/git/?p=mrathor/xen.git;a=shortlog;h=dom0pvh-v8

Will rebase on top of unstable and post a v2, do you have any other
comments related to the patch that I should fix before posting v2?

Roger.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] xen: move PIRQ EOI map fields to arch_domain
  2014-04-08 13:58       ` Roger Pau Monné
@ 2014-04-08 14:04         ` Jan Beulich
  0 siblings, 0 replies; 6+ messages in thread
From: Jan Beulich @ 2014-04-08 14:04 UTC (permalink / raw)
  To: Roger Pau Monné; +Cc: xen-devel, Keir Fraser

>>> On 08.04.14 at 15:58, <roger.pau@citrix.com> wrote:
> On 08/04/14 15:01, Jan Beulich wrote:
>>>>> On 08.04.14 at 14:16, <roger.pau@citrix.com> wrote:
>>> On 08/04/14 13:33, Jan Beulich wrote:
>>>>>>> On 08.04.14 at 12:33, <roger.pau@citrix.com> wrote:
>>>>> @@ -354,7 +353,7 @@ ret_t do_physdev_op(int cmd, XEN_GUEST_HANDLE_PARAM(void) 
> 
>>> arg)
>>>>>          }
>>>>>          mfn = page_to_mfn(page);
>>>>>  
>>>>> -        if ( cmpxchg(&v->domain->arch.pv_domain.pirq_eoi_map_mfn,
>>>>> +        if ( cmpxchg(&v->domain->arch.pirq_eoi_map_mfn,
>>>>
>>>> In order to get here you also need to modify hvm_physdev_op().
>>>
>>> This is on top of Mukesh PVH Dom0 v8 series (as stated on the 
>>> description), which has the following in hvm_physdev_op:
>>>
>>> static long hvm_physdev_op(int cmd, XEN_GUEST_HANDLE_PARAM(void) arg)
>>> {
>>>     switch ( cmd )
>>>     {
>>>     default:
>>>         if ( !is_pvh_vcpu(current) || !is_hardware_domain(current->domain) )
>>>             return -ENOSYS;
>>>         /* fall through */
>>>     case PHYSDEVOP_map_pirq:
>>>     case PHYSDEVOP_unmap_pirq:
>>>     case PHYSDEVOP_eoi:
>>>     case PHYSDEVOP_irq_status_query:
>>>     case PHYSDEVOP_get_free_pirq:
>>>         return do_physdev_op(cmd, arg);
>>>     }
>>> }
>> 
>> I don't recall that series to include a revert of a7ca5c40 ("x86/pvh:
>> disallow PHYSDEVOP_pirq_eoi_gmfn_v2/v1"), and if it did it would
>> be wrong, as then it would have to already include the changes you
>> are doing here.
> 
> OK, now I see it, Mukesh Dom0 PVH v8 series is based on top of
> b3c0519e019de3fcd993913ab48c327daec35115, which is previous to your
> commit of a7ca5c40:
> 
> https://oss.oracle.com/git/?p=mrathor/xen.git;a=shortlog;h=dom0pvh-v8 
> 
> Will rebase on top of unstable and post a v2, do you have any other
> comments related to the patch that I should fix before posting v2?

No - everything else looked like the expected adjustments and reverts.

Jan

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2014-04-08 14:04 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-04-08 10:33 [PATCH] xen: move PIRQ EOI map fields to arch_domain Roger Pau Monne
2014-04-08 11:33 ` Jan Beulich
2014-04-08 12:16   ` Roger Pau Monné
2014-04-08 13:01     ` Jan Beulich
2014-04-08 13:58       ` Roger Pau Monné
2014-04-08 14:04         ` Jan Beulich

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.