From: "Jan Beulich" Subject: [PATCH v3 3/3] x86/vlapic: a few type adjustments Date: Fri, 12 Sep 2014 13:54:01 +0100 Message-ID: <54130909020000780003480A@mail.emea.novell.com> References: <5413077902000078000347F7@mail.emea.novell.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=__Part3B0E70F9.0__=" Return-path: Received: from mail6.bemta14.messagelabs.com ([193.109.254.103]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1XSQMV-0003e5-3b for xen-devel@lists.xenproject.org; Fri, 12 Sep 2014 12:54:03 +0000 In-Reply-To: <5413077902000078000347F7@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: xen-devel Cc: Keir Fraser List-Id: xen-devel@lists.xenproject.org This is a MIME message. If you are reading this text, you may want to consider changing to a mail reader or gateway that understands how to properly handle MIME multipart messages. --=__Part3B0E70F9.0__= Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable Content-Disposition: inline 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 --- 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; } =20 -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 =3D 0; + bool_t result =3D 0; uint32_t logical_id =3D vlapic_get_reg(vlapic, APIC_LDR); =20 if ( vlapic_x2apic_mode(vlapic) ) @@ -196,9 +196,9 @@ static int vlapic_match_logical_addr(str result =3D 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; } =20 @@ -206,7 +206,7 @@ static int vlapic_match_logical_addr(str } =20 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 @@ =20 #define vcpu_vlapic(x) (&(x)->arch.hvm_vcpu.vlapic) #define vlapic_vcpu(x) (container_of((x), struct vcpu, arch.hvm_vcpu.vla= pic)) +#define const_vlapic_vcpu(x) (container_of((x), const struct vcpu, \ + arch.hvm_vcpu.vlapic)) #define vlapic_domain(x) (vlapic_vcpu(x)->domain) =20 #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 =20 -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); =20 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); =20 void vlapic_domain_unpause(const struct domain *); --=__Part3B0E70F9.0__= Content-Type: text/plain; name="x86-HVM-x2APIC-types.patch" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="x86-HVM-x2APIC-types.patch" x86/vlapic: a few type adjustments=0A=0AConstify a couple of pointer = parameters, convert a boolean function=0Areturn type to bool_t, and clean = up a printk() being touched anyway.=0A=0ASuggested-by: Andrew Cooper = =0ASigned-off-by: Jan Beulich =0A=0A--- a/xen/arch/x86/hvm/vlapic.c=0A+++ b/xen/arch/x86/hvm/vlapic.c=0A= @@ -173,9 +173,9 @@ uint32_t vlapic_set_ppr(struct vlapic *v=0A return = ppr;=0A }=0A =0A-static int vlapic_match_logical_addr(struct vlapic = *vlapic, uint32_t mda)=0A+static bool_t vlapic_match_logical_addr(const = struct vlapic *vlapic, uint32_t mda)=0A {=0A- int result =3D 0;=0A+ = bool_t result =3D 0;=0A uint32_t logical_id =3D vlapic_get_reg(vlapic, = APIC_LDR);=0A =0A if ( vlapic_x2apic_mode(vlapic) )=0A@@ -196,9 +196,9 = @@ static int vlapic_match_logical_addr(str=0A result =3D = 1;=0A break;=0A default:=0A- gdprintk(XENLOG_WARNING, = "Bad DFR value for lapic of vcpu %d: %08x\n",=0A- = vlapic_vcpu(vlapic)->vcpu_id,=0A- vlapic_get_reg(vlapic, = APIC_DFR));=0A+ printk(XENLOG_G_WARNING "%pv: bad LAPIC DFR value = %08x\n",=0A+ const_vlapic_vcpu(vlapic),=0A+ = vlapic_get_reg(vlapic, APIC_DFR));=0A break;=0A }=0A =0A@@ = -206,7 +206,7 @@ static int vlapic_match_logical_addr(str=0A }=0A =0A = bool_t vlapic_match_dest(=0A- struct vlapic *target, const struct = vlapic *source,=0A+ const struct vlapic *target, const struct vlapic = *source,=0A int short_hand, uint32_t dest, bool_t dest_mode)=0A {=0A = HVM_DBG_LOG(DBG_LEVEL_VLAPIC, "target %p, source %p, dest %#x, "=0A--- = a/xen/include/asm-x86/hvm/vlapic.h=0A+++ b/xen/include/asm-x86/hvm/vlapic.h= =0A@@ -28,6 +28,8 @@=0A =0A #define vcpu_vlapic(x) (&(x)->arch.hvm_vcpu.v= lapic)=0A #define vlapic_vcpu(x) (container_of((x), struct vcpu, = arch.hvm_vcpu.vlapic))=0A+#define const_vlapic_vcpu(x) (container_of((x), = const struct vcpu, \=0A+ arch.hvm_vcpu.vlapic)= )=0A #define vlapic_domain(x) (vlapic_vcpu(x)->domain)=0A =0A #define = _VLAPIC_ID(vlapic, id) (vlapic_x2apic_mode(vlapic) \=0A@@ -85,7 +87,8 @@ = struct vlapic {=0A /* vlapic's frequence is 100 MHz */=0A #define = APIC_BUS_CYCLE_NS 10=0A =0A-static inline uint32_t vlapic_get= _reg(struct vlapic *vlapic, uint32_t reg)=0A+static inline uint32_t = vlapic_get_reg(const struct vlapic *vlapic,=0A+ = uint32_t reg)=0A {=0A return *((uint32_t *)(&vlapic->regs->da= ta[reg]));=0A }=0A@@ -129,7 +132,7 @@ struct vlapic *vlapic_lowest_prio(=0A= int short_hand, uint32_t dest, bool_t dest_mode);=0A =0A bool_t = vlapic_match_dest(=0A- struct vlapic *target, const struct vlapic = *source,=0A+ const struct vlapic *target, const struct vlapic = *source,=0A int short_hand, uint32_t dest, bool_t dest_mode);=0A =0A = void vlapic_domain_unpause(const struct domain *);=0A --=__Part3B0E70F9.0__= 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 --=__Part3B0E70F9.0__=--