From patchwork Fri Jul 19 11:00:10 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Neil Armstrong X-Patchwork-Id: 813375 Delivered-To: patch@linaro.org Received: by 2002:adf:f288:0:b0:367:895a:4699 with SMTP id k8csp690929wro; Fri, 19 Jul 2024 04:00:30 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCU1u4zsgbGOzk1BYHN9qo9A/XbnkbfEGm/DGh8LgWeQlNxuKJmh6E375iOdhi/oalY1RoELth8WFnxpRuzDbyHU X-Google-Smtp-Source: AGHT+IERSANc56NQ4U5CmIHTVPVUkpHIK2UiZTYKsVFdn+uXZ3uLwtbvLLYt/CiGe0FfVpm9Sinl X-Received: by 2002:a17:906:4686:b0:a72:afd9:6109 with SMTP id a640c23a62f3a-a7a0f13cb46mr572495466b.16.1721386830192; Fri, 19 Jul 2024 04:00:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1721386830; cv=none; d=google.com; s=arc-20160816; b=OblL81yZp5UAyiI/c4VzAGVcP3uxUAnXCG4QaLO4p46pOBZyC862rRFrhADGJLeEfa RA6q06XkCdosOYCBpwyUwStOk6gM5EN7YS5aKPcgTz2UDDrM5f5numYcXGjG5hZNpjy6 QzjAPXC1zjMbZhSK6vSs/sKNBLnEn83AVqbhGiq0Su6SkjZ02lKOxdt36Epvp+TbwhY2 DLc9EoyoDaHD6eaU9qU4dKizYFJyR6mxeeRDnL5cohtr4YJ4Nglz7CKSWga9IntlY0pG 6zRtaYoI/WPBzUWfpZVGQN1hDAvcHioMc2lI7DriWm03sX5H+DCJodDQpXqMDoO/Iz0W 42sw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; 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=pRXlMLo+mMrIjbw8kD9NHKRqyotXea3NhoC7/eGbktQ=; fh=lIn5pjpO+27eEBPvNXGiRUczyjN+bQE3VX+aCGRD/wE=; b=IqdDdotHCGltIopQ7sLucQVlfXNh6V4X5ZT5/f180xwPcWiuz58UR9m3flw2gAhGuJ L1WT63bNAM4DPLchFe8VobC95hiOla9ZFiV1z50PGoQ8zKxyPO0qIuqsss2d4jD4x8ay 75zLnsojJGnhQZHWuS60wA/lZr7hkb6P/bPlmrrbyccozjPjfPyxshzpB2gl2o3f+kyo 903V3Lf3LKPWaLWrkRKRGVGoAiHb2gcy7ayWmK5ZVYK+FOEb6J83cnVcyicYn9NSyC+P nCRwLaLOrnwT7xWUwqfbstpnL/m9UBKxAYPV5v0TykUFGFsc4LVmbQ5BSP/2HJmKTlHA SZxQ==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=WTD1wGPe; 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 a640c23a62f3a-a7a3c787b46si10739866b.88.2024.07.19.04.00.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 19 Jul 2024 04:00:30 -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=WTD1wGPe; 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 9FBEB88001; Fri, 19 Jul 2024 13:00:21 +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="WTD1wGPe"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id BE1CA88B84; Fri, 19 Jul 2024 13:00:19 +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=unavailable autolearn_force=no version=3.4.2 Received: from mail-wm1-x335.google.com (mail-wm1-x335.google.com [IPv6:2a00:1450:4864:20::335]) (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 9F99388B8B for ; Fri, 19 Jul 2024 13:00:16 +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-x335.google.com with SMTP id 5b1f17b1804b1-426717a2d12so8014805e9.0 for ; Fri, 19 Jul 2024 04:00:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1721386816; x=1721991616; 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=pRXlMLo+mMrIjbw8kD9NHKRqyotXea3NhoC7/eGbktQ=; b=WTD1wGPeTTFlj4T9m648Bd++Ynva9Vz1IEmr7igt01iiTi16Klabj1FwWHaMHNVsZh ZTjmmXBhU0FC0V5KREE+g5KP8lhvaGgnaSpWgqlazhzEGojcub26yPq9lAVNXimCSa2V FgmlrmD9Krch2dMBbdAEI3xPwB8AuJsH9xwdEU9zy/y4HEgS/bCylZr3cezf/3HIRnAr eszXk3yrSCcVJEXqoQt8Azw/oUAPGqBVIvg6Eoo/cwQoSjNKfFVOB5cAG6KQ/frqpwvy bl291MVs4n86hG9mut2763LZDmBN/RFlI/t2Ca5hYJBQfgOjamNEhqJfigCuzijNv8hw GqbQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1721386816; x=1721991616; 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=pRXlMLo+mMrIjbw8kD9NHKRqyotXea3NhoC7/eGbktQ=; b=cWvJRoOvdCuBALUqx6WWtdCorzm9YIyrc9uhnhPuRGAiIxN6tbQeSjt+WQ/j3yOM9b zlPMsTvaGFdQ/N1mCYUiQwd4kddLheOAbhHrEIUSrlggetpZAgTT0gvp14Z8Ryh5Nt/v DMRAdz8wDWMsXHQKOu305YU27qBolVkJGA03r63jtfrhx1XJiHRQsh6kMr/Ssf3kJToq EwyyclZsqTuPzM1TLCrfWXx9WtUyrGDfSQhcJFHCtNqc7uZKJw6zVaONUlAlni1OysWj b3kvVaYPpKHaC+RVn7INGW2oCnc5RmuKzigYZ0HiUKZP9+X+msru/BP5XdR8Arw3NEc9 sBUA== X-Forwarded-Encrypted: i=1; AJvYcCXGl4nv4DE+PkK4MxST4dSe5RGSmGcVORw6WP+9e5DEgaw7g85gVlILmPwozM6OSYwc1M0Q+bbBqEc2+WCLvEmaM5bw2g== X-Gm-Message-State: AOJu0YyDHKkMLHsZF0Vh2ak4rNjuWQbTwyepnDcdYsJoinbX3MFnBgn9 Qq6FrCsoRQmcQ8M501xBH/i7M/jltSiBbcW1krqEv63fA6OwcmJyFEo+iEWxNbEwqIWar53HOv9 J X-Received: by 2002:a05:600c:5486:b0:427:aab7:976b with SMTP id 5b1f17b1804b1-427d2a8e1b1mr28609585e9.5.1721386815817; Fri, 19 Jul 2024 04:00:15 -0700 (PDT) Received: from arrakeen.starnux.net ([2a01:e0a:982:cbb0:8261:5fff:fe11:bdda]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-427d6697c3fsm20556055e9.0.2024.07.19.04.00.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 19 Jul 2024 04:00:15 -0700 (PDT) From: Neil Armstrong Date: Fri, 19 Jul 2024 13:00:10 +0200 Subject: [PATCH 1/4] ufs: allocate descriptors with size aligned with DMA_MINALIGN MIME-Version: 1.0 Message-Id: <20240719-u-boot-ufs-dcache-fixup-v1-1-b044fc9564e9@linaro.org> References: <20240719-u-boot-ufs-dcache-fixup-v1-0-b044fc9564e9@linaro.org> In-Reply-To: <20240719-u-boot-ufs-dcache-fixup-v1-0-b044fc9564e9@linaro.org> To: Bhupesh Sharma , Neha Malcom Francis , Tom Rini Cc: Marek Vasut , Caleb Connolly , u-boot-qcom@groups.io, u-boot@lists.denx.de, Neil Armstrong X-Mailer: b4 0.14.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=1349; i=neil.armstrong@linaro.org; h=from:subject:message-id; bh=9uuL7WgYDcbYQ123de/k6aM9CyjgPchU1v9LdgwJNHs=; b=owEBbQKS/ZANAwAKAXfc29rIyEnRAcsmYgBmmkc8jaKIBed6JukbM3+trpgoq4vS5+0dQOv+UAkE O3P5lFuJAjMEAAEKAB0WIQQ9U8YmyFYF/h30LIt33NvayMhJ0QUCZppHPAAKCRB33NvayMhJ0SAJD/ 4qpmUovPRHm56EUxriUvTZPVlgCTeKI05cBHlBHuiMHnvoZNZUn7ysgelA89MNWmcdoPXKVznTFUJO itBVLtOiHtGN5fljVHCdLedfkp6C6GdsW9uACzlCva4/mih4US80Sdl65V7YZf7C9/73Q85xATE3iv bE3ccXdMa74VPjrLU5OclIMPcNrQvQTd6apqFgipWVgVx0VqTcrybD9vncO/ms/OCLKRL+Z3wlUXSk 3PmmJI1mz8j3jTmPXfWGMsqC9Y0jR3BLLE/KFhJHlfi0Cr8glXLOnUJJWRTpCSe17WP29P+5zyNpUn 5oXxUGJj0604obo0IQYaneoxsK0JaoBRBWJ4OeDIZ5Qem52014TeH86wNIjbc3B9hVoZ5o98YoyD8w MdbnHILP3Ju8ZLENyj2shSkdw7WHYArZSBPOoKk8aWsUA7gs9I+IfdU3q+IclKHzxU+RGxs28aap4o jWKfjoeDV3uTxF4PYbqVVfo7dbRZiKjg0dj4+JYQkResNcGup+dymUiuq6wLS80dMQYZdXRlktiOzG RNQCiSn2m3PjvmgAmplm8g4ZwGGAmHa6fh4ITsBGpp2TanXtMUc6simyfBreW1VE4ji3Vf3q0RB33h tGjtBK6texbnug0br8+txGSMsQLAMZGCI71BEdwDFQvgdh+hlNPv6ZPCQsYw== 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 --- 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 e4400f319a7..bc86903245c 100644 --- a/drivers/ufs/ufs.c +++ b/drivers/ufs/ufs.c @@ -634,7 +634,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; @@ -643,7 +645,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;