From nobody Tue Apr 16 16:59:21 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) smtp.mailfrom=edk2-devel-bounces@lists.01.org; dmarc=fail(p=none dis=none) header.from=linaro.org Return-Path: Received: from ml01.01.org (ml01.01.org [198.145.21.10]) by mx.zohomail.com with SMTPS id 1528278766158706.3082100525587; Wed, 6 Jun 2018 02:52:46 -0700 (PDT) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id CC9F5210E12AA; Wed, 6 Jun 2018 02:52:42 -0700 (PDT) Received: from mail-wr0-x244.google.com (mail-wr0-x244.google.com [IPv6:2a00:1450:400c:c0c::244]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 23FD7210E12A5 for ; Wed, 6 Jun 2018 02:52:40 -0700 (PDT) Received: by mail-wr0-x244.google.com with SMTP id w10-v6so5563771wrk.9 for ; Wed, 06 Jun 2018 02:52:40 -0700 (PDT) Received: from dogfood.home ([2a01:cb1d:112:6f00:e8af:f8ab:ef29:1cd5]) by smtp.gmail.com with ESMTPSA id 135-v6sm5060643wmx.21.2018.06.06.02.52.37 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 06 Jun 2018 02:52:38 -0700 (PDT) X-Original-To: edk2-devel@lists.01.org Received-SPF: none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) client-ip=198.145.21.10; envelope-from=edk2-devel-bounces@lists.01.org; helo=ml01.01.org; Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=2a00:1450:400c:c0c::244; helo=mail-wr0-x244.google.com; envelope-from=ard.biesheuvel@linaro.org; receiver=edk2-devel@lists.01.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id; bh=2JHOnm7T52O3457vt1jCy/28RD4L26+NB2Wm3ma7IQM=; b=Pz0OM0SOVHsuGxLZXu6xD3RVoedu1JkKicvQq+BLab/0Srp8PWat3OPeIip1hoOP1E Gko8PFo2r134E519JLcMOpCtz+gUTcBLI7qYhDJ98czGHbg0sPldE8tAuaqMbBW3OVOs +dFgcOtdm/FJuhSTT7V9/KOj1lDPrQ4DHdeTg= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=2JHOnm7T52O3457vt1jCy/28RD4L26+NB2Wm3ma7IQM=; b=A0Ymmsd9JXXZtsUGWYUKP6f55w391bnIUxFgXTNmAy3LnMkpdBelPwBK6WY6MZvg1j 3WlzmXHGozm3Vst1XIo4SUtyXG2Wei4yqEJicyIRvp1sMOYAocNHtvIDYwqj3/anp5jz KUY1oDvpHqQ7Om7085bSZN+AYhkJtn/ZsINypaUP591LbClrQDAiyjNpO2wJPizobMGZ aLF0Nk/MlcK4wQyLuXuwSuahFDk2TL6/fMKqrUHtz++3yGwj/MzfcHu7/BSNmwUqDfT1 sGETxk8NjN9CLMFT/N9RXcXlGxcFcfxPJ/tB3lg6A+wHBtebXcZMI5aMgF5UdFDbDkFK 710A== X-Gm-Message-State: APt69E29iDrly1wvcSdHUc5BK1Ykz2wTDByodW/Ffwi15QoAhsbrooHO VAPLZ+BqeEUIUdK83YI6rjZYwpjOU3E= X-Google-Smtp-Source: ADUXVKJn7rJwf5nKpFV2zSNa9UAAhbGzuWx017Aygr1Riu6yrtOBysibyIT06ZCwzw8q/OdxNgezBQ== X-Received: by 2002:a5d:4b4b:: with SMTP id w11-v6mr1744666wrs.87.1528278759069; Wed, 06 Jun 2018 02:52:39 -0700 (PDT) From: Ard Biesheuvel To: edk2-devel@lists.01.org Date: Wed, 6 Jun 2018 11:52:35 +0200 Message-Id: <20180606095235.20822-1-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 2.17.0 Subject: [edk2] [PATCH] MdeModulePkg/CapsulePei: clean Dcache before consuming capsule data X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: ruiyu.ni@intel.com, Ard Biesheuvel , liming.gao@intel.com, jiewen.yao@intel.com, leif.lindholm@linaro.org, michael.d.kinney@intel.com, star.zeng@intel.com MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_4 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" When capsule updates are staged for processing after a warm reboot, they are copied into memory with the MMU and caches enabled. When the capsule PEI gets around to coalescing the capsule, the MMU and caches may still be disabled, and so on architectures where uncached accesses are incoherent with the caches (such as ARM and AARCH64), we may read stale data if we don't clean the caches to memory first. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Ard Biesheuvel Reviewed-by: Jiewen.yao@intel.com --- MdeModulePkg/Universal/CapsulePei/CapsulePei.inf | 1 + MdeModulePkg/Universal/CapsulePei/Common/CapsuleCoalesce.c | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/MdeModulePkg/Universal/CapsulePei/CapsulePei.inf b/MdeModulePk= g/Universal/CapsulePei/CapsulePei.inf index c54bc21a95a8..594e110d1f8a 100644 --- a/MdeModulePkg/Universal/CapsulePei/CapsulePei.inf +++ b/MdeModulePkg/Universal/CapsulePei/CapsulePei.inf @@ -48,6 +48,7 @@ [Packages] =20 [LibraryClasses] BaseLib + CacheMaintenanceLib HobLib BaseMemoryLib PeiServicesLib diff --git a/MdeModulePkg/Universal/CapsulePei/Common/CapsuleCoalesce.c b/M= deModulePkg/Universal/CapsulePei/Common/CapsuleCoalesce.c index 3e7054cd38a9..1730f925adc5 100644 --- a/MdeModulePkg/Universal/CapsulePei/Common/CapsuleCoalesce.c +++ b/MdeModulePkg/Universal/CapsulePei/Common/CapsuleCoalesce.c @@ -27,6 +27,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER= EXPRESS OR IMPLIED. #include =20 #include +#include #include #include #include @@ -283,6 +284,9 @@ ValidateCapsuleByMemoryResource ( DEBUG ((EFI_D_INFO, "Address(0x%lx) Size(0x%lx) in MemoryResource[0x= %x] - Start(0x%lx) Length(0x%lx)\n", Address, Size, Index, MemoryResource[Index].PhysicalStart, Memo= ryResource[Index].ResourceLength)); + + WriteBackDataCacheRange ((VOID *)(UINTN)Address, Size); + return TRUE; } } --=20 2.17.0 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel