Received: by 2002:ab2:b82:0:b0:1f3:401:3cfb with SMTP id 2csp293468lqh; Thu, 28 Mar 2024 02:08:22 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVnCan71+jVf9mTxLw30pA54SSPLJlngaXOdjhMfk4Y3Jzh6cVjvtxQ0btSDaFNZ9OslqBfP+Zf7ha/FvaWNxAnzrw2wFVlZVo+ZESL9w== X-Google-Smtp-Source: AGHT+IEiMTp4b/0M/WD2plLib4Z/7UcFwwUwlnqcDIkINKKdt8CDjhhrUP2EahcVEzd8Z1hgeoUo X-Received: by 2002:a17:90a:7147:b0:2a0:4073:deda with SMTP id g7-20020a17090a714700b002a04073dedamr2124309pjs.20.1711616902678; Thu, 28 Mar 2024 02:08:22 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1711616902; cv=pass; d=google.com; s=arc-20160816; b=DAAqpUvcc6bAbMCzoSL1HADag60fU5CTYyd9slNCTNE4zLX6tluHJwMDshVko65Vle 4+xSfL+su2m5vb5ASfihWlYwRFOhggkbPyodyrMF0Or+QGffRWPsVGIlwuJaDLBYPf2R k7B9bGj+LaxOm9JVnaSJ6X3B0KELxEuiA5Ivkve5j5UrL7a4KHQHV0zUCBLEMeQqMWhf K13zNGfbRodoRb03cTvZ1ny1e2EB4dYe8/eIoTn/eeFNRh4rdsT9jh1IErPXI/TTyPul 0LYzxYfyCeRwXYbIDlFCho74COyOzgiQOBEueIaB1ts6Fi1zjgwfS+lMO61lgg9jrdBa FZeA== 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=HM44pbsmFVRbstdVP4VtgtGfnhFu80RvHjpcG5bJYs8=; fh=fdB1gp86k1YVETiJ9I7eUIXzWYa05+TyhN1hKr5ya+o=; b=L9ie0j7bNHzplZ+R933xZZCczFooo31lTGL4s+bVWQED/QiUqM7+w6gg8+rF3k6Y4X X3/cKD/HWxlrDpZY9FJxddIlvjwoa5RhztGm32/DCq9JKCqD9t8RUN/pfRgWl4Ki6HAg TIYEjTUBSMr5nm7UWT8W1lerLQgJ8mzwF5rdi8xgQlnXGhW1wZqT8s5EgBla0c/KrD6S GleP0aUQenCV4kJkngzCK7whTtxuHJQJ8OtqLQEnUJGZaV/w18SA89Gof0P0qtIqhHt0 SRnmRERq2twNCvpLOsbNAOB32tMbr5gdV+1qrG+6YXE/lIsmr9VVamZ9Id0kQug+uoIx eQnQ==; 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-122635-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-122635-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. [139.178.88.99]) by mx.google.com with ESMTPS id o19-20020a17090ac71300b002a096c3a882si1127087pjt.174.2024.03.28.02.08.22 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 28 Mar 2024 02:08:22 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-122635-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; 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-122635-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-122635-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 8F6E529A867 for ; Thu, 28 Mar 2024 09:06:41 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 04AB25D90B; Thu, 28 Mar 2024 09:06:34 +0000 (UTC) Received: from szxga05-in.huawei.com (szxga05-in.huawei.com [45.249.212.191]) (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 5151A39FD8; Thu, 28 Mar 2024 09:06:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=45.249.212.191 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711616793; cv=none; b=qwMiK7tlE7LzHNOsv7huvciS7EN9irQJ3NcFUcXWpFXsLE4GI6iNwpJGZLL7eJcMwJ0qwSI13EcYAG++aOlhQPPDkQMOZFuMd8/VbJ5wHt38fIXgdLDjUdb7wq2HhmeT/1G+6AJaFGUasw6TFhkZNN+6A6I2ECoDvdXQW2LPcxs= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711616793; c=relaxed/simple; bh=Lc0IotqXw2gAX1b8tilNy6g3z9IyZ4SY1RLG5vS3eQ8=; h=From:To:CC:Subject:Date:Message-ID:MIME-Version:Content-Type; b=Rqfj1TwkM35KB2PbtBoBPXqpMkoXip4KxzXWyp2qCfFb2rY0kMYgATplE+g8hDWNgJ0gh8Y5zV8wIzHIBcJVHs0HbSrcS9Lu51LFLG/VDg7/XVaVATKjuFj7YXYTtviakUoTziCnpz+SmiAlheeyOt92fz1LYyHLw91zfSpy9E0= 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.191 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.162.112]) by szxga05-in.huawei.com (SkyGuard) with ESMTP id 4V4yLq5VfGz1GDKr; Thu, 28 Mar 2024 17:05:55 +0800 (CST) Received: from kwepemi500008.china.huawei.com (unknown [7.221.188.139]) by mail.maildlp.com (Postfix) with ESMTPS id 9ECC514011F; Thu, 28 Mar 2024 17:06:27 +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; Thu, 28 Mar 2024 17:06:26 +0800 From: Yihang Li To: , , , , , CC: , , , , , Subject: [PATCH v4] scsi: libsas: Allocation SMP request is aligned to ARCH_DMA_MINALIGN Date: Thu, 28 Mar 2024 17:06:26 +0800 Message-ID: <20240328090626.621147-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 Reviewed-by: Damien Le Moal --- Changes since v3: - Still aligned to ARCH_DMA_MINALIGN for safe DMA operations. Changes since v2: - Use 16B as alignment for SMP requests instead of ARCH_DMA_MINALIGN. Changes since v1: - Directly modify alloc_smp_req() instead of using handler callback. --- drivers/scsi/libsas/sas_expander.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/scsi/libsas/sas_expander.c b/drivers/scsi/libsas/sas_expander.c index a2204674b680..c989d182fc75 100644 --- a/drivers/scsi/libsas/sas_expander.c +++ b/drivers/scsi/libsas/sas_expander.c @@ -135,7 +135,7 @@ 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 = kzalloc(ALIGN(size, ARCH_DMA_MINALIGN), GFP_KERNEL); if (p) p[0] = SMP_REQUEST; return p; -- 2.33.0