Skip to contentSkip to conversation

add pci-serial device.

PATCH Superseded Gerd Hoffmann 4 participants 12 messages Sep 24, 2012 – Sep 28, 2012

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

cover add pci-serial device.

Hi,

Two patches, first split up serial.c a bit,
then actually add the pci-based serial device.

cheers,
Gerd

Gerd Hoffmann (2):
serial: split serial.c
serial: add pci variant

 default-configs/pci.mak  |    2 +
 docs/pciserial.inf       |   96 +++++++++++++++++++++++++++++++
 hw/Makefile.objs         |    3 +-
 hw/alpha_dp264.c         |    1 +
 hw/kzm.c                 |    2 +-
 hw/mips_fulong2e.c       |    1 +
 hw/mips_jazz.c           |    1 +
 hw/mips_malta.c          |    1 +
 hw/mips_mipssim.c        |    2 +-
 hw/mips_r4k.c            |    1 +
 hw/musicpal.c            |    2 +-
 hw/omap_uart.c           |    3 +-
 hw/openrisc_sim.c        |    3 +-
 hw/pc.c                  |    1 +
 hw/pc.h                  |   27 ---------
 hw/pci_ids.h             |    1 +
 hw/petalogix_ml605_mmu.c |    2 +-
 hw/ppc/e500.c            |    2 +-
 hw/ppc405_uc.c           |    2 +-
 hw/ppc440_bamboo.c       |    2 +-
 hw/ppc_prep.c            |    1 +
 hw/pxa2xx.c              |    2 +-
 hw/serial-isa.c          |  130 +++++++++++++++++++++++++++++++++++++++++
 hw/serial-pci.c          |  101 ++++++++++++++++++++++++++++++++
 hw/serial.c              |  143 ++--------------------------------------------
 hw/serial.h              |   73 +++++++++++++++++++++++
 hw/sm501.c               |    2 +-
 hw/sun4u.c               |    1 +
 hw/virtex_ml507.c        |    2 +-
 hw/xtensa_lx60.c         |    3 +-
 30 files changed, 433 insertions(+), 180 deletions(-)
 create mode 100644 docs/pciserial.inf
 create mode 100644 hw/serial-isa.c
 create mode 100644 hw/serial-pci.c
 create mode 100644 hw/serial.h
#1 lore raw

PATCH 1/2 serial: split serial.c

Split serial.c into serial.c, serial.h and serial-isa.c. While being at creating a serial.h header file move the serial prototypes from pc.h to the new serial.h. The latter leads to s/pc.h/serial.h/ in tons of boards which just want the serial bits from pc.h

---
 hw/Makefile.objs         |    2 +-
 hw/alpha_dp264.c         |    1 +
 hw/kzm.c                 |    2 +-
 hw/mips_fulong2e.c       |    1 +
 hw/mips_jazz.c           |    1 +
 hw/mips_malta.c          |    1 +
 hw/mips_mipssim.c        |    2 +-
 hw/mips_r4k.c            |    1 +
 hw/musicpal.c            |    2 +-
 hw/omap_uart.c           |    3 +-
 hw/openrisc_sim.c        |    3 +-
 hw/pc.c                  |    1 +
 hw/pc.h                  |   27 ---------
 hw/petalogix_ml605_mmu.c |    2 +-
 hw/ppc/e500.c            |    2 +-
 hw/ppc405_uc.c           |    2 +-
 hw/ppc440_bamboo.c       |    2 +-
 hw/ppc_prep.c            |    1 +
 hw/pxa2xx.c              |    2 +-
 hw/serial-isa.c          |  130 +++++++++++++++++++++++++++++++++++++++++
 hw/serial.c              |  143 ++--------------------------------------------
 hw/serial.h              |   73 +++++++++++++++++++++++
 hw/sm501.c               |    2 +-
 hw/sun4u.c               |    1 +
 hw/virtex_ml507.c        |    2 +-
 hw/xtensa_lx60.c         |    3 +-
 26 files changed, 232 insertions(+), 180 deletions(-)
 create mode 100644 hw/serial-isa.c
 create mode 100644 hw/serial.h
hw/Makefile.objs +1 -1
index 6dfebd2..7a27889 100644
@@ -20,7 +20,7 @@ hw-obj-$(CONFIG_M48T59) += m48t59.o
 hw-obj-$(CONFIG_ESCC) += escc.o
 hw-obj-$(CONFIG_EMPTY_SLOT) += empty_slot.o
 
-hw-obj-$(CONFIG_SERIAL) += serial.o
+hw-obj-$(CONFIG_SERIAL) += serial.o serial-isa.o
 hw-obj-$(CONFIG_PARALLEL) += parallel.o
 hw-obj-$(CONFIG_I8254) += i8254_common.o i8254.o
 hw-obj-$(CONFIG_PCSPK) += pcspk.o
hw/alpha_dp264.c +1 -0
index 9eb939f..faeb275 100644
@@ -15,6 +15,7 @@
 #include "mc146818rtc.h"
 #include "ide.h"
 #include "i8254.h"
+#include "serial.h"
 
 #define MAX_IDE_BUS 2
 
hw/kzm.c +1 -1
index 68cd1b4..1f3082b 100644
@@ -21,7 +21,7 @@
 #include "net.h"
 #include "sysemu.h"
 #include "boards.h"
-#include "pc.h" /* for the FPGA UART that emulates a 16550 */
+#include "serial.h"
 #include "imx.h"
 
     /* Memory map for Kzm Emulation Baseboard:
hw/mips_fulong2e.c +1 -0
index 38e4b86..8a38cd9 100644
@@ -20,6 +20,7 @@
 
 #include "hw.h"
 #include "pc.h"
+#include "serial.h"
 #include "fdc.h"
 #include "net.h"
 #include "boards.h"
hw/mips_jazz.c +1 -0
index db927f1..d35cd54 100644
@@ -26,6 +26,7 @@
 #include "mips.h"
 #include "mips_cpudevs.h"
 #include "pc.h"
+#include "serial.h"
 #include "isa.h"
 #include "fdc.h"
 #include "sysemu.h"
hw/mips_malta.c +1 -0
index ad23f26..05a1eaa 100644
@@ -24,6 +24,7 @@
 
 #include "hw.h"
 #include "pc.h"
+#include "serial.h"
 #include "fdc.h"
 #include "net.h"
 #include "boards.h"
hw/mips_mipssim.c +1 -1
index 830f635..0ee6756 100644
@@ -27,7 +27,7 @@
 #include "hw.h"
 #include "mips.h"
 #include "mips_cpudevs.h"
-#include "pc.h"
+#include "serial.h"
 #include "isa.h"
 #include "net.h"
 #include "sysemu.h"
hw/mips_r4k.c +1 -0
index 967a76e..b3be80b 100644
@@ -11,6 +11,7 @@
 #include "mips.h"
 #include "mips_cpudevs.h"
 #include "pc.h"
+#include "serial.h"
 #include "isa.h"
 #include "net.h"
 #include "sysemu.h"
hw/musicpal.c +1 -1
index f305e21..346fe41 100644
@@ -15,7 +15,7 @@
 #include "net.h"
 #include "sysemu.h"
 #include "boards.h"
-#include "pc.h"
+#include "serial.h"
 #include "qemu-timer.h"
 #include "ptimer.h"
 #include "block.h"
hw/omap_uart.c +1 -2
index 167d5c4..1c16a54 100644
@@ -20,8 +20,7 @@
 #include "qemu-char.h"
 #include "hw.h"
 #include "omap.h"
-/* We use pc-style serial ports.  */
-#include "pc.h"
+#include "serial.h"
 #include "exec-memory.h"
 
 /* UARTs */
hw/openrisc_sim.c +2 -1
index 55e97f0..e484613 100644
@@ -21,7 +21,8 @@
 #include "hw.h"
 #include "boards.h"
 #include "elf.h"
-#include "pc.h"
+#include "serial.h"
+#include "net.h"
 #include "loader.h"
 #include "exec-memory.h"
 #include "sysemu.h"
hw/pc.c +1 -0
index 7e7e0e2..f056777 100644
@@ -23,6 +23,7 @@
  */
 #include "hw.h"
 #include "pc.h"
+#include "serial.h"
 #include "apic.h"
 #include "fdc.h"
 #include "ide.h"
hw/pc.h +0 -27
index e4db071..170a265 100644
@@ -12,33 +12,6 @@
 
 /* PC-style peripherals (also used by other machines).  */
 
-/* serial.c */
-
-SerialState *serial_init(int base, qemu_irq irq, int baudbase,
-                         CharDriverState *chr);
-SerialState *serial_mm_init(MemoryRegion *address_space,
-                            target_phys_addr_t base, int it_shift,
-                            qemu_irq irq, int baudbase,
-                            CharDriverState *chr, enum device_endian);
-static inline bool serial_isa_init(ISABus *bus, int index,
-                                   CharDriverState *chr)
-{
-    ISADevice *dev;
-
-    dev = isa_try_create(bus, "isa-serial");
-    if (!dev) {
-        return false;
-    }
-    qdev_prop_set_uint32(&dev->qdev, "index", index);
-    qdev_prop_set_chr(&dev->qdev, "chardev", chr);
-    if (qdev_init(&dev->qdev) < 0) {
-        return false;
-    }
-    return true;
-}
-
-void serial_set_frequency(SerialState *s, uint32_t frequency);
-
 /* parallel.c */
 static inline bool parallel_init(ISABus *bus, int index, CharDriverState *chr)
 {
hw/petalogix_ml605_mmu.c +1 -1
index dced648..03f68e8 100644
@@ -34,7 +34,7 @@
 #include "boards.h"
 #include "xilinx.h"
 #include "blockdev.h"
-#include "pc.h"
+#include "serial.h"
 #include "exec-memory.h"
 
 #include "microblaze_boot.h"
hw/ppc/e500.c +1 -1
index 6f0de6d..466435a 100644
@@ -19,7 +19,7 @@
 #include "e500.h"
 #include "net.h"
 #include "hw/hw.h"
-#include "hw/pc.h"
+#include "hw/serial.h"
 #include "hw/pci.h"
 #include "hw/boards.h"
 #include "sysemu.h"
hw/ppc405_uc.c +1 -1
index 89e5013..3d3c33c 100644
@@ -24,7 +24,7 @@
 #include "hw.h"
 #include "ppc.h"
 #include "ppc405.h"
-#include "pc.h"
+#include "serial.h"
 #include "qemu-timer.h"
 #include "sysemu.h"
 #include "qemu-log.h"
hw/ppc440_bamboo.c +1 -1
index c198071..7e6fa85 100644
@@ -23,7 +23,7 @@
 #include "loader.h"
 #include "elf.h"
 #include "exec-memory.h"
-#include "pc.h"
+#include "serial.h"
 #include "ppc.h"
 #include "ppc405.h"
 #include "sysemu.h"
hw/ppc_prep.c +1 -0
index 592b7b2..0390800 100644
@@ -24,6 +24,7 @@
 #include "hw.h"
 #include "nvram.h"
 #include "pc.h"
+#include "serial.h"
 #include "fdc.h"
 #include "net.h"
 #include "sysemu.h"
hw/pxa2xx.c +1 -1
index d5f1420..4ec904f 100644
@@ -10,7 +10,7 @@
 #include "sysbus.h"
 #include "pxa.h"
 #include "sysemu.h"
-#include "pc.h"
+#include "serial.h"
 #include "i2c.h"
 #include "ssi.h"
 #include "qemu-char.h"
hw/serial-isa.c new file +130 -0

130 lines not on this page · raw message

hw/serial.c +5 -138

192 lines not on this page · raw message

hw/serial.h new file +73 -0

73 lines not on this page · raw message

hw/sm501.c +1 -1
index 786e076..050d096 100644
@@ -24,7 +24,7 @@
 
 #include <stdio.h>
 #include "hw.h"
-#include "pc.h"
+#include "serial.h"
 #include "console.h"
 #include "devices.h"
 #include "sysbus.h"
hw/sun4u.c +1 -0
index 07cd042..2a85ddb 100644
@@ -25,6 +25,7 @@
 #include "pci.h"
 #include "apb_pci.h"
 #include "pc.h"
+#include "serial.h"
 #include "nvram.h"
 #include "fdc.h"
 #include "net.h"
hw/virtex_ml507.c +1 -1
index 79bc0d1..6ae5f60 100644
@@ -24,7 +24,7 @@
 
 #include "sysbus.h"
 #include "hw.h"
-#include "pc.h"
+#include "serial.h"
 #include "net.h"
 #include "flash.h"
 #include "sysemu.h"
hw/xtensa_lx60.c +2 -1
index 3653f65..99d8b4f 100644
@@ -31,7 +31,8 @@
 #include "elf.h"
 #include "memory.h"
 #include "exec-memory.h"
-#include "pc.h"
+#include "serial.h"
+#include "net.h"
 #include "sysbus.h"
 #include "flash.h"
 #include "blockdev.h"
Signature · 1 line
1.7.1
#2 lore raw

PATCH 2/2 serial: add pci variant

In reply to Gerd Hoffmann

So we get a hot-pluggable 16550 uart.

---
 default-configs/pci.mak |    2 +
 docs/pciserial.inf      |   96 ++++++++++++++++++++++++++++++++++++++++++++
 hw/Makefile.objs        |    1 +
 hw/pci_ids.h            |    1 +
 hw/serial-pci.c         |  101 +++++++++++++++++++++++++++++++++++++++++++++++
 5 files changed, 201 insertions(+), 0 deletions(-)
 create mode 100644 docs/pciserial.inf
 create mode 100644 hw/serial-pci.c
default-configs/pci.mak +2 -0
index 69e18f1..ae9d1eb 100644
@@ -19,3 +19,5 @@ CONFIG_IDE_PCI=y
 CONFIG_AHCI=y
 CONFIG_ESP=y
 CONFIG_ESP_PCI=y
+CONFIG_SERIAL=y
+CONFIG_SERIAL_PCI=y
docs/pciserial.inf new file +96 -0

96 lines not on this page · raw message

hw/Makefile.objs +1 -0
index 7a27889..9ab8878 100644
@@ -21,6 +21,7 @@ hw-obj-$(CONFIG_ESCC) += escc.o
 hw-obj-$(CONFIG_EMPTY_SLOT) += empty_slot.o
 
 hw-obj-$(CONFIG_SERIAL) += serial.o serial-isa.o
+hw-obj-$(CONFIG_SERIAL_PCI) += serial-pci.o
 hw-obj-$(CONFIG_PARALLEL) += parallel.o
 hw-obj-$(CONFIG_I8254) += i8254_common.o i8254.o
 hw-obj-$(CONFIG_PCSPK) += pcspk.o
hw/pci_ids.h +1 -0
index 301bf1c..c017a79 100644
@@ -37,6 +37,7 @@
 #define PCI_CLASS_BRIDGE_PCI             0x0604
 #define PCI_CLASS_BRIDGE_OTHER           0x0680
 
+#define PCI_CLASS_COMMUNICATION_SERIAL   0x0700
 #define PCI_CLASS_COMMUNICATION_OTHER    0x0780
 
 #define PCI_CLASS_PROCESSOR_CO           0x0b40
hw/serial-pci.c new file +101 -0

101 lines not on this page · raw message

Signature · 1 line
1.7.1
#3 lore raw
In reply to Gerd Hoffmann
Quoted 4 lines · Gerd Hoffmann

Hi,

Two patches, first split up serial.c a bit,
then actually add the pci-based serial device.

The series looks good to me. A couple requests:

1) Could you add a spec describing this new PCI device? Doesn't need to be more than a couple paragraphs since the device is super simple.

2) Could you make the inf file an separate patch and either include documentation in the commit message on how to use it with Windows or just add a comment to the inf file?

This is a new PCI space for QEMU too. Is this a driver that is "owned" by QEMU and Red Hat is donating the PCI id or is this a driver that RH controls that we're implementing?

The only reason I ask is whether this is something we can add new features to. I can't think of one off hand, but it can't hurt to work this out up front.

Regards,

Anthony Liguori

Quoted 43 lines

cheers,
Gerd

Gerd Hoffmann (2):
serial: split serial.c
serial: add pci variant

 default-configs/pci.mak  |    2 +
 docs/pciserial.inf       |   96 +++++++++++++++++++++++++++++++
 hw/Makefile.objs         |    3 +-
 hw/alpha_dp264.c         |    1 +
 hw/kzm.c                 |    2 +-
 hw/mips_fulong2e.c       |    1 +
 hw/mips_jazz.c           |    1 +
 hw/mips_malta.c          |    1 +
 hw/mips_mipssim.c        |    2 +-
 hw/mips_r4k.c            |    1 +
 hw/musicpal.c            |    2 +-
 hw/omap_uart.c           |    3 +-
 hw/openrisc_sim.c        |    3 +-
 hw/pc.c                  |    1 +
 hw/pc.h                  |   27 ---------
 hw/pci_ids.h             |    1 +
 hw/petalogix_ml605_mmu.c |    2 +-
 hw/ppc/e500.c            |    2 +-
 hw/ppc405_uc.c           |    2 +-
 hw/ppc440_bamboo.c       |    2 +-
 hw/ppc_prep.c            |    1 +
 hw/pxa2xx.c              |    2 +-
 hw/serial-isa.c          |  130 +++++++++++++++++++++++++++++++++++++++++
 hw/serial-pci.c          |  101 ++++++++++++++++++++++++++++++++
 hw/serial.c              |  143 ++--------------------------------------------
 hw/serial.h              |   73 +++++++++++++++++++++++
 hw/sm501.c               |    2 +-
 hw/sun4u.c               |    1 +
 hw/virtex_ml507.c        |    2 +-
 hw/xtensa_lx60.c         |    3 +-
 30 files changed, 433 insertions(+), 180 deletions(-)
 create mode 100644 docs/pciserial.inf
 create mode 100644 hw/serial-isa.c
 create mode 100644 hw/serial-pci.c
 create mode 100644 hw/serial.h
#4 lore raw
Quoted 16 lines · Anthony Liguori
Quoted 4 lines · Gerd Hoffmann

Hi,

Two patches, first split up serial.c a bit,
then actually add the pci-based serial device.

The series looks good to me. A couple requests:

1) Could you add a spec describing this new PCI device? Doesn't need to be more than a couple paragraphs since the device is super simple.

2) Could you make the inf file an separate patch and either include documentation in the commit message on how to use it with Windows or just add a comment to the inf file?

Quoted 7 lines

This is a new PCI space for QEMU too. Is this a driver that is "owned" by QEMU and Red Hat is donating the PCI id or is this a driver that RH controls that we're implementing?

The only reason I ask is whether this is something we can add new features to. I can't think of one off hand, but it can't hurt to work this out up front.

Multiport e.g. (to save PCI slots). There was some proposal recently to add a model of an real multiport PCI card, just don't find the mail right now...

Jan

#6 lore raw
In reply to Anthony Liguori
Quoted 11 lines · Anthony Liguori
Quoted 4 lines · Gerd Hoffmann

Hi,

Two patches, first split up serial.c a bit,
then actually add the pci-based serial device.

The series looks good to me. A couple requests:

1) Could you add a spec describing this new PCI device? Doesn't need to be more than a couple paragraphs since the device is super simple.

Well, it is pretty strait forward: A single IO bar, 8 bytes in size, where the 16550 uart is mapped to:

[kraxel@fedora ~]$ lspci -vse
00:0e.0 Serial controller: Red Hat, Inc. Device 0002 (rev 01) (prog-if 00 [8250])
Subsystem: Red Hat, Inc Device 1100
Physical Slot: 14
Flags: fast devsel, IRQ 11
I/O ports at c130 [size=8]
Kernel driver in use: serial

But I can surely add a comment about it.

Quoted 3 lines

2) Could you make the inf file an separate patch and either include documentation in the commit message on how to use it with Windows or just add a comment to the inf file?

I think a comment is better, easier to find than a commit message. Will do.

Quoted 1 line

This is a new PCI space for QEMU too.

It isn't new, I just followed what the pci bridge is doing (which has 1b36:0001).

Quoted 3 lines

Is this a driver that is "owned"
by QEMU and Red Hat is donating the PCI id or is this a driver that RH controls that we're implementing?

I consider it being owned by qemu.

cheers,
Gerd

#5 lore raw
In reply to Jan Kiszka

Hi,

Quoted 7 lines
Quoted 3 lines

The only reason I ask is whether this is something we can add new features to. I can't think of one off hand, but it can't hurt to work this out up front.

Multiport e.g. (to save PCI slots). There was some proposal recently to add a model of an real multiport PCI card, just don't find the mail right now...

Easy enough to add. Should be a separate device with its own pci id though. According to the linux source code there seem to be two common ways to implement this: A single, large pci bar where all uarts are mapped one after the other. Or one pci bar for each uart. Now I need to figure which is easier to handle for windows guests ...

cheers,
Gerd

#7 lore raw
In reply to Gerd Hoffmann
Quoted 25 lines · Gerd Hoffmann
Quoted 11 lines · Anthony Liguori
Quoted 4 lines · Gerd Hoffmann

Hi,

Two patches, first split up serial.c a bit,
then actually add the pci-based serial device.

The series looks good to me. A couple requests:

1) Could you add a spec describing this new PCI device? Doesn't need to be more than a couple paragraphs since the device is super simple.

Well, it is pretty strait forward: A single IO bar, 8 bytes in size, where the 16550 uart is mapped to:

[kraxel@fedora ~]$ lspci -vse
00:0e.0 Serial controller: Red Hat, Inc. Device 0002 (rev 01) (prog-if 00 [8250])
Subsystem: Red Hat, Inc Device 1100
Physical Slot: 14
Flags: fast devsel, IRQ 11
I/O ports at c130 [size=8]
Kernel driver in use: serial

Quoted 1 line

But I can surely add a comment about it.

Understood, but I'd really prefer a file in docs/. We should be rigorous about having formal specs for all of our paravirtual devices. The code shouldn't be the spec.

Quoted 7 lines
Quoted 4 lines

2) Could you make the inf file an separate patch and either include documentation in the commit message on how to use it with Windows or just add a comment to the inf file?

I think a comment is better, easier to find than a commit message. Will do.

So do I. Thanks.

Quoted 4 lines
Quoted 1 line

This is a new PCI space for QEMU too.

It isn't new, I just followed what the pci bridge is doing (which has 1b36:0001).

Ah, Michael, could you add a quick spec to docs for the pci_bridge device?

Quoted 6 lines
Quoted 4 lines

Is this a driver that is "owned"
by QEMU and Red Hat is donating the PCI id or is this a driver that RH controls that we're implementing?

I consider it being owned by qemu.

Great.

Regards,

Anthony Liguori

Quoted 3 lines

cheers,
Gerd

#8 lore raw

Hi,

Quoted 3 lines

Understood, but I'd really prefer a file in docs/. We should be rigorous about having formal specs for all of our paravirtual devices. The code shouldn't be the spec.

Well, pci-serial and pci-bridge are *not* paravirtual devices.

They follow a specification describing the programming interface, and likewise does real hardware. Same is true for all usb host controllers and ahci btw. I can certainly place a text file for pci-serial in docs/spec/, but there isn't much qemu-specific to specify ...

Guests have generic drivers which just match the PCI class and programming interface fields in the pci config space and don't care (much) what the pci id is. The pci id is used to print the name of the hardware, apply quirks, handle vendor-specific extensions, and in case of pci-serial windows also uses it to figure whenever the device is just a serial port or a modem (behind a 16550).

Whenever we'll pick the pci ids of existing hardware or assign a unique one is a matter of taste. Picking unique IDs from Red Hat vendor space doesn't make the devices paravirtual. usb controllers and ahci got IDs matching the ones of the intel chipsets (piix, q35) emulated by qemu, which makes sense in that case.

For pci-serial windows needs a "driver" (which is just a inf file, the driver itself is shipped by windows). So in that case it is easier to go with our own ids I think, as we can simply ship a inf file then. When picking the IDs of other cards, existing as real hardware, users would have to hunt down the (non-redistributable) driver package for the real hardware to get it going in windows.

cheers,
Gerd

#9 lore raw
Quoted 33 lines · Gerd Hoffmann

Hi,

Quoted 3 lines

Understood, but I'd really prefer a file in docs/. We should be rigorous about having formal specs for all of our paravirtual devices. The code shouldn't be the spec.

Well, pci-serial and pci-bridge are *not* paravirtual devices.

They follow a specification describing the programming interface, and likewise does real hardware. Same is true for all usb host controllers and ahci btw. I can certainly place a text file for pci-serial in docs/spec/, but there isn't much qemu-specific to specify ...

Guests have generic drivers which just match the PCI class and programming interface fields in the pci config space and don't care (much) what the pci id is. The pci id is used to print the name of the hardware, apply quirks, handle vendor-specific extensions, and in case of pci-serial windows also uses it to figure whenever the device is just a serial port or a modem (behind a 16550).

Whenever we'll pick the pci ids of existing hardware or assign a unique one is a matter of taste. Picking unique IDs from Red Hat vendor space doesn't make the devices paravirtual. usb controllers and ahci got IDs matching the ones of the intel chipsets (piix, q35) emulated by qemu, which makes sense in that case.

For pci-serial windows needs a "driver" (which is just a inf file, the driver itself is shipped by windows). So in that case it is easier to go with our own ids I think, as we can simply ship a inf file then. When picking the IDs of other cards, existing as real hardware, users would have to hunt down the (non-redistributable) driver package for the real hardware to get it going in windows.

Quoted 2 lines

cheers,
Gerd

Any way to bypass the need to distribute the inf?

Signature · 1 line
MST
#11 lore raw
In reply to Anthony Liguori
Quoted 43 lines · Anthony Liguori
Quoted 25 lines · Gerd Hoffmann
Quoted 11 lines · Anthony Liguori
Quoted 4 lines · Gerd Hoffmann

Hi,

Two patches, first split up serial.c a bit,
then actually add the pci-based serial device.

The series looks good to me. A couple requests:

1) Could you add a spec describing this new PCI device? Doesn't need to be more than a couple paragraphs since the device is super simple.

Well, it is pretty strait forward: A single IO bar, 8 bytes in size, where the 16550 uart is mapped to:

[kraxel@fedora ~]$ lspci -vse
00:0e.0 Serial controller: Red Hat, Inc. Device 0002 (rev 01) (prog-if 00 [8250])
Subsystem: Red Hat, Inc Device 1100
Physical Slot: 14
Flags: fast devsel, IRQ 11
I/O ports at c130 [size=8]
Kernel driver in use: serial

Quoted 1 line

But I can surely add a comment about it.

Understood, but I'd really prefer a file in docs/. We should be rigorous about having formal specs for all of our paravirtual devices. The code shouldn't be the spec.

Quoted 7 lines
Quoted 4 lines

2) Could you make the inf file an separate patch and either include documentation in the commit message on how to use it with Windows or just add a comment to the inf file?

I think a comment is better, easier to find than a commit message. Will do.

So do I. Thanks.

Quoted 7 lines
Quoted 4 lines
Quoted 1 line

This is a new PCI space for QEMU too.

It isn't new, I just followed what the pci bridge is doing (which has 1b36:0001).

Ah, Michael, could you add a quick spec to docs for the pci_bridge device?

What exactly would you like to see in this spec?

Quoted 16 lines
Quoted 6 lines
Quoted 4 lines

Is this a driver that is "owned"
by QEMU and Red Hat is donating the PCI id or is this a driver that RH controls that we're implementing?

I consider it being owned by qemu.

Great.

Regards,

Anthony Liguori

Quoted 3 lines

cheers,
Gerd

#10 lore raw
In reply to Michael S. Tsirkin

Hi,

Quoted 11 lines
Quoted 9 lines

For pci-serial windows needs a "driver" (which is just a inf file, the driver itself is shipped by windows). So in that case it is easier to go with our own ids I think, as we can simply ship a inf file then. When picking the IDs of other cards, existing as real hardware, users would have to hunt down the (non-redistributable) driver package for the real hardware to get it going in windows.

cheers,
Gerd

Any way to bypass the need to distribute the inf?

The usual way to pick ids supported by windows out-of-the-box unfortunaly doesn't fly for pci-serial cards. I'm happy that we don't have to code anything and just the inf file to hook up the serial.sys shipped by windows is enougth. I'm certainly open for better ideas though ...

cheers,
Gerd