|
[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
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.
> +{
> + 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()?
> + 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).
> + if ( ret < 0 )
> + return false;
> +
> + if ( !bar_data.is_valid )
> + return false;
> +
> + return true;
Simply "return bar_data.is_valid;"?
Jan
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |