Re: [RFC PATCH v1 35/38] coco: guest: arm64: Add Realm device start and stop support
From: Jonathan Cameron
Date: Thu Jul 31 2025 - 06:40:54 EST
On Mon, 28 Jul 2025 19:22:12 +0530
"Aneesh Kumar K.V (Arm)" <aneesh.kumar@xxxxxxxxxx> wrote:
> Writing 1 to 'tsm/acceept' will initiate the TDISP RUN sequence.
>
> Signed-off-by: Aneesh Kumar K.V (Arm) <aneesh.kumar@xxxxxxxxxx>
A few more trivial things on this first read through.
Jonathan
> diff --git a/drivers/virt/coco/arm-cca-guest/rsi-da.c b/drivers/virt/coco/arm-cca-guest/rsi-da.c
> index 936f844880de..64034d220e02 100644
> --- a/drivers/virt/coco/arm-cca-guest/rsi-da.c
> +++ b/drivers/virt/coco/arm-cca-guest/rsi-da.c
> +int rsi_device_stop(struct pci_dev *pdev)
> +{
> + int ret;
> + struct cca_guest_dsc *dsm = to_cca_guest_dsc(pdev);
> + int vdev_id = (pci_domain_nr(pdev->bus) << 16) |
> + PCI_DEVID(pdev->bus->number, pdev->devfn);
Feels like this occurs so often we should add a helper.
Can't be completely generic as pci_domain_nr can have more bits
than I guess we are assuming here, but we can have something for
use in the rsi code.
> +
> + ret = rsi_rdev_stop(pdev, vdev_id, dsm->instance_id);
> + if (ret != RSI_SUCCESS) {
> + pci_err(pdev, "failed to stop the device (%u)\n", ret);
> + return -EIO;
> + }
> return 0;
> }
> diff --git a/drivers/virt/coco/arm-cca-guest/rsi-da.h b/drivers/virt/coco/arm-cca-guest/rsi-da.h
> index 0d6e1c0ada4a..71ee1edb832e 100644
> --- a/drivers/virt/coco/arm-cca-guest/rsi-da.h
> +++ b/drivers/virt/coco/arm-cca-guest/rsi-da.h
> @@ -54,5 +54,5 @@ static inline struct cca_guest_dsc *to_cca_guest_dsc(struct pci_dev *pdev)
> int rsi_update_interface_report(struct pci_dev *pdev, bool validate);
> int rsi_device_lock(struct pci_dev *pdev);
> int rsi_device_start(struct pci_dev *pdev);
> -
Tidy this up.
> +int rsi_device_stop(struct pci_dev *pdev);
> #endif