qemu-arm
[Top][All Lists]
Advanced

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

RE: [PATCH RFC V2 03/37] hw/arm/virt: Move setting of common CPU propert


From: Salil Mehta
Subject: RE: [PATCH RFC V2 03/37] hw/arm/virt: Move setting of common CPU properties in a function
Date: Tue, 10 Oct 2023 09:47:28 +0000

Hi Shaoqin,

> From: Shaoqin Huang <shahuang@redhat.com>
> Sent: Tuesday, October 10, 2023 7:47 AM
> 
> On 9/26/23 18:04, Salil Mehta via wrote:
> > Factor out CPU properties code common for {hot,cold}-plugged CPUs. This 
> > allows
> > code reuse.
> >
> > Signed-off-by: Salil Mehta <salil.mehta@huawei.com>
> > ---
> >   hw/arm/virt.c         | 220 ++++++++++++++++++++++++++----------------
> >   include/hw/arm/virt.h |   4 +
> >   2 files changed, 140 insertions(+), 84 deletions(-)
> >
> > diff --git a/hw/arm/virt.c b/hw/arm/virt.c
> > index 57fe97c242..0eb6bf5a18 100644
> > --- a/hw/arm/virt.c
> > +++ b/hw/arm/virt.c
> > @@ -2018,16 +2018,130 @@ static void virt_cpu_post_init(VirtMachineState
> *vms, MemoryRegion *sysmem)
> >       }
> >   }
> >
> > +static void virt_cpu_set_properties(Object *cpuobj, const CPUArchId
> *cpu_slot,
> > +                                    Error **errp)
> > +{
> 
> Hi Salil,
> 
> This patch seems break the code, the virt_cpu_set_properties() function
> being defined but not used in this patch, so those original code in the
> machvirt_init() just not work.


Good catch. 

BTW, the change in this patch is intentional as I wanted to clearly show
the move. But I will fix the compilation break in this patch with some
trick.

Thanks for identifying!
Salil.


> We should use this function in the machvirt_init().
> 
> > +    MachineState *ms = MACHINE(qdev_get_machine());
> > +    VirtMachineState *vms = VIRT_MACHINE(ms);
> > +    Error *local_err = NULL;
> > +    VirtMachineClass *vmc;
> > +
> > +    vmc = VIRT_MACHINE_GET_CLASS(ms);
> > +
> > +    /* now, set the cpu object property values */
> > +    numa_cpu_pre_plug(cpu_slot, DEVICE(cpuobj), &local_err);
> > +    if (local_err) {
> > +        goto out;
> > +    }
> > +
> > +    object_property_set_int(cpuobj, "mp-affinity", cpu_slot->arch_id, 
> > NULL);
> > +

[...]

> > +    /*
> > +     * RFC: Question: this must only be called for the hotplugged cpus. 
> > For the
> > +     * cold booted secondary cpus this is being taken care in 
> > arm_load_kernel()
> > +     * in boot.c. Perhaps we should remove that code now?
> > +     */
> > +    if (vms->psci_conduit != QEMU_PSCI_CONDUIT_DISABLED) {
> > +        object_property_set_int(cpuobj, "psci-conduit", vms->psci_conduit,
> > +                                NULL);
> > +
> > +        /* Secondary CPUs start in PSCI powered-down state */
> > +        if (CPU(cpuobj)->cpu_index > 0) {
> > +            object_property_set_bool(cpuobj, "start-powered-off", true, 
> > NULL);
> > +        }
> > +    }
> 
> Besides, if this patch is just factor out the code, we could move the
> check psci_conduit to later patch, and keep this patch clean.

I do not see the reason why we should do that?


Thanks
Salil.



reply via email to

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