[Qemu-devel] [PATCH] riscv/cpu: use device_class_set_parent_realize

Mao Zhongyi posted 1 patch 6 years, 11 months ago
Test asan passed
Test checkpatch passed
Test docker-quick@centos7 passed
Test docker-mingw@fedora passed
Test docker-clang@ubuntu passed
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/20181126032038.22044-1-maozhongyi@cmss.chinamobile.com
target/riscv/cpu.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
[Qemu-devel] [PATCH] riscv/cpu: use device_class_set_parent_realize
Posted by Mao Zhongyi 6 years, 11 months ago
Signed-off-by: Mao Zhongyi <maozhongyi@cmss.chinamobile.com>
---
 target/riscv/cpu.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/target/riscv/cpu.c b/target/riscv/cpu.c
index a025a0a3ba..5e8a2cb2ba 100644
--- a/target/riscv/cpu.c
+++ b/target/riscv/cpu.c
@@ -330,8 +330,8 @@ static void riscv_cpu_class_init(ObjectClass *c, void *data)
     CPUClass *cc = CPU_CLASS(c);
     DeviceClass *dc = DEVICE_CLASS(c);
 
-    mcc->parent_realize = dc->realize;
-    dc->realize = riscv_cpu_realize;
+    device_class_set_parent_realize(dc, riscv_cpu_realize,
+                                    &mcc->parent_realize);
 
     mcc->parent_reset = cc->reset;
     cc->reset = riscv_cpu_reset;
-- 
2.17.1




Re: [Qemu-devel] [PATCH] riscv/cpu: use device_class_set_parent_realize
Posted by Bastian Koppelmann 6 years, 11 months ago
On 11/26/18 4:20 AM, Mao Zhongyi wrote:
> Signed-off-by: Mao Zhongyi <maozhongyi@cmss.chinamobile.com>
> ---
>   target/riscv/cpu.c | 4 ++--
>   1 file changed, 2 insertions(+), 2 deletions(-)
>

Reviewed-by: Bastian Koppelmann <kbastian@mail.uni-paderborn.de>

Cheers,

Bastian


Re: [Qemu-devel] [PATCH] riscv/cpu: use device_class_set_parent_realize
Posted by Palmer Dabbelt 6 years, 11 months ago
On Mon, 26 Nov 2018 01:06:33 PST (-0800), Bastian Koppelmann wrote:
> On 11/26/18 4:20 AM, Mao Zhongyi wrote:
>> Signed-off-by: Mao Zhongyi <maozhongyi@cmss.chinamobile.com>
>> ---
>>   target/riscv/cpu.c | 4 ++--
>>   1 file changed, 2 insertions(+), 2 deletions(-)
>>
>
> Reviewed-by: Bastian Koppelmann <kbastian@mail.uni-paderborn.de>

Shouldn't we also use device_class_set_parent_reset right below this?  Either
way, I'll queue this one for 3.2.

Thanks!

Re: [Qemu-devel] [PATCH] riscv/cpu: use device_class_set_parent_realize
Posted by maozy 6 years, 11 months ago
Hi, Palmer

On 11/28/18 8:34 AM, Palmer Dabbelt wrote:
> On Mon, 26 Nov 2018 01:06:33 PST (-0800), Bastian Koppelmann wrote:
>> On 11/26/18 4:20 AM, Mao Zhongyi wrote:
>>> Signed-off-by: Mao Zhongyi <maozhongyi@cmss.chinamobile.com>
>>> ---
>>>   target/riscv/cpu.c | 4 ++--
>>>   1 file changed, 2 insertions(+), 2 deletions(-)
>>>
>>
>> Reviewed-by: Bastian Koppelmann <kbastian@mail.uni-paderborn.de>
> 
> Shouldn't we also use device_class_set_parent_reset right below this?  

device_class_set_parent_reset only used for DeviceClass *dc->reset, here
is CPUClass *cc->reset.

Thanks,
Mao

> Either
> way, I'll queue this one for 3.2.
> 
> Thanks!
> 



Re: [Qemu-devel] [PATCH] riscv/cpu: use device_class_set_parent_realize
Posted by Palmer Dabbelt 6 years, 11 months ago
On Tue, 27 Nov 2018 17:46:04 PST (-0800), maozhongyi@cmss.chinamobile.com wrote:
> Hi, Palmer
>
> On 11/28/18 8:34 AM, Palmer Dabbelt wrote:
>> On Mon, 26 Nov 2018 01:06:33 PST (-0800), Bastian Koppelmann wrote:
>>> On 11/26/18 4:20 AM, Mao Zhongyi wrote:
>>>> Signed-off-by: Mao Zhongyi <maozhongyi@cmss.chinamobile.com>
>>>> ---
>>>>   target/riscv/cpu.c | 4 ++--
>>>>   1 file changed, 2 insertions(+), 2 deletions(-)
>>>>
>>>
>>> Reviewed-by: Bastian Koppelmann <kbastian@mail.uni-paderborn.de>
>>
>> Shouldn't we also use device_class_set_parent_reset right below this?
>
> device_class_set_parent_reset only used for DeviceClass *dc->reset, here
> is CPUClass *cc->reset.

Ah, OK, I didn't look closely enough.

> Thanks,
> Mao
>
>> Either
>> way, I'll queue this one for 3.2.
>>
>> Thanks!
>>

Re: [Qemu-devel] [PATCH] riscv/cpu: use device_class_set_parent_realize
Posted by Alistair Francis 6 years, 11 months ago
On Sun, Nov 25, 2018 at 7:21 PM Mao Zhongyi
<maozhongyi@cmss.chinamobile.com> wrote:
>
> Signed-off-by: Mao Zhongyi <maozhongyi@cmss.chinamobile.com>

Reviewed-by: Alistair Francis <alistair.francis@wdc.com>

Alistair

> ---
>  target/riscv/cpu.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/target/riscv/cpu.c b/target/riscv/cpu.c
> index a025a0a3ba..5e8a2cb2ba 100644
> --- a/target/riscv/cpu.c
> +++ b/target/riscv/cpu.c
> @@ -330,8 +330,8 @@ static void riscv_cpu_class_init(ObjectClass *c, void *data)
>      CPUClass *cc = CPU_CLASS(c);
>      DeviceClass *dc = DEVICE_CLASS(c);
>
> -    mcc->parent_realize = dc->realize;
> -    dc->realize = riscv_cpu_realize;
> +    device_class_set_parent_realize(dc, riscv_cpu_realize,
> +                                    &mcc->parent_realize);
>
>      mcc->parent_reset = cc->reset;
>      cc->reset = riscv_cpu_reset;
> --
> 2.17.1
>
>
>
>