Skip to contentSkip to conversation

x86/hvm: Unify hvm_event_pending()'s API with the !CONFIG_HVM version

PATCH In review Andrew Cooper 5 participants 7 messages Nov 9, 2018 – Nov 14, 2018

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 x86/hvm: Unify hvm_event_pending()'s API with the !CONFIG_HVM version

No functional change.

---
CC: Jan Beulich <[email protected]>
CC: Wei Liu <[email protected]>
CC: Jun Nakajima <[email protected]>
CC: Kevin Tian <[email protected]>
CC: Boris Ostrovsky <[email protected]>
CC: Suravee Suthikulpanit <[email protected]>
CC: Brian Woods <[email protected]>

---
 xen/arch/x86/hvm/svm/svm.c    | 5 ++---
 xen/arch/x86/hvm/vmx/vmx.c    | 2 +-
 xen/include/asm-x86/hvm/hvm.h | 4 ++--
 3 files changed, 5 insertions(+), 6 deletions(-)
xen/arch/x86/hvm/svm/svm.c +2 -3
index 07a5ed8..396ee4a 100644
@@ -1581,10 +1581,9 @@ static void svm_inject_event(const struct x86_event *event)
         HVMTRACE_2D(INJ_EXC, _event.vector, _event.error_code);
 }
 
-static int svm_event_pending(struct vcpu *v)
+static bool svm_event_pending(const struct vcpu *v)
 {
-    struct vmcb_struct *vmcb = v->arch.hvm.svm.vmcb;
-    return vmcb->eventinj.fields.v;
+    return v->arch.hvm.svm.vmcb->eventinj.fields.v;
 }
 
 static void svm_cpu_dead(unsigned int cpu)
xen/arch/x86/hvm/vmx/vmx.c +1 -1
index e065f8b..365eeb2 100644
@@ -1903,7 +1903,7 @@ static void vmx_inject_event(const struct x86_event *event)
         HVMTRACE_2D(INJ_EXC, _event.vector, _event.error_code);
 }
 
-static int vmx_event_pending(struct vcpu *v)
+static bool vmx_event_pending(const struct vcpu *v)
 {
     unsigned long intr_info;
 
xen/include/asm-x86/hvm/hvm.h +2 -2
index 2a1acd8..3d3250d 100644
@@ -158,7 +158,7 @@ struct hvm_function_table {
 
     void (*init_hypercall_page)(struct domain *d, void *hypercall_page);
 
-    int  (*event_pending)(struct vcpu *v);
+    bool (*event_pending)(const struct vcpu *v);
     bool (*get_pending_event)(struct vcpu *v, struct x86_event *info);
     void (*invlpg)(struct vcpu *v, unsigned long linear);
 
@@ -507,7 +507,7 @@ static inline void hvm_inject_page_fault(int errcode, unsigned long cr2)
     hvm_inject_event(&event);
 }
 
-static inline int hvm_event_pending(struct vcpu *v)
+static inline bool hvm_event_pending(const struct vcpu *v)
 {
     return hvm_funcs.event_pending(v);
 }
Signature · 7 lines
2.1.4


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Reviewed-by on v1 1/1
#2 lore raw
In reply to Andrew Cooper
Quoted 12 lines · Andrew Cooper

No functional change.

---
CC: Jan Beulich <[email protected]>
CC: Wei Liu <[email protected]>
CC: Jun Nakajima <[email protected]>
CC: Kevin Tian <[email protected]>
CC: Boris Ostrovsky <[email protected]>
CC: Suravee Suthikulpanit <[email protected]>
CC: Brian Woods <[email protected]>
---

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel

Acked-by on v1 1/1
#3 lore raw
In reply to Andrew Cooper
Quoted 2 lines
Quoted 1 line
Quoted 1 line · On 09.11.18 at 15:42, <[email protected]> wrote:

No functional change.

So I understand that "unify" means converting the return type to bool. You could have said so.

Quoted 1 line

Jan

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel

#4 lore raw
Quoted 4 lines · Jan Beulich
Quoted 2 lines
Quoted 1 line
Quoted 1 line · On 09.11.18 at 15:42, <[email protected]> wrote:

No functional change.

So I understand that "unify" means converting the return type to bool. You could have said so.

Perhaps, but that misses the point of making the change.

The patch introducing the !CONFIG_HVM version should have used int/non-const so the API was same, or had this patch as a prerequisite to update the API to our new standards, and then duplicate it for the !CONFIG_HVM case.

~Andrew

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel

#5 lore raw
Quoted 7 lines
Quoted 1 line
Quoted 1 line · On 12.11.18 at 11:07, <[email protected]> wrote:
Quoted 4 lines · Jan Beulich
Quoted 2 lines
Quoted 1 line
Quoted 1 line · On 09.11.18 at 15:42, <[email protected]> wrote:

No functional change.

So I understand that "unify" means converting the return type to bool. You could have said so.

Quoted 6 lines

Perhaps, but that misses the point of making the change.

The patch introducing the !CONFIG_HVM version should have used int/non-const so the API was same, or had this patch as a prerequisite to update the API to our new standards, and then duplicate it for the !CONFIG_HVM case.

All fine, just that it would have been nice if the description here said slightly more than just "No functional change."

Jan

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel