qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Venu Busireddy <venu.busireddy@oracle.com>
To: "Michael S. Tsirkin" <mst@redhat.com>
Cc: Marcel Apfelbaum <marcel@redhat.com>,
	virtio-dev@lists.oasis-open.org, qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [virtio-dev] Re: [PATCH v2 3/4] Add "Group Identifier" support to Red Hat PCI bridge.
Date: Tue, 26 Jun 2018 23:08:12 -0500	[thread overview]
Message-ID: <20180627040812.GA20446@troi> (raw)
In-Reply-To: <20180627065943-mutt-send-email-mst@kernel.org>

On 2018-06-27 07:02:36 +0300, Michael S. Tsirkin wrote:
> On Tue, Jun 26, 2018 at 10:49:33PM -0500, Venu Busireddy wrote:
> > Add the "Vendor-Specific" capability to the Red Hat PCI bridge device
> > "pci-bridge", to contain the "Group Identifier" (UUID) that will be
> > used to pair a virtio device with the passthrough device attached to
> > that bridge.
> > 
> > This capability is added to the bridge iff the "uuid" option is specified
> > for the bridge.
> 
> I think the name should be more explicit. How about "failover-group-id"?

I can change it. But don't you think it is bit long?

> > 
> > Signed-off-by: Venu Busireddy <venu.busireddy@oracle.com>
> 
> I'd like to also tweak the device id in this case,
> to make it easier for guests to know it's a grouping bridge.

Could you please recommend a name for the new ID'd definition? Something
in lines of PCI_DEVICE_ID_REDHAT_<blah blah>.

Thanks,

Venu

> 
> > ---
> >  hw/pci-bridge/pci_bridge_dev.c |  8 ++++++++
> >  hw/pci/pci_bridge.c            | 26 ++++++++++++++++++++++++++
> >  include/hw/pci/pcie.h          |  1 +
> >  3 files changed, 35 insertions(+)
> > 
> > diff --git a/hw/pci-bridge/pci_bridge_dev.c b/hw/pci-bridge/pci_bridge_dev.c
> > index b2d861d216..bbbc6fa1c6 100644
> > --- a/hw/pci-bridge/pci_bridge_dev.c
> > +++ b/hw/pci-bridge/pci_bridge_dev.c
> > @@ -71,6 +71,12 @@ static void pci_bridge_dev_realize(PCIDevice *dev, Error **errp)
> >          bridge_dev->msi = ON_OFF_AUTO_OFF;
> >      }
> >  
> > +    err = pci_bridge_vendor_init(dev, 0, errp);
> > +    if (err < 0) {
> > +        error_append_hint(errp, "Can't init group ID, error %d\n", err);
> > +        goto vendor_cap_err;
> > +    }
> > +
> >      err = slotid_cap_init(dev, 0, bridge_dev->chassis_nr, 0, errp);
> >      if (err) {
> >          goto slotid_error;
> > @@ -109,6 +115,7 @@ slotid_error:
> >      if (shpc_present(dev)) {
> >          shpc_cleanup(dev, &bridge_dev->bar);
> >      }
> > +vendor_cap_err:
> >  shpc_error:
> >      pci_bridge_exitfn(dev);
> >  }
> > @@ -162,6 +169,7 @@ static Property pci_bridge_dev_properties[] = {
> >                              ON_OFF_AUTO_AUTO),
> >      DEFINE_PROP_BIT(PCI_BRIDGE_DEV_PROP_SHPC, PCIBridgeDev, flags,
> >                      PCI_BRIDGE_DEV_F_SHPC_REQ, true),
> > +    DEFINE_PROP_UUID(COMPAT_PROP_UUID, PCIDevice, uuid, false),
> >      DEFINE_PROP_END_OF_LIST(),
> >  };
> >  
> > diff --git a/hw/pci/pci_bridge.c b/hw/pci/pci_bridge.c
> > index 40a39f57cb..cb8b3dad2a 100644
> > --- a/hw/pci/pci_bridge.c
> > +++ b/hw/pci/pci_bridge.c
> > @@ -34,12 +34,17 @@
> >  #include "hw/pci/pci_bus.h"
> >  #include "qemu/range.h"
> >  #include "qapi/error.h"
> > +#include "qemu/uuid.h"
> >  
> >  /* PCI bridge subsystem vendor ID helper functions */
> >  #define PCI_SSVID_SIZEOF        8
> >  #define PCI_SSVID_SVID          4
> >  #define PCI_SSVID_SSID          6
> >  
> > +#define PCI_VENDOR_SIZEOF             20
> > +#define PCI_VENDOR_CAP_LEN_OFFSET      2
> > +#define PCI_VENDOR_GROUP_ID_OFFSET     4
> > +
> >  int pci_bridge_ssvid_init(PCIDevice *dev, uint8_t offset,
> >                            uint16_t svid, uint16_t ssid,
> >                            Error **errp)
> > @@ -57,6 +62,27 @@ int pci_bridge_ssvid_init(PCIDevice *dev, uint8_t offset,
> >      return pos;
> >  }
> >  
> > +int pci_bridge_vendor_init(PCIDevice *d, uint8_t offset, Error **errp)
> > +{
> > +    int pos;
> > +
> > +    if (qemu_uuid_is_null(&d->uuid)) {
> > +        return 0;
> > +    }
> > +
> > +    pos = pci_add_capability(d, PCI_CAP_ID_VNDR, offset, PCI_VENDOR_SIZEOF,
> > +            errp);
> > +    if (pos < 0) {
> > +        return pos;
> > +    }
> > +
> > +    pci_set_word(d->config + pos + PCI_VENDOR_CAP_LEN_OFFSET,
> > +            PCI_VENDOR_SIZEOF);
> > +    memcpy(d->config + pos + PCI_VENDOR_GROUP_ID_OFFSET, &d->uuid,
> > +            sizeof(QemuUUID));
> > +    return pos;
> > +}
> > +
> >  /* Accessor function to get parent bridge device from pci bus. */
> >  PCIDevice *pci_bridge_get_device(PCIBus *bus)
> >  {
> > diff --git a/include/hw/pci/pcie.h b/include/hw/pci/pcie.h
> > index b71e369703..b4189d0ce3 100644
> > --- a/include/hw/pci/pcie.h
> > +++ b/include/hw/pci/pcie.h
> > @@ -82,6 +82,7 @@ struct PCIExpressDevice {
> >  };
> >  
> >  #define COMPAT_PROP_PCP "power_controller_present"
> > +#define COMPAT_PROP_UUID "uuid"
> >  
> >  /* PCI express capability helper functions */
> >  int pcie_cap_init(PCIDevice *dev, uint8_t offset, uint8_t type,
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: virtio-dev-unsubscribe@lists.oasis-open.org
> For additional commands, e-mail: virtio-dev-help@lists.oasis-open.org
> 

  reply	other threads:[~2018-06-27  4:08 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-06-27  3:49 [Qemu-devel] [PATCH v2 0/4] Use of unique identifier for pairing virtio and passthrough devices Venu Busireddy
2018-06-27  3:49 ` [Qemu-devel] [PATCH v2 1/4] Add a true or false option to the DEFINE_PROP_UUID macro Venu Busireddy
2018-06-27  3:49 ` [Qemu-devel] [PATCH v2 2/4] Add "Group Identifier" support to virtio devices Venu Busireddy
2018-06-27  3:49 ` [Qemu-devel] [PATCH v2 3/4] Add "Group Identifier" support to Red Hat PCI bridge Venu Busireddy
2018-06-27  4:02   ` Michael S. Tsirkin
2018-06-27  4:08     ` Venu Busireddy [this message]
2018-06-27 23:07       ` [Qemu-devel] [virtio-dev] " Venu Busireddy
2018-06-28  2:14         ` Michael S. Tsirkin
2018-06-28  3:46           ` Venu Busireddy
2018-06-28  8:10           ` Siwei Liu
2018-06-28  8:25     ` [Qemu-devel] " Daniel P. Berrangé
2018-06-28 10:07       ` [Qemu-devel] Retrieving configuration metadata from hypervisor (was: Re: [PATCH v2 3/4] Add "Group Identifier" support to Red Hat PCI bridge.) Cornelia Huck
2018-06-27  3:49 ` [Qemu-devel] [PATCH v2 4/4] Add "Group Identifier" support to Red Hat PCI Express bridge Venu Busireddy
2018-06-27  3:49 ` [Qemu-devel] [PATCH v2 virtio 1/1] Add "Group Identifier" to virtio PCI capabilities Venu Busireddy
2018-06-27  4:06 ` [Qemu-devel] [PATCH v2 0/4] Use of unique identifier for pairing virtio and passthrough devices Michael S. Tsirkin
2018-06-27  4:12   ` [Qemu-devel] [virtio-dev] " Venu Busireddy
2018-06-27  7:21   ` Siwei Liu
2018-06-27  8:17   ` Cornelia Huck
2018-06-27 12:24 ` [Qemu-devel] " Roman Kagan
2018-06-27 19:29   ` Venu Busireddy
2018-06-27 19:47     ` Michael S. Tsirkin
2018-06-27 19:59       ` Venu Busireddy
2018-06-27 20:12         ` Michael S. Tsirkin
2018-06-27 22:34           ` Venu Busireddy
2018-06-28  1:54             ` Michael S. Tsirkin
2018-06-28  3:27               ` Venu Busireddy
2018-06-29 18:55                 ` [Qemu-devel] [virtio-dev] " Venu Busireddy
2018-06-29 21:59                   ` Michael S. Tsirkin
2018-06-28 10:17     ` [Qemu-devel] " Roman Kagan

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=20180627040812.GA20446@troi \
    --to=venu.busireddy@oracle.com \
    --cc=marcel@redhat.com \
    --cc=mst@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=virtio-dev@lists.oasis-open.org \
    /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).