From patchwork Mon Sep 30 12:44:23 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Neil Armstrong X-Patchwork-Id: 831559 Delivered-To: patch@linaro.org Received: by 2002:a5d:66c8:0:b0:367:895a:4699 with SMTP id k8csp1928390wrw; Mon, 30 Sep 2024 05:46:56 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCXi+e5v/gYMyzXHN3q5IcwUToIoyOqhnidPOKUf7Urw3tgwS60kV09pVEKl9ZXNnOWCz+7qmw==@linaro.org X-Google-Smtp-Source: AGHT+IGmcocN5/8nbU7BzvnoZXN4quql/xdmb32kFqOpo9uWPRzZ+yIuiRDHQwTTF/7w8Q4PKeM4 X-Received: by 2002:a05:6602:b89:b0:82b:42f:41d5 with SMTP id ca18e2360f4ac-8349328d108mr817550039f.16.1727700416291; Mon, 30 Sep 2024 05:46:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1727700416; cv=none; d=google.com; s=arc-20240605; b=O6fwE1dnVoR86Bvka0IW8KcNHH9qK7cNsfv4Gy+7HruFJ1IXekQ9RoBgH1M1XhMUa4 z+pGRUx0TqeiNTJ6wtTZoT4o39lKo0IJBdniSweB9NyfgmAwOsWGQd6mtUmMD+iJ5BpW 0WdARwJQDz9PVHezFuVH7F0U8dZtsL7kLg8E8XZ1MVXO8Kp76KofydUti+Gv7emCLA9t PMgjEHCViRqHUZshn3fwSXD2di20f8Rjw8B7AL7rgKIdhjFDTwUEjtWhGxNtALPhUHqA iHG0rMZc0cNr2o4rCQ3IWYO3byo/cbKw3sq+q1UHdL4WBXxa6EBPOs4GoAxRc1kmtazk R1gQ== 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=knvPlmaDX5syLFpUIje8nDrZOHvIoGgtObR1QK+uQcA=; fh=570KpmrNCchtF4yVOVmqo4lT7OPg+S+zPwKJ0YCPPso=; b=fApCAUgw3RzeXDC2CckTH/VCwI+Rn18t70ZF4t5/hFdBVU3n2OpBFLeCz4J0lb1Y4b qgACk9Gr+/TUAbdNXIsivXTfovFel8ghIRBEKhZdcizT/yyBeHpw+lttFtz4+zXpBa6o u4r3UK1XM2ChjksmSRrGDswovVG14yvJVP+0GDQyDpMvdtJm23VYvUpm8Z68oW5ZzIjm RelSF2/YUzODHx2FWwj7BEQDvygmE+d5J3xF0c5pgN7Ehsfvde5fPPz6OPCXNOnB4lYO xayLqd/ZIT8DnJ0/c0iWZg4HRl/AOUClf18buzyi1heLUFP0jyoRz8x2umzFl4VaXlrU +7jA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=IV3gKhKC; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 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. [85.214.62.61]) by mx.google.com with ESMTPS id 8926c6da1cb9f-4d8888e6f76si3710776173.134.2024.09.30.05.46.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 30 Sep 2024 05:46:56 -0700 (PDT) Received-SPF: pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 as permitted sender) client-ip=85.214.62.61; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=IV3gKhKC; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 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 0053A88F4E; Mon, 30 Sep 2024 14:44:52 +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="IV3gKhKC"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id B3A8188E2D; Mon, 30 Sep 2024 14:44:49 +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-wm1-x32d.google.com (mail-wm1-x32d.google.com [IPv6:2a00:1450:4864:20::32d]) (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 BB76388E24 for ; Mon, 30 Sep 2024 14:44: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-wm1-x32d.google.com with SMTP id 5b1f17b1804b1-42cc43454d5so31428665e9.3 for ; Mon, 30 Sep 2024 05:44:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1727700272; x=1728305072; 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=knvPlmaDX5syLFpUIje8nDrZOHvIoGgtObR1QK+uQcA=; b=IV3gKhKCRJNtsOnvnwj2b8iG01AgUNPgjEPu4HTt9PkDyhxq78Bk9uks8agJjbUHS0 8bI98ojc6ENIY/EiVoxWnwnI+X0WBSo+d//+HPaKzew2BcV5ePzghL8NvGc0N3tClbnO zxb+HxBt5hxdJriPhzzjrMTN8erY5W7FDCUpgdCVb+rAFkwn/0Widms0gNqyIvhMMUhs RiSZwPKmwnWOIgVMcKQpXIfAu/TIj5Y+NiI1dGLAl6Acw/5crd8mCgvMVbYplZTH/ZDn W3vNDifxP1uM8gZdtZ8tsT3/a+SRUZJ/i8I4aYN8xSYZ2b+gi59tFw3DbIwIfNbNlq1X YubQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1727700272; x=1728305072; 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=knvPlmaDX5syLFpUIje8nDrZOHvIoGgtObR1QK+uQcA=; b=oOFcgoUjraCYyA6JhNuQSTfbtkBJz9mzuA5gImrOtcSlkMUylsdzILw5rqumELjvOe IocfrmbyTnxkikaf4Nj30Kbz8GZjRpZDe10JjvohcLuh4FSXjDHUcT4dB8PlPtr/P7oM bFV+vSKLJMBHk4no3lMDYohae7Ey5nGI1+KfhS3d+F+gFHiqIn6viNv5IVYFXkE79atp +7FKDjwDI4BsLTak9ueDpeG4PsX4W3WIeO7mdg5JluLAuBexUUziSbmVrhQxyXmg1+qZ MVROsSzhlGamhsQMu/DGMTpLL0Tnxy7k+pHKWRCFlQEQrBncGnplb9GTtxA4cc91wxv0 MvAA== X-Forwarded-Encrypted: i=1; AJvYcCWJm0/nUIVjs1hXVc/rZlSKOlSm1CBj4bTJqdqPkN4jWf3If+Co0YscNr+zltVVxMqA8iLo0Ag=@lists.denx.de X-Gm-Message-State: AOJu0YyrpetYUz6perOnJCutNnRTzhs8xgliC480LFHVEx590pObB+gk P6+kHfP86O31sAhhiizdAsjASOV+xTkxvuZjWwKPQTtOTd7YYSalJA4z1GwutfI= X-Received: by 2002:a05:600c:17d1:b0:426:6158:962d with SMTP id 5b1f17b1804b1-42f5c33d132mr61749115e9.23.1727700272129; Mon, 30 Sep 2024 05:44:32 -0700 (PDT) Received: from arrakeen.starnux.net ([2a01:e0a:982:cbb0:52eb:f6ff:feb3:451a]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-42e96a36597sm149362745e9.31.2024.09.30.05.44.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 30 Sep 2024 05:44:31 -0700 (PDT) From: Neil Armstrong Date: Mon, 30 Sep 2024 14:44:23 +0200 Subject: [PATCH v3 01/13] ufs: allocate descriptors with size aligned with DMA_MINALIGN MIME-Version: 1.0 Message-Id: <20240930-topic-ufs-enhancements-v3-1-58234f84ab89@linaro.org> References: <20240930-topic-ufs-enhancements-v3-0-58234f84ab89@linaro.org> In-Reply-To: <20240930-topic-ufs-enhancements-v3-0-58234f84ab89@linaro.org> To: Tom Rini , Bhupesh Sharma , Neha Malcom Francis Cc: Michal Simek , Marek Vasut , bmeng.cn@gmail.com, u-boot@lists.denx.de, u-boot-qcom@groups.io, Neil Armstrong , Venkatesh Yadav Abbarapu X-Mailer: b4 0.14.1 X-Developer-Signature: v=1; a=openpgp-sha256; l=1468; i=neil.armstrong@linaro.org; h=from:subject:message-id; bh=qjQYv0/dis5SePWQOliF/chMW/9j7B57ftSkErHC/tw=; b=owEBbQKS/ZANAwAKAXfc29rIyEnRAcsmYgBm+p0op/wassLlxaqKsPS7KuDnWWTe/m33d8+GBsW+ yGJCikWJAjMEAAEKAB0WIQQ9U8YmyFYF/h30LIt33NvayMhJ0QUCZvqdKAAKCRB33NvayMhJ0Q/LEA CwAO1xkW47eviXrfsW5HddJz2taHdiResVR1msA0m0WR9S87I5imFdH11zJnwy4VJ0vrIYULsa2/HV posiwnkY9Fcpv58np3/x9KcBM4e5QZyF8HaHzZ0fqiTdt0q4qu/jkGYkSPG7MjNf9NzqNhk1SK1Bi5 BfPRJouVF8WpL35An+jaTieoYxSfPxwlKT2fKybyH7YecHgM74X6PtJ8z++n/zgWbuipjCWkg6T9kx RUae74gwdL7pV/sIO7S7EE3K4rFqf7GHsIh4zPwP19Jjrr8Y/F2VBqD7iH5cZiDSaPU4szaqJUJ/U6 sFovRtV/vJYVdarF25XpdYQ1arYH+yJ/n7hS0lh8I6H5WKz72JgSwaZXRZ/1B5Dfw5A7NR11haihtb 0Lq1qsGm/DXEl4X4Cl6Vu4dFNJwwrUDeYxMt0g5JJ69zS0wDlo2+EAn9Bt+Ebri40J8bFqS7/z2+ry Mvj07RUl0n72cj5aA5Oz10UnK99UI//zdtoLG98cwjlANlttljZToDwiQGVS8ZPS8xPIeyCjJqzDGg q1sR4SafbX3hqz+dZ858TuaQIWie3Dm8O6i4YwrTJgCopUxCs65IS8PWzlzGN7QjQ9OQaIDXLQ92v4 Gu2y9mAktGGOff4T0w7QfzXMHPqk46FbOS1lotHAC1WKX2PDCMw9ZY2RcCoQ== 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. Reviewed-by: Neha Malcom Francis Tested-by: Venkatesh Yadav Abbarapu Signed-off-by: Neil Armstrong --- 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;