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

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


  • To: Oleksii <oleksii.kurochko@xxxxxxxxx>
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Mon, 30 Oct 2023 17:43:26 +0100
  • 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=RdCj2um+EEp7a3DsFWKtm4OIAliSxHWpJd/XJ48iS/0=; b=eoycnbHXbq7nCFYleGJV/+hvDpNr8eJeteWwzxtu22yZVeV8RI89z65yuW+8elVTH21em2hXToTPC76GTMBO9Qy8KwOSRwem9yf88/reru3wpcbPMX/LO8FLXdATnaf0dAw4uNWdCM0qyFL0SefEcJUr2wAVrufl+Sk7Pp4/CkGAXYj3o4CG7AFQJfEdPZF2tiWmwAMw+ecei15bPPy8SA5BOUkUiP4AbFRHmbM/Hryb9d5014TkezEb2JadqitsNYbpmEXsEzPov/UlIJstzLcKMFTe5XhOY5xgVlFECIGutlopwEFohHK+qVvML0Vb/SIsgBhquqpsgGN42Xs8kg==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=bOvx6lieOsII1T9lPP7lo6zn6C4WwSR4T7idp/r0OdytCFC58nBlKmV7klYGlwc2RX6CgGO2iRy+lSFp2SVa+NsJ/MJlIytahiQSAZBeK4dtsuNXl3c40bhh0J46BklZRKEY/gJbAvj+UWyhDPEcElQzsxoK1PND9+mbD4BQtIKhZ+DBmMA603mBbyPjsho9XxEl26hYKGt5LKSbs47KyM76V1ot0l+fpT7CgjuGWMQkkV4CrDso4m/CqhUMC+7z6+icmEYoTJeLLAQ8APp7LLltrl52V6K9zgFEXCN3nICgZ9zBKcxB2//AQe8mJPUdT1clhEmxzR2YX6U4GxOYWw==
  • 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>, Julien Grall <julien@xxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Wei Liu <wl@xxxxxxx>, xen-devel@xxxxxxxxxxxxxxxxxxxx
  • Delivery-date: Mon, 30 Oct 2023 16:43:41 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 30.10.2023 17:34, Oleksii wrote:
> Hello Jan,
> 
> On Thu, 2023-10-19 at 11:55 +0200, Jan Beulich wrote:
>> On 14.09.2023 16:56, Oleksii Kurochko wrote:
>>> --- /dev/null
>>> +++ b/xen/include/asm-generic/pci.h
>>> @@ -0,0 +1,18 @@
>>> +/* SPDX-License-Identifier: GPL-2.0-only */
>>> +#ifndef __ASM_GENERIC_PCI_H__
>>> +#define __ASM_GENERIC_PCI_H__
>>> +
>>> +struct arch_pci_dev {
>>> +};
>>> +
>>> +#endif /* __ASM_GENERIC_PCI_H__ */
>>
>> While more involved, I still wonder whether xen/pci.h could also
>> avoid
>> including asm/pci.h when !HAS_PCI. Of course there's more than just
>> the
>> #include which then would need #ifdef-ing out.
>>
>> Jan
> 
> It looks like we can do that but only one question should be resolved.
> In ARM case, in <asm/pci.h> there is !HAS_PCI branch:
> 
> #else   /*!CONFIG_HAS_PCI*/
> 
> struct arch_pci_dev { };
> 
> static always_inline bool is_pci_passthrough_enabled(void)
> {
>     return false;
> }
> 
> struct pci_dev;
> 
> static inline void arch_pci_init_pdev(struct pci_dev *pdev) {}
> 
> static inline int pci_get_host_bridge_segment(const struct
> dt_device_node *node,
>                                               uint16_t *segment)
> {
>     ASSERT_UNREACHABLE();
>     return -EINVAL;
> }
> 
> static inline int pci_get_new_domain_nr(void)
> {
>     ASSERT_UNREACHABLE();
>     return -1;
> }
> 
> #endif  /*!CONFIG_HAS_PCI*/
> 
> And if is_pci_passthrough_enabled(), arch_pci_init_pdev() is used by
> all architrectures but pci_get_host_bridge_segment() and
> pci_get_new_domain_nr() is ARM specific.
> Does it make sense to add them to <xen/pci.h> and ifdef them?

Counter question: Is the arch_pci_init_pdev() stub actually needed?
The sole caller looks to be in a file which is only built when HAS_PCI=y.

For the Arm-only stubs (which are called from Arm-specific code afaics)
all it would take is that the respective .c files include asm/pci.h
(possibly alongside xen/pci.h).

Jan



 


Rackspace

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