All of lore.kernel.org
 help / color / mirror / Atom feed
From: Isaku Yamahata <isaku.yamahata@gmail.com>
To: "Michael S. Tsirkin" <mst@redhat.com>
Cc: Isaku Yamahata <isaku.yamahata@intel.com>,
	Igor Mammedov <imammedo@redhat.com>,
	qemu-devel@nongnu.org, Isaku Yamahata <isaku.yamahata@gmail.com>
Subject: Re: [PATCH v3 07/10] hw/i386: declare ACPI mother board resource for MMCONFIG region
Date: Tue, 16 Feb 2021 10:13:25 -0800	[thread overview]
Message-ID: <20210216181325.GB15303@private.email.ne.jp> (raw)
In-Reply-To: <20210216084510-mutt-send-email-mst@kernel.org>

On Tue, Feb 16, 2021 at 08:45:48AM -0500,
"Michael S. Tsirkin" <mst@redhat.com> wrote:

> On Tue, Feb 16, 2021 at 01:43:01AM -0800, Isaku Yamahata wrote:
> > On Mon, Feb 15, 2021 at 01:48:32PM +0100,
> > Igor Mammedov <imammedo@redhat.com> wrote:
> > 
> > > On Fri, 12 Feb 2021 12:51:57 -0800
> > > Isaku Yamahata <isaku.yamahata@gmail.com> wrote:
> > > 
> > > > On Fri, Feb 12, 2021 at 04:40:38PM +0100,
> > > > Igor Mammedov <imammedo@redhat.com> wrote:
> > > > 
> > > > > On Wed, 10 Feb 2021 22:46:43 -0800
> > > > > Isaku Yamahata <isaku.yamahata@intel.com> wrote:
> > > > >   
> > > > > > +    Aml *dev;
> > > > > > +    Aml *rbuf;
> > > > > > +    Aml *resource_template;
> > > > > > +    Aml *rbuf_name;
> > > > > > +    Aml *crs;
> > > > > > +
> > > > > > +    if (!acpi_get_mcfg(&mcfg)) {
> > > > > > +        return NULL;
> > > > > > +    }
> > > > > > +
> > > > > > +    /* DRAM controller */
> > > > > > +    dev = aml_device("DRAC");
> > > > > > +    aml_append(dev, aml_name_decl("_HID", aml_string("PNP0C01")));
> > > > > > +
> > > > > > +    resource_template = aml_resource_template();
> > > > > > +    aml_append(resource_template,
> > > > > > +               aml_qword_memory(AML_POS_DECODE,
> > > > > > +                                AML_MIN_FIXED,
> > > > > > +                                AML_MAX_FIXED,
> > > > > > +                                AML_NON_CACHEABLE,
> > > > > > +                                AML_READ_WRITE,
> > > > > > +                                0x0000000000000000,
> > > > > > +                                mcfg.base,
> > > > > > +                                mcfg.base + mcfg.size - 1,  
> > > > > s/mcfg.base + mcfg.size - 1/mcfg.base/  
> > > > 
> > > > AddressMaximum needs to be the highest address of the region.
> > > > Not base address. By disassemble/assembl it, iasl complains as follows.
> > > > Also there are similar examples in acpi-build.c.
> > > I mostly clean up all places to use the same base address for min/max,
> > > but probably something were left behind.
> > > 
> > > spec says:
> > > 
> > > acpi 6.3: 19.6.110 QWordMemory
> > > 
> > > AddressMaximum evaluates to a 64-bit integer that specifies the highest possible base address of the
> > > Memory range. The value must have ‘0’ in all bits where the corresponding bit in AddressGranularity is
> > > ‘1’. For bridge devices which translate addresses, this is the address on the secondary bus. The 64-bit
> > > field DescriptorName ._MAX is automatically created to refer to this portion of the resource descriptor.
> > 
> > Ok, Linux guest is happy with min=max.
> > I conlude that it's iasl issue.
> > 
> > Thanks,
> 
> OK but what about all the other places in the code that seem to use this
> field differently?

Igor, what do you think?
The followings are the summary of the situation.

- acpi 6.4: 19.6.110 QWordMemory
  _MAX: maximum of base address.

- acpi 6.4: 6.4.3.5 Address Space Resource Descriptors
  table 6.44
  If _LEN > 0 and _MIF = 1 and _MAF = 1, then _LEN = _MAX - _MIN + 1
  This doesn't match with the above description

- iasl
  If _LEN > 0 and _MIF = 1 and _MAF = 1,
  it emits warning on _LEN != _MAX - _MIN + 1

- Linux Guest MMCONFIG check 
  check_mcfg_resoure() uses only _MIN. doesn't use _MAX.
  _MAX value doesn't matter

- Linux acpi code
  acpi_decode_space() uses _MAX to calulate range [start, end], not use _LEN.
  i.e. It assumes _LEN = _MAX - _MIN + 1 if _LEN > 0, _MIF = 1, _MAF = 1

- qemu code sets for [qd]word_memory_resource (except this patch)
  If _LEN > 0 and _MIF = 1 and _MAF = 1, then set _LEN = _MAX - _MIN + 1

-- 
Isaku Yamahata <isaku.yamahata@gmail.com>


  reply	other threads:[~2021-02-16 18:14 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-02-11  6:46 [PATCH v3 00/10] ACPI related fixes to comform the spec better Isaku Yamahata
2021-02-11  6:46 ` [PATCH v3 01/10] checkpatch: don't emit warning on newly created acpi data files Isaku Yamahata
2021-02-11  6:46 ` [PATCH v3 02/10] qtest: update tests/qtest/bios-tables-test-allowed-diff.h Isaku Yamahata
2021-02-11  6:46 ` [PATCH v3 03/10] i386: add properoty, x-smm-compat-5, to keep compatibility of SMM Isaku Yamahata
2021-02-12 14:54   ` Igor Mammedov
2021-02-11  6:46 ` [PATCH v3 04/10] acpi/core: always set SCI_EN when SMM isn't supported Isaku Yamahata
2021-02-12 15:09   ` Igor Mammedov
2021-02-11  6:46 ` [PATCH v3 05/10] acpi: set fadt.smi_cmd to zero when SMM is not supported Isaku Yamahata
2021-02-12 15:15   ` Igor Mammedov
2021-02-11  6:46 ` [PATCH v3 06/10] acpi: add test case for smm unsupported -machine smm=off Isaku Yamahata
2021-02-11  6:46 ` [PATCH v3 07/10] hw/i386: declare ACPI mother board resource for MMCONFIG region Isaku Yamahata
2021-02-12 15:40   ` Igor Mammedov
2021-02-12 20:51     ` Isaku Yamahata
2021-02-15 12:48       ` Igor Mammedov
2021-02-16  9:43         ` Isaku Yamahata
2021-02-16 13:45           ` Michael S. Tsirkin
2021-02-16 18:13             ` Isaku Yamahata [this message]
2021-02-16 22:04               ` Igor Mammedov
2021-02-11  6:46 ` [PATCH v3 08/10] i386: acpi: Don't build HPET ACPI entry if HPET is disabled Isaku Yamahata
2021-02-11  6:46 ` [PATCH v3 09/10] acpi: add test case for -no-hpet Isaku Yamahata
2021-02-11  6:46 ` [PATCH v3 10/10] qtest/acpi/bios-tables-test: update acpi tables Isaku Yamahata

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=20210216181325.GB15303@private.email.ne.jp \
    --to=isaku.yamahata@gmail.com \
    --cc=imammedo@redhat.com \
    --cc=isaku.yamahata@intel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.