[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [Xen-devel] Qemu upstream drive question
On Fri, Feb 17, 2012 at 5:42 PM, Ian Campbell <Ian.Campbell@xxxxxxxxxx> wrote: > VOn Thu, 2012-02-16 at 22:52 +0000, Daniel Castro wrote: >> On Thu, Feb 16, 2012 at 8:13 PM, Ian Campbell <Ian.Campbell@xxxxxxxxxx> >> wrote: >> > On Thu, 2012-02-16 at 10:53 +0000, Daniel Castro wrote: >> >> Hello All, >> >> >> >> When a HVM guest is started upstream qemu presents the emulated drives >> >> as PCI devices or ata drives? >> > >> >> If more than drive is present how can I know which drive is which in >> >> xenstore? >> > >> > Emulated devices do not appear in xenstore. >> > >> > Some PV devices may have an emulated equivalent but the rule of thumb is >> > that an OS should only use either PV or Emulated devices and not mix and >> > match. >> > >> > In Linux we implement this by requiring that the emulated devices are >> > unplugged before we will use the PV path. >> > >> > In principal you can infer which Emulated device might matches a PV >> > device, the file docs/misc/vbd-interface.txt in the xen tree gives some >> > hints about this, but basically PV disks 0..3 can correspond to the >> > first four IDE devices (primary-master, primary-slave, secondary-master >> > & secondary-slave). >> > >> > I presume you are asking in the context of SeaBIOS. In that context you >> > could argue against unplugging because the guest OS may want to use >> > emulated devices, however I would suggest that for simplicity for time >> > being you just unplug the emulated devices before you enable the PV >> > path. >> Thanks for the response Ian, I am not sure I understand you. What I do >> is something similar to this: >> Find the emulated devices. > > Why? You don't need these in your Xen code. > > If anything is going to enumerate these devices it will be the existing > SeaBIOS code which drive the emulated devices. There is no need for you > to touch that. > >> ATA Devices are the drives and the PCI device is for what? > > You are referring to the Xen platform device (5853:0001)?. This device > has nothing to do with the emulated disks. > > The platform device just serves as a useful point to hook the Xen driver > loading off since many OSes handle autoloading of PCI drivers well so we > use it to trigger the loading of Xen drivers. > > It has some secondary purposes such as the IRQ associated with this > device can also be used to inject event channels and the unplug protocol > happens via I/O ports on this device. > >> Find if the device is a disk. (in the context of a vbd the xenstore id >> corresponds to what?) > > The meaning of the VBD number (e.g. 832 and 985 in your examples below) > is described by the document I pointed you at in my last mail: > docs/misc/vbd-interface.txt. > >> If disk, then find corresponding entry on xenstore. Example >> device/vbd/832, device/vbd/985 > > You should enumerate (using XS_DIRECTORY) the device/vbd directory. Each > entry you find in there is a disk. There is no need for you to go > anywhere near the emulated disk devices to do this, nor to establish any > correspondence with the emulated devices. You know they are all vbds > because you found them in device/vbd. > > The sequence of events should be: > > * Notice that you are running under Xen and that the platform PCI > device is present. You most likely want to do this by using > pci_find_init_device() to register a callback for the platform > device. If you never get a callback then there is nothing for > you to do and you should assume standard SeaBIOS drivers etc > will take care of the emulated devices. > * Unplug all of the emulated devices per the protocol defined in > docs/misc/hvm-emulated-unplug.markdown. You do not need to > enumerate the emulated devices to do this. If this fails then > abort and assume standard SeaBIOS drivers etc will take care of > the emulated devices. > * Enumerate the contents of device/vbd in xenstore, for each disk: > * parse the disk and partition number per > docs/misc/vbd-interface.txt, > * "Write device details to xenstore -rings, ref, etc" and > do the necessary xenbus state transitions to get into > state 4 (XenBusConnected) > * create and register the appropriate disk device > structures with SeaBIOS. > > In the future once all this is working then there may be extensions such > as not unplugging devices and ensuring the safe coexistence of the > emulated and PV devices but you can leave that to one side for now since > there are other issues with doing that (c.f. previous discussions about > how to safely shutdown the PV devices after SeaBIOS is finished). > > Ian. Thanks a million Ian. Perfectly clear now, I will get on to it then. > > -- +-=====---------------------------+ | +---------------------------------+ | This space intentionally blank for notetaking. | | | Daniel Castro, | | | | Consultant/Programmer.| | | | U Andes | +-------------------------------------+ _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxxxxxxxx http://lists.xensource.com/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |