qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH v5 05/13] hw/core/resettable: add support for changing parent


From: Damien Hedde
Subject: Re: [PATCH v5 05/13] hw/core/resettable: add support for changing parent
Date: Mon, 2 Dec 2019 12:43:41 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.2.0


On 11/29/19 7:38 PM, Peter Maydell wrote:
> On Fri, 18 Oct 2019 at 16:07, Damien Hedde <address@hidden> wrote:
>>
>> Add a function resettable_change_parent() to do the required
>> plumbing when changing the parent a of Resettable object.
>>
>> We need to make sure that the reset state of the object remains
>> coherent with the reset state of the new parent.
>>
>> We make the 2 following hypothesis:
>> + when an object is put in a parent under reset, the object goes in
>> reset.
>> + when an object is removed from a parent under reset, the object
>> leaves reset.
>>
>> The added function avoid any glitch if both old and new parent are
>> already in reset.
>>
>> Signed-off-by: Damien Hedde <address@hidden>
>> ---
>>  hw/core/resettable.c    | 54 +++++++++++++++++++++++++++++++++++++++++
>>  hw/core/trace-events    |  1 +
>>  include/hw/resettable.h | 16 ++++++++++++
>>  3 files changed, 71 insertions(+)
>>
>> diff --git a/hw/core/resettable.c b/hw/core/resettable.c
>> index c5e11cff4f..60d4285fcc 100644
>> --- a/hw/core/resettable.c
>> +++ b/hw/core/resettable.c
>> @@ -32,6 +32,14 @@ static void resettable_phase_exit(Object *obj, void 
>> *opaque, ResetType type);
>>   */
>>  static bool enter_phase_in_progress;
>>
>> +/**
>> + * exit_phase_in_progress:
>> + * Flag telling whether we are currently in an enter phase where side
>> + * effects are forbidden. This flag allows us to catch if
>> + * resettable_change_parent() is called during exit phase.
>> + */
>> +static unsigned exit_phase_in_progress;
> 
> This is another global that I don't think we should have.
> Is it also just for asserts ?

Yes. It's only to ensure we don't miss-use the api.

--
Damien





reply via email to

[Prev in Thread] Current Thread [Next in Thread]