public inbox for drm-ai-reviews@public-inbox.freedesktop.org
 help / color / mirror / Atom feed
From: Claude Code Review Bot <claude-review@example.com>
To: dri-devel-reviews@example.com
Subject: Claude review: platform/x86/intel/vsec: Switch exported helpers from pci_dev to device
Date: Fri, 27 Feb 2026 14:12:36 +1000	[thread overview]
Message-ID: <review-patch4-20260224-upstream-pmt-acpi-v5-v5-4-8dd73bcf049c@linux.intel.com> (raw)
In-Reply-To: <20260224-upstream-pmt-acpi-v5-v5-4-8dd73bcf049c@linux.intel.com>

Patch Review

**Overall: The largest patch, mostly mechanical. Has a potential safety concern.**

This is the core conversion: `struct intel_vsec_device` gains `struct device *dev` replacing `struct pci_dev *pcidev`. All consumers are updated.

**Concern — unchecked `to_pci_dev()` in downstream code after ACPI support is added:**

Several downstream consumers now do `to_pci_dev(ivdev->dev)` or `to_pci_dev(entry->ep->dev)` without first checking `dev_is_pci()`. While this is safe *today* because only PCI parents exist, patch 6 adds ACPI discovery support, and future ACPI-enumerated PMT endpoints could reach this code. Specifically:

1. In `class.c`, `intel_pmt_populate_entry()`:
   ```c
   struct pci_dev *pci_dev = to_pci_dev(ivdev->dev);
   ```
   This function uses `pci_resource_start()` which will crash on a non-PCI device.

2. In `telemetry.c`, `pmt_copy_region()`:
   ```c
   struct pci_dev *pdev = to_pci_dev(entry->ep->dev);
   ```

3. In `sdsi.c`, `sdsi_map_mbox_registers()`:
   ```c
   struct pci_dev *parent = to_pci_dev(dev);
   ```

4. In `vsec_tpmi.c`, `intel_vsec_tpmi_init()`:
   ```c
   struct pci_dev *pci_dev = to_pci_dev(vsec_dev->dev);
   ```

While the commit message says "same APIs work for PCI and ACPI parents", these unconverted sites will crash with non-PCI devices. It would be prudent to add `dev_is_pci()` guards or at minimum a comment at each `to_pci_dev()` site asserting that only PCI devices reach that path. The `intel_vsec_set_mapping()` function correctly adds such a guard:

```c
if (!dev_is_pci(vsec_dev->dev))
    return -ENODEV;
```

This pattern should be applied more consistently.

**Minor: `xe_pmt_telem_read` uses `kdev_to_xe_device()`** — this needs `kdev_to_xe_device()` to exist in the xe driver. It does (it's a standard xe helper), so this is fine.

---

---
Generated by Claude Code Patch Reviewer

  reply	other threads:[~2026-02-27  4:12 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-02-25  1:50 [PATCH v5 0/6] platform/x86/intel/vsec: Prep for ACPI PMT discovery David E. Box
2026-02-25  1:50 ` [PATCH v5 1/6] platform/x86/intel/vsec: Refactor base_addr handling David E. Box
2026-02-27  4:12   ` Claude review: " Claude Code Review Bot
2026-02-25  1:50 ` [PATCH v5 2/6] platform/x86/intel/vsec: Make driver_data info const David E. Box
2026-02-27  4:12   ` Claude review: " Claude Code Review Bot
2026-02-25  1:50 ` [PATCH v5 3/6] platform/x86/intel/vsec: Decouple add/link helpers from PCI David E. Box
2026-02-27  4:12   ` Claude review: " Claude Code Review Bot
2026-02-25  1:50 ` [PATCH v5 4/6] platform/x86/intel/vsec: Switch exported helpers from pci_dev to device David E. Box
2026-02-27  4:12   ` Claude Code Review Bot [this message]
2026-02-25  1:50 ` [PATCH v5 5/6] platform/x86/intel/vsec: Return real error codes from registration path David E. Box
2026-02-27  4:12   ` Claude review: " Claude Code Review Bot
2026-02-25  1:50 ` [PATCH v5 6/6] platform/x86/intel/vsec: Plumb ACPI PMT discovery tables through vsec David E. Box
2026-02-27  4:12   ` Claude review: " Claude Code Review Bot
2026-02-27  4:12 ` Claude review: platform/x86/intel/vsec: Prep for ACPI PMT discovery Claude Code Review Bot

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=review-patch4-20260224-upstream-pmt-acpi-v5-v5-4-8dd73bcf049c@linux.intel.com \
    --to=claude-review@example.com \
    --cc=dri-devel-reviews@example.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