Skip to contentSkip to conversation

x86/hvm: switch some open-coded dpci access to use the provided macro

PATCH In review Roger Pau Monne 2 participants 4 messages Mar 21, 2017 – Mar 22, 2017

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 x86/hvm: switch some open-coded dpci access to use the provided macro

No functional change.

---
Cc: Jan Beulich <[email protected]>
Cc: Andrew Cooper <[email protected]>

---
 xen/arch/x86/hvm/hvm.c       | 2 +-
 xen/drivers/passthrough/io.c | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)
xen/arch/x86/hvm/hvm.c +1 -1
index 0282986738..0d8c574f4d 100644
@@ -457,7 +457,7 @@ void hvm_migrate_pirqs(struct vcpu *v)
 {
     struct domain *d = v->domain;
 
-    if ( !iommu_enabled || !d->arch.hvm_domain.irq.dpci )
+    if ( !iommu_enabled || !domain_get_irq_dpci(d) )
        return;
 
     spin_lock(&d->event_lock);
xen/drivers/passthrough/io.c +2 -2
index 080183ea31..ce5c9b90d2 100644
@@ -788,7 +788,7 @@ static int _hvm_dpci_msi_eoi(struct domain *d,
 
 void hvm_dpci_msi_eoi(struct domain *d, int vector)
 {
-    if ( !iommu_enabled || !d->arch.hvm_domain.irq.dpci )
+    if ( !iommu_enabled || !domain_get_irq_dpci(d) )
        return;
 
     spin_lock(&d->event_lock);
@@ -798,7 +798,7 @@ void hvm_dpci_msi_eoi(struct domain *d, int vector)
 
 static void hvm_dirq_assist(struct domain *d, struct hvm_pirq_dpci *pirq_dpci)
 {
-    if ( unlikely(!d->arch.hvm_domain.irq.dpci) )
+    if ( unlikely(!domain_get_irq_dpci(d)) )
     {
         ASSERT_UNREACHABLE();
         return;
Signature · 7 lines
2.12.0


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
#1 lore raw
Quoted 2 lines
Quoted 1 line
Quoted 1 line · On 21.03.17 at 16:41, <[email protected]> wrote:

No functional change.

The reason it's done the original way is, I guess, that - other than your title suggests - this is not a macro, and not even an inline function. In cases where the two checks the function does aren't needed, I think it is reasonable to avoid the call.

Jan

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

#2 lore raw
Quoted 7 lines · Jan Beulich
Quoted 2 lines
Quoted 1 line
Quoted 1 line · On 21.03.17 at 16:41, <[email protected]> wrote:

No functional change.

The reason it's done the original way is, I guess, that - other than your title suggests - this is not a macro, and not even an inline function. In cases where the two checks the function does aren't needed, I think it is reasonable to avoid the call.

Right, seems like I got confused with another helper. Would you like me to make that an inline function, or just leave it as-is?

The function includes an extra is_hvm_domain check, so I guess it's better to leave it as-is for those paths.

Roger.

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

#3 lore raw
Quoted 5 lines
Quoted 1 line
Quoted 1 line · On 22.03.17 at 13:49, <[email protected]> wrote:
Quoted 3 lines · Jan Beulich
Quoted 2 lines
Quoted 1 line
Quoted 1 line · On 21.03.17 at 16:41, <[email protected]> wrote:

No functional change.

Quoted 7 lines
Quoted 4 lines

The reason it's done the original way is, I guess, that - other than your title suggests - this is not a macro, and not even an inline function. In cases where the two checks the function does aren't needed, I think it is reasonable to avoid the call.

Right, seems like I got confused with another helper. Would you like me to make that an inline function, or just leave it as-is?

With this ...

Quoted 2 lines

The function includes an extra is_hvm_domain check, so I guess it's better to leave it as-is for those paths.

... I'm not really certain what meaning I should assign to "leave it as is". As long as none of the places you patch changed actively lack either of the two extra checks, I'd prefer for the patch to simply be dropped.

Jan

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