From: Oleksandr Andrushchenko <oleksandr_andrushchenko@epam.com>
Signed-off-by: Oleksandr Andrushchenko <oleksandr_andrushchenko@epam.com>
---
xen/drivers/vpci/header.c | 16 +++++++++++-----
1 file changed, 11 insertions(+), 5 deletions(-)
diff --git a/xen/drivers/vpci/header.c b/xen/drivers/vpci/header.c
index 1f326c894d16..d5738ecca93d 100644
--- a/xen/drivers/vpci/header.c
+++ b/xen/drivers/vpci/header.c
@@ -34,13 +34,19 @@ struct map_data {
struct pci_dev *pdev;
};
+static bool is_hardware_domain_DomD(const struct domain *d)
+{
+ return d->domain_id == 1;
+}
+
static struct vpci_header *get_vpci_header(struct domain *d,
const struct pci_dev *pdev);
static struct vpci_header *get_hwdom_vpci_header(const struct pci_dev *pdev)
{
+ /* TODO: this should be for the hardware_domain, not current->domain. */
if ( unlikely(list_empty(&pdev->vpci->headers)) )
- return get_vpci_header(hardware_domain, pdev);
+ return get_vpci_header(current->domain, pdev);
/* hwdom's header is always the very first entry. */
return list_first_entry(&pdev->vpci->headers, struct vpci_header, node);
@@ -74,7 +80,7 @@ static struct vpci_header *get_vpci_header(struct domain *d,
return NULL;
}
- if ( !is_hardware_domain(d) )
+ if ( !is_hardware_domain_DomD(d) )
{
struct vpci_header *hwdom_header = get_hwdom_vpci_header(pdev);
#ifdef CONFIG_ARM
@@ -304,7 +310,7 @@ static int modify_bars(const struct pci_dev *pdev, uint16_t cmd, bool rom_only)
if ( !mem )
return -ENOMEM;
- if ( is_hardware_domain(current->domain) )
+ if ( is_hardware_domain_DomD(current->domain) )
header = get_hwdom_vpci_header(pdev);
else
header = get_vpci_header(current->domain, pdev);
@@ -641,7 +647,7 @@ static uint32_t bar_read_dispatch(const struct pci_dev *pdev, unsigned int reg,
{
struct vpci_bar *vbar, *bar = data;
- if ( is_hardware_domain(current->domain) )
+ if ( is_hardware_domain_DomD(current->domain) )
return bar_read_hwdom(pdev, reg, data);
vbar = get_vpci_bar(current->domain, pdev, bar->index);
@@ -656,7 +662,7 @@ static void bar_write_dispatch(const struct pci_dev *pdev, unsigned int reg,
{
struct vpci_bar *bar = data;
- if ( is_hardware_domain(current->domain) )
+ if ( is_hardware_domain_DomD(current->domain) )
bar_write_hwdom(pdev, reg, val, data);
else
{
--
2.17.1