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

Re: [PATCH 14/17] libacpi: build ACPI MCFG table if requested


  • To: Roger Pau Monné <roger.pau@xxxxxxxxxx>
  • From: Thierry Escande <thierry.escande@xxxxxxxxxx>
  • Date: Fri, 12 Jun 2026 12:02:01 +0200
  • Authentication-results: eu.smtp.expurgate.cloud; dkim=pass header.s=selector1 header.d=vates.tech header.i="@vates.tech" header.h="From:Subject:Date:Message-ID:To:Cc:MIME-Version:Content-Type:In-Reply-To:References:Feedback-ID"
  • Cc: xen-devel@xxxxxxxxxxxxxxxxxxxx, Jan Beulich <jbeulich@xxxxxxxx>, Anthony PERARD <anthony.perard@xxxxxxxxxx>, Alexey Gerasimenko <x1917x@xxxxxxxxx>
  • Delivery-date: Fri, 12 Jun 2026 10:02:09 +0000
  • Feedback-id: default:8631fc262581453bbf619ec5b2062170:Sweego
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 4/29/26 12:13, Roger Pau Monné wrote:
> On Fri, Mar 13, 2026 at 04:35:04PM +0000, Thierry Escande wrote:
>> +static struct acpi_10_mcfg *construct_mcfg(struct acpi_ctxt *ctxt,
>> +                                        const struct acpi_config *config)
>> +{
>> +    struct acpi_10_mcfg *mcfg;
>> +
>> +    /* Warning: this code expects that we have only one PCI segment */
> 
> Not only one PCI segment, but just one ECAM region.  You could in
> theory have multiple ECAM regions within a single PCI segment.

Yes, right. AFAIU, Xen guests have only 1 bus within only 1 segment,
with no multiple buses support, hence no multiple segments support, right?

> 
>> +    mcfg = ctxt->mem_ops.alloc(ctxt, sizeof(*mcfg), 16);
>> +    if ( !mcfg )
>> +        return NULL;
>> +
>> +    memset(mcfg, 0, sizeof(*mcfg));
>> +    mcfg->header.signature        = ACPI_MCFG_SIGNATURE;
>> +    mcfg->header.revision         = ACPI_1_0_MCFG_REVISION;
>> +    mcfg->header.creator_id       = ACPI_CREATOR_ID;
>> +    mcfg->header.creator_revision = ACPI_CREATOR_REVISION;
>> +    mcfg->header.length           = sizeof(*mcfg);
>> +    mcfg->header.oem_revision     = ACPI_OEM_REVISION;
>> +    fixed_strcpy(mcfg->header.oem_id, ACPI_OEM_ID);
>> +    fixed_strcpy(mcfg->header.oem_table_id, ACPI_OEM_TABLE_ID);
>> +
>> +    mcfg->entries[0].base_address      = config->mmconfig_addr;
>> +    mcfg->entries[0].pci_segment       = 0;
>> +    mcfg->entries[0].start_pci_bus_num = 0;
>> +    mcfg->entries[0].end_pci_bus_num   =
>> +        MCFG_SIZE_TO_NUM_BUSES(config->mmconfig_size) - 1;
> 
> 
> You might want to check that mmconfig_addr and mmconfig_size are set
> ahead of using them?  Just in case some bogus toolstack/hvmloader sets
> ACPI_HAS_MCFG without correctly populating the fields?

Makes sense.

Regards,


--
Thierry Escande | Vates XCP-ng Developer

XCP-ng & Xen Orchestra - Vates solutions

web: https://vates.tech

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.