[PATCH] hw/misc/ivshmem: Use 32-bit addressing for the memory BAR

Geoffrey McRae posted 1 patch 1 year ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/20230419043931.36764-1-geoff@hostfission.com
hw/misc/ivshmem.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
[PATCH] hw/misc/ivshmem: Use 32-bit addressing for the memory BAR
Posted by Geoffrey McRae 1 year ago
Since OVMF 202211 the bios maps BAR2 to an upper address which has the
undesirable effect of making it impossible to map the memory under Linux
due to it exceeding the maximum permissible range for hotplug memory
(see `mhp_get_pluggable_range` in `mm/memory_hotplug.c`). This patch
resolves this by configuring the BAR as 32-bit.

Signed-off-by: Geoffrey McRae <geoff@hostfission.com>
---
 hw/misc/ivshmem.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/hw/misc/ivshmem.c b/hw/misc/ivshmem.c
index d66d912172..2f8f7e2030 100644
--- a/hw/misc/ivshmem.c
+++ b/hw/misc/ivshmem.c
@@ -913,7 +913,7 @@ static void ivshmem_common_realize(PCIDevice *dev, Error **errp)
     pci_register_bar(PCI_DEVICE(s), 2,
                      PCI_BASE_ADDRESS_SPACE_MEMORY |
                      PCI_BASE_ADDRESS_MEM_PREFETCH |
-                     PCI_BASE_ADDRESS_MEM_TYPE_64,
+                     PCI_BASE_ADDRESS_MEM_TYPE_32,
                      s->ivshmem_bar2);
 }
 
-- 
2.39.2
Re: [PATCH] hw/misc/ivshmem: Use 32-bit addressing for the memory BAR
Posted by Geoffrey McRae 5 months ago
It seems this patch was missed/ignored, Can we please get some traction 
on this? Even if this is not the correct approach some advice on how to 
get this issue resolved would be much appreciated. We are seeing a lot 
of outcry of the fact that people have to roll back their OVMF BIOS to 
get things working.

On 2023-04-19 14:39, Geoffrey McRae wrote:
> Since OVMF 202211 the bios maps BAR2 to an upper address which has the
> undesirable effect of making it impossible to map the memory under 
> Linux
> due to it exceeding the maximum permissible range for hotplug memory
> (see `mhp_get_pluggable_range` in `mm/memory_hotplug.c`). This patch
> resolves this by configuring the BAR as 32-bit.
> 
> Signed-off-by: Geoffrey McRae <geoff@hostfission.com>
> ---
>  hw/misc/ivshmem.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/hw/misc/ivshmem.c b/hw/misc/ivshmem.c
> index d66d912172..2f8f7e2030 100644
> --- a/hw/misc/ivshmem.c
> +++ b/hw/misc/ivshmem.c
> @@ -913,7 +913,7 @@ static void ivshmem_common_realize(PCIDevice *dev, 
> Error **errp)
>      pci_register_bar(PCI_DEVICE(s), 2,
>                       PCI_BASE_ADDRESS_SPACE_MEMORY |
>                       PCI_BASE_ADDRESS_MEM_PREFETCH |
> -                     PCI_BASE_ADDRESS_MEM_TYPE_64,
> +                     PCI_BASE_ADDRESS_MEM_TYPE_32,
>                       s->ivshmem_bar2);
>  }