qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: tsnsaito@gmail.com
To: Artyom Tarasenko <atar4qemu@gmail.com>
Cc: blauwirbel@gmail.com, qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH] fix disabling interrupts in sun4u
Date: Fri, 29 Jul 2011 10:21:17 +0900	[thread overview]
Message-ID: <4e320b10.0222440a.61f2.6c8c@mx.google.com> (raw)
In-Reply-To: <CACXAS8DTvpdp603xPsehm=H5=0Tg78pfuCwsrt4BH9iSa=2niQ@mail.gmail.com>

At Thu, 28 Jul 2011 16:44:23 +0200,
Artyom Tarasenko wrote:
> On Thu, Jul 28, 2011 at 3:40 PM,  <tsnsaito@gmail.com> wrote:
> > At Thu, 28 Jul 2011 14:50:57 +0200,
> > Artyom Tarasenko wrote:
> >> On Thu, Jul 28, 2011 at 2:03 PM,  <tsnsaito@gmail.com> wrote:
> >> > At Thu, 28 Jul 2011 13:51:08 +0200,
> >> > Artyom Tarasenko wrote:
> >> >> On Thu, Jul 28, 2011 at 12:31 PM,  <tsnsaito@gmail.com> wrote:
> >> Do you have objections to this patch in its current form?
> >
> > No, I don't have any objections.
> >
> >> > The interrupts from APB would be reported by cpu_set_irq(),
> >> > but cpu_set_irq() seems to generate interrupt_vector_n traps.
> >>
> >> For me it's not obvious. The interrupt vector not just one line, but
> >> the vector, which is written in the corresponding CPU register (also
> >> missing in the current qemu implementation). On the real hardware the
> >> vector is created by the IOMMU (PBM/APB/...). If qemu intends to
> >> support multiple chipsets, we should keep it the way it's done on the
> >> real hardware (for instance the interrupt vectors for on-board devices
> >> on Ultra-1 and E6500 are not the same).
> >
> > Sorry, I can't keep up with this vector thing...
> > Does the CPU receive hardware interrupts as interrupt_vector traps
> > (trap type=0x60) regardless of the kind of the interrupt controller,
> > doesn't it?
> 
> It does indeed, but it also stores the interrupt vector identifying
> the initiator device, in a CPU register readable with asi 0x7f .
> What would APB pass to the cpu_set_irq? I see the three following variants:
> 
> a) it passes the PCI interrupt id, which is translated to the
> interrupt vector in cpu_set_irq()
> b) it passes the vector. This implies that 2048 (0-0x7ff) CPU
> interrupts have to be allocated.
> c) hack combining a+b: allocate only the interrupts known to be used
> and translate an internal interrupt id to a vector.
> 
> The variant "a" is bad because it doesn't allow support for different
> chipsets. The variant "b" is bad because qemu has to allocate way too
> many interrupts. Only few of them will be used actually. The variant
> "c" is bad, well, because it's a hack.
> 
> That's why I suggest using another interface between APB and CPU.

Thanks, I understand the reason for introducing a diffent interface
for device interrupts.
It might be difficult to implement the interface as the set_irq callback.

> >> I'd suggest APB shall use some other interface for communicating
> >> interrupts to the CPU. Something like
> >> cpu_receive_ivec(interrupt_vector).
> >>
> >> >> >> Signed-off-by: Artyom Tarasenko <atar4qemu@gmail.com>
> >> >> >> ---
> >> >> >>  hw/sun4u.c |    6 ++++--
> >> >> >>  1 files changed, 4 insertions(+), 2 deletions(-)
> >> >> >>
> >> >> >> diff --git a/hw/sun4u.c b/hw/sun4u.c
> >> >> >> index d7dcaf0..7f95aeb 100644
> >> >> >> --- a/hw/sun4u.c
> >> >> >> +++ b/hw/sun4u.c
> >> >> >> @@ -255,7 +255,7 @@ void cpu_check_irqs(CPUState *env)
> >> >> >>          pil |= 1 << 14;
> >> >> >>      }
> >> >> >>
> >> >> >> -    if (!pil) {
> >> >> >> +    if (pil < (2 << env->psrpil)){
> >> >> >>          if (env->interrupt_request & CPU_INTERRUPT_HARD) {
> >> >> >>              CPUIRQ_DPRINTF("Reset CPU IRQ (current interrupt %x)\n",
> >> >> >>                             env->interrupt_index);
> >> >> >> @@ -287,10 +287,12 @@ void cpu_check_irqs(CPUState *env)
> >> >> >>                  break;
> >> >> >>              }
> >> >> >>          }
> >> >> >> -    } else {
> >> >> >> +    } else if (env->interrupt_request & CPU_INTERRUPT_HARD) {
> >> >> >>          CPUIRQ_DPRINTF("Interrupts disabled, pil=%08x pil_in=%08x softint=%08x "
> >> >> >>                         "current interrupt %x\n",
> >> >> >>                         pil, env->pil_in, env->softint, env->interrupt_index);
> >> >> >> +        env->interrupt_index = 0;
> >> >> >> +        cpu_reset_interrupt(env, CPU_INTERRUPT_HARD);
> >> >> >>      }
> >> >> >>  }
> >> >> >>
> >> >> >> --
> >> >> >> 1.7.3.4
> >> >> >
> >> >> >
> >> >> > ----
> >> >> > Tsuneo Saito <tsnsaito@gmail.com>
> >> >> >
> >> >>
> >> >>
> >> >>
> >> >> --
> >> >> Regards,
> >> >> Artyom Tarasenko
> >> >>
> >> >> solaris/sparc under qemu blog: http://tyom.blogspot.com/
> >> >
> >> > ----
> >> > Tsuneo Saito <tsnsaito@gmail.com>
> >> >
> >>
> >> --
> >> Regards,
> >> Artyom Tarasenko
> >>
> >> solaris/sparc under qemu blog: http://tyom.blogspot.com/
> >
> > ----
> > Tsuneo Saito <tsnsaito@gmail.com>
> >
> 
> 
> 
> -- 
> Regards,
> Artyom Tarasenko
> 
> solaris/sparc under qemu blog: http://tyom.blogspot.com/

----
Tsuneo Saito <tsnsaito@gmail.com>

  reply	other threads:[~2011-07-29  1:21 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-07-25 17:22 [Qemu-devel] [PATCH] fix disabling interrupts in sun4u Artyom Tarasenko
2011-07-28 10:31 ` tsnsaito
2011-07-28 11:51   ` Artyom Tarasenko
2011-07-28 12:03     ` tsnsaito
2011-07-28 12:10       ` Tsuneo Saito
2011-07-28 12:55         ` Artyom Tarasenko
2011-07-28 12:50       ` Artyom Tarasenko
2011-07-28 13:40         ` tsnsaito
2011-07-28 14:44           ` Artyom Tarasenko
2011-07-29  1:21             ` tsnsaito [this message]
2011-07-30  9:28             ` Blue Swirl
2011-07-30  9:09 ` Blue Swirl
2011-07-30 12:31   ` Artyom Tarasenko
2011-07-30 13:25     ` Blue Swirl
2011-07-30 20:19       ` Artyom Tarasenko
2011-07-30 20:32         ` Blue Swirl
2011-07-30 20:58           ` Artyom Tarasenko
2011-07-30 21:13             ` Blue Swirl
2011-08-28 11:39 ` Blue Swirl

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4e320b10.0222440a.61f2.6c8c@mx.google.com \
    --to=tsnsaito@gmail.com \
    --cc=atar4qemu@gmail.com \
    --cc=blauwirbel@gmail.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).