[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH v5 0/9] Clock framework API.
Re: [Qemu-devel] [PATCH v5 0/9] Clock framework API.
Tue, 18 Dec 2018 16:24:54 +0100
Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.3.1
On 10/16/18 5:48 PM, Peter Maydell wrote:
> On 12 October 2018 at 16:26, Damien Hedde <address@hidden> wrote:
>> Hi Peter,
>> Sorry to bother you with this, but you said some time ago you would
>> write something about reset.
> Yeah, sorry about that. I haven't found (made) the time to think
> the issues through yet. Let me just dump to email the notes I had.
> This is a very "raw" set of notes, so it's not very organised and
> has a lot of 'todo' bits in it...
> Overall question -- does anybody know of other device modelling
> systems that do a good job of modelling reset, and how they do it?
> If we can borrow a proven design that might be better tha
> thrashing one out ourseles...
> My idea was roughly that we need a multi-phase reset, something like:
> PHASE 1:
> Devices reset internal state. No calls out to other devices
> (ie no setting IRQ line state, etc)
> Some common bit of code (dev base class?) marks the device
> reset as being in-progress by setting dev->resetting = true.
> PHASE 2:
> Devices update their output lines (calls to irq line setting
> functions, clock setting, etc)
> In this phase devices may be the recipients of callbacks for
> IRQ line level changes, etc, and must cope with this. A
> callback can tell it's being called for a level change during
> reset because dev->resetting will be true.
> (They can update their own outputs in response to input changes.)
> PHASE 3:
> Common code (dev base class) sets dev->resetting = false.
> (Individual devices don't get to do anything here, unless
> there's some painful case that requires it.)
> The theory is that by decoupling reset into multiple phases
> we can avoid most of the reset order issues, by having the
> two ends do things in the right phase and/or by having
> the destination end be able to identify when a change is
> happening in the middle of reset.
This strategy seems fine to me.
> Compatibility with existing device reset methods:
> essentially the current rules are the same as the "phase 1"
> rules, so we can just say that the current reset code in
> all devices is phase 1 reset. Then we can adjust anything
> that needs a phase 2 (which is probably not all that many
> Places where reset order currently matters:
> (this is just a list of things we should make sure our design
> copes with)
> * wired-high IRQ lines, and device outputs that are asserted
> as the device comes out of reset
> * setting PC in the generic-loader device vs CPU reset
> * image load (rom image reset) vs Arm M-profile reset wanting
> to read the reset PC/SP from memory
> * Arm M-profile CPUs should have INITVTOR as a config signal input
> * x86 CPU vs APIC reset order ??
> * anything else?
> We should have some sort of "reset domain" object which can
> contain devices and also other reset domains. A reset domain's
> reset is simple: its phase 1 reset is "for each child, do
> phase 1 reset for that child", similarly for phases 2 and 3.
> A reset domain has an overall "reset" method that says
> "do phase 1 for all children, then phase 2, then phase 3".
> This allows things like "this SoC has a reset line which
> resets all its internal devices". (Do we want to give
> reset domains input gpio lines to trigger reset, or is
> being able to call a method on it sufficient?)
Consider the following use case: a platform with a controller that holds
a reset line on another device (starting with reset held).
At the beginning, the main (cold) reset will be triggered to start the
platform. During phase 2, the controller will set the reset line of the
other device (a gpio). Then we have phase 3. How do we handle this ?
Do we need to "delay" the phase 3 of the device until the controller
releases its reset line or do we consider the internal gpio reset line
to be outside of this reset scope ?
If we do that, we have 2 reset "sources": the main reset and the
internal gpio and there is some kind of OR operation to do between these
> At the moment we have reset methods on devices:
> * each bus handles reset for the things on the bus
> * the (one and only) sysbus resets all the sysbus devices
> * devices on no bus don't get reset at all unless something
> takes special measures! (notably the CPUs are reset in
> a very ad-hoc way at the moment)
> I guess this should be cleaned up by making each bus be
> a 'reset domain', and having a "system" reset domain which gets
> anything which doesn't have a parent reset domain (and which
> we then use for whole-board power-on reset). Calling the
> system reset domain's overall reset method will then do
> the 3-phase reset for everything>
> How would direct qemu_register_reset() calls fit into this
> scheme? (Some of them are devices that could get QOM reset
> methods instead. Perhaps we could get away with dumping the
> rest into the 'master reset' domain, or leaving them as-is?
> Some are for CPU reset which we definitely should clean up.)
> We need to handle different types of reset somehow, in
> particular "cold/power on reset" versus "warm reset".
> Can we do this just with reset domain objects, or do we
> need/want to pass each device's reset method a "type" argument?
Maybe phase 1 only needs the type, phase 2 and 3 can only depends on the
Anyway, this reset problem seems outside of the scope of this patch set.
I think I'll do a reroll with the remark I've got so far, but it will
still miss the reset part to be well integrated. I can also propose
something in another rfc about the 3-phase reset to advance on that part.
|[Prev in Thread]
||[Next in Thread]|
- Re: [Qemu-devel] [PATCH v5 0/9] Clock framework API.,
Damien Hedde <=