From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by mx.groups.io with SMTP id smtpd.web09.10849.1664460451392678862 for ; Thu, 29 Sep 2022 07:07:31 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=gOMYG3sr; spf=pass (domain: redhat.com, ip: 170.10.129.124, mailfrom: kraxel@redhat.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1664460450; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=tvWpfRctUqjhl2OrwafC4gRTrkgahbSDolh6ANXnATQ=; b=gOMYG3srksxPixiyYwSy67vcYgNUeIEiDZUMFC85qjwWVF+p8dI5nWtASdZTTBlrCbrq5n npezVXaqZZpqGh4vL7BdBkfWHUFmoHwi4FE1Y9t+2Gnmn0CR/EvbsdUZ5tmKlhzV/5zC0t 8F0ihc88k3UjKRzrvxn6oAdZWqOx5JU= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-501-iFWrmmFoNsaCcZsGYrKIkQ-1; Thu, 29 Sep 2022 10:07:26 -0400 X-MC-Unique: iFWrmmFoNsaCcZsGYrKIkQ-1 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.rdu2.redhat.com [10.11.54.7]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 316B7862FDF; Thu, 29 Sep 2022 14:07:26 +0000 (UTC) Received: from sirius.home.kraxel.org (unknown [10.39.194.9]) by smtp.corp.redhat.com (Postfix) with ESMTPS id E942214588BE; Thu, 29 Sep 2022 14:07:25 +0000 (UTC) Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id EC8A618009BB; Thu, 29 Sep 2022 16:07:20 +0200 (CEST) From: "Gerd Hoffmann" To: devel@edk2.groups.io Cc: Gerd Hoffmann , Oliver Steffen , Ard Biesheuvel , Jiewen Yao , Pawel Polawski , Jordan Justen Subject: [PATCH 4/4] OvmfPkg/PciHotPlugInitDxe: reserve more mmio space Date: Thu, 29 Sep 2022 16:07:20 +0200 Message-Id: <20220929140720.1501464-5-kraxel@redhat.com> In-Reply-To: <20220929140720.1501464-1-kraxel@redhat.com> References: <20220929140720.1501464-1-kraxel@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.7 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset="US-ASCII"; x-default=true In case the 64-bit pci mmio window is larger than the default size of 32G be generous and hand out larger chunks of address space for prefetchable mmio bridge windows. Signed-off-by: Gerd Hoffmann --- OvmfPkg/PciHotPlugInitDxe/PciHotPlugInit.inf | 1 + OvmfPkg/PciHotPlugInitDxe/PciHotPlugInit.c | 13 +++++++++++++ 2 files changed, 14 insertions(+) diff --git a/OvmfPkg/PciHotPlugInitDxe/PciHotPlugInit.inf b/OvmfPkg/PciHotPlugInitDxe/PciHotPlugInit.inf index 78b95faa7a7a..f56b1de6fd92 100644 --- a/OvmfPkg/PciHotPlugInitDxe/PciHotPlugInit.inf +++ b/OvmfPkg/PciHotPlugInitDxe/PciHotPlugInit.inf @@ -40,6 +40,7 @@ [Protocols] [Pcd] gUefiOvmfPkgTokenSpaceGuid.PcdOvmfHostBridgePciDevId ## CONSUMES + gUefiOvmfPkgTokenSpaceGuid.PcdPciMmio64Size ## CONSUMES [Depex] TRUE diff --git a/OvmfPkg/PciHotPlugInitDxe/PciHotPlugInit.c b/OvmfPkg/PciHotPlugInitDxe/PciHotPlugInit.c index c122855b735d..08ea5b57bc18 100644 --- a/OvmfPkg/PciHotPlugInitDxe/PciHotPlugInit.c +++ b/OvmfPkg/PciHotPlugInitDxe/PciHotPlugInit.c @@ -744,12 +744,25 @@ GetResourcePadding ( // // Request defaults. // + UINT64 Pci64Size = PcdGet64 (PcdPciMmio64Size); + + // non-prefetchable SetMmioPadding ( --FirstResource, FALSE, TRUE, (UINTN)HighBitSetRoundUp32 (SIZE_2MB) ); + + // prefetchable + if (Pci64Size > SIZE_32GB) { + SetMmioPadding ( + --FirstResource, + TRUE, + FALSE, + (UINTN)HighBitSetRoundUp64 (RShiftU64 (Pci64Size, 8)) + ); + } } // -- 2.37.3