qemu-discuss
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-discuss] Add PCI Passthrough for multiple devices on same bus?


From: Andrew Martin
Subject: Re: [Qemu-discuss] Add PCI Passthrough for multiple devices on same bus?
Date: Thu, 12 Sep 2013 16:19:36 -0500 (CDT)

Tony,

Thanks for the information regarding virtualization in general.
Perhaps I didn't elaborate - this is a PCIe serial port card. It
has 4 serial ports on it - no storage. I would like to a serial
terminal emulator on the VM to be able to access these serial ports. 

02:00.0 Serial controller: MosChip Semiconductor Technology Ltd. 4-Port PCIe 
Serial Adapter
02:00.1 Serial controller: MosChip Semiconductor Technology Ltd. 4-Port PCIe 
Serial Adapter
02:00.2 Serial controller: MosChip Semiconductor Technology Ltd. 4-Port PCIe 
Serial Adapter
02:00.3 Serial controller: MosChip Semiconductor Technology Ltd. 4-Port PCIe 
Serial Adapter

How can I give the VM access to these serial ports, either by
PCI pass-through or by virtualizing them in the host somehow?

Thanks,

Andrew

----- Original Message -----
> From: "Tony Su" <address@hidden>
> To: "Andrew Martin" <address@hidden>
> Cc: "qemu_mail" <address@hidden>
> Sent: Wednesday, September 11, 2013 9:32:33 AM
> Subject: Re: [Qemu-discuss] Add PCI Passthrough for multiple devices on same 
> bus?
> 
> OK,
> Some fundamentals...
> 
> There are many benefits whenever you virtualize, and ideally you
> should try to virtualize as much of the whole solution as possible. I
> won't try to itemize all benefits but just the fact you're running
> QEMU must mean you understand at least some of the benefits.
> 
> There are three main areas of virtualization starting with CPU/RAM
> and
> early virtualization assumed virtualizing these in some way would
> always exist and was always part of even first generation
> virtualization. Later, I/O virtualization was and is still being
> introduced. And lastly, storage has always been recommended to be
> implemented virtualized, usually as a backing file (mounted possibly
> as a loop device). Virtualized storage has been around almost since
> the beginning and has been recommended so as to ensure isolation,
> avoid contention and remove the issues involved accessing the Host
> file system directly.
> 
> So, to be more clear and describing in relation to your situation,
> these issues you have about exposing PCI pass-through  to the VM
> should be unnecessary. As long as connectivity exists for the Host,
> then the virtualization technology running on the Host (QEMU in your
> case) should be able to manage virtual storage, and provide a
> configured storage (typically a backing file aka virtual disk file)
> to
> the Guest VM. The Guest VM never has to access the hardware directly,
> it only sees the virtualized fs provided by the Host which <does>
> know
> how to access the storage using whatever driver is necessary.
> 
> I wouldn't know how to analyze much less troubleshoot your PCI
> pass-through without closer inspection but as I described shouldn't
> be
> necessary unless you have a special need.
> 
> HTH,
> TSU
> 
> On Tue, Sep 10, 2013 at 12:05 PM, Andrew Martin <address@hidden>
> wrote:
> > Tony,
> >
> > I am using virt-manager, but also receive this same error when
> > attempting
> > to add a second serial port through the GUI. I believe the issue is
> > that
> > all 4 of the serial ports on this card appear on the same bus. Is
> > there a
> > way to add more than one device that is on the same bus to the VM?
> >
> > I am not familiar with the "virtual storage" method that you
> > mention. Can
> > this be used with non-storage devices, such as a serial card? Do
> > you have
> > any documentation on this feature?
> >
> > Thanks,
> >
> > Andrew
> >
> > ----- Original Message -----
> >> From: "Tony Su" <address@hidden>
> >> To: "Andrew Martin" <address@hidden>
> >> Cc: "qemu_mail" <address@hidden>
> >> Sent: Sunday, September 8, 2013 6:42:14 PM
> >> Subject: Re: [Qemu-discuss] Add PCI Passthrough for multiple
> >> devices on same bus?
> >>
> >> Since you're using virsh commands, have you also considered just
> >> running vm manager if you're running a graphical environment? It's
> >> pretty straightforward when you use vm manager if there isn't a
> >> conflict of some sort...
> >>
> >> Also, just wondering if you really need to access the hardware
> >> directly, it's more typical to let the Host access the hardware
> >> directly and create virtual storage on the hardware for VM use
> >> instead. If you don't have a specific need, there are many
> >> benefits
> >> doing it the more usual virtualized storage way.
> >>
> >> Tony
> >>
> >> On Thu, Sep 5, 2013 at 3:15 PM, Andrew Martin
> >> <address@hidden>
> >> wrote:
> >> > Hello,
> >> >
> >> > I have a 4-port PCIe serial card that I would like to pass
> >> > through
> >> > to a VM. The serial card has 4 serial ports on it, and I would
> >> > like to pass all 4 ports through. Here are the ports, as seen on
> >> > the host:
> >> > # lspci
> >> > 02:00.0 Serial controller: MosChip Semiconductor Technology Ltd.
> >> > 4-Port PCIe Serial Adapter
> >> > 02:00.1 Serial controller: MosChip Semiconductor Technology Ltd.
> >> > 4-Port PCIe Serial Adapter
> >> > 02:00.2 Serial controller: MosChip Semiconductor Technology Ltd.
> >> > 4-Port PCIe Serial Adapter
> >> > 02:00.3 Serial controller: MosChip Semiconductor Technology Ltd.
> >> > 4-Port PCIe Serial Adapter
> >> >
> >> > # virsh nodedev-list
> >> > pci_0000_02_00_0
> >> > pci_0000_02_00_1
> >> > pci_0000_02_00_2
> >> > pci_0000_02_00_3
> >> >
> >> > I have configured the first port, 02:00.0 , in my VM
> >> > configuration
> >> > file as follows:
> >> > <hostdev mode='subsystem' type='pci' managed='yes'>
> >> >       <source>
> >> >         <address domain='0x0000' bus='0x02' slot='0x00'
> >> >         function='0x0'/>
> >> >       </source>
> >> >       <address type='pci' domain='0x0000' bus='0x00' slot='0x05'
> >> >       function='0x0'/>
> >> > </hostdev>
> >> >
> >> > If I attempt to start the VM, I get the following error:
> >> > error: internal error Unable to reset PCI device 0000:02:00.1:
> >> > internal error Active 0000:02:00.0 devices on bus with
> >> > 0000:02:00.1, not doing bus reset
> >> >
> >> > Running the following commands to detach the other 3 ports then
> >> > allows me to successfully start the VM, and I can see the serial
> >> > port in it:
> >> > # virsh nodedev-detach pci_0000_02_00_1
> >> > # virsh nodedev-detach pci_0000_02_00_2
> >> > # virsh nodedev-detach pci_0000_02_00_3
> >> >
> >> > However, when I attempt to add more than 1 of the ports to the
> >> > VM
> >> > config, I keep getting this error:
> >> > error: internal error Unable to reset PCI device 0000:02:00.1:
> >> > internal error Active 0000:02:00.0 devices on bus with
> >> > 0000:02:00.1, not doing bus reset
> >> >
> >> > The second port I added (0000:02:00.1) is configured as follows
> >> > in
> >> > the VM config:
> >> >     <hostdev mode='subsystem' type='pci' managed='yes'>
> >> >       <source>
> >> >         <address domain='0x0000' bus='0x02' slot='0x00'
> >> >         function='0x1'/>
> >> >       </source>
> >> >       <address type='pci' domain='0x0000' bus='0x00' slot='0x06'
> >> >       function='0x0'/>
> >> >     </hostdev>
> >> >
> >> > How can I add all 4 of these devices (which share the same bus)
> >> > as
> >> > PCI passthrough to the VM?
> >> >
> >> > Thanks,
> >> >
> >> > Andrew
> >> >
> >>
> 



reply via email to

[Prev in Thread] Current Thread [Next in Thread]