From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by mx.groups.io with SMTP id smtpd.web10.51414.1673518817386126830 for ; Thu, 12 Jan 2023 02:20:17 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=rgEhjNX9; spf=pass (domain: kernel.org, ip: 145.40.68.75, mailfrom: ardb@kernel.org) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 28A9DB81DD8 for ; Thu, 12 Jan 2023 10:20:15 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D9F49C433F2 for ; Thu, 12 Jan 2023 10:20:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1673518813; bh=xkNSDH71O2B4zW7cs3QMNQJDhBzmsBkpR5aoishSlCo=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=rgEhjNX90Y7kyjM1CIhTsqfKPvjLsVMEtraDfra/eXuX4Rs6oghwhVRjvtR5OIojz gb1j/zI0ing85pFZCdivy+f461YH12UTqocWx0vNnEf/3iQQS+BZBcI+r6jFMU1EgK qwGelmvXgSqj14LEj69C8xq39jDYEGVmdP2sskJpEKwJEsNOnJsuvdcjmB3C/Kij9V P+zjvjmZyyDY43qJLo7MPivKCW1nKl7iPfN2EvR6Tx0FnyI52HGqkRazC/SWBqs4c3 NaqQEk4W8qjCKooe+hVWxoTKkeqZx9wsH5Mznaa1U1tSGmlTpS23L+4ZLV7xnL1dR4 P7u8sG2PMihuA== Received: by mail-lj1-f176.google.com with SMTP id n5so18276662ljc.9 for ; Thu, 12 Jan 2023 02:20:13 -0800 (PST) X-Gm-Message-State: AFqh2kqhscpeXSBAlAfpigPDt1fuyvmFlwJan4mJEu9d7sIfFhlZ/9K9 IvM75EQWCd0kguJ+gl1tqyCy1nCKCtHIOlyFHS0= X-Google-Smtp-Source: AMrXdXsUnGFNb548npkWAF2QXBUcA9II7U0JGAtAnH/r8yJJmE7GVb8eNdJcGhFSPURqzguIwt2cAzsRE1QEnvzX0B4= X-Received: by 2002:a2e:bd0c:0:b0:27f:bc58:3924 with SMTP id n12-20020a2ebd0c000000b0027fbc583924mr4845272ljq.352.1673518811792; Thu, 12 Jan 2023 02:20:11 -0800 (PST) MIME-Version: 1.0 References: <20230111180023.3841167-1-kraxel@redhat.com> In-Reply-To: <20230111180023.3841167-1-kraxel@redhat.com> From: "Ard Biesheuvel" Date: Thu, 12 Jan 2023 11:20:00 +0100 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH 1/1] OvmfPkg/VirtNorFlashDxe: map flash memory as uncacheable To: Gerd Hoffmann Cc: devel@edk2.groups.io, Ard Biesheuvel , Jiewen Yao , Oliver Steffen , Jordan Justen , Pawel Polawski Content-Type: text/plain; charset="UTF-8" On Wed, 11 Jan 2023 at 19:00, Gerd Hoffmann wrote: > > 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 Reviewed-by: Ard Biesheuvel Queued up as #3887 > --- > 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 >