* Re: [PATCH 00/11] Xen arch portability patches [not found] <20080221084530.470680000@ls.local.valinux.co.jp> @ 2008-02-21 19:35 ` Jeremy Fitzhardinge [not found] ` <20080221091002.222498000@ls.local.valinux.co.jp> [not found] ` <20080221091001.314830000@ls.local.valinux.co.jp> 2 siblings, 0 replies; 5+ messages in thread From: Jeremy Fitzhardinge @ 2008-02-21 19:35 UTC (permalink / raw) To: yamahata Cc: linux-kernel, virtualization, xen-devel, linux-ia64, xen-ia64-devel, Chris Wright, Stephen C. Tweedie yamahata@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 ^ permalink raw reply [flat|nested] 5+ messages in thread
[parent not found: <20080221091002.222498000@ls.local.valinux.co.jp>]
* Re: [PATCH 06/11] xen: move arch/x86/xen/events.c undedr drivers/xen and split out arch specific part. [not found] ` <20080221091002.222498000@ls.local.valinux.co.jp> @ 2008-02-21 19:38 ` Jeremy Fitzhardinge 2008-02-22 3:47 ` Isaku Yamahata 0 siblings, 1 reply; 5+ messages in thread From: Jeremy Fitzhardinge @ 2008-02-21 19:38 UTC (permalink / raw) To: yamahata Cc: linux-kernel, virtualization, xen-devel, linux-ia64, xen-ia64-devel, Chris Wright, Stephen C. Tweedie yamahata@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). J ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 06/11] xen: move arch/x86/xen/events.c undedr drivers/xen and split out arch specific part. 2008-02-21 19:38 ` [PATCH 06/11] xen: move arch/x86/xen/events.c undedr drivers/xen and split out arch specific part Jeremy Fitzhardinge @ 2008-02-22 3:47 ` Isaku Yamahata 0 siblings, 0 replies; 5+ messages in thread From: Isaku Yamahata @ 2008-02-22 3:47 UTC (permalink / raw) To: Jeremy Fitzhardinge Cc: linux-kernel, virtualization, xen-devel, linux-ia64, xen-ia64-devel, Chris Wright, Stephen C. Tweedie On Thu, Feb 21, 2008 at 11:38:18AM -0800, Jeremy Fitzhardinge wrote: > yamahata@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@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 ^ permalink raw reply related [flat|nested] 5+ messages in thread
[parent not found: <20080221091001.314830000@ls.local.valinux.co.jp>]
* Re: [PATCH 03/11] xen: add missing definitions for xen grant table which ia64/xen needs. [not found] ` <20080221091001.314830000@ls.local.valinux.co.jp> @ 2008-02-21 19:40 ` Jeremy Fitzhardinge 0 siblings, 0 replies; 5+ messages in thread From: Jeremy Fitzhardinge @ 2008-02-21 19:40 UTC (permalink / raw) To: yamahata Cc: linux-kernel, virtualization, xen-devel, linux-ia64, xen-ia64-devel, Chris Wright, Stephen C. Tweedie yamahata@valinux.co.jp wrote: Yep. We removed the guest handle stuff for the initial upstreaming, since it isn't necessary on x86 and it quietened some of the reviewer noise. But I expected we'd need to reintroduce it at some stage. J ^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH 00/11] Xen arch portability patches
@ 2008-02-22 5:07 Isaku Yamahata
2008-02-22 5:07 ` [PATCH 06/11] xen: move arch/x86/xen/events.c undedr drivers/xen and split out arch specific part Isaku Yamahata
0 siblings, 1 reply; 5+ messages in thread
From: Isaku Yamahata @ 2008-02-22 5:07 UTC (permalink / raw)
To: linux-kernel; +Cc: linux-ia64, yamahata
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 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(-)
^ permalink raw reply [flat|nested] 5+ messages in thread* [PATCH 06/11] xen: move arch/x86/xen/events.c undedr drivers/xen and split out arch specific part. 2008-02-22 5:07 [PATCH 00/11] Xen arch portability patches Isaku Yamahata @ 2008-02-22 5:07 ` Isaku Yamahata 0 siblings, 0 replies; 5+ messages in thread From: Isaku Yamahata @ 2008-02-22 5:07 UTC (permalink / raw) To: linux-kernel; +Cc: linux-ia64, yamahata 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@valinux.co.jp> --- arch/x86/xen/Makefile | 2 +- drivers/xen/Makefile | 2 +- {arch/x86 => drivers}/xen/events.c | 34 ++++++++++++++++++++++++++-------- include/asm-x86/xen/hypervisor.h | 7 +++++++ include/xen/events.h | 1 + 5 files changed, 36 insertions(+), 10 deletions(-) rename {arch/x86 => drivers}/xen/events.c (95%) 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/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..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 /* * This lock protects updates to the following mapping and reference-count @@ -49,7 +51,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 +457,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 +475,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 +490,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 +527,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) { -- 1.5.3 ^ permalink raw reply related [flat|nested] 5+ messages in thread
end of thread, other threads:[~2008-02-22 5:12 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <20080221084530.470680000@ls.local.valinux.co.jp>
2008-02-21 19:35 ` [PATCH 00/11] Xen arch portability patches Jeremy Fitzhardinge
[not found] ` <20080221091002.222498000@ls.local.valinux.co.jp>
2008-02-21 19:38 ` [PATCH 06/11] xen: move arch/x86/xen/events.c undedr drivers/xen and split out arch specific part Jeremy Fitzhardinge
2008-02-22 3:47 ` Isaku Yamahata
[not found] ` <20080221091001.314830000@ls.local.valinux.co.jp>
2008-02-21 19:40 ` [PATCH 03/11] xen: add missing definitions for xen grant table which ia64/xen needs Jeremy Fitzhardinge
2008-02-22 5:07 [PATCH 00/11] Xen arch portability patches Isaku Yamahata
2008-02-22 5:07 ` [PATCH 06/11] xen: move arch/x86/xen/events.c undedr drivers/xen and split out arch specific part Isaku Yamahata
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox