[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20251027094916.1153143-8-aneesh.kumar@kernel.org>
Date: Mon, 27 Oct 2025 15:18:59 +0530
From: "Aneesh Kumar K.V (Arm)" <aneesh.kumar@...nel.org>
To: linux-coco@...ts.linux.dev,
kvmarm@...ts.linux.dev
Cc: linux-pci@...r.kernel.org,
linux-kernel@...r.kernel.org,
dan.j.williams@...el.com,
aik@....com,
lukas@...ner.de,
Samuel Ortiz <sameo@...osinc.com>,
Xu Yilun <yilun.xu@...ux.intel.com>,
Jason Gunthorpe <jgg@...pe.ca>,
Suzuki K Poulose <Suzuki.Poulose@....com>,
Steven Price <steven.price@....com>,
Bjorn Helgaas <helgaas@...nel.org>,
Jonathan Cameron <Jonathan.Cameron@...wei.com>,
Catalin Marinas <catalin.marinas@....com>,
Marc Zyngier <maz@...nel.org>,
Will Deacon <will@...nel.org>,
Oliver Upton <oliver.upton@...ux.dev>,
"Aneesh Kumar K.V (Arm)" <aneesh.kumar@...nel.org>
Subject: [PATCH 08/12] coco: host: arm64: Instantiate RMM pdev during device connect
An RMM pdev object represents a communication channel between the RMM
and a physical device, for example a PCIe device. With the required
helpers now in place, update the connect callback to create an RMM pdev
object.
Signed-off-by: Aneesh Kumar K.V (Arm) <aneesh.kumar@...nel.org>
---
drivers/virt/coco/arm-cca-host/arm-cca.c | 23 +++++++++++++++++++++--
1 file changed, 21 insertions(+), 2 deletions(-)
diff --git a/drivers/virt/coco/arm-cca-host/arm-cca.c b/drivers/virt/coco/arm-cca-host/arm-cca.c
index e79f05fee516..8eaf8749e59d 100644
--- a/drivers/virt/coco/arm-cca-host/arm-cca.c
+++ b/drivers/virt/coco/arm-cca-host/arm-cca.c
@@ -71,8 +71,8 @@ static void cca_tsm_pci_remove(struct pci_tsm *tsm)
}
}
-static __maybe_unused int init_dev_communication_buffers(struct pci_dev *pdev,
- struct cca_host_comm_data *comm_data)
+static int init_dev_communication_buffers(struct pci_dev *pdev,
+ struct cca_host_comm_data *comm_data)
{
int ret = -ENOMEM;
@@ -160,6 +160,16 @@ static int cca_tsm_connect(struct pci_dev *pdev)
if (rc)
goto err_tsm;
+ rc = init_dev_communication_buffers(pdev, &pf0_dsc->comm_data);
+ if (rc)
+ goto err_comm_buff;
+ rc = pdev_create(pdev);
+ if (rc)
+ goto err_pdev_create;
+
+ rc = pdev_ide_setup(pdev);
+ if (rc)
+ goto err_ide_setup;
/*
* Once ide is setup, enable the stream at the endpoint
* Root port will be done by RMM
@@ -167,6 +177,12 @@ static int cca_tsm_connect(struct pci_dev *pdev)
pci_ide_stream_enable(pdev, ide);
return 0;
+err_ide_setup:
+ pdev_stop_and_destroy(pdev);
+err_pdev_create:
+ free_dev_communication_buffers(&pf0_dsc->comm_data);
+err_comm_buff:
+ tsm_ide_stream_unregister(ide);
err_tsm:
pci_ide_stream_teardown(rp, ide);
pci_ide_stream_teardown(pdev, ide);
@@ -193,6 +209,9 @@ static void cca_tsm_disconnect(struct pci_dev *pdev)
stream_id = ide->stream_id;
pf0_dsc->sel_stream = NULL;
+ pdev_stop_and_destroy(pdev);
+ free_dev_communication_buffers(&pf0_dsc->comm_data);
+
pci_ide_stream_release(ide);
clear_bit(stream_id, cca_stream_ids);
}
--
2.43.0
Powered by blists - more mailing lists