From mboxrd@z Thu Jan 1 00:00:00 1970 From: Andrew Cooper Subject: Re: [PATCH v3 3/3] x86/vlapic: a few type adjustments Date: Mon, 15 Sep 2014 16:15:24 +0100 Message-ID: <5417028C.5030400@citrix.com> References: <5413077902000078000347F7@mail.emea.novell.com> <54130909020000780003480A@mail.emea.novell.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============4009872950530731009==" Return-path: Received: from mail6.bemta5.messagelabs.com ([195.245.231.135]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1XTY1g-0007OZ-6A for xen-devel@lists.xenproject.org; Mon, 15 Sep 2014 15:17:12 +0000 In-Reply-To: <54130909020000780003480A@mail.emea.novell.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Jan Beulich , xen-devel Cc: Keir Fraser List-Id: xen-devel@lists.xenproject.org This is a multi-part message in MIME format. --===============4009872950530731009== Content-Type: multipart/alternative; boundary="------------020306040404050501030207" This is a multi-part message in MIME format. --------------020306040404050501030207 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit On 12/09/2014 13:54, Jan Beulich wrote: > Constify a couple of pointer parameters, convert a boolean function > return type to bool_t, and clean up a printk() being touched anyway. > > Suggested-by: Andrew Cooper > Signed-off-by: Jan Beulich Reviewed-by: Andrew Cooper > > --- a/xen/arch/x86/hvm/vlapic.c > +++ b/xen/arch/x86/hvm/vlapic.c > @@ -173,9 +173,9 @@ uint32_t vlapic_set_ppr(struct vlapic *v > return ppr; > } > > -static int vlapic_match_logical_addr(struct vlapic *vlapic, uint32_t mda) > +static bool_t vlapic_match_logical_addr(const struct vlapic *vlapic, uint32_t mda) > { > - int result = 0; > + bool_t result = 0; > uint32_t logical_id = vlapic_get_reg(vlapic, APIC_LDR); > > if ( vlapic_x2apic_mode(vlapic) ) > @@ -196,9 +196,9 @@ static int vlapic_match_logical_addr(str > result = 1; > break; > default: > - gdprintk(XENLOG_WARNING, "Bad DFR value for lapic of vcpu %d: %08x\n", > - vlapic_vcpu(vlapic)->vcpu_id, > - vlapic_get_reg(vlapic, APIC_DFR)); > + printk(XENLOG_G_WARNING "%pv: bad LAPIC DFR value %08x\n", > + const_vlapic_vcpu(vlapic), > + vlapic_get_reg(vlapic, APIC_DFR)); > break; > } > > @@ -206,7 +206,7 @@ static int vlapic_match_logical_addr(str > } > > bool_t vlapic_match_dest( > - struct vlapic *target, const struct vlapic *source, > + const struct vlapic *target, const struct vlapic *source, > int short_hand, uint32_t dest, bool_t dest_mode) > { > HVM_DBG_LOG(DBG_LEVEL_VLAPIC, "target %p, source %p, dest %#x, " > --- a/xen/include/asm-x86/hvm/vlapic.h > +++ b/xen/include/asm-x86/hvm/vlapic.h > @@ -28,6 +28,8 @@ > > #define vcpu_vlapic(x) (&(x)->arch.hvm_vcpu.vlapic) > #define vlapic_vcpu(x) (container_of((x), struct vcpu, arch.hvm_vcpu.vlapic)) > +#define const_vlapic_vcpu(x) (container_of((x), const struct vcpu, \ > + arch.hvm_vcpu.vlapic)) > #define vlapic_domain(x) (vlapic_vcpu(x)->domain) > > #define _VLAPIC_ID(vlapic, id) (vlapic_x2apic_mode(vlapic) \ > @@ -85,7 +87,8 @@ struct vlapic { > /* vlapic's frequence is 100 MHz */ > #define APIC_BUS_CYCLE_NS 10 > > -static inline uint32_t vlapic_get_reg(struct vlapic *vlapic, uint32_t reg) > +static inline uint32_t vlapic_get_reg(const struct vlapic *vlapic, > + uint32_t reg) > { > return *((uint32_t *)(&vlapic->regs->data[reg])); > } > @@ -129,7 +132,7 @@ struct vlapic *vlapic_lowest_prio( > int short_hand, uint32_t dest, bool_t dest_mode); > > bool_t vlapic_match_dest( > - struct vlapic *target, const struct vlapic *source, > + const struct vlapic *target, const struct vlapic *source, > int short_hand, uint32_t dest, bool_t dest_mode); > > void vlapic_domain_unpause(const struct domain *); > > > > > > _______________________________________________ > Xen-devel mailing list > Xen-devel@lists.xen.org > http://lists.xen.org/xen-devel --------------020306040404050501030207 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit On 12/09/2014 13:54, Jan Beulich wrote:
Constify a couple of pointer parameters, convert a boolean function
return type to bool_t, and clean up a printk() being touched anyway.

Suggested-by: Andrew Cooper <andrew.cooper3@citrix.com>
Signed-off-by: Jan Beulich <jbeulich@suse.com>

Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>


--- a/xen/arch/x86/hvm/vlapic.c
+++ b/xen/arch/x86/hvm/vlapic.c
@@ -173,9 +173,9 @@ uint32_t vlapic_set_ppr(struct vlapic *v
    return ppr;
 }
 
-static int vlapic_match_logical_addr(struct vlapic *vlapic, uint32_t mda)
+static bool_t vlapic_match_logical_addr(const struct vlapic *vlapic, uint32_t mda)
 {
-    int result = 0;
+    bool_t result = 0;
     uint32_t logical_id = vlapic_get_reg(vlapic, APIC_LDR);
 
     if ( vlapic_x2apic_mode(vlapic) )
@@ -196,9 +196,9 @@ static int vlapic_match_logical_addr(str
             result = 1;
         break;
     default:
-        gdprintk(XENLOG_WARNING, "Bad DFR value for lapic of vcpu %d: %08x\n",
-                 vlapic_vcpu(vlapic)->vcpu_id,
-                 vlapic_get_reg(vlapic, APIC_DFR));
+        printk(XENLOG_G_WARNING "%pv: bad LAPIC DFR value %08x\n",
+               const_vlapic_vcpu(vlapic),
+               vlapic_get_reg(vlapic, APIC_DFR));
         break;
     }
 
@@ -206,7 +206,7 @@ static int vlapic_match_logical_addr(str
 }
 
 bool_t vlapic_match_dest(
-    struct vlapic *target, const struct vlapic *source,
+    const struct vlapic *target, const struct vlapic *source,
     int short_hand, uint32_t dest, bool_t dest_mode)
 {
     HVM_DBG_LOG(DBG_LEVEL_VLAPIC, "target %p, source %p, dest %#x, "
--- a/xen/include/asm-x86/hvm/vlapic.h
+++ b/xen/include/asm-x86/hvm/vlapic.h
@@ -28,6 +28,8 @@
 
 #define vcpu_vlapic(x)   (&(x)->arch.hvm_vcpu.vlapic)
 #define vlapic_vcpu(x)   (container_of((x), struct vcpu, arch.hvm_vcpu.vlapic))
+#define const_vlapic_vcpu(x) (container_of((x), const struct vcpu, \
+                              arch.hvm_vcpu.vlapic))
 #define vlapic_domain(x) (vlapic_vcpu(x)->domain)
 
 #define _VLAPIC_ID(vlapic, id) (vlapic_x2apic_mode(vlapic) \
@@ -85,7 +87,8 @@ struct vlapic {
 /* vlapic's frequence is 100 MHz */
 #define APIC_BUS_CYCLE_NS               10
 
-static inline uint32_t vlapic_get_reg(struct vlapic *vlapic, uint32_t reg)
+static inline uint32_t vlapic_get_reg(const struct vlapic *vlapic,
+                                      uint32_t reg)
 {
     return *((uint32_t *)(&vlapic->regs->data[reg]));
 }
@@ -129,7 +132,7 @@ struct vlapic *vlapic_lowest_prio(
     int short_hand, uint32_t dest, bool_t dest_mode);
 
 bool_t vlapic_match_dest(
-    struct vlapic *target, const struct vlapic *source,
+    const struct vlapic *target, const struct vlapic *source,
     int short_hand, uint32_t dest, bool_t dest_mode);
 
 void vlapic_domain_unpause(const struct domain *);





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

--------------020306040404050501030207-- --===============4009872950530731009== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Xen-devel mailing list Xen-devel@lists.xen.org http://lists.xen.org/xen-devel --===============4009872950530731009==--