On 19.12.2023 14:48, Mykyta Poturai wrote:
> This patch adds the ability for the device emulator to inject MSI
> interrupts into guests. This is done by adding a new DM op to the device
> model library.
> 
> It is not possible to reuse already existing inject_msi DM op, because
> it does not have a devid parameter, which is required for translation of
> MSIs to interrupt numbers on ARM.

Yet then ...

> @@ -112,6 +113,20 @@ int dm_op(const struct dmop_args *op_args)
>          break;
>      }
>  
> +    case XEN_DMOP_arm_inject_msi:
> +    {
> +        const struct xen_dm_op_arm_inject_msi *data =
> +            &op.u.arm_inject_msi;
> +
> +        if ( d->arch.vgic.its == NULL )
> +        {
> +            rc = -EINVAL;
> +            break;
> +        }
> +        vgic_its_trigger_msi(d, d->arch.vgic.its, data->devid, data->data);
> +        break;
> +
> +    }

... you're not using the addr field at all, which therefore could likely
hold the devid data (encoded to really represent some form of address,
or stored directly - much depends on what purpose the address serves on
Arm for MSI).

> --- a/xen/include/public/hvm/dm_op.h
> +++ b/xen/include/public/hvm/dm_op.h
> @@ -444,6 +444,15 @@ struct xen_dm_op_nr_vcpus {
>  };
>  typedef struct xen_dm_op_nr_vcpus xen_dm_op_nr_vcpus_t;
>  
> +#define XEN_DMOP_arm_inject_msi 21
> +
> +struct xen_dm_op_arm_inject_msi {
> +    uint64_t addr;
> +    uint32_t data;
> +    uint32_t devid;
> +};

Additionally xen_dm_op_inject_msi has a padding field, which is likely
possible to use as well (perhaps by simply renaming it).

Also note how the addr field there is using uint64_aligned_t.

Jan

Reply via email to