qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re:Re:Re:Re:Re: qemu not support serial crtscts


From: 付小明
Subject: Re:Re:Re:Re:Re: qemu not support serial crtscts
Date: Wed, 6 Apr 2022 14:47:12 +0800 (CST)


HI, everyone!
      
Is there any progress on this issue?
   


I am looking forward to your reply

Xiaoming Fu



At 2022-03-22 10:27:03, "付小明" <fxm16899@163.com> wrote:

Could you provide more detail, please? For a bug report it
is useful to know:
 * what you were trying to do
 * what happened
 * what you expected to happen
 * full details like the QEMU command line
 * what guest software you were running

Ideally, the report should have everything we need to be
able to reproduce the problem ourselves.

--》 the machine's guest is linux, the machine's host is centos.qemu not support serial hardware flow control
in the guest , use the serial hardware flow control by the minicom.
I find the guest serial stty -F /dev/ttyS0 -a is crtscts. But host the serial stty -F /dev/ttyS0 -a is -crtscts.
the function relation is 
>> serial_ioport_write(serial.c) -> serial_update_parameters(serial.c) -> qemu_chr_fe_ioctl(serial.c) -> tty_serial_ioctl(char-serial.c) -> tty_serial_init(char-serial.c)
 In the guest set  the speed, parity,data_bits,stop_bits, qemu can get them by  the function serial_update_parameters.  But qemu can not get the hardware flow control of the guest set.
the speed, parity,data_bits,stop_bits is see LCR, like this
the hardware flow control is may see MCR, but code no it.
serial_ioport_write(serial.c) can change LCR、MCR

We can slove it? I am looking forward your reply and communicating with you.

Xiaoming Fu







在 2022-03-17 14:13:45,"付小明" <fxm16899@163.com> 写道:

Could you provide more detail, please? For a bug report it
is useful to know:
 * what you were trying to do
 * what happened
 * what you expected to happen
 * full details like the QEMU command line
 * what guest software you were running

Ideally, the report should have everything we need to be
able to reproduce the problem ourselves.

--》 the machine's guest is linux, the machine's host is centos.qemu not support serial hardware flow control
in the guest , use the serial hardware flow control by the minicom.
qemu arg  :  -chardev tty,id=charserial0,path=/dev/ttyS0 -device pci-serial,chardev=charserial0,id=serial0,bus=pci.0,addr=0x17 -add-fd set=5,fd=28

libvirt xml: 

<serial type="dev">
      <source path="/dev/ttyS0"/>
      <target type="pci-serial"/>
      <address type="pci" domain="0x0000" bus="0x00" slot="0x17" function="0x0"/>
    </serial>


I find the guest serial stty -F /dev/ttyS0 -a is crtscts. But host the serial stty -F /dev/ttyS0 -a is -crtscts!
Because qemu is not support hardware flow control


Xiaoming Fu




At 2022-03-16 21:27:40, "付小明" <fxm16899@163.com> wrote:

YES, I trace. But I do not  find regular.
In the guest ,I use the minicom to test.
minicomcrts.txt is the qemu log of use hardware flow control 
minicomnocrts.txt is the qemu log of not use hardware flow control
I add qemu log in serial.c, you can see it.


>Ah, so is the guest changing the speed/parity etc but that's having the
>side effect of clearing the flags, because CHR_IOCTL_SERIAL_SET_PARAMS
>calls tty_serial_init?
---->  speed/parity etc is see LCR
        harware flow control is see MCR

You can test is
1、the guest is linux;the host is linux. You can use the minicom -s to set hardware flow control or not set hardware flow control
2、qemu arg  :  -chardev tty,id=charserial0,path=/dev/ttyS0 -device pci-serial,chardev=charserial0,id=serial0,bus=pci.0,addr=0x17 -add-fd set=5,fd=28

3、libvirt xml: 

<serial type="dev">
      <source path="/dev/ttyS0"/>
      <target type="pci-serial"/>
      <address type="pci" domain="0x0000" bus="0x00" slot="0x17" function="0x0"/>
    </serial>


I am looking forward to your reply

Xiaoming Fu

在 2022-03-16 19:28:01,"Dr. David Alan Gilbert" <dgilbert@redhat.com> 写道: >* 付小明 (fxm16899@163.com) wrote: >> the function relation is >> serial_ioport_write(serial.c) -> serial_update_parameters(serial.c) -> qemu_chr_fe_ioctl(serial.c) -> tty_serial_ioctl(char-serial.c) -> tty_serial_init(char-serial.c) >> >> >> in tty_serial_init: tty.c_cflag &= ~(CSIZE | PARENB | PARODD | CRTSCTS | CSTOPB); is set no hardware flow control(-crtscts) >> tty.c_cflag |= CRTSCTS is set hardware fow control(crtscts) > >Ah, so is the guest changing the speed/parity etc but that's having the >side effect of clearing the flags, because CHR_IOCTL_SERIAL_SET_PARAMS >calls tty_serial_init? > >I think you'd need to show a trace of all the serial ioport writes to >explain what's happening. > >Dave > >> >> >> >> 2、the app in the guest set the speed, parity,data_bits,stop_bits, qemu can get them by the function serial_update_parameters. But qemu can not get the hardware flow control of the guest set。 >> 3、I find some knowledge. Hardware flow control is RTS/CTS . We can see MCR. >> >> >> >> So I try code like this : >> >> if ((s->mcr & 0x02) && (s->mcr & 0x01) && ((~(s->msr)) & 0x10)) { >> >> up_crtscts = 1; >> >> } else { >> >> up_crtscts = 0; >> >> } >> >> But RTS is no right. Because the RTS is enable when set hardware flow control and not set hardware flow control .This is may a qemu bug >> I think the RTS is enable when set hardware flow control ; the RTS is not enable when not set hardware flow control. >> >> >> I need your help! I am looking forward your reply! >> >> >> 在 2022-03-16 18:32:59,"Dr. David Alan Gilbert" <dgilbert@redhat.com> 写道: >> >* 付小明 (fxm16899@163.com) wrote: >> >> hi all >> >> information >> >> -chardev tty,id=charserial0,path=/dev/ttyS0 -device pci-serial,chardev=charserial0,id=serial0,bus=pci.0,addr=0x17 -add-fd set=5,fd=28 -chardev tty,id=charserial1,path=/dev/ttyS1 -device pci-serial,chardev=charserial1,id=serial1,bus=pci.0,addr=0x18 -add-fd set=6,fd=29 -chardev tty,id=charserial2,path=/dev/ttyS2 -device pci-serial,chardev=charserial2,id=serial2,bus=pci.0,addr=0x19 -add-fd set=7,fd=30 -chardev tty,id=charserial3,path=/dev/ttyS3 -device pci-serial,chardev=charserial3,id=serial3,bus=pci.0,addr=0x1a >> > >> >Hi, >> > It's a while since I tried it; I think I would try adding debug to >> >see if char-serial.c tty_serial_ioctl is called. >> > >> >Dave >> > >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> At 2022-03-16 14:38:47, "付小明" <fxm16899@163.com> wrote: >> >> >> >> >> >> >> >> >> >> HI ,ALL >> >> Nice to meet you! I need your help. I find a bug in qemu. qemu not support serial hardware flow control >> >> 1、Problem: the machine's guest is windows, the machine's host is centos. The qemu emulation pci-serial. >> >> A printer (model is BTP-2001cp)use the serial to print. The machine connect the printer by serial port. >> >> The data printed by the printer is missing some data.You can see picture 1 is lost some data, picture 2 is normal.Because the printer need hardware flow control. >> >> This is a bug: >> >> the machine's guest is windows, the machine's host is centos. The qemu emulation pci-serial. >> >> A printer (model is BTP-2001cp)use the serial to print. The machine connect the printer by serial port. >> >> The data printed by the printer is missing some data >> >> because qemu not support serial hardware flow control。 >> >> 2、Problem: the machine's guest is linux, the machine's host is centos.qemu not support serial hardware flow control >> >> in the guest , use the serial hardware flow control by minicom. I find the guest serial stty -F /dev/ttyS0 -a is crtscts. But host the serial stty -F /dev/ttyS0 -a is -crtscts. >> >> >> >> >> >> I need your help! I am looking forward your reply >> >> >> >> >> >> >> >> >> >> Xiaoming Fu >> >> >> >> >> >> -------- Forwarding messages -------- >> >> From: "付小明" <fxm16899@163.com> >> >> Date: 2022-03-15 10:11:11 >> >> To: "Peter Maydell" <peter.maydell@linaro.org> >> >> Cc: "QEMU Developers" <qemu-devel@nongnu.org> >> >> Subject: Re:Re: set qemu support serial crtscts >> >> >> >> Hi, Peter and all developers >> >> Yes, I need to describe it clearly. >> >> 1、I want make the qemu serial support crtscts >> >> 2、Problem: the machine's guest is windows, the machine's host is centos. The qemu emulation pci-serial. >> >> A printer (model is BTP-2001cp)use the serial to print. The machine connect the printer by serial port. >> >> The data printed by the printer is missing some data.You can see picture 1 is lost some data, picture 2 is normal. >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> At 2021-04-14 21:24:20, "Peter Maydell" <peter.maydell@linaro.org> wrote: >> >> >On Wed, 14 Apr 2021 at 14:18, 付小明 <fxm16899@163.com> wrote: >> >> >> >> >> >> HI, I have find qemu serial not support crtscts. This result some >> >> >> machine not communication, because this machine need crtscts >> >> > >> >> >Could you provide more detail, please? For a bug report it >> >> >is useful to know: >> >> > * what you were trying to do >> >> > * what happened >> >> > * what you expected to happen >> >> > * full details like the QEMU command line >> >> > * what guest software you were running >> >> > >> >> >Ideally, the report should have everything we need to be >> >> >able to reproduce the problem ourselves. >> >> > >> >> >thanks >> >> >-- PMM >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> > >> > >> > >> >-- >> >Dr. David Alan Gilbert / dgilbert@redhat.com / Manchester, UK > > > > > >-- >Dr. David Alan Gilbert / dgilbert@redhat.com / Manchester, UK


 



 



 



 


reply via email to

[Prev in Thread] Current Thread [Next in Thread]