Received: by 10.213.65.68 with SMTP id h4csp2122764imn; Sun, 8 Apr 2018 20:15:53 -0700 (PDT) X-Google-Smtp-Source: AIpwx4++DJQmRiVXzzBG5G/TUx7Xe1T0sn55Rl70xFexLcnTa3b17BE2SKbLwD3ERXfGOERYQZ0v X-Received: by 10.101.75.81 with SMTP id k17mr24320689pgt.335.1523243374438; Sun, 08 Apr 2018 20:09:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523243374; cv=none; d=google.com; s=arc-20160816; b=A5GrSzK8sc3VvjR7KoLhdZFFYIwfz5tDukRnQ7lqSdVyxGYYNTeODH+VJIM+O9/RUp zYTuO/RIWxcWobW2KLxKRdaQDDoyDHh53hn+f0hHm0RJIlZmKIxKYQNAIhObaaC5jPDf hgea0KKTOXh4qCEL28Fhe37gQ/9Lq6UcVDvMlaPYKh+QZv4oQsum3kUHCIxdIcKBlWav goWk7rDuy2a0WT7K87Ay6QsK1o8dkvLu/F5RxCqpdi6tTmozHZ2UeUy87mmKGbD9ZvdH JBNlBc5jGAcqbAwgf1n0BZHse8lRrxvLFhcZ6ulCjTsCNk1s6mbjSTTyiGi+/4hF4Umd mctA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:content-transfer-encoding :spamdiagnosticmetadata:spamdiagnosticoutput:content-language :accept-language:in-reply-to:references:message-id:date:thread-index :thread-topic:subject:cc:to:from:dkim-signature :arc-authentication-results; bh=m+Z8XjcW6Kq2UB965QdZItzXslhlpNFqbUKleE5KA5Q=; b=KSSa/JEemQ8gDDPp6vnRHGrDy0SvTms3aCh8LAZtVsBj+UjBoeN3MdBB8TywAXxXAi q7OIyzAV0ZHwr4C4Eqi1Z/I1R8GXkAggKWxQwE1QNwshEFS9duW6wlqOkRvGmoyWvnnr mJiZV3l+z2es8y3mhD9Z7aT/hoH8lqcVU0xF1X8v03+PiN7q7pdYrXxas2eoC/J+1oYN T7FV3Rocm90h9FpTO7QQoVnFKiyQtITxHfvMk8Ixt8Ifw8bU5nEkGY7aDMV83PvY4hRS Ur+i3m/c1SD+EjVRVDh1taoYIutRJcv88krYg4CL4hsz1kW38E8PrDL2kvfl5cXDz9IS 1pgQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@microsoft.com header.s=selector1 header.b=LvCBXzWO; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=microsoft.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id g2si3980304pgu.212.2018.04.08.20.08.57; Sun, 08 Apr 2018 20:09:34 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@microsoft.com header.s=selector1 header.b=LvCBXzWO; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=microsoft.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757803AbeDICgl (ORCPT + 99 others); Sun, 8 Apr 2018 22:36:41 -0400 Received: from mail-cys01nam02on0104.outbound.protection.outlook.com ([104.47.37.104]:11355 "EHLO NAM02-CY1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1755617AbeDIA1f (ORCPT ); Sun, 8 Apr 2018 20:27:35 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=m+Z8XjcW6Kq2UB965QdZItzXslhlpNFqbUKleE5KA5Q=; b=LvCBXzWOjeqSebvU+bs0eQlajgca2i4RcXlUcIvWEJ9JxeiEpINH0LDrxCsdQrHijnTzCApJwvrzMpyhKdRv6lL7TUxq7jHLZ959H+aKO+x9nLGTHJwXX9ZDw8uTLYuLsFny5XyAcDn5mGULd9yN1cL0IIx5fxRnjX+aqcIN7Ec= Received: from DM5PR2101MB1032.namprd21.prod.outlook.com (52.132.128.13) by DM5PR2101MB1031.namprd21.prod.outlook.com (52.132.128.12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.696.0; Mon, 9 Apr 2018 00:27:29 +0000 Received: from DM5PR2101MB1032.namprd21.prod.outlook.com ([fe80::8109:aef0:a777:7059]) by DM5PR2101MB1032.namprd21.prod.outlook.com ([fe80::8109:aef0:a777:7059%2]) with mapi id 15.20.0696.003; Mon, 9 Apr 2018 00:27:29 +0000 From: Sasha Levin To: "stable@vger.kernel.org" , "linux-kernel@vger.kernel.org" CC: Kevin Barnett , Kevin Barnett , Don Brace , "Martin K . Petersen" , Sasha Levin Subject: [PATCH AUTOSEL for 4.9 049/293] scsi: smartpqi: correct bdma hw bug Thread-Topic: [PATCH AUTOSEL for 4.9 049/293] scsi: smartpqi: correct bdma hw bug Thread-Index: AQHTz5j7HkI0+N7RE0OFuReZ1zI3eQ== Date: Mon, 9 Apr 2018 00:23:28 +0000 Message-ID: <20180409002239.163177-49-alexander.levin@microsoft.com> References: <20180409002239.163177-1-alexander.levin@microsoft.com> In-Reply-To: <20180409002239.163177-1-alexander.levin@microsoft.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [52.168.54.252] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1;DM5PR2101MB1031;7:bOyDp9H6mgc5G2850JUO5nuWvPIxsQoWjmOzkpHYXYPFvad7uP2lBqcZaO3UeWhCiyolgf919fmdLTfofTNGvxAKX0DJQ8p37v17dBeZef77OQ3BCfg6cYZtlUufF5KHd1XdEz6EjQRHgPaO0Awcp0Keh6OxraGwFuw68npsY8S+P3h+hbuhj649so8pxB+4VsIWuHGZNHJPsvi4mfB61G7iwiwfZSCxnUHCWn8l19mty82xWa9wsQqbST7drJZQ;20:7A/KVDCzJ1xWLrWaDVvEuTKRDxH12Sk5aw3vM3jloNeA0zQsUdQ/pOt2mPl4WZ+jLVZh3EmZXv+KL/Od13bU+4azBQ4dUmz/ujJvgU+hNZvjq9o/b1jVN1QU6D1Edf/PqtY6WjOE3yBijiw1eO4QtGkeu3rr5na2voRsn92yzAQ= x-ms-office365-filtering-ht: Tenant X-MS-Office365-Filtering-Correlation-Id: a26e8a51-df17-478e-e2ef-08d59db0ad6f x-microsoft-antispam: UriScan:(222181515654134);BCL:0;PCL:0;RULEID:(7020095)(4652020)(48565401081)(5600026)(4604075)(3008032)(4534165)(4627221)(201703031133081)(201702281549075)(2017052603328)(7193020);SRVR:DM5PR2101MB1031; x-ms-traffictypediagnostic: DM5PR2101MB1031: authentication-results: spf=none (sender IP is ) smtp.mailfrom=Alexander.Levin@microsoft.com; x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:(28532068793085)(227479698468861)(89211679590171)(131327999870524)(72170198267865)(146099531331640)(222181515654134); x-exchange-antispam-report-cfa-test: BCL:0;PCL:0;RULEID:(8211001083)(61425038)(6040522)(2401047)(5005006)(8121501046)(93006095)(93001095)(3231221)(944501327)(52105095)(3002001)(10201501046)(6055026)(61426038)(61427038)(6041310)(20161123558120)(20161123562045)(20161123560045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123564045)(6072148)(201708071742011);SRVR:DM5PR2101MB1031;BCL:0;PCL:0;RULEID:;SRVR:DM5PR2101MB1031; x-forefront-prvs: 0637FCE711 x-forefront-antispam-report: SFV:NSPM;SFS:(10019020)(396003)(376002)(366004)(39380400002)(346002)(39860400002)(189003)(199004)(2900100001)(10290500003)(99286004)(76176011)(14454004)(7736002)(11346002)(26005)(86612001)(72206003)(478600001)(36756003)(106356001)(66066001)(2616005)(186003)(22452003)(86362001)(68736007)(305945005)(54906003)(102836004)(486006)(59450400001)(110136005)(316002)(6506007)(446003)(8656006)(107886003)(53936002)(4326008)(105586002)(6436002)(6486002)(476003)(6512007)(5660300001)(5250100002)(25786009)(3846002)(6116002)(1076002)(97736004)(3280700002)(2501003)(2906002)(81156014)(8676002)(10090500001)(81166006)(8936002)(3660700001)(22906009)(217873001);DIR:OUT;SFP:1102;SCL:1;SRVR:DM5PR2101MB1031;H:DM5PR2101MB1032.namprd21.prod.outlook.com;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;MX:1;A:1; received-spf: None (protection.outlook.com: microsoft.com does not designate permitted sender hosts) x-microsoft-antispam-message-info: uy8XJu5T3GDMSPthvpO73QbXK+/e3l7rU+omOw+j4x8k+bOj/ktCo1fm1CFYcKiFc0VX5wW8DpjKAKHZW06N2buDabD821zbiL5qbz2YuYmJizRDFygu4vZpTFmDj79AMLD/i/Iq6AVJcsHQjK/iTW17FxaDM8OFeOY/Mj8RZkCnRxOJGjAvNF0oRGyHNMSBxi+WogEscAU4RtskkWTo/QRw5jPBSfjGUbR991YLNNlSOMCZlcVhS50ZuPAsHdK0ZuxoUSLi9dg6qT5BrzMWG85zuv/aw6OS0EBRuC5a+btqLEi9Mu+tf9WnbZbgo3MnjomnpzArQnz/E4tmF0Ja63skUXU/AraZhwBkcROZFtyRvRkvOhi7twMLnZoBJvSXlfNAuZBu6oSkLzWG5f93k7AxOHwJUiuFbDZbo3J+eqg= spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: microsoft.com X-MS-Exchange-CrossTenant-Network-Message-Id: a26e8a51-df17-478e-e2ef-08d59db0ad6f X-MS-Exchange-CrossTenant-originalarrivaltime: 09 Apr 2018 00:23:28.2530 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 72f988bf-86f1-41af-91ab-2d7cd011db47 X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR2101MB1031 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Kevin Barnett [ Upstream commit e1d213bdc3e359c6c5da8ebbc5b2e87b376e8777 ] add workaround for BDMA hardware bug that can cause hw to read up to 12 SGL elements (192 bytes) beyond the last element in the list. This fix avoids IOMMU violations Reviewed-by: Scott Benesh Signed-off-by: Kevin Barnett Signed-off-by: Don Brace Signed-off-by: Martin K. Petersen Signed-off-by: Sasha Levin --- drivers/scsi/smartpqi/smartpqi_init.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/drivers/scsi/smartpqi/smartpqi_init.c b/drivers/scsi/smartpqi/= smartpqi_init.c index 96a343ec8313..fafb50e2f20b 100644 --- a/drivers/scsi/smartpqi/smartpqi_init.c +++ b/drivers/scsi/smartpqi/smartpqi_init.c @@ -47,6 +47,8 @@ #define DRIVER_NAME "Microsemi PQI Driver (v" DRIVER_VERSION ")" #define DRIVER_NAME_SHORT "smartpqi" =20 +#define PQI_EXTRA_SGL_MEMORY (12 * sizeof(struct pqi_sg_descriptor)) + MODULE_AUTHOR("Microsemi"); MODULE_DESCRIPTION("Driver for Microsemi Smart Family Controller version " DRIVER_VERSION); @@ -3024,6 +3026,8 @@ static int pqi_alloc_operational_queues(struct pqi_ct= rl_info *ctrl_info) alloc_length =3D (size_t)aligned_pointer + PQI_QUEUE_ELEMENT_ARRAY_ALIGNMENT; =20 + alloc_length +=3D PQI_EXTRA_SGL_MEMORY; + ctrl_info->queue_memory_base =3D dma_zalloc_coherent(&ctrl_info->pci_dev->dev, alloc_length, @@ -4117,7 +4121,8 @@ static void pqi_calculate_io_resources(struct pqi_ctr= l_info *ctrl_info) max_transfer_size =3D (max_sg_entries - 1) * PAGE_SIZE; =20 ctrl_info->sg_chain_buffer_length =3D - max_sg_entries * sizeof(struct pqi_sg_descriptor); + (max_sg_entries * sizeof(struct pqi_sg_descriptor)) + + PQI_EXTRA_SGL_MEMORY; ctrl_info->sg_tablesize =3D max_sg_entries; ctrl_info->max_sectors =3D max_transfer_size / 512; } --=20 2.15.1