From: Jon Derrick <jonathan.derrick@intel.com>
To: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
Cc: <linux-pci@vger.kernel.org>, Bjorn Helgaas <helgaas@kernel.org>,
Nirmal Patel <nirmal.patel@intel.com>,
Sushma Kalakota <sushmax.kalakota@intel.com>,
Jon Derrick <jonathan.derrick@intel.com>
Subject: [PATCH 4/5] PCI: vmd: Pass features to vmd_get_phys_offsets()
Date: Fri, 20 Nov 2020 15:51:43 -0700 [thread overview]
Message-ID: <20201120225144.15138-5-jonathan.derrick@intel.com> (raw)
In-Reply-To: <20201120225144.15138-1-jonathan.derrick@intel.com>
Modifies the physical address offset parser to use the device-specific
features member. No functional changes.
Signed-off-by: Jon Derrick <jonathan.derrick@intel.com>
---
drivers/pci/controller/vmd.c | 20 ++++++++------------
1 file changed, 8 insertions(+), 12 deletions(-)
diff --git a/drivers/pci/controller/vmd.c b/drivers/pci/controller/vmd.c
index b0504ee..71aa002 100644
--- a/drivers/pci/controller/vmd.c
+++ b/drivers/pci/controller/vmd.c
@@ -493,14 +493,14 @@ static void vmd_phys_to_offset(struct vmd_dev *vmd, u64 phys1, u64 phys2,
(phys2 & PCI_BASE_ADDRESS_MEM_MASK);
}
-static int vmd_get_phys_offsets(struct vmd_dev *vmd, bool native_hint,
+static int vmd_get_phys_offsets(struct vmd_dev *vmd, unsigned long features,
resource_size_t *offset1,
resource_size_t *offset2)
{
struct pci_dev *dev = vmd->dev;
u64 phys1, phys2;
- if (native_hint) {
+ if (features & VMD_FEAT_HAS_MEMBAR_SHADOW) {
u32 vmlock;
int ret;
@@ -519,7 +519,7 @@ static int vmd_get_phys_offsets(struct vmd_dev *vmd, bool native_hint,
pci_iounmap(dev, membar2);
vmd_phys_to_offset(vmd, phys1, phys2, offset1, offset2);
}
- } else {
+ } else if (features & VMD_FEAT_HAS_MEMBAR_SHADOW_VSCAP) {
/* Hypervisor-Emulated Vendor-Specific Capability */
int pos = pci_find_capability(dev, PCI_CAP_ID_VNDR);
u32 reg, regu;
@@ -638,16 +638,12 @@ static int vmd_enable_domain(struct vmd_dev *vmd, unsigned long features)
* and child devices. These registers will either return the host value
* or 0, depending on an enable bit in the VMD device.
*/
- if (features & VMD_FEAT_HAS_MEMBAR_SHADOW) {
+ if (features & VMD_FEAT_HAS_MEMBAR_SHADOW)
membar2_offset = MB2_SHADOW_OFFSET + MB2_SHADOW_SIZE;
- ret = vmd_get_phys_offsets(vmd, true, &offset[0], &offset[1]);
- if (ret)
- return ret;
- } else if (features & VMD_FEAT_HAS_MEMBAR_SHADOW_VSCAP) {
- ret = vmd_get_phys_offsets(vmd, false, &offset[0], &offset[1]);
- if (ret)
- return ret;
- }
+
+ ret = vmd_get_phys_offsets(vmd, features, &offset[0], &offset[1]);
+ if (ret)
+ return ret;
/*
* Certain VMD devices may have a root port configuration option which
--
1.8.3.1
next prev parent reply other threads:[~2020-11-20 22:52 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-11-20 22:51 [PATCH 0/5] Legacy direct-assign mode Jon Derrick
2020-11-20 22:51 ` [PATCH 1/5] PCI: vmd: Reset the VMD subdevice domain on probe Jon Derrick
2020-11-20 22:51 ` [PATCH 2/5] PCI: Add a reset quirk for VMD Jon Derrick
2020-11-24 21:40 ` Bjorn Helgaas
2020-11-25 17:22 ` Derrick, Jonathan
2020-11-25 17:34 ` Alex Williamson
2020-11-20 22:51 ` [PATCH 3/5] PCI: vmd: Add offset translation helper Jon Derrick
2020-11-20 22:51 ` Jon Derrick [this message]
2020-11-20 22:51 ` [PATCH 5/5] PCI: vmd: Add legacy guest passthrough mode Jon Derrick
2021-03-22 12:28 ` [PATCH 0/5] Legacy direct-assign mode Lorenzo Pieralisi
2021-03-22 15:25 ` Derrick, Jonathan
2021-03-22 19:48 ` Christoph Hellwig
2021-03-22 22:55 ` Derrick, Jonathan
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=20201120225144.15138-5-jonathan.derrick@intel.com \
--to=jonathan.derrick@intel.com \
--cc=helgaas@kernel.org \
--cc=linux-pci@vger.kernel.org \
--cc=lorenzo.pieralisi@arm.com \
--cc=nirmal.patel@intel.com \
--cc=sushmax.kalakota@intel.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).