* [PATCH 1/4] IA64: hpsim, fix SAL handling in fw-emu
@ 2012-02-24 11:10 Jiri Slaby
2012-02-24 11:10 ` [PATCH 2/4] IA64: simserial, include some headers Jiri Slaby
` (3 more replies)
0 siblings, 4 replies; 8+ messages in thread
From: Jiri Slaby @ 2012-02-24 11:10 UTC (permalink / raw)
To: tony.luck; +Cc: fenghua.yu, linux-ia64, linux-kernel, jirislaby
The switch-cases of SAL_FREQ_BASE generate non-relocatable code. The
same as for the ifs one level upper. This causes oopses early in boot
because the kernel jumps to the hell instead of the offset in sal
callback.
So use ifs here for SAL_FREQ_BASE decision too.
Isn't there any compiler directive or settings to solve that cleanly?
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
arch/ia64/hp/sim/boot/fw-emu.c | 17 ++++-------------
1 files changed, 4 insertions(+), 13 deletions(-)
diff --git a/arch/ia64/hp/sim/boot/fw-emu.c b/arch/ia64/hp/sim/boot/fw-emu.c
index bf6d9d8..0216e28 100644
--- a/arch/ia64/hp/sim/boot/fw-emu.c
+++ b/arch/ia64/hp/sim/boot/fw-emu.c
@@ -160,28 +160,19 @@ sal_emulator (long index, unsigned long in1, unsigned long in2,
*/
status = 0;
if (index == SAL_FREQ_BASE) {
- switch (in1) {
- case SAL_FREQ_BASE_PLATFORM:
+ if (in1 == SAL_FREQ_BASE_PLATFORM)
r9 = 200000000;
- break;
-
- case SAL_FREQ_BASE_INTERVAL_TIMER:
+ else if (in1 == SAL_FREQ_BASE_INTERVAL_TIMER) {
/*
* Is this supposed to be the cr.itc frequency
* or something platform specific? The SAL
* doc ain't exactly clear on this...
*/
r9 = 700000000;
- break;
-
- case SAL_FREQ_BASE_REALTIME_CLOCK:
+ } else if (in1 == SAL_FREQ_BASE_REALTIME_CLOCK)
r9 = 1;
- break;
-
- default:
+ else
status = -1;
- break;
- }
} else if (index == SAL_SET_VECTORS) {
;
} else if (index == SAL_GET_STATE_INFO) {
--
1.7.9
^ permalink raw reply related [flat|nested] 8+ messages in thread* [PATCH 2/4] IA64: simserial, include some headers 2012-02-24 11:10 [PATCH 1/4] IA64: hpsim, fix SAL handling in fw-emu Jiri Slaby @ 2012-02-24 11:10 ` Jiri Slaby 2012-02-24 11:10 ` [PATCH 3/4] IA64: hpsim, initialize chip for assigned irqs Jiri Slaby ` (2 subsequent siblings) 3 siblings, 0 replies; 8+ messages in thread From: Jiri Slaby @ 2012-02-24 11:10 UTC (permalink / raw) To: tony.luck; +Cc: fenghua.yu, linux-ia64, linux-kernel, jirislaby And remove declarations which are already in the headers. Signed-off-by: Jiri Slaby <jslaby@suse.cz> --- arch/ia64/hp/sim/simserial.c | 8 +++----- 1 files changed, 3 insertions(+), 5 deletions(-) diff --git a/arch/ia64/hp/sim/simserial.c b/arch/ia64/hp/sim/simserial.c index bff0824..974cac8 100644 --- a/arch/ia64/hp/sim/simserial.c +++ b/arch/ia64/hp/sim/simserial.c @@ -34,9 +34,12 @@ #include <linux/sysrq.h> #include <asm/irq.h> +#include <asm/hpsim.h> #include <asm/hw_irq.h> #include <asm/uaccess.h> +#include "hpsim_ssc.h" + #undef SIMSERIAL_DEBUG /* define this to get some debug information */ #define KEYBOARD_INTR 3 /* must match with simulator! */ @@ -45,11 +48,6 @@ #define IRQ_T(info) ((info->flags & ASYNC_SHARE_IRQ) ? IRQF_SHARED : IRQF_DISABLED) -#define SSC_GETCHAR 21 - -extern long ia64_ssc (long, long, long, long, int); -extern void ia64_ssc_connect_irq (long intr, long irq); - static char *serial_name = "SimSerial driver"; static char *serial_version = "0.6"; -- 1.7.9 ^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH 3/4] IA64: hpsim, initialize chip for assigned irqs 2012-02-24 11:10 [PATCH 1/4] IA64: hpsim, fix SAL handling in fw-emu Jiri Slaby 2012-02-24 11:10 ` [PATCH 2/4] IA64: simserial, include some headers Jiri Slaby @ 2012-02-24 11:10 ` Jiri Slaby 2012-02-24 11:10 ` [PATCH 4/4] IA64: simserial, bail out when request_irq fails Jiri Slaby 2012-02-24 22:32 ` [PATCH 1/4] IA64: hpsim, fix SAL handling in fw-emu Tony Luck 3 siblings, 0 replies; 8+ messages in thread From: Jiri Slaby @ 2012-02-24 11:10 UTC (permalink / raw) To: tony.luck; +Cc: fenghua.yu, linux-ia64, linux-kernel, jirislaby Currently, when assign_irq_vector is called and the irq connected in the simulator, the irq is not ready. request_irq will return ENOSYS immediately. It is because the irq chip is unset. Hence set the chip properly to irq_type_hp_sim. And make sure this is done from both users of simulated interrupts. Also we have to set handler here, otherwise we end up in handle_bad_int resulting in spam in logs and no irqs handled. We use handle_simple_irq as these are SW interrupts that need no ACK or anything. Signed-off-by: Jiri Slaby <jslaby@suse.cz> --- arch/ia64/hp/sim/hpsim_irq.c | 36 ++++++++++++++++++++++++++++++------ arch/ia64/hp/sim/hpsim_setup.c | 6 ------ arch/ia64/hp/sim/simeth.c | 19 +++---------------- arch/ia64/hp/sim/simserial.c | 3 +-- arch/ia64/include/asm/hpsim.h | 2 +- 5 files changed, 35 insertions(+), 31 deletions(-) diff --git a/arch/ia64/hp/sim/hpsim_irq.c b/arch/ia64/hp/sim/hpsim_irq.c index 4bd9a63..0aa70eb 100644 --- a/arch/ia64/hp/sim/hpsim_irq.c +++ b/arch/ia64/hp/sim/hpsim_irq.c @@ -10,6 +10,8 @@ #include <linux/sched.h> #include <linux/irq.h> +#include "hpsim_ssc.h" + static unsigned int hpsim_irq_startup(struct irq_data *data) { @@ -37,15 +39,37 @@ static struct irq_chip irq_type_hp_sim = { .irq_set_affinity = hpsim_set_affinity_noop, }; +static void hpsim_irq_set_chip(int irq) +{ + struct irq_chip *chip = irq_get_chip(irq); + + if (chip == &no_irq_chip) + irq_set_chip(irq, &irq_type_hp_sim); +} + +static void hpsim_connect_irq(int intr, int irq) +{ + ia64_ssc(intr, irq, 0, 0, SSC_CONNECT_INTERRUPT); +} + +int hpsim_get_irq(int intr) +{ + int irq = assign_irq_vector(AUTO_ASSIGN); + + if (irq >= 0) { + hpsim_irq_set_chip(irq); + irq_set_handler(irq, handle_simple_irq); + hpsim_connect_irq(intr, irq); + } + + return irq; +} + void __init hpsim_irq_init (void) { int i; - for_each_active_irq(i) { - struct irq_chip *chip = irq_get_chip(i); - - if (chip == &no_irq_chip) - irq_set_chip(i, &irq_type_hp_sim); - } + for_each_active_irq(i) + hpsim_irq_set_chip(i); } diff --git a/arch/ia64/hp/sim/hpsim_setup.c b/arch/ia64/hp/sim/hpsim_setup.c index f629e90..664a540 100644 --- a/arch/ia64/hp/sim/hpsim_setup.c +++ b/arch/ia64/hp/sim/hpsim_setup.c @@ -26,12 +26,6 @@ #include "hpsim_ssc.h" void -ia64_ssc_connect_irq (long intr, long irq) -{ - ia64_ssc(intr, irq, 0, 0, SSC_CONNECT_INTERRUPT); -} - -void ia64_ctl_trace (long on) { ia64_ssc(on, 0, 0, 0, SSC_CTL_TRACE); diff --git a/arch/ia64/hp/sim/simeth.c b/arch/ia64/hp/sim/simeth.c index 47afcc6..e343357 100644 --- a/arch/ia64/hp/sim/simeth.c +++ b/arch/ia64/hp/sim/simeth.c @@ -129,17 +129,6 @@ netdev_probe(char *name, unsigned char *ether) static inline int -netdev_connect(int irq) -{ - /* XXX Fix me - * this does not support multiple cards - * also no return value - */ - ia64_ssc_connect_irq(NETWORK_INTR, irq); - return 0; -} - -static inline int netdev_attach(int fd, int irq, unsigned int ipaddr) { /* this puts the host interface in the right mode (start interrupting) */ @@ -226,15 +215,13 @@ simeth_probe1(void) return err; } - if ((rc = assign_irq_vector(AUTO_ASSIGN)) < 0) - panic("%s: out of interrupt vectors!\n", __func__); - dev->irq = rc; - /* * attach the interrupt in the simulator, this does enable interrupts * until a netdev_attach() is called */ - netdev_connect(dev->irq); + if ((rc = hpsim_get_irq(NETWORK_INTR)) < 0) + panic("%s: out of interrupt vectors!\n", __func__); + dev->irq = rc; printk(KERN_INFO "%s: hosteth=%s simfd=%d, HwAddr", dev->name, simeth_device, local->simfd); diff --git a/arch/ia64/hp/sim/simserial.c b/arch/ia64/hp/sim/simserial.c index 974cac8..797e89a 100644 --- a/arch/ia64/hp/sim/simserial.c +++ b/arch/ia64/hp/sim/simserial.c @@ -947,11 +947,10 @@ simrs_init (void) if (state->type == PORT_UNKNOWN) continue; if (!state->irq) { - if ((rc = assign_irq_vector(AUTO_ASSIGN)) < 0) + if ((rc = hpsim_get_irq(KEYBOARD_INTR)) < 0) panic("%s: out of interrupt vectors!\n", __func__); state->irq = rc; - ia64_ssc_connect_irq(KEYBOARD_INTR, state->irq); } printk(KERN_INFO "ttyS%d at 0x%04lx (irq = %d) is a %s\n", diff --git a/arch/ia64/include/asm/hpsim.h b/arch/ia64/include/asm/hpsim.h index 892ab19..0fe5022 100644 --- a/arch/ia64/include/asm/hpsim.h +++ b/arch/ia64/include/asm/hpsim.h @@ -10,7 +10,7 @@ int simcons_register(void); struct tty_driver; extern struct tty_driver *hp_simserial_driver; -void ia64_ssc_connect_irq(long intr, long irq); +extern int hpsim_get_irq(int intr); void ia64_ctl_trace(long on); #endif -- 1.7.9 ^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH 4/4] IA64: simserial, bail out when request_irq fails 2012-02-24 11:10 [PATCH 1/4] IA64: hpsim, fix SAL handling in fw-emu Jiri Slaby 2012-02-24 11:10 ` [PATCH 2/4] IA64: simserial, include some headers Jiri Slaby 2012-02-24 11:10 ` [PATCH 3/4] IA64: hpsim, initialize chip for assigned irqs Jiri Slaby @ 2012-02-24 11:10 ` Jiri Slaby 2012-02-24 22:32 ` [PATCH 1/4] IA64: hpsim, fix SAL handling in fw-emu Tony Luck 3 siblings, 0 replies; 8+ messages in thread From: Jiri Slaby @ 2012-02-24 11:10 UTC (permalink / raw) To: tony.luck; +Cc: fenghua.yu, linux-ia64, linux-kernel, jirislaby Without this, the code succeeds when the port is opened by root and we get unwanted interrupts storm on the first key stroke. Instead of that, tell the user we failed and that we won't continue. I suppose, the code was copied from the serial layer where we may want to change the irq number, so we must allow open even of the failing port. This is not the case for this driver at all. Signed-off-by: Jiri Slaby <jslaby@suse.cz> --- arch/ia64/hp/sim/simserial.c | 9 +-------- 1 files changed, 1 insertions(+), 8 deletions(-) diff --git a/arch/ia64/hp/sim/simserial.c b/arch/ia64/hp/sim/simserial.c index 797e89a..60c9093 100644 --- a/arch/ia64/hp/sim/simserial.c +++ b/arch/ia64/hp/sim/simserial.c @@ -702,15 +702,8 @@ startup(struct async_struct *info) handler = rs_interrupt_single; retval = request_irq(state->irq, handler, IRQ_T(info), "simserial", NULL); - if (retval) { - if (capable(CAP_SYS_ADMIN)) { - if (info->tty) - set_bit(TTY_IO_ERROR, - &info->tty->flags); - retval = 0; - } + if (retval) goto errout; - } } /* -- 1.7.9 ^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH 1/4] IA64: hpsim, fix SAL handling in fw-emu 2012-02-24 11:10 [PATCH 1/4] IA64: hpsim, fix SAL handling in fw-emu Jiri Slaby ` (2 preceding siblings ...) 2012-02-24 11:10 ` [PATCH 4/4] IA64: simserial, bail out when request_irq fails Jiri Slaby @ 2012-02-24 22:32 ` Tony Luck 2012-02-24 22:44 ` Jiri Slaby 3 siblings, 1 reply; 8+ messages in thread From: Tony Luck @ 2012-02-24 22:32 UTC (permalink / raw) To: Jiri Slaby; +Cc: fenghua.yu, linux-ia64, linux-kernel, jirislaby Are these four patches the only things needed to get the kernel running on the simulator? I've been building sim_defconfig as part of my regular "did things break" cycle. But I haven't tried to boot in well over five years. -Tony ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 1/4] IA64: hpsim, fix SAL handling in fw-emu 2012-02-24 22:32 ` [PATCH 1/4] IA64: hpsim, fix SAL handling in fw-emu Tony Luck @ 2012-02-24 22:44 ` Jiri Slaby 0 siblings, 0 replies; 8+ messages in thread From: Jiri Slaby @ 2012-02-24 22:44 UTC (permalink / raw) To: Tony Luck; +Cc: Jiri Slaby, fenghua.yu, linux-ia64, linux-kernel On 02/24/2012 11:32 PM, Tony Luck wrote: > Are these four patches the only things needed to get the kernel > running on the simulator? I've been building sim_defconfig as > part of my regular "did things break" cycle. But I haven't tried to > boot in well over five years. Yes, it works fine for me. I'm using busybox as userspace. From SLES 11 SP2. I was using it to test tty patches applied to simserial. My .config differs from sim_defconfig though. I didn't know there is a defconfig for HP simulator. So I configured the kernel from scratch with help of menuconfig. thanks, -- js suse labs ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 00/68] TTY buffer in tty_port -- prep no. 1
@ 2012-03-08 19:50 Greg KH
2012-03-08 20:01 ` [PATCH 1/4] [IA64] hpsim, fix SAL handling in fw-emu Jiri Slaby
0 siblings, 1 reply; 8+ messages in thread
From: Greg KH @ 2012-03-08 19:50 UTC (permalink / raw)
To: Jiri Slaby; +Cc: alan, linux-serial, linux-kernel, jirislaby
On Mon, Mar 05, 2012 at 02:51:47PM +0100, Jiri Slaby wrote:
> Hi,
>
> this is the first series of patches which allow tty buffers to be
> moved from tty_struct (present from open to close/hangup) to tty_port
> (present as long as the device). This will allow us to get rid of the
> tty refcounting in the interrupt service routines and other hot paths
> after we are done. This is because we won't need to handle races among
> ISRs, timers, hangups and others, because tty_port lives as long as an
> interrupt/timer tick may occur. Unlike tty_struct.
>
> In this series, only first few drivers are converted to use
> tty_port. The rest is to come later.
>
> The first few patches are simple fixes/cleanups which emerged during
> the code investigation here and there. Further serialP header removal
> happens there. Finally, some drivers are forced to use tty_port, which
> will become a necessity in the future.
>
> Simserial (ia64) and standard x86 stuff were runtime-tested. The rest
> is only checked to be compilation-errors free.
>
> Final remark: simserial stuff depends on 4 patches sent to Tony Luck
> last week. They are in hist tree and -next already.
Where are those patches at specifically? Can you send them to me so I
could include them in my tree? Otherwise I can only apply the first 27
of these patches (which I have now done.)
thanks,
greg k-h
^ permalink raw reply [flat|nested] 8+ messages in thread* [PATCH 1/4] [IA64] hpsim, fix SAL handling in fw-emu 2012-03-08 19:50 [PATCH 00/68] TTY buffer in tty_port -- prep no. 1 Greg KH @ 2012-03-08 20:01 ` Jiri Slaby 2012-03-08 20:29 ` Greg KH 0 siblings, 1 reply; 8+ messages in thread From: Jiri Slaby @ 2012-03-08 20:01 UTC (permalink / raw) To: gregkh; +Cc: alan, linux-kernel The switch-cases of SAL_FREQ_BASE generate non-relocatable code. The same as for the ifs one level upper. This causes oopses early in boot because the kernel jumps to the hell instead of the offset in sal callback. So use ifs here for SAL_FREQ_BASE decision too. Isn't there any compiler directive or settings to solve that cleanly? Signed-off-by: Jiri Slaby <jslaby@suse.cz> Signed-off-by: Tony Luck <tony.luck@intel.com> --- arch/ia64/hp/sim/boot/fw-emu.c | 17 ++++------------- 1 file changed, 4 insertions(+), 13 deletions(-) diff --git a/arch/ia64/hp/sim/boot/fw-emu.c b/arch/ia64/hp/sim/boot/fw-emu.c index bf6d9d8..0216e28 100644 --- a/arch/ia64/hp/sim/boot/fw-emu.c +++ b/arch/ia64/hp/sim/boot/fw-emu.c @@ -160,28 +160,19 @@ sal_emulator (long index, unsigned long in1, unsigned long in2, */ status = 0; if (index == SAL_FREQ_BASE) { - switch (in1) { - case SAL_FREQ_BASE_PLATFORM: + if (in1 == SAL_FREQ_BASE_PLATFORM) r9 = 200000000; - break; - - case SAL_FREQ_BASE_INTERVAL_TIMER: + else if (in1 == SAL_FREQ_BASE_INTERVAL_TIMER) { /* * Is this supposed to be the cr.itc frequency * or something platform specific? The SAL * doc ain't exactly clear on this... */ r9 = 700000000; - break; - - case SAL_FREQ_BASE_REALTIME_CLOCK: + } else if (in1 == SAL_FREQ_BASE_REALTIME_CLOCK) r9 = 1; - break; - - default: + else status = -1; - break; - } } else if (index == SAL_SET_VECTORS) { ; } else if (index == SAL_GET_STATE_INFO) { -- 1.7.9.2 ^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH 1/4] [IA64] hpsim, fix SAL handling in fw-emu 2012-03-08 20:01 ` [PATCH 1/4] [IA64] hpsim, fix SAL handling in fw-emu Jiri Slaby @ 2012-03-08 20:29 ` Greg KH 0 siblings, 0 replies; 8+ messages in thread From: Greg KH @ 2012-03-08 20:29 UTC (permalink / raw) To: Jiri Slaby; +Cc: alan, linux-kernel On Thu, Mar 08, 2012 at 09:01:16PM +0100, Jiri Slaby wrote: > The switch-cases of SAL_FREQ_BASE generate non-relocatable code. The > same as for the ifs one level upper. This causes oopses early in boot > because the kernel jumps to the hell instead of the offset in sal > callback. > > So use ifs here for SAL_FREQ_BASE decision too. > > Isn't there any compiler directive or settings to solve that cleanly? > > Signed-off-by: Jiri Slaby <jslaby@suse.cz> > Signed-off-by: Tony Luck <tony.luck@intel.com> <snip> Thanks for these, that works, I'll get back to applying the reset of your series. greg k-h ^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2012-03-08 20:30 UTC | newest] Thread overview: 8+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2012-02-24 11:10 [PATCH 1/4] IA64: hpsim, fix SAL handling in fw-emu Jiri Slaby 2012-02-24 11:10 ` [PATCH 2/4] IA64: simserial, include some headers Jiri Slaby 2012-02-24 11:10 ` [PATCH 3/4] IA64: hpsim, initialize chip for assigned irqs Jiri Slaby 2012-02-24 11:10 ` [PATCH 4/4] IA64: simserial, bail out when request_irq fails Jiri Slaby 2012-02-24 22:32 ` [PATCH 1/4] IA64: hpsim, fix SAL handling in fw-emu Tony Luck 2012-02-24 22:44 ` Jiri Slaby -- strict thread matches above, loose matches on Subject: below -- 2012-03-08 19:50 [PATCH 00/68] TTY buffer in tty_port -- prep no. 1 Greg KH 2012-03-08 20:01 ` [PATCH 1/4] [IA64] hpsim, fix SAL handling in fw-emu Jiri Slaby 2012-03-08 20:29 ` Greg KH
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox