[PATCH 0/3] hw/misc: QUP UART device

Brian Cain posted 3 patches 3 weeks, 5 days ago
Failed in applying to current master (apply log)
MAINTAINERS                                 |    3 +
docs/system/device-emulation.rst            |    1 +
docs/system/devices/qup.rst                 |   10 +
include/hw/misc/qup-wrapper.h               |   27 +
hw/misc/qup-wrapper.c                       |   90 ++
Cargo.lock                                  |   15 +
Cargo.toml                                  |    1 +
hw/misc/Kconfig                             |    3 +
hw/misc/meson.build                         |    3 +
rust/chardev/src/chardev.rs                 |   82 +-
rust/hw/char/Kconfig                        |    4 +
rust/hw/char/meson.build                    |    1 +
rust/hw/char/qup_geni_uart/Cargo.toml       |   27 +
rust/hw/char/qup_geni_uart/meson.build      |   28 +
rust/hw/char/qup_geni_uart/src/device.rs    | 1293 +++++++++++++++++++
rust/hw/char/qup_geni_uart/src/lib.rs       |    9 +
rust/hw/char/qup_geni_uart/src/registers.rs |  160 +++
17 files changed, 1741 insertions(+), 16 deletions(-)
create mode 100644 docs/system/devices/qup.rst
create mode 100644 include/hw/misc/qup-wrapper.h
create mode 100644 hw/misc/qup-wrapper.c
create mode 100644 rust/hw/char/qup_geni_uart/Cargo.toml
create mode 100644 rust/hw/char/qup_geni_uart/meson.build
create mode 100644 rust/hw/char/qup_geni_uart/src/device.rs
create mode 100644 rust/hw/char/qup_geni_uart/src/lib.rs
create mode 100644 rust/hw/char/qup_geni_uart/src/registers.rs
[PATCH 0/3] hw/misc: QUP UART device
Posted by Brian Cain 3 weeks, 5 days ago
Add the QUP + GENI uart device models.  The QUP is a "Universal Peripheral"
present on Qualcomm SoCs, with connections for SPI, UART, I2C, I3C.  For
now we're only interested in UART.

Will follow up with a v2 including wiring into machines + qtest after
https://lore.kernel.org/qemu-devel/20261027143721.4125584-1-brian.cain@oss.qualcomm.com/
lands.

Brian Cain (3):
  hw/misc: add the QUP wrapper device
  rust/chardev: fix write errors and add write watches
  rust/hw/char: add QUP GENI UART device model

 MAINTAINERS                                 |    3 +
 docs/system/device-emulation.rst            |    1 +
 docs/system/devices/qup.rst                 |   10 +
 include/hw/misc/qup-wrapper.h               |   27 +
 hw/misc/qup-wrapper.c                       |   90 ++
 Cargo.lock                                  |   15 +
 Cargo.toml                                  |    1 +
 hw/misc/Kconfig                             |    3 +
 hw/misc/meson.build                         |    3 +
 rust/chardev/src/chardev.rs                 |   82 +-
 rust/hw/char/Kconfig                        |    4 +
 rust/hw/char/meson.build                    |    1 +
 rust/hw/char/qup_geni_uart/Cargo.toml       |   27 +
 rust/hw/char/qup_geni_uart/meson.build      |   28 +
 rust/hw/char/qup_geni_uart/src/device.rs    | 1293 +++++++++++++++++++
 rust/hw/char/qup_geni_uart/src/lib.rs       |    9 +
 rust/hw/char/qup_geni_uart/src/registers.rs |  160 +++
 17 files changed, 1741 insertions(+), 16 deletions(-)
 create mode 100644 docs/system/devices/qup.rst
 create mode 100644 include/hw/misc/qup-wrapper.h
 create mode 100644 hw/misc/qup-wrapper.c
 create mode 100644 rust/hw/char/qup_geni_uart/Cargo.toml
 create mode 100644 rust/hw/char/qup_geni_uart/meson.build
 create mode 100644 rust/hw/char/qup_geni_uart/src/device.rs
 create mode 100644 rust/hw/char/qup_geni_uart/src/lib.rs
 create mode 100644 rust/hw/char/qup_geni_uart/src/registers.rs

-- 
2.34.1

Re: [PATCH 0/3] hw/misc: QUP UART device
Posted by Pierrick Bouvier 3 weeks, 5 days ago
On 10/27/2026 10:38 AM, Brian Cain wrote:
> Add the QUP + GENI uart device models.  The QUP is a "Universal Peripheral"
> present on Qualcomm SoCs, with connections for SPI, UART, I2C, I3C.  For
> now we're only interested in UART.
> 
> Will follow up with a v2 including wiring into machines + qtest after
> https://lore.kernel.org/qemu-devel/20261027143721.4125584-1-brian.cain@oss.qualcomm.com/
> lands.
> 
> Brian Cain (3):
>   hw/misc: add the QUP wrapper device
>   rust/chardev: fix write errors and add write watches
>   rust/hw/char: add QUP GENI UART device model
> 
>  MAINTAINERS                                 |    3 +
>  docs/system/device-emulation.rst            |    1 +
>  docs/system/devices/qup.rst                 |   10 +
>  include/hw/misc/qup-wrapper.h               |   27 +
>  hw/misc/qup-wrapper.c                       |   90 ++
>  Cargo.lock                                  |   15 +
>  Cargo.toml                                  |    1 +
>  hw/misc/Kconfig                             |    3 +
>  hw/misc/meson.build                         |    3 +
>  rust/chardev/src/chardev.rs                 |   82 +-
>  rust/hw/char/Kconfig                        |    4 +
>  rust/hw/char/meson.build                    |    1 +
>  rust/hw/char/qup_geni_uart/Cargo.toml       |   27 +
>  rust/hw/char/qup_geni_uart/meson.build      |   28 +
>  rust/hw/char/qup_geni_uart/src/device.rs    | 1293 +++++++++++++++++++
>  rust/hw/char/qup_geni_uart/src/lib.rs       |    9 +
>  rust/hw/char/qup_geni_uart/src/registers.rs |  160 +++
>  17 files changed, 1741 insertions(+), 16 deletions(-)
>  create mode 100644 docs/system/devices/qup.rst
>  create mode 100644 include/hw/misc/qup-wrapper.h
>  create mode 100644 hw/misc/qup-wrapper.c
>  create mode 100644 rust/hw/char/qup_geni_uart/Cargo.toml
>  create mode 100644 rust/hw/char/qup_geni_uart/meson.build
>  create mode 100644 rust/hw/char/qup_geni_uart/src/device.rs
>  create mode 100644 rust/hw/char/qup_geni_uart/src/lib.rs
>  create mode 100644 rust/hw/char/qup_geni_uart/src/registers.rs
> 

Any specific reason to have this implemented in Rust?

Not a bad thing in itself, but it means it's only available with rust
builds, which can be a problem if a machine defined in C wants to use it
unconditionally. Rust is not (yet) a mandatory dep for QEMU.

Regards,
Pierrick
Re: [PATCH 0/3] hw/misc: QUP UART device
Posted by Brian Cain 3 weeks, 5 days ago
On 10/27/2026 1:43 PM, Pierrick Bouvier wrote:
> On 10/27/2026 10:38 AM, Brian Cain wrote:
>> Add the QUP + GENI uart device models.  The QUP is a "Universal Peripheral"
>> present on Qualcomm SoCs, with connections for SPI, UART, I2C, I3C.  For
>> now we're only interested in UART.
>>
>> Will follow up with a v2 including wiring into machines + qtest after
>> https://lore.kernel.org/qemu-devel/20261027143721.4125584-1-brian.cain@oss.qualcomm.com/
>> lands.
>>
>> Brian Cain (3):
>>    hw/misc: add the QUP wrapper device
>>    rust/chardev: fix write errors and add write watches
>>    rust/hw/char: add QUP GENI UART device model
>>
>>   MAINTAINERS                                 |    3 +
>>   docs/system/device-emulation.rst            |    1 +
>>   docs/system/devices/qup.rst                 |   10 +
>>   include/hw/misc/qup-wrapper.h               |   27 +
>>   hw/misc/qup-wrapper.c                       |   90 ++
>>   Cargo.lock                                  |   15 +
>>   Cargo.toml                                  |    1 +
>>   hw/misc/Kconfig                             |    3 +
>>   hw/misc/meson.build                         |    3 +
>>   rust/chardev/src/chardev.rs                 |   82 +-
>>   rust/hw/char/Kconfig                        |    4 +
>>   rust/hw/char/meson.build                    |    1 +
>>   rust/hw/char/qup_geni_uart/Cargo.toml       |   27 +
>>   rust/hw/char/qup_geni_uart/meson.build      |   28 +
>>   rust/hw/char/qup_geni_uart/src/device.rs    | 1293 +++++++++++++++++++
>>   rust/hw/char/qup_geni_uart/src/lib.rs       |    9 +
>>   rust/hw/char/qup_geni_uart/src/registers.rs |  160 +++
>>   17 files changed, 1741 insertions(+), 16 deletions(-)
>>   create mode 100644 docs/system/devices/qup.rst
>>   create mode 100644 include/hw/misc/qup-wrapper.h
>>   create mode 100644 hw/misc/qup-wrapper.c
>>   create mode 100644 rust/hw/char/qup_geni_uart/Cargo.toml
>>   create mode 100644 rust/hw/char/qup_geni_uart/meson.build
>>   create mode 100644 rust/hw/char/qup_geni_uart/src/device.rs
>>   create mode 100644 rust/hw/char/qup_geni_uart/src/lib.rs
>>   create mode 100644 rust/hw/char/qup_geni_uart/src/registers.rs
>>
> Any specific reason to have this implemented in Rust?
>
> Not a bad thing in itself, but it means it's only available with rust
> builds, which can be a problem if a machine defined in C wants to use it
> unconditionally. Rust is not (yet) a mandatory dep for QEMU.

A new device model -> a brand new day -> a new frontier?

It was an interesting challenge and seemed appropriate given the nice 
reference pl011 device.  But I will concede it can be impractical.  
Making this device conditionally enabled in the machine that uses it 
felt kinda "lame" and made me long for a day when it *was* a mandatory 
dependency.

Seeing as how we have a pl011 device in C, maybe it's better to start 
with a C version of the QUP?  If so, that's okay with me.

> Regards,
> Pierrick

Re: [PATCH 0/3] hw/misc: QUP UART device
Posted by Pierrick Bouvier 3 weeks, 5 days ago
On 10/27/2026 12:02 PM, Brian Cain wrote:
> 
> On 10/27/2026 1:43 PM, Pierrick Bouvier wrote:
>> On 10/27/2026 10:38 AM, Brian Cain wrote:
>>> Add the QUP + GENI uart device models.  The QUP is a "Universal
>>> Peripheral"
>>> present on Qualcomm SoCs, with connections for SPI, UART, I2C, I3C.  For
>>> now we're only interested in UART.
>>>
>>> Will follow up with a v2 including wiring into machines + qtest after
>>> https://lore.kernel.org/qemu-devel/20261027143721.4125584-1-
>>> brian.cain@oss.qualcomm.com/
>>> lands.
>>>
>>> Brian Cain (3):
>>>    hw/misc: add the QUP wrapper device
>>>    rust/chardev: fix write errors and add write watches
>>>    rust/hw/char: add QUP GENI UART device model
>>>
>>>   MAINTAINERS                                 |    3 +
>>>   docs/system/device-emulation.rst            |    1 +
>>>   docs/system/devices/qup.rst                 |   10 +
>>>   include/hw/misc/qup-wrapper.h               |   27 +
>>>   hw/misc/qup-wrapper.c                       |   90 ++
>>>   Cargo.lock                                  |   15 +
>>>   Cargo.toml                                  |    1 +
>>>   hw/misc/Kconfig                             |    3 +
>>>   hw/misc/meson.build                         |    3 +
>>>   rust/chardev/src/chardev.rs                 |   82 +-
>>>   rust/hw/char/Kconfig                        |    4 +
>>>   rust/hw/char/meson.build                    |    1 +
>>>   rust/hw/char/qup_geni_uart/Cargo.toml       |   27 +
>>>   rust/hw/char/qup_geni_uart/meson.build      |   28 +
>>>   rust/hw/char/qup_geni_uart/src/device.rs    | 1293 +++++++++++++++++++
>>>   rust/hw/char/qup_geni_uart/src/lib.rs       |    9 +
>>>   rust/hw/char/qup_geni_uart/src/registers.rs |  160 +++
>>>   17 files changed, 1741 insertions(+), 16 deletions(-)
>>>   create mode 100644 docs/system/devices/qup.rst
>>>   create mode 100644 include/hw/misc/qup-wrapper.h
>>>   create mode 100644 hw/misc/qup-wrapper.c
>>>   create mode 100644 rust/hw/char/qup_geni_uart/Cargo.toml
>>>   create mode 100644 rust/hw/char/qup_geni_uart/meson.build
>>>   create mode 100644 rust/hw/char/qup_geni_uart/src/device.rs
>>>   create mode 100644 rust/hw/char/qup_geni_uart/src/lib.rs
>>>   create mode 100644 rust/hw/char/qup_geni_uart/src/registers.rs
>>>
>> Any specific reason to have this implemented in Rust?
>>
>> Not a bad thing in itself, but it means it's only available with rust
>> builds, which can be a problem if a machine defined in C wants to use it
>> unconditionally. Rust is not (yet) a mandatory dep for QEMU.
> 
> A new device model -> a brand new day -> a new frontier?
> 
> It was an interesting challenge and seemed appropriate given the nice
> reference pl011 device.  But I will concede it can be impractical. 
> Making this device conditionally enabled in the machine that uses it
> felt kinda "lame" and made me long for a day when it *was* a mandatory
> dependency.
> 
> Seeing as how we have a pl011 device in C, maybe it's better to start
> with a C version of the QUP?  If so, that's okay with me.
>

If it's a mandatory device as part of a machine definition, it would
probably be better to stick to C for now.
I hope we can get Rust as a main dep at some point. I'm not sure what is
the criteria to do this change, out of deciding "let's do this".

Regards,
Pierrick

Re: [PATCH 0/3] hw/misc: QUP UART device
Posted by Brian Cain 3 weeks, 4 days ago
On 10/27/2026 3:12 PM, Pierrick Bouvier wrote:
> On 10/27/2026 12:02 PM, Brian Cain wrote:
>> On 10/27/2026 1:43 PM, Pierrick Bouvier wrote:
>>> On 10/27/2026 10:38 AM, Brian Cain wrote:
>>>> Add the QUP + GENI uart device models.  The QUP is a "Universal
>>>> Peripheral"
>>>> present on Qualcomm SoCs, with connections for SPI, UART, I2C, I3C.  For
>>>> now we're only interested in UART.
>>>>
>>>> Will follow up with a v2 including wiring into machines + qtest after
>>>> https://lore.kernel.org/qemu-devel/20261027143721.4125584-1-
>>>> brian.cain@oss.qualcomm.com/
>>>> lands.
>>>>
>>>> Brian Cain (3):
>>>>     hw/misc: add the QUP wrapper device
>>>>     rust/chardev: fix write errors and add write watches
>>>>     rust/hw/char: add QUP GENI UART device model
>>>>
>>>>    MAINTAINERS                                 |    3 +
>>>>    docs/system/device-emulation.rst            |    1 +
>>>>    docs/system/devices/qup.rst                 |   10 +
>>>>    include/hw/misc/qup-wrapper.h               |   27 +
>>>>    hw/misc/qup-wrapper.c                       |   90 ++
>>>>    Cargo.lock                                  |   15 +
>>>>    Cargo.toml                                  |    1 +
>>>>    hw/misc/Kconfig                             |    3 +
>>>>    hw/misc/meson.build                         |    3 +
>>>>    rust/chardev/src/chardev.rs                 |   82 +-
>>>>    rust/hw/char/Kconfig                        |    4 +
>>>>    rust/hw/char/meson.build                    |    1 +
>>>>    rust/hw/char/qup_geni_uart/Cargo.toml       |   27 +
>>>>    rust/hw/char/qup_geni_uart/meson.build      |   28 +
>>>>    rust/hw/char/qup_geni_uart/src/device.rs    | 1293 +++++++++++++++++++
>>>>    rust/hw/char/qup_geni_uart/src/lib.rs       |    9 +
>>>>    rust/hw/char/qup_geni_uart/src/registers.rs |  160 +++
>>>>    17 files changed, 1741 insertions(+), 16 deletions(-)
>>>>    create mode 100644 docs/system/devices/qup.rst
>>>>    create mode 100644 include/hw/misc/qup-wrapper.h
>>>>    create mode 100644 hw/misc/qup-wrapper.c
>>>>    create mode 100644 rust/hw/char/qup_geni_uart/Cargo.toml
>>>>    create mode 100644 rust/hw/char/qup_geni_uart/meson.build
>>>>    create mode 100644 rust/hw/char/qup_geni_uart/src/device.rs
>>>>    create mode 100644 rust/hw/char/qup_geni_uart/src/lib.rs
>>>>    create mode 100644 rust/hw/char/qup_geni_uart/src/registers.rs
>>>>
>>> Any specific reason to have this implemented in Rust?
>>>
>>> Not a bad thing in itself, but it means it's only available with rust
>>> builds, which can be a problem if a machine defined in C wants to use it
>>> unconditionally. Rust is not (yet) a mandatory dep for QEMU.
>> A new device model -> a brand new day -> a new frontier?
>>
>> It was an interesting challenge and seemed appropriate given the nice
>> reference pl011 device.  But I will concede it can be impractical.
>> Making this device conditionally enabled in the machine that uses it
>> felt kinda "lame" and made me long for a day when it *was* a mandatory
>> dependency.
>>
>> Seeing as how we have a pl011 device in C, maybe it's better to start
>> with a C version of the QUP?  If so, that's okay with me.
>>
> If it's a mandatory device as part of a machine definition, it would
> probably be better to stick to C for now.
> I hope we can get Rust as a main dep at some point. I'm not sure what is
> the criteria to do this change, out of deciding "let's do this".

Hmm - so ... can I put in a vote for this, then?  Can "at some point" be 
now?  What are the criteria?


> Regards,
> Pierrick

Re: [PATCH 0/3] hw/misc: QUP UART device
Posted by Pierrick Bouvier 3 weeks, 4 days ago
On 10/28/2026 4:21 PM, Brian Cain wrote:
> 
> On 10/27/2026 3:12 PM, Pierrick Bouvier wrote:
>> On 10/27/2026 12:02 PM, Brian Cain wrote:
>>> On 10/27/2026 1:43 PM, Pierrick Bouvier wrote:
>>>> On 10/27/2026 10:38 AM, Brian Cain wrote:
>>>>> Add the QUP + GENI uart device models.  The QUP is a "Universal
>>>>> Peripheral"
>>>>> present on Qualcomm SoCs, with connections for SPI, UART, I2C,
>>>>> I3C.  For
>>>>> now we're only interested in UART.
>>>>>
>>>>> Will follow up with a v2 including wiring into machines + qtest after
>>>>> https://lore.kernel.org/qemu-devel/20261027143721.4125584-1-
>>>>> brian.cain@oss.qualcomm.com/
>>>>> lands.
>>>>>
>>>>> Brian Cain (3):
>>>>>     hw/misc: add the QUP wrapper device
>>>>>     rust/chardev: fix write errors and add write watches
>>>>>     rust/hw/char: add QUP GENI UART device model
>>>>>
>>>>>    MAINTAINERS                                 |    3 +
>>>>>    docs/system/device-emulation.rst            |    1 +
>>>>>    docs/system/devices/qup.rst                 |   10 +
>>>>>    include/hw/misc/qup-wrapper.h               |   27 +
>>>>>    hw/misc/qup-wrapper.c                       |   90 ++
>>>>>    Cargo.lock                                  |   15 +
>>>>>    Cargo.toml                                  |    1 +
>>>>>    hw/misc/Kconfig                             |    3 +
>>>>>    hw/misc/meson.build                         |    3 +
>>>>>    rust/chardev/src/chardev.rs                 |   82 +-
>>>>>    rust/hw/char/Kconfig                        |    4 +
>>>>>    rust/hw/char/meson.build                    |    1 +
>>>>>    rust/hw/char/qup_geni_uart/Cargo.toml       |   27 +
>>>>>    rust/hw/char/qup_geni_uart/meson.build      |   28 +
>>>>>    rust/hw/char/qup_geni_uart/src/device.rs    | 1293 +++++++++++++
>>>>> ++++++
>>>>>    rust/hw/char/qup_geni_uart/src/lib.rs       |    9 +
>>>>>    rust/hw/char/qup_geni_uart/src/registers.rs |  160 +++
>>>>>    17 files changed, 1741 insertions(+), 16 deletions(-)
>>>>>    create mode 100644 docs/system/devices/qup.rst
>>>>>    create mode 100644 include/hw/misc/qup-wrapper.h
>>>>>    create mode 100644 hw/misc/qup-wrapper.c
>>>>>    create mode 100644 rust/hw/char/qup_geni_uart/Cargo.toml
>>>>>    create mode 100644 rust/hw/char/qup_geni_uart/meson.build
>>>>>    create mode 100644 rust/hw/char/qup_geni_uart/src/device.rs
>>>>>    create mode 100644 rust/hw/char/qup_geni_uart/src/lib.rs
>>>>>    create mode 100644 rust/hw/char/qup_geni_uart/src/registers.rs
>>>>>
>>>> Any specific reason to have this implemented in Rust?
>>>>
>>>> Not a bad thing in itself, but it means it's only available with rust
>>>> builds, which can be a problem if a machine defined in C wants to
>>>> use it
>>>> unconditionally. Rust is not (yet) a mandatory dep for QEMU.
>>> A new device model -> a brand new day -> a new frontier?
>>>
>>> It was an interesting challenge and seemed appropriate given the nice
>>> reference pl011 device.  But I will concede it can be impractical.
>>> Making this device conditionally enabled in the machine that uses it
>>> felt kinda "lame" and made me long for a day when it *was* a mandatory
>>> dependency.
>>>
>>> Seeing as how we have a pl011 device in C, maybe it's better to start
>>> with a C version of the QUP?  If so, that's okay with me.
>>>
>> If it's a mandatory device as part of a machine definition, it would
>> probably be better to stick to C for now.
>> I hope we can get Rust as a main dep at some point. I'm not sure what is
>> the criteria to do this change, out of deciding "let's do this".
> 
> Hmm - so ... can I put in a vote for this, then?  Can "at some point" be
> now?  What are the criteria?
>

@Manos, Paolo: any idea on this?
Could 12.0 be the first version to make rust a mandatory dep?

Regards,
Pierrick