Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1341079 > unrolled thread
| Started by | Jon Derrick <jonathan.derrick@intel.com> |
|---|---|
| First post | 2016-02-23 23:00 +0100 |
| Last post | 2016-02-24 00:50 +0100 |
| Articles | 3 — 2 participants |
Back to article view | Back to linux.kernel
[PATCH] VMD: Attach vmd resources to parent domain's resource tree Jon Derrick <jonathan.derrick@intel.com> - 2016-02-23 23:00 +0100
Re: [PATCH] VMD: Attach vmd resources to parent domain's resource tree Keith Busch <keith.busch@intel.com> - 2016-02-24 00:20 +0100
Re: [PATCH] VMD: Attach vmd resources to parent domain's resource tree Jon Derrick <jonathan.derrick@intel.com> - 2016-02-24 00:50 +0100
| From | Jon Derrick <jonathan.derrick@intel.com> |
|---|---|
| Date | 2016-02-23 23:00 +0100 |
| Subject | [PATCH] VMD: Attach vmd resources to parent domain's resource tree |
| Message-ID | <r5t9V-2Zj-29@gated-at.bofh.it> |
This patch attaches the new VMD domain's resources to the VMD device's
resources. This allows /proc/iomem to display a more complete picture.
Before:
c0000000-c1ffffff : 0000:5d:05.5
c2000000-c3ffffff : 0000:5d:05.5
c2010000-c2013fff : nvme
c4000000-c40fffff : 0000:5d:05.5
After:
c0000000-c1ffffff : 0000:5d:05.5
c0000000-0000001f : VMD CFGBAR
c2000000-c3ffffff : 0000:5d:05.5
c2000000-c3ffffff : VMD MEMBAR1
c2000000-c22fffff : PCI Bus 10000:01
c2000000-c200ffff : 10000:01:00.0
c2010000-c2013fff : 10000:01:00.0
c2010000-c2013fff : nvme
c2300000-c24fffff : PCI Bus 10000:01
c4000000-c40fffff : 0000:5d:05.5
c4002000-c40fffff : VMD MEMBAR2
Signed-off-by: Jon Derrick <jonathan.derrick@intel.com>
---
arch/x86/pci/vmd.c | 19 +++++++++++++++++++
1 file changed, 19 insertions(+)
diff --git a/arch/x86/pci/vmd.c b/arch/x86/pci/vmd.c
index d57e480..06490da 100644
--- a/arch/x86/pci/vmd.c
+++ b/arch/x86/pci/vmd.c
@@ -503,6 +503,20 @@ static struct pci_ops vmd_ops = {
.write = vmd_pci_write,
};
+static void vmd_attach_resources(struct vmd_dev *vmd)
+{
+ vmd->dev->resource[VMD_CFGBAR].child = &vmd->resources[0];
+ vmd->dev->resource[VMD_MEMBAR1].child = &vmd->resources[1];
+ vmd->dev->resource[VMD_MEMBAR2].child = &vmd->resources[2];
+}
+
+static void vmd_detach_resources(struct vmd_dev *vmd)
+{
+ vmd->dev->resource[VMD_CFGBAR].child = NULL;
+ vmd->dev->resource[VMD_MEMBAR1].child = NULL;
+ vmd->dev->resource[VMD_MEMBAR2].child = NULL;
+}
+
/*
* VMD domains start at 0x1000 to not clash with ACPI _SEG domains.
*/
@@ -530,6 +544,7 @@ static int vmd_enable_domain(struct vmd_dev *vmd)
.start = res->start,
.end = (resource_size(res) >> 20) - 1,
.flags = IORESOURCE_BUS | IORESOURCE_PCI_FIXED,
+ .parent = res,
};
res = &vmd->dev->resource[VMD_MEMBAR1];
@@ -542,6 +557,7 @@ static int vmd_enable_domain(struct vmd_dev *vmd)
.start = res->start,
.end = res->end,
.flags = flags,
+ .parent = res,
};
res = &vmd->dev->resource[VMD_MEMBAR2];
@@ -554,6 +570,7 @@ static int vmd_enable_domain(struct vmd_dev *vmd)
.start = res->start + 0x2000,
.end = res->end,
.flags = flags,
+ .parent = res,
};
sd->domain = vmd_find_free_domain();
@@ -578,6 +595,7 @@ static int vmd_enable_domain(struct vmd_dev *vmd)
return -ENODEV;
}
+ vmd_attach_resources(vmd);
vmd_setup_dma_ops(vmd);
dev_set_msi_domain(&vmd->bus->dev, vmd->irq_domain);
pci_rescan_bus(vmd->bus);
@@ -674,6 +692,7 @@ static void vmd_remove(struct pci_dev *dev)
{
struct vmd_dev *vmd = pci_get_drvdata(dev);
+ vmd_detach_resources(vmd);
pci_set_drvdata(dev, NULL);
sysfs_remove_link(&vmd->dev->dev.kobj, "domain");
pci_stop_root_bus(vmd->bus);
--
1.8.3.1
[toc] | [next] | [standalone]
| From | Keith Busch <keith.busch@intel.com> |
|---|---|
| Date | 2016-02-24 00:20 +0100 |
| Subject | Re: [PATCH] VMD: Attach vmd resources to parent domain's resource tree |
| Message-ID | <r5upk-47T-13@gated-at.bofh.it> |
| In reply to | #1341079 |
On Tue, Feb 23, 2016 at 02:50:13PM -0700, Jon Derrick wrote: > This patch attaches the new VMD domain's resources to the VMD device's > resources. This allows /proc/iomem to display a more complete picture. > > Before: > c0000000-c1ffffff : 0000:5d:05.5 > c2000000-c3ffffff : 0000:5d:05.5 > c2010000-c2013fff : nvme > c4000000-c40fffff : 0000:5d:05.5 > > After: > c0000000-c1ffffff : 0000:5d:05.5 > c0000000-0000001f : VMD CFGBAR > c2000000-c3ffffff : 0000:5d:05.5 > c2000000-c3ffffff : VMD MEMBAR1 > c2000000-c22fffff : PCI Bus 10000:01 > c2000000-c200ffff : 10000:01:00.0 > c2010000-c2013fff : 10000:01:00.0 > c2010000-c2013fff : nvme > c2300000-c24fffff : PCI Bus 10000:01 > c4000000-c40fffff : 0000:5d:05.5 > c4002000-c40fffff : VMD MEMBAR2 I think we should drop the CFGBAR from here since that's a bus resource rather than IO memory. Otherwise, this looks good and useful. I think in the near future we should come up with a better name than "VMD MEMBAR" to help distinguish multiple VMD's in a system.
[toc] | [prev] | [next] | [standalone]
| From | Jon Derrick <jonathan.derrick@intel.com> |
|---|---|
| Date | 2016-02-24 00:50 +0100 |
| Subject | Re: [PATCH] VMD: Attach vmd resources to parent domain's resource tree |
| Message-ID | <r5uSl-4mi-15@gated-at.bofh.it> |
| In reply to | #1341162 |
On Tue, Feb 23, 2016 at 11:16:11PM +0000, Keith Busch wrote: > On Tue, Feb 23, 2016 at 02:50:13PM -0700, Jon Derrick wrote: > > This patch attaches the new VMD domain's resources to the VMD device's > > resources. This allows /proc/iomem to display a more complete picture. > > > > Before: > > c0000000-c1ffffff : 0000:5d:05.5 > > c2000000-c3ffffff : 0000:5d:05.5 > > c2010000-c2013fff : nvme > > c4000000-c40fffff : 0000:5d:05.5 > > > > After: > > c0000000-c1ffffff : 0000:5d:05.5 > > c0000000-0000001f : VMD CFGBAR > > c2000000-c3ffffff : 0000:5d:05.5 > > c2000000-c3ffffff : VMD MEMBAR1 > > c2000000-c22fffff : PCI Bus 10000:01 > > c2000000-c200ffff : 10000:01:00.0 > > c2010000-c2013fff : 10000:01:00.0 > > c2010000-c2013fff : nvme > > c2300000-c24fffff : PCI Bus 10000:01 > > c4000000-c40fffff : 0000:5d:05.5 > > c4002000-c40fffff : VMD MEMBAR2 > > I think we should drop the CFGBAR from here since that's a bus resource > rather than IO memory. Otherwise, this looks good and useful. Yes that entry doesn't make much sense for iomem does it. I'll drop that part. > > I think in the near future we should come up with a better name than > "VMD MEMBAR" to help distinguish multiple VMD's in a system. Seconded. I'm fine with naming it by its PCI designator, eg 10000:01:00.0, and maybe a bar designator after that (or not).
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web