Patchwork ivshmem: fix PCI BAR2 registration during initialization

login
register
mail settings
Submitter zanghongyong@huawei.com
Date Nov. 21, 2011, 10:56 a.m.
Message ID <1321872978-3298-1-git-send-email-zanghongyong@huawei.com>
Download mbox | patch
Permalink /patch/126762/
State New
Headers show

Comments

zanghongyong@huawei.com - Nov. 21, 2011, 10:56 a.m.
From: Hongyong Zang <zanghongyong@huawei.com>

Ivshmem cannot work, and the command lspci cannot show ivshmem BAR2 in the guest.
As for pci_register_bar(), parameter MemoryRegion should be s->bar instead of s->ivshmem.

Signed-off-by: Hongyong Zang <zanghongyong@huawei.com>
---
 hw/ivshmem.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
Avi Kivity - Nov. 21, 2011, 12:16 p.m.
On 11/21/2011 12:56 PM, zanghongyong@huawei.com wrote:
> From: Hongyong Zang <zanghongyong@huawei.com>
>
> Ivshmem cannot work, and the command lspci cannot show ivshmem BAR2 in the guest.
> As for pci_register_bar(), parameter MemoryRegion should be s->bar instead of s->ivshmem.
>
> Signed-off-by: Hongyong Zang <zanghongyong@huawei.com>
> ---
>  hw/ivshmem.c |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
>
> diff --git a/hw/ivshmem.c b/hw/ivshmem.c
> index 242fbea..2ecf658 100644
> --- a/hw/ivshmem.c
> +++ b/hw/ivshmem.c
> @@ -694,7 +694,7 @@ static int pci_ivshmem_init(PCIDevice *dev)
>          s->peers = g_malloc0(s->nb_peers * sizeof(Peer));
>  
>          pci_register_bar(&s->dev, 2,
> -                         PCI_BASE_ADDRESS_SPACE_MEMORY, &s->ivshmem);
> +                         PCI_BASE_ADDRESS_SPACE_MEMORY, &s->bar);
>  
>          s->eventfd_chr = g_malloc0(s->vectors * sizeof(CharDriverState *));
>  

Reviewed-by: Avi Kivity <avi@redhat.com>

This is 1.0 worthy.
Anthony Liguori - Nov. 22, 2011, 12:22 a.m.
On 11/21/2011 04:56 AM, zanghongyong@huawei.com wrote:
> From: Hongyong Zang<zanghongyong@huawei.com>
>
> Ivshmem cannot work, and the command lspci cannot show ivshmem BAR2 in the guest.
> As for pci_register_bar(), parameter MemoryRegion should be s->bar instead of s->ivshmem.
>
> Signed-off-by: Hongyong Zang<zanghongyong@huawei.com>

Applied.  Thanks.

Regards,

Anthony Liguori

> ---
>   hw/ivshmem.c |    2 +-
>   1 files changed, 1 insertions(+), 1 deletions(-)
>
> diff --git a/hw/ivshmem.c b/hw/ivshmem.c
> index 242fbea..2ecf658 100644
> --- a/hw/ivshmem.c
> +++ b/hw/ivshmem.c
> @@ -694,7 +694,7 @@ static int pci_ivshmem_init(PCIDevice *dev)
>           s->peers = g_malloc0(s->nb_peers * sizeof(Peer));
>
>           pci_register_bar(&s->dev, 2,
> -                         PCI_BASE_ADDRESS_SPACE_MEMORY,&s->ivshmem);
> +                         PCI_BASE_ADDRESS_SPACE_MEMORY,&s->bar);
>
>           s->eventfd_chr = g_malloc0(s->vectors * sizeof(CharDriverState *));
>

Patch

diff --git a/hw/ivshmem.c b/hw/ivshmem.c
index 242fbea..2ecf658 100644
--- a/hw/ivshmem.c
+++ b/hw/ivshmem.c
@@ -694,7 +694,7 @@  static int pci_ivshmem_init(PCIDevice *dev)
         s->peers = g_malloc0(s->nb_peers * sizeof(Peer));
 
         pci_register_bar(&s->dev, 2,
-                         PCI_BASE_ADDRESS_SPACE_MEMORY, &s->ivshmem);
+                         PCI_BASE_ADDRESS_SPACE_MEMORY, &s->bar);
 
         s->eventfd_chr = g_malloc0(s->vectors * sizeof(CharDriverState *));