Commit Graph

25 Commits

Author SHA1 Message Date
bouyer
c24c993fe4 Merge the bouyer-xenpvh branch, bringing in Xen PV drivers support under HVM
guests in GENERIC.
Xen support can be disabled at runtime with
boot -c
disable hypervisor
2020-04-25 15:26:16 +00:00
jdolecek
718f3cb496 put xenbus dmat into xenbus_device so it's available also for backend
devices which don't use autoconfig, remove from attach args
2020-04-11 11:01:12 +00:00
jdolecek
010da6cff2 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
2020-04-10 14:54:33 +00:00
jdolecek
79743bc4f3 add wrapper to free response from xenbus_dev_request_and_reply(), so
that call in xenbus_dev_write() wouldn't need to know how it's allocated
2020-04-07 16:10:48 +00:00
jdolecek
125dad3d64 add a small wrapper xenbus_directory_free() to free result of
xenbus_directory(), so that caller doesn't need to be aware how the memory
was allocated
2020-04-07 15:59:57 +00:00
jdolecek
43fc8b6fb5 partially convert to kmem_alloc()
plug memory leak in one xenbus_probe_device_type() error path
when read_backend_details() fails
2020-04-07 15:40:14 +00:00
jdolecek
418f6d13ac convert the node watch code to use kmem_alloc() instead of malloc() 2020-04-07 14:07:01 +00:00
jdolecek
786f885750 make xenbus_watch_path() static, it's not used outside xenbus_client.c 2020-04-07 13:38:50 +00:00
jdolecek
08090ccf7a revert the watch.node change, xenbus_watch_path() and xenbus_watch_path2()
need to use non-constant path
2020-04-07 13:36:22 +00:00
jdolecek
782d82899b change xenbus_read() interface so that caller supplies the buffer and it's
size, caller doesn't free(9) the returned value any more
2020-04-07 11:47:05 +00:00
jdolecek
b07f99d6d8 no need to malloc()+copy watch.node, it's constant string - either "device"
or "backend"; just use the strings direct
2020-04-07 09:18:00 +00:00
cherry
ac8432e2db Switch NetBSD/xen to use XEN api tag RELEASE-4.11.1
The headers for this api are in sys/external/mit/xen-include-public/dist/
2019-02-02 12:32:54 +00:00
cegger
908dafc263 switch from xen3-public to xen-public. 2011-12-07 15:47:41 +00:00
jym
eba16022d3 Merge jym-xensuspend branch in -current. ok bouyer@.
Goal: save/restore support in NetBSD domUs, for i386, i386 PAE and amd64.

Executive summary:
- split all Xen drivers (xenbus(4), grant tables, xbd(4), xennet(4))
in two parts: suspend and resume, and hook them to pmf(9).
- modify pmap so that Xen hypervisor does not cry out loud in case
it finds "unexpected" recursive memory mappings
- provide a sysctl(7), machdep.xen.suspend, to command suspend from
userland via powerd(8). Note: a suspend can only be handled correctly
when dom0 requested it, so provide a mechanism that will prevent
kernel to blindly validate user's commands

The code is still in experimental state, use at your own risk: restore
can corrupt backend communications rings; this can completely thrash
dom0 as it will loop at a high interrupt level trying to honor
all domU requests.

XXX PAE suspend does not work in amd64 currently, due to (yet again!)
page validation issues with hypervisor. Will fix.

XXX secondary CPUs are not suspended, I will write the handlers
in sync with cherry's Xen MP work.

Tested under i386 and amd64, bear in mind ring corruption though.

No build break expected, GENERICs and XEN* kernels should be fine.
./build.sh distribution still running. In any case: sorry if it does
break for you, contact me directly for reports.
2011-09-20 00:12:23 +00:00
cegger
e91b443503 make this header standalone 2008-10-29 13:35:35 +00:00
jym
4f26afe701 - rename init_events() to events_init(), to better reflect netbsd semantics
- change unbind_[pv]irq_from_evtch() so that they now return the event
channel the [PV]IRQ was bound to. It reflects the opposite behaviour of the
bind_[pv]irq_to_evtch() functions.

- remove xenbus_suspend() and xenbus_resume() prototypes, as they are not
used anywhere else, and will conflict with the xenbus pmf(9) handlers.

- make start_info aligned on a page boundary, as Xen expects it to be so.

- mask event channel during xbd detach before removing its handler (can
avoid spurious events).

- add the "protocol" entry in xenstore during xbd initialization. Normally
created during domU's boot by xentools, it is under domU's responsibility
in all other cases (save/restore, hot plugging, etc.).

- modifications to xs_init(), so that it can properly return an error.

Reviewed by Christoph (cegger@).
2008-10-24 21:09:24 +00:00
cegger
af33bdeef3 device_t / softc split
reviewed, tested and approved by bouyer
2008-04-16 18:41:48 +00:00
ichiro
f742db2180 make compile
- add xenbus_read_ull prototype into include/xenbus.h
2008-03-14 02:17:15 +00:00
bouyer
4e54134323 Pull up the bouyer-xenamd64 branch to HEAD. This brings in amd64 support
to NetBSD/Xen, both Dom0 and DomU.
2007-11-22 16:16:40 +00:00
bouyer
2613e19eec Add a 'base' argument to xenbus_read_ul, so that we can read number is base
other than 10.
2006-06-25 16:46:59 +00:00
bouyer
237137c875 Add needed framework for backend drivers.
As we want some control on the name the backend driver will have we
can't use autoconf(9) here. Instead backend drivers registers to
xenbus, which will call a create callback when a new device is there.
Backend devices won't have a "struct device" in xenbus, use a void pointer
instead.
2006-05-23 21:07:56 +00:00
bouyer
0c9571be10 Properly handle dynamic attach/detach of device:
- keep a linked list of xenbus_device in the xenbus_infrastructure, and
  keep a pointer to struct device for each xenbus_device
- xenbus_probe_device_type(): check that the device is not already attached
- when we get a frontend_changed callback, call xenbus_probe_device_type()
- When a device changes to state XenbusStateClosed, config_detach() it
  and free the structures.
While there, move xbusd_path[] to the end of struct xenbus_device, and
allocate only the space needed to store the path. Garbage-collect
struct xenbus_driver, it's not needed.
2006-03-26 22:02:57 +00:00
bouyer
14e4157f2e Add a xenbus_read_ul() which reads a node and convert it to unsigned long.
Make xenbus_switch_state() and xenbus_read_driver_state() do something usefull.
2006-03-16 23:08:08 +00:00
bouyer
aceceafca7 Implement watch of xenstore nodes, and install watches for otherend'state
node.
2006-03-15 22:20:06 +00:00
bouyer
636656c40d Xenbus public functions 2006-03-06 20:29:52 +00:00