Message ID | 1474548753-12596-15-git-send-email-zhaoshenglong@huawei.com |
---|---|
State | New |
Headers | show |
Hi Shannon, On 22/09/16 13:52, z00226004 wrote: > From: Shannon Zhao <shannon.zhao@linaro.org> > > Add macros for HVM_PARAM_CALLBACK_TYPE_PPI operation values and update > them in evtchn_fixup(). > > Also use HVM_PARAM_CALLBACK_IRQ_TYPE_MASK in hvm_set_callback_via(). > > Cc: Jan Beulich <jbeulich@suse.com> > Cc: Andrew Cooper <andrew.cooper3@citrix.com> > Signed-off-by: Shannon Zhao <shannon.zhao@linaro.org> Providing Jan's comments have been addressed (I will let Jan confirm): Acked-by: Julien Grall <julien.grall@arm.com> Regards,
On 2016/9/22 8:00, Jan Beulich wrote: >>>> On 22.09.16 at 14:52, <zhaoshenglong@huawei.com> wrote: >> From: Shannon Zhao <shannon.zhao@linaro.org> >> >> Add macros for HVM_PARAM_CALLBACK_TYPE_PPI operation values and update >> them in evtchn_fixup(). >> >> Also use HVM_PARAM_CALLBACK_IRQ_TYPE_MASK in hvm_set_callback_via(). >> >> Cc: Jan Beulich <jbeulich@suse.com> >> Cc: Andrew Cooper <andrew.cooper3@citrix.com> >> Signed-off-by: Shannon Zhao <shannon.zhao@linaro.org> >> --- >> xen/arch/arm/domain_build.c | 9 ++++++--- >> xen/arch/x86/hvm/irq.c | 2 +- >> xen/include/public/hvm/params.h | 3 +++ >> 3 files changed, 10 insertions(+), 4 deletions(-) >> >> diff --git a/xen/arch/arm/domain_build.c b/xen/arch/arm/domain_build.c >> index 35ab08d..0cf7dc3 100644 >> --- a/xen/arch/arm/domain_build.c >> +++ b/xen/arch/arm/domain_build.c >> @@ -2016,9 +2016,12 @@ static void evtchn_fixup(struct domain *d, struct >> kernel_info *kinfo) >> d->arch.evtchn_irq); >> >> /* Set the value of domain param HVM_PARAM_CALLBACK_IRQ */ >> - val = (u64)HVM_PARAM_CALLBACK_TYPE_PPI << 56; >> - val |= (2 << 8); /* Active-low level-sensitive */ >> - val |= d->arch.evtchn_irq & 0xff; >> + val = MASK_INSR(HVM_PARAM_CALLBACK_TYPE_PPI, >> + HVM_PARAM_CALLBACK_IRQ_TYPE_MASK); >> + /* Active-low level-sensitive */ >> + val |= MASK_INSR(HVM_PARAM_CALLBACK_TYPE_PPI_FLAG_LOW_LEVEL, >> + HVM_PARAM_CALLBACK_TYPE_PPI_FLAG_MASK); >> + val |= d->arch.evtchn_irq; >> d->arch.hvm_domain.params[HVM_PARAM_CALLBACK_IRQ] = val; >> >> /* >> diff --git a/xen/arch/x86/hvm/irq.c b/xen/arch/x86/hvm/irq.c >> index 5323d7c..e597114 100644 >> --- a/xen/arch/x86/hvm/irq.c >> +++ b/xen/arch/x86/hvm/irq.c >> @@ -325,7 +325,7 @@ void hvm_set_callback_via(struct domain *d, uint64_t via) >> unsigned int gsi=0, pdev=0, pintx=0; >> uint8_t via_type; >> >> - via_type = (uint8_t)(via >> 56) + 1; >> + via_type = (uint8_t)MASK_EXTR(via, HVM_PARAM_CALLBACK_IRQ_TYPE_MASK) + >> 1; >> if ( ((via_type == HVMIRQ_callback_gsi) && (via == 0)) || >> (via_type > HVMIRQ_callback_vector) ) >> via_type = HVMIRQ_callback_none; >> diff --git a/xen/include/public/hvm/params.h b/xen/include/public/hvm/params.h >> index f7338a3..5c50e2e 100644 >> --- a/xen/include/public/hvm/params.h >> +++ b/xen/include/public/hvm/params.h >> @@ -30,6 +30,7 @@ >> */ >> >> #define HVM_PARAM_CALLBACK_IRQ 0 >> +#define HVM_PARAM_CALLBACK_IRQ_TYPE_MASK 0xFF00000000000000 > > I'd be surprised if this goes through on all compiler versions: This > is a constant which needs at least a UL suffix (and if intended to > be usable on 32-bit even a ULL one, which would then get us into > complications with there not being supposed to be any non-C89 > constructs in the public headers). > Hi Jan, Do I need to resend this patch or add new one to fix this on top of this one? Thanks, -- Shannon
diff --git a/xen/arch/arm/domain_build.c b/xen/arch/arm/domain_build.c index 35ab08d..0cf7dc3 100644 --- a/xen/arch/arm/domain_build.c +++ b/xen/arch/arm/domain_build.c @@ -2016,9 +2016,12 @@ static void evtchn_fixup(struct domain *d, struct kernel_info *kinfo) d->arch.evtchn_irq); /* Set the value of domain param HVM_PARAM_CALLBACK_IRQ */ - val = (u64)HVM_PARAM_CALLBACK_TYPE_PPI << 56; - val |= (2 << 8); /* Active-low level-sensitive */ - val |= d->arch.evtchn_irq & 0xff; + val = MASK_INSR(HVM_PARAM_CALLBACK_TYPE_PPI, + HVM_PARAM_CALLBACK_IRQ_TYPE_MASK); + /* Active-low level-sensitive */ + val |= MASK_INSR(HVM_PARAM_CALLBACK_TYPE_PPI_FLAG_LOW_LEVEL, + HVM_PARAM_CALLBACK_TYPE_PPI_FLAG_MASK); + val |= d->arch.evtchn_irq; d->arch.hvm_domain.params[HVM_PARAM_CALLBACK_IRQ] = val; /* diff --git a/xen/arch/x86/hvm/irq.c b/xen/arch/x86/hvm/irq.c index 5323d7c..e597114 100644 --- a/xen/arch/x86/hvm/irq.c +++ b/xen/arch/x86/hvm/irq.c @@ -325,7 +325,7 @@ void hvm_set_callback_via(struct domain *d, uint64_t via) unsigned int gsi=0, pdev=0, pintx=0; uint8_t via_type; - via_type = (uint8_t)(via >> 56) + 1; + via_type = (uint8_t)MASK_EXTR(via, HVM_PARAM_CALLBACK_IRQ_TYPE_MASK) + 1; if ( ((via_type == HVMIRQ_callback_gsi) && (via == 0)) || (via_type > HVMIRQ_callback_vector) ) via_type = HVMIRQ_callback_none; diff --git a/xen/include/public/hvm/params.h b/xen/include/public/hvm/params.h index f7338a3..5c50e2e 100644 --- a/xen/include/public/hvm/params.h +++ b/xen/include/public/hvm/params.h @@ -30,6 +30,7 @@ */ #define HVM_PARAM_CALLBACK_IRQ 0 +#define HVM_PARAM_CALLBACK_IRQ_TYPE_MASK 0xFF00000000000000 /* * How should CPU0 event-channel notifications be delivered? * @@ -66,6 +67,8 @@ * This is only used by ARM/ARM64 and masking/eoi the interrupt associated to * the notification is handled by the interrupt controller. */ +#define HVM_PARAM_CALLBACK_TYPE_PPI_FLAG_MASK 0xFF00 +#define HVM_PARAM_CALLBACK_TYPE_PPI_FLAG_LOW_LEVEL 2 #endif /*