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

Re: [PATCH v1 04/29] xen/asm-generic: introduce stub header device.h


  • To: Julien Grall <julien@xxxxxxx>
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Thu, 19 Oct 2023 13:14:46 +0200
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=suse.com; dmarc=pass action=none header.from=suse.com; dkim=pass header.d=suse.com; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=9MdrXl4iI7l7+aeaOIPZKeZ80Y8hARXounR30EkZd2k=; b=dxyYcyh1YbvW0oV8ESWqfNzyLTgp9mTvhyfIJlmi/su/4ZW0FxnbMIvJGRRn3oJ9dFxre7TNfKcxhkqct5Nq5cQN58fZTDsoCn031a5D5ZWJPLKRWMFx36KW7SJvrmg2dZ4bpcQf3PDrcbAbBJpzNUck43LAEyoSpCxJtHVD0lO7sqWmw4DoNXwJI+F0sgcgRJstviXoIZ9s66YtnDLey4ns0HkG7K7K0EEIlDm2E3tNaCttWrfIAtF2iVvYF2aCRIBrfNACHaW+6ViaoYR0BERdeSC1J/awjKAX/Scz7ZsnI6wAucTcca/UIZ66cydsQ9F6uA0kg6cn76FHnTLDaw==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=WU5CN/JNqKHeNvW0M6Uq1RV/B0qaTiLDQqwkb2aRMN5UG8bus8gYwX4PhzTUVKblQ1/S/FpzfvFmoaiMzjeckNL8zPk6BPt8EMd4OWODa7IYSZPATmI/GBRFwvYvajOBhqv/R7+zX9W1vDZXnq0xlrlKwGC56IeO/LQKbRUXQg4zZ9k2ti/DESbeAj+uwuVdYtqrqueeEMyyg9KSFHSnrgo09GGu4JJw6NSChfDblJS0JUFsISzphUKXuUDYVs54RHiPrUk5iYKkj94XFvXqg112OKSHJKTchFQMJJnhYErQm5xTf8bR4evjVCXCkype4/7k3YWn3JBoA401fv7gag==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com;
  • Cc: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, George Dunlap <george.dunlap@xxxxxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Wei Liu <wl@xxxxxxx>, xen-devel@xxxxxxxxxxxxxxxxxxxx, Oleksii Kurochko <oleksii.kurochko@xxxxxxxxx>
  • Delivery-date: Thu, 19 Oct 2023 11:14:58 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 19.10.2023 13:07, Julien Grall wrote:
> 
> 
> On 19/10/2023 12:01, Jan Beulich wrote:
>> On 19.10.2023 12:57, Julien Grall wrote:
>>> On 19/10/2023 11:53, Jan Beulich wrote:
>>>> On 19.10.2023 12:42, Julien Grall wrote:
>>>>> On 19/10/2023 10:14, Jan Beulich wrote:
>>>>>> On 14.09.2023 16:56, Oleksii Kurochko wrote:
>>>>>>> --- /dev/null
>>>>>>> +++ b/xen/include/asm-generic/device.h
>>>>>>> @@ -0,0 +1,65 @@
>>>>>>> +/* SPDX-License-Identifier: GPL-2.0-only */
>>>>>>> +#ifndef __ASM_GENERIC_DEVICE_H__
>>>>>>> +#define __ASM_GENERIC_DEVICE_H__
>>>>>>> +
>>>>>>> +struct dt_device_node;
>>>>>>> +
>>>>>>> +enum device_type
>>>>>>> +{
>>>>>>> +    DEV_DT,
>>>>>>> +    DEV_PCI,
>>>>>>> +};
>>>>>>
>>>>>> Are both of these really generic?
>>>>>
>>>>> I think can be re-used for RISC-V to have an abstract view a device.
>>>>> This is for instance used in the IOMMU code where both PCI and platform
>>>>> (here called DT) can be assigned to a domain. The driver will need to
>>>>> know the difference, but the common layer doesn't need to.
>>>>
>>>> Question to me is whether DT and PCI can be considered "common", which
>>>> is a prereq for being used here.
>>>
>>> I think it can. See more below.
>>>
>>>>
>>>>>>> +struct device {
>>>>>>> +    enum device_type type;
>>>>>>> +#ifdef CONFIG_HAS_DEVICE_TREE
>>>>>>> +    struct dt_device_node *of_node; /* Used by drivers imported from 
>>>>>>> Linux */
>>>>>>> +#endif
>>>>>>> +};
>>>>>>> +
>>>>>>> +enum device_class
>>>>>>> +{
>>>>>>> +    DEVICE_SERIAL,
>>>>>>> +    DEVICE_IOMMU,
>>>>>>> +    DEVICE_GIC,
>>>>>>
>>>>>> This one certainly is Arm-specific.
>>>>>
>>>>> This could be renamed to DEVICE_IC (or INTERRUPT_CONTROLLER)
>>>>>
>>>>>>
>>>>>>> +    DEVICE_PCI_HOSTBRIDGE,
>>>>>>
>>>>>> And this one's PCI-specific.
>>>>>
>>>>> Are you suggesting to #ifdef it? If so, I don't exactly see the value 
>>>>> here.
>>>>
>>>> What to do with it is secondary to me. I was questioning its presence here.
>>>>
>>>>>> Overall same question as before: Are you expecting that RISC-V is going 
>>>>>> to
>>>>>> get away without a customized header? I wouldn't think so.
>>>>>
>>>>> I think it can be useful. Most likely you will have multiple drivers for
>>>>> a class and you may want to initialize certain device class early than
>>>>> others. See how it is used in device_init().
>>>>
>>>> I'm afraid I don't see how your reply relates to the question of such a
>>>> fallback header being sensible to have, or whether instead RISC-V will
>>>> need its own private header anyway.
>>>
>>> My point is that RISC-V will most likely duplicate what Arm did (they
>>> are already copying the dom0less code). So the header would end up to be
>>> duplicated. This is not ideal and therefore we want to share the header.
>>>
>>> I don't particularly care whether it lives in asm-generic or somewhere.
>>> I just want to avoid the duplication.
>>
>> Avoiding duplication is one goal, which I certainly appreciate. The header
>> as presented here is, however, only a subset of Arm's if I'm not mistaken.
>> If moving all of Arm's code here, I then wonder whether that really can
>> count as "generic".
> 
>  From previous discussion, I recalled that we seemed to agree that if 
> applies for most the architecture, then it should be considered common.

Hmm, not my recollection - a certain amount of "does this make sense from
an abstract perspective" should also be applied.

>> Avoiding duplication could e.g. be achieved by making RISC-V symlink Arm's
>> header.
> 
> Ewwwwww. Removing the fact I dislike it, I can see some issues with this 
> approach in term of review. Who is responsible to review for any changes 
> here? Surely, we don't only want to the Arm folks to review.

That could be achieved by an F: entry in the RISC-V section of ./MAINTAINERS.

Jan



 


Rackspace

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