From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id EEF39EEAA; Sat, 28 Jun 2025 14:30:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1751121047; cv=none; b=B71bJXd9T6d4L5Fch5CN9LDziP0racZnLWGnnSl7wsu3nPKjfBhrqdeyeMw8c0WNig+BkVXV/yeRAZVtdeTloqfipB1EyFDL/FvIIPJIanXtt8OVrM8BqqO2xEHvW/zfvwjp52TW8q5r3KRDUU27B5RmpIJjilK2n++ZmwFyOzg= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1751121047; c=relaxed/simple; bh=Zjca297UPm9qRvcIWvdjcDdDUN0GQEN4ZAaapxXydnI=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=m72Ew5ogiohc2znab4wMvevO66wpfeWL2rqBvY9aRH0sped2CW3lNrTsRMeyMQhSjPom6LtnpKiUx2t98v81tpvJxZbKLB07Y/GfyIbZj/jDcqNXqnpltn0xSRum4CweuUH2Nw2QXhmou5/T7Ik3kaaSp3AB5TCGWhT0itaNanI= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=eVaW43Sl; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="eVaW43Sl" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 20DC1C4CEEA; Sat, 28 Jun 2025 14:30:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1751121046; bh=Zjca297UPm9qRvcIWvdjcDdDUN0GQEN4ZAaapxXydnI=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=eVaW43Sl/FlOO9tXaYKFjoHnVxXZvH0PCA3tsUNCALkdHjsEmxPo5473himU/xcKe 6cf1OP0Pb2SVEArJeEkRitdgSgNNuVWwnhUcfZO/MdRQORUwRPsS37MbGLRWFO2afg 594BZkclWAGh5TsenxRGZ3XzZKhXYXnmfLvofJTU= Date: Sat, 28 Jun 2025 16:30:44 +0200 From: Greg Kroah-Hartman To: Komal Bajaj Cc: linux-arm-msm@vger.kernel.org, linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, Souradeep Chowdhury , Konrad Dybcio Subject: Re: [PATCH v2] usb: misc: qcom_eud: Access EUD_MODE_MANAGER2 through secure calls Message-ID: <2025062833-sneak-ceremony-a06b@gregkh> References: <20250627125131.27606-1-komal.bajaj@oss.qualcomm.com> Precedence: bulk X-Mailing-List: linux-usb@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20250627125131.27606-1-komal.bajaj@oss.qualcomm.com> On Fri, Jun 27, 2025 at 06:21:31PM +0530, Komal Bajaj wrote: > EUD_MODE_MANAGER2 register is mapped to a memory region that is marked > as read-only for HLOS, enforcing access restrictions that prohibit > direct memory-mapped writes via writel(). > > Attempts to write to this region from HLOS can result in silent failures > or memory access violations, particularly when toggling EUD (Embedded > USB Debugger) state. To ensure secure register access, modify the driver > to use qcom_scm_io_writel(), which routes the write operation to Qualcomm > Secure Channel Monitor (SCM). SCM has the necessary permissions to access > protected memory regions, enabling reliable control over EUD state. > > SC7280, the only user of EUD is also affected, indicating that this could > never have worked on a properly fused device. > > Fixes: 9a1bf58ccd44 ("usb: misc: eud: Add driver support for Embedded USB Debugger(EUD)") > Signed-off-by: Melody Olvera > Signed-off-by: Komal Bajaj > Reviewed-by: Konrad Dybcio > --- > Changes in v2: > * Drop separate compatible to be added for secure eud > * Use secure call to access EUD mode manager register > * Link to v1: https://lore.kernel.org/all/20240807183205.803847-1-quic_molvera@quicinc.com/ > > drivers/usb/misc/qcom_eud.c | 20 ++++++++++++++------ > 1 file changed, 14 insertions(+), 6 deletions(-) > > diff --git a/drivers/usb/misc/qcom_eud.c b/drivers/usb/misc/qcom_eud.c > index 83079c414b4f..30c999c49eb0 100644 > --- a/drivers/usb/misc/qcom_eud.c > +++ b/drivers/usb/misc/qcom_eud.c > @@ -16,6 +16,8 @@ > #include > #include > > +#include > + > #define EUD_REG_INT1_EN_MASK 0x0024 > #define EUD_REG_INT_STATUS_1 0x0044 > #define EUD_REG_CTL_OUT_1 0x0074 > @@ -34,7 +36,7 @@ struct eud_chip { > struct device *dev; > struct usb_role_switch *role_sw; > void __iomem *base; > - void __iomem *mode_mgr; > + phys_addr_t mode_mgr; > unsigned int int_status; > int irq; > bool enabled; > @@ -43,10 +45,14 @@ struct eud_chip { > > static int enable_eud(struct eud_chip *priv) > { > + int ret; > + > writel(EUD_ENABLE, priv->base + EUD_REG_CSR_EUD_EN); > writel(EUD_INT_VBUS | EUD_INT_SAFE_MODE, > priv->base + EUD_REG_INT1_EN_MASK); > - writel(1, priv->mode_mgr + EUD_REG_EUD_EN2); > + ret = qcom_scm_io_writel(priv->mode_mgr + EUD_REG_EUD_EN2, 1); > + if (ret) > + return ret; > > return usb_role_switch_set_role(priv->role_sw, USB_ROLE_DEVICE); > } > @@ -54,7 +60,7 @@ static int enable_eud(struct eud_chip *priv) > static void disable_eud(struct eud_chip *priv) > { > writel(0, priv->base + EUD_REG_CSR_EUD_EN); > - writel(0, priv->mode_mgr + EUD_REG_EUD_EN2); > + qcom_scm_io_writel(priv->mode_mgr + EUD_REG_EUD_EN2, 0); > } > > static ssize_t enable_show(struct device *dev, > @@ -178,6 +184,7 @@ static void eud_role_switch_release(void *data) > static int eud_probe(struct platform_device *pdev) > { > struct eud_chip *chip; > + struct resource *res; > int ret; > > chip = devm_kzalloc(&pdev->dev, sizeof(*chip), GFP_KERNEL); > @@ -200,9 +207,10 @@ static int eud_probe(struct platform_device *pdev) > if (IS_ERR(chip->base)) > return PTR_ERR(chip->base); > > - chip->mode_mgr = devm_platform_ioremap_resource(pdev, 1); > - if (IS_ERR(chip->mode_mgr)) > - return PTR_ERR(chip->mode_mgr); > + res = platform_get_resource(pdev, IORESOURCE_MEM, 1); > + if (!res) > + return -ENODEV; > + chip->mode_mgr = res->start; > > chip->irq = platform_get_irq(pdev, 0); > if (chip->irq < 0) > -- > 2.48.1 > > Hi, This is the friendly patch-bot of Greg Kroah-Hartman. You have sent him a patch that has triggered this response. He used to manually respond to these common problems, but in order to save his sanity (he kept writing the same thing over and over, yet to different people), I was created. Hopefully you will not take offence and will fix the problem in your patch and resubmit it so that it can be accepted into the Linux kernel tree. You are receiving this message because of the following common error(s) as indicated below: - You have marked a patch with a "Fixes:" tag for a commit that is in an older released kernel, yet you do not have a cc: stable line in the signed-off-by area at all, which means that the patch will not be applied to any older kernel releases. To properly fix this, please follow the documented rules in the Documentation/process/stable-kernel-rules.rst file for how to resolve this. If you wish to discuss this problem further, or you have questions about how to resolve this issue, please feel free to respond to this email and Greg will reply once he has dug out from the pending patches received from other developers. thanks, greg k-h's patch email bot