From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by mx.groups.io with SMTP id smtpd.web10.23553.1633428313176320755 for ; Tue, 05 Oct 2021 03:05:13 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=Ci3dwTGw; spf=pass (domain: kernel.org, ip: 198.145.29.99, mailfrom: ardb@kernel.org) Received: by mail.kernel.org (Postfix) with ESMTPSA id E7DD461381 for ; Tue, 5 Oct 2021 10:05:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1633428311; bh=OcjyLyHXIiakpE6OSzEqyn/tGYLOOTjqQWpcTZZwbbM=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=Ci3dwTGw7vtlHT+2SL7zPlqtU1To6bYgZHIkAuLJIuKGDzG4oIKp7XRy3tLkWxQz6 Wpkve7qMTeoEyc1okbww3679XORs7gJ96rOBHb9QWrpPmn3rz38ultYMP72VK+fZ28 2VtwRF2+B7iUI9suHZgftndQOJjCgR0G3/M2alxWx5XVAgj8wsnegIttwLfATjeWAP zr8RHFcYij1G4dNcvkUi8ZvTnuXWer/BcdZfhr9ARy9zPOo/L4blepMiA75MgP0u7D 3jB5nJAM9iKBluqrPCixJnBPci+ApD3pjqISRVmekM+i2Ztfb8lgKnscI3EmQ9cOHe 7DV5NZAwsuEhQ== Received: by mail-ot1-f47.google.com with SMTP id 5-20020a9d0685000000b0054706d7b8e5so25205939otx.3 for ; Tue, 05 Oct 2021 03:05:11 -0700 (PDT) X-Gm-Message-State: AOAM5303mbY3A5oQeRvnmFTbizJ//MWmMXrcmdvHbCQxptL7ZlHJDbbI KXb4o65nvbZHNybDsINI/+ur1GUYFo1vu34VcgE= X-Google-Smtp-Source: ABdhPJyNwUzHpg4recW5zF63ptU3BRiBenK5/NhTOWVYU17t6k8blQONXFxLehPsNwabdUB8tCArLsq9Ktu2rP7wFK8= X-Received: by 2002:a9d:7b48:: with SMTP id f8mr13826979oto.112.1633428311346; Tue, 05 Oct 2021 03:05:11 -0700 (PDT) MIME-Version: 1.0 References: <20211002005238.40280-1-jeremy.linton@arm.com> <20211002005238.40280-5-jeremy.linton@arm.com> In-Reply-To: From: "Ard Biesheuvel" Date: Tue, 5 Oct 2021 12:05:00 +0200 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH 4/5] Platform/RaspberryPi: Normal memory should not be marked as uncached To: Andrei Warkentin Cc: Jeremy Linton , "devel@edk2.groups.io" , "pete@akeo.ie" , "ardb+tianocore@kernel.org" , "leif@nuviainc.com" , "Sunny.Wang@arm.com" , "samer.el-haj-mahmoud@arm.com" Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Sat, 2 Oct 2021 at 03:14, Andrei Warkentin wrote= : > > I may have misunderstood the flags as being valid ways of mapping the add= ed range. Should we also then take out WC and WT? No, you understood correctly. The problem is that normal memory ceases to behave like normal memory when you map it UC (ie., unaligned accesses and DC ZVA instructions are no longer allowed) so it should be omitted. We use it in the memory map for things like the runtime MMIO mappings for NOR flash and RTC. WC and WT are reasonable for bare metal, but note that we omit those as well for ArmVirtPkg, as using those breaks coherency, which means the hypervisor/virtualization host's view of the guest's memory goes out of sync. > ________________________________ > From: Jeremy Linton > Sent: Friday, October 1, 2021 7:52 PM > To: devel@edk2.groups.io > Cc: pete@akeo.ie ; ardb+tianocore@kernel.org ; leif@nuviainc.com ; Andrei Warkentin ; Sunny.Wang@arm.com ; samer.el-haj-= mahmoud@arm.com ; Jeremy Linton > Subject: [PATCH 4/5] Platform/RaspberryPi: Normal memory should not be ma= rked as uncached > > The efi spec seems to indicate that the efi uncacheable attribute > should be mapped to device memory rather than normal-nc. This means > that the uefi mem attribute for the >3G ram doesn't match the remainder > of the RAM in the machine. > > So, lets remove the uncacheable attribute to make it more consistent. > > Signed-off-by: Jeremy Linton > --- > Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxe.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxe.c b/Platfor= m/RaspberryPi/Drivers/ConfigDxe/ConfigDxe.c > index 2ef7da67bd..415d99fadb 100644 > --- a/Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxe.c > +++ b/Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxe.c > @@ -499,7 +499,7 @@ ApplyVariables ( > > Status =3D gDS->AddMemorySpace (EfiGcdMemoryTypeSystemMemory, 3UL * = BASE_1GB, > SystemMemorySizeBelow4GB - (3UL * SIZE_1GB), > - EFI_MEMORY_UC | EFI_MEMORY_WC | EFI_MEMORY_WT | EFI_= MEMORY_WB); > + EFI_MEMORY_WC | EFI_MEMORY_WT | EFI_MEMORY_WB); > ASSERT_EFI_ERROR (Status); > Status =3D gDS->SetMemorySpaceAttributes (3UL * BASE_1GB, > SystemMemorySizeBelow4GB - (3UL * SIZE_1GB), EFI_MEM= ORY_WB); > @@ -511,7 +511,7 @@ ApplyVariables ( > // > Status =3D gDS->AddMemorySpace (EfiGcdMemoryTypeSystemMemory, 4UL = * BASE_1GB, > SystemMemorySize - (4UL * SIZE_1GB), > - EFI_MEMORY_UC | EFI_MEMORY_WC | EFI_MEMORY_WT | EF= I_MEMORY_WB); > + EFI_MEMORY_WC | EFI_MEMORY_WT | EFI_MEMORY_WB); > ASSERT_EFI_ERROR (Status); > Status =3D gDS->SetMemorySpaceAttributes (4UL * BASE_1GB, > SystemMemorySize - (4UL * SIZE_1GB), EFI_MEMORY_WB= ); > -- > 2.13.7 >