From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=2607:f8b0:400e:c00::243; helo=mail-pf0-x243.google.com; envelope-from=heyi.guo@linaro.org; receiver=edk2-devel@lists.01.org Received: from mail-pf0-x243.google.com (mail-pf0-x243.google.com [IPv6:2607:f8b0:400e:c00::243]) (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 73ED121F85E91 for ; Wed, 28 Mar 2018 19:25:11 -0700 (PDT) Received: by mail-pf0-x243.google.com with SMTP id t16so2213338pfh.4 for ; Wed, 28 Mar 2018 19:31:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id; bh=/fntoPfKX/wVbjsFzvhYZRyJLWiM/89Z/bqmZRaTzfk=; b=Gfxg9ifpXUBdrcEpq4zotrQYFTx8T2mFLACY6TGME1tBgl0gXvphmvM7Y7tKm7R1jQ sMjJQx1HThP7K7e8CLxZhgpID02FvRNfFbkvTiLov20H6+kgA6YlDNUkvV3usC4SKfsE 4uRZc7XM7V//aSTIaYw7+CgrXI12aubCOD3HQ= 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=/fntoPfKX/wVbjsFzvhYZRyJLWiM/89Z/bqmZRaTzfk=; b=A/z5/SCYV6+EjwQgd0sokmFx1IC9BvHKVLtcUmhzXbJEQF3KKBIimDcRfW6nfEkw02 5I9Fkp/vIaQ3THx6U1DGFzT9ATOavV9Z8DRXRWIutnRYJf0UQK0M0LfAfVdkhiZZJvbw FWOl9bXRUBJJyGnquNZU8XKrRXCH8EGzIu5gqkTlfAhQDNDf/wVU+k1MfA/Dz2+K5lPV SfvMk4+T5QNz/t16tcvVr58D5GosDxDkM4lF2mtxgI/nmXRWVLZPp/7CnKDBxK8S3mJj VRVn0VBbRXjIZZwLzGYhheR/DlUbROZllDLaZM/d7Vums1okRXcug4RBgEvMaUcVD32W LJcw== X-Gm-Message-State: AElRT7EHUYhLq5ZjCBEKvgBwX8I3GonF+EIO3ULmZCWU195/p0vkcO2F Jw/yse3BLZmXDbkqKz0FVl0trlFdr+s= X-Google-Smtp-Source: AIpwx49rG57mFxS0R3XRWdVsPY6zx8MzRfZwjBoSn06fUJeJv8QFeRyKNj+k7iQkI5vYySCQMapaSQ== X-Received: by 10.101.93.71 with SMTP id e7mr4113093pgt.171.1522290710763; Wed, 28 Mar 2018 19:31:50 -0700 (PDT) Received: from localhost.localdomain ([104.237.91.79]) by smtp.gmail.com with ESMTPSA id t128sm9519644pfb.157.2018.03.28.19.31.48 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 28 Mar 2018 19:31:50 -0700 (PDT) From: Heyi Guo To: edk2-devel@lists.01.org Cc: Heyi Guo , Yi Li , Renhao Liang , Star Zeng , Eric Dong , Michael D Kinney , Liming Gao Date: Thu, 29 Mar 2018 10:31:32 +0800 Message-Id: <1522290692-99585-1-git-send-email-heyi.guo@linaro.org> X-Mailer: git-send-email 2.7.4 Subject: [RFC 1/1] MdeModulePkg/Gcd: Fix bug of attribute conversion 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: , X-List-Received-Date: Thu, 29 Mar 2018 02:25:12 -0000 For gDS->SetMemorySpaceAttributes(), when user passes a combined memory attribute including CPU arch attribute and other attributes, like EFI_MEMORY_RUNTIME, ConverToCpuArchAttributes() will return INVALID_CPU_ARCH_ATTRIBUTES and skip setting page/cache attribute for the specified memory space. We don't see any reason to forbid combining CPU arch attributes and non-CPU-arch attributes when calling gDS->SetMemorySpaceAttributes(), so we change ConverToCpuArchAttributes() to only check if there is valid CPU arch attributes in the input "Attribute" parameter and just ignore other attributes. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Heyi Guo Signed-off-by: Yi Li Signed-off-by: Renhao Liang Cc: Star Zeng Cc: Eric Dong Cc: Michael D Kinney Cc: Liming Gao --- MdeModulePkg/Core/Dxe/Gcd/Gcd.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/MdeModulePkg/Core/Dxe/Gcd/Gcd.c b/MdeModulePkg/Core/Dxe/Gcd/Gcd.c index 77f4adb4bc01..2ababdd14cc6 100644 --- a/MdeModulePkg/Core/Dxe/Gcd/Gcd.c +++ b/MdeModulePkg/Core/Dxe/Gcd/Gcd.c @@ -673,8 +673,8 @@ ConverToCpuArchAttributes ( { UINT64 CpuArchAttributes; - if ((Attributes & ~(EXCLUSIVE_MEMORY_ATTRIBUTES | - NONEXCLUSIVE_MEMORY_ATTRIBUTES)) != 0) { + if ((Attributes & (EXCLUSIVE_MEMORY_ATTRIBUTES | + NONEXCLUSIVE_MEMORY_ATTRIBUTES)) == 0) { return INVALID_CPU_ARCH_ATTRIBUTES; } -- 2.7.4