From patchwork Thu Mar 29 02:31:32 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: gary guo X-Patchwork-Id: 132550 Delivered-To: patch@linaro.org Received: by 10.46.84.29 with SMTP id i29csp1195435ljb; Wed, 28 Mar 2018 19:31:53 -0700 (PDT) X-Google-Smtp-Source: AIpwx4/f/TtXmwhDz9BKfoW8BeHuwzXl5n89QRRg1XOsHpLwqpPhPas89PN4Nnc9ptMp2DAdS6SX X-Received: by 2002:a17:902:2983:: with SMTP id h3-v6mr6289419plb.346.1522290713302; Wed, 28 Mar 2018 19:31:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1522290713; cv=none; d=google.com; s=arc-20160816; b=SOu4vjOvTAZHn83ouCYK32mnrEot9VUtDBU0rxsLN1XP81t3gmueg3aoN6mz7zspil xQ0Lta7AD4Ntwip+Umr22QqIPlExFX/Cfi/tI+XISAQvJKedkbg2YhJdlosNIB1M0Xal 5zycR8/g4hPORW/Eb48ASoU0KRIVStQ4ChqZ4y8IWCxDZch0w7B6k5Me43zJtZsat8KB 4F56tElpSVE4+0pc15Ixc/WrqaQK1Gn8/nzqfL8gbNrHNFFWBFZoBo2o9OGlF0DSCBFN VCoLCAsAtSV9pov7ygI/BnqWfcDpjJtPl2VTQZvdYBHX7iQxh0VtBpw85rJLrnqBp/pp FtSg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version:cc :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:message-id:date:to:from:dkim-signature :delivered-to:arc-authentication-results; bh=T5WaOJC1bGHXLa6quIxOjDRJTF08oLI+zwL5nmtqcbs=; b=hlCMi27gIm69dAMFs4gfgeWwsQtyaSSrgFOVN8N6Hd0EMD8rrCOVv0QHGuJo1RaM9I 26CtU3DhZkk3yQtedD8hZA6VIJzkcg0vQ/Q0wA51UQrFu92s5qTeIv4IPJC660sNXSQv nJeXyqMJ0a0P4H9jB9XGd9+yi0cnBHhiq2zQyMFNZoACLYlK0A+h/hBsCObXhpWAm32i qTi/U0E1KLB1aPIN1mZC39m5TiOviO6iTcUB8uMSEip4tMU5KReHux7G/NYN2TQvfWtv 2lW4X/l6mTBZWSl3VVh1G+xaQ4V9EwYTBlhM/8BX+j5ZKg85uf9WYHAO4mB+qHYeW4H9 Xo4g== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=Gfxg9ifp; spf=pass (google.com: best guess record for domain of edk2-devel-bounces@lists.01.org designates 2001:19d0:306:5::1 as permitted sender) smtp.mailfrom=edk2-devel-bounces@lists.01.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from ml01.01.org (ml01.01.org. [2001:19d0:306:5::1]) by mx.google.com with ESMTPS id x11-v6si4951260plm.326.2018.03.28.19.31.52 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 28 Mar 2018 19:31:53 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of edk2-devel-bounces@lists.01.org designates 2001:19d0:306:5::1 as permitted sender) client-ip=2001:19d0:306:5::1; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=Gfxg9ifp; spf=pass (google.com: best guess record for domain of edk2-devel-bounces@lists.01.org designates 2001:19d0:306:5::1 as permitted sender) smtp.mailfrom=edk2-devel-bounces@lists.01.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 2E4DE224DD137; Wed, 28 Mar 2018 19:25:13 -0700 (PDT) X-Original-To: edk2-devel@lists.01.org Delivered-To: edk2-devel@lists.01.org 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-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 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: [edk2] [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: , Cc: Yi Li , Eric Dong , Renhao Liang , Liming Gao , Heyi Guo , Michael D Kinney , Star Zeng MIME-Version: 1.0 Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" 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(-) -- 2.7.4 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel Signed-off-by: Heyi Guo Signed-off-by: Yi Li Signed-off-by: Renhao Liang Signed-off-by: Heyi Guo Signed-off-by: Yi Li Signed-off-by: Renhao Liang 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; }