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

Re: [PATCH 3/3] arm: platform: qcom: add basic support SA8155P SoC


  • To: Volodymyr Babchuk <Volodymyr_Babchuk@xxxxxxxx>, "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: Michal Orzel <michal.orzel@xxxxxxx>
  • Date: Wed, 3 Apr 2024 10:16:23 +0200
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=epam.com smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none (0)
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=OHxMjhwmAzimPSJP1VTomeYb5uReXxIrg/cUbSKwr4Q=; b=Gl5NuMnHMFTtsp0ds9qs1k6h0/VMvyPFmUQWtUXqbDkwwGyg8ot7aJgeFz3zTX0JP3xeWZYJ3i47kCRkQIMa7YOEcGxgDsQJLYXnyRLaOaTgB1i/uHPhvk5Yx+sJ/lY19hjutwsu3AY45F6YTLYLZt4hZoI6IAgFacdLYRt2S6S4ussKgGjUhftBUFtCxufUbcKHpBSE8SHXL+TbsrTd1js6z5hY+alECAF0tAOQLWI/8j8YhNRwnsu71dXd7J8hFjNIbBvTahSBDV2ZUARjWHO7Q2s6A8bgdPk6SeWuWFQzk7ATLKOT7Vq+jOZFn5TWic3qFrC2ZDlBuJEt9IcJtA==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=mtBIhvhaCtQqHGqfiQOGr8MkyoExC4A3kwGQPn4R59q0qZ0uK8rIAt0WRjTs/HBJrwb7ahJoP4UFqXoUqVMk7Xr4+uH3dwvPHkPJmoftp7Hx5pQZgOJ9jaJHIQ7F181zwZgcSXpMBDuQau9mzqIB3RhREEZIiB2PF9vRopWCg2JfNMzbvYcKr6VacyYzXmnPo/8IbzwfXdaBQE0HT+YLXIl/hCGEcf4nuIfl4Rm+2t8Wt5Xow5BuH1lkO0s6eyFbzFePs45PHn2+10v30U/RP8C5vY3yHqIOtJClqwNXOMMROngwCa1roVkZQtnVV6KthTvnNRI8bEpe9bqyw4S26w==
  • Cc: Stefano Stabellini <sstabellini@xxxxxxxxxx>, Julien Grall <julien@xxxxxxx>, Bertrand Marquis <bertrand.marquis@xxxxxxx>
  • Delivery-date: Wed, 03 Apr 2024 08:16:38 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

Hello,

On 29/03/2024 01:08, Volodymyr Babchuk wrote:
> 
> 
> Qualcomm SA8155P is the automotive variant of SM8150 aka Snapdragon
> 855.
> 
> This patch adds very basic support for the platform. We need to handle
> Qualcomm-specific SMC to workaround quirk in the QCOM SCM driver in
> the Linux kernel. Basically the driver tries multiple different SMCs
> to determine which calling convention is supported by a SoC. If all
> calls fail it decides that the SoC uses "legacy SMC" and tries to
> communicate with SCM by issuing SMC with funcid = 1. Problem is that
> Xen has own understanding on how such SMC should be handled. It
> interprets this SMC as legacy PSCI_cpu_off and happily turns of Linux
> boot CPU.
> 
> To workaround this, we pretend that we support
> QCOM_SCM_INFO_IS_CALL_AVAIL, this will make the driver use the latest
> calling convention. All subsequent calls will fail anyways and the
> driver will terminate self gracefully. This is not a big deal, because
> right now (with Linux 6.8) even on baremetal setup the driver fails
> anyways, because it does not know how to work with this SoC.
Therefore I would consider adding a Kconfig option and placing it under 
experimental

> 
> Signed-off-by: Volodymyr Babchuk <volodymyr_babchuk@xxxxxxxx>
> ---
>  xen/arch/arm/platforms/Makefile |  1 +
>  xen/arch/arm/platforms/qcom.c   | 77 +++++++++++++++++++++++++++++++++
>  2 files changed, 78 insertions(+)
>  create mode 100644 xen/arch/arm/platforms/qcom.c
> 
> diff --git a/xen/arch/arm/platforms/Makefile b/xen/arch/arm/platforms/Makefile
> index 8632f4115f..6873735ef0 100644
> --- a/xen/arch/arm/platforms/Makefile
> +++ b/xen/arch/arm/platforms/Makefile
> @@ -9,5 +9,6 @@ obj-$(CONFIG_ALL_PLAT)   += sunxi.o
>  obj-$(CONFIG_ALL64_PLAT) += thunderx.o
>  obj-$(CONFIG_ALL64_PLAT) += xgene-storm.o
>  obj-$(CONFIG_ALL64_PLAT) += brcm-raspberry-pi.o
> +obj-$(CONFIG_ALL64_PLAT) += qcom.o
>  obj-$(CONFIG_MPSOC_PLATFORM)  += xilinx-zynqmp.o
>  obj-$(CONFIG_MPSOC_PLATFORM)  += xilinx-zynqmp-eemi.o
> diff --git a/xen/arch/arm/platforms/qcom.c b/xen/arch/arm/platforms/qcom.c
> new file mode 100644
> index 0000000000..77e9c58649
> --- /dev/null
> +++ b/xen/arch/arm/platforms/qcom.c
> @@ -0,0 +1,77 @@
> +/*
> + * xen/arch/arm/platforms/qcom.c
> + *
> + * Qualcomm SoCs specific code
> + *
> + * Volodymyr Babchuk <volodymyr_babchuk@xxxxxxxx>
> + *
> + * Copyright (c) 2024 EPAM Systems.
> + *
> + * This program is free software; you can redistribute it and/or modify
> + * it under the terms of the GNU General Public License as published by
> + * the Free Software Foundation; either version 2 of the License, or
> + * (at your option) any later version.
> + *
> + * This program is distributed in the hope that it will be useful,
> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> + * GNU General Public License for more details.
Please use SPDX identifier instead of license text

> + */
> +
> +#include <asm/platform.h>
> +#include <public/arch-arm/smccc.h>
no need for this public header

> +#include <asm/smccc.h>
> +
> +#define SCM_SMC_FNID(s, c)     ((((s) & 0xFF) << 8) | ((c) & 0xFF))
spaces instead of tabs

> +#define QCOM_SCM_SVC_INFO              0x06
spaces instead of tabs

> +#define QCOM_SCM_INFO_IS_CALL_AVAIL    0x01
> +
> +#define ARM_SMCCC_SIP_QCOM_SCM_IS_CALL_AVAIL                            \
> +    ARM_SMCCC_CALL_VAL(ARM_SMCCC_FAST_CALL,                             \
> +                       ARM_SMCCC_CONV_64,                               \
> +                       ARM_SMCCC_OWNER_SIP,                             \
> +                       SCM_SMC_FNID(QCOM_SCM_SVC_INFO,                  \
> +                                    QCOM_SCM_INFO_IS_CALL_AVAIL))
> +
> +static const char * const sa8155p_dt_compat[] __initconst =
> +{
> +    "qcom,sa8155p",
> +    NULL
> +};
> +
> +static bool sa8155p_smc(struct cpu_user_regs *regs)
> +{
> +    uint32_t funcid = get_user_reg(regs, 0);
> +
> +    switch ( funcid ) {
brace should be placed on a new line

~Michal



 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.