qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Philippe Mathieu-Daudé" <philmd@redhat.com>
To: "Marc-André Lureau" <marcandre.lureau@redhat.com>,
	"Aleksandar Markovic" <aleksandar.m.mail@gmail.com>
Cc: Damien Hedde <damien.hedde@greensocs.com>,
	"peter.maydell@linaro.org" <peter.maydell@linaro.org>,
	"qemu-devel@nongnu.org" <qemu-devel@nongnu.org>,
	Laurent Vivier <laurent@vivier.eu>,
	Aleksandar Markovic <amarkovic@wavecomp.com>,
	Aleksandar Rikalo <aleksandar.rikalo@rt-rk.com>,
	Aurelien Jarno <aurelien@aurel32.net>
Subject: Re: [PATCH v4 18/37] mips: baudbase is 115200 by default
Date: Mon, 25 Nov 2019 14:03:54 +0100	[thread overview]
Message-ID: <8992c003-5d65-77e9-17eb-592449cf9fdc@redhat.com> (raw)
In-Reply-To: <c61a0426-bf43-9afe-3110-51bb11d75bd1@redhat.com>

On 11/25/19 1:54 PM, Philippe Mathieu-Daudé wrote:
> On 11/25/19 12:26 PM, Philippe Mathieu-Daudé wrote:
>> On 11/25/19 11:12 AM, Marc-André Lureau wrote:
>>> Hi
>>>
>>> On Mon, Nov 25, 2019 at 2:07 PM Aleksandar Markovic
>>> <aleksandar.m.mail@gmail.com> wrote:
>>>>
>>>>
>>>>
>>>> On Wednesday, November 20, 2019, Marc-André Lureau 
>>>> <marcandre.lureau@redhat.com> wrote:
>>>>>
>>>>> Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
>>>>> ---
>>>>>   hw/mips/mips_mipssim.c | 1 -
>>>>>   1 file changed, 1 deletion(-)
>>>>>
>>>>> diff --git a/hw/mips/mips_mipssim.c b/hw/mips/mips_mipssim.c
>>>>> index bfafa4d7e9..3cd0e6eb33 100644
>>>>> --- a/hw/mips/mips_mipssim.c
>>>>> +++ b/hw/mips/mips_mipssim.c
>>>>> @@ -223,7 +223,6 @@ mips_mipssim_init(MachineState *machine)
>>>>>       if (serial_hd(0)) {
>>>>>           DeviceState *dev = qdev_create(NULL, TYPE_SERIAL_IO);
>>>>>
>>>>> -        qdev_prop_set_uint32(DEVICE(dev), "baudbase", 115200);
>>>>>           qdev_prop_set_chr(dev, "chardev", serial_hd(0));
>>>>>           qdev_set_legacy_instance_id(dev, 0x3f8, 2);
>>>>>           qdev_init_nofail(dev);
>>>>> -- 
>>>>
>>>>
>>>> Please mention in your commit message where the default baudbase is 
>>>> set.
>>>
>>> ok
>>>
>>>> Also, is there a guarantie that default value 115200 will never 
>>>> change in future?
>>>
>>> The level of stability on properties in general is unclear to me.
>>>
>>> Given that 115200 is standard for serial, it is unlikely to change
>>> though.. We can have an assert there instead?
>>>
>>> Peter, what do you think? thanks

IOW, until we merge Damien's "Clock framework API" series, I'd:

- rename 'baudbase' -> 'input_frequency_hz'

- set a 0 default value

  DEFINE_PROP_UINT32("input-frequency-hz", SerialState,
                      input_frequency_hz, 0),

- add a check in serial_realize()

     if (s->input_frequency_hz == 0) {
         error_setg(errp,
               "serial: input-frequency-hz property must be set");
         return;
     }

[*] https://www.mail-archive.com/qemu-devel@nongnu.org/msg642174.html

>> This property confused me by the past. It is _not_ the baudrate.
>> It is the input frequency clocking the UART ('XIN' pin, Xtal INput).
>>
>> Each board has its own frequency, and it can even be variable (the 
>> clock domain tree can reconfigure it at a different rate).
> 
> Laurent pointed me to the following commit which confirms my 
> interpretation:
> 
> $ git show 038eaf82c853
> commit 038eaf82c853f3bf8d4c106c0677bbf4adada7de
> Author: Stefan Weil <weil@mail.berlios.de>
> Date:   Sat Oct 31 11:28:11 2009 +0100
> 
>      serial: Add interface to set reference oscillator frequency
> 
>      Many (most?) serial interfaces have a programmable
>      clock which provides the reference frequency ("baudbase").
>      So a fixed baudbase which is only set once can be wrong.
> 
>      omap1.c is an example which could use the new interface
>      to change baudbase when the programmable clock changes.
>      ar7 system emulation (still not part of standard QEMU)
>      is similar to omap and already uses serial_set_frequency.
> 
>      Signed-off-by: Stefan Weil <weil@mail.berlios.de>
>      Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
> 
> diff --git a/hw/pc.h b/hw/pc.h
> index 15fff8d103..03ffc91536 100644
> --- a/hw/pc.h
> +++ b/hw/pc.h
> @@ -13,6 +13,7 @@ SerialState *serial_mm_init (target_phys_addr_t base, 
> int it_shift,
>                                qemu_irq irq, int baudbase,
>                                CharDriverState *chr, int ioregister);
>   SerialState *serial_isa_init(int index, CharDriverState *chr);
> +void serial_set_frequency(SerialState *s, uint32_t frequency);
> 
>   /* parallel.c */
> 
> diff --git a/hw/serial.c b/hw/serial.c
> index fa12dcc075..0063260569 100644
> --- a/hw/serial.c
> +++ b/hw/serial.c
> @@ -730,6 +730,13 @@ static void serial_init_core(SerialState *s)
>                             serial_event, s);
>   }
> 
> +/* Change the main reference oscillator frequency. */
> +void serial_set_frequency(SerialState *s, uint32_t frequency)
> +{
> +    s->baudbase = frequency;
> +    serial_update_parameters(s);
> +}
> +



  reply	other threads:[~2019-11-25 13:06 UTC|newest]

Thread overview: 107+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-11-20 15:24 [PATCH v4 00/37] Clean-ups: qom-ify serial and remove QDEV_PROP_PTR Marc-André Lureau
2019-11-20 15:24 ` [PATCH v4 01/37] qdev: remove unused qdev_prop_int64 Marc-André Lureau
2019-12-02  5:22   ` Markus Armbruster
2019-12-02 10:29     ` Marc-André Lureau
2019-11-20 15:24 ` [PATCH v4 02/37] sysbus: remove unused sysbus_try_create* Marc-André Lureau
2019-11-20 15:24 ` [PATCH v4 03/37] sysbus: remove outdated comment Marc-André Lureau
2019-11-20 15:24 ` [PATCH v4 04/37] chardev: generate an internal id when none given Marc-André Lureau
2019-11-20 15:24 ` [PATCH v4 05/37] serial-pci-multi: factor out multi_serial_get_port_count() Marc-André Lureau
2019-11-20 15:24 ` [PATCH v4 06/37] serial: initial qom-ification Marc-André Lureau
2019-11-20 16:40   ` Philippe Mathieu-Daudé
2019-11-20 16:45     ` Marc-André Lureau
2019-11-21 13:39   ` Peter Maydell
2019-11-20 15:24 ` [PATCH v4 07/37] serial: register vmsd with DeviceClass Marc-André Lureau
2019-11-20 15:24 ` [PATCH v4 08/37] serial: add "chardev" property Marc-André Lureau
2019-11-20 15:24 ` [PATCH v4 09/37] serial: add "baudbase" property Marc-André Lureau
2019-11-20 15:24 ` [PATCH v4 10/37] serial: realize the serial device Marc-André Lureau
2019-11-20 16:12   ` Philippe Mathieu-Daudé
2019-11-20 15:24 ` [PATCH v4 11/37] serial: replace serial_exit_core() with unrealize Marc-André Lureau
2019-11-20 15:24 ` [PATCH v4 12/37] serial: start making SerialMM a sysbus device Marc-André Lureau
2019-11-21 13:47   ` Peter Maydell
2019-11-21 18:15     ` Marc-André Lureau
2019-11-21 18:24       ` Peter Maydell
2019-11-21 18:51         ` Marc-André Lureau
2019-11-22 10:10           ` Peter Maydell
2019-11-22 12:02             ` Marc-André Lureau
2019-11-20 15:24 ` [PATCH v4 13/37] serial-mm: add "regshift" property Marc-André Lureau
2019-11-20 15:24 ` [PATCH v4 14/37] serial-mm: add endianness property Marc-André Lureau
2019-11-20 15:24 ` [PATCH v4 15/37] serial-mm: use sysbus facilities Marc-André Lureau
2019-11-20 15:24 ` [PATCH v4 16/37] serial: make SerialIO a sysbus device Marc-André Lureau
2019-11-20 16:18   ` Philippe Mathieu-Daudé
2019-11-20 15:24 ` [PATCH v4 17/37] mips: inline serial_init() Marc-André Lureau
2019-11-20 16:17   ` Philippe Mathieu-Daudé
2019-11-25 10:12   ` Aleksandar Markovic
2019-11-25 10:15     ` Marc-André Lureau
2019-11-25 13:33       ` Aleksandar Markovic
2019-11-25 19:13         ` Marc-André Lureau
2019-11-27 12:22   ` Aleksandar Markovic
2019-11-20 15:24 ` [PATCH v4 18/37] mips: baudbase is 115200 by default Marc-André Lureau
2019-11-21 13:39   ` Peter Maydell
2019-11-25 10:07   ` Aleksandar Markovic
2019-11-25 10:12     ` Marc-André Lureau
2019-11-25 11:26       ` Philippe Mathieu-Daudé
2019-11-25 12:22         ` Aleksandar Markovic
2019-11-25 12:54         ` Philippe Mathieu-Daudé
2019-11-25 13:03           ` Philippe Mathieu-Daudé [this message]
2019-11-27 12:07             ` Marc-André Lureau
2019-11-27 12:20               ` Aleksandar Markovic
2019-11-20 15:24 ` [PATCH v4 19/37] mips: use sysbus_add_io() Marc-André Lureau
2019-11-21 13:40   ` Peter Maydell
2019-11-27 12:28   ` Aleksandar Markovic
2019-12-15  5:40   ` Philippe Mathieu-Daudé
2019-11-20 15:24 ` [PATCH v4 20/37] mips: use sysbus_mmio_get_region() instead of internal fields Marc-André Lureau
2019-11-21 13:48   ` Peter Maydell
2019-11-27 12:23   ` Aleksandar Markovic
2019-12-15  5:39   ` Philippe Mathieu-Daudé
2019-11-20 15:24 ` [PATCH v4 21/37] sm501: make SerialMM a child, export chardev property Marc-André Lureau
2019-11-21 14:00   ` Peter Maydell
2019-11-25 19:47     ` Marc-André Lureau
2019-11-20 15:24 ` [PATCH v4 22/37] vmmouse: replace PROP_PTR with PROP_LINK Marc-André Lureau
2019-11-20 15:24 ` [PATCH v4 23/37] lance: " Marc-André Lureau
2019-11-20 15:24 ` [PATCH v4 24/37] etraxfs: remove PROP_PTR usage Marc-André Lureau
2019-11-20 15:24 ` [PATCH v4 25/37] dp8393x: replace PROP_PTR with PROP_LINK Marc-André Lureau
2019-11-20 22:58   ` Laurent Vivier
2019-11-20 15:24 ` [PATCH v4 26/37] leon3: use qemu_irq framework instead of callback as property Marc-André Lureau
2019-11-20 15:24 ` [PATCH v4 27/37] leon3: use qdev gpio facilities for the PIL Marc-André Lureau
2019-11-21 13:51   ` Peter Maydell
2019-12-15  6:10     ` Philippe Mathieu-Daudé
2019-12-19 12:44       ` Marc-André Lureau
2019-11-20 15:24 ` [PATCH v4 28/37] qdev: use g_strcmp0() instead of open-coding it Marc-André Lureau
2019-11-20 16:25   ` Philippe Mathieu-Daudé
2019-11-20 17:10     ` Eduardo Habkost
2019-11-20 15:24 ` [PATCH v4 29/37] RFC: mips/cps: fix setting saar property Marc-André Lureau
2019-12-15  5:56   ` Philippe Mathieu-Daudé
2019-12-16 19:36     ` [EXTERNAL]Re: " Aleksandar Markovic
2019-12-19 13:04       ` Philippe Mathieu-Daudé
2019-11-20 15:24 ` [PATCH v4 30/37] cris: improve passing PIC interrupt vector to the CPU Marc-André Lureau
2019-11-20 16:32   ` Philippe Mathieu-Daudé
2019-11-20 15:24 ` [PATCH v4 31/37] smbus-eeprom: remove PROP_PTR Marc-André Lureau
2019-11-21 22:43   ` Corey Minyard
2019-11-29  9:06     ` Marc-André Lureau
2019-11-29 14:39       ` Corey Minyard
2019-11-22 11:07   ` Philippe Mathieu-Daudé
2019-11-22 11:12     ` Marc-André Lureau
2019-11-22 11:15       ` Philippe Mathieu-Daudé
2019-11-20 15:24 ` [PATCH v4 32/37] omap-intc: " Marc-André Lureau
2019-12-15  5:42   ` Philippe Mathieu-Daudé
2019-11-20 15:24 ` [PATCH v4 33/37] omap-i2c: " Marc-André Lureau
2019-12-15  5:43   ` Philippe Mathieu-Daudé
2019-11-20 15:24 ` [PATCH v4 34/37] omap-gpio: " Marc-André Lureau
2019-12-15  5:44   ` Philippe Mathieu-Daudé
2019-11-20 15:24 ` [PATCH v4 35/37] qdev: remove PROP_MEMORY_REGION Marc-André Lureau
2019-11-20 15:24 ` [PATCH v4 36/37] qdev: remove QDEV_PROP_PTR Marc-André Lureau
2019-11-20 15:24 ` [PATCH v4 37/37] qdev/qom: remove some TODO limitations now that PROP_PTR is gone Marc-André Lureau
2019-12-01 10:19 ` [PATCH v4 00/37] Clean-ups: qom-ify serial and remove QDEV_PROP_PTR Marc-André Lureau
2019-12-01 12:15   ` [PATCH v6 " Aleksandar Markovic
2019-12-01 15:35     ` Marc-André Lureau
2019-12-01 19:05       ` Aleksandar Markovic
2019-12-01 19:28         ` Aleksandar Markovic
2019-12-01 17:18   ` [PATCH v4 " Peter Maydell
2019-12-01 17:27     ` Marc-André Lureau
2019-12-01 18:10       ` Peter Maydell
2019-12-02 11:17         ` Marc-André Lureau
2019-12-12 20:17           ` Dr. David Alan Gilbert
2019-12-13 16:34             ` Marc-André Lureau
2019-12-11 12:01   ` Marc-André Lureau
2019-12-15  6:11     ` Philippe Mathieu-Daudé
2019-12-19 13:53     ` Marc-André Lureau

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=8992c003-5d65-77e9-17eb-592449cf9fdc@redhat.com \
    --to=philmd@redhat.com \
    --cc=aleksandar.m.mail@gmail.com \
    --cc=aleksandar.rikalo@rt-rk.com \
    --cc=amarkovic@wavecomp.com \
    --cc=aurelien@aurel32.net \
    --cc=damien.hedde@greensocs.com \
    --cc=laurent@vivier.eu \
    --cc=marcandre.lureau@redhat.com \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-devel@nongnu.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).