qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Michael S. Tsirkin" <mst@redhat.com>
To: "Dr. David Alan Gilbert (git)" <dgilbert@redhat.com>
Cc: amit.shah@redhat.com, qemu-stable@nongnu.org,
	quintela@redhat.com, qemu-devel@nongnu.org, kraxel@redhat.com
Subject: Re: [Qemu-devel] [PATCH 1/1] xhci PCIe endpoint migration compatibility fix
Date: Tue, 9 Sep 2014 16:14:19 +0300	[thread overview]
Message-ID: <20140909131419.GB12757@redhat.com> (raw)
In-Reply-To: <1410257983-12569-1-git-send-email-dgilbert@redhat.com>

On Tue, Sep 09, 2014 at 11:19:43AM +0100, Dr. David Alan Gilbert (git) wrote:
> From: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
> 
> Add back the PCIe config capabilities on XHCI cards in non-PCIe slots,
> but only for machine types before 2.1.

You can clear cmask for these bits to at least
make it work one way.

> This fixes a migration incompatibility in the XHCI PCI devices
> caused by:
>    058fdcf52cdbf57b67e7 - xhci: add endpoint cap on express bus only
> 
> Note that in fixing it for compatibility with older QEMUs, it breaks
> compatibility with existing QEMU 2.1's on older machine types.
> 
> The status before this patch was (if it used an XHCI adapter):
>    machine type | source qemu
>      any           pre-2.1     - FAIL
>      any           2.1...      - PASS
> 
> With this patch:
>    machine type | source qemu
>      any           pre-2.1    - PASS
>      pre-2.1       2.1...     - FAIL
>      2.1           2.1...     - PASS
> 
> A test to trigger it is to add '-device nec-usb-xhci,id=xhci,addr=0x12'
> to the command line.
>
> Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>

Cc: qemu-stable@nongnu.org
Acked-by: Michael S. Tsirkin <mst@redhat.com>

> ---
>  hw/usb/hcd-xhci.c    | 6 +++++-
>  include/hw/i386/pc.h | 5 +++++
>  2 files changed, 10 insertions(+), 1 deletion(-)
> 
> diff --git a/hw/usb/hcd-xhci.c b/hw/usb/hcd-xhci.c
> index bbe4c5f..73ced1f 100644
> --- a/hw/usb/hcd-xhci.c
> +++ b/hw/usb/hcd-xhci.c
> @@ -499,6 +499,7 @@ enum xhci_flags {
>      XHCI_FLAG_USE_MSI = 1,
>      XHCI_FLAG_USE_MSI_X,
>      XHCI_FLAG_SS_FIRST,
> +    XHCI_FLAG_FORCE_PCIE_ENDCAP,
>  };
>  
>  static void xhci_kick_ep(XHCIState *xhci, unsigned int slotid,
> @@ -3626,7 +3627,8 @@ static int usb_xhci_initfn(struct PCIDevice *dev)
>                       PCI_BASE_ADDRESS_SPACE_MEMORY|PCI_BASE_ADDRESS_MEM_TYPE_64,
>                       &xhci->mem);
>  
> -    if (pci_bus_is_express(dev->bus)) {
> +    if (pci_bus_is_express(dev->bus) ||
> +        xhci_get_flag(xhci, XHCI_FLAG_FORCE_PCIE_ENDCAP)) {
>          ret = pcie_endpoint_cap_init(dev, 0xa0);
>          assert(ret >= 0);
>      }
> @@ -3855,6 +3857,8 @@ static Property xhci_properties[] = {
>      DEFINE_PROP_BIT("msix",     XHCIState, flags, XHCI_FLAG_USE_MSI_X, true),
>      DEFINE_PROP_BIT("superspeed-ports-first",
>                      XHCIState, flags, XHCI_FLAG_SS_FIRST, true),
> +    DEFINE_PROP_BIT("force-pcie-endcap", XHCIState, flags,
> +                    XHCI_FLAG_FORCE_PCIE_ENDCAP, false),
>      DEFINE_PROP_UINT32("intrs", XHCIState, numintrs, MAXINTRS),
>      DEFINE_PROP_UINT32("slots", XHCIState, numslots, MAXSLOTS),
>      DEFINE_PROP_UINT32("p2",    XHCIState, numports_2, 4),
> diff --git a/include/hw/i386/pc.h b/include/hw/i386/pc.h
> index a39cb42..77316d5 100644
> --- a/include/hw/i386/pc.h
> +++ b/include/hw/i386/pc.h
> @@ -330,6 +330,11 @@ bool e820_get_entry(int, uint32_t, uint64_t *, uint64_t *);
>              .value    = "off",\
>          },\
>          {\
> +            .driver   = "nec-usb-xhci",\
> +            .property = "force-pcie-endcap",\
> +            .value    = "on",\
> +        },\
> +        {\
>              .driver   = "pci-serial",\
>              .property = "prog_if",\
>              .value    = stringify(0),\
> -- 
> 1.9.3

      reply	other threads:[~2014-09-09 13:11 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-09-09 10:19 [Qemu-devel] [PATCH 1/1] xhci PCIe endpoint migration compatibility fix Dr. David Alan Gilbert (git)
2014-09-09 13:14 ` Michael S. Tsirkin [this message]

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=20140909131419.GB12757@redhat.com \
    --to=mst@redhat.com \
    --cc=amit.shah@redhat.com \
    --cc=dgilbert@redhat.com \
    --cc=kraxel@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-stable@nongnu.org \
    --cc=quintela@redhat.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).