Re: [RFC PATCH v1 20/38] coco: host: arm64: Add support for creating a virtual device

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, 28 Jul 2025 19:21:57 +0530
"Aneesh Kumar K.V (Arm)" <aneesh.kumar@xxxxxxxxxx> wrote:

> Changes to support the creation of virtual device objects with RMM.
> 
> Signed-off-by: Aneesh Kumar K.V (Arm) <aneesh.kumar@xxxxxxxxxx>
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.

>  };





[Index of Archives]     [DMA Engine]     [Linux Coverity]     [Linux USB]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Greybus]

  Powered by Linux