qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] arm/virt: Add high MMIO PCI region, 2G in size
@ 2015-07-23 11:42 Pavel Fedin
  2015-07-23 11:57 ` Alexander Graf
  0 siblings, 1 reply; 5+ messages in thread
From: Pavel Fedin @ 2015-07-23 11:42 UTC (permalink / raw)
  To: 'QEMU Developers'
  Cc: 'Peter Maydell', 'Alexander Graf',
	'Igor Mammedov'

This large region is necessary for some devices like ivshmem and video cards

Signed-off-by: Pavel Fedin <p.fedin@samsung.com>
---
 A small merge conflict in virt.h is possible when applying the patch to current master. It is
caused by change made by my vGICv3 series (VIRT_GIC_V2M changed).
---
 hw/arm/virt.c         | 13 ++++++++++++-
 include/hw/arm/virt.h |  1 +
 2 files changed, 13 insertions(+), 1 deletion(-)

diff --git a/hw/arm/virt.c b/hw/arm/virt.c
index e798f72..a9badec 100644
--- a/hw/arm/virt.c
+++ b/hw/arm/virt.c
@@ -125,6 +125,7 @@ static const MemMapEntry a15memmap[] = {
     [VIRT_PCIE_PIO] =           { 0x3eff0000, 0x00010000 },
     [VIRT_PCIE_ECAM] =          { 0x3f000000, 0x01000000 },
     [VIRT_MEM] =                { 0x40000000, 30ULL * 1024 * 1024 * 1024 },
+    [VIRT_PCIE_MMIO_HIGH] =     {0x800000000, 0x80000000 },
 };
 
 static const int a15irqmap[] = {
@@ -759,6 +760,8 @@ static void create_pcie(const VirtBoardInfo *vbi, qemu_irq *pic)
     hwaddr size_pio = vbi->memmap[VIRT_PCIE_PIO].size;
     hwaddr base_ecam = vbi->memmap[VIRT_PCIE_ECAM].base;
     hwaddr size_ecam = vbi->memmap[VIRT_PCIE_ECAM].size;
+    hwaddr base_mmio_high = vbi->memmap[VIRT_PCIE_MMIO_HIGH].base;
+    hwaddr size_mmio_high = vbi->memmap[VIRT_PCIE_MMIO_HIGH].size;
     hwaddr base = base_mmio;
     int nr_pcie_buses = size_ecam / PCIE_MMCFG_SIZE_MIN;
     int irq = vbi->irqmap[VIRT_PCIE];
@@ -794,6 +797,12 @@ static void create_pcie(const VirtBoardInfo *vbi, qemu_irq *pic)
     /* Map IO port space */
     sysbus_mmio_map(SYS_BUS_DEVICE(dev), 2, base_pio);
 
+    /* High MMIO space */
+    mmio_alias = g_new0(MemoryRegion, 1);
+    memory_region_init_alias(mmio_alias, OBJECT(dev), "pcie-mmio-high",
+                             mmio_reg, base_mmio_high, size_mmio_high);
+    memory_region_add_subregion(get_system_memory(), base_mmio_high, mmio_alias);
+
     for (i = 0; i < GPEX_NUM_IRQS; i++) {
         sysbus_connect_irq(SYS_BUS_DEVICE(dev), i, pic[irq + i]);
     }
@@ -819,7 +828,9 @@ static void create_pcie(const VirtBoardInfo *vbi, qemu_irq *pic)
                                  1, FDT_PCI_RANGE_IOPORT, 2, 0,
                                  2, base_pio, 2, size_pio,
                                  1, FDT_PCI_RANGE_MMIO, 2, base_mmio,
-                                 2, base_mmio, 2, size_mmio);
+                                 2, base_mmio, 2, size_mmio,
+                                 1, FDT_PCI_RANGE_MMIO, 2, base_mmio_high,
+                                 2, base_mmio_high, 2, size_mmio_high);
 
     qemu_fdt_setprop_cell(vbi->fdt, nodename, "#interrupt-cells", 1);
     create_pcie_irq_map(vbi, vbi->gic_phandle, irq, nodename);
diff --git a/include/hw/arm/virt.h b/include/hw/arm/virt.h
index 852efb9..1d43598 100644
--- a/include/hw/arm/virt.h
+++ b/include/hw/arm/virt.h
@@ -60,6 +60,7 @@ enum {
     VIRT_PCIE_PIO,
     VIRT_PCIE_ECAM,
     VIRT_PLATFORM_BUS,
+    VIRT_PCIE_MMIO_HIGH,
 };
 
 typedef struct MemMapEntry {
-- 
1.9.5.msysgit.0

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [Qemu-devel] [PATCH] arm/virt: Add high MMIO PCI region, 2G in size
  2015-07-23 11:42 [Qemu-devel] [PATCH] arm/virt: Add high MMIO PCI region, 2G in size Pavel Fedin
@ 2015-07-23 11:57 ` Alexander Graf
  2015-07-23 16:56   ` Paolo Bonzini
  2015-07-24  7:16   ` Pavel Fedin
  0 siblings, 2 replies; 5+ messages in thread
From: Alexander Graf @ 2015-07-23 11:57 UTC (permalink / raw)
  To: Pavel Fedin, 'QEMU Developers'
  Cc: 'Peter Maydell', 'Igor Mammedov'



On 23.07.15 13:42, Pavel Fedin wrote:
> This large region is necessary for some devices like ivshmem and video cards
> 
> Signed-off-by: Pavel Fedin <p.fedin@samsung.com>
> ---
>  A small merge conflict in virt.h is possible when applying the patch to current master. It is
> caused by change made by my vGICv3 series (VIRT_GIC_V2M changed).
> ---
>  hw/arm/virt.c         | 13 ++++++++++++-
>  include/hw/arm/virt.h |  1 +
>  2 files changed, 13 insertions(+), 1 deletion(-)
> 
> diff --git a/hw/arm/virt.c b/hw/arm/virt.c
> index e798f72..a9badec 100644
> --- a/hw/arm/virt.c
> +++ b/hw/arm/virt.c
> @@ -125,6 +125,7 @@ static const MemMapEntry a15memmap[] = {
>      [VIRT_PCIE_PIO] =           { 0x3eff0000, 0x00010000 },
>      [VIRT_PCIE_ECAM] =          { 0x3f000000, 0x01000000 },
>      [VIRT_MEM] =                { 0x40000000, 30ULL * 1024 * 1024 * 1024 },
> +    [VIRT_PCIE_MMIO_HIGH] =     {0x800000000, 0x80000000 },

This limits the amount of RAM to 30GB, no? I'm not sure it's what we
want in the long run ...

>  };
>  
>  static const int a15irqmap[] = {
> @@ -759,6 +760,8 @@ static void create_pcie(const VirtBoardInfo *vbi, qemu_irq *pic)
>      hwaddr size_pio = vbi->memmap[VIRT_PCIE_PIO].size;
>      hwaddr base_ecam = vbi->memmap[VIRT_PCIE_ECAM].base;
>      hwaddr size_ecam = vbi->memmap[VIRT_PCIE_ECAM].size;
> +    hwaddr base_mmio_high = vbi->memmap[VIRT_PCIE_MMIO_HIGH].base;
> +    hwaddr size_mmio_high = vbi->memmap[VIRT_PCIE_MMIO_HIGH].size;
>      hwaddr base = base_mmio;
>      int nr_pcie_buses = size_ecam / PCIE_MMCFG_SIZE_MIN;
>      int irq = vbi->irqmap[VIRT_PCIE];
> @@ -794,6 +797,12 @@ static void create_pcie(const VirtBoardInfo *vbi, qemu_irq *pic)
>      /* Map IO port space */
>      sysbus_mmio_map(SYS_BUS_DEVICE(dev), 2, base_pio);
>  
> +    /* High MMIO space */
> +    mmio_alias = g_new0(MemoryRegion, 1);
> +    memory_region_init_alias(mmio_alias, OBJECT(dev), "pcie-mmio-high",
> +                             mmio_reg, base_mmio_high, size_mmio_high);
> +    memory_region_add_subregion(get_system_memory(), base_mmio_high, mmio_alias);
> +
>      for (i = 0; i < GPEX_NUM_IRQS; i++) {
>          sysbus_connect_irq(SYS_BUS_DEVICE(dev), i, pic[irq + i]);
>      }
> @@ -819,7 +828,9 @@ static void create_pcie(const VirtBoardInfo *vbi, qemu_irq *pic)
>                                   1, FDT_PCI_RANGE_IOPORT, 2, 0,
>                                   2, base_pio, 2, size_pio,
>                                   1, FDT_PCI_RANGE_MMIO, 2, base_mmio,
> -                                 2, base_mmio, 2, size_mmio);
> +                                 2, base_mmio, 2, size_mmio,
> +                                 1, FDT_PCI_RANGE_MMIO, 2, base_mmio_high,

You need to mark the range as 64bit. Also maybe we want to make this
region write combined?


Alex

> +                                 2, base_mmio_high, 2, size_mmio_high);
>  
>      qemu_fdt_setprop_cell(vbi->fdt, nodename, "#interrupt-cells", 1);
>      create_pcie_irq_map(vbi, vbi->gic_phandle, irq, nodename);
> diff --git a/include/hw/arm/virt.h b/include/hw/arm/virt.h
> index 852efb9..1d43598 100644
> --- a/include/hw/arm/virt.h
> +++ b/include/hw/arm/virt.h
> @@ -60,6 +60,7 @@ enum {
>      VIRT_PCIE_PIO,
>      VIRT_PCIE_ECAM,
>      VIRT_PLATFORM_BUS,
> +    VIRT_PCIE_MMIO_HIGH,
>  };
>  
>  typedef struct MemMapEntry {
> 

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [Qemu-devel] [PATCH] arm/virt: Add high MMIO PCI region, 2G in size
  2015-07-23 11:57 ` Alexander Graf
@ 2015-07-23 16:56   ` Paolo Bonzini
  2015-07-26 13:13     ` Pavel Fedin
  2015-07-24  7:16   ` Pavel Fedin
  1 sibling, 1 reply; 5+ messages in thread
From: Paolo Bonzini @ 2015-07-23 16:56 UTC (permalink / raw)
  To: Alexander Graf, Pavel Fedin, 'QEMU Developers'
  Cc: 'Peter Maydell', 'Igor Mammedov'



On 23/07/2015 13:57, Alexander Graf wrote:
>> > @@ -125,6 +125,7 @@ static const MemMapEntry a15memmap[] = {
>> >      [VIRT_PCIE_PIO] =           { 0x3eff0000, 0x00010000 },
>> >      [VIRT_PCIE_ECAM] =          { 0x3f000000, 0x01000000 },
>> >      [VIRT_MEM] =                { 0x40000000, 30ULL * 1024 * 1024 * 1024 },
>> > +    [VIRT_PCIE_MMIO_HIGH] =     {0x800000000, 0x80000000 },
> This limits the amount of RAM to 30GB, no? I'm not sure it's what we
> want in the long run ...

Limiting high MMIO to 2GB is also relatively little.

(What the hell... my first hard drive was 20 MB and it failed more or
less at the same time as we managed to fill it...).

Paolo

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [Qemu-devel] [PATCH] arm/virt: Add high MMIO PCI region, 2G in size
  2015-07-23 11:57 ` Alexander Graf
  2015-07-23 16:56   ` Paolo Bonzini
@ 2015-07-24  7:16   ` Pavel Fedin
  1 sibling, 0 replies; 5+ messages in thread
From: Pavel Fedin @ 2015-07-24  7:16 UTC (permalink / raw)
  To: 'Alexander Graf', 'QEMU Developers'
  Cc: 'Peter Maydell', 'Igor Mammedov'

 Hello!

> > --- a/hw/arm/virt.c
> > +++ b/hw/arm/virt.c
> > @@ -125,6 +125,7 @@ static const MemMapEntry a15memmap[] = {
> >      [VIRT_PCIE_PIO] =           { 0x3eff0000, 0x00010000 },
> >      [VIRT_PCIE_ECAM] =          { 0x3f000000, 0x01000000 },
> >      [VIRT_MEM] =                { 0x40000000, 30ULL * 1024 * 1024 * 1024 },
> > +    [VIRT_PCIE_MMIO_HIGH] =     {0x800000000, 0x80000000 },
> 
> This limits the amount of RAM to 30GB, no? I'm not sure it's what we
> want in the long run ...

 Will it be OK if i put it at 0xf00000000 then?
 
Kind regards,
Pavel Fedin
Expert Engineer
Samsung Electronics Research center Russia

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [Qemu-devel] [PATCH] arm/virt: Add high MMIO PCI region, 2G in size
  2015-07-23 16:56   ` Paolo Bonzini
@ 2015-07-26 13:13     ` Pavel Fedin
  0 siblings, 0 replies; 5+ messages in thread
From: Pavel Fedin @ 2015-07-26 13:13 UTC (permalink / raw)
  To: 'Paolo Bonzini', 'Alexander Graf',
	'QEMU Developers'
  Cc: 'Peter Maydell', 'Igor Mammedov'

 Hello!

> Limiting high MMIO to 2GB is also relatively little.

 Ok, then what about 512GB window @ 512GB address? Would this satisfy everybody ?

[VIRT_PCIE_MMIO_HIGH] =     {0x8000000000, 0x8000000000 }

Kind regards,
Pavel Fedin
Expert Engineer
Samsung Electronics Research center Russia

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2015-07-26 13:13 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-07-23 11:42 [Qemu-devel] [PATCH] arm/virt: Add high MMIO PCI region, 2G in size Pavel Fedin
2015-07-23 11:57 ` Alexander Graf
2015-07-23 16:56   ` Paolo Bonzini
2015-07-26 13:13     ` Pavel Fedin
2015-07-24  7:16   ` Pavel Fedin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).