From mboxrd@z Thu Jan 1 00:00:00 1970 From: Andrew Cooper Subject: Re: [RFC v1 04/15] vmx: Add some helper functions for Posted-Interrupts Date: Thu, 26 Mar 2015 18:44:23 +0000 Message-ID: <55145387.4070805@citrix.com> References: <1427286717-4093-1-git-send-email-feng.wu@intel.com> <1427286717-4093-5-git-send-email-feng.wu@intel.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii"; Format="flowed" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <1427286717-4093-5-git-send-email-feng.wu@intel.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: Feng Wu , xen-devel@lists.xen.org Cc: yang.z.zhang@intel.com, kevin.tian@intel.com, keir@xen.org, JBeulich@suse.com List-Id: xen-devel@lists.xenproject.org On 25/03/15 12:31, Feng Wu wrote: > This patch adds some helper functions to manipulate the > Posted-Interrupts Descriptor. > > Signed-off-by: Feng Wu > --- > xen/include/asm-x86/hvm/vmx/vmx.h | 21 +++++++++++++++++++++ > 1 file changed, 21 insertions(+) > > diff --git a/xen/include/asm-x86/hvm/vmx/vmx.h b/xen/include/asm-x86/hvm/vmx/vmx.h > index 91c5e18..ecc5e17 100644 > --- a/xen/include/asm-x86/hvm/vmx/vmx.h > +++ b/xen/include/asm-x86/hvm/vmx/vmx.h > @@ -100,6 +100,7 @@ void vmx_update_cpu_exec_control(struct vcpu *v); > void vmx_update_secondary_exec_control(struct vcpu *v); > > #define POSTED_INTR_ON 0 > +#define POSTED_INTR_SN 1 > static inline int pi_test_and_set_pir(int vector, struct pi_desc *pi_desc) > { > return test_and_set_bit(vector, pi_desc->pir); > @@ -120,6 +121,26 @@ static inline int pi_test_and_clear_on(struct pi_desc *pi_desc) > return test_and_clear_bit(POSTED_INTR_ON, &pi_desc->control); > } > > +static inline int pi_test_on(struct pi_desc *pi_desc) static inline bool_t pi_test_on(const struct pi_desc *pi_desc) please. Similar for test_sn below. Is it important that these operations are properly atomic? A custory glance at the rest of your series suggests not. If not, please use the non-locked variants of test/clear/set_bit. Otherwise, Reviewed-by: Andrew Cooper > +{ > + return test_bit(POSTED_INTR_ON, &pi_desc->control); > +} > + > +static inline void pi_set_sn(struct pi_desc *pi_desc) > +{ > + set_bit(POSTED_INTR_SN, &pi_desc->control); > +} > + > +static inline int pi_test_sn(struct pi_desc *pi_desc) > +{ > + return test_bit(POSTED_INTR_SN, &pi_desc->control); > +} > + > +static inline void pi_clear_sn(struct pi_desc *pi_desc) > +{ > + clear_bit(POSTED_INTR_SN, &pi_desc->control); > +} > + > static inline unsigned long pi_get_pir(struct pi_desc *pi_desc, int group) > { > return xchg(&pi_desc->pir[group], 0);