Module Name: src Committed By: jdolecek Date: Fri Apr 10 14:54:34 UTC 2020
Modified Files: src/sys/arch/xen/include: xenbus.h src/sys/arch/xen/x86: xen_bus_dma.c src/sys/arch/xen/xen: hypervisor.c src/sys/arch/xen/xenbus: xenbus_probe.c Log Message: add and pass dma tag to PV drivers attached to xenbus, so thay can use bus_dmamap_load_mbuf() et.al. due to XENPV override, _BUS_BUS_TO_PHYS() dmamap segment ds_addr gets filled with ma, so value can be directly used for e.g. grant calls To generate a diff of this commit: cvs rdiff -u -r1.22 -r1.23 src/sys/arch/xen/include/xenbus.h cvs rdiff -u -r1.29 -r1.30 src/sys/arch/xen/x86/xen_bus_dma.c cvs rdiff -u -r1.73 -r1.74 src/sys/arch/xen/xen/hypervisor.c cvs rdiff -u -r1.47 -r1.48 src/sys/arch/xen/xenbus/xenbus_probe.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/sys/arch/xen/include/xenbus.h diff -u src/sys/arch/xen/include/xenbus.h:1.22 src/sys/arch/xen/include/xenbus.h:1.23 --- src/sys/arch/xen/include/xenbus.h:1.22 Tue Apr 7 16:10:48 2020 +++ src/sys/arch/xen/include/xenbus.h Fri Apr 10 14:54:34 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: xenbus.h,v 1.22 2020/04/07 16:10:48 jdolecek Exp $ */ +/* $NetBSD: xenbus.h,v 1.23 2020/04/10 14:54:34 jdolecek Exp $ */ /****************************************************************************** * xenbus.h * @@ -33,6 +33,7 @@ #define _ASM_XEN_XENBUS_H #include <sys/device.h> +#include <sys/bus.h> #include <sys/queue.h> #include <xen/include/public/xen.h> #include <xen/include/public/io/xenbus.h> @@ -43,6 +44,7 @@ struct xenbus_attach_args { const char *xa_device; int xa_handle; + bus_dma_tag_t xa_dmat; }; /* devices to xenbus attach */ @@ -50,6 +52,7 @@ struct xenbusdev_attach_args { const char *xa_type; int xa_id; struct xenbus_device *xa_xbusd; + bus_dma_tag_t xa_dmat; }; /* Register callback to watch this node. */ Index: src/sys/arch/xen/x86/xen_bus_dma.c diff -u src/sys/arch/xen/x86/xen_bus_dma.c:1.29 src/sys/arch/xen/x86/xen_bus_dma.c:1.30 --- src/sys/arch/xen/x86/xen_bus_dma.c:1.29 Thu Apr 9 19:26:37 2020 +++ src/sys/arch/xen/x86/xen_bus_dma.c Fri Apr 10 14:54:33 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: xen_bus_dma.c,v 1.29 2020/04/09 19:26:37 jdolecek Exp $ */ +/* $NetBSD: xen_bus_dma.c,v 1.30 2020/04/10 14:54:33 jdolecek Exp $ */ /* NetBSD bus_dma.c,v 1.21 2005/04/16 07:53:35 yamt Exp */ /*- @@ -32,7 +32,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: xen_bus_dma.c,v 1.29 2020/04/09 19:26:37 jdolecek Exp $"); +__KERNEL_RCSID(0, "$NetBSD: xen_bus_dma.c,v 1.30 2020/04/10 14:54:33 jdolecek Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -47,6 +47,15 @@ __KERNEL_RCSID(0, "$NetBSD: xen_bus_dma. extern paddr_t avail_end; +/* No special needs */ +struct x86_bus_dma_tag xenbus_bus_dma_tag = { + ._tag_needs_free = 0, + ._bounce_thresh = 0, + ._bounce_alloc_lo = 0, + ._bounce_alloc_hi = 0, + ._may_bounce = NULL, +}; + /* Pure 2^n version of get_order */ static inline int get_order(unsigned long size) { Index: src/sys/arch/xen/xen/hypervisor.c diff -u src/sys/arch/xen/xen/hypervisor.c:1.73 src/sys/arch/xen/xen/hypervisor.c:1.74 --- src/sys/arch/xen/xen/hypervisor.c:1.73 Tue Apr 7 08:14:42 2020 +++ src/sys/arch/xen/xen/hypervisor.c Fri Apr 10 14:54:33 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: hypervisor.c,v 1.73 2020/04/07 08:14:42 jdolecek Exp $ */ +/* $NetBSD: hypervisor.c,v 1.74 2020/04/10 14:54:33 jdolecek Exp $ */ /* * Copyright (c) 2005 Manuel Bouyer. @@ -53,7 +53,7 @@ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: hypervisor.c,v 1.73 2020/04/07 08:14:42 jdolecek Exp $"); +__KERNEL_RCSID(0, "$NetBSD: hypervisor.c,v 1.74 2020/04/10 14:54:33 jdolecek Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -415,7 +415,7 @@ hypervisor_match(device_t parent, cfdata bi.common.len = sizeof(struct btinfo_rootdevice); /* From i386/multiboot.c */ - /* $NetBSD: hypervisor.c,v 1.73 2020/04/07 08:14:42 jdolecek Exp $ */ + /* $NetBSD: hypervisor.c,v 1.74 2020/04/10 14:54:33 jdolecek Exp $ */ int i, len; vaddr_t data; extern struct bootinfo bootinfo; @@ -545,8 +545,10 @@ hypervisor_attach(device_t parent, devic #endif /* MULTIPROCESSOR */ #if NXENBUS > 0 + extern struct x86_bus_dma_tag xenbus_bus_dma_tag; memset(&hac, 0, sizeof(hac)); hac.hac_xenbus.xa_device = "xenbus"; + hac.hac_xenbus.xa_dmat = &xenbus_bus_dma_tag; config_found_ia(self, "xendevbus", &hac.hac_xenbus, hypervisor_print); #endif #if NXENCONS > 0 Index: src/sys/arch/xen/xenbus/xenbus_probe.c diff -u src/sys/arch/xen/xenbus/xenbus_probe.c:1.47 src/sys/arch/xen/xenbus/xenbus_probe.c:1.48 --- src/sys/arch/xen/xenbus/xenbus_probe.c:1.47 Fri Apr 10 12:38:40 2020 +++ src/sys/arch/xen/xenbus/xenbus_probe.c Fri Apr 10 14:54:33 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: xenbus_probe.c,v 1.47 2020/04/10 12:38:40 jdolecek Exp $ */ +/* $NetBSD: xenbus_probe.c,v 1.48 2020/04/10 14:54:33 jdolecek Exp $ */ /****************************************************************************** * Talks to Xen Store to figure out what devices we have. * @@ -29,7 +29,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: xenbus_probe.c,v 1.47 2020/04/10 12:38:40 jdolecek Exp $"); +__KERNEL_RCSID(0, "$NetBSD: xenbus_probe.c,v 1.48 2020/04/10 14:54:33 jdolecek Exp $"); #if 0 #define DPRINTK(fmt, args...) \ @@ -81,6 +81,7 @@ CFATTACH_DECL_NEW(xenbus, 0, xenbus_matc NULL, NULL); device_t xenbus_dev; +bus_dma_tag_t xenbus_dmat; SLIST_HEAD(, xenbus_device) xenbus_device_list; SLIST_HEAD(, xenbus_backend_driver) xenbus_backend_driver_list = @@ -99,10 +100,12 @@ xenbus_match(device_t parent, cfdata_t m static void xenbus_attach(device_t parent, device_t self, void *aux) { + struct xenbus_attach_args *xa = (struct xenbus_attach_args *)aux; int err; aprint_normal(": Xen Virtual Bus Interface\n"); xenbus_dev = self; + xenbus_dmat = xa->xa_dmat; config_pending_incr(self); err = kthread_create(PRI_NONE, 0, NULL, xenbus_probe_init, NULL, @@ -424,6 +427,7 @@ xenbus_probe_device_type(const char *pat } } else { xbusd->xbusd_type = XENBUS_FRONTEND_DEVICE; + xa.xa_dmat = xenbus_dmat; xa.xa_xbusd = xbusd; xa.xa_type = type; xa.xa_id = strtoul(dir[i], &ep, 0);