From mboxrd@z Thu Jan 1 00:00:00 1970 From: =?GB2312?B?09q80bj7?= Subject: How to switch VGA passthrough live Date: Fri, 4 Jun 2010 17:29:43 +0800 Message-ID: Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============1963217599==" Return-path: List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: yuri.schaeffer@os3.nl, allen.m.kay@intel.com Cc: xen-devel@lists.xensource.com List-Id: xen-devel@lists.xenproject.org --===============1963217599== Content-Type: multipart/alternative; boundary=000e0cd6d02293a26c048830f6f6 --000e0cd6d02293a26c048830f6f6 Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: quoted-printable Hi, I want to switch video card live between two HVMs. My simplest idea is that when the HVM has the permission to access passthrough video card, and another HVM will be paused. If switch from A to B, execute commands : xm pause A ; xm pci-detach A 00:00:02.0 ; xm pci-attach B 00:00:02.0 ; xm unpause B. I have a try, but failed. The pseudo-code is as below. Can you give me some ideas? Any suggestions will be thankful. Execute =93xm pci-detach Domain 00:00:02.0=94: 1. Raise sci interrupt to unplug the device. If OSPM doesn=92t handle the unplug process, and then invoke acpi_php_writeb to power off the device= . 2. Modify power_off_php_devfn function: int power_off_php_devfn(int php_devfn) { If(php_devfn =3D=3D 0x10) // Intel integrated graphics { p =3D & dpci_infos.php_devs[php_devfn]; // save the two-tuples : (php_dev, domid) save_php_device_by_domid(p,domid); // hide the device from bus and dpci_infos pci_hide_device(& p->pt_dev->dev); memset(p,0x00,sizeof(struct php_dev)); return 0; } return unregister_real_device(php_devfn); } Execute =93xm pci-attach Domain 00:00:02.0=94: 1. Modify power_on_php_devfn function: int power_off_php_devfn(int devfn) { =85. while(devfn =3D=3D 0x10) // Intel integrated graphics { if( ! get_php_device_by_domid(p,domid) ) // get saved php_dev struct break; // cannot get , create new one //restore the php device to bus and dpci_infos restore_php_device(p,devfn); // restore dpci_infos.php_devs[devfn] dpci_infos->e_bus->devices[devfn] =3D p-> pt_dev->dev; return 0; } if (!dpci_infos.pci_access) {=85} pt_dev =3D register_real_device(..); return 0; } This plan hides the VGA device from HVM and never destroys it. Both mmio an= d pio maps are reserved. When finishing =93xm unpause B=94, it seems working = well observed by Dom0 serial port login. But the screen is black and cannot receive any signal. I am confusing. Video BIOS should be reloaded? Or need raise some interrupt to flush screen? Thanks & Regards, Yujiageng --000e0cd6d02293a26c048830f6f6 Content-Type: text/html; charset=GB2312 Content-Transfer-Encoding: quoted-printable

Hi,

 

I want to switc= h video card live between two HVMs. My simplest idea is that when the HVM h= as the permission to access passthrough video card, and another HVM wi= ll be paused. If switch from A to B, execute commands :

 <= /p>

xm pause A ;

xm pci-detach A=   00:00:02.0 ;

xm pci-attach B= 00:00:02.0 ;

xm unpause B.

 

I have a try, b= ut failed. The pseudo-code is as below. Can you give me some ideas? Any sug= gestions will be thankful.

<= font size=3D"3" face=3D"Calibri"> 

<= font size=3D"3" face=3D"Calibri">Execute “xm pci-detach Domain 00:00:= 02.0”:

1.<= /font>   = ;    Raise sci interrupt to unplug the device. If OSPM does= n’t handle the unplug process, and then invoke acpi_php_writeb to pow= er off the device.

2.<= /font>   = ;    Modify power_off_php_devfn function:

int power_off_php_= devfn(int php_devfn)

{

         = ;           If(php= _devfn =3D=3D 0x10)  // Intel integrated graphics=

         = ;           {

         = ;            &n= bsp;       p =3D & dpci_infos.php_= devs[php_devfn];

 

      = ; // save the two-tuples : (php_dev, domid)

       save= _php_device_by_domid(p,domid);

<= span style=3D"mso-tab-count: 2"> &nb= sp;            =     

      = // hide the device from bus and dpci_infos

         = ;            &n= bsp;       pci_hide_device(& p->= ;pt_dev->dev);

         = ;            &n= bsp;       memset(p,0x00,sizeof(struct= php_dev));

 

         = ;            &n= bsp;       return 0;

         = ;           }

    return unregister_real_device(php_devfn= );

}

<= font size=3D"3" face=3D"Calibri"> 

<= font size=3D"3" face=3D"Calibri">Execute “xm pci-attach Domain 00:00:= 02.0”:

1.<= /font>   = ;    Modify power_on_php_devfn function:

int power_off_php_devfn(int devfn)

{

   &nbs= p;       ….

   &nbs= p;       while(devfn =3D=3D 0x10) // I= ntel integrated graphics

   &nbs= p;       {

   &nbs= p;            &= nbsp;   if( ! get_php_device_by_domid(p,domid) ) // get sa= ved php_dev struct

   &nbs= p;            &= nbsp;            break;           = ;            &n= bsp;            = ; // cannot get , create new one

 

   &nbs= p;            &= nbsp;   //restore the php device to bus and dpci_infos

   &nbs= p;            &= nbsp;   restore_php_device(p,devfn);   &nbs= p;     // restore dpci_infos.php_devs[devfn]

   &nbs= p;            &= nbsp;   dpci_infos->e_bus->devices[devfn] =3D p->= pt_dev->dev;

 

   &nbs= p;            &= nbsp;   return 0;

   &nbs= p;       }

 

   &nbs= p;       if (!dpci_infos.pci_access)

   &nbs= p;       {…}

           pt_dev = =3D register_real_device(..);

  return 0;

}

<= font size=3D"3" face=3D"Calibri"> 

This plan hides the VGA= device from HVM and never destroys it. Both mmio and pio maps are reserved= . When finishing “xm unpause B”, it seems working well obs= erved by Dom0 serial port login. But the screen is black and cannot receive= any signal. I am confusing. Video BIOS should be reloaded? Or need raise s= ome interrupt to flush screen?

 

 

Thanks & Regards,
Yuji= ageng

--000e0cd6d02293a26c048830f6f6-- --===============1963217599== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel --===============1963217599==--