From mboxrd@z Thu Jan 1 00:00:00 1970 From: Samuel Thibault Subject: Re: [PATCH ARM v3 4/7] mini-os: moved events code under arch Date: Wed, 11 Jun 2014 21:04:04 +0200 Message-ID: <20140611190404.GJ6816@type.mobile.lan> References: <1402482618-15269-1-git-send-email-talex5@gmail.com> <1402482618-15269-5-git-send-email-talex5@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Return-path: Received: from mail6.bemta4.messagelabs.com ([85.158.143.247]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1Wup4O-0006NS-M2 for xen-devel@lists.xenproject.org; Wed, 11 Jun 2014 20:24:28 +0000 Content-Disposition: inline In-Reply-To: <1402482618-15269-5-git-send-email-talex5@gmail.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: Thomas Leonard Cc: xen-devel@lists.xenproject.org, stefano.stabellini@eu.citrix.com, Dave.Scott@eu.citrix.com, anil@recoil.org List-Id: xen-devel@lists.xenproject.org Thomas Leonard, le Wed 11 Jun 2014 11:30:15 +0100, a =E9crit : > From: Karim Raslan > = > This is all code motion, except that we now initialise > the ev_actions array before calling the arch-specific code > to make it more robust against future changes. > = > Signed-off-by: Karim Allah Ahmed > [talex5@gmail.com: separated from big ARM commit] > Signed-off-by: Thomas Leonard Acked-by: Samuel Thibault > --- > extras/mini-os/arch/x86/events.c | 31 +++++++++++++++++++++++++++++++ > extras/mini-os/events.c | 24 ++++-------------------- > extras/mini-os/include/events.h | 3 +++ > 3 files changed, 38 insertions(+), 20 deletions(-) > create mode 100644 extras/mini-os/arch/x86/events.c > = > diff --git a/extras/mini-os/arch/x86/events.c b/extras/mini-os/arch/x86/e= vents.c > new file mode 100644 > index 0000000..e420a98 > --- /dev/null > +++ b/extras/mini-os/arch/x86/events.c > @@ -0,0 +1,31 @@ > +#include > +#include > +#include > + > +#if defined(__x86_64__) > +char irqstack[2 * STACK_SIZE]; > + > +static struct pda > +{ > + int irqcount; /* offset 0 (used in x86_64.S) */ > + char *irqstackptr; /* 8 */ > +} cpu0_pda; > +#endif > + > +void arch_init_events(void) > +{ > +#if defined(__x86_64__) > + asm volatile("movl %0,%%fs ; movl %0,%%gs" :: "r" (0)); > + wrmsrl(0xc0000101, &cpu0_pda); /* 0xc0000101 is MSR_GS_BASE */ > + cpu0_pda.irqcount =3D -1; > + cpu0_pda.irqstackptr =3D (void*) (((unsigned long)irqstack + 2 * STA= CK_SIZE) > + & ~(STACK_SIZE - 1)); > +#endif > +} > + > +void arch_fini_events(void) > +{ > +#if defined(__x86_64__) > + wrmsrl(0xc0000101, NULL); /* 0xc0000101 is MSR_GS_BASE */ > +#endif > +} > diff --git a/extras/mini-os/events.c b/extras/mini-os/events.c > index 2da9b01..d60630b 100644 > --- a/extras/mini-os/events.c > +++ b/extras/mini-os/events.c > @@ -167,44 +167,28 @@ evtchn_port_t bind_pirq(uint32_t pirq, int will_sha= re, > return op.port; > } > = > -#if defined(__x86_64__) > -char irqstack[2 * STACK_SIZE]; > - > -static struct pda > -{ > - int irqcount; /* offset 0 (used in x86_64.S) */ > - char *irqstackptr; /* 8 */ > -} cpu0_pda; > -#endif > - > /* > * Initially all events are without a handler and disabled > */ > void init_events(void) > { > int i; > -#if defined(__x86_64__) > - asm volatile("movl %0,%%fs ; movl %0,%%gs" :: "r" (0)); > - wrmsrl(0xc0000101, &cpu0_pda); /* 0xc0000101 is MSR_GS_BASE */ > - cpu0_pda.irqcount =3D -1; > - cpu0_pda.irqstackptr =3D (void*) (((unsigned long)irqstack + 2 * STA= CK_SIZE) > - & ~(STACK_SIZE - 1)); > -#endif > + > /* initialize event handler */ > for ( i =3D 0; i < NR_EVS; i++ ) > { > ev_actions[i].handler =3D default_handler; > mask_evtchn(i); > } > + > + arch_init_events(); > } > = > void fini_events(void) > { > /* Dealloc all events */ > unbind_all_ports(); > -#if defined(__x86_64__) > - wrmsrl(0xc0000101, NULL); /* 0xc0000101 is MSR_GS_BASE */ > -#endif > + arch_fini_events(); > } > = > void default_handler(evtchn_port_t port, struct pt_regs *regs, void *ign= ore) > diff --git a/extras/mini-os/include/events.h b/extras/mini-os/include/eve= nts.h > index 0e9d3a7..0452d21 100644 > --- a/extras/mini-os/include/events.h > +++ b/extras/mini-os/include/events.h > @@ -25,6 +25,9 @@ > typedef void (*evtchn_handler_t)(evtchn_port_t, struct pt_regs *, void *= ); > = > /* prototypes */ > +void arch_init_events(void); > +void arch_fini_events(void); > + > int do_event(evtchn_port_t port, struct pt_regs *regs); > evtchn_port_t bind_virq(uint32_t virq, evtchn_handler_t handler, void *d= ata); > evtchn_port_t bind_pirq(uint32_t pirq, int will_share, evtchn_handler_t = handler, void *data); > -- = > 2.0.0 > = > = > _______________________________________________ > Xen-devel mailing list > Xen-devel@lists.xen.org > http://lists.xen.org/xen-devel > = -- = Samuel un driver qui fait quoi, alors ? ben pour les bips pour passer les oops en morse -+- #ens-mim - vive les rapports de bug -+-