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

Re: [PATCH 06/19] xen: Clean up asm-generic/device.h


  • To: Jan Beulich <jbeulich@xxxxxxxx>
  • From: Alejandro Vallejo <agarciav@xxxxxxx>
  • Date: Thu, 5 Jun 2025 16:15:23 +0200
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=suse.com smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none (0)
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=WHKjQfU4bxhYT26M6l0FU4nyZquQYBgbcOeFFL9KKsQ=; b=aAh5DlftbfHFxJQYz8U5+sKD8HURh6i+kRDfZDQCfV1dW72eyzZdk0xpVd4pT5iO8vBLXU0ZaRvi2nDkawi9YW1Xqix7qNt2mOsBGYVtKJXo2J/3Pnc2rNh3ZxB0jXQ3bBB8mtdeN/SSslFBQVSgLvabdndj5eE052CYie6WeV73wmBrYr6bpFaMQBsUZJZt15TO+u0Wp4oNCKd7q9qnnf+RgUhqRmHjy6q49eMnRSVP5fYLzGRzI+4mzlog5jRoPKISErDMQGp2x9JSE/G6tfRKDrcxo/CQ1QeZCNgGnvzYkmIdl9r06hBdXaAx1YFGavfiKR+AZXnMGOH1Va67Bg==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=SnKILXxAUXUvly7zGQaxGKzEA6plHLslSkK+fAsSDLZ+zBbP0hVGnfchowUpQQDuqRMrOm024OsRpKtOqLeDO710+rAvPBRN0+yY6Dkh+XkBfbtScROEQs/wQi2B/uH5FiRI+zA3vfT/MsaWTOMX2UdyGHC3bQbqF2q1JkoGx6zHtxXz4utsbt2KfgR+kpTA6XcvMAhk3ZRNupXmZHfl2gkK8T22AJsmFa5r9cBW0MB2AIEJI7be4NUUdQ6wtx2a0ksurHYbCApsS7f/qWk0SfldcgEKAWRsVNGLyNGbAimtZp9potf2M7i35t9IgHAtCUkW79qUu833faqkjubZsA==
  • Cc: Alistair Francis <alistair.francis@xxxxxxx>, Bob Eshleman <bobbyeshleman@xxxxxxxxx>, Connor Davis <connojdavis@xxxxxxxxx>, "Oleksii Kurochko" <oleksii.kurochko@xxxxxxxxx>, Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Anthony PERARD <anthony.perard@xxxxxxxxxx>, Michal Orzel <michal.orzel@xxxxxxx>, Julien Grall <julien@xxxxxxx>, Roger Pau Monné <roger.pau@xxxxxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, "Daniel P. Smith" <dpsmith@xxxxxxxxxxxxxxxxxxxx>, <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • Delivery-date: Thu, 05 Jun 2025 14:15:41 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On Mon Jun 2, 2025 at 4:24 PM CEST, Jan Beulich wrote:
> On 02.06.2025 16:19, Alejandro Vallejo wrote:
>> On Mon Jun 2, 2025 at 9:51 AM CEST, Jan Beulich wrote:
>>> On 30.05.2025 14:02, Alejandro Vallejo wrote:
>>>> --- a/xen/include/asm-generic/device.h
>>>> +++ b/xen/include/asm-generic/device.h
>>>> @@ -6,9 +6,7 @@
>>>>  
>>>>  enum device_type
>>>>  {
>>>> -#ifdef CONFIG_HAS_DEVICE_TREE
>>>>      DEV_DT,
>>>> -#endif
>>>
>>> Why would this enumerator need exposing on a non-DT arch? In fact I would 
>>> have
>>> hoped for ...
>> 
>> A non-DT arch would not include this. x86 doesn't.
>
> Both here and ...
>
>>>>      DEV_PCI
>>>
>>> ... this to be hidden for arch-es not supporting PCI.
>>>
>>> Similar concerns elsewhere in this change.
>> 
>> This file is exclusively used by arches supporting DT to abstract away where
>> the device came from. x86 does not use it at all, and while it wouldn't be
>> impossible to compile-out DEV_PCI, it would needlessly pollute the codebase 
>> with
>> no measurable gain, because the abstractions still need to stay.
>
> ... here: In "xen/include/asm-generic/device.h" there's nothing at all saying
> that this file is a DT-only one. Instead there is something in there saying
> that it's suitable to use in the entirely "generic" case.
>
> Jan

Try to use it from x86 and observe the build system catch fire. It could be made
to not go on fire, but it implies heavy refactoring in x86 (particularly IOMMU
code) for no good reason because there's no devices in a DTB to disambiguate.

How about adding this to the top of the header?

```
 /*
  * This header helps DTB-based architectures abstract away where a particular
  * device comes from; be it the DTB itself or enumerated on a PCI bus. 
  */

  [snip]

 #ifndef CONFIG_HAS_DEVICE_TREE
 #error "Header meant to be used exclusively by DTB-base architectures."
 #endif
```

Cheers,
Alejandro



 


Rackspace

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