From patchwork Tue Dec 27 06:30:46 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: b29237@freescale.com X-Patchwork-Id: 133300 X-Patchwork-Delegate: galak@kernel.crashing.org Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from ozlabs.org (localhost [IPv6:::1]) by ozlabs.org (Postfix) with ESMTP id 19FB9B7351 for ; Tue, 27 Dec 2011 18:19:40 +1100 (EST) Received: from TX2EHSOBE004.bigfish.com (tx2ehsobe002.messaging.microsoft.com [65.55.88.12]) (using TLSv1 with cipher AES128-SHA (128/128 bits)) (Client CN "mail.global.frontbridge.com", Issuer "Microsoft Secure Server Authority" (verified OK)) by ozlabs.org (Postfix) with ESMTPS id 0B07BB6FD3 for ; Tue, 27 Dec 2011 18:19:31 +1100 (EST) Received: from mail9-tx2-R.bigfish.com (10.9.14.245) by TX2EHSOBE004.bigfish.com (10.9.40.24) with Microsoft SMTP Server id 14.1.225.23; Tue, 27 Dec 2011 07:19:07 +0000 Received: from mail9-tx2 (localhost [127.0.0.1]) by mail9-tx2-R.bigfish.com (Postfix) with ESMTP id 2E1D7E0731; Tue, 27 Dec 2011 07:19:12 +0000 (UTC) X-SpamScore: 0 X-BigFish: VS0(zzzz1202hzz8275bhz2dh2a8h668h839h61h) X-Spam-TCS-SCL: 0:0 X-Forefront-Antispam-Report: CIP:70.37.183.190; KIP:(null); UIP:(null); IPV:NLI; H:mail.freescale.net; RD:none; EFVD:NLI Received: from mail9-tx2 (localhost.localdomain [127.0.0.1]) by mail9-tx2 (MessageSwitch) id 132497035235556_15288; Tue, 27 Dec 2011 07:19:12 +0000 (UTC) Received: from TX2EHSMHS007.bigfish.com (unknown [10.9.14.249]) by mail9-tx2.bigfish.com (Postfix) with ESMTP id 01FD7600019; Tue, 27 Dec 2011 07:19:12 +0000 (UTC) Received: from mail.freescale.net (70.37.183.190) by TX2EHSMHS007.bigfish.com (10.9.99.107) with Microsoft SMTP Server (TLS) id 14.1.225.22; Tue, 27 Dec 2011 07:19:07 +0000 Received: from az33smr02.freescale.net (10.64.34.200) by 039-SN1MMR1-002.039d.mgd.msft.net (10.84.1.15) with Microsoft SMTP Server id 14.1.355.3; Tue, 27 Dec 2011 01:19:25 -0600 Received: from localhost (rock.ap.freescale.net [10.193.20.106]) by az33smr02.freescale.net (8.13.1/8.13.0) with ESMTP id pBR7JMEc017692; Tue, 27 Dec 2011 01:19:23 -0600 (CST) From: To: , , , , Subject: [PATCH] dmaengine: async_xor, fix zero address issue when xor highmem page Date: Tue, 27 Dec 2011 14:30:46 +0800 Message-ID: <1324967446-28939-1-git-send-email-b29237@freescale.com> X-Mailer: git-send-email 1.7.5.1 MIME-Version: 1.0 X-OriginatorOrg: freescale.com Cc: Forrest shi X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org Sender: linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org From: Forrest shi we may do_sync_xor high mem pages, in this case, page_address will return zero address which cause a failure. this patch uses kmap_atomic before xor the pages and kunmap_atomic after it. Signed-off-by: b29237@freescale.com --- crypto/async_tx/async_xor.c | 16 ++++++++++++---- 1 files changed, 12 insertions(+), 4 deletions(-) diff --git a/crypto/async_tx/async_xor.c b/crypto/async_tx/async_xor.c index bc28337..5b416d1 100644 --- a/crypto/async_tx/async_xor.c +++ b/crypto/async_tx/async_xor.c @@ -26,6 +26,7 @@ #include #include #include +#include #include #include #include @@ -126,7 +127,7 @@ do_sync_xor(struct page *dest, struct page **src_list, unsigned int offset, int src_cnt, size_t len, struct async_submit_ctl *submit) { int i; - int xor_src_cnt = 0; + int xor_src_cnt = 0, kmap_cnt=0; int src_off = 0; void *dest_buf; void **srcs; @@ -138,11 +139,13 @@ do_sync_xor(struct page *dest, struct page **src_list, unsigned int offset, /* convert to buffer pointers */ for (i = 0; i < src_cnt; i++) - if (src_list[i]) - srcs[xor_src_cnt++] = page_address(src_list[i]) + offset; + if (src_list[i]) { + srcs[xor_src_cnt++] = kmap_atomic(src_list[i], KM_USER1) + offset; + } + kmap_cnt = xor_src_cnt; src_cnt = xor_src_cnt; /* set destination address */ - dest_buf = page_address(dest) + offset; + dest_buf = kmap_atomic(dest, KM_USER0) + offset; if (submit->flags & ASYNC_TX_XOR_ZERO_DST) memset(dest_buf, 0, len); @@ -157,6 +160,11 @@ do_sync_xor(struct page *dest, struct page **src_list, unsigned int offset, src_off += xor_src_cnt; } + kunmap_atomic(dest_buf, KM_USER0); + for (i = 0; i < kmap_cnt; i++) + if (src_list[i]) + kunmap_atomic(srcs[i], KM_USER1); + async_tx_sync_epilog(submit); }