From: Sean Anderson <sean.anderson@linux.dev>
To: Radhey Shyam Pandey <radhey.shyam.pandey@amd.com>,
Laurent Pinchart <laurent.pinchart@ideasonboard.com>,
linux-phy@lists.infradead.org
Cc: Vinod Koul <vkoul@kernel.org>,
linux-arm-kernel@lists.infradead.org,
Kishon Vijay Abraham I <kishon@kernel.org>,
linux-kernel@vger.kernel.org, Michal Simek <michal.simek@amd.com>,
Sean Anderson <sean.anderson@linux.dev>
Subject: [PATCH v3 4/5] phy: zynqmp: Take the phy mutex in xlate
Date: Fri, 28 Jun 2024 16:55:39 -0400 [thread overview]
Message-ID: <20240628205540.3098010-5-sean.anderson@linux.dev> (raw)
In-Reply-To: <20240628205540.3098010-1-sean.anderson@linux.dev>
Take the phy mutex in xlate to protect against concurrent
modification/access to gtr_phy. This does not typically cause any
issues, since in most systems the phys are only xlated once and
thereafter accessed with the phy API (which takes the locks). However,
we are about to allow userspace to access phys for debugging, so it's
important to avoid any data races.
Signed-off-by: Sean Anderson <sean.anderson@linux.dev>
---
Changes in v3:
- New
drivers/phy/xilinx/phy-zynqmp.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/phy/xilinx/phy-zynqmp.c b/drivers/phy/xilinx/phy-zynqmp.c
index 4d697e11d8eb..991be42eef3d 100644
--- a/drivers/phy/xilinx/phy-zynqmp.c
+++ b/drivers/phy/xilinx/phy-zynqmp.c
@@ -759,6 +759,7 @@ static struct phy *xpsgtr_xlate(struct device *dev,
phy_type = args->args[1];
phy_instance = args->args[2];
+ guard(mutex)(>r_phy->phy->mutex);
ret = xpsgtr_set_lane_type(gtr_phy, phy_type, phy_instance);
if (ret < 0) {
dev_err(gtr_dev->dev, "Invalid PHY type and/or instance\n");
--
2.35.1.1320.gc452695387.dirty
--
linux-phy mailing list
linux-phy@lists.infradead.org
https://lists.infradead.org/mailman/listinfo/linux-phy
next prev parent reply other threads:[~2024-06-28 20:57 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-06-28 20:55 [PATCH v3 0/5] phy: zynqmp: Fixes and debugfs support Sean Anderson
2024-06-28 20:55 ` [PATCH v3 1/5] phy: zynqmp: Enable reference clock correctly Sean Anderson
2024-06-28 20:55 ` [PATCH v3 2/5] phy: zynqmp: Store instance instead of type Sean Anderson
2024-06-28 20:55 ` [PATCH v3 3/5] phy: zynqmp: Only wait for PLL lock "primary" instances Sean Anderson
2024-06-28 20:55 ` Sean Anderson [this message]
2024-06-28 20:55 ` [PATCH v3 5/5] phy: zynqmp: Add debugfs support Sean Anderson
2024-07-02 13:35 ` [PATCH v3 0/5] phy: zynqmp: Fixes and " Vinod Koul
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240628205540.3098010-5-sean.anderson@linux.dev \
--to=sean.anderson@linux.dev \
--cc=kishon@kernel.org \
--cc=laurent.pinchart@ideasonboard.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-phy@lists.infradead.org \
--cc=michal.simek@amd.com \
--cc=radhey.shyam.pandey@amd.com \
--cc=vkoul@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).