Received: by 2002:ab2:6857:0:b0:1ef:ffd0:ce49 with SMTP id l23csp3303293lqp; Tue, 26 Mar 2024 05:53:25 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXny5SONJ81lfxO1EkBqwmrk5dmnDsQjlD8H8NMXBSdRKdKNUiCLsTJCGHhzDwBCpUk+TqFAOoQbzXErhADle7TGoVffX4ysO2CV7VcoQ== X-Google-Smtp-Source: AGHT+IHiYrEzBpJDPSBW0E2XIrNh+17EviyH/9W/JGEIT5moSeHt3be/FhGQ2QngLTckcJkoth8J X-Received: by 2002:a17:902:c943:b0:1de:de7d:d3a6 with SMTP id i3-20020a170902c94300b001dede7dd3a6mr1931896pla.30.1711457605103; Tue, 26 Mar 2024 05:53:25 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1711457605; cv=pass; d=google.com; s=arc-20160816; b=FX0o0rkiMUG1q/S6NStlJ4U3KOEuB4SUdAy01rHMROXfRSB63h32Kot3n8F8gHWCdy 0kEqDy5zWu9DY+aK2lOnFyY/2uZ6aQ/UdpUB3KX01tokqAl7mYIUk8SLBn6yXDb/gh2T GeofhLMNZ3R+cQkhS7DqcC7/Lsb0GR5tsS+LQWWyjXL81OEcZKs3TNV5CHMrdnea0OuC 9uwNaY1JrZD70KC3JoZKMYbvUfeAdSq5q+Ynr+cKSBKhfgPEFjkihgTHErQIX5A8MPA6 UCQZF+YP+VNv6bVrky5LM1Kj4NWakwfq0KO5A2DZvR2EyVjRtT4TqajVP9yIG7LOeDEW DaQg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:date:subject:cc:to :from; bh=Fc/5cIlEjuByCmzXSWO/VYdJ77wophvVQPp9XRbMzpM=; fh=fdB1gp86k1YVETiJ9I7eUIXzWYa05+TyhN1hKr5ya+o=; b=msm+1y7wnF/35QqqcwEQouGUlJU3IoUVylw9YTxr+AMOkF8/qPFLX8j1l0VNxD+1Bl gzPWL9Au3c04+poOFTM/ApmBn0fyY2Eq9DQqeIGEYJJUf04vwPfnJ5SN4jg3wMAKoumX BTj6eC48RBvB44mVDJmr1FhJ7/AoxcL80QmDgXN9woW3WdvIn0sGtcI33tGteS3llPTd Oa60xCut8auDo5aAr7p7FI2il7yv23WVRnLtsq+V6ZmZfrXjRHWJ4Pqh7jLsYArTgO9k SwNxf9V4LkBtX4ynTIxh+9TZpkEms+9bQvlm0nOdZb7KL6Bp/dw/pA8feRUxcei4APBq Wsiw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=huawei.com dmarc=pass fromdomain=huawei.com); spf=pass (google.com: domain of linux-kernel+bounces-119002-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-119002-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id c16-20020a170902d49000b001e0b5fa1cf6si5089365plg.306.2024.03.26.05.53.24 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 26 Mar 2024 05:53:25 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-119002-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=huawei.com dmarc=pass fromdomain=huawei.com); spf=pass (google.com: domain of linux-kernel+bounces-119002-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-119002-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id DB9443048A4 for ; Tue, 26 Mar 2024 12:44:26 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 1A53F6D1C7; Tue, 26 Mar 2024 12:44:08 +0000 (UTC) Received: from szxga04-in.huawei.com (szxga04-in.huawei.com [45.249.212.190]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id CDEDA5CDE7; Tue, 26 Mar 2024 12:44:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=45.249.212.190 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711457047; cv=none; b=Fluynpr5prTO/oSFS0rDiylk96GuwmEBnrHjXOzxd3qtBVOL5CWdre86c10tK4Mxw6YjBHjV3/gzAbMCKgvW8CAkRonLaOpdMEvnurM+91Q3rXvO/ZpXMzzaLKD1aIBa1Pkn0nP3BTGuCNvwC/Jh1DKcNnLpw57r9uFnPJshbNQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711457047; c=relaxed/simple; bh=+tsqbPva4v8ckvlURd/TCkXfFT7ZUNUmsZJThNP5SU0=; h=From:To:CC:Subject:Date:Message-ID:MIME-Version:Content-Type; b=I0j26Yu2aDd03psCeUYbYK2EK2jARcCXfn7CmK4FgBNJ5mhzw7KS2ZSjaPYt1gesulZuhlwuom2suX9sjGfU58MCmy5HGwR+hGnfmyTIn9WuTaBZ4RyhDNAJjoQUZSxGCUlC7nczp3xv/kaG3HD5DffGNO4VLtwA2Qr3fAy7H6k= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com; spf=pass smtp.mailfrom=huawei.com; arc=none smtp.client-ip=45.249.212.190 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=huawei.com Received: from mail.maildlp.com (unknown [172.19.163.17]) by szxga04-in.huawei.com (SkyGuard) with ESMTP id 4V3qDK70wkz2Bhfw; Tue, 26 Mar 2024 20:41:21 +0800 (CST) Received: from kwepemi500008.china.huawei.com (unknown [7.221.188.139]) by mail.maildlp.com (Postfix) with ESMTPS id B395D1A0172; Tue, 26 Mar 2024 20:44:00 +0800 (CST) Received: from localhost.huawei.com (10.50.165.33) by kwepemi500008.china.huawei.com (7.221.188.139) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.35; Tue, 26 Mar 2024 20:44:00 +0800 From: Yihang Li To: , , , , , CC: , , , , , Subject: [PATCH v2] scsi: libsas: Allocation SMP request is aligned to ARCH_DMA_MINALIGN Date: Tue, 26 Mar 2024 20:43:58 +0800 Message-ID: <20240326124358.2466259-1-liyihang9@huawei.com> X-Mailer: git-send-email 2.33.0 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-ClientProxiedBy: dggems703-chm.china.huawei.com (10.3.19.180) To kwepemi500008.china.huawei.com (7.221.188.139) This series [1] reducing the kmalloc() minimum alignment on arm64 to 8 (from 128). In libsas, this will cause SMP requests to be 8-byte-aligned through kmalloc() allocation. However, for the hisi_sas hardware, all commands address must be 16-byte-aligned. Otherwise, the commands fail to be executed. ARCH_DMA_MINALIGN represents the minimum (static) alignment for safe DMA operations, so use ARCH_DMA_MINALIGN as the alignment for SMP request. Link: https://lkml.kernel.org/r/20230612153201.554742-1-catalin.marinas@arm.com [1] Signed-off-by: Yihang Li --- Changes since v1: - Directly modify alloc_smp_req() instead of using handler callback. --- drivers/scsi/libsas/sas_expander.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/scsi/libsas/sas_expander.c b/drivers/scsi/libsas/sas_expander.c index a2204674b680..941abc7298df 100644 --- a/drivers/scsi/libsas/sas_expander.c +++ b/drivers/scsi/libsas/sas_expander.c @@ -135,7 +135,10 @@ static int smp_execute_task(struct domain_device *dev, void *req, int req_size, static inline void *alloc_smp_req(int size) { - u8 *p = kzalloc(size, GFP_KERNEL); + u8 *p; + + size = ALIGN(size, ARCH_DMA_MINALIGN); + p = kzalloc(size, GFP_KERNEL); if (p) p[0] = SMP_REQUEST; return p; -- 2.33.0