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.133.124]) by mx.groups.io with SMTP id smtpd.web10.160802.1673851094794843914 for ; Sun, 15 Jan 2023 22:38:15 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=GHiXHUCP; spf=pass (domain: redhat.com, ip: 170.10.133.124, mailfrom: kraxel@redhat.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1673851093; 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: in-reply-to:in-reply-to:references:references; bh=KJHC/0/HXBDlZV5EaRzZc9OpLWlx+GWRmhKN0jWgC2Q=; b=GHiXHUCPcPm9rVzwkei8HLpLfW82o1dnC0p4hacf1v1LBIsOMvNXYoiwLFa1Ff2vvwO+PK 3mS/hAwGbbG3ydAQSB6tXwKWYlv+cTCo5mFp9h0Wgn/06wFsr79hhxnmWRaJFXWx80aIJ9 0ZuLa8OLyA6Xrr3XaIU/hj9s2h/2+vI= 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-474-03peqOI4OCOsLgMjZQAlCA-1; Mon, 16 Jan 2023 01:38:11 -0500 X-MC-Unique: 03peqOI4OCOsLgMjZQAlCA-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 E23011C29D4E; Mon, 16 Jan 2023 06:38:10 +0000 (UTC) Received: from sirius.home.kraxel.org (unknown [10.39.192.124]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 9BEA71121314; Mon, 16 Jan 2023 06:38:10 +0000 (UTC) Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id 3C8F418017F5; Mon, 16 Jan 2023 07:38:09 +0100 (CET) Date: Mon, 16 Jan 2023 07:38:09 +0100 From: "Gerd Hoffmann" To: Ard Biesheuvel Cc: devel@edk2.groups.io, Ard Biesheuvel , Jiewen Yao , Oliver Steffen , Jordan Justen , Pawel Polawski Subject: Re: [PATCH 1/1] OvmfPkg/VirtNorFlashDxe: map flash memory as uncacheable Message-ID: <20230116063809.4sgnz4th6m2dldrk@sirius.home.kraxel.org> References: <20230111180023.3841167-1-kraxel@redhat.com> MIME-Version: 1.0 In-Reply-To: X-Scanned-By: MIMEDefang 3.1 on 10.11.54.3 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Thu, Jan 12, 2023 at 11:20:00AM +0100, Ard Biesheuvel wrote: > 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 Laszlo pointed me to commit 789a72328553 ("OvmfPkg/VirtNorFlashDxe: use EFI_MEMORY_WC and drop AlignedCopyMem()") and I'm wondering whenever we need to also bring back AlignedCopyMem, or is it safe to use CopyMem because we know we operate on virtual hardware? take care, Gerd