From mboxrd@z Thu Jan 1 00:00:00 1970 From: Claude Code Review Bot 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 Message-ID: In-Reply-To: <20260224-upstream-pmt-acpi-v5-v5-4-8dd73bcf049c@linux.intel.com> References: <20260224-upstream-pmt-acpi-v5-v5-0-8dd73bcf049c@linux.intel.com> <20260224-upstream-pmt-acpi-v5-v5-4-8dd73bcf049c@linux.intel.com> X-Mailer: Claude Code Patch Reviewer Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Patch Review **Overall: The largest patch, mostly mechanical. Has a potential safety con= cern.** This is the core conversion: `struct intel_vsec_device` gains `struct devic= e *dev` replacing `struct pci_dev *pcidev`. All consumers are updated. **Concern =E2=80=94 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 suppor= t, and future ACPI-enumerated PMT endpoints could reach this code. Specific= ally: 1. In `class.c`, `intel_pmt_populate_entry()`: ```c struct pci_dev *pci_dev =3D 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 =3D to_pci_dev(entry->ep->dev); ``` 3. In `sdsi.c`, `sdsi_map_mbox_registers()`: ```c struct pci_dev *parent =3D to_pci_dev(dev); ``` 4. In `vsec_tpmi.c`, `intel_vsec_tpmi_init()`: ```c struct pci_dev *pci_dev =3D to_pci_dev(vsec_dev->dev); ``` While the commit message says "same APIs work for PCI and ACPI parents", th= ese 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()`** =E2=80=94 this ne= eds `kdev_to_xe_device()` to exist in the xe driver. It does (it's a standa= rd xe helper), so this is fine. --- --- Generated by Claude Code Patch Reviewer