aboutsummaryrefslogtreecommitdiffstats
path: root/extras/mini-os/pcifront.c
Commit message (Collapse)AuthorAgeFilesLines
* mini-os: fix various memory leaks in pcifrontMatthew Daley2013-09-211-10/+19
| | | | | | Coverity-ID: 1055834-1055840 Signed-off-by: Matthew Daley <mattjd@gmail.com> Acked-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
* minios: fix xenbus_rm() calls in frontend driversBen Cressey2013-09-101-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The commit "minios: refactor xenbus state machine" caused "/state" to be appended to the local value of nodename. Previously the nodename variable pointed to dev->nodename. The xenbus_rm() calls were not updated to reflect this change, and refer to paths that do not exist. For example, shutdown_blkfront() for vbd 2049 would issue these calls: xenbus_rm(XBT_NIL, "device/vbd/2049/state/ring-ref"); xenbus_rm(XBT_NIL, "device/vbd/2049/state/event-channel"); This patch restores the previous behavior, issuing these calls instead: xenbus_rm(XBT_NIL, "device/vbd/2049/ring-ref"); xenbus_rm(XBT_NIL, "device/vbd/2049/event-channel"); This causes frontend drivers to not be properly reset when PV-GRUB exists. Some PV Linux drivers fail to re-initialize frontend devices if PV-GRUB leaves them in this state. Signed-off-by: Ben Cressey <bcressey@amazon.com> Reviewed-by: Matt Wilson <msw@amazon.com> Cc: Stefano Stabellini <stefano.stabellini@eu.citrix.com> Acked-by: Samuel Thibault <samuel.thibault@ens-lyon.org> [msw: adjusted commit message to include consequences, split out changes into separate patches] Signed-off-by: Matt Wilson <msw@amazon.com>
* minios: clean up unneeded "err = NULL" in frontend driversBen Cressey2013-09-101-1/+0
| | | | | | | | | | | | | | | This patch removes cases where the error message pointer is already NULL and is then set to NULL. These are harmless, but suggest incorrect practice: the pointer should be passed to free() to deallocate memory prior to reassignment. There are no functional changes in this patch. Signed-off-by: Ben Cressey <bcressey@amazon.com> Reviewed-by: Matt Wilson <msw@amazon.com> Cc: Stefano Stabellini <stefano.stabellini@eu.citrix.com> Acked-by: Samuel Thibault <samuel.thibault@ens-lyon.org> [msw: split a larger patch from Ben into this cleanup patch] Signed-off-by: Matt Wilson <msw@amazon.com>
* minios: clean up allocation of char arrays used for xenbus pathsMatt Wilson2013-09-101-4/+4
| | | | | | | | | | This patch cleans up instances of char array allocation where string lengths were manually counted to use strlen() instead. There are no functional changes in this patch. Signed-off-by: Matt Wilson <msw@amazon.com> Cc: Stefano Stabellini <stefano.stabellini@eu.citrix.com> Acked-By: Samuel Thibault <samuel.thibault@ens-lyon.org>
* minios: correct char array allocation for xenbus pathsMatt Wilson2013-09-101-2/+5
| | | | | | | | | | | | | | | | | | | The char arrays used to hold xenbus paths have historically been allocated by manually counting the length longest string constants included in constructing the path. This has led to improperly sized buffers, both too large (with little consequence) and too small (which obviously causes problems). This patch corrects the instances where the length was incorrectly calculated by using strlen() on the longest string constant used in building a xenbus path. A follow-on clean-up patch will change all instances to use strlen(). Signed-off-by: Ben Cressey <bcressey@amazon.com> Cc: Stefano Stabellini <stefano.stabellini@eu.citrix.com> Acked-By: Samuel Thibault <samuel.thibault@ens-lyon.org> [msw: split this patch from a larger patch from Ben, reworked to use strlen()] Signed-off-by: Matt Wilson <msw@amazon.com>
* mini-os: stop compiler complaint about unused variablesJohn McDermott2012-02-091-0/+1
| | | | | | | | | gcc (GCC) 4.6.2 20111027 (Red Hat 4.6.2-1) complains about unused variables in mini-os drivers Signed-off-by: John McDermott <john.mcdermott@nrl.navy.mil> Acked-by: Ian Jackson <ian.jackson@eu.citrix.com> Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
* mini-os: do not wait for pci backend in pcifront_scanIan Campbell2011-12-091-12/+3
| | | | | | | | | | | | | | | | | | | | | | | | | This blocks the main thread indefinitely if there is no PCI backend present in xenstore. Even in the case where there are passthrough devices configured libxl creates the stubdom and waits for it to startup _before_ adding the backend. Since the stub domains main thread is blocked before it can write the "running" state to xenstore the toolstack eventually times out and kills everything. There is already a separate pcifront thread which waits for the backend to appear and calls init_pcifront at the appropriate time should a backend ever appear. Unfortunately I don't have any free test boxes with VT-d so I haven't been able to test the cases where PCI deivces are passed through but I obviously have tested that I can now start an HVM domain with stub qemu without PCI devices passed through which I couldn't do before so this is an improvement. This stuff is a bit like pushing the lump around the carpet :-/ Signed-off-by: Ian Campbell <ian.campbell@citrix.com> Acked-by: Ian Jackson <ian.jackson.citrix.com> Committed-by: Ian Jackson <ian.jackson.citrix.com> Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
* mini-os: Revert 21106:b20f897d6010 "Fix xenbus initialisation"Keir Fraser2010-05-041-6/+5
| | | | | | Jeremy Fitzhardinge (jeremy@goop.org) reports that this fixes HVM+stubdom. Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
* mini-os: Fix crash on frontend shutdown failuresKeir Fraser2010-04-071-1/+2
| | | | | | | Do not free frontend resources if some error happened, since the backend may not have finished properly restarting in such case. Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
* mini-os: Fix frontend shutdown wait loopKeir Fraser2010-04-071-1/+1
| | | | | | | minios frontends must wait for backends to be shut down and reinitialized before freeing resources. Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
* mini-os: Fix xenbus initialisationKeir Fraser2010-04-061-5/+6
| | | | | | | | | This fixes xenbus initialization of blkfront, netfront and pcifront by uniformizing with fbfront: after writing parameters, set state to initialised, then wait for backend to switch to connect state, and then only read its parameter and switch to the connect state. Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
* minios: Trivial spelling typo fixed.4.0.0-branchedKeir Fraser2010-03-301-1/+1
| | | | Sigend-off-by: Keir Fraser <keir.fraser@citrix.com>
* mini-os: Fix memory leaks in blkfront, netfront, pcifront, etc.Keir Fraser2009-12-141-3/+11
| | | | | | | | | The return value of Xenbus routines xenbus_transaction_start(), xenbus_printf(), xenbus_transaction_end(), etc. is a pointer of error message. This pointer should be passed to free() to release the allocated memory when it is no longer needed. Signed-off-by: Yu Zhiguo <yuzg@cn.fujitsu.com>
* minios: Fix xenbus_unwatch_path callsKeir Fraser2009-11-231-3/+3
| | | | | | | | | | In a lot of places in MiniOS frontends, xenbus_watch_path_token is used instead of xenbus_watch_path to get more precise wake ups. To free those, xenbus_unwatch_path_token has to be used instead of xenbus_unwatch_path, else the unwatch operation will fail. This fixes spurious watch events left by pv-grub. Signed-Off-By: Samuel Thibault <samuel.thibault@ens-lyon.org>
* pcifront: fix multiple initialization bugKeir Fraser2009-11-231-5/+14
| | | | | | | | | Now that we have pcifront_watches to dynamically initialize pcifront we don't need a call to init_pcifront in pcilib and pcifront_scan anymore; we should just wait for the frontend to connect to the backend instead. Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
* pcifront: implement dynamic connections and disconnectionsKeir Fraser2009-11-131-7/+127
| | | | | | | | | | this patch implements dynamic connections and disconnections in pcifront. This feature is required to properly support pci hotplug, because when no pci devices are assigned to a guest, xend will remove the pci backend altogether. Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
* minios pcifront: translate physical into virtual addressesKeir Fraser2009-10-141-2/+63
| | | | | | | | Qemu understands physical pci addresses while pciback expects virtual pci addresses: this patch adds a translation function in pcifront to make the conversion. Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
* stubdom/minios: re-structure headersKeir Fraser2009-10-011-7/+9
| | | | | | | | | As part of making stubdom usable on NetBSD, it is necessary to restructure the minios headers to avoid conflicts with NetBSD's crossbuild toolchain. Signed-off-by: Christoph Egger <Christoph.Egger@amd.com> Acked-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
* minios: refactor xenbus state machineKeir Fraser2009-06-031-15/+56
| | | | | | | | Implement xenbus_wait_for_state_change and xenbus_switch_state and change the various frontends to use the two functions and do proper error checking. Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
* mini-os: make init_pcifront fail early if there is no backendKeir Fraser2008-07-311-2/+9
| | | | | | Else, we would leave entries in xenstore, which disturbs xend. Signed-off-by: Samuel Thibault <samuel.thibault@eu.citrix.com>
* stubdom: Fixes for gcc 4.2.4 32bitKeir Fraser2008-07-101-2/+2
| | | | Signed-off-by: Samuel Thibault <samuel.thibault@eu.citrix.com>
* stubdom: use host's gccKeir Fraser2008-07-041-4/+2
| | | | | | | | This makes stubdom use the host's gcc instead of downloading/compiling binutils+gcc. That requires a bunch of changes and even uncovered a few bugs, but saves a lot of time. Signed-off-by: Samuel Thibault <samuel.thibault@eu.citrix.com>
* minios: PIRQ and MSI/MSI-X supportKeir Fraser2008-07-021-0/+88
| | | | Signed-off-by: Samuel Thibault <samuel.thibault@eu.citrix.com>
* stubdom: PCI passthrough support via PV-PCIKeir Fraser2008-07-021-0/+278
Signed-off-by: Samuel Thibault <samuel.thibault@eu.citrix.com>