[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH RFCv2 3/4] i386/pc: warn if phys-bits is too low
From: |
Joao Martins |
Subject: |
Re: [PATCH RFCv2 3/4] i386/pc: warn if phys-bits is too low |
Date: |
Mon, 14 Feb 2022 15:48:44 +0000 |
On 2/14/22 15:41, Igor Mammedov wrote:
> On Mon, 14 Feb 2022 15:18:43 +0000
> Joao Martins <joao.m.martins@oracle.com> wrote:
>> On 2/14/22 15:03, Igor Mammedov wrote:
>>> On Mon, 7 Feb 2022 20:24:21 +0000
>>> Joao Martins <joao.m.martins@oracle.com> wrote:
>>>> diff --git a/hw/i386/pc.c b/hw/i386/pc.c
>>>> index b060aedd38f3..f8712eb8427e 100644
>>>> --- a/hw/i386/pc.c
>>>> +++ b/hw/i386/pc.c
>>>> @@ -842,6 +842,7 @@ static void relocate_4g(MachineState *machine,
>>>> PCMachineState *pcms)
>>>> X86MachineState *x86ms = X86_MACHINE(pcms);
>>>> ram_addr_t device_mem_size = 0;
>>>> uint32_t eax, vendor[3];
>>>> + hwaddr maxphysaddr;
>>>>
>>>> host_cpuid(0x0, 0, &eax, &vendor[0], &vendor[2], &vendor[1]);
>>>> if (!IS_AMD_VENDOR(vendor)) {
>>>> @@ -858,6 +859,12 @@ static void relocate_4g(MachineState *machine,
>>>> PCMachineState *pcms)
>>>> return;
>>>> }
>>>>
>>>> + maxphysaddr = ((hwaddr)1 << X86_CPU(first_cpu)->phys_bits) - 1;
>>>> + if (maxphysaddr < AMD_ABOVE_1TB_START)
>>>> + warn_report("Relocated RAM above 4G to start at %lu "
>>>> + "phys-bits too low (%u)",
>>>> + AMD_ABOVE_1TB_START, X86_CPU(first_cpu)->phys_bits);
>>>
>>> perhaps this hunk belongs to the end of pc_memory_init(),
>>> it's not HT fixup specific at all?
>>>
>> It is HT fixup related. Because we are relocating the whole above-4g-ram,
>> on what used to be enough with just 40 phys bits (default).
>
> what if user starts QEMU with amount of RAM that won't fit into
> configured phys bits (whether it's default one or one that comes from host)
> and not on AMD host at that so no relocation happens but we still have
> broken configuration. What matters here is the end address that might
> be used by guest (pci64_bit hole end) is reachable.
>
> That's why I suggested to make it generic check instead of AMD specific one.
>
OK, I see.
If I'm being dense, that would require replacing AMD_ABOVE_1TB_START in the
comparison to something that computes the max used addr -- Let me try that then.
- Re: [PATCH RFCv2 2/4] i386/pc: relocate 4g start to 1T where applicable, (continued)
[PATCH RFCv2 4/4] i386/pc: Restrict AMD-only enforcing of valid IOVAs to new machine type, Joao Martins, 2022/02/07
[PATCH RFCv2 3/4] i386/pc: warn if phys-bits is too low, Joao Martins, 2022/02/07
- Re: [PATCH RFCv2 3/4] i386/pc: warn if phys-bits is too low, David Edmondson, 2022/02/14
- Re: [PATCH RFCv2 3/4] i386/pc: warn if phys-bits is too low, Igor Mammedov, 2022/02/14
- Re: [PATCH RFCv2 3/4] i386/pc: warn if phys-bits is too low, Joao Martins, 2022/02/23
- Re: [PATCH RFCv2 3/4] i386/pc: warn if phys-bits is too low, Igor Mammedov, 2022/02/24
- Re: [PATCH RFCv2 3/4] i386/pc: warn if phys-bits is too low, Joao Martins, 2022/02/24