On Tue, Aug 29, 2023 at 11:19:47PM +0000, Volodymyr Babchuk wrote:
> From: Stewart Hildebrand <[email protected]>
> 
> Skip mapping the BAR if it is not in a valid range.
> 
> Signed-off-by: Stewart Hildebrand <[email protected]>
> ---
>  xen/drivers/vpci/header.c | 9 +++++++++
>  1 file changed, 9 insertions(+)
> 
> diff --git a/xen/drivers/vpci/header.c b/xen/drivers/vpci/header.c
> index 1d243eeaf9..dbabdcbed2 100644
> --- a/xen/drivers/vpci/header.c
> +++ b/xen/drivers/vpci/header.c
> @@ -345,6 +345,15 @@ static int modify_bars(const struct pci_dev *pdev, 
> uint16_t cmd, bool rom_only)
>               bar->enabled == !!(cmd & PCI_COMMAND_MEMORY) )
>              continue;
>  
> +#ifdef CONFIG_ARM
> +        if ( !is_hardware_domain(pdev->domain) )
> +        {
> +            if ( (start_guest < PFN_DOWN(GUEST_VPCI_MEM_ADDR)) ||
> +                 (end_guest >= PFN_DOWN(GUEST_VPCI_MEM_ADDR + 
> GUEST_VPCI_MEM_SIZE)) )
> +                continue;
> +        }
> +#endif

Hm, I think this should be in a hook similar to pci_check_bar() that
can be implemented per-arch.

IIRC at least on x86 we allow the guest to place the BARs whenever it
wants, would such placement cause issues to the hypervisor on Arm?

Thanks, Roger.

Reply via email to