[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <ZVFWyO74GkJZCGR7@liuwe-devbox-debian-v2>
Date: Sun, 12 Nov 2023 22:50:48 +0000
From: Wei Liu <wei.liu@...nel.org>
To: Saurabh Sengar <ssengar@...ux.microsoft.com>
Cc: kys@...rosoft.com, haiyangz@...rosoft.com, wei.liu@...nel.org,
decui@...rosoft.com, tglx@...utronix.de, mingo@...hat.com,
bp@...en8.de, dave.hansen@...ux.intel.com, x86@...nel.org,
hpa@...or.com, linux-hyperv@...r.kernel.org,
linux-kernel@...r.kernel.org, ssengar@...rosoft.com
Subject: Re: [PATCH v2] x86/hyperv: Fix the detection of E820_TYPE_PRAM in a
Gen2 VM
On Sat, Nov 11, 2023 at 12:37:47AM -0800, Saurabh Sengar wrote:
> A Gen2 VM doesn't support legacy PCI/PCIe, so both raw_pci_ops and
> raw_pci_ext_ops are NULL, and pci_subsys_init() -> pcibios_init()
> doesn't call pcibios_resource_survey() -> e820__reserve_resources_late();
> as a result, any emulated persistent memory of E820_TYPE_PRAM (12) via
> the kernel parameter memmap=nn[KMG]!ss is not added into iomem_resource
> and hence can't be detected by register_e820_pmem().
>
> Fix this by directly calling e820__reserve_resources_late() in
> hv_pci_init(), which is called from arch_initcall(pci_arch_init).
>
> It's ok to move a Gen2 VM's e820__reserve_resources_late() from
> subsys_initcall(pci_subsys_init) to arch_initcall(pci_arch_init) because
> the code in-between doesn't depend on the E820 resources.
> e820__reserve_resources_late() depends on e820__reserve_resources(),
> which has been called earlier from setup_arch().
>
> For a Gen-2 VM, the new hv_pci_init() also adds any memory of
> E820_TYPE_PMEM (7) into iomem_resource, and acpi_nfit_register_region() ->
> acpi_nfit_insert_resource() -> region_intersects() returns
> REGION_INTERSECTS, so the memory of E820_TYPE_PMEM won't get added twice.
>
> Changed the local variable "int gen2vm" to "bool gen2vm".
>
> Signed-off-by: Saurabh Sengar <ssengar@...ux.microsoft.com>
> Signed-off-by: Dexuan Cui <decui@...rosoft.com>
Applied to hyperv-fixes. Thanks.
Powered by blists - more mailing lists