From: "Philippe Mathieu-Daudé" <philmd@redhat.com>
To: BALATON Zoltan <balaton@eik.bme.hu>, qemu-devel@nongnu.org
Cc: Huacai Chen <zltjiangshi@gmail.com>,
Aleksandar Markovic <amarkovic@wavecomp.com>,
Aurelien Jarno <aurelien@aurel32.net>
Subject: Re: [Qemu-devel] [PATCH 1/4] hw/pci-host/bonito.c: Add PCI mem region mapped at the correct address
Date: Tue, 12 Feb 2019 01:18:44 +0100 [thread overview]
Message-ID: <16772f2f-51a5-c4f2-9da2-df1b30380050@redhat.com> (raw)
In-Reply-To: <e26ca956807437844403d835cb2d67bf306244fd.1549857716.git.balaton@eik.bme.hu>
On 2/11/19 5:01 AM, BALATON Zoltan wrote:
> Stop using system memory as PCI memory otherwise devices such as VGA
> that have regions mapped to PCI memory clash with RAM. Use a separate
> memory region for PCI memory and map it to the correct address in
> system memory which allows PCI mem regions to show at the correct
> address where clients expect them.
>
> Signed-off-by: BALATON Zoltan <balaton@eik.bme.hu>
> ---
> hw/pci-host/bonito.c | 5 ++++-
> 1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/hw/pci-host/bonito.c b/hw/pci-host/bonito.c
> index 9f33582706..c940ec6e48 100644
> --- a/hw/pci-host/bonito.c
> +++ b/hw/pci-host/bonito.c
> @@ -598,11 +598,14 @@ static const VMStateDescription vmstate_bonito = {
> static void bonito_pcihost_realize(DeviceState *dev, Error **errp)
> {
> PCIHostState *phb = PCI_HOST_BRIDGE(dev);
> + MemoryRegion *mr = g_new0(MemoryRegion, 1);
No need to alloc, move that to BonitoState, see [*].
>
> + memory_region_init(mr, OBJECT(dev), "pci.mem", BONITO_PCILO_SIZE);
> phb->bus = pci_register_root_bus(DEVICE(dev), "pci",
> pci_bonito_set_irq, pci_bonito_map_irq,
> - dev, get_system_memory(), get_system_io(),
> + dev, mr, get_system_io(),
> 0x28, 32, TYPE_PCI_BUS);
> + memory_region_add_subregion(get_system_memory(), BONITO_PCILO_BASE, mr);
> }
>
> static void bonito_realize(PCIDevice *dev, Error **errp)
>
[*]:
-- >8 --
@@ -217,6 +217,7 @@ struct BonitoState {
PCIHostState parent_obj;
qemu_irq *pic;
PCIBonitoState *pci_dev;
+ MemoryRegion pci_mmio;
};
#define TYPE_BONITO_PCI_HOST_BRIDGE "Bonito-pcihost"
@@ -598,14 +599,15 @@ static const VMStateDescription vmstate_bonito = {
static void bonito_pcihost_realize(DeviceState *dev, Error **errp)
{
PCIHostState *phb = PCI_HOST_BRIDGE(dev);
- MemoryRegion *mr = g_new0(MemoryRegion, 1);
+ BonitoState *s = BONITO_PCI_HOST_BRIDGE(dev);
- memory_region_init(mr, OBJECT(dev), "pci.mem", BONITO_PCILO_SIZE);
+ memory_region_init(&s->pci_mmio, OBJECT(dev), "pci.mem",
BONITO_PCILO_SIZE);
phb->bus = pci_register_root_bus(DEVICE(dev), "pci",
pci_bonito_set_irq,
pci_bonito_map_irq,
- dev, mr, get_system_io(),
+ dev, &s->pci_mmio, get_system_io(),
0x28, 32, TYPE_PCI_BUS);
- memory_region_add_subregion(get_system_memory(), BONITO_PCILO_BASE,
mr);
+ memory_region_add_subregion(get_system_memory(),
+ BONITO_PCILO_BASE, &s->pci_mmio);
}
---
Using snippet:
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Tested-by: Philippe Mathieu-Daudé <philmd@redhat.com>
next prev parent reply other threads:[~2019-02-12 0:26 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-02-11 4:01 [Qemu-devel] [PATCH 0/4] Misc MIPS fulong2e improvements BALATON Zoltan
2019-02-11 4:01 ` [Qemu-devel] [PATCH 2/4] mips_fulong2e: Fix bios flash size BALATON Zoltan
2019-02-11 23:59 ` Philippe Mathieu-Daudé
2019-02-11 4:01 ` [Qemu-devel] [PATCH 4/4] mips_fulong2e: Add on-board graphics chip BALATON Zoltan
2019-02-11 23:54 ` Philippe Mathieu-Daudé
2019-02-13 0:01 ` BALATON Zoltan
2019-02-11 4:01 ` [Qemu-devel] [PATCH 1/4] hw/pci-host/bonito.c: Add PCI mem region mapped at the correct address BALATON Zoltan
2019-02-12 0:18 ` Philippe Mathieu-Daudé [this message]
2019-02-11 4:01 ` [Qemu-devel] [PATCH 3/4] mips_fulong2e: Dynamically generate SPD EEPROM data BALATON Zoltan
2019-02-12 0:00 ` Philippe Mathieu-Daudé
2019-02-14 17:15 ` Aleksandar Markovic
2019-02-14 17:45 ` BALATON Zoltan
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=16772f2f-51a5-c4f2-9da2-df1b30380050@redhat.com \
--to=philmd@redhat.com \
--cc=amarkovic@wavecomp.com \
--cc=aurelien@aurel32.net \
--cc=balaton@eik.bme.hu \
--cc=qemu-devel@nongnu.org \
--cc=zltjiangshi@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).