qemu-devel
[Top][All Lists]
Advanced

[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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]