[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20150714212459.11515.71211.stgit@gimli.home>
Date: Tue, 14 Jul 2015 15:25:04 -0600
From: Alex Williamson <alex.williamson@...hat.com>
To: iommu@...ts.linux-foundation.org
Cc: joro@...tes.org, dwmw2@...radead.org, linux-kernel@...r.kernel.org
Subject: [PATCH 2/2] iommu/vt-d: Report superpage support in sysfs
We already have the VT-d capability register printed raw, but it
typically involves a trip to the code or the spec to figure out
whether superpages are supported. Make this easier with "2M_pages"
and "1G_pages" sysfs entries that clearly report Y/N.
Signed-off-by: Alex Williamson <alex.williamson@...hat.com>
---
drivers/iommu/intel-iommu.c | 22 ++++++++++++++++++++++
1 file changed, 22 insertions(+)
diff --git a/drivers/iommu/intel-iommu.c b/drivers/iommu/intel-iommu.c
index 560afc0..eb6e3f4 100644
--- a/drivers/iommu/intel-iommu.c
+++ b/drivers/iommu/intel-iommu.c
@@ -4468,6 +4468,26 @@ static ssize_t intel_iommu_show_ndoms_used(struct device *dev,
}
static DEVICE_ATTR(domains_used, S_IRUGO, intel_iommu_show_ndoms_used, NULL);
+static ssize_t intel_iommu_show_2M_pages(struct device *dev,
+ struct device_attribute *attr,
+ char *buf)
+{
+ struct intel_iommu *iommu = dev_get_drvdata(dev);
+ return sprintf(buf, "%c\n", cap_super_page_val(iommu->cap) & 1 ?
+ 'Y' : 'N');
+}
+static DEVICE_ATTR(2M_pages, S_IRUGO, intel_iommu_show_2M_pages, NULL);
+
+static ssize_t intel_iommu_show_1G_pages(struct device *dev,
+ struct device_attribute *attr,
+ char *buf)
+{
+ struct intel_iommu *iommu = dev_get_drvdata(dev);
+ return sprintf(buf, "%c\n", cap_super_page_val(iommu->cap) & 2 ?
+ 'Y' : 'N');
+}
+static DEVICE_ATTR(1G_pages, S_IRUGO, intel_iommu_show_1G_pages, NULL);
+
static struct attribute *intel_iommu_attrs[] = {
&dev_attr_version.attr,
&dev_attr_address.attr,
@@ -4475,6 +4495,8 @@ static struct attribute *intel_iommu_attrs[] = {
&dev_attr_ecap.attr,
&dev_attr_domains_supported.attr,
&dev_attr_domains_used.attr,
+ &dev_attr_2M_pages.attr,
+ &dev_attr_1G_pages.attr,
NULL,
};
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists