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.web11.31476.1673460030063800547 for ; Wed, 11 Jan 2023 10:00:30 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=cej7LjDB; 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=1673460029; 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; bh=KHKp3Ht2HP1cSPKHlhOaGyYr1trX1dcdX3NN3IrA/oM=; b=cej7LjDBX2MtMa/8Qgo0K7dxBRsTfrkMJ6PCCyPxBBy3v2zMdashJDE4DiaHJdiYp0Akz0 WhALg+LqHMlus8A3SUxpmhKp2slrXCV7hfEnRylWozQ+k/0FVsYfjK1Iw/HxyYQmlWfrtG ZyhaTSSuqa6cKNElQ9TkjQkglrEaO74= Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-397-59wX4gBiNgGF0J1ELDBIDQ-1; Wed, 11 Jan 2023 13:00:26 -0500 X-MC-Unique: 59wX4gBiNgGF0J1ELDBIDQ-1 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id A3FEB3C42200; Wed, 11 Jan 2023 18:00:25 +0000 (UTC) Received: from sirius.home.kraxel.org (unknown [10.39.192.238]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 5DD731121314; Wed, 11 Jan 2023 18:00:25 +0000 (UTC) Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id 6900F180060E; Wed, 11 Jan 2023 19:00:23 +0100 (CET) From: "Gerd Hoffmann" To: devel@edk2.groups.io Cc: Ard Biesheuvel , Gerd Hoffmann , Jiewen Yao , Oliver Steffen , Jordan Justen , Pawel Polawski Subject: [PATCH 1/1] OvmfPkg/VirtNorFlashDxe: map flash memory as uncacheable Date: Wed, 11 Jan 2023 19:00:23 +0100 Message-Id: <20230111180023.3841167-1-kraxel@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.3 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset="US-ASCII"; x-default=true Switching from the ArmPlatformPkg/NorFlashDxe driver to the OvmfPkg/VirtNorFlashDxe driver had the side effect that flash address space got registered as EFI_MEMORY_WC instead of EFI_MEMORY_UC. That confuses the linux kernel's numa code, seems this makes kernel consider the flash being node memory. "lsmem" changes from ... RANGE SIZE STATE REMOVABLE BLOCK 0x0000000040000000-0x000000013fffffff 4G online yes 8-39 ... to ... RANGE SIZE STATE REMOVABLE BLOCK 0x0000000000000000-0x0000000007ffffff 128M online yes 0 0x0000000040000000-0x000000013fffffff 4G online yes 8-39 ... and in the kernel log got new error lines: NUMA: Warning: invalid memblk node 512 [mem 0x0000000004000000-0x0000000007ffffff] NUMA: Faking a node at [mem 0x0000000004000000-0x000000013fffffff] Changing the attributes back to EFI_MEMORY_UC fixes this. Fixes: b92298af8218 ("ArmVirtPkg/ArmVirtQemu: migrate to OVMF's VirtNorFlashDxe") Signed-off-by: Gerd Hoffmann --- OvmfPkg/VirtNorFlashDxe/VirtNorFlashDxe.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/OvmfPkg/VirtNorFlashDxe/VirtNorFlashDxe.c b/OvmfPkg/VirtNorFlashDxe/VirtNorFlashDxe.c index ff3121af2a40..f9a41f6aab0f 100644 --- a/OvmfPkg/VirtNorFlashDxe/VirtNorFlashDxe.c +++ b/OvmfPkg/VirtNorFlashDxe/VirtNorFlashDxe.c @@ -394,14 +394,14 @@ NorFlashFvbInitialize ( EfiGcdMemoryTypeMemoryMappedIo, Instance->DeviceBaseAddress, RuntimeMmioRegionSize, - EFI_MEMORY_WC | EFI_MEMORY_RUNTIME + EFI_MEMORY_UC | EFI_MEMORY_RUNTIME ); ASSERT_EFI_ERROR (Status); Status = gDS->SetMemorySpaceAttributes ( Instance->DeviceBaseAddress, RuntimeMmioRegionSize, - EFI_MEMORY_WC | EFI_MEMORY_RUNTIME + EFI_MEMORY_UC | EFI_MEMORY_RUNTIME ); ASSERT_EFI_ERROR (Status); -- 2.39.0