Thank you for your contribution! Sashiko AI review found 1 potential issue(s) 
to consider:
- [Low] PCI: hv: hv_pci_reset_device() passes 3 arguments to wait_for_response()
--

commit 5767f2b6950e5dc7da0b5c142f971d8282c27a56
Author: Hamza Mahfooz <[email protected]>

PCI: hv: add vPCI device reset support

This commit negotiates Hyper-V vPCI protocol version 1.5 and implements the
reset_root_port() callback on pci_host_bridge by sending a PCI_RESET_DEVICE
request over the vPCI VMBus channel.

> diff --git a/drivers/pci/controller/pci-hyperv.c 
> b/drivers/pci/controller/pci-hyperv.c
> index 89816a2bd7cd3..4bb4ca6da1f7b 100644
> --- a/drivers/pci/controller/pci-hyperv.c
> +++ b/drivers/pci/controller/pci-hyperv.c

[ ... ]

> @@ -1397,6 +1401,52 @@ static int hv_pcifront_write_config(struct pci_bus 
> *bus, unsigned int devfn,
>       return PCIBIOS_SUCCESSFUL;
>  }
>  
> +static int hv_pci_reset_device(struct pci_host_bridge *bridge,
> +                            struct pci_dev *pdev)
> +{
> +     struct hv_pcibus_device *hbus =
> +             container_of(bridge->sysdata, struct hv_pcibus_device, sysdata);
> +     struct pci_child_message reset = {};
> +     struct hv_pci_compl comp_pkt;
> +     struct pci_packet pkt = {
> +             .completion_func = hv_pci_generic_compl,
> +             .compl_ctxt = &comp_pkt,
> +     };
> +     enum hv_pcibus_state state;
> +     int ret;
> +
> +     /* Do not take state_lock: eject holds it while removing/locking pdev. 
> */
> +     state = READ_ONCE(hbus->state);
> +     if (state != hv_pcibus_probed && state != hv_pcibus_installed)
> +             return -ENODEV;
> +
> +     init_completion(&comp_pkt.host_event);
> +     reset.message_type.type = PCI_RESET_DEVICE;
> +     reset.wslot.slot = devfn_to_wslot(pdev->devfn);
> +
> +     ret = vmbus_sendpacket(hbus->hdev->channel, &reset, sizeof(reset),
> +                            (unsigned long)&pkt, VM_PKT_DATA_INBAND,
> +                            VMBUS_DATA_PACKET_FLAG_COMPLETION_REQUESTED);
> +     if (ret)
> +             return ret;
> +
> +     ret = wait_for_response(hbus->hdev, &comp_pkt.host_event,
> +                             "PCI_RESET_DEVICE");

[Severity: Low]
Does this compile when CONFIG_PCI_HYPERV is enabled?

In drivers/pci/controller/pci-hyperv.c, wait_for_response() only accepts two
arguments:

static int wait_for_response(struct hv_device *hdev,
                             struct completion *comp)

Passing "PCI_RESET_DEVICE" as a third argument in hv_pci_reset_device()
causes the build to fail with too many arguments to wait_for_response().

> +     if (ret)
> +             return ret;
> +
> +     if (comp_pkt.completion_status == STATUS_NOT_SUPPORTED)
> +             return -ENOTTY;
> +
> +     if (comp_pkt.completion_status) {
> +             pci_err(pdev, "Hyper-V device reset failed: %#x\n",
> +                     comp_pkt.completion_status);
> +             return -EIO;
> +     }
> +
> +     return 0;
> +}

[ ... ]

-- 
Sashiko AI review ยท 
https://sashiko.dev/#/patchset/[email protected]?part=2

Reply via email to