From: Joerg Roedel <joro-zLv9SwRftAIdnm+yROfE0A@public.gmane.org>
To: suravee.suthikulpanit-5C7GfCeVMHo@public.gmane.org
Cc: iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org,
jay.cornwall-5C7GfCeVMHo@public.gmane.org,
linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
kim.naru-5C7GfCeVMHo@public.gmane.org
Subject: Re: [PATCH] iommu/amd: Fix logics to determine and checking max PASID
Date: Wed, 5 Mar 2014 23:35:45 +0100 [thread overview]
Message-ID: <20140305223544.GA2813@8bytes.org> (raw)
In-Reply-To: <1394046068-3858-1-git-send-email-suravee.suthikulpanit-5C7GfCeVMHo@public.gmane.org>
On Wed, Mar 05, 2014 at 01:01:08PM -0600, suravee.suthikulpanit-5C7GfCeVMHo@public.gmane.org wrote:
> drivers/iommu/amd_iommu.c | 26 +++++++++++++++++++++++---
> drivers/iommu/amd_iommu_init.c | 15 ++++++++-------
> drivers/iommu/amd_iommu_types.h | 6 ++----
> drivers/iommu/amd_iommu_v2.c | 2 +-
> 4 files changed, 34 insertions(+), 15 deletions(-)
Hmm, this looks a bit complicated. Since the inv_iotlb_pasid and
complete_ppr command only support 16 bit pasids by specification, there
is no way to support pasids with more than 16 bits in general anymore. I
think the best way to handle it is to just change the PASID_MASK to
0x0000ffff.
> static void build_inv_iotlb_pasid(struct iommu_cmd *cmd, u16 devid, int pasid,
> int qdep, u64 address, bool size)
> {
> + /* Note:
> + * This command supports only 16-bit PASID.
> + * Currently, hardware only implement upto 16-bit PASID
> + * even though the spec says it could have upto 20 bits.
> + * This is likely to be updated in the future revision of
> + * IOMMU specs when the hardware with PASID > 16 bits
> + * become available.
> + */
> + BUG_ON(pasid > 0xFFFF);
We can keep this as BUG_ON(pasid & ~PASID_MASK), but then ...
> - cmd->data[1] = pasid & PASID_MASK;
> + cmd->data[1] = pasid & amd_iommu_max_pasid;
... masking out the other bits is redundant.
Joerg
WARNING: multiple messages have this Message-ID (diff)
From: Joerg Roedel <joro@8bytes.org>
To: suravee.suthikulpanit@amd.com
Cc: iommu@lists.linux-foundation.org, linux-kernel@vger.kernel.org,
kim.naru@amd.com, jay.cornwall@amd.com
Subject: Re: [PATCH] iommu/amd: Fix logics to determine and checking max PASID
Date: Wed, 5 Mar 2014 23:35:45 +0100 [thread overview]
Message-ID: <20140305223544.GA2813@8bytes.org> (raw)
In-Reply-To: <1394046068-3858-1-git-send-email-suravee.suthikulpanit@amd.com>
On Wed, Mar 05, 2014 at 01:01:08PM -0600, suravee.suthikulpanit@amd.com wrote:
> drivers/iommu/amd_iommu.c | 26 +++++++++++++++++++++++---
> drivers/iommu/amd_iommu_init.c | 15 ++++++++-------
> drivers/iommu/amd_iommu_types.h | 6 ++----
> drivers/iommu/amd_iommu_v2.c | 2 +-
> 4 files changed, 34 insertions(+), 15 deletions(-)
Hmm, this looks a bit complicated. Since the inv_iotlb_pasid and
complete_ppr command only support 16 bit pasids by specification, there
is no way to support pasids with more than 16 bits in general anymore. I
think the best way to handle it is to just change the PASID_MASK to
0x0000ffff.
> static void build_inv_iotlb_pasid(struct iommu_cmd *cmd, u16 devid, int pasid,
> int qdep, u64 address, bool size)
> {
> + /* Note:
> + * This command supports only 16-bit PASID.
> + * Currently, hardware only implement upto 16-bit PASID
> + * even though the spec says it could have upto 20 bits.
> + * This is likely to be updated in the future revision of
> + * IOMMU specs when the hardware with PASID > 16 bits
> + * become available.
> + */
> + BUG_ON(pasid > 0xFFFF);
We can keep this as BUG_ON(pasid & ~PASID_MASK), but then ...
> - cmd->data[1] = pasid & PASID_MASK;
> + cmd->data[1] = pasid & amd_iommu_max_pasid;
... masking out the other bits is redundant.
Joerg
next prev parent reply other threads:[~2014-03-05 22:35 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-03-05 19:01 [PATCH] iommu/amd: Fix logics to determine and checking max PASID suravee.suthikulpanit-5C7GfCeVMHo
2014-03-05 19:01 ` suravee.suthikulpanit
[not found] ` <1394046068-3858-1-git-send-email-suravee.suthikulpanit-5C7GfCeVMHo@public.gmane.org>
2014-03-05 22:35 ` Joerg Roedel [this message]
2014-03-05 22:35 ` Joerg Roedel
[not found] ` <20140305223544.GA2813-zLv9SwRftAIdnm+yROfE0A@public.gmane.org>
2014-03-05 22:46 ` Suravee Suthikulanit
2014-03-05 22:46 ` Suravee Suthikulanit
2014-03-05 23:08 ` Suravee Suthikulanit
2014-03-05 23:08 ` Suravee Suthikulanit
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=20140305223544.GA2813@8bytes.org \
--to=joro-zlv9swrftaidnm+yrofe0a@public.gmane.org \
--cc=iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org \
--cc=jay.cornwall-5C7GfCeVMHo@public.gmane.org \
--cc=kim.naru-5C7GfCeVMHo@public.gmane.org \
--cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=suravee.suthikulpanit-5C7GfCeVMHo@public.gmane.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.