From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wr1-f45.google.com (mail-wr1-f45.google.com [209.85.221.45]) by mx.groups.io with SMTP id smtpd.web11.59272.1673539409410512091 for ; Thu, 12 Jan 2023 08:03:29 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@gmail.com header.s=20210112 header.b=YLo/+6dt; spf=pass (domain: gmail.com, ip: 209.85.221.45, mailfrom: pedro.falcato@gmail.com) Received: by mail-wr1-f45.google.com with SMTP id bn26so18582013wrb.0 for ; Thu, 12 Jan 2023 08:03:29 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=5io/jyKd4w0nWLn++fXresU2eiF4elRAb0UGGZ+x9yw=; b=YLo/+6dthBWiyUCNiYd2XZ9v/lDTdey0g4rjBk/5IWLrsPUX+gUIzYMpUfGeEV/uVC 64IH+IdpvKBZNW+5S3+9QBtcOKggcgWFIu5hjCCnTAS6xpJnYyNiJuu9PvPWO3vO1r3r YXrO1S3EGmGz2A8bQb5IYl3HRBmYjIm0hcrRtwQA0VqEeIPPssZja7JX61npwsYfQJuO ZkcyJcA0qLs5jFsEg6S/qLgeefhw4tEYeLAFS4YYK6SkQP0JO/QwDHzaWuhBhLDMmF7a zXVHomVEHAiuxc5inlOvBY8cthAblPmo7KHJuL5+6zWpNBLUXtA8iH8PypKHfhtAJtra 1z0g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=5io/jyKd4w0nWLn++fXresU2eiF4elRAb0UGGZ+x9yw=; b=gDuLT9eUBFFrvzPT1y4uCJS9WnWwfmRX5+We+TE4SCRup/ELXdChcub79Apfi3C9qx S80BZZ+0yZOpDlBxdGAohXh/zV767ywt4lPAQtgX1RqwtsELWI+au7QKNqseCroy/H6X ArpU4qsrsvQYLTNgfr9tDyRRUuSevRxmyXflnNo/q07CX7ehlN/1E9qjNhlof6P1hXTW EzxvW3xo8PJ1mn2YnVXM6FrexdtFQuTTgHzpmVH0EB/6xpEvlEJZ7ANnsuEutnrSXzLd z0jU/6fGvF/Qv9l5vJm7R8KGUzouUtyl9doP17DRJ+FFzynw8Pr4QvTi6E6vdi0OC0Fq pfDw== X-Gm-Message-State: AFqh2kpjFbGY1vO47WSHjoMC+xCW6zIx20bXRsZfmsD90a4mEq4a6cmA cH3MrQdSbAhOBX2wKPQ6L/jlwjRovm6LWrwl X-Google-Smtp-Source: AMrXdXvDIeF7zQXTczlhiaz+v0X0Qp+aLKAhTD4FrRMPtj6YbliD+scPxmBK+XprNPUesZvS8gHE8g== X-Received: by 2002:a5d:6143:0:b0:2bd:da9b:b88f with SMTP id y3-20020a5d6143000000b002bdda9bb88fmr862762wrt.8.1673539407461; Thu, 12 Jan 2023 08:03:27 -0800 (PST) Return-Path: Received: from PC-PEDRO-ARCH.lan ([2001:8a0:7280:5801:9441:3dce:686c:bfc7]) by smtp.gmail.com with ESMTPSA id j17-20020adff011000000b002a64e575b4esm17001515wro.47.2023.01.12.08.03.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 12 Jan 2023 08:03:27 -0800 (PST) From: "Pedro Falcato" To: devel@edk2.groups.io Cc: Pedro Falcato , Jian J Wang , Liming Gao , Hao A Wu , Ray Ni Subject: [PATCH 1/1] PciBusDxe: Add PcdPciProbePcieConfig Date: Thu, 12 Jan 2023 16:03:20 +0000 Message-Id: <20230112160320.411772-1-pedro.falcato@gmail.com> X-Mailer: git-send-email 2.39.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Virtualization software like QEMU can introduce interesting impossible topologies like PCIe devices on legacy PCI buses. Add a new PCD PcdPciProbePcieConfig to control PCIe extended configuration space probing, given that currently PCIe config space probing can trigger asserts in BasePciCf8Lib, making it hard to use on virtual platforms. Signed-off-by: Pedro Falcato Cc: Jian J Wang Cc: Liming Gao Cc: Hao A Wu Cc: Ray Ni --- MdeModulePkg/Bus/Pci/PciBusDxe/PciBusDxe.inf | 1 + MdeModulePkg/Bus/Pci/PciBusDxe/PciCommand.c | 4 ++++ MdeModulePkg/MdeModulePkg.dec | 6 ++++++ 3 files changed, 11 insertions(+) diff --git a/MdeModulePkg/Bus/Pci/PciBusDxe/PciBusDxe.inf b/MdeModulePkg/Bus/Pci/PciBusDxe/PciBusDxe.inf index e317169d9c57..c3e52ccd3e2e 100644 --- a/MdeModulePkg/Bus/Pci/PciBusDxe/PciBusDxe.inf +++ b/MdeModulePkg/Bus/Pci/PciBusDxe/PciBusDxe.inf @@ -107,6 +107,7 @@ gEfiMdeModulePkgTokenSpaceGuid.PcdMrIovSupport ## CONSUMES gEfiMdeModulePkgTokenSpaceGuid.PcdPciDisableBusEnumeration ## SOMETIMES_CONSUMES gEfiMdeModulePkgTokenSpaceGuid.PcdPcieResizableBarSupport ## CONSUMES + gEfiMdeModulePkgTokenSpaceGuid.PcdPciProbePcieConfig ## CONSUMES [UserExtensions.TianoCore."ExtraFiles"] PciBusDxeExtra.uni diff --git a/MdeModulePkg/Bus/Pci/PciBusDxe/PciCommand.c b/MdeModulePkg/Bus/Pci/PciBusDxe/PciCommand.c index ba4b099bc5c1..1c4e7fa23cb5 100644 --- a/MdeModulePkg/Bus/Pci/PciBusDxe/PciCommand.c +++ b/MdeModulePkg/Bus/Pci/PciBusDxe/PciCommand.c @@ -211,6 +211,10 @@ LocatePciExpressCapabilityRegBlock ( return EFI_UNSUPPORTED; } + if (PcdGetBool (PcdPciProbePcieConfig) == FALSE) { + return EFI_UNSUPPORTED; + } + if (*Offset != 0) { CapabilityPtr = *Offset; } else { diff --git a/MdeModulePkg/MdeModulePkg.dec b/MdeModulePkg/MdeModulePkg.dec index be5e829ca9c5..d5005535e8fb 100644 --- a/MdeModulePkg/MdeModulePkg.dec +++ b/MdeModulePkg/MdeModulePkg.dec @@ -2098,6 +2098,12 @@ # @Prompt Enable PCIe Resizable BAR Capability support. gEfiMdeModulePkgTokenSpaceGuid.PcdPcieResizableBarSupport|FALSE|BOOLEAN|0x10000024 + ## Indicates if the PCIe configuration space should be probed. + # TRUE - Probe PCIe space for PCIe devices. + # FALSE - Do not touch PCIe configuration space. + # @Prompt Enable PCIe configuration space probing + gEfiMdeModulePkgTokenSpaceGuid.PcdPciProbePcieConfig|FALSE|BOOLEAN|0x10000026 + ## This PCD holds the shared bit mask for page table entries when Tdx is enabled. # @Prompt The shared bit mask when Intel Tdx is enabled. gEfiMdeModulePkgTokenSpaceGuid.PcdTdxSharedBitMask|0x0|UINT64|0x10000025 -- 2.39.0