All of lore.kernel.org
 help / color / mirror / Atom feed
From: Paolo Bonzini <pbonzini@redhat.com>
To: Peter Maydell <peter.maydell@linaro.org>
Cc: dwmw2@infradead.org, aliguori@us.ibm.com, lersek@redhat.com,
	qemu-devel@nongnu.org, afaerber@suse.de
Subject: Re: [Qemu-devel] [PATCH v2 1/3] cpu: make CPU_INTERRUPT_RESET available on all targets
Date: Wed, 06 Mar 2013 09:49:27 +0100	[thread overview]
Message-ID: <51370317.2000709@redhat.com> (raw)
In-Reply-To: <CAFEAcA86cv3OriD+7gdGVbEZdPgL9n3mxdR8FDddLM1wkxepCg@mail.gmail.com>

Il 06/03/2013 00:23, Peter Maydell ha scritto:
> On 6 March 2013 03:00, Paolo Bonzini <pbonzini@redhat.com> wrote:
>> On the x86, some devices need access to the CPU reset pin (INIT#).
>> Provide a generic service to do this, using one of the internal
>> cpu_interrupt targets.  Generalize the PPC-specific code for
>> CPU_INTERRUPT_RESET to other targets, and provide a function that
>> will raise the interrupt on all CPUs.
> 
> Not sure this makes sense -- reset isn't an interrupt...

cpu_interrupt is not just for interrupts, CPU_INTERRUPT_TGT_INT_* is a
generic mechanism for adding events to the CPU that have to exit the
translation block (they do not even have to be input pins, though
CPU_INTERRUPT_RESET is).  This patch just takes one particular
CPU_INTERRUPT_TGT_INT_* value and makes it available to all targets.

It is important for the reset to exit the translation block, or the CPU
goes into the weeds.  The problem I was seeing is that the code looked like:

    mov $0xfe, %al
    out %al, $0x60
    jmp foo           // this is a relative jump
...
foo:
    cli
    hlt

Now, if the reset were synchronous (i.e. cpu_reset), it would modify the
stored PC to 0xfffffff0 without leaving the translation block.
Because the jump is relative, it would go to 0xfffffff0 + the offset
instead of jumping to foo.

This could also be implemented by something like this:

    run_on_cpu(cpu, cpu_reset);
    cpu_interrupt(cpu, CPU_INTERRUPT_EXITTB);

But I preferred to reuse the existing logic (there would be some
additional complication because the x86 INIT signal does _not_ reset a
couple of things that are reset at power up).

Paolo

  reply	other threads:[~2013-03-06  8:49 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-03-05 19:00 [Qemu-devel] [PATCH v2 0/3] Implement x86 soft reset Paolo Bonzini
2013-03-05 19:00 ` [Qemu-devel] [PATCH v2 1/3] cpu: make CPU_INTERRUPT_RESET available on all targets Paolo Bonzini
2013-03-05 23:23   ` Peter Maydell
2013-03-06  8:49     ` Paolo Bonzini [this message]
2013-03-06  2:02   ` Peter Crosthwaite
2013-03-06  9:13     ` Paolo Bonzini
2013-03-06 11:54       ` Andreas Färber
2013-03-06 12:12       ` Peter Maydell
2013-03-06 12:19         ` Paolo Bonzini
2013-03-05 19:00 ` [Qemu-devel] [PATCH v2 2/3] pc: port 92 reset requires a low->high transition Paolo Bonzini
2013-03-05 19:00 ` [Qemu-devel] [PATCH v2 3/3] hw: correctly implement soft reset Paolo Bonzini
2013-03-06  2:02   ` li guang
2013-03-06  8:36     ` Paolo Bonzini
2013-03-06  9:06       ` li guang
2013-03-06  9:23         ` Paolo Bonzini
2013-03-05 19:35 ` [Qemu-devel] [PATCH v2 0/3] Implement x86 " Laszlo Ersek

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=51370317.2000709@redhat.com \
    --to=pbonzini@redhat.com \
    --cc=afaerber@suse.de \
    --cc=aliguori@us.ibm.com \
    --cc=dwmw2@infradead.org \
    --cc=lersek@redhat.com \
    --cc=peter.maydell@linaro.org \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.