Re: [PATCH 0/8] Add support for Qualcomm SA8155-ADP board

2024-03-04 Thread Konrad Dybcio




On 3/4/24 16:51, Volodymyr Babchuk wrote:


Hi Stephan,

Stephan Gerhold  writes:


On Fri, Mar 01, 2024 at 06:25:39PM +, Volodymyr Babchuk wrote:

Caleb Connolly  writes:

On 29/02/2024 14:21, Volodymyr Babchuk wrote:

This patch series adds support for Qualcomm SA8155-ADP development
board. Main motivation for this series is to allow running
virtualization software on this board and U-Boot is a good way to
break Qualcomm's boot chain at EL2 with more convenient ways for
uploading and running the code. With this patches applied it is
possible to upload and run Xen on this board. KVM probably should work
too.


This is really cool! I've experimented with this on SDM845 and SM8250
but never really did anything with it... I'd love to take a look at your
Xen branch?


Honestly, there is nothing to look at right now. I just implemented
early printk serial driver for the qcom, made hacks to the device tree
and trying to boot Dom0. I already expecting issues with the GPU,
because it has own SMMU without virtualization support and Xen already
complains about it. So I had to remove it from the DTS for a time being.



Did you enable all the clocks/power domains/etc for the GPU SMMU? If I
remember correctly it is off by default and all registers read as
zeroes. The SMMU driver could easily get confused about the capabilities
of the SMMU (e.g. the stage 2/virtualization support) if all the ID
registers read as zeroes.


Ah, this is a great idea, thanks. I tried a quick test by enabling only
clocks that are provided by GCC, but looks like I need to enable GPUCC
clocks as well. So I need to write a driver for GPUCC or at least
figure which registers to write with a debugger. I'll try this later.


You'll probably also need to enable the CX GDSC (not sure about the
order, probably GDSC and then clocks)

Konrad


Re: [PATCH 0/8] Add support for Qualcomm SA8155-ADP board

2024-03-04 Thread Caleb Connolly



On 04/03/2024 15:51, Volodymyr Babchuk wrote:
> 
> Hi Stephan,
> 
> Stephan Gerhold  writes:
> 
>> On Fri, Mar 01, 2024 at 06:25:39PM +, Volodymyr Babchuk wrote:
>>> Caleb Connolly  writes:
 On 29/02/2024 14:21, Volodymyr Babchuk wrote:
> This patch series adds support for Qualcomm SA8155-ADP development
> board. Main motivation for this series is to allow running
> virtualization software on this board and U-Boot is a good way to
> break Qualcomm's boot chain at EL2 with more convenient ways for
> uploading and running the code. With this patches applied it is
> possible to upload and run Xen on this board. KVM probably should work
> too.

 This is really cool! I've experimented with this on SDM845 and SM8250
 but never really did anything with it... I'd love to take a look at your
 Xen branch?
>>>
>>> Honestly, there is nothing to look at right now. I just implemented
>>> early printk serial driver for the qcom, made hacks to the device tree
>>> and trying to boot Dom0. I already expecting issues with the GPU,
>>> because it has own SMMU without virtualization support and Xen already
>>> complains about it. So I had to remove it from the DTS for a time being.
>>>
>>
>> Did you enable all the clocks/power domains/etc for the GPU SMMU? If I
>> remember correctly it is off by default and all registers read as
>> zeroes. The SMMU driver could easily get confused about the capabilities
>> of the SMMU (e.g. the stage 2/virtualization support) if all the ID
>> registers read as zeroes.
> 
> Ah, this is a great idea, thanks. I tried a quick test by enabling only
> clocks that are provided by GCC, but looks like I need to enable GPUCC
> clocks as well. So I need to write a driver for GPUCC or at least
> figure which registers to write with a debugger. I'll try this later.
> 
> By the way, do you have any suggestion about my second issue? When Linux
> in the Dom0 tries to access UFS, CPU gets a secure interrupt and hangs in
> TZ. I had the same exactly behavior when I tried to access EMAC without 
> enabling
> clocks and power domains in U-Boot. But Linux should enable all
> prerequisites for UFS... I suspect that there is an additional
> initialization needs to be done, but I didn't figured it yet.

Maybe it would be easiest to try enabling UFS in U-Boot first? I have it
working on SDM845 and SM8250, so it should be easy enough to add SM8150
as well...

You can find the UFS and PHY patches in the branch linked below (sorry
it's not very clean... Maybe easier to just add your drivers on top)

This way we can more easily dig in and see what the root cause is.

If you run into issues there let me know and I can maybe give it a try
on an SM8150 HDK.

https://git.codelinaro.org/linaro/qcomlt/u-boot/-/commits/caleb/rbx-integration/?ref_type=HEADS
> 

-- 
// Caleb (they/them)


Re: [PATCH 0/8] Add support for Qualcomm SA8155-ADP board

2024-03-04 Thread Volodymyr Babchuk


Hi Stephan,

Stephan Gerhold  writes:

> On Fri, Mar 01, 2024 at 06:25:39PM +, Volodymyr Babchuk wrote:
>> Caleb Connolly  writes:
>> > On 29/02/2024 14:21, Volodymyr Babchuk wrote:
>> >> This patch series adds support for Qualcomm SA8155-ADP development
>> >> board. Main motivation for this series is to allow running
>> >> virtualization software on this board and U-Boot is a good way to
>> >> break Qualcomm's boot chain at EL2 with more convenient ways for
>> >> uploading and running the code. With this patches applied it is
>> >> possible to upload and run Xen on this board. KVM probably should work
>> >> too.
>> >
>> > This is really cool! I've experimented with this on SDM845 and SM8250
>> > but never really did anything with it... I'd love to take a look at your
>> > Xen branch?
>> 
>> Honestly, there is nothing to look at right now. I just implemented
>> early printk serial driver for the qcom, made hacks to the device tree
>> and trying to boot Dom0. I already expecting issues with the GPU,
>> because it has own SMMU without virtualization support and Xen already
>> complains about it. So I had to remove it from the DTS for a time being.
>> 
>
> Did you enable all the clocks/power domains/etc for the GPU SMMU? If I
> remember correctly it is off by default and all registers read as
> zeroes. The SMMU driver could easily get confused about the capabilities
> of the SMMU (e.g. the stage 2/virtualization support) if all the ID
> registers read as zeroes.

Ah, this is a great idea, thanks. I tried a quick test by enabling only
clocks that are provided by GCC, but looks like I need to enable GPUCC
clocks as well. So I need to write a driver for GPUCC or at least
figure which registers to write with a debugger. I'll try this later.

By the way, do you have any suggestion about my second issue? When Linux
in the Dom0 tries to access UFS, CPU gets a secure interrupt and hangs in
TZ. I had the same exactly behavior when I tried to access EMAC without enabling
clocks and power domains in U-Boot. But Linux should enable all
prerequisites for UFS... I suspect that there is an additional
initialization needs to be done, but I didn't figured it yet.

-- 
WBR, Volodymyr

Re: [PATCH 0/8] Add support for Qualcomm SA8155-ADP board

2024-03-04 Thread Stephan Gerhold
On Fri, Mar 01, 2024 at 06:25:39PM +, Volodymyr Babchuk wrote:
> Caleb Connolly  writes:
> > On 29/02/2024 14:21, Volodymyr Babchuk wrote:
> >> This patch series adds support for Qualcomm SA8155-ADP development
> >> board. Main motivation for this series is to allow running
> >> virtualization software on this board and U-Boot is a good way to
> >> break Qualcomm's boot chain at EL2 with more convenient ways for
> >> uploading and running the code. With this patches applied it is
> >> possible to upload and run Xen on this board. KVM probably should work
> >> too.
> >
> > This is really cool! I've experimented with this on SDM845 and SM8250
> > but never really did anything with it... I'd love to take a look at your
> > Xen branch?
> 
> Honestly, there is nothing to look at right now. I just implemented
> early printk serial driver for the qcom, made hacks to the device tree
> and trying to boot Dom0. I already expecting issues with the GPU,
> because it has own SMMU without virtualization support and Xen already
> complains about it. So I had to remove it from the DTS for a time being.
> 

Did you enable all the clocks/power domains/etc for the GPU SMMU? If I
remember correctly it is off by default and all registers read as
zeroes. The SMMU driver could easily get confused about the capabilities
of the SMMU (e.g. the stage 2/virtualization support) if all the ID
registers read as zeroes.

Thanks,
Stephan


Re: [PATCH 0/8] Add support for Qualcomm SA8155-ADP board

2024-03-01 Thread Volodymyr Babchuk


Hi Caleb,

Caleb Connolly  writes:

> On 29/02/2024 14:21, Volodymyr Babchuk wrote:
>> 
>> This patch series adds support for Qualcomm SA8155-ADP development
>> board. Main motivation for this series is to allow running
>> virtualization software on this board and U-Boot is a good way to
>> break Qualcomm's boot chain at EL2 with more convenient ways for
>> uploading and running the code. With this patches applied it is
>> possible to upload and run Xen on this board. KVM probably should work
>> too.
>
> This is really cool! I've experimented with this on SDM845 and SM8250
> but never really did anything with it... I'd love to take a look at your
> Xen branch?

Honestly, there is nothing to look at right now. I just implemented
early printk serial driver for the qcom, made hacks to the device tree
and trying to boot Dom0. I already expecting issues with the GPU,
because it has own SMMU without virtualization support and Xen already
complains about it. So I had to remove it from the DTS for a time being.

Anyways, right now my Dom0 does not want to boot due to some issues with
UFS. I suspect that some power domain or clock is disabled or some
other bit of initialization is missing in the mainline Linux. And
reason why bare Linux kernel have no issues with UFS is because
aboot/xbl does proper UFS initialization, while in my case I am skipping
the android bootloader completely...

I'll publish my work when I'll get Dom0 running.

-- 
WBR, Volodymyr

Re: [PATCH 0/8] Add support for Qualcomm SA8155-ADP board

2024-03-01 Thread Caleb Connolly



On 01/03/2024 18:25, Volodymyr Babchuk wrote:
> 
> Hi Caleb,
> 
> Caleb Connolly  writes:
> 
>> On 29/02/2024 14:21, Volodymyr Babchuk wrote:
>>>
>>> This patch series adds support for Qualcomm SA8155-ADP development
>>> board. Main motivation for this series is to allow running
>>> virtualization software on this board and U-Boot is a good way to
>>> break Qualcomm's boot chain at EL2 with more convenient ways for
>>> uploading and running the code. With this patches applied it is
>>> possible to upload and run Xen on this board. KVM probably should work
>>> too.
>>
>> This is really cool! I've experimented with this on SDM845 and SM8250
>> but never really did anything with it... I'd love to take a look at your
>> Xen branch?
> 
> Honestly, there is nothing to look at right now. I just implemented
> early printk serial driver for the qcom, made hacks to the device tree
> and trying to boot Dom0. I already expecting issues with the GPU,
> because it has own SMMU without virtualization support and Xen already
> complains about it. So I had to remove it from the DTS for a time being.

Hmm, I see. You'll also definitely start running into issues with the
DSPs and probably anything else that loads firmware. Qualcomm's
hypervisor seems to be involved in booting a lot of the peripherals. The
sc7180 Chromebook support is probably a good reference for how to do
this in Linux as they also run in EL2.
> 
> Anyways, right now my Dom0 does not want to boot due to some issues with
> UFS. I suspect that some power domain or clock is disabled or some
> other bit of initialization is missing in the mainline Linux. And
> reason why bare Linux kernel have no issues with UFS is because
> aboot/xbl does proper UFS initialization, while in my case I am skipping
> the android bootloader completely...

Oh that's always fun...
> 
> I'll publish my work when I'll get Dom0 running.

For sure, I'd love to try it out!

It's really exciting to know you're working on this :D
> 

-- 
// Caleb (they/them)


Re: [PATCH 0/8] Add support for Qualcomm SA8155-ADP board

2024-03-01 Thread Caleb Connolly



On 29/02/2024 14:21, Volodymyr Babchuk wrote:
> 
> This patch series adds support for Qualcomm SA8155-ADP development
> board. Main motivation for this series is to allow running
> virtualization software on this board and U-Boot is a good way to
> break Qualcomm's boot chain at EL2 with more convenient ways for
> uploading and running the code. With this patches applied it is
> possible to upload and run Xen on this board. KVM probably should work
> too.

This is really cool! I've experimented with this on SDM845 and SM8250
but never really did anything with it... I'd love to take a look at your
Xen branch?
> 
> I added myself as a maintainer for this board, but my abilities to
> maintain it are quite limited as I have no access to Qualcomm
> documentation. I used mostly Linux drivers as the source for
> device-specific information, like register addresses and offsets.
> If anyone wants to maintain this, I will gladly agree.
> 
> 
> Volodymyr Babchuk (8):
>   clk: qcom: clear div mask before assigning new divider
>   dts: qcom: import device trees and bindings for SA8155P-ADP
>   net: dw_eth_qos: add support for Qualcomm SM8150 SoC
>   clk: qcom: add support for power domains uclass
>   clk: qcom: add driver for SM8150 SoC
>   pinctr: qcom: pass pin number to get_function_mux callback
>   pinctrl: qcom: add driver for SM8150 SoC
>   board: add support for Qualcomm SA8155P-ADP board
> 
>  arch/arm/dts/pmm8155au_1.dtsi |  135 +
>  arch/arm/dts/pmm8155au_2.dtsi |  108 +
>  arch/arm/dts/sa8155p-adp-u-boot.dtsi  |   30 +
>  arch/arm/dts/sa8155p-adp.dts  |  606 ++
>  arch/arm/dts/sa8155p.dtsi |   40 +
>  arch/arm/dts/sm8150.dtsi  | 5293 +
>  arch/arm/mach-snapdragon/Kconfig  |   14 +
>  arch/arm/mach-snapdragon/Makefile |2 +
>  arch/arm/mach-snapdragon/init_sa8155p.c   |   30 +
>  arch/arm/mach-snapdragon/sysmap-sm8150.c  |   31 +
>  board/qualcomm/sa8155p-adp/Kconfig|   12 +
>  board/qualcomm/sa8155p-adp/MAINTAINERS|6 +
>  configs/sa8155p_adp_defconfig |   33 +
>  doc/board/qualcomm/index.rst  |1 +
>  doc/board/qualcomm/sa8155p-adp.rst|   94 +
>  drivers/clk/qcom/Kconfig  |8 +
>  drivers/clk/qcom/Makefile |1 +
>  drivers/clk/qcom/clock-qcom.c |   96 +-
>  drivers/clk/qcom/clock-qcom.h |7 +
>  drivers/clk/qcom/clock-sm8150.c   |  234 +
>  drivers/net/dwc_eth_qos.c |4 +
>  drivers/net/dwc_eth_qos.h |2 +
>  drivers/net/dwc_eth_qos_qcom.c|   47 +-
>  drivers/pinctrl/qcom/Kconfig  |7 +
>  drivers/pinctrl/qcom/Makefile |1 +
>  drivers/pinctrl/qcom/pinctrl-apq8016.c|3 +-
>  drivers/pinctrl/qcom/pinctrl-apq8096.c|3 +-
>  drivers/pinctrl/qcom/pinctrl-ipq4019.c|3 +-
>  drivers/pinctrl/qcom/pinctrl-qcom.c   |4 +-
>  drivers/pinctrl/qcom/pinctrl-qcom.h   |3 +-
>  drivers/pinctrl/qcom/pinctrl-qcs404.c |3 +-
>  drivers/pinctrl/qcom/pinctrl-sdm845.c |3 +-
>  drivers/pinctrl/qcom/pinctrl-sm8150.c |  589 ++
>  include/configs/sa8155p_adp.h |   25 +
>  .../dt-bindings/clock/qcom,dispcc-sm8150.h|   76 +
>  include/dt-bindings/clock/qcom,gcc-sm8150.h   |  252 +
>  include/dt-bindings/clock/qcom,gpucc-sm8150.h |   33 +
>  include/dt-bindings/clock/qcom,rpmh.h |   37 +
>  include/dt-bindings/dma/qcom-gpi.h|   11 +
>  include/dt-bindings/firmware/qcom,scm.h   |   39 +
>  include/dt-bindings/iio/qcom,spmi-vadc.h  |  303 +
>  .../dt-bindings/interconnect/qcom,osm-l3.h|   15 +
>  .../dt-bindings/interconnect/qcom,sm8150.h|  159 +
>  include/dt-bindings/phy/phy-qcom-qmp.h|   20 +
>  include/dt-bindings/power/qcom-rpmpd.h|  412 ++
>  .../regulator/qcom,rpmh-regulator.h   |   36 +
>  include/dt-bindings/soc/qcom,rpmh-rsc.h   |   14 +
>  47 files changed, 8866 insertions(+), 19 deletions(-)
>  create mode 100644 arch/arm/dts/pmm8155au_1.dtsi
>  create mode 100644 arch/arm/dts/pmm8155au_2.dtsi
>  create mode 100644 arch/arm/dts/sa8155p-adp-u-boot.dtsi
>  create mode 100644 arch/arm/dts/sa8155p-adp.dts
>  create mode 100644 arch/arm/dts/sa8155p.dtsi
>  create mode 100644 arch/arm/dts/sm8150.dtsi
>  create mode 100644 arch/arm/mach-snapdragon/init_sa8155p.c
>  create mode 100644 arch/arm/mach-snapdragon/sysmap-sm8150.c
>  create mode 100644 board/qualcomm/sa8155p-adp/Kconfig
>  create mode 100644 board/qualcomm/sa8155p-adp/MAINTAINERS
>  create mode 100644 configs/sa8155p_adp_defconfig
>  create mode 100644 doc/board/qualcomm/sa8155p-adp.rst
>  create mode 100644 drivers/clk/qcom/clock-sm8150.c
>  create mode 100644 drivers/pinctrl/qcom/pinctrl-sm8150.c

[PATCH 0/8] Add support for Qualcomm SA8155-ADP board

2024-02-29 Thread Volodymyr Babchuk


This patch series adds support for Qualcomm SA8155-ADP development
board. Main motivation for this series is to allow running
virtualization software on this board and U-Boot is a good way to
break Qualcomm's boot chain at EL2 with more convenient ways for
uploading and running the code. With this patches applied it is
possible to upload and run Xen on this board. KVM probably should work
too.

I added myself as a maintainer for this board, but my abilities to
maintain it are quite limited as I have no access to Qualcomm
documentation. I used mostly Linux drivers as the source for
device-specific information, like register addresses and offsets.
If anyone wants to maintain this, I will gladly agree.


Volodymyr Babchuk (8):
  clk: qcom: clear div mask before assigning new divider
  dts: qcom: import device trees and bindings for SA8155P-ADP
  net: dw_eth_qos: add support for Qualcomm SM8150 SoC
  clk: qcom: add support for power domains uclass
  clk: qcom: add driver for SM8150 SoC
  pinctr: qcom: pass pin number to get_function_mux callback
  pinctrl: qcom: add driver for SM8150 SoC
  board: add support for Qualcomm SA8155P-ADP board

 arch/arm/dts/pmm8155au_1.dtsi |  135 +
 arch/arm/dts/pmm8155au_2.dtsi |  108 +
 arch/arm/dts/sa8155p-adp-u-boot.dtsi  |   30 +
 arch/arm/dts/sa8155p-adp.dts  |  606 ++
 arch/arm/dts/sa8155p.dtsi |   40 +
 arch/arm/dts/sm8150.dtsi  | 5293 +
 arch/arm/mach-snapdragon/Kconfig  |   14 +
 arch/arm/mach-snapdragon/Makefile |2 +
 arch/arm/mach-snapdragon/init_sa8155p.c   |   30 +
 arch/arm/mach-snapdragon/sysmap-sm8150.c  |   31 +
 board/qualcomm/sa8155p-adp/Kconfig|   12 +
 board/qualcomm/sa8155p-adp/MAINTAINERS|6 +
 configs/sa8155p_adp_defconfig |   33 +
 doc/board/qualcomm/index.rst  |1 +
 doc/board/qualcomm/sa8155p-adp.rst|   94 +
 drivers/clk/qcom/Kconfig  |8 +
 drivers/clk/qcom/Makefile |1 +
 drivers/clk/qcom/clock-qcom.c |   96 +-
 drivers/clk/qcom/clock-qcom.h |7 +
 drivers/clk/qcom/clock-sm8150.c   |  234 +
 drivers/net/dwc_eth_qos.c |4 +
 drivers/net/dwc_eth_qos.h |2 +
 drivers/net/dwc_eth_qos_qcom.c|   47 +-
 drivers/pinctrl/qcom/Kconfig  |7 +
 drivers/pinctrl/qcom/Makefile |1 +
 drivers/pinctrl/qcom/pinctrl-apq8016.c|3 +-
 drivers/pinctrl/qcom/pinctrl-apq8096.c|3 +-
 drivers/pinctrl/qcom/pinctrl-ipq4019.c|3 +-
 drivers/pinctrl/qcom/pinctrl-qcom.c   |4 +-
 drivers/pinctrl/qcom/pinctrl-qcom.h   |3 +-
 drivers/pinctrl/qcom/pinctrl-qcs404.c |3 +-
 drivers/pinctrl/qcom/pinctrl-sdm845.c |3 +-
 drivers/pinctrl/qcom/pinctrl-sm8150.c |  589 ++
 include/configs/sa8155p_adp.h |   25 +
 .../dt-bindings/clock/qcom,dispcc-sm8150.h|   76 +
 include/dt-bindings/clock/qcom,gcc-sm8150.h   |  252 +
 include/dt-bindings/clock/qcom,gpucc-sm8150.h |   33 +
 include/dt-bindings/clock/qcom,rpmh.h |   37 +
 include/dt-bindings/dma/qcom-gpi.h|   11 +
 include/dt-bindings/firmware/qcom,scm.h   |   39 +
 include/dt-bindings/iio/qcom,spmi-vadc.h  |  303 +
 .../dt-bindings/interconnect/qcom,osm-l3.h|   15 +
 .../dt-bindings/interconnect/qcom,sm8150.h|  159 +
 include/dt-bindings/phy/phy-qcom-qmp.h|   20 +
 include/dt-bindings/power/qcom-rpmpd.h|  412 ++
 .../regulator/qcom,rpmh-regulator.h   |   36 +
 include/dt-bindings/soc/qcom,rpmh-rsc.h   |   14 +
 47 files changed, 8866 insertions(+), 19 deletions(-)
 create mode 100644 arch/arm/dts/pmm8155au_1.dtsi
 create mode 100644 arch/arm/dts/pmm8155au_2.dtsi
 create mode 100644 arch/arm/dts/sa8155p-adp-u-boot.dtsi
 create mode 100644 arch/arm/dts/sa8155p-adp.dts
 create mode 100644 arch/arm/dts/sa8155p.dtsi
 create mode 100644 arch/arm/dts/sm8150.dtsi
 create mode 100644 arch/arm/mach-snapdragon/init_sa8155p.c
 create mode 100644 arch/arm/mach-snapdragon/sysmap-sm8150.c
 create mode 100644 board/qualcomm/sa8155p-adp/Kconfig
 create mode 100644 board/qualcomm/sa8155p-adp/MAINTAINERS
 create mode 100644 configs/sa8155p_adp_defconfig
 create mode 100644 doc/board/qualcomm/sa8155p-adp.rst
 create mode 100644 drivers/clk/qcom/clock-sm8150.c
 create mode 100644 drivers/pinctrl/qcom/pinctrl-sm8150.c
 create mode 100644 include/configs/sa8155p_adp.h
 create mode 100644 include/dt-bindings/clock/qcom,dispcc-sm8150.h
 create mode 100644 include/dt-bindings/clock/qcom,gcc-sm8150.h
 create mode 100644 include/dt-bindings/clock/qcom,gpucc-sm8150.h
 create mode 100644 include/dt-bindings/clock/qcom,rpmh.h
 create mode 100644 include/dt-bindings/dma/qcom-gpi.h
 create mode 100644