All of lore.kernel.org
 help / color / mirror / Atom feed
From: Nadav Amit <nadav.amit@gmail.com>
To: Joerg Roedel <joro@8bytes.org>, Will Deacon <will@kernel.org>
Cc: Nadav Amit <namit@vmware.com>, Jiajun Cao <caojiajun@vmware.com>,
	iommu@lists.linux-foundation.org, linux-kernel@vger.kernel.org
Subject: [PATCH 1/4] iommu/amd: Fix wrong parentheses on page-specific invalidations
Date: Sat,  1 May 2021 23:59:56 -0700	[thread overview]
Message-ID: <20210502070001.1559127-2-namit@vmware.com> (raw)
In-Reply-To: <20210502070001.1559127-1-namit@vmware.com>

From: Nadav Amit <namit@vmware.com>

The logic to determine the mask of page-specific invalidations was
tested in userspace. As the code was copied into the kernel, the
parentheses were mistakenly set in the wrong place, resulting in the
wrong mask.

Fix it.

Cc: Joerg Roedel <joro@8bytes.org>
Cc: Will Deacon <will@kernel.org>
Cc: Jiajun Cao <caojiajun@vmware.com>
Cc: iommu@lists.linux-foundation.org
Cc: linux-kernel@vger.kernel.org
Fixes: 268aa4548277 ("iommu/amd: Page-specific invalidations for more than one page")
Signed-off-by: Nadav Amit <namit@vmware.com>
---
 drivers/iommu/amd/iommu.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/iommu/amd/iommu.c b/drivers/iommu/amd/iommu.c
index 80e8e1916dd1..6723cbcf4030 100644
--- a/drivers/iommu/amd/iommu.c
+++ b/drivers/iommu/amd/iommu.c
@@ -884,7 +884,7 @@ static inline u64 build_inv_address(u64 address, size_t size)
 		 * The msb-bit must be clear on the address. Just set all the
 		 * lower bits.
 		 */
-		address |= 1ull << (msb_diff - 1);
+		address |= (1ull << msb_diff) - 1;
 	}
 
 	/* Clear bits 11:0 */
-- 
2.25.1


WARNING: multiple messages have this Message-ID (diff)
From: Nadav Amit <nadav.amit@gmail.com>
To: Joerg Roedel <joro@8bytes.org>, Will Deacon <will@kernel.org>
Cc: iommu@lists.linux-foundation.org, Nadav Amit <namit@vmware.com>,
	Jiajun Cao <caojiajun@vmware.com>,
	linux-kernel@vger.kernel.org
Subject: [PATCH 1/4] iommu/amd: Fix wrong parentheses on page-specific invalidations
Date: Sat,  1 May 2021 23:59:56 -0700	[thread overview]
Message-ID: <20210502070001.1559127-2-namit@vmware.com> (raw)
In-Reply-To: <20210502070001.1559127-1-namit@vmware.com>

From: Nadav Amit <namit@vmware.com>

The logic to determine the mask of page-specific invalidations was
tested in userspace. As the code was copied into the kernel, the
parentheses were mistakenly set in the wrong place, resulting in the
wrong mask.

Fix it.

Cc: Joerg Roedel <joro@8bytes.org>
Cc: Will Deacon <will@kernel.org>
Cc: Jiajun Cao <caojiajun@vmware.com>
Cc: iommu@lists.linux-foundation.org
Cc: linux-kernel@vger.kernel.org
Fixes: 268aa4548277 ("iommu/amd: Page-specific invalidations for more than one page")
Signed-off-by: Nadav Amit <namit@vmware.com>
---
 drivers/iommu/amd/iommu.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/iommu/amd/iommu.c b/drivers/iommu/amd/iommu.c
index 80e8e1916dd1..6723cbcf4030 100644
--- a/drivers/iommu/amd/iommu.c
+++ b/drivers/iommu/amd/iommu.c
@@ -884,7 +884,7 @@ static inline u64 build_inv_address(u64 address, size_t size)
 		 * The msb-bit must be clear on the address. Just set all the
 		 * lower bits.
 		 */
-		address |= 1ull << (msb_diff - 1);
+		address |= (1ull << msb_diff) - 1;
 	}
 
 	/* Clear bits 11:0 */
-- 
2.25.1

_______________________________________________
iommu mailing list
iommu@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/iommu

  reply	other threads:[~2021-05-02  7:05 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-02  6:59 [PATCH 0/4] iommu/amd: Enable page-selective flushes Nadav Amit
2021-05-02  6:59 ` Nadav Amit
2021-05-02  6:59 ` Nadav Amit [this message]
2021-05-02  6:59   ` [PATCH 1/4] iommu/amd: Fix wrong parentheses on page-specific invalidations Nadav Amit
2021-05-18  9:23   ` Joerg Roedel
2021-05-18  9:23     ` Joerg Roedel
2021-05-31 20:11     ` Nadav Amit
2021-05-31 20:11       ` Nadav Amit
2021-05-02  6:59 ` [PATCH 2/4] iommu/amd: Do not sync on page size changes Nadav Amit
2021-05-02  6:59   ` Nadav Amit
2021-05-02  6:59 ` [PATCH 2/4] iommu/amd: Selective flush on unmap Nadav Amit
2021-05-02  6:59   ` Nadav Amit
2021-05-02  6:59 ` [PATCH 3/4] iommu/amd: Do not sync on page size changes Nadav Amit
2021-05-02  6:59   ` Nadav Amit
2021-06-01 15:59   ` Robin Murphy
2021-06-01 15:59     ` Robin Murphy
2021-06-01 16:39     ` Nadav Amit
2021-06-01 16:39       ` Nadav Amit
2021-06-01 17:27       ` Robin Murphy
2021-06-01 17:27         ` Robin Murphy
2021-06-01 18:56         ` Nadav Amit
2021-06-01 18:56           ` Nadav Amit
2021-05-02  7:00 ` [PATCH 3/4] iommu/amd: Selective flush on unmap Nadav Amit
2021-05-02  7:00   ` Nadav Amit
2021-05-02  7:00 ` [PATCH 4/4] iommu/amd: Do not use flush-queue when NpCache is on Nadav Amit
2021-05-02  7:00   ` Nadav Amit

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210502070001.1559127-2-namit@vmware.com \
    --to=nadav.amit@gmail.com \
    --cc=caojiajun@vmware.com \
    --cc=iommu@lists.linux-foundation.org \
    --cc=joro@8bytes.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=namit@vmware.com \
    --cc=will@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.