From: Wan Zongshun <vw-6ukY98dZOFrYtjvyW6yDsg@public.gmane.org>
To: Joerg Roedel <joro-zLv9SwRftAIdnm+yROfE0A@public.gmane.org>,
Wan ZongShun <mcuos.com-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
Cc: linux-kernel
<linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
Wan Zongshun <vincent.wan-5C7GfCeVMHo@public.gmane.org>,
iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org,
Ray Huang <ray.huang-5C7GfCeVMHo@public.gmane.org>,
Borislav Petkov <bp-l3A5Bk7waGM@public.gmane.org>,
ken.xue-5C7GfCeVMHo@public.gmane.org
Subject: Re: [PATCH 5/6] iommu/amd: Add support for non-pci devices
Date: Fri, 8 Jan 2016 22:52:59 +0800 [thread overview]
Message-ID: <568FCD4B.4000807@iommu.org> (raw)
In-Reply-To: <20160108121855.GU18805-zLv9SwRftAIdnm+yROfE0A@public.gmane.org>
>>
>>
>> static bool check_device(struct device *dev)
>> {
>> u16 devid;
>> ......
>>
>> /* No PCI device */
>> if (!dev_is_pci(dev) && (get_acpihid_device_id(dev, NULL) < 0))
>> return false;
>>
>> devid = get_device_id(dev);
>
> That is true for this case, but the other call-sites of get_device_id()
> still have to care about a potential negative return value, right?
>
Actually I am supposing the '.add_device' will be the first called in
iommu initializing stage, so I think as long as having no error of check
device here, any call-sites of get_device_id() will be fine, because
adding device successfully should be the pre-condition of any iommu
function can be performed, please correct me.
static int amd_iommu_add_device(struct device *dev)
{
struct iommu_dev_data *dev_data;
struct iommu_domain *domain;
struct amd_iommu *iommu;
u16 devid;
int ret;
if (!check_device(dev) || get_dev_data(dev))
return 0;
devid = get_device_id(dev);
iommu = amd_iommu_rlookup_table[devid];
Vincent.
>
> Joerg
>
>
WARNING: multiple messages have this Message-ID (diff)
From: Wan Zongshun <vw@iommu.org>
To: Joerg Roedel <joro@8bytes.org>, Wan ZongShun <mcuos.com@gmail.com>
Cc: Wan Zongshun <vincent.wan@amd.com>,
linux-kernel <linux-kernel@vger.kernel.org>,
iommu@lists.linux-foundation.org, Ray Huang <ray.huang@amd.com>,
Borislav Petkov <bp@suse.de>,
ken.xue@amd.com
Subject: Re: [PATCH 5/6] iommu/amd: Add support for non-pci devices
Date: Fri, 8 Jan 2016 22:52:59 +0800 [thread overview]
Message-ID: <568FCD4B.4000807@iommu.org> (raw)
In-Reply-To: <20160108121855.GU18805@8bytes.org>
>>
>>
>> static bool check_device(struct device *dev)
>> {
>> u16 devid;
>> ......
>>
>> /* No PCI device */
>> if (!dev_is_pci(dev) && (get_acpihid_device_id(dev, NULL) < 0))
>> return false;
>>
>> devid = get_device_id(dev);
>
> That is true for this case, but the other call-sites of get_device_id()
> still have to care about a potential negative return value, right?
>
Actually I am supposing the '.add_device' will be the first called in
iommu initializing stage, so I think as long as having no error of check
device here, any call-sites of get_device_id() will be fine, because
adding device successfully should be the pre-condition of any iommu
function can be performed, please correct me.
static int amd_iommu_add_device(struct device *dev)
{
struct iommu_dev_data *dev_data;
struct iommu_domain *domain;
struct amd_iommu *iommu;
u16 devid;
int ret;
if (!check_device(dev) || get_dev_data(dev))
return 0;
devid = get_device_id(dev);
iommu = amd_iommu_rlookup_table[devid];
Vincent.
>
> Joerg
>
>
next prev parent reply other threads:[~2016-01-08 14:52 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-01-05 10:07 [PATCH 0/6] iommu/amd: enable ACPI hardware ID device support Wan Zongshun
2016-01-05 10:07 ` Wan Zongshun
[not found] ` <1451988444-4694-1-git-send-email-vincent.wan-5C7GfCeVMHo@public.gmane.org>
2016-01-05 10:07 ` [PATCH 1/6] iommu/amd: Modify ivhd_header structure to support type 11h and 40h Wan Zongshun
2016-01-05 10:07 ` Wan Zongshun
2016-01-05 10:07 ` [PATCH 2/6] iommu/amd: Use the most comprehensive IVHD type that the driver can support Wan Zongshun
2016-01-05 10:07 ` Wan Zongshun
2016-01-05 10:07 ` [PATCH 3/6] iommu/amd: Add new map for storing IVHD dev entry type HID Wan Zongshun
2016-01-05 10:07 ` Wan Zongshun
2016-01-05 10:07 ` [PATCH 4/6] iommu/amd: Introduces ivrs_acpihid kernel parameter Wan Zongshun
2016-01-05 10:07 ` Wan Zongshun
2016-01-05 10:07 ` [PATCH 5/6] iommu/amd: Add support for non-pci devices Wan Zongshun
2016-01-05 10:07 ` Wan Zongshun
[not found] ` <1451988444-4694-6-git-send-email-vincent.wan-5C7GfCeVMHo@public.gmane.org>
2016-01-07 12:04 ` Joerg Roedel
2016-01-07 12:04 ` Joerg Roedel
[not found] ` <20160107120422.GB19149-zLv9SwRftAIdnm+yROfE0A@public.gmane.org>
2016-01-08 3:15 ` Wan ZongShun
2016-01-08 3:15 ` Wan ZongShun
2016-01-08 12:18 ` Joerg Roedel
[not found] ` <20160108121855.GU18805-zLv9SwRftAIdnm+yROfE0A@public.gmane.org>
2016-01-08 14:52 ` Wan Zongshun [this message]
2016-01-08 14:52 ` Wan Zongshun
[not found] ` <568FCD4B.4000807-6ukY98dZOFrYtjvyW6yDsg@public.gmane.org>
2016-01-08 17:01 ` Joerg Roedel
2016-01-08 17:01 ` Joerg Roedel
2016-01-09 9:47 ` Wan Zongshun
2016-01-20 12:00 ` Joerg Roedel
2016-01-05 10:07 ` [PATCH 6/6] iommu/amd: Manage iommu_group " Wan Zongshun
2016-01-05 10:07 ` Wan Zongshun
[not found] ` <1451988444-4694-7-git-send-email-vincent.wan-5C7GfCeVMHo@public.gmane.org>
2016-01-07 12:06 ` Joerg Roedel
2016-01-07 12:06 ` Joerg Roedel
2016-01-08 1:44 ` Wan ZongShun
2016-01-05 15:40 ` [PATCH 0/6] iommu/amd: enable ACPI hardware ID device support Suravee Suthikulpanit
2016-01-05 15:40 ` Suravee Suthikulpanit
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=568FCD4B.4000807@iommu.org \
--to=vw-6uky98dzofrytjvyw6ydsg@public.gmane.org \
--cc=bp-l3A5Bk7waGM@public.gmane.org \
--cc=iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org \
--cc=joro-zLv9SwRftAIdnm+yROfE0A@public.gmane.org \
--cc=ken.xue-5C7GfCeVMHo@public.gmane.org \
--cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=mcuos.com-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
--cc=ray.huang-5C7GfCeVMHo@public.gmane.org \
--cc=vincent.wan-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.