From: Rodrigo Vivi <rodrigo.vivi@intel.com>
To: "Michael J. Ruhl" <michael.j.ruhl@intel.com>
Cc: <intel-xe@lists.freedesktop.org>, <david.e.box@linux.intel.com>
Subject: Re: [PATCH 3/6] platform/x86/intel/pmt: Add support to use provided read callbacks
Date: Mon, 13 May 2024 13:15:40 -0400 [thread overview]
Message-ID: <ZkJKvFY2aGe4FSV-@intel.com> (raw)
In-Reply-To: <20240510205948.904409-4-michael.j.ruhl@intel.com>
On Fri, May 10, 2024 at 04:59:35PM -0400, Michael J. Ruhl wrote:
> From: "David E. Box" <david.e.box@linux.intel.com>
>
This patch needs a commit message.
> Signed-off-by: David E. Box <david.e.box@linux.intel.com>
Whenever sending email on other's behalf, please always remind to sign it off.
Also, these patches should also had been sent to platform-driver-x86@vger.kernel.org
and linux-kernel@vger.kernel.org
and perhaps cc'ing other maintainers listed by
scripts/get_maintainer.pl
And later, likely trying to get their ack to get then
trough drm-xe-next where we are adding the first usage of these.
> ---
> drivers/platform/x86/intel/pmt/class.c | 28 +++++++++++++++++-----
> drivers/platform/x86/intel/pmt/class.h | 8 +++++--
> drivers/platform/x86/intel/pmt/telemetry.c | 10 ++++----
> 3 files changed, 34 insertions(+), 12 deletions(-)
>
> diff --git a/drivers/platform/x86/intel/pmt/class.c b/drivers/platform/x86/intel/pmt/class.c
> index d7939b28e937..62e36dd89137 100644
> --- a/drivers/platform/x86/intel/pmt/class.c
> +++ b/drivers/platform/x86/intel/pmt/class.c
> @@ -58,6 +58,24 @@ pmt_memcpy64_fromio(void *to, const u64 __iomem *from, size_t count)
> return count;
> }
>
> +void pmt_telem_read_mmio(struct pci_dev *pdev, struct pmt_callbacks *cb, u32 guid, void *buf,
> + void __iomem *addr, u32 count)
> +{
> + if (cb && cb->read_telem) {
> + count = cb->read_telem(pdev, guid, buf, count);
> + return;
> + }
> +
> + if (guid == GUID_SPR_PUNIT) {
> + /* PUNIT on SPR only supports aligned 64-bit read */
> + count = pmt_memcpy64_fromio(buf, addr, count);
> + return;
> + }
> +
> + memcpy_fromio(buf, addr, count);
> +}
> +EXPORT_SYMBOL_NS_GPL(pmt_telem_read_mmio, INTEL_PMT);
> +
> /*
> * sysfs
> */
> @@ -79,11 +97,8 @@ intel_pmt_read(struct file *filp, struct kobject *kobj,
> if (count > entry->size - off)
> count = entry->size - off;
>
> - if (entry->guid == GUID_SPR_PUNIT)
> - /* PUNIT on SPR only supports aligned 64-bit read */
> - count = pmt_memcpy64_fromio(buf, entry->base + off, count);
> - else
> - memcpy_fromio(buf, entry->base + off, count);
> + pmt_telem_read_mmio(entry->ep->pcidev, entry->cb, entry->header.guid, buf,
> + entry->base + off, count);
>
> return count;
> }
> @@ -239,6 +254,7 @@ static int intel_pmt_populate_entry(struct intel_pmt_entry *entry,
>
> entry->guid = header->guid;
> entry->size = header->size;
> + entry->cb = ivdev->priv_data;
>
> return 0;
> }
> @@ -300,7 +316,7 @@ static int intel_pmt_dev_register(struct intel_pmt_entry *entry,
> goto fail_ioremap;
>
> if (ns->pmt_add_endpoint) {
> - ret = ns->pmt_add_endpoint(entry, ivdev->pcidev);
> + ret = ns->pmt_add_endpoint(ivdev, entry);
> if (ret)
> goto fail_add_endpoint;
> }
> diff --git a/drivers/platform/x86/intel/pmt/class.h b/drivers/platform/x86/intel/pmt/class.h
> index d6f9ccaf28c8..5032c5244eb4 100644
> --- a/drivers/platform/x86/intel/pmt/class.h
> +++ b/drivers/platform/x86/intel/pmt/class.h
> @@ -24,6 +24,7 @@ struct pci_dev;
> struct telem_endpoint {
> struct pci_dev *pcidev;
> struct telem_header header;
> + struct pmt_callbacks *cb;
> void __iomem *base;
> bool present;
> struct kref kref;
> @@ -43,6 +44,7 @@ struct intel_pmt_entry {
> struct kobject *kobj;
> void __iomem *disc_table;
> void __iomem *base;
> + struct pmt_callbacks *cb;
> unsigned long base_addr;
> size_t size;
> u32 guid;
> @@ -55,10 +57,12 @@ struct intel_pmt_namespace {
> const struct attribute_group *attr_grp;
> int (*pmt_header_decode)(struct intel_pmt_entry *entry,
> struct device *dev);
> - int (*pmt_add_endpoint)(struct intel_pmt_entry *entry,
> - struct pci_dev *pdev);
> + int (*pmt_add_endpoint)(struct intel_vsec_device *ivdev,
> + struct intel_pmt_entry *entry);
> };
>
> +void pmt_telem_read_mmio(struct pci_dev *pdev, struct pmt_callbacks *cb, u32 guid, void *buf,
> + void __iomem *addr, u32 count);
> bool intel_pmt_is_early_client_hw(struct device *dev);
> int intel_pmt_dev_create(struct intel_pmt_entry *entry,
> struct intel_pmt_namespace *ns,
> diff --git a/drivers/platform/x86/intel/pmt/telemetry.c b/drivers/platform/x86/intel/pmt/telemetry.c
> index 3478f891ea0b..c9feac859e57 100644
> --- a/drivers/platform/x86/intel/pmt/telemetry.c
> +++ b/drivers/platform/x86/intel/pmt/telemetry.c
> @@ -93,8 +93,8 @@ static int pmt_telem_header_decode(struct intel_pmt_entry *entry,
> return 0;
> }
>
> -static int pmt_telem_add_endpoint(struct intel_pmt_entry *entry,
> - struct pci_dev *pdev)
> +static int pmt_telem_add_endpoint(struct intel_vsec_device *ivdev,
> + struct intel_pmt_entry *entry)
> {
> struct telem_endpoint *ep;
>
> @@ -104,13 +104,14 @@ static int pmt_telem_add_endpoint(struct intel_pmt_entry *entry,
> return -ENOMEM;
>
> ep = entry->ep;
> - ep->pcidev = pdev;
> + ep->pcidev = ivdev->pcidev;
> ep->header.access_type = entry->header.access_type;
> ep->header.guid = entry->header.guid;
> ep->header.base_offset = entry->header.base_offset;
> ep->header.size = entry->header.size;
> ep->base = entry->base;
> ep->present = true;
> + ep->cb = ivdev->priv_data;
>
> kref_init(&ep->kref);
>
> @@ -218,7 +219,8 @@ int pmt_telem_read(struct telem_endpoint *ep, u32 id, u64 *data, u32 count)
> if (offset + NUM_BYTES_QWORD(count) > size)
> return -EINVAL;
>
> - memcpy_fromio(data, ep->base + offset, NUM_BYTES_QWORD(count));
> + pmt_telem_read_mmio(ep->pcidev, ep->cb, ep->header.guid, data, ep->base + offset,
> + NUM_BYTES_QWORD(count));
>
> return ep->present ? 0 : -EPIPE;
> }
> --
> 2.44.0
>
next prev parent reply other threads:[~2024-05-13 17:15 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-05-10 20:59 [PATCH 0/6] Support PMT features in Xe Michael J. Ruhl
2024-05-10 20:59 ` [PATCH 1/6] platform/x86/intel/vsec.h: Move to include/linux Michael J. Ruhl
2024-05-28 15:43 ` Ruhl, Michael J
2024-05-30 21:07 ` David E. Box
2024-05-10 20:59 ` [PATCH 2/6] platform/x86/intel/vsec: Add PMT read callbacks Michael J. Ruhl
2024-05-10 20:59 ` [PATCH 3/6] platform/x86/intel/pmt: Add support to use provided " Michael J. Ruhl
2024-05-13 17:15 ` Rodrigo Vivi [this message]
2024-05-10 20:59 ` [PATCH 4/6] platform/x86/intel/pmt: Add quirk for BAR0 offset adjustment Michael J. Ruhl
2024-05-30 20:59 ` David E. Box
2024-05-31 15:40 ` Ruhl, Michael J
2024-05-10 20:59 ` [PATCH 5/6] drm/xe/vsec: Add support for DG2 Michael J. Ruhl
2024-05-10 20:59 ` [PATCH 6/6] drm/xe/vsec: Support BMG devices Michael J. Ruhl
2024-05-30 21:06 ` David E. Box
2024-05-31 15:42 ` Ruhl, Michael J
2024-05-10 21:48 ` ✓ CI.Patch_applied: success for Support PMT features in Xe Patchwork
2024-05-10 21:48 ` ✗ CI.checkpatch: warning " Patchwork
2024-05-10 21:49 ` ✗ CI.KUnit: failure " Patchwork
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=ZkJKvFY2aGe4FSV-@intel.com \
--to=rodrigo.vivi@intel.com \
--cc=david.e.box@linux.intel.com \
--cc=intel-xe@lists.freedesktop.org \
--cc=michael.j.ruhl@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 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.