[PATCH v1 13/16] drivers/vuart: move PL011 emulator code

dmkhn@proton.me posted 16 patches 7 months, 3 weeks ago
[PATCH v1 13/16] drivers/vuart: move PL011 emulator code
Posted by dmkhn@proton.me 7 months, 3 weeks ago
From: Denis Mukhin <dmukhin@ford.com> 

Move PL011 emulator to the new location for UART emulators.

No functional change intended.

Signed-off-by: Denis Mukhin <dmukhin@ford.com>
---
 xen/arch/arm/Kconfig                               |  7 -------
 xen/arch/arm/Makefile                              |  1 -
 xen/drivers/Kconfig                                |  2 ++
 xen/drivers/Makefile                               |  1 +
 xen/drivers/vuart/Kconfig                          | 14 ++++++++++++++
 xen/drivers/vuart/Makefile                         |  1 +
 .../arm/vpl011.c => drivers/vuart/vuart-pl011.c}   |  0
 7 files changed, 18 insertions(+), 8 deletions(-)
 create mode 100644 xen/drivers/vuart/Kconfig
 create mode 100644 xen/drivers/vuart/Makefile
 rename xen/{arch/arm/vpl011.c => drivers/vuart/vuart-pl011.c} (100%)

diff --git a/xen/arch/arm/Kconfig b/xen/arch/arm/Kconfig
index b11cb583a763..6eeae97293f2 100644
--- a/xen/arch/arm/Kconfig
+++ b/xen/arch/arm/Kconfig
@@ -170,13 +170,6 @@ config NEW_VGIC
 	problems with the standard emulation.
 	At the moment this implementation is not security supported.
 
-config HAS_VUART_PL011
-	bool "Emulated SBSA UART console support"
-	default y
-	help
-	  Allows a guest to use SBSA Generic UART as a console. The
-	  SBSA Generic UART implements a subset of ARM PL011 UART.
-
 config HAS_VUART_MMIO
 	bool "Emulated UART for hardware domain"
 	default y
diff --git a/xen/arch/arm/Makefile b/xen/arch/arm/Makefile
index dd015a2a19e8..8475043d8701 100644
--- a/xen/arch/arm/Makefile
+++ b/xen/arch/arm/Makefile
@@ -65,7 +65,6 @@ obj-$(CONFIG_HAS_ITS) += vgic-v3-its.o
 endif
 obj-$(CONFIG_VM_EVENT) += vm_event.o
 obj-y += vtimer.o
-obj-$(CONFIG_HAS_VUART_PL011) += vpl011.o
 obj-y += vsmc.o
 obj-y += vpsci.o
 obj-$(CONFIG_HAS_VUART_MMIO) += vuart.o
diff --git a/xen/drivers/Kconfig b/xen/drivers/Kconfig
index 20050e9bb8b3..5e533b260004 100644
--- a/xen/drivers/Kconfig
+++ b/xen/drivers/Kconfig
@@ -12,6 +12,8 @@ source "drivers/pci/Kconfig"
 
 source "drivers/video/Kconfig"
 
+source "drivers/vuart/Kconfig"
+
 config HAS_VPCI
 	bool
 
diff --git a/xen/drivers/Makefile b/xen/drivers/Makefile
index 2a1ae8ad130a..510820472938 100644
--- a/xen/drivers/Makefile
+++ b/xen/drivers/Makefile
@@ -2,6 +2,7 @@ obj-y += char/
 obj-$(CONFIG_HAS_CPUFREQ) += cpufreq/
 obj-$(CONFIG_HAS_PCI) += pci/
 obj-$(CONFIG_HAS_VPCI) += vpci/
+obj-$(CONFIG_HAS_VUART) += vuart/
 obj-$(CONFIG_HAS_PASSTHROUGH) += passthrough/
 obj-$(CONFIG_ACPI) += acpi/
 obj-$(CONFIG_VIDEO) += video/
diff --git a/xen/drivers/vuart/Kconfig b/xen/drivers/vuart/Kconfig
new file mode 100644
index 000000000000..d8df0f6d1b3c
--- /dev/null
+++ b/xen/drivers/vuart/Kconfig
@@ -0,0 +1,14 @@
+config HAS_VUART
+	bool
+
+if (ARM_32 || ARM_64)
+
+config HAS_VUART_PL011
+	bool "Emulated PL011 UART support"
+	default y
+	select HAS_VUART
+	help
+	  Allows a guest to use SBSA Generic UART as a console. The
+	  SBSA Generic UART implements a subset of ARM PL011 UART.
+
+endif
diff --git a/xen/drivers/vuart/Makefile b/xen/drivers/vuart/Makefile
new file mode 100644
index 000000000000..3b7069f1cf95
--- /dev/null
+++ b/xen/drivers/vuart/Makefile
@@ -0,0 +1 @@
+obj-$(CONFIG_HAS_VUART_PL011) += vuart-pl011.o
diff --git a/xen/arch/arm/vpl011.c b/xen/drivers/vuart/vuart-pl011.c
similarity index 100%
rename from xen/arch/arm/vpl011.c
rename to xen/drivers/vuart/vuart-pl011.c
-- 
2.34.1
Re: [PATCH v1 13/16] drivers/vuart: move PL011 emulator code
Posted by Jan Beulich 7 months, 3 weeks ago
On 24.06.2025 05:56, dmkhn@proton.me wrote:
> From: Denis Mukhin <dmukhin@ford.com> 
> 
> Move PL011 emulator to the new location for UART emulators.
> 
> No functional change intended.
> 
> Signed-off-by: Denis Mukhin <dmukhin@ford.com>
> ---
>  xen/arch/arm/Kconfig                               |  7 -------
>  xen/arch/arm/Makefile                              |  1 -
>  xen/drivers/Kconfig                                |  2 ++
>  xen/drivers/Makefile                               |  1 +
>  xen/drivers/vuart/Kconfig                          | 14 ++++++++++++++
>  xen/drivers/vuart/Makefile                         |  1 +
>  .../arm/vpl011.c => drivers/vuart/vuart-pl011.c}   |  0
>  7 files changed, 18 insertions(+), 8 deletions(-)
>  create mode 100644 xen/drivers/vuart/Kconfig
>  create mode 100644 xen/drivers/vuart/Makefile
>  rename xen/{arch/arm/vpl011.c => drivers/vuart/vuart-pl011.c} (100%)

I question the placement under drivers/. To me, driver != emulator. I
wonder what others think. But yes, we already have drivers/vpci/. That
may want moving then ...

Jan
Re: [PATCH v1 13/16] drivers/vuart: move PL011 emulator code
Posted by dmkhn@proton.me 7 months, 3 weeks ago
On Tue, Jun 24, 2025 at 07:50:33AM +0200, Jan Beulich wrote:
> On 24.06.2025 05:56, dmkhn@proton.me wrote:
> > From: Denis Mukhin <dmukhin@ford.com>
> >
> > Move PL011 emulator to the new location for UART emulators.
> >
> > No functional change intended.
> >
> > Signed-off-by: Denis Mukhin <dmukhin@ford.com>
> > ---
> >  xen/arch/arm/Kconfig                               |  7 -------
> >  xen/arch/arm/Makefile                              |  1 -
> >  xen/drivers/Kconfig                                |  2 ++
> >  xen/drivers/Makefile                               |  1 +
> >  xen/drivers/vuart/Kconfig                          | 14 ++++++++++++++
> >  xen/drivers/vuart/Makefile                         |  1 +
> >  .../arm/vpl011.c => drivers/vuart/vuart-pl011.c}   |  0
> >  7 files changed, 18 insertions(+), 8 deletions(-)
> >  create mode 100644 xen/drivers/vuart/Kconfig
> >  create mode 100644 xen/drivers/vuart/Makefile
> >  rename xen/{arch/arm/vpl011.c => drivers/vuart/vuart-pl011.c} (100%)
> 
> I question the placement under drivers/. To me, driver != emulator. I
> wonder what others think. But yes, we already have drivers/vpci/. That
> may want moving then ...

re: driver != emulator: I agree; but I followed drivers/vpci.

Do you think common/vuart would be a better location?

> 
> Jan
Re: [PATCH v1 13/16] drivers/vuart: move PL011 emulator code
Posted by Jan Beulich 7 months, 3 weeks ago
On 24.06.2025 09:31, dmkhn@proton.me wrote:
> On Tue, Jun 24, 2025 at 07:50:33AM +0200, Jan Beulich wrote:
>> On 24.06.2025 05:56, dmkhn@proton.me wrote:
>>> From: Denis Mukhin <dmukhin@ford.com>
>>>
>>> Move PL011 emulator to the new location for UART emulators.
>>>
>>> No functional change intended.
>>>
>>> Signed-off-by: Denis Mukhin <dmukhin@ford.com>
>>> ---
>>>  xen/arch/arm/Kconfig                               |  7 -------
>>>  xen/arch/arm/Makefile                              |  1 -
>>>  xen/drivers/Kconfig                                |  2 ++
>>>  xen/drivers/Makefile                               |  1 +
>>>  xen/drivers/vuart/Kconfig                          | 14 ++++++++++++++
>>>  xen/drivers/vuart/Makefile                         |  1 +
>>>  .../arm/vpl011.c => drivers/vuart/vuart-pl011.c}   |  0
>>>  7 files changed, 18 insertions(+), 8 deletions(-)
>>>  create mode 100644 xen/drivers/vuart/Kconfig
>>>  create mode 100644 xen/drivers/vuart/Makefile
>>>  rename xen/{arch/arm/vpl011.c => drivers/vuart/vuart-pl011.c} (100%)
>>
>> I question the placement under drivers/. To me, driver != emulator. I
>> wonder what others think. But yes, we already have drivers/vpci/. That
>> may want moving then ...
> 
> re: driver != emulator: I agree; but I followed drivers/vpci.
> 
> Do you think common/vuart would be a better location?

Or maybe common/emul/... This wants discussing, I think.

Jan
Re: [PATCH v1 13/16] drivers/vuart: move PL011 emulator code
Posted by dmkhn@proton.me 7 months ago
On Tue, Jun 24, 2025 at 09:33:04AM +0200, Jan Beulich wrote:
> On 24.06.2025 09:31, dmkhn@proton.me wrote:
> > On Tue, Jun 24, 2025 at 07:50:33AM +0200, Jan Beulich wrote:
> >> On 24.06.2025 05:56, dmkhn@proton.me wrote:
> >>> From: Denis Mukhin <dmukhin@ford.com>
> >>>
> >>> Move PL011 emulator to the new location for UART emulators.
> >>>
> >>> No functional change intended.
> >>>
> >>> Signed-off-by: Denis Mukhin <dmukhin@ford.com>
> >>> ---
> >>>  xen/arch/arm/Kconfig                               |  7 -------
> >>>  xen/arch/arm/Makefile                              |  1 -
> >>>  xen/drivers/Kconfig                                |  2 ++
> >>>  xen/drivers/Makefile                               |  1 +
> >>>  xen/drivers/vuart/Kconfig                          | 14 ++++++++++++++
> >>>  xen/drivers/vuart/Makefile                         |  1 +
> >>>  .../arm/vpl011.c => drivers/vuart/vuart-pl011.c}   |  0
> >>>  7 files changed, 18 insertions(+), 8 deletions(-)
> >>>  create mode 100644 xen/drivers/vuart/Kconfig
> >>>  create mode 100644 xen/drivers/vuart/Makefile
> >>>  rename xen/{arch/arm/vpl011.c => drivers/vuart/vuart-pl011.c} (100%)
> >>
> >> I question the placement under drivers/. To me, driver != emulator. I
> >> wonder what others think. But yes, we already have drivers/vpci/. That
> >> may want moving then ...
> >
> > re: driver != emulator: I agree; but I followed drivers/vpci.
> >
> > Do you think common/vuart would be a better location?
> 
> Or maybe common/emul/... This wants discussing, I think.

Will something like the following work
  common/hvm/vuart
?

> 
> Jan
Re: [PATCH v1 13/16] drivers/vuart: move PL011 emulator code
Posted by Jan Beulich 7 months ago
On 10.07.2025 03:59, dmkhn@proton.me wrote:
> On Tue, Jun 24, 2025 at 09:33:04AM +0200, Jan Beulich wrote:
>> On 24.06.2025 09:31, dmkhn@proton.me wrote:
>>> On Tue, Jun 24, 2025 at 07:50:33AM +0200, Jan Beulich wrote:
>>>> On 24.06.2025 05:56, dmkhn@proton.me wrote:
>>>>> From: Denis Mukhin <dmukhin@ford.com>
>>>>>
>>>>> Move PL011 emulator to the new location for UART emulators.
>>>>>
>>>>> No functional change intended.
>>>>>
>>>>> Signed-off-by: Denis Mukhin <dmukhin@ford.com>
>>>>> ---
>>>>>  xen/arch/arm/Kconfig                               |  7 -------
>>>>>  xen/arch/arm/Makefile                              |  1 -
>>>>>  xen/drivers/Kconfig                                |  2 ++
>>>>>  xen/drivers/Makefile                               |  1 +
>>>>>  xen/drivers/vuart/Kconfig                          | 14 ++++++++++++++
>>>>>  xen/drivers/vuart/Makefile                         |  1 +
>>>>>  .../arm/vpl011.c => drivers/vuart/vuart-pl011.c}   |  0
>>>>>  7 files changed, 18 insertions(+), 8 deletions(-)
>>>>>  create mode 100644 xen/drivers/vuart/Kconfig
>>>>>  create mode 100644 xen/drivers/vuart/Makefile
>>>>>  rename xen/{arch/arm/vpl011.c => drivers/vuart/vuart-pl011.c} (100%)
>>>>
>>>> I question the placement under drivers/. To me, driver != emulator. I
>>>> wonder what others think. But yes, we already have drivers/vpci/. That
>>>> may want moving then ...
>>>
>>> re: driver != emulator: I agree; but I followed drivers/vpci.
>>>
>>> Do you think common/vuart would be a better location?
>>
>> Or maybe common/emul/... This wants discussing, I think.
> 
> Will something like the following work
>   common/hvm/vuart
> ?

Not really, emulators may not be limited to HVM. But iirc common/emul/ is
what we settled on anyway at the last Community Call?

Jan
Re: [PATCH v1 13/16] drivers/vuart: move PL011 emulator code
Posted by dmkhn@proton.me 7 months ago
On Thu, Jul 10, 2025 at 10:15:54AM +0200, Jan Beulich wrote:
> On 10.07.2025 03:59, dmkhn@proton.me wrote:
> > On Tue, Jun 24, 2025 at 09:33:04AM +0200, Jan Beulich wrote:
> >> On 24.06.2025 09:31, dmkhn@proton.me wrote:
> >>> On Tue, Jun 24, 2025 at 07:50:33AM +0200, Jan Beulich wrote:
> >>>> On 24.06.2025 05:56, dmkhn@proton.me wrote:
> >>>>> From: Denis Mukhin <dmukhin@ford.com>
> >>>>>
> >>>>> Move PL011 emulator to the new location for UART emulators.
> >>>>>
> >>>>> No functional change intended.
> >>>>>
> >>>>> Signed-off-by: Denis Mukhin <dmukhin@ford.com>
> >>>>> ---
> >>>>>  xen/arch/arm/Kconfig                               |  7 -------
> >>>>>  xen/arch/arm/Makefile                              |  1 -
> >>>>>  xen/drivers/Kconfig                                |  2 ++
> >>>>>  xen/drivers/Makefile                               |  1 +
> >>>>>  xen/drivers/vuart/Kconfig                          | 14 ++++++++++++++
> >>>>>  xen/drivers/vuart/Makefile                         |  1 +
> >>>>>  .../arm/vpl011.c => drivers/vuart/vuart-pl011.c}   |  0
> >>>>>  7 files changed, 18 insertions(+), 8 deletions(-)
> >>>>>  create mode 100644 xen/drivers/vuart/Kconfig
> >>>>>  create mode 100644 xen/drivers/vuart/Makefile
> >>>>>  rename xen/{arch/arm/vpl011.c => drivers/vuart/vuart-pl011.c} (100%)
> >>>>
> >>>> I question the placement under drivers/. To me, driver != emulator. I
> >>>> wonder what others think. But yes, we already have drivers/vpci/. That
> >>>> may want moving then ...
> >>>
> >>> re: driver != emulator: I agree; but I followed drivers/vpci.
> >>>
> >>> Do you think common/vuart would be a better location?
> >>
> >> Or maybe common/emul/... This wants discussing, I think.
> >
> > Will something like the following work
> >   common/hvm/vuart
> > ?
> 
> Not really, emulators may not be limited to HVM. But iirc common/emul/ is
> what we settled on anyway at the last Community Call?

Sorry, I missed today's call, did not know about the decision.

> 
> Jan
> 
Re: [PATCH v1 13/16] drivers/vuart: move PL011 emulator code
Posted by Stefano Stabellini 7 months ago
On Thu, 10 Jul 2025, Jan Beulich wrote:
> On 10.07.2025 03:59, dmkhn@proton.me wrote:
> > On Tue, Jun 24, 2025 at 09:33:04AM +0200, Jan Beulich wrote:
> >> On 24.06.2025 09:31, dmkhn@proton.me wrote:
> >>> On Tue, Jun 24, 2025 at 07:50:33AM +0200, Jan Beulich wrote:
> >>>> On 24.06.2025 05:56, dmkhn@proton.me wrote:
> >>>>> From: Denis Mukhin <dmukhin@ford.com>
> >>>>>
> >>>>> Move PL011 emulator to the new location for UART emulators.
> >>>>>
> >>>>> No functional change intended.
> >>>>>
> >>>>> Signed-off-by: Denis Mukhin <dmukhin@ford.com>
> >>>>> ---
> >>>>>  xen/arch/arm/Kconfig                               |  7 -------
> >>>>>  xen/arch/arm/Makefile                              |  1 -
> >>>>>  xen/drivers/Kconfig                                |  2 ++
> >>>>>  xen/drivers/Makefile                               |  1 +
> >>>>>  xen/drivers/vuart/Kconfig                          | 14 ++++++++++++++
> >>>>>  xen/drivers/vuart/Makefile                         |  1 +
> >>>>>  .../arm/vpl011.c => drivers/vuart/vuart-pl011.c}   |  0
> >>>>>  7 files changed, 18 insertions(+), 8 deletions(-)
> >>>>>  create mode 100644 xen/drivers/vuart/Kconfig
> >>>>>  create mode 100644 xen/drivers/vuart/Makefile
> >>>>>  rename xen/{arch/arm/vpl011.c => drivers/vuart/vuart-pl011.c} (100%)
> >>>>
> >>>> I question the placement under drivers/. To me, driver != emulator. I
> >>>> wonder what others think. But yes, we already have drivers/vpci/. That
> >>>> may want moving then ...
> >>>
> >>> re: driver != emulator: I agree; but I followed drivers/vpci.
> >>>
> >>> Do you think common/vuart would be a better location?
> >>
> >> Or maybe common/emul/... This wants discussing, I think.
> > 
> > Will something like the following work
> >   common/hvm/vuart
> > ?
> 
> Not really, emulators may not be limited to HVM. But iirc common/emul/ is
> what we settled on anyway at the last Community Call?

Yes, that is what I recall as well
Re: [PATCH v1 13/16] drivers/vuart: move PL011 emulator code
Posted by dmkhn@proton.me 6 months, 1 week ago
On Thu, Jul 10, 2025 at 10:00:10AM -0700, Stefano Stabellini wrote:
> On Thu, 10 Jul 2025, Jan Beulich wrote:
> > On 10.07.2025 03:59, dmkhn@proton.me wrote:
> > > On Tue, Jun 24, 2025 at 09:33:04AM +0200, Jan Beulich wrote:
> > >> On 24.06.2025 09:31, dmkhn@proton.me wrote:
> > >>> On Tue, Jun 24, 2025 at 07:50:33AM +0200, Jan Beulich wrote:
> > >>>> On 24.06.2025 05:56, dmkhn@proton.me wrote:
> > >>>>> From: Denis Mukhin <dmukhin@ford.com>
> > >>>>>
> > >>>>> Move PL011 emulator to the new location for UART emulators.
> > >>>>>
> > >>>>> No functional change intended.
> > >>>>>
> > >>>>> Signed-off-by: Denis Mukhin <dmukhin@ford.com>
> > >>>>> ---
> > >>>>>  xen/arch/arm/Kconfig                               |  7 -------
> > >>>>>  xen/arch/arm/Makefile                              |  1 -
> > >>>>>  xen/drivers/Kconfig                                |  2 ++
> > >>>>>  xen/drivers/Makefile                               |  1 +
> > >>>>>  xen/drivers/vuart/Kconfig                          | 14 ++++++++++++++
> > >>>>>  xen/drivers/vuart/Makefile                         |  1 +
> > >>>>>  .../arm/vpl011.c => drivers/vuart/vuart-pl011.c}   |  0
> > >>>>>  7 files changed, 18 insertions(+), 8 deletions(-)
> > >>>>>  create mode 100644 xen/drivers/vuart/Kconfig
> > >>>>>  create mode 100644 xen/drivers/vuart/Makefile
> > >>>>>  rename xen/{arch/arm/vpl011.c => drivers/vuart/vuart-pl011.c} (100%)
> > >>>>
> > >>>> I question the placement under drivers/. To me, driver != emulator. I
> > >>>> wonder what others think. But yes, we already have drivers/vpci/. That
> > >>>> may want moving then ...
> > >>>
> > >>> re: driver != emulator: I agree; but I followed drivers/vpci.
> > >>>
> > >>> Do you think common/vuart would be a better location?
> > >>
> > >> Or maybe common/emul/... This wants discussing, I think.
> > >
> > > Will something like the following work
> > >   common/hvm/vuart
> > > ?
> >
> > Not really, emulators may not be limited to HVM. But iirc common/emul/ is
> > what we settled on anyway at the last Community Call?
> 
> Yes, that is what I recall as well

Ack, will use common/emul/