[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH 3/6] hw/sd/allwinner-sdhost: Do DMA accesses via DMA address
From: |
Philippe Mathieu-Daudé |
Subject: |
Re: [PATCH 3/6] hw/sd/allwinner-sdhost: Do DMA accesses via DMA address space |
Date: |
Sun, 31 May 2020 21:31:52 +0200 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.5.0 |
On 5/31/20 7:54 PM, Philippe Mathieu-Daudé wrote:
> The DMA operations should not use the CPU address space, but
> the DMA address space. Add support for a DMA address space,
> and replace the cpu_physical_memory API calls by equivalent
> dma_memory_read/write calls.
>
> Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
> ---
> include/hw/sd/allwinner-sdhost.h | 4 ++++
> hw/sd/allwinner-sdhost.c | 36 ++++++++++++++++++++++++++------
> 2 files changed, 34 insertions(+), 6 deletions(-)
>
[...]> @@ -742,6 +747,17 @@ static void allwinner_sdhost_init(Object *obj)
> sysbus_init_irq(SYS_BUS_DEVICE(s), &s->irq);
> }
>
> +static void allwinner_sdhost_realize(DeviceState *dev, Error **errp)
> +{
> + AwSdHostState *s = AW_SDHOST(dev);
> +
> + if (!s->dma_mr) {
> + error_setg(errp, "\"dma\" property must be provided.");
Oops I forgot to include the part that sets this property in the A10/H3
SoCs.
> + return;
> + }
> + address_space_init(&s->dma_as, s->dma_mr, "sdhost-dma");
> +}
> +
> static void allwinner_sdhost_reset(DeviceState *dev)
> {
> AwSdHostState *s = AW_SDHOST(dev);
> @@ -787,6 +803,12 @@ static void allwinner_sdhost_reset(DeviceState *dev)
> s->status_crc = REG_SD_CRC_STA_RST;
> }
>
> +static Property allwinner_sdhost_properties[] = {
> + DEFINE_PROP_LINK("dma", AwSdHostState,
> + dma_mr, TYPE_MEMORY_REGION, MemoryRegion *),
> + DEFINE_PROP_END_OF_LIST(),
> +};
> +
> static void allwinner_sdhost_bus_class_init(ObjectClass *klass, void *data)
> {
> SDBusClass *sbc = SD_BUS_CLASS(klass);
> @@ -798,7 +820,9 @@ static void allwinner_sdhost_class_init(ObjectClass
> *klass, void *data)
> {
> DeviceClass *dc = DEVICE_CLASS(klass);
>
> + device_class_set_props(dc, allwinner_sdhost_properties);
> dc->reset = allwinner_sdhost_reset;
> + dc->realize = allwinner_sdhost_realize;
> dc->vmsd = &vmstate_allwinner_sdhost;
> }
>
>
- [PATCH 0/6] exec/memory: Rework some address and access size limits, Philippe Mathieu-Daudé, 2020/05/31
- [PATCH 1/6] target/s390x/mmu_helper: Use address_space_rw() in place, Philippe Mathieu-Daudé, 2020/05/31
- [PATCH 3/6] hw/sd/allwinner-sdhost: Do DMA accesses via DMA address space, Philippe Mathieu-Daudé, 2020/05/31
- Re: [PATCH 3/6] hw/sd/allwinner-sdhost: Do DMA accesses via DMA address space,
Philippe Mathieu-Daudé <=
- [PATCH 2/6] hw/dma/rc4030: Use DMA address space to do DMA accesses, Philippe Mathieu-Daudé, 2020/05/31
- [PATCH 4/6] exec/cpu-common: Do not restrict CPU to 32-bit memory access maximum, Philippe Mathieu-Daudé, 2020/05/31
- [PATCH 5/6] exec: Restrict 32-bit CPUs to 32-bit address space, Philippe Mathieu-Daudé, 2020/05/31
- [RFC PATCH 6/6] memory: Use CPU register size as default access_size_max, Philippe Mathieu-Daudé, 2020/05/31
- Re: [PATCH 0/6] exec/memory: Rework some address and access size limits, no-reply, 2020/05/31