[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH v7 13/14] sdhci: fix the PCI device, using the P
From: |
Peter Maydell |
Subject: |
Re: [Qemu-devel] [PATCH v7 13/14] sdhci: fix the PCI device, using the PCI address space for DMA |
Date: |
Mon, 15 Jan 2018 13:50:51 +0000 |
On 13 January 2018 at 05:07, Philippe Mathieu-Daudé <address@hidden> wrote:
> While SysBus devices can use the get_system_memory() address space,
> PCI devices should use the bus master address space for DMA.
>
> Suggested-by: Peter Maydell <address@hidden>
> Signed-off-by: Philippe Mathieu-Daudé <address@hidden>
> ---
> Should we check for the PCI_COMMAND_MASTER bit before
> using pci_get_address_space()?
That isn't necessary -- the PCI core code handles the master
bit by mapping or unmapping a memory region from the container
which is what the pci_get_address_space() does its writes to.
> @@ -1382,6 +1381,9 @@ static void sdhci_sysbus_realize(DeviceState *dev,
> Error ** errp)
> return;
> }
>
> + s->dma_as = g_new0(AddressSpace, 1);
> + address_space_init(s->dma_as, get_system_memory(), "sdhci-dma");
You can just use address_space_memory rather than creating
a new address space here.
> +
> sysbus_init_irq(sbd, &s->irq);
> sysbus_init_mmio(sbd, &s->iomem);
> }
> @@ -1391,6 +1393,9 @@ static void sdhci_sysbus_unrealize(DeviceState *dev,
> Error **errp)
> SDHCIState *s = SYSBUS_SDHCI(dev);
>
> sdhci_common_unrealize(s, &error_abort);
> +
> + address_space_destroy(s->dma_as);
> + g_free(s->dma_as);
> }
>
> static void sdhci_sysbus_class_init(ObjectClass *klass, void *data)
> --
> 2.15.1
Otherwise
Reviewed-by: Peter Maydell <address@hidden>
thanks
-- PMM
- [Qemu-devel] [PATCH v7 05/14] sdhci: refactor common sysbus/pci realize() into sdhci_common_realize(), (continued)
- [Qemu-devel] [PATCH v7 05/14] sdhci: refactor common sysbus/pci realize() into sdhci_common_realize(), Philippe Mathieu-Daudé, 2018/01/13
- [Qemu-devel] [PATCH v7 07/14] sdhci: use qemu_log_mask(UNIMP) instead of fprintf(), Philippe Mathieu-Daudé, 2018/01/13
- [Qemu-devel] [PATCH v7 06/14] sdhci: refactor common sysbus/pci unrealize() into sdhci_common_unrealize(), Philippe Mathieu-Daudé, 2018/01/13
- [Qemu-devel] [PATCH v7 08/14] sdhci: convert the DPRINT() calls into trace events, Philippe Mathieu-Daudé, 2018/01/13
- [Qemu-devel] [PATCH v7 09/14] sdhci: move MASK_TRNMOD with other SDHC_TRN* defines in "sd-internal.h", Philippe Mathieu-Daudé, 2018/01/13
- [Qemu-devel] [PATCH v7 10/14] sdhci: rename the SDHC_CAPAB register, Philippe Mathieu-Daudé, 2018/01/13
- [Qemu-devel] [PATCH v7 11/14] sdhci: fix CAPAB/MAXCURR registers, both are 64bit and read-only, Philippe Mathieu-Daudé, 2018/01/13
- [Qemu-devel] [PATCH v7 12/14] sdhci: Implement write method of ACMD12ERRSTS register, Philippe Mathieu-Daudé, 2018/01/13
- [Qemu-devel] [PATCH v7 14/14] sdhci: add a 'dma' property to the sysbus devices, Philippe Mathieu-Daudé, 2018/01/13
- [Qemu-devel] [PATCH v7 13/14] sdhci: fix the PCI device, using the PCI address space for DMA, Philippe Mathieu-Daudé, 2018/01/13
- Re: [Qemu-devel] [PATCH v7 13/14] sdhci: fix the PCI device, using the PCI address space for DMA,
Peter Maydell <=
- Re: [Qemu-devel] [PATCH v7 00/14] SDHCI: housekeeping (part 1), Peter Maydell, 2018/01/15