|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [Xen-devel] [PATCH v10 06/17] Xen: ARM: Add support for mapping platform device mmio
Hi Shannon, Sorry to come late in the review process. On 01/04/2016 16:49, Shannon Zhao wrote: Add a bus_notifier for platform bus device in order to map the device mmio regions when DOM0 booting with ACPI. Signed-off-by: Shannon Zhao <shannon.zhao@xxxxxxxxxx> Acked-by: Stefano Stabellini <stefano.stabellini@xxxxxxxxxxxxx> --- drivers/xen/Makefile | 1 + drivers/xen/arm-device.c | 141 +++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 142 insertions(+) create mode 100644 drivers/xen/arm-device.c diff --git a/drivers/xen/Makefile b/drivers/xen/Makefile index 9b7a35c..415f286 100644 --- a/drivers/xen/Makefile +++ b/drivers/xen/Makefile @@ -9,6 +9,7 @@ CFLAGS_features.o := $(nostackp) CFLAGS_efi.o += -fshort-wchar +dom0-$(CONFIG_ARM64) += arm-device.o dom0-$(CONFIG_PCI) += pci.o dom0-$(CONFIG_USB_SUPPORT) += dbgp.o dom0-$(CONFIG_XEN_ACPI) += acpi.o $(xen-pad-y) diff --git a/drivers/xen/arm-device.c b/drivers/xen/arm-device.c new file mode 100644 index 0000000..76e26e5 --- /dev/null +++ b/drivers/xen/arm-device.c @@ -0,0 +1,141 @@ +/* + * Copyright (c) 2015, Linaro Limited, Shannon Zhao + * + * This program is free software; you can redistribute it and/or modify it + * under the terms and conditions of the GNU General Public License, + * version 2, as published by the Free Software Foundation. + * + * This program is distributed in the hope it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + * more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +#include <linux/platform_device.h> +#include <linux/acpi.h> +#include <xen/xen.h> +#include <xen/page.h> +#include <xen/interface/memory.h> +#include <asm/xen/hypervisor.h> +#include <asm/xen/hypercall.h> + +static int xen_unmap_device_mmio(struct resource *resource, unsigned int count) NITs: There is multiple resource so s/resource/resources/. Also the variable could be const. Ditto I would add a comment to explain that the regions are always mapped 1:1 to DOM0, and this is fine because the memory map for DOM0 is the same as the host (except for the RAM). + gpfns[j] = XEN_PFN_DOWN(r->start) + j; + idxs[j] = XEN_PFN_DOWN(r->start) + j; + } + + xatp.domid = DOMID_SELF; + xatp.size = nr; + xatp.space = XENMAPSPACE_dev_mmio; + + set_xen_guest_handle(xatp.gpfns, gpfns); + set_xen_guest_handle(xatp.idxs, idxs); + set_xen_guest_handle(xatp.errs, errs); + + rc = HYPERVISOR_memory_op(XENMEM_add_to_physmap_range, &xatp); + kfree(gpfns); + kfree(idxs); + kfree(errs); + if (rc) + return rc; Shouldn't we redo the mapping if the hypercall fails? Regards, -- Julien Grall _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxx http://lists.xen.org/xen-devel
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |