From patchwork Tue Sep 10 09:20:18 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Neil Armstrong X-Patchwork-Id: 826943 Delivered-To: patch@linaro.org Received: by 2002:adf:ab1c:0:b0:367:895a:4699 with SMTP id q28csp205652wrc; Tue, 10 Sep 2024 02:20:37 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCXlY2/GJtn93UEt1ooCzIreULamEN6kYb24QNWkEZZ4zSP2cCPynuZs/Va0m0+9VEYgQRhT3g==@linaro.org X-Google-Smtp-Source: AGHT+IFeSU/cd0zPZ8JU0gyDWPOgb/jak74UNFs3KGkETJeSCaZwo19vMppxivJ27YDaT4CPoZ26 X-Received: by 2002:adf:f3ca:0:b0:371:8eb3:8c64 with SMTP id ffacd0b85a97d-378896c7ddfmr7512530f8f.54.1725960037238; Tue, 10 Sep 2024 02:20:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1725960037; cv=none; d=google.com; s=arc-20240605; b=W+rnyrtZPXmIUUpKaNIfSb5UPJI8MRPIw9ZKVtZyZLLyrqYW+9Nr52+OYWUMfbZ6oi 7a/TO+rSY9jVnnHA1cFa1BAB2gD0JSVEHBKCjURzktaqS/iMrhN5CuRzSIoWbEVmrkmw 8UCRZIlrlE9RMr2XXBaoiNt/ibE476iG4Yre1zhVRtblmm4Uv5W1T+pqLsvx6JLmVZtw gZf31F5Z/GADd+baYeOZX77MDhRkf4grLBAbryG3e3TqfDZzgw94WeczvQfTfuUpAKAr cg13pvJpFicmQUasOLQuSthGIQYei+Qai3dJQ1bKYbOXYY0qaIMkQYn2qt6rG0niJ0+9 drtA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:cc:to:in-reply-to:references :message-id:content-transfer-encoding:mime-version:subject:date:from :dkim-signature; bh=biSm18yZGgi2o3fcqtSUq93PVwUF/FUAc7uacCwORCk=; fh=MpQxDFwiapfMzPUCjtB/tGQ74Yoee5eRTjQ1h4khh8w=; b=Rb6abZPJyK8APceTrfhUV5xPNfQTJKlF8L3crByAfGmup1Otxo7rtltFzU1kH5C5H0 H+RHZFq3rMUCdh7L+Tnp7TTAiAhnRmUzxkmLJPfoKCOM1xjynIUMF5vq0/BOkRMCoETg oZ8+YVWJVGisJrB8apGsyeDpXEKrFA3tvI7+zQDk9fAuxC9m2NSnGPoqgdP0/vMrKXe4 zV5Jy9fmjZRAvwshZyjwWofXH9IRjSz+TWzY5kuzvsw4IIkMc4OmOrKxPH5VEILwyujQ d6oaXOW12Tv0k/hOa90Bogruh+sYP3uUf+sIzmnN3oaZe9UjXMr1gdZVjLaO4SplMWNk Z6dg==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=PGuTLLFy; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Return-Path: Received: from phobos.denx.de (phobos.denx.de. [2a01:238:438b:c500:173d:9f52:ddab:ee01]) by mx.google.com with ESMTPS id ffacd0b85a97d-3789569ac2csi2938506f8f.460.2024.09.10.02.20.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 Sep 2024 02:20:37 -0700 (PDT) Received-SPF: pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=PGuTLLFy; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id C907A88F72; Tue, 10 Sep 2024 11:20:35 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="PGuTLLFy"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 10F4488F72; Tue, 10 Sep 2024 11:20:35 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-lf1-x12d.google.com (mail-lf1-x12d.google.com [IPv6:2a00:1450:4864:20::12d]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 0585788F70 for ; Tue, 10 Sep 2024 11:20:32 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=neil.armstrong@linaro.org Received: by mail-lf1-x12d.google.com with SMTP id 2adb3069b0e04-53660856a21so2922132e87.2 for ; Tue, 10 Sep 2024 02:20:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1725960030; x=1726564830; darn=lists.denx.de; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=biSm18yZGgi2o3fcqtSUq93PVwUF/FUAc7uacCwORCk=; b=PGuTLLFyxlMyGFHG1z9ImcRDExl/i6HUO671RFe1SBxeS7aIlGEu1WGP+WKjI8KiEM vSSaLJVzKIxVROuOllAZ5OqylVOuv1roX6ga6jXy9mLWJB3d9nAXaWrKGcxyJuLBMOLL qQWH8oIyUg8Nbo4zmIYiAoSbcE6pkE99dZnasFJ8ojvaWoIr8E+0J6DzrWLtBJ90LHWQ 93EhG7MiJ9B76NhWh6Xbc4s4wMhwd8BacKyNJDo0b4+IkJW9qVqB2Qm7WlOxq9hCPrjh P9/ELLtz2wzL6zAv3DPyNR+YO5Am3fkHf8OOrIwB+7QKmBvfIIVXUICcp/2kOmhIVhmH DCXg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1725960030; x=1726564830; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=biSm18yZGgi2o3fcqtSUq93PVwUF/FUAc7uacCwORCk=; b=b2c5wbeRoH0BcjoWHJVqnfZj6LYwwTgftSXn704XPMRQcUEZfCMIbDNPnrX8MhDgd2 0iDxVS5veEC/zBKtj5Y2po9CwZX//QqsIfLDcrfoWq+ngiX+lqu/cWdySuqPy4DT+JCS ajfhtqWXyZb2nuWr4MLtmeY67EDW9x48u5iUmeisxc3TulJdY9quCqum12p9N1p/5TyZ Z4XV+EIuZakzK67mo386O6eiqM3sYWyFMUJHWYCNRFM7j0GLhDkVF8yFO9lSbi8sQy30 uxdXQKRwAx3xaGiqtKv1LHxIV+ipnlt0YciPMDMgWK0udjGWOxGtgBYyEYtIcFF8TfRR YreQ== X-Gm-Message-State: AOJu0YwSQuicBDBYourxHsvnDYaFx+CvhfZhThekc+xmd8Zd4Rq0ZQWx AqjeIw86yVlAQP5r4WqoNv5KolauaMwOKfkj2mzOQSRRFX1BixazIQZKMf4BSDE= X-Received: by 2002:a05:6512:31c5:b0:52c:e07d:229c with SMTP id 2adb3069b0e04-536587b06e0mr10422885e87.22.1725960029075; Tue, 10 Sep 2024 02:20:29 -0700 (PDT) Received: from arrakeen.starnux.net ([2a01:e0a:982:cbb0:52eb:f6ff:feb3:451a]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-42cb099acf6sm101256245e9.9.2024.09.10.02.20.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 Sep 2024 02:20:28 -0700 (PDT) From: Neil Armstrong Date: Tue, 10 Sep 2024 11:20:18 +0200 Subject: [PATCH 01/13] ufs: allocate descriptors with size aligned with DMA_MINALIGN MIME-Version: 1.0 Message-Id: <20240910-topic-ufs-enhancements-v1-1-3ee0bffacc64@linaro.org> References: <20240910-topic-ufs-enhancements-v1-0-3ee0bffacc64@linaro.org> In-Reply-To: <20240910-topic-ufs-enhancements-v1-0-3ee0bffacc64@linaro.org> To: Tom Rini , Bhupesh Sharma , Neha Malcom Francis Cc: u-boot@lists.denx.de, u-boot-qcom@groups.io, Neil Armstrong X-Mailer: b4 0.14.1 X-Developer-Signature: v=1; a=openpgp-sha256; l=1349; i=neil.armstrong@linaro.org; h=from:subject:message-id; bh=ZHS2jy/EiG6hVskbTeagCeI2IfA8YWfz33iJ6L6mEhs=; b=owEBbQKS/ZANAwAKAXfc29rIyEnRAcsmYgBm4A9W+13nYUZOgKbKnDZBdG3CNOrFO2d/WPHOz900 UrTEM5KJAjMEAAEKAB0WIQQ9U8YmyFYF/h30LIt33NvayMhJ0QUCZuAPVgAKCRB33NvayMhJ0cleEA CuGrlxaP+IMpUuTe3DFqooewrSRYv0JzdvigwWr1h0mmdZI9K2kZns2vCxa/ig8ZCvb+kpF9h7CpdR 6dlwWKi5uWK27KvAGWof7VU96gEDHOKlv/AD4wEYG9kOwsSn/rT8H+QnB3ODqT1suHUlqzykK0NPQr eHbI56TAB1ms8vguBraQWhDD2J8X6dYb2DIuPapWCSzC5555qtsjBItHgeM1FwbivpcGEFvvR09QhN /xqI+1mzUaczSxDvQUx3z1LCst8POhlRo5asdDuOWPepIw+kRnIm3e1Qx6IA7phdshTDBjfWVadmwr i0dXwngfzuD78Cn+WVrC5iyAEwo5sL9AHfq5xfuFhNeQzUY3Uv9eAZ0l4ICC6yRJhdQXC0y22nv9ZM BUBJyTMjGdXIkgK3lQS61plEFibVvPM+TSBVO57o8ZAsixl+zeoI8Njb6CtUuFv+YJzKdFNo6f8k0L HqRe/ynwA8SuM1BMykqFxTYbyzxLpALPkVk2hQvPbjNpQAezVfJR7SdPlkNkbDcTHyTfdHV9ioKuH8 6s+troki6LqagvUazf2FFlPYNRr/qnb3hlYkmZfxfvEkqkL4ta2qmw3disosghIF1anS5kiGz/eA74 QcpelNn3b9trouqWPYOTfOX3hD0LQoW4P6lps2HC+J5k7/ZBW5mhSkEmJBMA== X-Developer-Key: i=neil.armstrong@linaro.org; a=openpgp; fpr=89EC3D058446217450F22848169AB7B1A4CFF8AE X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.8 at phobos.denx.de X-Virus-Status: Clean Align the allocation size with DMA_MINALIGN to make sure we do not flush/invalidate data from following allocations. Signed-off-by: Neil Armstrong Reviewed-by: Neha Malcom Francis --- drivers/ufs/ufs.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/drivers/ufs/ufs.c b/drivers/ufs/ufs.c index be64bf971f1..e005cc90608 100644 --- a/drivers/ufs/ufs.c +++ b/drivers/ufs/ufs.c @@ -633,7 +633,9 @@ static int ufshcd_memory_alloc(struct ufs_hba *hba) /* Allocate one Transfer Request Descriptor * Should be aligned to 1k boundary. */ - hba->utrdl = memalign(1024, sizeof(struct utp_transfer_req_desc)); + hba->utrdl = memalign(1024, + ALIGN(sizeof(struct utp_transfer_req_desc), + ARCH_DMA_MINALIGN)); if (!hba->utrdl) { dev_err(hba->dev, "Transfer Descriptor memory allocation failed\n"); return -ENOMEM; @@ -642,7 +644,9 @@ static int ufshcd_memory_alloc(struct ufs_hba *hba) /* Allocate one Command Descriptor * Should be aligned to 1k boundary. */ - hba->ucdl = memalign(1024, sizeof(struct utp_transfer_cmd_desc)); + hba->ucdl = memalign(1024, + ALIGN(sizeof(struct utp_transfer_cmd_desc), + ARCH_DMA_MINALIGN)); if (!hba->ucdl) { dev_err(hba->dev, "Command descriptor memory allocation failed\n"); return -ENOMEM;