[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH v2 2/2] xen/pci: replace call to is_memory_hole to pci_check_bar
- To: Jan Beulich <jbeulich@xxxxxxxx>
- From: Rahul Singh <Rahul.Singh@xxxxxxx>
- Date: Thu, 18 Aug 2022 14:58:37 +0000
- Accept-language: en-US
- Arc-authentication-results: i=2; mx.microsoft.com 1; spf=pass (sender ip is 63.35.35.123) smtp.rcpttodomain=lists.xenproject.org smtp.mailfrom=arm.com; dmarc=pass (p=none sp=none pct=100) action=none header.from=arm.com; dkim=pass (signature was verified) header.d=armh.onmicrosoft.com; arc=pass (0 oda=1 ltdi=1 spf=[1,1,smtp.mailfrom=arm.com] dkim=[1,1,header.d=arm.com] dmarc=[1,1,header.from=arm.com])
- Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=arm.com; dmarc=pass action=none header.from=arm.com; dkim=pass header.d=arm.com; arc=none
- Arc-message-signature: i=2; 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=xeBGDWK9BVixJ/8oPcXiVSRkQpLynfRHlAjh9I4vS4w=; b=L2JYuDguWG6oXiOaJ94WkDtOXEXOJ1F+fs8tA4EjTvo2dWyziOCSkYClXs/XZntwBxYtnFVxQxtzK0GtWYrAaKZFMdv9UjCnVRHld7NABFWBcikK4yWJ0ATbW22/54Vy0Ie9d97Ikm6DdKm2neF5WlMeTayDTL2OjhoZz7Rbv+Ihkp8kBkweDFipOjALzqMdu72eyHkiETr+7PyHSGI3j1Ks26vglQC2/fXC6Iz5rR+35C3uxvEFhRwSf51LetRcvJazMcANGd+RkRbPJDK/BrtLnNgB0S5B095b8Q6RHJIbXDBv77JootquyUZWOPJuckHd42LHbqJiAG+BG9dE7g==
- 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=xeBGDWK9BVixJ/8oPcXiVSRkQpLynfRHlAjh9I4vS4w=; b=L50h8jNQpz6XeLse0sHxvGeSPDMd5rX200xGVzzeNCSaaD+DJG+E48euOp0iMGwN5vfHCY1cCjlg7fWq6+iGabdtShjahWEZTaxsX60W3mLoQSyhoxQDGYulruZVgzhhEsdj/9/be9mwVT5rwcrrDbX5+ifaUr0QYaUUdFMVfcuZwDtVrCZeuU/gdDTZeFBCI0jh2dJ5kd7GQRRm6QHE2VWIfhZpfYdgCFmHS7hn0J3MaUqHeQpD/cV7DIlqXmqoCH6GAjmTOrKBzgCKk7S527F+cgR3rCLzYbon9z+9xpX+6DTpX/HYdEedW62lfMYPn2xCcnrA6exH9W0MZnqD7w==
- Arc-seal: i=2; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=pass; b=eFD2MxtVF+Xt/Uc8TMxe3UusMwB+vYFgmIY5rpz4E/ICvtkWpJB0IxG1/yG/BG6i3FKLntU8j2rTGCeXMafjXyfixQqdTOH0thsOEjTMScGA1SjryMvWjMP4pM0TtFOJWpT+DPIWNcGxnga+JZMd+mgo53RoZMuBMPN44Fjo1/FgAbtidnVxu0q4np+0ZYiYf80jyJOjvpuTvv3LaMw9MDCjah0vFrwS2NVIIniVFQ+0JlyhQCjEMbKCpx81IXdBDQ7pmUiwOKE3wa13ool+dAGt8WbQtzFb3nAV+bdNXA/y6kXQcQ3xcZ+mXFGITqqj8zPCS6I9Orr06B92ORwGPg==
- Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=KJgZungl41T8Yby2MW3qECBYj8P5zzjdT+4fhd566o18b60A7C2efHCmGhq321W3W5Ko0ZB7FpjlFlaR8fdKMVPVI38oPy/xi5kH7KIvifhPRgHiN08poME48574TOBNRR3osPtx4ek7JT5S5oFVQY3y6n8Kl1Jk13l26sfd6hdPRcccz0kI6QAwrHNktK/c0sLgDbcIklRF32f5/P0gcd56y28iRJUCGGEI20GMC2LuMBcwKTDhStuywUgnc9we9TLQB6L01PMbcEg3XyC/56FDPGJ1ehwM1BeZSpzI/ISbvqVlqgDzCLfPkdlV+JB4wDS1z0wqueRG3fbNzU0T8g==
- Authentication-results-original: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=arm.com;
- Cc: Bertrand Marquis <Bertrand.Marquis@xxxxxxx>, 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" <xen-devel@xxxxxxxxxxxxxxxxxxxx>
- Delivery-date: Thu, 18 Aug 2022 14:59:04 +0000
- List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
- Nodisclaimer: true
- Original-authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=arm.com;
- Thread-index: AQHYskgSn+BMkn6XSUmZynj+RN74K62zNKQAgAGMxwA=
- Thread-topic: [PATCH v2 2/2] xen/pci: replace call to is_memory_hole to pci_check_bar
Hello Jan,
> On 17 Aug 2022, at 4:18 pm, Jan Beulich <jbeulich@xxxxxxxx> wrote:
>
> On 17.08.2022 16:45, Rahul Singh wrote:
>> @@ -363,6 +373,42 @@ 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)
>
> s/u64/uint64_t/g please.
Ack.
>
>> +{
>> + struct pdev_bar *bar_data = data;
>> + unsigned long s = mfn_x(bar_data->start);
>> + unsigned long e = mfn_x(bar_data->end);
>> +
>> + if ( (s < e) && (s >= PFN_UP(addr)) && (e <= PFN_UP(addr + len - 1)) )
>
> Doesn't this need to be s >= PFN_DOWN(addr)? Or else why is e checked
> against PFN_UP()?
Ack. I will modify as if ( (s < e) && (s >= PFN_DOWN(addr)) && (e <=
PFN_UP(addr + len - 1)) )
>
>> + bar_data->is_valid = true;
>> +
>> + return 0;
>> +}
>> +
>> +bool pci_check_bar(const struct pci_dev *pdev, mfn_t start, mfn_t end)
>> +{
>> + int ret;
>> + const struct dt_device_node *dt_node;
>> + struct pdev_bar bar_data = {
>> + .start = start,
>> + .end = end,
>> + .is_valid = false
>> + };
>> +
>> + dt_node = pci_find_host_bridge_node(pdev);
>> + if ( !dt_node )
>> + return false;
>> +
>> + ret = dt_for_each_range(dt_node, &is_bar_valid, &bar_data);
>
> Just as a side note - I find such (the first instance here) uses of the
> unary & operator odd. The same effect will be had without it. So all it
> does (in my opinion) is make things harder to read (just very slightly,
> of course).
I follow the same calling method as used in map_device_children() function in
file arch/arm/domain_build.c
>
>> + if ( ret < 0 )
>> + return false;
>> +
>> + if ( !bar_data.is_valid )
>> + return false;
>> +
>> + return true;
>
> Simply "return bar_data.is_valid;"?
Ack.
Regards,
Rahul
|