WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

[Xen-devel] How to switch VGA passthrough live

To: yuri.schaeffer@xxxxxx, allen.m.kay@xxxxxxxxx
Subject: [Xen-devel] How to switch VGA passthrough live
From: 于佳耕 <yujiageng734@xxxxxxxxx>
Date: Fri, 4 Jun 2010 17:29:43 +0800
Cc: xen-devel@xxxxxxxxxxxxxxxxxxx
Delivery-date: Fri, 04 Jun 2010 02:30:49 -0700
Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:received:date:message-id :subject:from:to:cc:content-type; bh=/aOWhveteP/ue8RpwgkvhrqcCGxMuBK7YZ0II3jEvD0=; b=lYxY9KIN5HmP/x5qX4iKD5d8nFiTbYyzCTYkRXktKccSJlIlB5PQm0TDnbAMxHxVbO 8frKi+ORtcvccEF5EBDEnztVKz2IU92AHrhwrZghH78ThNLa4lj5o6n6A8OjKGgVwiLz I3UbVB5E1d4ZmkVp2klCGFX1HHYbBMpq4YziE=
Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:date:message-id:subject:from:to:cc:content-type; b=pgDfXStoDMQU0DpHdsucWDFyuHH/SQVb+FHQfBPFyLxadHd38aFEay2Q4/aA7qOcrw 3n6iIGVqK8Kql5k6cwhoshYe4UKZo9s74WBi4yz0G61y2qg8a59k71pBf4op4oUUTpli emQlDnLJ/3KIc1TRs9KCJRbQdcBJtk+BfNhfc=
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx

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 “xm pci-detach Domain 00:00:02.0”:

1.       Raise sci interrupt to unplug the device. If OSPM doesn’t 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 == 0x10)  // Intel integrated graphics

                    {

                             p = & 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 “xm pci-attach Domain 00:00:02.0”:

1.       Modify power_on_php_devfn function:

int power_off_php_devfn(int devfn)

{

           ….

           while(devfn == 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] = p-> pt_dev->dev;

 

                    return 0;

           }

 

           if (!dpci_infos.pci_access)

           {…}

           pt_dev = register_real_device(..);

  return 0;

}

 

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 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

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel