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

Re: [PATCH] xen/pci: replace call to is_memory_hole to pci_check_bar


  • To: Oleksandr <olekstysh@xxxxxxxxx>, Rahul Singh <rahul.singh@xxxxxxx>
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Tue, 9 Aug 2022 12:11:23 +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=gxKSiC1OQmtpVWmA/XPbVf5BRb6scrzbYmJiVJJ50us=; b=H7ej6bpVd9dfqLqnJcl8cp3fy+a5PKDif0JKeejEgalKKsKcDuhBO5zhGlH16g4KOYxn+Le5JgOSvabuqylL8tUK9J+9lOv8AUISA9JLkAOHjA/pQBveckONSa+/EVNT2iREe2laPw13Yj/IepaEOnDV6LMEz028vF31VIeLvzrkSHmGLDVqF2sbixLm/Sc7YVIz4YEKnEbyhbWe1byPgtXxG4BVxYUHRBxoWKjAXUv09bE+naR+2H1dwywe1c8MH+j0xFTRQ2/AkriKf6g1a6v5oQNrlRSM/QuJQTGpP+4Ge81RMMkySDuzoQyNHcccdr5dpcgg+OnlZuqnV24EIQ==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Z9YU9GpVxo+zYHwUbek5mmEYekZdpuiZRQ/i+tGlFbUN/Gv4hVCGgRERMMl1deqnt2Ng+Q9/+RoD4w2DWcAQRic7MyDQW0iXOvBo9XOEJqUJzCJcthtS6ze8jis4ieS3tMmvyhn2/lX83ZxNHMJzFWk3c9GWHHmPattjZLvncumzNt0l4y0VghGG7VqAx3GdtUc1aIAL30W+s0pU+BaazRgf9LAS8zW7hBqTKDCGtsBBnd6p389bOPWHSO0eOBIjDSDNIjn9QQOfLBsWb/rSL+isxY2JYtpGFW6pRNS4sYxvrA6uGYJvg7KlqchpQeaXGSw71TpErWPM4Qe8dk+wUw==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com;
  • Cc: bertrand.marquis@xxxxxxx, Oleksandr Andrushchenko <oleksandr_andrushchenko@xxxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Julien Grall <julien@xxxxxxx>, Volodymyr Babchuk <Volodymyr_Babchuk@xxxxxxxx>, Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Roger Pau Monné <roger.pau@xxxxxxxxxx>, Wei Liu <wl@xxxxxxx>, Paul Durrant <paul@xxxxxxx>, xen-devel@xxxxxxxxxxxxxxxxxxxx
  • Delivery-date: Tue, 09 Aug 2022 10:11:33 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 08.08.2022 17:30, Oleksandr wrote:
> On 05.08.22 18:43, Rahul Singh wrote:
>> --- a/xen/arch/arm/pci/pci-host-common.c
>> +++ b/xen/arch/arm/pci/pci-host-common.c
>> @@ -363,6 +363,41 @@ int __init pci_host_bridge_mappings(struct domain *d)
>>       return 0;
>>   }
>>   
>> +static int is_bar_valid(const struct dt_device_node *dev,
>> +                        u64 addr, u64 len, void *data)

Nit: No new uses of u64 please use uint64_t instead.

>> --- a/xen/arch/x86/include/asm/pci.h
>> +++ b/xen/arch/x86/include/asm/pci.h
>> @@ -57,4 +57,14 @@ static always_inline bool is_pci_passthrough_enabled(void)
>>   
>>   void arch_pci_init_pdev(struct pci_dev *pdev);
>>   
>> +static inline bool pci_check_bar(const struct pci_dev *pdev,
>> +                                 mfn_t start, mfn_t end)
>> +{
>> +    /*
>> +     * Check if BAR is not overlapping with any memory region defined
>> +     * in the memory map.
>> +     */
>> +    return is_memory_hole(start, end);
>> +}
> 
> 
> Nit: I would use simple #define instead of static inline here
> 
> But I am not 100% sure that x86 maintainers would be happy.

Quite the other way around - when possible we prefer inline functions.
And note that the two functions are strictly aliases of one another
(in which case a simplified

#define pci_check_bar is_memory_hole

might indeed have been worth a consideration, as there's no type
safety to be lost in such cases).

Jan



 


Rackspace

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