All of lore.kernel.org
 help / color / mirror / Atom feed
From: NISHIGUCHI Naoki <nisiguti@jp.fujitsu.com>
To: Yuji Shimada <shimada-yxb@necst.nec.co.jp>
Cc: Ian Jackson <Ian.Jackson@eu.citrix.com>,
	xen-devel <xen-devel@lists.xensource.com>,
	"Dong, Eddie" <eddie.dong@intel.com>,
	Keir Fraser <keir.fraser@eu.citrix.com>,
	"Cui, Dexuan" <dexuan.cui@intel.com>
Subject: Re: [PATCH] Support more Capability Structures (including MSI/MSI-X) and Device Specific Registers for pt device.
Date: Tue, 08 Jul 2008 14:14:55 +0900	[thread overview]
Message-ID: <4872F7CF.2040603@jp.fujitsu.com> (raw)
In-Reply-To: <20080704152258.855C.SHIMADA-YXB@necst.nec.co.jp>

[-- Attachment #1: Type: text/plain, Size: 4383 bytes --]

Hi,

I've tested your patch with Windows XP Professional SP2 and UHCI/EHCI.
But your patch did not work with USB keyboard and USB mouse and so on.
The following are hypervisor's log.

(XEN) domctl.c:760:d0 ioport_map:invalid:gport=ffffffff mport=f600 nr_ports=20
(XEN) domctl.c:760:d0 ioport_map:invalid:gport=ffffffff mport=f800 nr_ports=20
(XEN) domctl.c:760:d0 ioport_map:invalid:gport=ffffffff mport=f700 nr_ports=20
(XEN) domctl.c:760:d0 ioport_map:invalid:gport=ffffffff mport=f700 nr_ports=20
(XEN) domctl.c:760:d0 ioport_map:invalid:gport=ffffffff mport=f800 nr_ports=20
(XEN) domctl.c:760:d0 ioport_map:invalid:gport=ffffffff mport=f600 nr_ports=20
(XEN) p2m.c:1158:d0 clear_mmio_p2m_entry: gfn_to_mfn failed! gfn=000fffff

The problem had occurred by removing mapping of invalid guest address(-1).

Attached patch fixes this problem.


Signed-off-by: Naoki Nishiguchi <nisiguti@jp.fujitsu.com>

Regards,
Naoki Nishiguchi

Yuji Shimada wrote:
> I am submitting the patch which supports more Capability Structures
> including MSI/MSI-X Capability Structure and Device Specific
> Registers for passthrough device. The purpose of the patch is enabling
> various I/O device to be assigned to guest domain.
> 
> I hope the patch is applied to xen 3.3 unstable tree, and tested by
> many developers.
> 
> I implemented following Capability Structures and Device Specific
> Registers.
> 
>     * Configuration Header Type 0
>         -> emulation.
>            "emulation" does not mean no accessing real I/O device.
>            Access real I/O device, but guest value and real value
>            might be different.
>     * MSI Capability Structure
>         -> emulation.
>            Behavior is not changed from existed implementation in
>            pt-msi.c, although code is changed.
>     * MSI-X Capability Structure
>         -> emulation.
>            Behavior is not changed from existed implementation in
>            pt-msi.c, although code is changed.
>     * PCI Express Capability Structure
>         -> emulation.
>     * PCI Power Management Capability Structure
>         -> emulation.
>     * Vital Product Data Capability Structure
>         -> emulation.
>            Emulated register is only  Next Capability Pointer Register.
>            All other registers are passthrough.
>     * Vendor Specific Capability Structure
>         -> emulation
>            Emulated register is only  Next Capability Pointer Register.
>            All other registers are passthrough.
>     * Device Specific Register (exclude capability structures)
>         -> passthrough.
>            The device drivers in guest domain are allowed to access
>            Device Specific Register. So various I/O device will work.
> 
> I assigned following device to guest domain, and they worked fine.
> 
>     - PCIe NIC (MSI)
>     - PCI NIC (MSI)
>     - UHCI (INTx interrupt)
>     - IDE Controller (INTx interrupt)
> 
> To assign device with MSI to guest domain, please add "msi_irq_enable"
> to xen hypervisor's boot parameter. If you would like to disable
> MSI/MSI-X, please add "pci=nomsi" to guest linux boot parameter.
> 
> I have not tested MSI-X much. I hope developers in xen community test
> them.
> 
> Other Capability Structures are hidden from guest software. To do
> this, I change Next Capability Pointer's value to point only the
> Capability Structure that need to be exported to guest software (see
> emulate capabilities above). And some Capability Structures are 0
> hardwired, and others are passthrough.
> 
> This patch removes "switch" statements for emulation, and introduces
> table based emulation derived from pciback driver. You can implement
> new Capability Structure by adding new table.
> 
> The other advantage of using this table is that you can easily change
> the emulation policy of each field/bit by just simply modifying the
> "emu_mask" value provided in each register table.
> And for only special emulation or interacting with other components
> (like hypervisor), you have to implement function corresponding to the
> register.
> 
> Thanks.
> 
> Signed-off-by: Yuji Shimada <shimada-yxb@necst.nec.co.jp>
> 
> 
> ------------------------------------------------------------------------
> 
> _______________________________________________
> Xen-devel mailing list
> Xen-devel@lists.xensource.com
> http://lists.xensource.com/xen-devel


[-- Attachment #2: fix_pt_iomap.patch --]
[-- Type: text/x-patch, Size: 720 bytes --]

diff -r 0d707feab01e tools/ioemu/hw/pass-through.c
--- a/tools/ioemu/hw/pass-through.c	Mon Jul 07 16:13:53 2008 +0100
+++ b/tools/ioemu/hw/pass-through.c	Tue Jul 08 11:27:48 2008 +0900
@@ -827,7 +827,7 @@ void pt_iomem_map(PCIDevice *d, int i, u
     if ( e_size == 0 )
         return;
 
-    if ( !first_map )
+    if ( !first_map && old_ebase != -1 )
     {
         add_msix_mapping(assigned_device, i);
         /* Remove old mapping */
@@ -883,7 +883,7 @@ void pt_ioport_map(PCIDevice *d, int i,
     if ( e_size == 0 )
         return;
 
-    if ( !first_map )
+    if ( !first_map && old_ebase != -1 )
     {
         /* Remove old mapping */
         ret = xc_domain_ioport_mapping(xc_handle, domid, old_ebase,

[-- Attachment #3: Type: text/plain, Size: 138 bytes --]

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

  reply	other threads:[~2008-07-08  5:14 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-07-04  6:26 [PATCH] Support more Capability Structures (including MSI/MSI-X) and Device Specific Registers for pt device Yuji Shimada
2008-07-08  5:14 ` NISHIGUCHI Naoki [this message]
2008-07-08  7:30   ` Yuji Shimada

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4872F7CF.2040603@jp.fujitsu.com \
    --to=nisiguti@jp.fujitsu.com \
    --cc=Ian.Jackson@eu.citrix.com \
    --cc=dexuan.cui@intel.com \
    --cc=eddie.dong@intel.com \
    --cc=keir.fraser@eu.citrix.com \
    --cc=shimada-yxb@necst.nec.co.jp \
    --cc=xen-devel@lists.xensource.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.