Stefano Stabellini
2012-May-21 15:12 UTC
[PATCH] xen: domain_pirq_to_emuirq return IRQ_UNBOUND by default
xen: domain_pirq_to_emuirq return IRQ_UNBOUND by default
domain_pirq_to_emuirq should return IRQ_UNBOUND rather than 0 on
missing entries.
Add a default parameter to pirq_field, so that callers can set any
default return value they want; use IRQ_UNBOUND in
domain_pirq_to_emuirq.
This patch fixes a regression introduced by 23573: save/restore failing
on upstream QEMU with PV on HVM guests.
Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
diff -r f1bb3decd2db xen/include/asm-x86/irq.h
--- a/xen/include/asm-x86/irq.h Fri May 18 13:50:01 2012 +0000
+++ b/xen/include/asm-x86/irq.h Mon May 21 15:07:28 2012 +0000
@@ -173,13 +173,14 @@ void irq_set_affinity(struct irq_desc *,
int init_domain_irq_mapping(struct domain *);
void cleanup_domain_irq_mapping(struct domain *);
-#define domain_pirq_to_irq(d, pirq) pirq_field(d, pirq, arch.irq)
+#define domain_pirq_to_irq(d, pirq) pirq_field(d, pirq, arch.irq, 0)
#define domain_irq_to_pirq(d, irq) ({ \
void *__ret = radix_tree_lookup(&(d)->arch.irq_pirq, irq); \
__ret ? radix_tree_ptr_to_int(__ret) : 0; \
})
#define PIRQ_ALLOCATED -1
-#define domain_pirq_to_emuirq(d, pirq) pirq_field(d, pirq, arch.hvm.emuirq)
+#define domain_pirq_to_emuirq(d, pirq) pirq_field(d, pirq, \
+ arch.hvm.emuirq, IRQ_UNBOUND)
#define domain_emuirq_to_pirq(d, emuirq) ({ \
void *__ret = radix_tree_lookup(&(d)->arch.hvm_domain.emuirq_pirq,
\
emuirq); \
diff -r f1bb3decd2db xen/include/xen/irq.h
--- a/xen/include/xen/irq.h Fri May 18 13:50:01 2012 +0000
+++ b/xen/include/xen/irq.h Mon May 21 15:07:28 2012 +0000
@@ -133,12 +133,12 @@ struct pirq {
/* Use this instead of pirq_info() if the structure may need allocating. */
extern struct pirq *pirq_get_info(struct domain *, int pirq);
-#define pirq_field(d, p, f) ({ \
+#define pirq_field(d, p, f, def) ({ \
const struct pirq *__pi = pirq_info(d, p); \
- __pi ? __pi->f : 0; \
+ __pi ? __pi->f : def; \
})
-#define pirq_to_evtchn(d, pirq) pirq_field(d, pirq, evtchn)
-#define pirq_masked(d, pirq) pirq_field(d, pirq, masked)
+#define pirq_to_evtchn(d, pirq) pirq_field(d, pirq, evtchn, 0)
+#define pirq_masked(d, pirq) pirq_field(d, pirq, masked, 0)
void pirq_cleanup_check(struct pirq *, struct domain *);
Stefano Stabellini
2012-May-25 11:32 UTC
Re: [PATCH] xen: domain_pirq_to_emuirq return IRQ_UNBOUND by default
On Mon, 21 May 2012, Stefano Stabellini wrote:> xen: domain_pirq_to_emuirq return IRQ_UNBOUND by default > > domain_pirq_to_emuirq should return IRQ_UNBOUND rather than 0 on > missing entries. > Add a default parameter to pirq_field, so that callers can set any > default return value they want; use IRQ_UNBOUND in > domain_pirq_to_emuirq. > > This patch fixes a regression introduced by 23573: save/restore failing > on upstream QEMU with PV on HVM guests. > > Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>ping?> diff -r f1bb3decd2db xen/include/asm-x86/irq.h > --- a/xen/include/asm-x86/irq.h Fri May 18 13:50:01 2012 +0000 > +++ b/xen/include/asm-x86/irq.h Mon May 21 15:07:28 2012 +0000 > @@ -173,13 +173,14 @@ void irq_set_affinity(struct irq_desc *, > int init_domain_irq_mapping(struct domain *); > void cleanup_domain_irq_mapping(struct domain *); > > -#define domain_pirq_to_irq(d, pirq) pirq_field(d, pirq, arch.irq) > +#define domain_pirq_to_irq(d, pirq) pirq_field(d, pirq, arch.irq, 0) > #define domain_irq_to_pirq(d, irq) ({ \ > void *__ret = radix_tree_lookup(&(d)->arch.irq_pirq, irq); \ > __ret ? radix_tree_ptr_to_int(__ret) : 0; \ > }) > #define PIRQ_ALLOCATED -1 > -#define domain_pirq_to_emuirq(d, pirq) pirq_field(d, pirq, arch.hvm.emuirq) > +#define domain_pirq_to_emuirq(d, pirq) pirq_field(d, pirq, \ > + arch.hvm.emuirq, IRQ_UNBOUND) > #define domain_emuirq_to_pirq(d, emuirq) ({ \ > void *__ret = radix_tree_lookup(&(d)->arch.hvm_domain.emuirq_pirq, \ > emuirq); \ > diff -r f1bb3decd2db xen/include/xen/irq.h > --- a/xen/include/xen/irq.h Fri May 18 13:50:01 2012 +0000 > +++ b/xen/include/xen/irq.h Mon May 21 15:07:28 2012 +0000 > @@ -133,12 +133,12 @@ struct pirq { > /* Use this instead of pirq_info() if the structure may need allocating. */ > extern struct pirq *pirq_get_info(struct domain *, int pirq); > > -#define pirq_field(d, p, f) ({ \ > +#define pirq_field(d, p, f, def) ({ \ > const struct pirq *__pi = pirq_info(d, p); \ > - __pi ? __pi->f : 0; \ > + __pi ? __pi->f : def; \ > }) > -#define pirq_to_evtchn(d, pirq) pirq_field(d, pirq, evtchn) > -#define pirq_masked(d, pirq) pirq_field(d, pirq, masked) > +#define pirq_to_evtchn(d, pirq) pirq_field(d, pirq, evtchn, 0) > +#define pirq_masked(d, pirq) pirq_field(d, pirq, masked, 0) > > void pirq_cleanup_check(struct pirq *, struct domain *); > > > _______________________________________________ > Xen-devel mailing list > Xen-devel@lists.xen.org > http://lists.xen.org/xen-devel >