From patchwork Tue Jan 21 06:56:39 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 13945896 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 4E4D3C02182 for ; Tue, 21 Jan 2025 07:28:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From: Reply-To:Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=CYN8MRS1RnP1foydPVEerv8n1UG6uH1Hz3MnU6KlRGQ=; b=mI2nSgfkJP+SS2dWGIRG5W+J+/ k06h+DbcxUVyxYS421amzbZKooJ05Qvp/m4GBGLBqJcs9Vw/qLk/3Rrm811+GVHpZTjPbtw/gS6Xg acHqSnJmP9MCLih2VFujGWPRWaw0HqKAEqMR6LzNIGKPZQ/V/w/JcwY6tosfT0ZhgjZzNM8Z/2oEi Qx/AgiEIV+IlLi322kazpHu7bLa8YHMWuf35wmJfj8tX9Oc84LBAXq7OMrxZ7OAfcYmEkCVippKI3 XGism4im7ysCLxuzkDlYR2abMhUa4kzdbNtshgmcnoXhVxYWkeysIvZgxarii+ibr3dL3ncp01aXY 8NKCLvAQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1ta8gh-000000078cn-0b2U; Tue, 21 Jan 2025 07:28:39 +0000 Received: from mail-pl1-x632.google.com ([2607:f8b0:4864:20::632]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1ta8DD-0000000732V-2vvc for linux-arm-kernel@lists.infradead.org; Tue, 21 Jan 2025 06:58:12 +0000 Received: by mail-pl1-x632.google.com with SMTP id d9443c01a7336-2166f1e589cso126959715ad.3 for ; Mon, 20 Jan 2025 22:58:11 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1737442691; x=1738047491; darn=lists.infradead.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=CYN8MRS1RnP1foydPVEerv8n1UG6uH1Hz3MnU6KlRGQ=; b=nAQAmX2I0ji3qge3bGz8nj09cbdyQQoRhAnP86N2/NVE2QY3RA3nYqvXQJRRO+JLLw bzCX0YHQwNUKZnjVOEMhq+WvVh8eNVKpdz3tSomXrJMQFzIrPZie03ubEojN/3wMnwHp QJwDWoMqloVep+PgQ7rqggvBU8mr25SVZFMnDH267+lsd6aHxj9VyF2zm2KYAVm5kcBC Md0Rog8T9tLkOIANeOs1rsXxASOCO8XeogTandyOZCdgqPaa2NOfjf7Mv2i3mixQYhh+ 5Ovb85K8+Fmls1IiWHAcbEydVc/3ewScu7RcLvjwSKMk9cEmene/cqmEF6YtBqCf3U05 Ws7A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1737442691; x=1738047491; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=CYN8MRS1RnP1foydPVEerv8n1UG6uH1Hz3MnU6KlRGQ=; b=h+TyZxf8vygF8jElYSzdFo5e9SlXjFq9kSEACsQTUG8gnPoYkQiUdQyDnfos+jkTri DH72QcCUpou1WvG+rwmu7LdHhxEzGK7Nr6XYSy/vRgDUhe+PvrTz/pMXRDwZRTDcK2nE lMZC713ApKS2C6lgZpa54GuhQrKAppPrifPcEOh5Z0kPAZy3q9hiI5PZLPZ0aNUthWJc alTWbxzUL6P++tjvTjjhzmUnGrqroTKYI13zVrphCaRlAxjZ3rYZV7yw6prH8IoLL9A4 L1fPtJUk5L1/kIUvnX2FQCdTzirKseZarpdgOV7wuqUghHcV2mr2BdznAW5Ffx5iymo2 KOSQ== X-Forwarded-Encrypted: i=1; AJvYcCUFIe333DKkrS6cecDsiliOQ1VX6pGUfUhGgyXKXXaaoQiSUo0nkpIlp4n+YDMVNFBMGCl+O7OSD8Sehul7ueoB@lists.infradead.org X-Gm-Message-State: AOJu0YyINlsSQ98+e6aOL0WDt83HWe+TvahdRhYosR8DixSPe7wKVmC0 l2bpVa9fFbEmqDa34Dgfao8g1azywfDqjnBQW7lN/zCiFTg4Rp/dUfAHCmjRh0k= X-Gm-Gg: ASbGncueq4f/KHYST8A9ajji9HB9NhBSSfRs5mECc1Zr6NXhmSgqIrSRG7opBRV0slo XLA75I/bA5LzwPeNLKUof5nb7XQhK+Y5Sp591OShElSlO23qWpAGRtBCKMgOefDsWY5ufQJcjOv XPNC81MVrKiILcLxsSZpdWWcGyBhWA5KBfq2/0EqhiAOZxnhpI880bty400HEBxgCztO4Qz1VE9 pnqneXbkamUH++htmy00s95PY3pReuUjOSqsZbzxyuPTYepcsi6tLJJgrhtzgU7EIDhlIWt X-Google-Smtp-Source: AGHT+IHEiht+oEKSqPdT2N2V7SuEcCXLPs4D/nYxCT06afvzXSDLl1haDMqTZYOsB5wUU2Y3V6I7PA== X-Received: by 2002:a17:903:32cf:b0:216:5af7:5a8e with SMTP id d9443c01a7336-21c355ec9c0mr238651055ad.26.1737442690920; Mon, 20 Jan 2025 22:58:10 -0800 (PST) Received: from localhost ([122.172.84.139]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-21c2ce9efd6sm70652705ad.23.2025.01.20.22.58.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 20 Jan 2025 22:58:10 -0800 (PST) From: Viresh Kumar To: Sudeep Holla Cc: Viresh Kumar , Vincent Guittot , =?utf-8?q?Alex_Benn=C3=A9e?= , Bill Mills , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH 2/3] firmware: arm_ffa: Setup of_node for ffa devices Date: Tue, 21 Jan 2025 12:26:39 +0530 Message-Id: <0e863a4baea59865aff0d1b5657f548bc0aa8d2a.1737441631.git.viresh.kumar@linaro.org> X-Mailer: git-send-email 2.31.1.272.g89b43f80a514 In-Reply-To: References: MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20250120_225811_734386_01AFA66C X-CRM114-Status: GOOD ( 12.70 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Match and bind the of_node for the FFA device. Signed-off-by: Viresh Kumar --- drivers/firmware/arm_ffa/bus.c | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/drivers/firmware/arm_ffa/bus.c b/drivers/firmware/arm_ffa/bus.c index dea3eb741d95..ca526e438e71 100644 --- a/drivers/firmware/arm_ffa/bus.c +++ b/drivers/firmware/arm_ffa/bus.c @@ -7,6 +7,8 @@ #include #include +#include +#include #include #include #include @@ -187,6 +189,32 @@ bool ffa_device_is_valid(struct ffa_device *ffa_dev) return valid; } +static void ffa_device_of_setup(struct ffa_device *ffa_dev) +{ + struct device_node *np; + uuid_t uuid; + u32 val; + + /* vm-id and UUID must match */ + for_each_compatible_node(np, NULL, "arm,ffa") { + if (of_property_read_u32(np, "vm-id", &val)) + continue; + + if (ffa_dev->vm_id != val) + continue; + + if (of_property_read_u32_array(np, "uuid", (u32 *)&uuid, + sizeof(uuid) / sizeof(u32))) + continue; + + if (!uuid_equal(&ffa_dev->uuid, &uuid)) + continue; + + device_set_node(&ffa_dev->dev, of_fwnode_handle(np)); + break; + } +} + struct ffa_device * ffa_device_register(const struct ffa_partition_info *part_info, const struct ffa_ops *ops) @@ -222,6 +250,8 @@ ffa_device_register(const struct ffa_partition_info *part_info, import_uuid(&uuid, (u8 *)part_info->uuid); uuid_copy(&ffa_dev->uuid, &uuid); + ffa_device_of_setup(ffa_dev); + ret = device_register(&ffa_dev->dev); if (ret) { dev_err(dev, "unable to register device %s err=%d\n", From patchwork Tue Jan 21 06:56:40 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 13945897 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 30193C02182 for ; Tue, 21 Jan 2025 07:30:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From: Reply-To:Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=gpYNm3qlAya2ACRDiV2R40K+VHw6jIU1PcEeONO07Hc=; b=4sFgJTlAJ/csGabVTIFLW2HVqU nTIxyq+mNoVGg8fVVgjXi4t+mXSS2QpMSBlDAkXtWi2avINNWjkoGcLDj0q5rcjlJb0O+NqzLHrcW a7fcUsKtRNTnYS5lBRPT1uCcji3mFaTs006g3wnbqRW+wDsEcXH/ahJnD7T9ZmXuHv1T0PVvNEhRR UqSVdfk/0T85NJvejPTpP8+dHxE8aJaU0f2+v4850yEVrFecYqnjFoOg+Kl+EHdm/Utr4oXcry8gx JgHizEiMsOYhaJPwgTo+oR9kw7Wq3nkFfdLI+iapWy86LvL/hhbwTWFRRITKVMn0iN+p0qt6Elik5 02Dkdo0g==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1ta8hw-000000078nC-3X1i; Tue, 21 Jan 2025 07:29:56 +0000 Received: from mail-pl1-x636.google.com ([2607:f8b0:4864:20::636]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1ta8DG-0000000733Z-3DOY for linux-arm-kernel@lists.infradead.org; Tue, 21 Jan 2025 06:58:15 +0000 Received: by mail-pl1-x636.google.com with SMTP id d9443c01a7336-2162c0f6a39so116136425ad.0 for ; Mon, 20 Jan 2025 22:58:14 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1737442694; x=1738047494; darn=lists.infradead.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=gpYNm3qlAya2ACRDiV2R40K+VHw6jIU1PcEeONO07Hc=; b=ROXzW4+856t5z2SR/6S01jFG6vPPkl/QUrZP5jhwatlgD6yJ+VWsksOVXStMfvaOyf hnrf/DC2wgraEBmLC232SSg6krK3qy6+eb/QO+aphKgUaNzbpq2863LgfEQXuoCCv5L8 B28RhIEn/LYenafEQ5683Vx2aTpSCGBWD8HfihW+PE7tRe2jwPxyv6+R9YkesgV9+JKf MJpgWzCVwZYQB/wR6zUWLG0dke1EDLmuxt0IXEFSGAV7QELpno7prd7g0fCIVj0jkGn7 DEWtd72VMUpAeBA7fZYOyaarC5trJiSxHrf1WMazzlJ380gNhwRfpgkyZhVj6eQDB2QN Zzgg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1737442694; x=1738047494; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=gpYNm3qlAya2ACRDiV2R40K+VHw6jIU1PcEeONO07Hc=; b=OYq0X6IERTAklkycl6mxeoyOUVSiNQYsfnIXnxwFlIJ2ssb8EhlhBvc1tAMam8l7c1 tqUR/fJkjAUlB1q/MxzK17PuaYxMy0lPGBH9tozSrGWWNngQfc1Dt9lKS137K4a5JiaW X0q0RXkM0zQBEJaFvqLc5S5otukiV8ygUPKbmzemLvxAk355UgoruQCj3Qhs2k6LIHzj 5HZgnxvTYNcXO8Gma2KBaKFDjsirqg5M5OoKnZ/Sb36WFKnSVW8tokcrjcsrrOFksWPD +sTAQKu+rVTGcVMVsWglD+2jA5k4G6ciWnfdU3zWBpdlueXmjRDhw+7JTzLnpXccXzL6 Nvvg== X-Forwarded-Encrypted: i=1; AJvYcCU84iX5KWK406NRTKzvRX+b97xBhR5KvhV5rO59UaxrGSnDRudgXsM8qt/eL9NAGluz4d+NMLcQ0iu4Tv9NNdba@lists.infradead.org X-Gm-Message-State: AOJu0YyGitUrLljByv1zhF1CRX7bi2WPNzZbNriO0Z5bSlXSIh98vPEX LX/2RcuTihtTMoT71sum7qwJFjWEeaWt5t5ClIQc5qxppRbgfeEV3oztmRTQTkE= X-Gm-Gg: ASbGncv5lF4jQAvFHuU2y33ESAESiBIfcUpwmRYTaQNnF5e37UNHCHPifuMe7EnaNol ukL3NcsYcb3dXz3cIV3iNMQdmgfuA6+jjIbHYqC0Z3jhXGUdmfF/LmxsItihze1lDhYiDVNP0Qw 4XyT1Oe3w3YGAKRaSrlVmPKernTw95PCo/bFafoHAf82hrSzvN4AC/132Go8EL7Syq8U1Ky3ljj 0YyOlFuI4OVpYrzCtgm8jhGHrmIgz/Q9bwAxGgciPy9KzJakyFoDZqgn+3omAVK37SGTBbW X-Google-Smtp-Source: AGHT+IHYl8ITOnKHBR9wtZWdnRc2vDPL7PmQsCpT1dlueNYfJot6EA1SnMHcxy4v1Dsvc7fZY1N5kw== X-Received: by 2002:a05:6a20:c707:b0:1d8:c74d:1ca0 with SMTP id adf61e73a8af0-1eb02521584mr31018777637.11.1737442694157; Mon, 20 Jan 2025 22:58:14 -0800 (PST) Received: from localhost ([122.172.84.139]) by smtp.gmail.com with ESMTPSA id 41be03b00d2f7-a9bdf0b50c6sm6841360a12.68.2025.01.20.22.58.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 20 Jan 2025 22:58:13 -0800 (PST) From: Viresh Kumar To: Sudeep Holla Cc: Viresh Kumar , Vincent Guittot , =?utf-8?q?Alex_Benn=C3=A9e?= , Bill Mills , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH 3/3] firmware: arm_ffa: Provide .dma_configure() Date: Tue, 21 Jan 2025 12:26:40 +0530 Message-Id: <766e29dbb32987f714158eef827e706fd1157500.1737441631.git.viresh.kumar@linaro.org> X-Mailer: git-send-email 2.31.1.272.g89b43f80a514 In-Reply-To: References: MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20250120_225814_801701_7C97857C X-CRM114-Status: GOOD ( 11.60 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Provide .dma_configure() callback to make reserved-memory work for FFA devices. Signed-off-by: Viresh Kumar --- drivers/firmware/arm_ffa/bus.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/drivers/firmware/arm_ffa/bus.c b/drivers/firmware/arm_ffa/bus.c index ca526e438e71..e7fd25ba71a4 100644 --- a/drivers/firmware/arm_ffa/bus.c +++ b/drivers/firmware/arm_ffa/bus.c @@ -110,12 +110,21 @@ static struct attribute *ffa_device_attributes_attrs[] = { }; ATTRIBUTE_GROUPS(ffa_device_attributes); +static int ffa_Device_dma_configure(struct device *dev) +{ + if (dev->of_node) + return of_dma_configure(dev, dev->of_node, true); + + return 0; +} + const struct bus_type ffa_bus_type = { .name = "arm_ffa", .match = ffa_device_match, .probe = ffa_device_probe, .remove = ffa_device_remove, .uevent = ffa_device_uevent, + .dma_configure = ffa_Device_dma_configure, .dev_groups = ffa_device_attributes_groups, }; EXPORT_SYMBOL_GPL(ffa_bus_type);