qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] add pci-bridge-seat
@ 2015-03-16 10:36 Gerd Hoffmann
  2015-03-16 12:20 ` Michael S. Tsirkin
  0 siblings, 1 reply; 5+ messages in thread
From: Gerd Hoffmann @ 2015-03-16 10:36 UTC (permalink / raw)
  To: qemu-devel; +Cc: Gerd Hoffmann, Michael S. Tsirkin

Simplifies multiseat configuration, see
docs/multiseat.txt update for details.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
 docs/multiseat.txt             | 19 +++++++++++++++++++
 docs/specs/pci-ids.txt         |  1 +
 hw/pci-bridge/pci_bridge_dev.c | 25 ++++++++++++++++++++++++-
 include/hw/pci/pci.h           |  1 +
 4 files changed, 45 insertions(+), 1 deletion(-)

diff --git a/docs/multiseat.txt b/docs/multiseat.txt
index b963665..814496e 100644
--- a/docs/multiseat.txt
+++ b/docs/multiseat.txt
@@ -106,6 +106,25 @@ the devices attached to the seat.
 Background info is here:
   http://www.freedesktop.org/wiki/Software/systemd/multiseat/
 
+
+guest side with pci-bridge-seat
+-------------------------------
+
+Qemu version FIXME and newer has a new pci-bridge-seat device which
+can be used instead of pci-bridge.  Just swap the device name in the
+qemu command line above.  The only difference between the two devices
+is the pci id.  We can match the pci id instead of the device path
+with a nice generic rule now, which simplifies the guest
+configuration:
+
+    [root@fedora ~]# cat /etc/udev/rules.d/70-qemu-pci-bridge-seat.rules
+    SUBSYSTEM=="pci", ATTR{vendor}=="0x1b36", ATTR{device}=="0x000a", \
+            TAG+="seat", ENV{ID_AUTOSEAT}="1"
+
+Patch with this rule will be submitted to upstream udev/systemd, so
+long-term, when systemd with this lands in distros, things will work
+just fine without any manual guest configuration.
+
 Enjoy!
 
 --
diff --git a/docs/specs/pci-ids.txt b/docs/specs/pci-ids.txt
index c6732fe..cdeb805 100644
--- a/docs/specs/pci-ids.txt
+++ b/docs/specs/pci-ids.txt
@@ -46,6 +46,7 @@ PCI devices (other than virtio):
 1b36:0004  PCI Quad-port 16550A adapter (docs/specs/pci-serial.txt)
 1b36:0005  PCI test device (docs/specs/pci-testdev.txt)
 1b36:0007  PCI SD Card Host Controller Interface (SDHCI)
+1b36:000a  PCI-PCI bridge (multiseat)
 
 All these devices are documented in docs/specs.
 
diff --git a/hw/pci-bridge/pci_bridge_dev.c b/hw/pci-bridge/pci_bridge_dev.c
index 36f73e1..e966d2e 100644
--- a/hw/pci-bridge/pci_bridge_dev.c
+++ b/hw/pci-bridge/pci_bridge_dev.c
@@ -28,7 +28,8 @@
 #include "hw/pci/pci_bus.h"
 #include "hw/hotplug.h"
 
-#define TYPE_PCI_BRIDGE_DEV "pci-bridge"
+#define TYPE_PCI_BRIDGE_DEV      "pci-bridge"
+#define TYPE_PCI_BRIDGE_SEAT_DEV "pci-bridge-seat"
 #define PCI_BRIDGE_DEV(obj) \
     OBJECT_CHECK(PCIBridgeDev, (obj), TYPE_PCI_BRIDGE_DEV)
 
@@ -170,9 +171,31 @@ static const TypeInfo pci_bridge_dev_info = {
     }
 };
 
+/*
+ * Multiseat bridge.  Same as the standard pci bridge, only with a
+ * different pci id, so we can match it easily in the guest for
+ * automagic multiseat configuration.  See docs/multiseat.txt for more.
+ */
+static void pci_bridge_dev_seat_class_init(ObjectClass *klass, void *data)
+{
+    DeviceClass *dc = DEVICE_CLASS(klass);
+    PCIDeviceClass *k = PCI_DEVICE_CLASS(klass);
+
+    k->device_id = PCI_DEVICE_ID_REDHAT_BRIDGE_SEAT;
+    dc->desc = "Standard PCI Bridge (multiseat)";
+}
+
+static const TypeInfo pci_bridge_dev_seat_info = {
+    .name              = TYPE_PCI_BRIDGE_SEAT_DEV,
+    .parent            = TYPE_PCI_BRIDGE_DEV,
+    .instance_size     = sizeof(PCIBridgeDev),
+    .class_init        = pci_bridge_dev_seat_class_init,
+};
+
 static void pci_bridge_dev_register(void)
 {
     type_register_static(&pci_bridge_dev_info);
+    type_register_static(&pci_bridge_dev_seat_info);
 }
 
 type_init(pci_bridge_dev_register);
diff --git a/include/hw/pci/pci.h b/include/hw/pci/pci.h
index be2d9b8..320c389 100644
--- a/include/hw/pci/pci.h
+++ b/include/hw/pci/pci.h
@@ -90,6 +90,7 @@
 #define PCI_DEVICE_ID_REDHAT_TEST        0x0005
 #define PCI_DEVICE_ID_REDHAT_SDHCI       0x0007
 #define PCI_DEVICE_ID_REDHAT_PCIE_HOST   0x0008
+#define PCI_DEVICE_ID_REDHAT_BRIDGE_SEAT 0x000a
 #define PCI_DEVICE_ID_REDHAT_QXL         0x0100
 
 #define FMT_PCIBUS                      PRIx64
-- 
1.8.3.1

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [Qemu-devel] [PATCH] add pci-bridge-seat
  2015-03-16 10:36 [Qemu-devel] [PATCH] add pci-bridge-seat Gerd Hoffmann
@ 2015-03-16 12:20 ` Michael S. Tsirkin
  2015-03-17  7:16   ` Gerd Hoffmann
  0 siblings, 1 reply; 5+ messages in thread
From: Michael S. Tsirkin @ 2015-03-16 12:20 UTC (permalink / raw)
  To: Gerd Hoffmann; +Cc: qemu-devel

On Mon, Mar 16, 2015 at 11:36:43AM +0100, Gerd Hoffmann wrote:
> Simplifies multiseat configuration, see
> docs/multiseat.txt update for details.
> 
> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
> ---
>  docs/multiseat.txt             | 19 +++++++++++++++++++
>  docs/specs/pci-ids.txt         |  1 +
>  hw/pci-bridge/pci_bridge_dev.c | 25 ++++++++++++++++++++++++-
>  include/hw/pci/pci.h           |  1 +
>  4 files changed, 45 insertions(+), 1 deletion(-)
> 
> diff --git a/docs/multiseat.txt b/docs/multiseat.txt
> index b963665..814496e 100644
> --- a/docs/multiseat.txt
> +++ b/docs/multiseat.txt
> @@ -106,6 +106,25 @@ the devices attached to the seat.
>  Background info is here:
>    http://www.freedesktop.org/wiki/Software/systemd/multiseat/
>  
> +
> +guest side with pci-bridge-seat
> +-------------------------------
> +
> +Qemu version FIXME and newer has a new pci-bridge-seat device which
> +can be used instead of pci-bridge.  Just swap the device name in the
> +qemu command line above.  The only difference between the two devices
> +is the pci id.  We can match the pci id instead of the device path
> +with a nice generic rule now, which simplifies the guest
> +configuration:
> +
> +    [root@fedora ~]# cat /etc/udev/rules.d/70-qemu-pci-bridge-seat.rules
> +    SUBSYSTEM=="pci", ATTR{vendor}=="0x1b36", ATTR{device}=="0x000a", \
> +            TAG+="seat", ENV{ID_AUTOSEAT}="1"
> +
> +Patch with this rule will be submitted to upstream udev/systemd, so
> +long-term, when systemd with this lands in distros, things will work
> +just fine without any manual guest configuration.
> +
>  Enjoy!
>  

I'm confused. What's wrong with using the regular bridge,
and ATTR{vendor}=="0x1b36", ATTR{device}=="0x0001"?


>  --
> diff --git a/docs/specs/pci-ids.txt b/docs/specs/pci-ids.txt
> index c6732fe..cdeb805 100644
> --- a/docs/specs/pci-ids.txt
> +++ b/docs/specs/pci-ids.txt
> @@ -46,6 +46,7 @@ PCI devices (other than virtio):
>  1b36:0004  PCI Quad-port 16550A adapter (docs/specs/pci-serial.txt)
>  1b36:0005  PCI test device (docs/specs/pci-testdev.txt)
>  1b36:0007  PCI SD Card Host Controller Interface (SDHCI)
> +1b36:000a  PCI-PCI bridge (multiseat)
>  
>  All these devices are documented in docs/specs.
>  
> diff --git a/hw/pci-bridge/pci_bridge_dev.c b/hw/pci-bridge/pci_bridge_dev.c
> index 36f73e1..e966d2e 100644
> --- a/hw/pci-bridge/pci_bridge_dev.c
> +++ b/hw/pci-bridge/pci_bridge_dev.c
> @@ -28,7 +28,8 @@
>  #include "hw/pci/pci_bus.h"
>  #include "hw/hotplug.h"
>  
> -#define TYPE_PCI_BRIDGE_DEV "pci-bridge"
> +#define TYPE_PCI_BRIDGE_DEV      "pci-bridge"
> +#define TYPE_PCI_BRIDGE_SEAT_DEV "pci-bridge-seat"
>  #define PCI_BRIDGE_DEV(obj) \
>      OBJECT_CHECK(PCIBridgeDev, (obj), TYPE_PCI_BRIDGE_DEV)
>  
> @@ -170,9 +171,31 @@ static const TypeInfo pci_bridge_dev_info = {
>      }
>  };
>  
> +/*
> + * Multiseat bridge.  Same as the standard pci bridge, only with a
> + * different pci id, so we can match it easily in the guest for
> + * automagic multiseat configuration.  See docs/multiseat.txt for more.

Hmm, this doesn't give me any info except it has something
to do with multiseat (which is itself an ambigious term)
and is somehow magic.

It's probably obvious to you - maybe you can explain?

> + */
> +static void pci_bridge_dev_seat_class_init(ObjectClass *klass, void *data)
> +{
> +    DeviceClass *dc = DEVICE_CLASS(klass);
> +    PCIDeviceClass *k = PCI_DEVICE_CLASS(klass);
> +
> +    k->device_id = PCI_DEVICE_ID_REDHAT_BRIDGE_SEAT;
> +    dc->desc = "Standard PCI Bridge (multiseat)";
> +}
> +
> +static const TypeInfo pci_bridge_dev_seat_info = {
> +    .name              = TYPE_PCI_BRIDGE_SEAT_DEV,
> +    .parent            = TYPE_PCI_BRIDGE_DEV,
> +    .instance_size     = sizeof(PCIBridgeDev),
> +    .class_init        = pci_bridge_dev_seat_class_init,
> +};
> +
>  static void pci_bridge_dev_register(void)
>  {
>      type_register_static(&pci_bridge_dev_info);
> +    type_register_static(&pci_bridge_dev_seat_info);
>  }
>  
>  type_init(pci_bridge_dev_register);
> diff --git a/include/hw/pci/pci.h b/include/hw/pci/pci.h
> index be2d9b8..320c389 100644
> --- a/include/hw/pci/pci.h
> +++ b/include/hw/pci/pci.h
> @@ -90,6 +90,7 @@
>  #define PCI_DEVICE_ID_REDHAT_TEST        0x0005
>  #define PCI_DEVICE_ID_REDHAT_SDHCI       0x0007
>  #define PCI_DEVICE_ID_REDHAT_PCIE_HOST   0x0008
> +#define PCI_DEVICE_ID_REDHAT_BRIDGE_SEAT 0x000a
>  #define PCI_DEVICE_ID_REDHAT_QXL         0x0100
>  
>  #define FMT_PCIBUS                      PRIx64
> -- 
> 1.8.3.1

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [Qemu-devel] [PATCH] add pci-bridge-seat
  2015-03-16 12:20 ` Michael S. Tsirkin
@ 2015-03-17  7:16   ` Gerd Hoffmann
  2015-03-17 19:20     ` Michael S. Tsirkin
  0 siblings, 1 reply; 5+ messages in thread
From: Gerd Hoffmann @ 2015-03-17  7:16 UTC (permalink / raw)
  To: Michael S. Tsirkin; +Cc: qemu-devel

On Mo, 2015-03-16 at 13:20 +0100, Michael S. Tsirkin wrote:
> On Mon, Mar 16, 2015 at 11:36:43AM +0100, Gerd Hoffmann wrote:
> > Simplifies multiseat configuration, see
> > docs/multiseat.txt update for details.
> > 
> > Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
> > ---
> >  docs/multiseat.txt             | 19 +++++++++++++++++++
> >  docs/specs/pci-ids.txt         |  1 +
> >  hw/pci-bridge/pci_bridge_dev.c | 25 ++++++++++++++++++++++++-
> >  include/hw/pci/pci.h           |  1 +
> >  4 files changed, 45 insertions(+), 1 deletion(-)
> > 
> > diff --git a/docs/multiseat.txt b/docs/multiseat.txt
> > index b963665..814496e 100644
> > --- a/docs/multiseat.txt
> > +++ b/docs/multiseat.txt
> > @@ -106,6 +106,25 @@ the devices attached to the seat.
> >  Background info is here:
> >    http://www.freedesktop.org/wiki/Software/systemd/multiseat/
> >  
> > +
> > +guest side with pci-bridge-seat
> > +-------------------------------
> > +
> > +Qemu version FIXME and newer has a new pci-bridge-seat device which
> > +can be used instead of pci-bridge.  Just swap the device name in the
> > +qemu command line above.  The only difference between the two devices
> > +is the pci id.  We can match the pci id instead of the device path
> > +with a nice generic rule now, which simplifies the guest
> > +configuration:
> > +
> > +    [root@fedora ~]# cat /etc/udev/rules.d/70-qemu-pci-bridge-seat.rules
> > +    SUBSYSTEM=="pci", ATTR{vendor}=="0x1b36", ATTR{device}=="0x000a", \
> > +            TAG+="seat", ENV{ID_AUTOSEAT}="1"
> > +
> > +Patch with this rule will be submitted to upstream udev/systemd, so
> > +long-term, when systemd with this lands in distros, things will work
> > +just fine without any manual guest configuration.
> > +
> >  Enjoy!
> >  
> 
> I'm confused. What's wrong with using the regular bridge,
> and ATTR{vendor}=="0x1b36", ATTR{device}=="0x0001"?

It works just fine, thats why the new device is identical except for the
id.

The whole point is to simplify guest-side configuration, by passing one
bit of extra information to the guest:  Whenever the pci bridge with the
devices below it should be considered a new seat (-device
pci-bridge-seat) or not (-device pci-bridge).

cheers,
  Gerd

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [Qemu-devel] [PATCH] add pci-bridge-seat
  2015-03-17  7:16   ` Gerd Hoffmann
@ 2015-03-17 19:20     ` Michael S. Tsirkin
  2015-03-18  7:14       ` Gerd Hoffmann
  0 siblings, 1 reply; 5+ messages in thread
From: Michael S. Tsirkin @ 2015-03-17 19:20 UTC (permalink / raw)
  To: Gerd Hoffmann; +Cc: qemu-devel

On Tue, Mar 17, 2015 at 08:16:45AM +0100, Gerd Hoffmann wrote:
> On Mo, 2015-03-16 at 13:20 +0100, Michael S. Tsirkin wrote:
> > On Mon, Mar 16, 2015 at 11:36:43AM +0100, Gerd Hoffmann wrote:
> > > Simplifies multiseat configuration, see
> > > docs/multiseat.txt update for details.
> > > 
> > > Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
> > > ---
> > >  docs/multiseat.txt             | 19 +++++++++++++++++++
> > >  docs/specs/pci-ids.txt         |  1 +
> > >  hw/pci-bridge/pci_bridge_dev.c | 25 ++++++++++++++++++++++++-
> > >  include/hw/pci/pci.h           |  1 +
> > >  4 files changed, 45 insertions(+), 1 deletion(-)
> > > 
> > > diff --git a/docs/multiseat.txt b/docs/multiseat.txt
> > > index b963665..814496e 100644
> > > --- a/docs/multiseat.txt
> > > +++ b/docs/multiseat.txt
> > > @@ -106,6 +106,25 @@ the devices attached to the seat.
> > >  Background info is here:
> > >    http://www.freedesktop.org/wiki/Software/systemd/multiseat/
> > >  
> > > +
> > > +guest side with pci-bridge-seat
> > > +-------------------------------
> > > +
> > > +Qemu version FIXME and newer has a new pci-bridge-seat device which
> > > +can be used instead of pci-bridge.  Just swap the device name in the
> > > +qemu command line above.  The only difference between the two devices
> > > +is the pci id.  We can match the pci id instead of the device path
> > > +with a nice generic rule now, which simplifies the guest
> > > +configuration:
> > > +
> > > +    [root@fedora ~]# cat /etc/udev/rules.d/70-qemu-pci-bridge-seat.rules
> > > +    SUBSYSTEM=="pci", ATTR{vendor}=="0x1b36", ATTR{device}=="0x000a", \
> > > +            TAG+="seat", ENV{ID_AUTOSEAT}="1"
> > > +
> > > +Patch with this rule will be submitted to upstream udev/systemd, so
> > > +long-term, when systemd with this lands in distros, things will work
> > > +just fine without any manual guest configuration.
> > > +
> > >  Enjoy!
> > >  
> > 
> > I'm confused. What's wrong with using the regular bridge,
> > and ATTR{vendor}=="0x1b36", ATTR{device}=="0x0001"?
> 
> It works just fine, thats why the new device is identical except for the
> id.
> 
> The whole point is to simplify guest-side configuration, by passing one
> bit of extra information to the guest:  Whenever the pci bridge with the
> devices below it should be considered a new seat (-device
> pci-bridge-seat) or not (-device pci-bridge).
> 
> cheers,
>   Gerd
> 

Could you explain a bit more please? What does it mean that
a bridge is a new seat? How is this used?

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [Qemu-devel] [PATCH] add pci-bridge-seat
  2015-03-17 19:20     ` Michael S. Tsirkin
@ 2015-03-18  7:14       ` Gerd Hoffmann
  0 siblings, 0 replies; 5+ messages in thread
From: Gerd Hoffmann @ 2015-03-18  7:14 UTC (permalink / raw)
  To: Michael S. Tsirkin; +Cc: qemu-devel

  Hi,

> Could you explain a bit more please? What does it mean that
> a bridge is a new seat? How is this used?

seat: kbd+mouse+display adapter.

multiseat: When you have multiple of them on a single machine. When
configured properly logind will show a login screen on each seat.

why a pci bridge: grouping all devices belonging to a seat by placing
them all below a pci bridge simplifies guest configuration (instead of a
list of devices you'll only need to say "this bridge and all devices
underneath it").

why a new pci bridge device: this allows to make the guest-side seat
configuration automatic with a udev rule.

more details: see docs/multiseat.txt

cheers,
  Gerd

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2015-03-18  7:14 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-03-16 10:36 [Qemu-devel] [PATCH] add pci-bridge-seat Gerd Hoffmann
2015-03-16 12:20 ` Michael S. Tsirkin
2015-03-17  7:16   ` Gerd Hoffmann
2015-03-17 19:20     ` Michael S. Tsirkin
2015-03-18  7:14       ` Gerd Hoffmann

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