yamahata at valinux.co.jp
2008-Feb-21 08:45 UTC
[PATCH 00/11] Xen arch portability patches
Hi. Recently the xen-ia64 community started to make efforts to merge xen/ia64 Linux to upstream. The first step is to merge up domU portion. This patchset is preliminary for xen/ia64 domU linux making the current xen/x86 domU code more arch generic and adding missing definitions and files. Diffstat: arch/x86/xen/Makefile | 4 +- arch/x86/xen/grant-table.c | 91 +++++++++++++ drivers/xen/Makefile | 3 +- {arch/x86 => drivers}/xen/events.c | 34 ++++-- {arch/x86 => drivers}/xen/features.c | 0 drivers/xen/grant-table.c | 37 +----- drivers/xen/xenbus/xenbus_client.c | 6 +- drivers/xen/xencomm.c | 232 ++++++++++++++++++++++++++++++++++ include/asm-x86/xen/hypervisor.h | 10 ++ include/asm-x86/xen/interface.h | 24 ++++ include/{ => asm-x86}/xen/page.h | 0 include/xen/events.h | 1 + include/xen/grant_table.h | 6 + include/xen/interface/callback.h | 119 +++++++++++++++++ include/xen/interface/grant_table.h | 11 ++- include/xen/interface/vcpu.h | 5 + include/xen/interface/xen.h | 22 +++- include/xen/interface/xencomm.h | 41 ++++++ include/xen/page.h | 181 +-------------------------- include/xen/xencomm.h | 77 +++++++++++ 20 files changed, 673 insertions(+), 231 deletions(-) -- yamahata
yamahata at valinux.co.jp
2008-Feb-21 08:45 UTC
[PATCH 01/11] xen: add missing __HYPERVISOR_arch_definisions which ia64 needs.
An embedded and charset-unspecified text was scrubbed... Name: 0001-xen-add-missing-__HYPERVISOR_arch_-0-7-definisions.patch Url: http://lists.linux-foundation.org/pipermail/virtualization/attachments/20080221/a04683cc/attachment.ksh
yamahata at valinux.co.jp
2008-Feb-21 08:45 UTC
[PATCH 02/11] xen: add missing VIRQ_ARCH_definitions which ia64/xen needs.
An embedded and charset-unspecified text was scrubbed... Name: 0002-xen-add-missing-VIRQ_ARCH_-0-7-definitions-which-i.patch Url: http://lists.linux-foundation.org/pipermail/virtualization/attachments/20080221/86adff78/attachment.txt
yamahata at valinux.co.jp
2008-Feb-21 08:45 UTC
[PATCH 03/11] xen: add missing definitions for xen grant table which ia64/xen needs.
An embedded and charset-unspecified text was scrubbed... Name: 0003-xen-add-missing-definitions-for-xen-grant-table-whi.patch Url: http://lists.linux-foundation.org/pipermail/virtualization/attachments/20080221/c8df90d3/attachment.txt
yamahata at valinux.co.jp
2008-Feb-21 08:45 UTC
[PATCH 04/11] xen: add missing definitions in include/xen/interface/vcpu.h which ia64/xen needs
An embedded and charset-unspecified text was scrubbed... Name: 0004-xen-add-missing-definitions-in-include-xen-interfac.patch Url: http://lists.linux-foundation.org/pipermail/virtualization/attachments/20080221/dda4f3dc/attachment.txt
yamahata at valinux.co.jp
2008-Feb-21 08:45 UTC
[PATCH 05/11] xen: move features.c from arch/x86/xen/features.c to drivers/xen.
An embedded and charset-unspecified text was scrubbed... Name: 0005-xen-move-features.c-from-arch-x86-xen-features.c-to.patch Url: http://lists.linux-foundation.org/pipermail/virtualization/attachments/20080221/5496b071/attachment.txt
yamahata at valinux.co.jp
2008-Feb-21 08:45 UTC
[PATCH 06/11] xen: move arch/x86/xen/events.c undedr drivers/xen and split out arch specific part.
An embedded and charset-unspecified text was scrubbed... Name: 0006-xen-move-arch-x86-xen-events.c-undedr-drivers-xen-a.patch Url: http://lists.linux-foundation.org/pipermail/virtualization/attachments/20080221/d9c4c9cf/attachment.txt
yamahata at valinux.co.jp
2008-Feb-21 08:45 UTC
[PATCH 07/11] xen: make include/xen/page.h portable moving those definitions under asm dir.
An embedded and charset-unspecified text was scrubbed... Name: 0007-xen-make-include-xen-page.h-portable-moving-those-d.patch Url: http://lists.linux-foundation.org/pipermail/virtualization/attachments/20080221/0cadbb82/attachment.txt
yamahata at valinux.co.jp
2008-Feb-21 08:45 UTC
[PATCH 08/11] xen: replace callers of alloc_vm_area()/free_vm_area() with xen_ prefixed one.
An embedded and charset-unspecified text was scrubbed... Name: 0008-xen-replace-callers-of-alloc_vm_area-free_vm_area.patch Url: http://lists.linux-foundation.org/pipermail/virtualization/attachments/20080221/1a33796d/attachment.txt
yamahata at valinux.co.jp
2008-Feb-21 08:45 UTC
[PATCH 09/11] xen: make grant table arch portable.
An embedded and charset-unspecified text was scrubbed... Name: 0009-xen-make-grant-table-arch-portable.patch Url: http://lists.linux-foundation.org/pipermail/virtualization/attachments/20080221/732e91d7/attachment.txt
yamahata at valinux.co.jp
2008-Feb-21 08:45 UTC
[PATCH 10/11] xen: import include/xen/interface/callback.h which ia64/xen needs.
An embedded and charset-unspecified text was scrubbed... Name: 0010-xen-import-include-xen-interface-callback.h-which-i.patch Url: http://lists.linux-foundation.org/pipermail/virtualization/attachments/20080221/4cc5215b/attachment.txt
yamahata at valinux.co.jp
2008-Feb-21 08:45 UTC
[PATCH 11/11] xen: import arch generic part of xencomm.
An embedded and charset-unspecified text was scrubbed... Name: 0011-xen-import-arch-generic-part-of-xencomm.patch Url: http://lists.linux-foundation.org/pipermail/virtualization/attachments/20080221/411f0f82/attachment.txt
yamahata at valinux.co.jp wrote:> Hi. Recently the xen-ia64 community started to make efforts to merge > xen/ia64 Linux to upstream. The first step is to merge up domU portion. > This patchset is preliminary for xen/ia64 domU linux making the current > xen/x86 domU code more arch generic and adding missing definitions and > files. >I haven't looked at the whole series yet, but this seems fine in principle. One thing: using attachments to post makes it hard to do inline comments on the patches. J
Jeremy Fitzhardinge
2008-Feb-21 19:38 UTC
[PATCH 06/11] xen: move arch/x86/xen/events.c undedr drivers/xen and split out arch specific part.
yamahata at valinux.co.jp wrote:> diff --git a/arch/x86/xen/events.c b/drivers/xen/events.c > similarity index 95% > rename from arch/x86/xen/events.c > rename to drivers/xen/events.c > index dcf613e..7474739 100644 > --- a/arch/x86/xen/events.c > +++ b/drivers/xen/events.c > @@ -37,7 +37,9 @@ > #include <xen/interface/xen.h> > #include <xen/interface/event_channel.h> > > -#include "xen-ops.h" > +#ifdef CONFIG_X86 > +# include "../arch/x86/xen/xen-ops.h" > +#endifHm. Perhaps it would be better to move whatever definition you need into a header in a common place (or move xen-ops.h entirely). J
Isaku Yamahata
2008-Feb-22 03:47 UTC
[PATCH 06/11] xen: move arch/x86/xen/events.c undedr drivers/xen and split out arch specific part.
On Thu, Feb 21, 2008 at 11:38:18AM -0800, Jeremy Fitzhardinge wrote:> yamahata at valinux.co.jp wrote: > >diff --git a/arch/x86/xen/events.c b/drivers/xen/events.c > >similarity index 95% > >rename from arch/x86/xen/events.c > >rename to drivers/xen/events.c > >index dcf613e..7474739 100644 > >--- a/arch/x86/xen/events.c > >+++ b/drivers/xen/events.c > >@@ -37,7 +37,9 @@ > > #include <xen/interface/xen.h> > > #include <xen/interface/event_channel.h> > > > >-#include "xen-ops.h" > >+#ifdef CONFIG_X86 > >+# include "../arch/x86/xen/xen-ops.h" > >+#endif > > Hm. Perhaps it would be better to move whatever definition you need > into a header in a common place (or move xen-ops.h entirely).Thank you for review. The updated version. changes - move the xen_vcpu declaration from arch/x86/xen/xen-ops.h to include/xen/xen-ops.h which is newly created. xen: move arch/x86/xen/events.c undedr drivers/xen and split out arch specific part. ia64/xen also uses events.c. clean it up so that ia64/xen can use. make ipi_to_irq globly visible. ia64/xen nees to reference it from other file. introduce resend_irq_on_evtchn() which ia64 needs. introduce xen_do_IRQ() to split out arch specific code. Signed-off-by: Isaku Yamahata <yamahata at valinux.co.jp> --- arch/x86/xen/Makefile | 2 +- arch/x86/xen/xen-ops.h | 2 +- drivers/xen/Makefile | 2 +- {arch/x86 => drivers}/xen/events.c | 33 ++++++++++++++++++++++++--------- include/asm-x86/xen/hypervisor.h | 7 +++++++ include/xen/events.h | 1 + include/xen/xen-ops.h | 6 ++++++ 7 files changed, 41 insertions(+), 12 deletions(-) rename {arch/x86 => drivers}/xen/events.c (95%) create mode 100644 include/xen/xen-ops.h diff --git a/arch/x86/xen/Makefile b/arch/x86/xen/Makefile index c5e9aa4..95c5926 100644 --- a/arch/x86/xen/Makefile +++ b/arch/x86/xen/Makefile @@ -1,4 +1,4 @@ obj-y := enlighten.o setup.o multicalls.o mmu.o \ - events.o time.o manage.o xen-asm.o + time.o manage.o xen-asm.o obj-$(CONFIG_SMP) += smp.o diff --git a/arch/x86/xen/xen-ops.h b/arch/x86/xen/xen-ops.h index b02a909..caaabf3 100644 --- a/arch/x86/xen/xen-ops.h +++ b/arch/x86/xen/xen-ops.h @@ -2,6 +2,7 @@ #define XEN_OPS_H #include <linux/init.h> +#include <xen/xen-ops.h> /* These are code, but not functions. Defined in entry.S */ extern const char xen_hypervisor_callback[]; @@ -9,7 +10,6 @@ extern const char xen_failsafe_callback[]; void xen_copy_trap_info(struct trap_info *traps); -DECLARE_PER_CPU(struct vcpu_info *, xen_vcpu); DECLARE_PER_CPU(unsigned long, xen_cr3); DECLARE_PER_CPU(unsigned long, xen_current_cr3); diff --git a/drivers/xen/Makefile b/drivers/xen/Makefile index 609fdda..823ce78 100644 --- a/drivers/xen/Makefile +++ b/drivers/xen/Makefile @@ -1,2 +1,2 @@ -obj-y += grant-table.o features.o +obj-y += grant-table.o features.o events.o obj-y += xenbus/ diff --git a/arch/x86/xen/events.c b/drivers/xen/events.c similarity index 95% rename from arch/x86/xen/events.c rename to drivers/xen/events.c index dcf613e..dce2dfc 100644 --- a/arch/x86/xen/events.c +++ b/drivers/xen/events.c @@ -33,12 +33,11 @@ #include <asm/xen/hypercall.h> #include <asm/xen/hypervisor.h> +#include <xen/xen-ops.h> #include <xen/events.h> #include <xen/interface/xen.h> #include <xen/interface/event_channel.h> -#include "xen-ops.h" - /* * This lock protects updates to the following mapping and reference-count * arrays. The lock does not need to be acquired to read the mapping tables. @@ -49,7 +48,7 @@ static DEFINE_SPINLOCK(irq_mapping_update_lock); static DEFINE_PER_CPU(int, virq_to_irq[NR_VIRQS]) = {[0 ... NR_VIRQS-1] = -1}; /* IRQ <-> IPI mapping */ -static DEFINE_PER_CPU(int, ipi_to_irq[XEN_NR_IPIS]) = {[0 ... XEN_NR_IPIS-1] = -1}; +DEFINE_PER_CPU(int, ipi_to_irq[XEN_NR_IPIS]) = {[0 ... XEN_NR_IPIS-1] = -1}; /* Packed IRQ information: binding type, sub-type index, and event channel. */ struct packed_irq @@ -455,7 +454,6 @@ void xen_send_IPI_one(unsigned int cpu, enum ipi_vector vector) notify_remote_via_irq(irq); } - /* * Search the CPUs pending events bitmasks. For each one found, map * the event number to an irq, and feed it into do_IRQ() for @@ -474,7 +472,10 @@ void xen_evtchn_do_upcall(struct pt_regs *regs) vcpu_info->evtchn_upcall_pending = 0; - /* NB. No need for a barrier here -- XCHG is a barrier on x86. */ +#ifndef CONFIG_X86 /* No need for a barrier -- XCHG is a barrier on x86. */ + /* Clear master flag /before/ clearing selector flag. */ + rmb(); +#endif pending_words = xchg(&vcpu_info->evtchn_pending_sel, 0); while (pending_words != 0) { unsigned long pending_bits; @@ -486,10 +487,8 @@ void xen_evtchn_do_upcall(struct pt_regs *regs) int port = (word_idx * BITS_PER_LONG) + bit_idx; int irq = evtchn_to_irq[port]; - if (irq != -1) { - regs->orig_ax = ~irq; - do_IRQ(regs); - } + if (irq != -1) + xen_do_IRQ(irq, regs); } } @@ -525,6 +524,22 @@ static void set_affinity_irq(unsigned irq, cpumask_t dest) rebind_irq_to_cpu(irq, tcpu); } +int resend_irq_on_evtchn(unsigned int irq) +{ + int masked, evtchn = evtchn_from_irq(irq); + struct shared_info *s = HYPERVISOR_shared_info; + + if (!VALID_EVTCHN(evtchn)) + return 1; + + masked = sync_test_and_set_bit(evtchn, s->evtchn_mask); + sync_set_bit(evtchn, s->evtchn_pending); + if (!masked) + unmask_evtchn(evtchn); + + return 1; +} + static void enable_dynirq(unsigned int irq) { int evtchn = evtchn_from_irq(irq); diff --git a/include/asm-x86/xen/hypervisor.h b/include/asm-x86/xen/hypervisor.h index 8e15dd2..138ee8a 100644 --- a/include/asm-x86/xen/hypervisor.h +++ b/include/asm-x86/xen/hypervisor.h @@ -61,6 +61,13 @@ extern struct start_info *xen_start_info; /* Force a proper event-channel callback from Xen. */ extern void force_evtchn_callback(void); +/* macro to avoid header inclusion dependncy hell */ +#define xen_do_IRQ(irq, regs) \ + do { \ + (regs)->orig_ax = ~(irq); \ + do_IRQ(regs); \ + } while (0) + /* Turn jiffies into Xen system time. */ u64 jiffies_to_st(unsigned long jiffies); diff --git a/include/xen/events.h b/include/xen/events.h index 2bde54d..574cfa4 100644 --- a/include/xen/events.h +++ b/include/xen/events.h @@ -37,6 +37,7 @@ int bind_ipi_to_irqhandler(enum ipi_vector ipi, void unbind_from_irqhandler(unsigned int irq, void *dev_id); void xen_send_IPI_one(unsigned int cpu, enum ipi_vector vector); +int resend_irq_on_evtchn(unsigned int irq); static inline void notify_remote_via_evtchn(int port) { diff --git a/include/xen/xen-ops.h b/include/xen/xen-ops.h new file mode 100644 index 0000000..003a7c9 --- /dev/null +++ b/include/xen/xen-ops.h @@ -0,0 +1,6 @@ +#ifndef INCLUDE_XEN_OPS_H +#define INCLUDE_XEN_OPS_H + +DECLARE_PER_CPU(struct vcpu_info *, xen_vcpu); + +#endif /* INCLUDE_XEN_OPS_H */ -- 1.5.3 -- yamahata