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

Re: [Xen-devel] [PATCH v3 20/24] xen/passthrough: Extend XEN_DOMCTL_assign_device to support DT device



>>> On 11.03.15 at 14:55, <ian.campbell@xxxxxxxxxx> wrote:
> On Wed, 2015-03-11 at 13:50 +0000, Julien Grall wrote:
>> Hi Ian,
>> 
>> On 11/03/2015 12:37, Ian Campbell wrote:
>> > On Tue, 2015-03-10 at 16:33 +0000, Julien Grall wrote:
>> >> Hi Ian,
>> >>
>> >> On 20/02/15 17:17, Ian Campbell wrote:
>> >>>> +    /* TODO: Do we need to check is_dying? Mostly to protect against
>> >>>> +     * hypercall trying to passthrough a device while we are
>> >>>> +     * dying.
>> >>>
>> >>> FWIW the PCI case appears not to care...
>> >>
>> >> There is one place in XEN_DOMCTL_assign_device...
>> >>
>> >> Although I don't understand much the usage of is_dying.
>> >>
>> >>>> +     */
>> >>>> +
>> >>>> +    switch ( domctl->cmd )
>> >>>> +    {
>> >>>> +    case XEN_DOMCTL_assign_device:
>> >>>> +        ret = -ENOSYS;
>> >>>> +        if ( domctl->u.assign_device.dev != XEN_DOMCTL_DEV_DT )
>> >>>> +            break;
>> >>>
>> >>> You added something similar to iommu_do_pci_domctl, would it not be
>> >>> preferable for the caller to switch on domctl->u.assign_device.dev and
>> >>> call the correct iommu_do_*_domctl?
>> >>
>> >> I though about it. It would require to stub iommu_do_*_domctl. So I
>> >> preferred to chose the current solution.
>> >
>> > You mean iommu_do_{pci,dt}_domctl?
>> >
>> > IIRC you already added suitable #defines for when these features are
>> > present, so reusing them at the call sites wouldn't be too bad, or else
>> > stubs aren't the worst thing either.
>> 
>> Hmmm I think I got you point now. Do you mean have something like:
> 
> That's one option I'd be happy with, yes. Jan might disagree.

Looks quite reasonable to except for ...

>> switch (domctl->u.assign_device.dev)
>> {
>> #ifdef HAS_PCI
>> case XEN_DOMCTL_DEV_PCI:
>>      ret = iommu_do_pci_domctl();
>>      break;
>> #endif
>> #ifdef HAS_DEVICE_TREE
>> case XEN_DOMCTL_DEV_DT:
>>      ret = iommu_do_dt_domctl()
>>      break;
>> #endif
>> 
>> default:
>>     ret = -ENOSYS;

... the -ENOSYS here: We commonly use e.g. -EOPNOTSUPP in
such situations.

Jan


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.