mbox series

[v7,0/9] dm: Add programmatic generation of ACPI tables (part A)

Message ID 20200419203657.163143-1-sjg@chromium.org
Headers show
Series dm: Add programmatic generation of ACPI tables (part A) | expand

Message

Simon Glass April 19, 2020, 8:36 p.m. UTC
This is split from the original series in an attempt to get things applied
in chunks.

v7 is just a rebase as requested

Changes in v7:
- Rebase to master

Changes in v5:
- Drop bisectability changes

Changes in v4:
- Put 'interrupts-extended' property on one line
- Rename acpi-probed to linux,probed
- Note that linux,probed is an out-of-tree feature
- Separate out the log newline
- Update comment in acpi_inc_align() to show the alignment
- Put back cast on table_compute_checksum()
- Rename list_fact() to list_fadt()
- Add a comment to dump_hdr()

Changes in v3:
- Drop mention of PRIC
- Rename acpi,desc to acpi,ddn
- Correct description of acpi,probed
- Drop hid-descr-addr
- Just add the device.txt binding file in this patch
- Change the example to ELAN
- Add a pointer to information about acpi,compatible
- Rename acpi_align_large() to acpi_align64()
- Fix 'RSDP' typo
- Fix 'XDST' typo
- Move acpi_align_large() out of dm_test_acpi_setup_base_tables()
- Beef up the comment explaining how the unaligned address is used

Changes in v2:
- Fix definition of HID
- Infer hid-over-i2c CID value
- Add the hid-over-i2c binding document
- Drop definition of ACPI_TABLE_CREATOR
- Make _acpi_write_dev_tables() static and switch argument order
- Generalise the ACPI function recursion with acpi_recurse_method()

Simon Glass (9):
  acpi: Add a binding for ACPI settings in the device tree
  acpi: Add a method to write tables for a device
  acpi: Convert part of acpi_table to use acpi_ctx
  x86: Allow devices to write ACPI tables
  acpi: Drop code for missing XSDT from acpi_write_rsdp()
  acpi: Move acpi_add_table() to generic code
  acpi: Put table-setup code in its own function
  acpi: Move the xsdt pointer to acpi_ctx
  acpi: Add an acpi command

 arch/sandbox/dts/test.dts              |   4 +
 arch/sandbox/include/asm/global_data.h |   1 +
 arch/x86/include/asm/global_data.h     |   1 +
 arch/x86/lib/acpi_table.c              | 239 +++++--------------------
 cmd/Kconfig                            |  14 ++
 cmd/Makefile                           |   1 +
 cmd/acpi.c                             | 186 +++++++++++++++++++
 doc/device-tree-bindings/device.txt    |  36 ++++
 drivers/core/acpi.c                    |  62 +++++++
 include/acpi/acpi_table.h              |  65 +++++++
 include/dm/acpi.h                      |  37 ++++
 lib/acpi/acpi_table.c                  | 174 +++++++++++++++++-
 test/dm/acpi.c                         | 238 +++++++++++++++++++++++-
 13 files changed, 855 insertions(+), 203 deletions(-)
 create mode 100644 cmd/acpi.c
 create mode 100644 doc/device-tree-bindings/device.txt

Comments

Andy Shevchenko April 21, 2020, 5:42 p.m. UTC | #1
On Sun, Apr 19, 2020 at 02:36:48PM -0600, Simon Glass wrote:
> This is split from the original series in an attempt to get things applied
> in chunks.
> 
> v7 is just a rebase as requested

So, overall I have no concerns, except that compatible string in ACPI seems
half-baked solution and, due to PRP0001 awareness (my understanding that it
should not be part of production devices), seems not needed right now.
It means we should require to have _HID and/or _CID.

Code looks fine to me, though.

> Changes in v7:
> - Rebase to master
> 
> Changes in v5:
> - Drop bisectability changes
> 
> Changes in v4:
> - Put 'interrupts-extended' property on one line
> - Rename acpi-probed to linux,probed
> - Note that linux,probed is an out-of-tree feature
> - Separate out the log newline
> - Update comment in acpi_inc_align() to show the alignment
> - Put back cast on table_compute_checksum()
> - Rename list_fact() to list_fadt()
> - Add a comment to dump_hdr()
> 
> Changes in v3:
> - Drop mention of PRIC
> - Rename acpi,desc to acpi,ddn
> - Correct description of acpi,probed
> - Drop hid-descr-addr
> - Just add the device.txt binding file in this patch
> - Change the example to ELAN
> - Add a pointer to information about acpi,compatible
> - Rename acpi_align_large() to acpi_align64()
> - Fix 'RSDP' typo
> - Fix 'XDST' typo
> - Move acpi_align_large() out of dm_test_acpi_setup_base_tables()
> - Beef up the comment explaining how the unaligned address is used
> 
> Changes in v2:
> - Fix definition of HID
> - Infer hid-over-i2c CID value
> - Add the hid-over-i2c binding document
> - Drop definition of ACPI_TABLE_CREATOR
> - Make _acpi_write_dev_tables() static and switch argument order
> - Generalise the ACPI function recursion with acpi_recurse_method()
> 
> Simon Glass (9):
>   acpi: Add a binding for ACPI settings in the device tree
>   acpi: Add a method to write tables for a device
>   acpi: Convert part of acpi_table to use acpi_ctx
>   x86: Allow devices to write ACPI tables
>   acpi: Drop code for missing XSDT from acpi_write_rsdp()
>   acpi: Move acpi_add_table() to generic code
>   acpi: Put table-setup code in its own function
>   acpi: Move the xsdt pointer to acpi_ctx
>   acpi: Add an acpi command
> 
>  arch/sandbox/dts/test.dts              |   4 +
>  arch/sandbox/include/asm/global_data.h |   1 +
>  arch/x86/include/asm/global_data.h     |   1 +
>  arch/x86/lib/acpi_table.c              | 239 +++++--------------------
>  cmd/Kconfig                            |  14 ++
>  cmd/Makefile                           |   1 +
>  cmd/acpi.c                             | 186 +++++++++++++++++++
>  doc/device-tree-bindings/device.txt    |  36 ++++
>  drivers/core/acpi.c                    |  62 +++++++
>  include/acpi/acpi_table.h              |  65 +++++++
>  include/dm/acpi.h                      |  37 ++++
>  lib/acpi/acpi_table.c                  | 174 +++++++++++++++++-
>  test/dm/acpi.c                         | 238 +++++++++++++++++++++++-
>  13 files changed, 855 insertions(+), 203 deletions(-)
>  create mode 100644 cmd/acpi.c
>  create mode 100644 doc/device-tree-bindings/device.txt
> 
> -- 
> 2.26.1.301.g55bc3eb7cb9-goog
>
Simon Glass April 21, 2020, 9:37 p.m. UTC | #2
Hi Andy,

On Tue, 21 Apr 2020 at 11:43, Andy Shevchenko
<andriy.shevchenko at linux.intel.com> wrote:
>
> On Sun, Apr 19, 2020 at 02:36:48PM -0600, Simon Glass wrote:
> > This is split from the original series in an attempt to get things applied
> > in chunks.
> >
> > v7 is just a rebase as requested
>
> So, overall I have no concerns, except that compatible string in ACPI seems
> half-baked solution and, due to PRP0001 awareness (my understanding that it
> should not be part of production devices), seems not needed right now.
> It means we should require to have _HID and/or _CID.

OK I am really not sure what to say about this. Let's deal with it
when we see the use of it later.

>
> Code looks fine to me, though.
>

OK good. I will send part B soon.

> > Changes in v7:
> > - Rebase to master
> >
> > Changes in v5:
> > - Drop bisectability changes
> >
> > Changes in v4:
> > - Put 'interrupts-extended' property on one line
> > - Rename acpi-probed to linux,probed
> > - Note that linux,probed is an out-of-tree feature
> > - Separate out the log newline
> > - Update comment in acpi_inc_align() to show the alignment
> > - Put back cast on table_compute_checksum()
> > - Rename list_fact() to list_fadt()
> > - Add a comment to dump_hdr()
> >
> > Changes in v3:
> > - Drop mention of PRIC
> > - Rename acpi,desc to acpi,ddn
> > - Correct description of acpi,probed
> > - Drop hid-descr-addr
> > - Just add the device.txt binding file in this patch
> > - Change the example to ELAN
> > - Add a pointer to information about acpi,compatible
> > - Rename acpi_align_large() to acpi_align64()
> > - Fix 'RSDP' typo
> > - Fix 'XDST' typo
> > - Move acpi_align_large() out of dm_test_acpi_setup_base_tables()
> > - Beef up the comment explaining how the unaligned address is used
> >
> > Changes in v2:
> > - Fix definition of HID
> > - Infer hid-over-i2c CID value
> > - Add the hid-over-i2c binding document
> > - Drop definition of ACPI_TABLE_CREATOR
> > - Make _acpi_write_dev_tables() static and switch argument order
> > - Generalise the ACPI function recursion with acpi_recurse_method()
> >
> > Simon Glass (9):
> >   acpi: Add a binding for ACPI settings in the device tree
> >   acpi: Add a method to write tables for a device
> >   acpi: Convert part of acpi_table to use acpi_ctx
> >   x86: Allow devices to write ACPI tables
> >   acpi: Drop code for missing XSDT from acpi_write_rsdp()
> >   acpi: Move acpi_add_table() to generic code
> >   acpi: Put table-setup code in its own function
> >   acpi: Move the xsdt pointer to acpi_ctx
> >   acpi: Add an acpi command
> >
> >  arch/sandbox/dts/test.dts              |   4 +
> >  arch/sandbox/include/asm/global_data.h |   1 +
> >  arch/x86/include/asm/global_data.h     |   1 +
> >  arch/x86/lib/acpi_table.c              | 239 +++++--------------------
> >  cmd/Kconfig                            |  14 ++
> >  cmd/Makefile                           |   1 +
> >  cmd/acpi.c                             | 186 +++++++++++++++++++
> >  doc/device-tree-bindings/device.txt    |  36 ++++
> >  drivers/core/acpi.c                    |  62 +++++++
> >  include/acpi/acpi_table.h              |  65 +++++++
> >  include/dm/acpi.h                      |  37 ++++
> >  lib/acpi/acpi_table.c                  | 174 +++++++++++++++++-
> >  test/dm/acpi.c                         | 238 +++++++++++++++++++++++-
> >  13 files changed, 855 insertions(+), 203 deletions(-)
> >  create mode 100644 cmd/acpi.c
> >  create mode 100644 doc/device-tree-bindings/device.txt
> >
> > --
> > 2.26.1.301.g55bc3eb7cb9-goog
> >
Regards,
Simon
Bin Meng April 23, 2020, 9:46 a.m. UTC | #3
Hi Simon,

On Wed, Apr 22, 2020 at 5:37 AM Simon Glass <sjg at chromium.org> wrote:
>
> Hi Andy,
>
> On Tue, 21 Apr 2020 at 11:43, Andy Shevchenko
> <andriy.shevchenko at linux.intel.com> wrote:
> >
> > On Sun, Apr 19, 2020 at 02:36:48PM -0600, Simon Glass wrote:
> > > This is split from the original series in an attempt to get things applied
> > > in chunks.
> > >
> > > v7 is just a rebase as requested
> >
> > So, overall I have no concerns, except that compatible string in ACPI seems
> > half-baked solution and, due to PRP0001 awareness (my understanding that it
> > should not be part of production devices), seems not needed right now.
> > It means we should require to have _HID and/or _CID.
>
> OK I am really not sure what to say about this. Let's deal with it
> when we see the use of it later.
>
> >
> > Code looks fine to me, though.
> >
>
> OK good. I will send part B soon.
>

v7 has been applied to u-boot-x86, thanks!

Regards,
Bin
Bin Meng April 23, 2020, 9:58 a.m. UTC | #4
Hi Simon,

On Thu, Apr 23, 2020 at 5:46 PM Bin Meng <bmeng.cn at gmail.com> wrote:
>
> Hi Simon,
>
> On Wed, Apr 22, 2020 at 5:37 AM Simon Glass <sjg at chromium.org> wrote:
> >
> > Hi Andy,
> >
> > On Tue, 21 Apr 2020 at 11:43, Andy Shevchenko
> > <andriy.shevchenko at linux.intel.com> wrote:
> > >
> > > On Sun, Apr 19, 2020 at 02:36:48PM -0600, Simon Glass wrote:
> > > > This is split from the original series in an attempt to get things applied
> > > > in chunks.
> > > >
> > > > v7 is just a rebase as requested
> > >
> > > So, overall I have no concerns, except that compatible string in ACPI seems
> > > half-baked solution and, due to PRP0001 awareness (my understanding that it
> > > should not be part of production devices), seems not needed right now.
> > > It means we should require to have _HID and/or _CID.
> >
> > OK I am really not sure what to say about this. Let's deal with it
> > when we see the use of it later.
> >
> > >
> > > Code looks fine to me, though.
> > >
> >
> > OK good. I will send part B soon.
> >
>
> v7 has been applied to u-boot-x86, thanks!
>

Unfortunately this series breaks sandbox_spl, please take a look.

https://gitlab.denx.de/u-boot/custodians/u-boot-x86/-/jobs/81615

Regards,
Bin
Bin Meng April 27, 2020, 5:58 a.m. UTC | #5
Hi Simon,

On Thu, Apr 23, 2020 at 5:58 PM Bin Meng <bmeng.cn at gmail.com> wrote:
>
> Hi Simon,
>
> On Thu, Apr 23, 2020 at 5:46 PM Bin Meng <bmeng.cn at gmail.com> wrote:
> >
> > Hi Simon,
> >
> > On Wed, Apr 22, 2020 at 5:37 AM Simon Glass <sjg at chromium.org> wrote:
> > >
> > > Hi Andy,
> > >
> > > On Tue, 21 Apr 2020 at 11:43, Andy Shevchenko
> > > <andriy.shevchenko at linux.intel.com> wrote:
> > > >
> > > > On Sun, Apr 19, 2020 at 02:36:48PM -0600, Simon Glass wrote:
> > > > > This is split from the original series in an attempt to get things applied
> > > > > in chunks.
> > > > >
> > > > > v7 is just a rebase as requested
> > > >
> > > > So, overall I have no concerns, except that compatible string in ACPI seems
> > > > half-baked solution and, due to PRP0001 awareness (my understanding that it
> > > > should not be part of production devices), seems not needed right now.
> > > > It means we should require to have _HID and/or _CID.
> > >
> > > OK I am really not sure what to say about this. Let's deal with it
> > > when we see the use of it later.
> > >
> > > >
> > > > Code looks fine to me, though.
> > > >
> > >
> > > OK good. I will send part B soon.
> > >
> >
> > v7 has been applied to u-boot-x86, thanks!
> >
>
> Unfortunately this series breaks sandbox_spl, please take a look.
>
> https://gitlab.denx.de/u-boot/custodians/u-boot-x86/-/jobs/81615
>

Did you send out a fix for this series so that I can squash in?

Regards,
Bin
Simon Glass April 27, 2020, 5:02 p.m. UTC | #6
Hi Bin,

On Sun, 26 Apr 2020 at 23:58, Bin Meng <bmeng.cn at gmail.com> wrote:
>
> Hi Simon,
>
> On Thu, Apr 23, 2020 at 5:58 PM Bin Meng <bmeng.cn at gmail.com> wrote:
> >
> > Hi Simon,
> >
> > On Thu, Apr 23, 2020 at 5:46 PM Bin Meng <bmeng.cn at gmail.com> wrote:
> > >
> > > Hi Simon,
> > >
> > > On Wed, Apr 22, 2020 at 5:37 AM Simon Glass <sjg at chromium.org> wrote:
> > > >
> > > > Hi Andy,
> > > >
> > > > On Tue, 21 Apr 2020 at 11:43, Andy Shevchenko
> > > > <andriy.shevchenko at linux.intel.com> wrote:
> > > > >
> > > > > On Sun, Apr 19, 2020 at 02:36:48PM -0600, Simon Glass wrote:
> > > > > > This is split from the original series in an attempt to get things applied
> > > > > > in chunks.
> > > > > >
> > > > > > v7 is just a rebase as requested
> > > > >
> > > > > So, overall I have no concerns, except that compatible string in ACPI seems
> > > > > half-baked solution and, due to PRP0001 awareness (my understanding that it
> > > > > should not be part of production devices), seems not needed right now.
> > > > > It means we should require to have _HID and/or _CID.
> > > >
> > > > OK I am really not sure what to say about this. Let's deal with it
> > > > when we see the use of it later.
> > > >
> > > > >
> > > > > Code looks fine to me, though.
> > > > >
> > > >
> > > > OK good. I will send part B soon.
> > > >
> > >
> > > v7 has been applied to u-boot-x86, thanks!
> > >
> >
> > Unfortunately this series breaks sandbox_spl, please take a look.
> >
> > https://gitlab.denx.de/u-boot/custodians/u-boot-x86/-/jobs/81615
> >
>
> Did you send out a fix for this series so that I can squash in?

Oops, no, I sent out a new series. I will send a fixup patch.

Regards,
Simon
Heinrich Schuchardt April 29, 2020, 6:09 p.m. UTC | #7
On 4/19/20 10:36 PM, Simon Glass wrote:
> This is split from the original series in an attempt to get things applied
> in chunks.
>
> v7 is just a rebase as requested

Hello Simon,

Andrei Warkentin pointed me to a similar development for EDK2:

Dynamic Tables Framework
https://github.com/tianocore/edk2/tree/master/DynamicTablesPkg

Best regards

Heinrich
Simon Glass May 1, 2020, 1:14 p.m. UTC | #8
Hi Heinrich,

On Wed, 29 Apr 2020 at 12:14, Heinrich Schuchardt <xypron.glpk at gmx.de> wrote:
>
> On 4/19/20 10:36 PM, Simon Glass wrote:
> > This is split from the original series in an attempt to get things applied
> > in chunks.
> >
> > v7 is just a rebase as requested
>
> Hello Simon,
>
> Andrei Warkentin pointed me to a similar development for EDK2:
>
> Dynamic Tables Framework
> https://github.com/tianocore/edk2/tree/master/DynamicTablesPkg

Thanks, I had a quick look. Are you thinking we should try to have a
common library for this?

Regards,
Simon