[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250730151210.00002ead@huawei.com>
Date: Wed, 30 Jul 2025 15:12:10 +0100
From: Jonathan Cameron <Jonathan.Cameron@...wei.com>
To: "Aneesh Kumar K.V (Arm)" <aneesh.kumar@...nel.org>
CC: <linux-coco@...ts.linux.dev>, <kvmarm@...ts.linux.dev>,
<linux-pci@...r.kernel.org>, <linux-kernel@...r.kernel.org>, <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>,
Catalin Marinas <catalin.marinas@....com>, Marc Zyngier <maz@...nel.org>,
Will Deacon <will@...nel.org>, Oliver Upton <oliver.upton@...ux.dev>
Subject: Re: [RFC PATCH v1 20/38] coco: host: arm64: Add support for
creating a virtual device
On Mon, 28 Jul 2025 19:21:57 +0530
"Aneesh Kumar K.V (Arm)" <aneesh.kumar@...nel.org> wrote:
> Changes to support the creation of virtual device objects with RMM.
>
> Signed-off-by: Aneesh Kumar K.V (Arm) <aneesh.kumar@...nel.org>
Hi Aneesh,
Really trivial stuff in this one.
> diff --git a/arch/arm64/include/asm/rmi_smc.h b/arch/arm64/include/asm/rmi_smc.h
> index 4a5ba98c1c0d..e5238b271493 100644
> --- a/arch/arm64/include/asm/rmi_smc.h
> +++ b/arch/arm64/include/asm/rmi_smc.h
> @@ -53,6 +53,8 @@
> #define SMC_RMI_PDEV_GET_STATE SMC_RMI_CALL(0x0178)
> #define SMC_RMI_PDEV_SET_PUBKEY SMC_RMI_CALL(0x017b)
> #define SMC_RMI_PDEV_STOP SMC_RMI_CALL(0x017c)
> +#define SMC_RMI_VDEV_CREATE SMC_RMI_CALL(0x0187)
> +
One blankl line probably enough.
>
> #define RMI_ABI_MAJOR_VERSION 1
t/coco/arm-cca-host/arm-cca.c b/drivers/virt/coco/arm-cca-host/arm-cca.c
> index c65b81f0706f..2da513f45974 100644
> --- a/drivers/virt/coco/arm-cca-host/arm-cca.c
> +++ b/drivers/virt/coco/arm-cca-host/arm-cca.c
> @@ -10,6 +10,8 @@
> #include <linux/pci.h>
> #include <linux/tsm.h>
> #include <linux/vmalloc.h>
> +#include <linux/kvm_host.h>
> +#include <linux/pci.h>
>
> #include "rmm-da.h"
>
> @@ -221,11 +223,39 @@ static void cca_tsm_disconnect(struct pci_dev *pdev)
> free_dev_communication_buffers(&dsc_pf0->comm_data);
> }
>
> +static struct pci_tdi *cca_tsm_bind(struct pci_dev *pdev, struct pci_dev *pf0_dev,
> + struct kvm *kvm, u64 tdi_id)
> +{
> + void *rmm_vdev;
> + struct cca_host_tdi *host_tdi __free(kfree) = NULL;
Move declaration and registration of destructor down to where it's
constructed. (Follow guidance in cleanup.h.
> + struct realm *realm = &kvm->arch.realm;
> +
> + if (pdev->is_virtfn)
> + return ERR_PTR(-ENXIO);
> +
> + if (!try_module_get(THIS_MODULE))
> + return ERR_PTR(-ENXIO);
> +
> + host_tdi = kmalloc(sizeof(struct cca_host_tdi), GFP_KERNEL);
> + if (!host_tdi)
> + return ERR_PTR(-ENOMEM);
> +
> + rmm_vdev = rme_create_vdev(realm, pdev, pf0_dev, tdi_id);
> + if (!IS_ERR_OR_NULL(rmm_vdev)) {
> + host_tdi->rmm_vdev = rmm_vdev;
> + return &no_free_ptr(host_tdi)->tdi;
> + }
> +
> + module_put(THIS_MODULE);
> + return rmm_vdev;
> +}
> +
> static const struct pci_tsm_ops cca_pci_ops = {
> .probe = cca_tsm_pci_probe,
> .remove = cca_tsm_pci_remove,
> .connect = cca_tsm_connect,
> .disconnect = cca_tsm_disconnect,
> + .bind = cca_tsm_bind,
Odd spacing. Seems just bind is using a tab.
> };
Powered by blists - more mailing lists