From: "David E. Box" <david.e.box@linux.intel.com>
To: hdegoede@redhat.com, david.e.box@linux.intel.com,
mgross@linux.intel.com, rjw@rjwysocki.net,
srinivas.pandruvada@intel.com
Cc: linux-kernel@vger.kernel.org, platform-driver-x86@vger.kernel.org
Subject: [PATCH 1/3] platform/x86/intel: pmt: Remove bin_attribute mmap support to runtime pm
Date: Mon, 14 Feb 2022 13:32:56 -0800 [thread overview]
Message-ID: <20220214213258.1929462-2-david.e.box@linux.intel.com> (raw)
In-Reply-To: <20220214213258.1929462-1-david.e.box@linux.intel.com>
PMT devices need to support runtime D3. However, binary attributes don't
provide access to open/release methods that could be used to control
runtime pm. Therefore, remove the mmap operation. The data may still be
accessed with read() calls.
Signed-off-by: David E. Box <david.e.box@linux.intel.com>
---
V0 comments:
I expect that this is an undesirable solution because of the ABI change.
I don't know if anyone is using this ABI outside of our Intel tools which
are willing to make this change. I'd rather find a solution to keep the
mmap support. I initially wrote a patch to simply add the missing open and
release callbacks to binary attributes but this was thought to be too heavy
handed in our internal review. I'm open to suggestions. Thanks.
David
.../ABI/testing/sysfs-class-intel_pmt | 24 +++++++-------
drivers/platform/x86/intel/pmt/class.c | 31 -------------------
2 files changed, 12 insertions(+), 43 deletions(-)
diff --git a/Documentation/ABI/testing/sysfs-class-intel_pmt b/Documentation/ABI/testing/sysfs-class-intel_pmt
index ed4c886a21b1..4182f67dcef8 100644
--- a/Documentation/ABI/testing/sysfs-class-intel_pmt
+++ b/Documentation/ABI/testing/sysfs-class-intel_pmt
@@ -15,10 +15,10 @@ Description:
The telem<x> directory contains files describing an instance of
a PMT telemetry device that exposes hardware telemetry. Each
telem<x> directory has an associated telem file. This file
- may be opened and mapped or read to access the telemetry space
- of the device. The register layout of the telemetry space is
- determined from an XML file that matches the PCI device id and
- GUID for the device.
+ may be opened and read to access the telemetry space of the
+ device. The register layout of the telemetry space is determined
+ from an XML file that matches the PCI device id and GUID for the
+ device.
What: /sys/class/intel_pmt/telem<x>/telem
Date: October 2020
@@ -26,7 +26,7 @@ KernelVersion: 5.10
Contact: David Box <david.e.box@linux.intel.com>
Description:
(RO) The telemetry data for this telemetry device. This file
- may be mapped or read to obtain the data.
+ may be read to obtain the data.
What: /sys/class/intel_pmt/telem<x>/guid
Date: October 2020
@@ -43,7 +43,7 @@ KernelVersion: 5.10
Contact: David Box <david.e.box@linux.intel.com>
Description:
(RO) The size of telemetry region in bytes that corresponds to
- the mapping size for the telem file.
+ the size of the telem file.
What: /sys/class/intel_pmt/telem<x>/offset
Date: October 2020
@@ -51,7 +51,7 @@ KernelVersion: 5.10
Contact: David Box <david.e.box@linux.intel.com>
Description:
(RO) The offset of telemetry region in bytes that corresponds to
- the mapping for the telem file.
+ the size of the telem file.
What: /sys/class/intel_pmt/crashlog<x>
Date: October 2020
@@ -61,10 +61,10 @@ Description:
The crashlog<x> directory contains files for configuring an
instance of a PMT crashlog device that can perform crash data
recording. Each crashlog<x> device has an associated crashlog
- file. This file can be opened and mapped or read to access the
- resulting crashlog buffer. The register layout for the buffer
- can be determined from an XML file of specified GUID for the
- parent device.
+ file. This file can be opened and read to access the resulting
+ crashlog buffer. The register layout for the buffer can be
+ determined from an XML file of specified GUID for the parent
+ device.
What: /sys/class/intel_pmt/crashlog<x>/crashlog
Date: October 2020
@@ -72,7 +72,7 @@ KernelVersion: 5.10
Contact: David Box <david.e.box@linux.intel.com>
Description:
(RO) The crashlog buffer for this crashlog device. This file
- may be mapped or read to obtain the data.
+ may be read to obtain the data.
What: /sys/class/intel_pmt/crashlog<x>/guid
Date: October 2020
diff --git a/drivers/platform/x86/intel/pmt/class.c b/drivers/platform/x86/intel/pmt/class.c
index 1c9e3f3ea41c..85fc159961c1 100644
--- a/drivers/platform/x86/intel/pmt/class.c
+++ b/drivers/platform/x86/intel/pmt/class.c
@@ -68,36 +68,6 @@ intel_pmt_read(struct file *filp, struct kobject *kobj,
return count;
}
-static int
-intel_pmt_mmap(struct file *filp, struct kobject *kobj,
- struct bin_attribute *attr, struct vm_area_struct *vma)
-{
- struct intel_pmt_entry *entry = container_of(attr,
- struct intel_pmt_entry,
- pmt_bin_attr);
- unsigned long vsize = vma->vm_end - vma->vm_start;
- struct device *dev = kobj_to_dev(kobj);
- unsigned long phys = entry->base_addr;
- unsigned long pfn = PFN_DOWN(phys);
- unsigned long psize;
-
- if (vma->vm_flags & (VM_WRITE | VM_MAYWRITE))
- return -EROFS;
-
- psize = (PFN_UP(entry->base_addr + entry->size) - pfn) * PAGE_SIZE;
- if (vsize > psize) {
- dev_err(dev, "Requested mmap size is too large\n");
- return -EINVAL;
- }
-
- vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot);
- if (io_remap_pfn_range(vma, vma->vm_start, pfn,
- vsize, vma->vm_page_prot))
- return -EAGAIN;
-
- return 0;
-}
-
static ssize_t
guid_show(struct device *dev, struct device_attribute *attr, char *buf)
{
@@ -263,7 +233,6 @@ static int intel_pmt_dev_register(struct intel_pmt_entry *entry,
sysfs_bin_attr_init(&entry->pmt_bin_attr);
entry->pmt_bin_attr.attr.name = ns->name;
entry->pmt_bin_attr.attr.mode = 0440;
- entry->pmt_bin_attr.mmap = intel_pmt_mmap;
entry->pmt_bin_attr.read = intel_pmt_read;
entry->pmt_bin_attr.size = entry->size;
--
2.25.1
next prev parent reply other threads:[~2022-02-14 21:49 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-02-14 21:32 [PATCH 0/3] Add pm_runtime and DG2 support David E. Box
2022-02-14 21:32 ` David E. Box [this message]
2022-02-21 9:05 ` [PATCH 1/3] platform/x86/intel: pmt: Remove bin_attribute mmap support to runtime pm Hans de Goede
2022-02-21 17:06 ` David E. Box
2022-02-14 21:32 ` [PATCH 2/3] platform/x86/intel: vsec: Enable runtime D3 David E. Box
2022-02-14 21:32 ` [PATCH 3/3] platform/x86/intel: vsec: Add DG2 support David E. Box
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=20220214213258.1929462-2-david.e.box@linux.intel.com \
--to=david.e.box@linux.intel.com \
--cc=hdegoede@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mgross@linux.intel.com \
--cc=platform-driver-x86@vger.kernel.org \
--cc=rjw@rjwysocki.net \
--cc=srinivas.pandruvada@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