qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Igor Mammedov <imammedo@redhat.com>
To: "Michael S. Tsirkin" <mst@redhat.com>
Cc: qemu-devel@nongnu.org
Subject: Re: type mismatch in SSDT
Date: Thu, 27 Oct 2022 15:52:53 +0200	[thread overview]
Message-ID: <20221027155253.0d81989c@fedora> (raw)
In-Reply-To: <20221027015833-mutt-send-email-mst@kernel.org>

On Thu, 27 Oct 2022 01:59:22 -0400
"Michael S. Tsirkin" <mst@redhat.com> wrote:

> Just noticed this when disassembling:
> 
> Parsing completed
> ACPI Warning: NsLookup: Type mismatch on ODAT (RegionField), searching for (Buffer) (20210604/nsaccess-760)
> Disassembly completed
> ASL Output:    /tmp/old-asl2/tests/data/acpi/virt/SSDT.memhp.dsl - 14945 bytes
> 
> Did not look into this yet but it seems new.
It was there practically 'forever'.

ODAT should be treated as Buffer according to implicit Field/data conversion rules,
that's probably the reason why it works. So warning looks a bit bogus to me.

however:
  DefCreateByteField := CreateByteFieldOp SourceBuff ByteIndex NameString
  SourceBuff := TermArg => Buffer
  TermArg := ExpressionOpcode | DataObject | ArgObj | LocalObj

and none of that explicitly leads to 

  TermObj := Object | StatementOpcode | ExpressionOpcode
  Object := NameSpaceModifierObj | NamedObj

So if we are to be as pedantic as IASL, we need to supply
field to CreateByteField not by name but via one of TermArg.
We could copy/assign whole buffer to a LocalObj
or summarily use ExpressionOpcode => ToBuffer() // this one has a bit controversial definition in 6.4 spec
or to avoid any copying add 'useless' DerefOf(RefOf())
wrapper around name to make argument of ExpressionOpcode kind.

following should silence warning.

diff --git a/hw/acpi/nvdimm.c b/hw/acpi/nvdimm.c
index 31e46df0bd..7488007540 100644
--- a/hw/acpi/nvdimm.c
+++ b/hw/acpi/nvdimm.c
@@ -1127,7 +1127,7 @@ static void nvdimm_build_common_dsm(Aml *dev,
     /* If RLEN >= Integer size, just use CreateField() operator */
     aml_append(method, aml_store(aml_shiftleft(dsm_out_buf_size, aml_int(3)),
                                  dsm_out_buf_size));
-    aml_append(method, aml_create_field(aml_name(NVDIMM_DSM_OUT_BUF),
+    aml_append(method, aml_create_field(aml_derefof(aml_refof(aml_name(NVDIMM_DSM_OUT_BUF))),
                aml_int(0), dsm_out_buf_size, "OBUF"));
     aml_append(method, aml_return(aml_name("OBUF")));
 



  reply	other threads:[~2022-10-27 13:54 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-27  5:59 type mismatch in SSDT Michael S. Tsirkin
2022-10-27 13:52 ` Igor Mammedov [this message]
2022-10-27 14:15   ` Michael S. Tsirkin
2022-10-31 10:46     ` Igor Mammedov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20221027155253.0d81989c@fedora \
    --to=imammedo@redhat.com \
    --cc=mst@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).