On Mon, Feb 6, 2023 at 9:24 PM Sunil V L <[email protected]> wrote:
>
> On Mon, Feb 06, 2023 at 06:17:50PM +0800, Bin Meng wrote:
> > On Thu, Feb 2, 2023 at 12:54 PM Sunil V L <[email protected]> wrote:
> > >
> > > Add few basic ACPI tables and DSDT with few devices in a
> > > new file virt-acpi-build.c.
> > >
> > > These are mostly leveraged from arm64.
> >
> > There are lots of same ACPI codes existing in x86/arm/riscv. I believe
> > some refactoring work is needed before ACPI support fully lands on
> > RISC-V.
> > For example, we can extract the common part among x86/arm/riscv into a
> > separate file, like hw/acpi/acpi-build.c?
> >
>
> While it appears like there is same code in multiple places, those
> functions take architecture specific MachineState parameter. Some tables
> like MADT though with same name, will have different contents for
> different architectures.
>
> Only one function which Daniel also pointed is the wrapper
> acpi_align_size() which can be made common. I am not
> sure whether it is worth of refactoring.
>

It's more than that. For example,

With acpi_dsdt_add_cpus(), the only meaningful parameter is the number
of cpus, so there is no need to pass the architecture specific
MachineState as the parameter.

Likewise, acpi_dsdt_add_fw_cfg() can be made generic as well.

Regards,
Bin

Reply via email to