Skip to contentSkip to conversation

serial-pci: Set prog interface field of pci config to 16550 compatible

PATCH Applied BALATON Zoltan 4 participants 16 messages Feb 27, 2014 – Mar 21, 2014

v1 of 4 Applied Latest is v4 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 serial-pci: Set prog interface field of pci config to 16550 compatible

---
 hw/char/serial-pci.c | 1 +
 1 file changed, 1 insertion(+)
hw/char/serial-pci.c +1 -0
index 991c99f..e662b77 100644
@@ -60,6 +60,7 @@ static int serial_pci_init(PCIDevice *dev)
         return -1;
     }
 
+    pci->dev.config[PCI_CLASS_PROG] = 0x02; /* 16550 compatible */
     pci->dev.config[PCI_INTERRUPT_PIN] = 0x01;
     s->irq = pci_allocate_irq(&pci->dev);
 
Signature · 1 line
1.8.1.5
#1 lore raw

Ping!
http://patchwork.ozlabs.org/patch/324674/

Quoted 19 lines · BALATON Zoltan

---
hw/char/serial-pci.c | 1 +

1 file changed, 1 insertion(+)
hw/char/serial-pci.c +1 -0
index 991c99f..e662b77 100644
@@ -60,6 +60,7 @@ static int serial_pci_init(PCIDevice *dev)
        return -1;
    }
 
+    pci->dev.config[PCI_CLASS_PROG] = 0x02; /* 16550 compatible */
    pci->dev.config[PCI_INTERRUPT_PIN] = 0x01;
    s->irq = pci_allocate_irq(&pci->dev);
 
Signature · 1 line
1.8.1.5
#2 lore raw
Quoted 17 lines · BALATON Zoltan

Ping!
http://patchwork.ozlabs.org/patch/324674/

Quoted 13 lines · BALATON Zoltan

---
hw/char/serial-pci.c | 1 +

1 file changed, 1 insertion(+)
hw/char/serial-pci.c +0 -0
index 991c99f..e662b77 100644
@@ -60,6 +60,7 @@ static int serial_pci_init(PCIDevice *dev)
        return -1;
    }
 
Quoted 3 lines

hw/char/serial-pci.c static int serial_pci_init(PCIDevice *dev) · line 65

Quoted 3 lines
hw/char/serial-pci.c +1 -0
+    pci->dev.config[PCI_CLASS_PROG] = 0x02; /* 16550 compatible */
    pci->dev.config[PCI_INTERRUPT_PIN] = 0x01;
    s->irq = pci_allocate_irq(&pci->dev);

Hm. While this is an one-liner indeed, I'm not sure it's the right value. From my pci.ids:

C 07 Communication controller

        00  Serial controller
                00  8250
                01  16450
                02  16550
                03  16650
                04  16750
                05  16850
                06  16950

so it seems correct thing to do.

What about multi_serial_pci_init() -- should it too set prog-if like this?

Thanks,

/mjt

#3 lore raw
Quoted 35 lines · Michael Tokarev
Quoted 17 lines · BALATON Zoltan

Ping!
http://patchwork.ozlabs.org/patch/324674/

Quoted 13 lines · BALATON Zoltan

---
hw/char/serial-pci.c | 1 +

1 file changed, 1 insertion(+)
hw/char/serial-pci.c +0 -0
index 991c99f..e662b77 100644
@@ -60,6 +60,7 @@ static int serial_pci_init(PCIDevice *dev)
        return -1;
    }
 
Quoted 3 lines

hw/char/serial-pci.c static int serial_pci_init(PCIDevice *dev) · line 65

Quoted 3 lines
hw/char/serial-pci.c +1 -0
+    pci->dev.config[PCI_CLASS_PROG] = 0x02; /* 16550 compatible */
    pci->dev.config[PCI_INTERRUPT_PIN] = 0x01;
    s->irq = pci_allocate_irq(&pci->dev);

Hm. While this is an one-liner indeed, I'm not sure it's the right value. From my pci.ids:

C 07 Communication controller

       00  Serial controller
               00  8250
               01  16450
               02  16550
               03  16650
               04  16750
               05  16850
               06  16950
Quoted 4 lines

so it seems correct thing to do.

What about multi_serial_pci_init() -- should it too set prog-if like this?

I'm not completely sure what the correct value should be for multi_serial_pci_init so I've left that alone. There's also 07 02 00 that means multiport serial controller that might apply for that case. For the simple case I've sent the patch for I had a client expecting this value so I think it is correct for that at least but I don't know about the multiport case.

Regards,
BALATON Zoltan

#4 lore raw
Quoted 36 lines · BALATON Zoltan
Quoted 35 lines · Michael Tokarev
Quoted 17 lines · BALATON Zoltan

Ping!
http://patchwork.ozlabs.org/patch/324674/

Quoted 13 lines · BALATON Zoltan

---
hw/char/serial-pci.c | 1 +

1 file changed, 1 insertion(+)
hw/char/serial-pci.c +0 -0
index 991c99f..e662b77 100644
@@ -60,6 +60,7 @@ static int serial_pci_init(PCIDevice *dev)
        return -1;
    }
 
Quoted 3 lines

hw/char/serial-pci.c static int serial_pci_init(PCIDevice *dev) · line 65

Quoted 3 lines
hw/char/serial-pci.c +1 -0
+    pci->dev.config[PCI_CLASS_PROG] = 0x02; /* 16550 compatible */
    pci->dev.config[PCI_INTERRUPT_PIN] = 0x01;
    s->irq = pci_allocate_irq(&pci->dev);

Hm. While this is an one-liner indeed, I'm not sure it's the right value. From my pci.ids:

C 07 Communication controller

       00  Serial controller
               00  8250
               01  16450
               02  16550
               03  16650
               04  16750
               05  16850
               06  16950
Quoted 6 lines
Quoted 4 lines

so it seems correct thing to do.

What about multi_serial_pci_init() -- should it too set prog-if like this?

I'm not completely sure what the correct value should be for multi_serial_pci_init so I've left that alone. There's also 07 02 00 that means multiport serial controller that might apply for that case. For the simple case I've sent the patch for I had a client expecting this value so I think it is correct for that at least but I don't know about the multiport case.

Also Gerd Hoffmann said he has picked this patch up so I'm adding him to cc too.

Quoted 2 lines

Regards,
BALATON Zoltan

#5 lore raw
Quoted 18 lines
Quoted 11 lines
Quoted 10 lines

C 07 Communication controller

       00  Serial controller
               00  8250
               01  16450
               02  16550

What about multi_serial_pci_init() -- should it too set prog-if like this?

Quoted 6 lines

I'm not completely sure what the correct value should be for multi_serial_pci_init so I've left that alone. There's also 07 02 00 that means multiport serial controller that might apply for that case. For the simple case I've sent the patch for I had a client expecting this value so I think it is correct for that at least but I don't know about the multiport case.

Quoted 2 lines

Also Gerd Hoffmann said he has picked this patch up so I'm adding him to cc too.

The multiport variants are simply multiple 16550 chips mapped one after the other. So "02" is better than "00".

I don't know what exactly the multiport serial controller is supposed to be.

cheers,
Gerd

#6 lore raw
Quoted 16 lines · Gerd Hoffmann
Quoted 16 lines
Quoted 15 lines
Quoted 8 lines

C 07 Communication controller

       00  Serial controller
               00  8250
               01  16450
               02  16550

What about multi_serial_pci_init() -- should it too set prog-if like this?

I'm not completely sure what the correct value should be for multi_serial_pci_init so I've left that alone. There's also 07 02 00 that means multiport serial controller that might apply for that case. For the simple case I've sent the patch for I had a client expecting this value so I think it is correct for that at least but I don't know about the multiport case.

Quoted 8 lines
Quoted 2 lines

Also Gerd Hoffmann said he has picked this patch up so I'm adding him to cc too.

The multiport variants are simply multiple 16550 chips mapped one after the other. So "02" is better than "00".

I don't know what exactly the multiport serial controller is supposed to be.

So what should we do then? Should I send an updated patch which sets 070002 in the multiport case too?

Regards,
BALATON Zoltan

#11 lore raw
Quoted 8 lines · Paolo Bonzini

Il 20/03/2014 16:42, Michael Tokarev ha scritto:

Quoted 5 lines
Quoted 2 lines · BALATON Zoltan

Ping!
http://patchwork.ozlabs.org/patch/324674/

Thanks, applied to -trivial.

No, please don't; this needs to be done for new machine types only.

Why? I tried running a Windows XP image that was set up before this patch and it did not complain about changed hardware. Or is there another reason I'm missing?

Regards,
BALATON Zoltan

#12 lore raw

Il 20/03/2014 17:01, BALATON Zoltan ha scritto:

Quoted 6 lines · Paolo Bonzini
Quoted 5 lines

Il 20/03/2014 16:42, Michael Tokarev ha scritto:

Quoted 4 lines
Quoted 2 lines · BALATON Zoltan

Ping!
http://patchwork.ozlabs.org/patch/324674/

Quoted 7 lines
Quoted 3 lines
Quoted 1 line

Thanks, applied to -trivial.

No, please don't; this needs to be done for new machine types only.

Why? I tried running a Windows XP image that was set up before this patch and it did not complain about changed hardware. Or is there another reason I'm missing?

Classes (or anything guest-visible in fact) must never ever be changed for the same machine type. It's a rule.

Paolo

#13 lore raw
Quoted 9 lines · Paolo Bonzini

Il 20/03/2014 17:01, BALATON Zoltan ha scritto:

Quoted 8 lines · Paolo Bonzini
Quoted 7 lines

Il 20/03/2014 16:42, Michael Tokarev ha scritto:

Quoted 5 lines
Quoted 2 lines · BALATON Zoltan

Ping!
http://patchwork.ozlabs.org/patch/324674/

Thanks, applied to -trivial.

Quoted 7 lines
Quoted 5 lines
Quoted 1 line

No, please don't; this needs to be done for new machine types only.

Why? I tried running a Windows XP image that was set up before this patch and it did not complain about changed hardware. Or is there another reason I'm missing?

Classes (or anything guest-visible in fact) must never ever be changed for the same machine type. It's a rule.

The class did not change only the prog interface field after it (which is guest visible but I think most guests just ignore it). So then what's the correct way to do it? Do I need to change the patch or can it be merged as it is the next time a new machine type is added?

Regards,
BALATON Zoltan

#14 lore raw

Il 20/03/2014 17:58, BALATON Zoltan ha scritto:

Quoted 8 lines
Quoted 3 lines

Classes (or anything guest-visible in fact) must never ever be changed for the same machine type. It's a rule.

The class did not change only the prog interface field after it (which is guest visible but I think most guests just ignore it). So then what's the correct way to do it? Do I need to change the patch or can it be merged as it is the next time a new machine type is added?

You can wait for the 2.1 machine type to be added.

Paolo

#15 lore raw
In reply to Paolo Bonzini
Quoted 8 lines · Paolo Bonzini

Il 20/03/2014 16:42, Michael Tokarev ha scritto:

Quoted 5 lines
Quoted 2 lines · BALATON Zoltan

Ping!
http://patchwork.ozlabs.org/patch/324674/

Thanks, applied to -trivial.

No, please don't; this needs to be done for new machine types only.

I thought about this too, but decided this is too minor a difference to warrant special per-machine-type handling. Oh well.

/mjt

#7 lore raw
In reply to BALATON Zoltan
Quoted 2 lines · BALATON Zoltan

So what should we do then? Should I send an updated patch which sets 070002 in the multiport case too?

Yes, that would be great.

cheers,
Gerd

#8 lore raw
Quoted 5 lines · Gerd Hoffmann
Quoted 2 lines · BALATON Zoltan

So what should we do then? Should I send an updated patch which sets 070002 in the multiport case too?

Yes, that would be great.

OK, I'll resubmit it after pc-2.1 is added also with the multiport case.

Thank you,
BALATON Zoltan