|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [PATCH 14/17] libacpi: build ACPI MCFG table if requested
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
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |