From patchwork Wed Oct 5 10:19:38 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adrian Hunter X-Patchwork-Id: 12999106 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0C68EC433F5 for ; Wed, 5 Oct 2022 10:20:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229496AbiJEKUP (ORCPT ); Wed, 5 Oct 2022 06:20:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53820 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229593AbiJEKUO (ORCPT ); Wed, 5 Oct 2022 06:20:14 -0400 Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C472C71BFF for ; Wed, 5 Oct 2022 03:20:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1664965213; x=1696501213; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=CzShbDe+0jMVu0dTbKcNM0QEbOfiTZeiXRO22k/SJcM=; b=aMkzGiG//S7hIcCPDZ8mpQnCRJIM2N0j0DO/Nlfs4bD8rHqrQ1Gli3N+ kOHCvqtSJBxZ7Rs6Pl7JjoG1Wyf0HFsioXK/CT5ItHGxLe7cIlSv+TSpX gZfsb6oYEE8T9hk0n4SQiG1mAsesoRdaf9tD7Xz1WBJBgX5yOf+Hf3uwC Eu573MgMp6oOXZkTElTZmM8NqBbPbmNPkH//b+wfx5Z2nmJyqjQHOm5il tSWIx6xKpcxcq0Ywg/ZVr+SHTB8XtGhJRZ+39PjwaTIwdB1lvloPnVMrp bbVTlWL2Iq713lCsmt/AJHUib1vqH5CnIBO+8zVK2z3mKn0Iz4TEhGYbD w==; X-IronPort-AV: E=McAfee;i="6500,9779,10490"; a="304110410" X-IronPort-AV: E=Sophos;i="5.95,159,1661842800"; d="scan'208";a="304110410" Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by orsmga102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 05 Oct 2022 03:20:13 -0700 X-IronPort-AV: E=McAfee;i="6500,9779,10490"; a="728605909" X-IronPort-AV: E=Sophos;i="5.95,159,1661842800"; d="scan'208";a="728605909" Received: from ahunter6-mobl1.ger.corp.intel.com (HELO ahunter-VirtualBox.home\044ger.corp.intel.com) ([10.252.59.192]) by fmsmga002-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 05 Oct 2022 03:20:11 -0700 From: Adrian Hunter To: Ulf Hansson Cc: Stefan Wahren , Florian Fainelli , Wolfram Sang , Alex Dubov , Thierry Reding , linux-mmc@vger.kernel.org Subject: [PATCH 01/14] mmc: sdhci: Remove local_irq_{save,restore}() around k[un]map_atomic() Date: Wed, 5 Oct 2022 13:19:38 +0300 Message-Id: <20221005101951.3165-2-adrian.hunter@intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20221005101951.3165-1-adrian.hunter@intel.com> References: <20221005101951.3165-1-adrian.hunter@intel.com> MIME-Version: 1.0 Organization: Intel Finland Oy, Registered Address: PL 281, 00181 Helsinki, Business Identity Code: 0357606 - 4, Domiciled in Helsinki Precedence: bulk List-ID: X-Mailing-List: linux-mmc@vger.kernel.org A long time ago the kmap_atomic API required a slot to be provided which risked the possibility that other code might use the same slot at the same time. Disabling interrupts prevented the possibility of an interrupt handler doing that. However, that went away with commit 3e4d3af501cc ("mm: stack based kmap_atomic()"). When the second argument to kmap_atomic was removed by commit 482fce997e14 ("mmc: remove the second argument of k[un]map_atomic()"), local_irq_{save,restore}() should have been removed also. Remove it now. Signed-off-by: Adrian Hunter --- drivers/mmc/host/sdhci.c | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c index fef03de85b99..0ee20f4beebf 100644 --- a/drivers/mmc/host/sdhci.c +++ b/drivers/mmc/host/sdhci.c @@ -705,16 +705,14 @@ static int sdhci_pre_dma_transfer(struct sdhci_host *host, return sg_count; } -static char *sdhci_kmap_atomic(struct scatterlist *sg, unsigned long *flags) +static char *sdhci_kmap_atomic(struct scatterlist *sg) { - local_irq_save(*flags); return kmap_atomic(sg_page(sg)) + sg->offset; } -static void sdhci_kunmap_atomic(void *buffer, unsigned long *flags) +static void sdhci_kunmap_atomic(void *buffer) { kunmap_atomic(buffer); - local_irq_restore(*flags); } void sdhci_adma_write_desc(struct sdhci_host *host, void **desc, @@ -756,7 +754,6 @@ static void sdhci_adma_table_pre(struct sdhci_host *host, struct mmc_data *data, int sg_count) { struct scatterlist *sg; - unsigned long flags; dma_addr_t addr, align_addr; void *desc, *align; char *buffer; @@ -788,9 +785,9 @@ static void sdhci_adma_table_pre(struct sdhci_host *host, SDHCI_ADMA2_MASK; if (offset) { if (data->flags & MMC_DATA_WRITE) { - buffer = sdhci_kmap_atomic(sg, &flags); + buffer = sdhci_kmap_atomic(sg); memcpy(align, buffer, offset); - sdhci_kunmap_atomic(buffer, &flags); + sdhci_kunmap_atomic(buffer); } /* tran, valid */ @@ -851,7 +848,6 @@ static void sdhci_adma_table_post(struct sdhci_host *host, int i, size; void *align; char *buffer; - unsigned long flags; if (data->flags & MMC_DATA_READ) { bool has_unaligned = false; @@ -874,9 +870,9 @@ static void sdhci_adma_table_post(struct sdhci_host *host, size = SDHCI_ADMA2_ALIGN - (sg_dma_address(sg) & SDHCI_ADMA2_MASK); - buffer = sdhci_kmap_atomic(sg, &flags); + buffer = sdhci_kmap_atomic(sg); memcpy(buffer, align, size); - sdhci_kunmap_atomic(buffer, &flags); + sdhci_kunmap_atomic(buffer); align += SDHCI_ADMA2_ALIGN; } From patchwork Wed Oct 5 10:19:39 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adrian Hunter X-Patchwork-Id: 12999107 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id CAFABC433F5 for ; Wed, 5 Oct 2022 10:20:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229651AbiJEKUS (ORCPT ); Wed, 5 Oct 2022 06:20:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54070 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229876AbiJEKUR (ORCPT ); Wed, 5 Oct 2022 06:20:17 -0400 Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 06BA174350 for ; Wed, 5 Oct 2022 03:20:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1664965216; x=1696501216; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=dshEQlLbRsGSaVjEQDlJ4AdYvT3o9SuxQZ1XhWcz9Is=; b=dknKaMIY79L5LNsbpyPZMH3rKWRSpyxg06LiwFwd08eG6LERisKBQFNL 3XDjBX425ZvqqH4KDrTRzElOTrumic9+baz7ne7h7+lWt7KB5a86B8OMY gMGoiQ3HqG9yy9oBt+ySFfuqT9MYsxl5UvA4SuGVWYZbdEC4wmatkN/NC wsuzK4PsWtJgZ/HE5QF4eglkkpZcjaR7TengMRfTMmVmlGuYqUqJbKZPz 1qEMN1k1WtbyDUTsZbEK5UrHhwQEEW9wwDiIkPM3/4FjW9E8/YJfOADyh pmLt8oWaDiKazVQLxSayEaAKgaHJzBc4CxQhHK+HdFXFhqLhh+R9aV8A0 w==; X-IronPort-AV: E=McAfee;i="6500,9779,10490"; a="304110413" X-IronPort-AV: E=Sophos;i="5.95,159,1661842800"; d="scan'208";a="304110413" Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by orsmga102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 05 Oct 2022 03:20:15 -0700 X-IronPort-AV: E=McAfee;i="6500,9779,10490"; a="728605912" X-IronPort-AV: E=Sophos;i="5.95,159,1661842800"; d="scan'208";a="728605912" Received: from ahunter6-mobl1.ger.corp.intel.com (HELO ahunter-VirtualBox.home\044ger.corp.intel.com) ([10.252.59.192]) by fmsmga002-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 05 Oct 2022 03:20:13 -0700 From: Adrian Hunter To: Ulf Hansson Cc: Stefan Wahren , Florian Fainelli , Wolfram Sang , Alex Dubov , Thierry Reding , linux-mmc@vger.kernel.org Subject: [PATCH 02/14] mmc: sdhci: Remove local_irq_{save,restore}() around sg_miter_{next,stop}() Date: Wed, 5 Oct 2022 13:19:39 +0300 Message-Id: <20221005101951.3165-3-adrian.hunter@intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20221005101951.3165-1-adrian.hunter@intel.com> References: <20221005101951.3165-1-adrian.hunter@intel.com> MIME-Version: 1.0 Organization: Intel Finland Oy, Registered Address: PL 281, 00181 Helsinki, Business Identity Code: 0357606 - 4, Domiciled in Helsinki Precedence: bulk List-ID: X-Mailing-List: linux-mmc@vger.kernel.org sg_miter_next() using an sg_mapping_iter with flag SG_MITER_ATOMIC uses kmap_atomic() to map pages. A long time ago the kmap_atomic API required a slot to be provided which risked the possibility that other code might use the same slot at the same time. Disabling interrupts prevented the possibility of an interrupt handler doing that. However, that went away with commit 3e4d3af501cc ("mm: stack based kmap_atomic()"). Remove local_irq_{save,restore}() around sg_miter_{next,stop}(). Signed-off-by: Adrian Hunter --- drivers/mmc/host/sdhci.c | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c index 0ee20f4beebf..31d87ec7d055 100644 --- a/drivers/mmc/host/sdhci.c +++ b/drivers/mmc/host/sdhci.c @@ -525,7 +525,6 @@ static inline bool sdhci_has_requests(struct sdhci_host *host) static void sdhci_read_block_pio(struct sdhci_host *host) { - unsigned long flags; size_t blksize, len, chunk; u32 scratch; u8 *buf; @@ -535,8 +534,6 @@ static void sdhci_read_block_pio(struct sdhci_host *host) blksize = host->data->blksz; chunk = 0; - local_irq_save(flags); - while (blksize) { BUG_ON(!sg_miter_next(&host->sg_miter)); @@ -563,13 +560,10 @@ static void sdhci_read_block_pio(struct sdhci_host *host) } sg_miter_stop(&host->sg_miter); - - local_irq_restore(flags); } static void sdhci_write_block_pio(struct sdhci_host *host) { - unsigned long flags; size_t blksize, len, chunk; u32 scratch; u8 *buf; @@ -580,8 +574,6 @@ static void sdhci_write_block_pio(struct sdhci_host *host) chunk = 0; scratch = 0; - local_irq_save(flags); - while (blksize) { BUG_ON(!sg_miter_next(&host->sg_miter)); @@ -608,8 +600,6 @@ static void sdhci_write_block_pio(struct sdhci_host *host) } sg_miter_stop(&host->sg_miter); - - local_irq_restore(flags); } static void sdhci_transfer_pio(struct sdhci_host *host) From patchwork Wed Oct 5 10:19:40 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adrian Hunter X-Patchwork-Id: 12999108 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A33ADC433F5 for ; Wed, 5 Oct 2022 10:20:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229608AbiJEKUV (ORCPT ); Wed, 5 Oct 2022 06:20:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54224 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229685AbiJEKUT (ORCPT ); Wed, 5 Oct 2022 06:20:19 -0400 Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 681CC73902 for ; Wed, 5 Oct 2022 03:20:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1664965218; x=1696501218; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=UUs+qYdCmXUrQman2MZrT8uLyoAo4la1YqjYh5vGoY4=; b=F3wBl1exW2a07GRkQ2rfQWM+kBfJCxr6FQuIf5t2na37edXtameHaQzN d0X3uUZ1oJXrkAQIPWlEMk5MnwoDYHR0bk9AMiyQf/vDNm5mCyjpJQnvD ni1yirk3F4VZNgXILl02Dy9zX4uerDy3WmV04pkuViUfiYlTHmDCrAvFp dBSIhfryq9JMLfcmJCYUAuqaK6OJykM1GUBN0oHph/jdq0DRmcjowjlyC ptsRMUDBL4YJ/FebxwRkcEYPpfTBhD3vAil6/BRJllWxiefIJXJc6X6ps 2bRPbxd5wO2XloAYo0N9muDmpToyKO/ONf3T9NyWE7Sruuh8DqhSraghT Q==; X-IronPort-AV: E=McAfee;i="6500,9779,10490"; a="304110416" X-IronPort-AV: E=Sophos;i="5.95,159,1661842800"; d="scan'208";a="304110416" Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by orsmga102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 05 Oct 2022 03:20:18 -0700 X-IronPort-AV: E=McAfee;i="6500,9779,10490"; a="728605916" X-IronPort-AV: E=Sophos;i="5.95,159,1661842800"; d="scan'208";a="728605916" Received: from ahunter6-mobl1.ger.corp.intel.com (HELO ahunter-VirtualBox.home\044ger.corp.intel.com) ([10.252.59.192]) by fmsmga002-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 05 Oct 2022 03:20:15 -0700 From: Adrian Hunter To: Ulf Hansson Cc: Stefan Wahren , Florian Fainelli , Wolfram Sang , Alex Dubov , Thierry Reding , linux-mmc@vger.kernel.org Subject: [PATCH 03/14] mmc: sdhci: Replace kmap_atomic() with kmap_local_page() Date: Wed, 5 Oct 2022 13:19:40 +0300 Message-Id: <20221005101951.3165-4-adrian.hunter@intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20221005101951.3165-1-adrian.hunter@intel.com> References: <20221005101951.3165-1-adrian.hunter@intel.com> MIME-Version: 1.0 Organization: Intel Finland Oy, Registered Address: PL 281, 00181 Helsinki, Business Identity Code: 0357606 - 4, Domiciled in Helsinki Precedence: bulk List-ID: X-Mailing-List: linux-mmc@vger.kernel.org kmap_local_page() is equivalent to kmap_atomic() except that it does not disable page faults or preemption. Where possible kmap_local_page() is preferred to kmap_atomic() - refer kernel highmem documentation. In this case, there is no need to disable page faults or preemption, so replace kmap_atomic() with kmap_local_page(), and, correspondingly, kunmap_atomic() with kunmap_local(). Signed-off-by: Adrian Hunter --- drivers/mmc/host/sdhci.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c index 31d87ec7d055..fb6e9a81f198 100644 --- a/drivers/mmc/host/sdhci.c +++ b/drivers/mmc/host/sdhci.c @@ -697,12 +697,12 @@ static int sdhci_pre_dma_transfer(struct sdhci_host *host, static char *sdhci_kmap_atomic(struct scatterlist *sg) { - return kmap_atomic(sg_page(sg)) + sg->offset; + return kmap_local_page(sg_page(sg)) + sg->offset; } static void sdhci_kunmap_atomic(void *buffer) { - kunmap_atomic(buffer); + kunmap_local(buffer); } void sdhci_adma_write_desc(struct sdhci_host *host, void **desc, From patchwork Wed Oct 5 10:19:41 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adrian Hunter X-Patchwork-Id: 12999109 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 02398C433FE for ; Wed, 5 Oct 2022 10:20:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229593AbiJEKU0 (ORCPT ); Wed, 5 Oct 2022 06:20:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54288 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229708AbiJEKUW (ORCPT ); Wed, 5 Oct 2022 06:20:22 -0400 Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B708E74346 for ; Wed, 5 Oct 2022 03:20:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1664965220; x=1696501220; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=KTDJ3Rp1axDNGeX58oy3aTlApK2zSpIdoA06Z3aTles=; b=IU/RzBjNlFZ/0qOr6gp1/jgHzT7+ARey+u5JxuMxzUuB2Myt1DWMAg0g iuFwBt98f4c7nt2LGUsjcpuhEgealKDxEGl8X+q5HVqIqRe4aQcINDT8A ygs6eEEU8vl7BzDgbd1U9aRqZJEMZdk0jF40Z+9/l5QiQxJZfU+6BhW26 rimyyrkF0jvQ0qvtgqQt4DDOO0N4Z7uLaanglQEUjokjXNFxUWW7Pj/ba zLCzvQjQ1QDSlJYlR/QDQY0xUbSSxijqLTPvgWQ6bFaOggriMkFHtJ7Z5 vj/+PqkD/sXnEOuKvkHAstCgjmddrM0nQFWYv5IJ4VP9gw+HOIsuOLKKA Q==; X-IronPort-AV: E=McAfee;i="6500,9779,10490"; a="304110421" X-IronPort-AV: E=Sophos;i="5.95,159,1661842800"; d="scan'208";a="304110421" Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by orsmga102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 05 Oct 2022 03:20:20 -0700 X-IronPort-AV: E=McAfee;i="6500,9779,10490"; a="728605935" X-IronPort-AV: E=Sophos;i="5.95,159,1661842800"; d="scan'208";a="728605935" Received: from ahunter6-mobl1.ger.corp.intel.com (HELO ahunter-VirtualBox.home\044ger.corp.intel.com) ([10.252.59.192]) by fmsmga002-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 05 Oct 2022 03:20:18 -0700 From: Adrian Hunter To: Ulf Hansson Cc: Stefan Wahren , Florian Fainelli , Wolfram Sang , Alex Dubov , Thierry Reding , linux-mmc@vger.kernel.org Subject: [PATCH 04/14] mmc: bcm2835: Remove local_irq_{save,restore}() around k[un]map_atomic() Date: Wed, 5 Oct 2022 13:19:41 +0300 Message-Id: <20221005101951.3165-5-adrian.hunter@intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20221005101951.3165-1-adrian.hunter@intel.com> References: <20221005101951.3165-1-adrian.hunter@intel.com> MIME-Version: 1.0 Organization: Intel Finland Oy, Registered Address: PL 281, 00181 Helsinki, Business Identity Code: 0357606 - 4, Domiciled in Helsinki Precedence: bulk List-ID: X-Mailing-List: linux-mmc@vger.kernel.org A long time ago the kmap_atomic API required a slot to be provided which risked the possibility that other code might use the same slot at the same time. Disabling interrupts prevented the possibility of an interrupt handler doing that. However, that went away with commit 3e4d3af501cc ("mm: stack based kmap_atomic()"). Unfortunately, that unnecessary pattern of code has been copied since and persists in bcm2385.c. Remove it. Signed-off-by: Adrian Hunter --- drivers/mmc/host/bcm2835.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/drivers/mmc/host/bcm2835.c b/drivers/mmc/host/bcm2835.c index 641ab4f42125..49acbfa87ab8 100644 --- a/drivers/mmc/host/bcm2835.c +++ b/drivers/mmc/host/bcm2835.c @@ -1068,7 +1068,6 @@ static void bcm2835_dma_complete_work(struct work_struct *work) } if (host->drain_words) { - unsigned long flags; void *page; u32 *buf; @@ -1076,7 +1075,6 @@ static void bcm2835_dma_complete_work(struct work_struct *work) host->drain_page += host->drain_offset >> PAGE_SHIFT; host->drain_offset &= ~PAGE_MASK; } - local_irq_save(flags); page = kmap_atomic(host->drain_page); buf = page + host->drain_offset; @@ -1089,7 +1087,6 @@ static void bcm2835_dma_complete_work(struct work_struct *work) } kunmap_atomic(page); - local_irq_restore(flags); } bcm2835_finish_data(host); From patchwork Wed Oct 5 10:19:42 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adrian Hunter X-Patchwork-Id: 12999110 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 52C0DC4332F for ; Wed, 5 Oct 2022 10:20:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229708AbiJEKUa (ORCPT ); Wed, 5 Oct 2022 06:20:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54428 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229711AbiJEKU2 (ORCPT ); Wed, 5 Oct 2022 06:20:28 -0400 Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 24DF173917 for ; Wed, 5 Oct 2022 03:20:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1664965224; x=1696501224; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=+Jh13VvZzGFPhxWL+aCBqD8YhZrYTDwgou6rEZvcP2c=; b=ZWaYS/USyI8O/NQdpgiRfVj/rRqyo1sRcjAUKyGqnKdZu3L1WVb+kAkm GvYxL8V+miOFvYOQOgT81i4ZZkMl9/TdJYAJZkqDggL9AdxALYAckA8GL W8rNQp6wqOJKmJkBt8KgZE04N2xNdcNkLhoTFgACRPT3JsOMXDT+hOUTU 0AW9ZMwf03hjZIjX8NrcG03agaP4WLSz00QksnVTYOxOidDmOL/upUJaB PM2C99zIRCbZ44NVEuoJFplTmaDltnXIRrZdFV0xYmT5j1wras6sDiFKP xN6Cot+PAeGY41vwXONaWsLvtoytrD3GaET1cSL3coQ7d9GoqUCWpmwd1 g==; X-IronPort-AV: E=McAfee;i="6500,9779,10490"; a="304110426" X-IronPort-AV: E=Sophos;i="5.95,159,1661842800"; d="scan'208";a="304110426" Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by orsmga102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 05 Oct 2022 03:20:22 -0700 X-IronPort-AV: E=McAfee;i="6500,9779,10490"; a="728605943" X-IronPort-AV: E=Sophos;i="5.95,159,1661842800"; d="scan'208";a="728605943" Received: from ahunter6-mobl1.ger.corp.intel.com (HELO ahunter-VirtualBox.home\044ger.corp.intel.com) ([10.252.59.192]) by fmsmga002-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 05 Oct 2022 03:20:20 -0700 From: Adrian Hunter To: Ulf Hansson Cc: Stefan Wahren , Florian Fainelli , Wolfram Sang , Alex Dubov , Thierry Reding , linux-mmc@vger.kernel.org Subject: [PATCH 05/14] mmc: bcm2835: Remove local_irq_{save,restore}() around sg_miter_{next,stop}() Date: Wed, 5 Oct 2022 13:19:42 +0300 Message-Id: <20221005101951.3165-6-adrian.hunter@intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20221005101951.3165-1-adrian.hunter@intel.com> References: <20221005101951.3165-1-adrian.hunter@intel.com> MIME-Version: 1.0 Organization: Intel Finland Oy, Registered Address: PL 281, 00181 Helsinki, Business Identity Code: 0357606 - 4, Domiciled in Helsinki Precedence: bulk List-ID: X-Mailing-List: linux-mmc@vger.kernel.org sg_miter_next() using an sg_mapping_iter with flag SG_MITER_ATOMIC uses kmap_atomic() to map pages. A long time ago the kmap_atomic API required a slot to be provided which risked the possibility that other code might use the same slot at the same time. Disabling interrupts prevented the possibility of an interrupt handler doing that. However, that went away with commit 3e4d3af501cc ("mm: stack based kmap_atomic()"). Remove local_irq_{save,restore}() around sg_miter_{next,stop}(). Signed-off-by: Adrian Hunter --- drivers/mmc/host/bcm2835.c | 5 ----- 1 file changed, 5 deletions(-) diff --git a/drivers/mmc/host/bcm2835.c b/drivers/mmc/host/bcm2835.c index 49acbfa87ab8..440773e3ba55 100644 --- a/drivers/mmc/host/bcm2835.c +++ b/drivers/mmc/host/bcm2835.c @@ -327,7 +327,6 @@ static void bcm2835_dma_complete(void *param) static void bcm2835_transfer_block_pio(struct bcm2835_host *host, bool is_read) { - unsigned long flags; size_t blksize; unsigned long wait_max; @@ -335,8 +334,6 @@ static void bcm2835_transfer_block_pio(struct bcm2835_host *host, bool is_read) wait_max = jiffies + msecs_to_jiffies(500); - local_irq_save(flags); - while (blksize) { int copy_words; u32 hsts = 0; @@ -421,8 +418,6 @@ static void bcm2835_transfer_block_pio(struct bcm2835_host *host, bool is_read) } sg_miter_stop(&host->sg_miter); - - local_irq_restore(flags); } static void bcm2835_transfer_pio(struct bcm2835_host *host) From patchwork Wed Oct 5 10:19:43 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adrian Hunter X-Patchwork-Id: 12999111 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E56A5C433FE for ; Wed, 5 Oct 2022 10:20:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229711AbiJEKUa (ORCPT ); Wed, 5 Oct 2022 06:20:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54430 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229710AbiJEKU2 (ORCPT ); Wed, 5 Oct 2022 06:20:28 -0400 Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AE03A74346 for ; Wed, 5 Oct 2022 03:20:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1664965225; x=1696501225; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=OTSmrEt2GIdGjZDQKAw02bjSU5MeRqdd+2YUlOEbJCI=; b=XWEhrgT2cIYdb3SdywXqWfFvSpqMtjvVPnJ+QQLIOyQ3GACNFkFXzhgd CbxWw9t66ejZ58IHe/FxaQRH2dKxgFz2Q1e7ZBibGBdbcSIS7e6cJZ7nB jseDgTeibq5eZRww1/9ruHLNsqy2CxWTYzFkB8IfW/+sAXS5Ud0xDAn23 6SGs3RuYkeERcAuqmE8ARlywgAw/tQpjVFHQqjan0PYSgnY+ggL/vQb64 WLeVIr04Qe0Dy3X7kU+3yxO3kmYxfyr9tusN8R7h8cPtuo20q7zFEBAqf 9ImXPSdrrCxyYtoEA2XygGOMKMRgGfcRhMbQ7U1KLBCcKMd/LziHljr+G g==; X-IronPort-AV: E=McAfee;i="6500,9779,10490"; a="304110436" X-IronPort-AV: E=Sophos;i="5.95,159,1661842800"; d="scan'208";a="304110436" Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by orsmga102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 05 Oct 2022 03:20:25 -0700 X-IronPort-AV: E=McAfee;i="6500,9779,10490"; a="728605955" X-IronPort-AV: E=Sophos;i="5.95,159,1661842800"; d="scan'208";a="728605955" Received: from ahunter6-mobl1.ger.corp.intel.com (HELO ahunter-VirtualBox.home\044ger.corp.intel.com) ([10.252.59.192]) by fmsmga002-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 05 Oct 2022 03:20:23 -0700 From: Adrian Hunter To: Ulf Hansson Cc: Stefan Wahren , Florian Fainelli , Wolfram Sang , Alex Dubov , Thierry Reding , linux-mmc@vger.kernel.org Subject: [PATCH 06/14] mmc: bcm2835: Replace kmap_atomic() with kmap_local_page() Date: Wed, 5 Oct 2022 13:19:43 +0300 Message-Id: <20221005101951.3165-7-adrian.hunter@intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20221005101951.3165-1-adrian.hunter@intel.com> References: <20221005101951.3165-1-adrian.hunter@intel.com> MIME-Version: 1.0 Organization: Intel Finland Oy, Registered Address: PL 281, 00181 Helsinki, Business Identity Code: 0357606 - 4, Domiciled in Helsinki Precedence: bulk List-ID: X-Mailing-List: linux-mmc@vger.kernel.org kmap_local_page() is equivalent to kmap_atomic() except that it does not disable page faults or preemption. Where possible kmap_local_page() is preferred to kmap_atomic() - refer kernel highmem documentation. In this case, there is no need to disable page faults or preemption, so replace kmap_atomic() with kmap_local_page(), and, correspondingly, kunmap_atomic() with kunmap_local(). Signed-off-by: Adrian Hunter --- drivers/mmc/host/bcm2835.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/mmc/host/bcm2835.c b/drivers/mmc/host/bcm2835.c index 440773e3ba55..8648f7e63ca1 100644 --- a/drivers/mmc/host/bcm2835.c +++ b/drivers/mmc/host/bcm2835.c @@ -1070,7 +1070,7 @@ static void bcm2835_dma_complete_work(struct work_struct *work) host->drain_page += host->drain_offset >> PAGE_SHIFT; host->drain_offset &= ~PAGE_MASK; } - page = kmap_atomic(host->drain_page); + page = kmap_local_page(host->drain_page); buf = page + host->drain_offset; while (host->drain_words) { @@ -1081,7 +1081,7 @@ static void bcm2835_dma_complete_work(struct work_struct *work) host->drain_words--; } - kunmap_atomic(page); + kunmap_local(page); } bcm2835_finish_data(host); From patchwork Wed Oct 5 10:19:44 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adrian Hunter X-Patchwork-Id: 12999112 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C272EC433F5 for ; Wed, 5 Oct 2022 10:20:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229710AbiJEKUb (ORCPT ); Wed, 5 Oct 2022 06:20:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54484 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229727AbiJEKU3 (ORCPT ); Wed, 5 Oct 2022 06:20:29 -0400 Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0FAE574B80 for ; Wed, 5 Oct 2022 03:20:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1664965228; x=1696501228; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=H+qpET7m8KjrmynFemQpw4n7WO+ula0zi+RhEelZiHk=; b=el+AKt0g8ElWr1bGdFex+NO+I5Kk7vff4cLCY9ngncBO79SD/dLPST2m g+00VRjWb2CNXww4hSyacrkjPcI+0Yf0cIkdV/fX83sDaMldMDI51ymgr VUicZZ8/0U7ihxfnKzDtD2lIK9uL4HYFaoWOtrfQVp+cGLAR7IhX1YFCL DXbmaKjdg7k1LGSWyr8v7pEULXY51aIv7+ZVJAJpW00l5HdW+z1KjIj2Y u8LClPfbcZKmRMzKsmLBuSr65gJLPT4VAWx+czfI0qObJlnPJ3YcI5sJ/ Vzz4eAUcWJyoWThKUYZDLMZnvNMTR1ezKWLh7P8+g0zL9b6LTImVEPngO g==; X-IronPort-AV: E=McAfee;i="6500,9779,10490"; a="304110444" X-IronPort-AV: E=Sophos;i="5.95,159,1661842800"; d="scan'208";a="304110444" Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by orsmga102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 05 Oct 2022 03:20:27 -0700 X-IronPort-AV: E=McAfee;i="6500,9779,10490"; a="728605965" X-IronPort-AV: E=Sophos;i="5.95,159,1661842800"; d="scan'208";a="728605965" Received: from ahunter6-mobl1.ger.corp.intel.com (HELO ahunter-VirtualBox.home\044ger.corp.intel.com) ([10.252.59.192]) by fmsmga002-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 05 Oct 2022 03:20:25 -0700 From: Adrian Hunter To: Ulf Hansson Cc: Stefan Wahren , Florian Fainelli , Wolfram Sang , Alex Dubov , Thierry Reding , linux-mmc@vger.kernel.org Subject: [PATCH 07/14] mmc: mmc_test: Remove local_irq_{save,restore}() around sg_copy_{from,to}_buffer() Date: Wed, 5 Oct 2022 13:19:44 +0300 Message-Id: <20221005101951.3165-8-adrian.hunter@intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20221005101951.3165-1-adrian.hunter@intel.com> References: <20221005101951.3165-1-adrian.hunter@intel.com> MIME-Version: 1.0 Organization: Intel Finland Oy, Registered Address: PL 281, 00181 Helsinki, Business Identity Code: 0357606 - 4, Domiciled in Helsinki Precedence: bulk List-ID: X-Mailing-List: linux-mmc@vger.kernel.org sg_copy_{from,to}_buffer() call sg_copy_buffer() which uses an sg_mapping_iter with flag SG_MITER_ATOMIC, so then sg_miter_next() uses kmap_atomic() to map pages. A long time ago the kmap_atomic API required a slot to be provided which risked the possibility that other code might use the same slot at the same time. Disabling interrupts prevented the possibility of an interrupt handler doing that. However, that went away with commit 3e4d3af501cc ("mm: stack based kmap_atomic()"). Remove local_irq_{save,restore}() around sg_copy_{from,to}_buffer(). Signed-off-by: Adrian Hunter --- drivers/mmc/core/mmc_test.c | 5 ----- 1 file changed, 5 deletions(-) diff --git a/drivers/mmc/core/mmc_test.c b/drivers/mmc/core/mmc_test.c index 8d9bceeff986..6cd6f8a94a71 100644 --- a/drivers/mmc/core/mmc_test.c +++ b/drivers/mmc/core/mmc_test.c @@ -932,7 +932,6 @@ static int mmc_test_transfer(struct mmc_test_card *test, unsigned blocks, unsigned blksz, int write) { int ret, i; - unsigned long flags; if (write) { for (i = 0; i < blocks * blksz; i++) @@ -940,9 +939,7 @@ static int mmc_test_transfer(struct mmc_test_card *test, } else { memset(test->scratch, 0, BUFFER_SIZE); } - local_irq_save(flags); sg_copy_from_buffer(sg, sg_len, test->scratch, BUFFER_SIZE); - local_irq_restore(flags); ret = mmc_test_set_blksize(test, blksz); if (ret) @@ -987,9 +984,7 @@ static int mmc_test_transfer(struct mmc_test_card *test, return RESULT_FAIL; } } else { - local_irq_save(flags); sg_copy_to_buffer(sg, sg_len, test->scratch, BUFFER_SIZE); - local_irq_restore(flags); for (i = 0; i < blocks * blksz; i++) { if (test->scratch[i] != (u8)i) return RESULT_FAIL; From patchwork Wed Oct 5 10:19:45 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adrian Hunter X-Patchwork-Id: 12999113 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 53BDFC4332F for ; Wed, 5 Oct 2022 10:20:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229812AbiJEKUd (ORCPT ); Wed, 5 Oct 2022 06:20:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54540 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229685AbiJEKUa (ORCPT ); Wed, 5 Oct 2022 06:20:30 -0400 Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DC77D74CC2 for ; Wed, 5 Oct 2022 03:20:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1664965229; x=1696501229; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=iApiaRkX3NpLoiypUKfBaKPYNfGTMaXUbRmeNC2CZAg=; b=npZ4bSuoCHN0fwfMnBtOJPHuMJquI2sgy1U9yeluoZR/WdFxqIomE9Og hsXVm1EwTJtHlO+Lb/5ekHifsZpLFMzYdRPnYptB2AO3r0KfD039bGRyU aE+IbfZRwdZNli/FDGaRw42x7h8u0lTzfBFPuX5/sRv4rNGruVy+8Bgbs ouQXKJYVqpWhzW9xgk9zXGQy7YViDg673UWGbsXjaDkItDMpih13JLKKc Q5rb+WeZmJbTAIOkzibgnPl32GHWNlJAclgRNkyOSnJBbH2snFzkwBLsq SVO2KSj27Pesh4VCrC/xbrXR+UwwCrP/42FsWh2LNKthYF7OFJA3eH7vI g==; X-IronPort-AV: E=McAfee;i="6500,9779,10490"; a="304110448" X-IronPort-AV: E=Sophos;i="5.95,159,1661842800"; d="scan'208";a="304110448" Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by orsmga102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 05 Oct 2022 03:20:29 -0700 X-IronPort-AV: E=McAfee;i="6500,9779,10490"; a="728605974" X-IronPort-AV: E=Sophos;i="5.95,159,1661842800"; d="scan'208";a="728605974" Received: from ahunter6-mobl1.ger.corp.intel.com (HELO ahunter-VirtualBox.home\044ger.corp.intel.com) ([10.252.59.192]) by fmsmga002-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 05 Oct 2022 03:20:27 -0700 From: Adrian Hunter To: Ulf Hansson Cc: Stefan Wahren , Florian Fainelli , Wolfram Sang , Alex Dubov , Thierry Reding , linux-mmc@vger.kernel.org Subject: [PATCH 08/14] mmc: tifm_sd: Remove local_irq_{save,restore}() around tifm_sd_transfer_data() Date: Wed, 5 Oct 2022 13:19:45 +0300 Message-Id: <20221005101951.3165-9-adrian.hunter@intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20221005101951.3165-1-adrian.hunter@intel.com> References: <20221005101951.3165-1-adrian.hunter@intel.com> MIME-Version: 1.0 Organization: Intel Finland Oy, Registered Address: PL 281, 00181 Helsinki, Business Identity Code: 0357606 - 4, Domiciled in Helsinki Precedence: bulk List-ID: X-Mailing-List: linux-mmc@vger.kernel.org tifm_sd_transfer_data() calls functions that ultimate use kmap_atomic() to map pages. A long time ago the kmap_atomic API required a slot to be provided which risked the possibility that other code might use the same slot at the same time. Disabling interrupts prevented the possibility of an interrupt handler doing that. However, that went away with commit 3e4d3af501cc ("mm: stack based kmap_atomic()"). When the second argument to kmap_atomic was removed by commit 482fce997e14 ("mmc: remove the second argument of k[un]map_atomic()"), local_irq_{save,restore}() should have been removed also. Remove it now. Signed-off-by: Adrian Hunter --- drivers/mmc/host/tifm_sd.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/drivers/mmc/host/tifm_sd.c b/drivers/mmc/host/tifm_sd.c index 63917070b1a7..ed1685add446 100644 --- a/drivers/mmc/host/tifm_sd.c +++ b/drivers/mmc/host/tifm_sd.c @@ -506,7 +506,6 @@ static void tifm_sd_card_event(struct tifm_dev *sock) unsigned int host_status = 0; int cmd_error = 0; struct mmc_command *cmd = NULL; - unsigned long flags; spin_lock(&sock->lock); host = mmc_priv((struct mmc_host*)tifm_get_drvdata(sock)); @@ -570,9 +569,7 @@ static void tifm_sd_card_event(struct tifm_dev *sock) if (host_status & (TIFM_MMCSD_AE | TIFM_MMCSD_AF | TIFM_MMCSD_BRS)) { - local_irq_save(flags); tifm_sd_transfer_data(host); - local_irq_restore(flags); host_status &= ~TIFM_MMCSD_AE; } } From patchwork Wed Oct 5 10:19:46 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adrian Hunter X-Patchwork-Id: 12999114 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4BC4AC433FE for ; Wed, 5 Oct 2022 10:20:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229781AbiJEKUd (ORCPT ); Wed, 5 Oct 2022 06:20:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54608 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229727AbiJEKUc (ORCPT ); Wed, 5 Oct 2022 06:20:32 -0400 Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2CF1A75CC2 for ; Wed, 5 Oct 2022 03:20:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1664965232; x=1696501232; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=dGXSJEkacErT+CMoDEUiOkDAkmEkNZ8NLs8UbTLgyiE=; b=Fj47/nLHDukEA1AWp1r1ELCCw3/K/uDatB1YROlZfHbs+M1uD3bbRFHx uyImIjtLbYyh2rPHDxv4cazAy6XqQ3tkoh5cumJmYfiYow1axs1VMmmV4 ls/9O9L7n9DWs/6ahZVqaxxGf9u9szIBq3+w9KSO2U+TH50+Ygx0hWaxE sLrbvJhMb8VRZF3lq5GFOSvWUBNjCpdRHURRYG6zmqV2JzbdfutnKAVS8 IMsINe21FH4XNrcrEa7A/5cgvvgnIYv8tK1HDoANXUR0qRvXocWVkPxeW 0cXc+8BfycQnV0cdOqy4mdvoa1ajvWoSnNcrpjFVUoJan1RHUTwNQ5ClO g==; X-IronPort-AV: E=McAfee;i="6500,9779,10490"; a="304110451" X-IronPort-AV: E=Sophos;i="5.95,159,1661842800"; d="scan'208";a="304110451" Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by orsmga102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 05 Oct 2022 03:20:32 -0700 X-IronPort-AV: E=McAfee;i="6500,9779,10490"; a="728605981" X-IronPort-AV: E=Sophos;i="5.95,159,1661842800"; d="scan'208";a="728605981" Received: from ahunter6-mobl1.ger.corp.intel.com (HELO ahunter-VirtualBox.home\044ger.corp.intel.com) ([10.252.59.192]) by fmsmga002-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 05 Oct 2022 03:20:29 -0700 From: Adrian Hunter To: Ulf Hansson Cc: Stefan Wahren , Florian Fainelli , Wolfram Sang , Alex Dubov , Thierry Reding , linux-mmc@vger.kernel.org Subject: [PATCH 09/14] mmc: tifm_sd: Remove local_irq_{save,restore}() around tifm_sd_bounce_block() Date: Wed, 5 Oct 2022 13:19:46 +0300 Message-Id: <20221005101951.3165-10-adrian.hunter@intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20221005101951.3165-1-adrian.hunter@intel.com> References: <20221005101951.3165-1-adrian.hunter@intel.com> MIME-Version: 1.0 Organization: Intel Finland Oy, Registered Address: PL 281, 00181 Helsinki, Business Identity Code: 0357606 - 4, Domiciled in Helsinki Precedence: bulk List-ID: X-Mailing-List: linux-mmc@vger.kernel.org tifm_sd_bounce_block() calls functions that ultimate use kmap_atomic() to map pages. A long time ago the kmap_atomic API required a slot to be provided which risked the possibility that other code might use the same slot at the same time. Disabling interrupts prevented the possibility of an interrupt handler doing that. However, that went away with commit 3e4d3af501cc ("mm: stack based kmap_atomic()"). When the second argument to kmap_atomic was removed by commit 482fce997e14 ("mmc: remove the second argument of k[un]map_atomic()"), local_irq_{save,restore}() should have been removed also. Remove it now. Signed-off-by: Adrian Hunter --- drivers/mmc/host/tifm_sd.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/drivers/mmc/host/tifm_sd.c b/drivers/mmc/host/tifm_sd.c index ed1685add446..d539f9b48422 100644 --- a/drivers/mmc/host/tifm_sd.c +++ b/drivers/mmc/host/tifm_sd.c @@ -264,16 +264,13 @@ static int tifm_sd_set_dma_data(struct tifm_sd *host, struct mmc_data *r_data) unsigned int t_size = TIFM_DMA_TSIZE * r_data->blksz; unsigned int dma_len, dma_blk_cnt, dma_off; struct scatterlist *sg = NULL; - unsigned long flags; if (host->sg_pos == host->sg_len) return 1; if (host->cmd_flags & DATA_CARRY) { host->cmd_flags &= ~DATA_CARRY; - local_irq_save(flags); tifm_sd_bounce_block(host, r_data); - local_irq_restore(flags); if (host->sg_pos == host->sg_len) return 1; } @@ -300,11 +297,9 @@ static int tifm_sd_set_dma_data(struct tifm_sd *host, struct mmc_data *r_data) if (dma_blk_cnt) sg = &r_data->sg[host->sg_pos]; else if (dma_len) { - if (r_data->flags & MMC_DATA_WRITE) { - local_irq_save(flags); + if (r_data->flags & MMC_DATA_WRITE) tifm_sd_bounce_block(host, r_data); - local_irq_restore(flags); - } else + else host->cmd_flags |= DATA_CARRY; sg = &host->bounce_buf; From patchwork Wed Oct 5 10:19:47 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adrian Hunter X-Patchwork-Id: 12999115 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id DFF1DC433F5 for ; Wed, 5 Oct 2022 10:20:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229861AbiJEKUg (ORCPT ); Wed, 5 Oct 2022 06:20:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54744 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229777AbiJEKUf (ORCPT ); Wed, 5 Oct 2022 06:20:35 -0400 Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9979E75CE0 for ; Wed, 5 Oct 2022 03:20:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1664965234; x=1696501234; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=7+PqZ32NVQdfGHU7azcHYiK2qm51Rx1ValQ6YoVHNkU=; b=QotegSY2T09SoLAWV0bqY0JSQPBak9gIwQO6EKAE54BcCaDPLBmhd3uJ LRHLpKudN+qVZM47wcXMOfL//jLnvJnEeTyXBgwe4atFaFbBNpCUWrYjD ELx9/J2BH5v2TIcT6uxTAFxF1zpJdfDdh6OO/MCTmKEg21Vv7yc9hd7wi Xsy55sClyTJeLtw47O9mNE2KClTrNsUECNbX3Lzzi39G1DX7nWwG58875 ErArkALE1GQIP4b1hFR2SjxV6/+9ulIIJ/dQufXr03YHgR3z6o1KN8ar8 0L9sXVpS25LppkPujbdKGe1JMNL1HMu2WO2Td4yQi9GBGk22gDOvhvFk4 A==; X-IronPort-AV: E=McAfee;i="6500,9779,10490"; a="304110456" X-IronPort-AV: E=Sophos;i="5.95,159,1661842800"; d="scan'208";a="304110456" Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by orsmga102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 05 Oct 2022 03:20:34 -0700 X-IronPort-AV: E=McAfee;i="6500,9779,10490"; a="728605993" X-IronPort-AV: E=Sophos;i="5.95,159,1661842800"; d="scan'208";a="728605993" Received: from ahunter6-mobl1.ger.corp.intel.com (HELO ahunter-VirtualBox.home\044ger.corp.intel.com) ([10.252.59.192]) by fmsmga002-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 05 Oct 2022 03:20:32 -0700 From: Adrian Hunter To: Ulf Hansson Cc: Stefan Wahren , Florian Fainelli , Wolfram Sang , Alex Dubov , Thierry Reding , linux-mmc@vger.kernel.org Subject: [PATCH 10/14] mmc: tifm_sd: Replace kmap_atomic() with kmap_local_page() Date: Wed, 5 Oct 2022 13:19:47 +0300 Message-Id: <20221005101951.3165-11-adrian.hunter@intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20221005101951.3165-1-adrian.hunter@intel.com> References: <20221005101951.3165-1-adrian.hunter@intel.com> MIME-Version: 1.0 Organization: Intel Finland Oy, Registered Address: PL 281, 00181 Helsinki, Business Identity Code: 0357606 - 4, Domiciled in Helsinki Precedence: bulk List-ID: X-Mailing-List: linux-mmc@vger.kernel.org kmap_local_page() is equivalent to kmap_atomic() except that it does not disable page faults or preemption. Where possible kmap_local_page() is preferred to kmap_atomic() - refer kernel highmem documentation. In this case, there is no need to disable page faults or preemption, so replace kmap_atomic() with kmap_local_page(), and, correspondingly, kunmap_atomic() with kunmap_local(). Signed-off-by: Adrian Hunter --- drivers/mmc/host/tifm_sd.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/drivers/mmc/host/tifm_sd.c b/drivers/mmc/host/tifm_sd.c index d539f9b48422..b5a2f2f25ad9 100644 --- a/drivers/mmc/host/tifm_sd.c +++ b/drivers/mmc/host/tifm_sd.c @@ -116,7 +116,7 @@ static void tifm_sd_read_fifo(struct tifm_sd *host, struct page *pg, unsigned char *buf; unsigned int pos = 0, val; - buf = kmap_atomic(pg) + off; + buf = kmap_local_page(pg) + off; if (host->cmd_flags & DATA_CARRY) { buf[pos++] = host->bounce_buf_data[0]; host->cmd_flags &= ~DATA_CARRY; @@ -132,7 +132,7 @@ static void tifm_sd_read_fifo(struct tifm_sd *host, struct page *pg, } buf[pos++] = (val >> 8) & 0xff; } - kunmap_atomic(buf - off); + kunmap_local(buf - off); } static void tifm_sd_write_fifo(struct tifm_sd *host, struct page *pg, @@ -142,7 +142,7 @@ static void tifm_sd_write_fifo(struct tifm_sd *host, struct page *pg, unsigned char *buf; unsigned int pos = 0, val; - buf = kmap_atomic(pg) + off; + buf = kmap_local_page(pg) + off; if (host->cmd_flags & DATA_CARRY) { val = host->bounce_buf_data[0] | ((buf[pos++] << 8) & 0xff00); writel(val, sock->addr + SOCK_MMCSD_DATA); @@ -159,7 +159,7 @@ static void tifm_sd_write_fifo(struct tifm_sd *host, struct page *pg, val |= (buf[pos++] << 8) & 0xff00; writel(val, sock->addr + SOCK_MMCSD_DATA); } - kunmap_atomic(buf - off); + kunmap_local(buf - off); } static void tifm_sd_transfer_data(struct tifm_sd *host) @@ -210,13 +210,13 @@ static void tifm_sd_copy_page(struct page *dst, unsigned int dst_off, struct page *src, unsigned int src_off, unsigned int count) { - unsigned char *src_buf = kmap_atomic(src) + src_off; - unsigned char *dst_buf = kmap_atomic(dst) + dst_off; + unsigned char *src_buf = kmap_local_page(src) + src_off; + unsigned char *dst_buf = kmap_local_page(dst) + dst_off; memcpy(dst_buf, src_buf, count); - kunmap_atomic(dst_buf - dst_off); - kunmap_atomic(src_buf - src_off); + kunmap_local(dst_buf - dst_off); + kunmap_local(src_buf - src_off); } static void tifm_sd_bounce_block(struct tifm_sd *host, struct mmc_data *r_data) From patchwork Wed Oct 5 10:19:48 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adrian Hunter X-Patchwork-Id: 12999116 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9A149C433FE for ; Wed, 5 Oct 2022 10:20:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229900AbiJEKUk (ORCPT ); Wed, 5 Oct 2022 06:20:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54832 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229777AbiJEKUi (ORCPT ); Wed, 5 Oct 2022 06:20:38 -0400 Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D790A75496 for ; Wed, 5 Oct 2022 03:20:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1664965236; x=1696501236; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=ySqpMmfPU6WHUVl46ZFzM3QA7uwCVmEUc5bGhgxfZPs=; b=eFYfWyCb/s7SCxKbA29LMjtfaZSqpd3WluZDxeB1vPinAw3ObtxAFXRr qOgC/Zf3jKjEbfiDKCaoPUgUzUOsUfWXbjHB5GwZc12iCXD41Y1el4Bbw u3V/nqvkns0qKEivpDKV4blnuCdjke6+KwpccMWBIwIR+saOR65iHQxDv 2LcVBNqocFZiCYrmCOwV5uLPbxbJXPgHTB54LUMiF+Qz0JgY42FfKDU6u SE2y4XLfNbHG3BKvBdQfMPDoqT/Q7EvpQoII2DgtYqmc14nbikTgAMue7 arQZr7Y/YEDmb/gvU2pZrPPATRnm1dFTK0/XsogeianXxmxmIFsxOB/UI Q==; X-IronPort-AV: E=McAfee;i="6500,9779,10490"; a="304110462" X-IronPort-AV: E=Sophos;i="5.95,159,1661842800"; d="scan'208";a="304110462" Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by orsmga102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 05 Oct 2022 03:20:36 -0700 X-IronPort-AV: E=McAfee;i="6500,9779,10490"; a="728606008" X-IronPort-AV: E=Sophos;i="5.95,159,1661842800"; d="scan'208";a="728606008" Received: from ahunter6-mobl1.ger.corp.intel.com (HELO ahunter-VirtualBox.home\044ger.corp.intel.com) ([10.252.59.192]) by fmsmga002-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 05 Oct 2022 03:20:34 -0700 From: Adrian Hunter To: Ulf Hansson Cc: Stefan Wahren , Florian Fainelli , Wolfram Sang , Alex Dubov , Thierry Reding , linux-mmc@vger.kernel.org Subject: [PATCH 11/14] mmc: tmio_mmc_core: Remove local_irq_{save,restore}() around k[un]map_atomic() Date: Wed, 5 Oct 2022 13:19:48 +0300 Message-Id: <20221005101951.3165-12-adrian.hunter@intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20221005101951.3165-1-adrian.hunter@intel.com> References: <20221005101951.3165-1-adrian.hunter@intel.com> MIME-Version: 1.0 Organization: Intel Finland Oy, Registered Address: PL 281, 00181 Helsinki, Business Identity Code: 0357606 - 4, Domiciled in Helsinki Precedence: bulk List-ID: X-Mailing-List: linux-mmc@vger.kernel.org A long time ago the kmap_atomic API required a slot to be provided which risked the possibility that other code might use the same slot at the same time. Disabling interrupts prevented the possibility of an interrupt handler doing that. However, that went away with commit 3e4d3af501cc ("mm: stack based kmap_atomic()"). When the second argument to kmap_atomic was removed by commit 482fce997e14 ("mmc: remove the second argument of k[un]map_atomic()"), local_irq_{save,restore}() should have been removed also. Remove it now. Signed-off-by: Adrian Hunter Reviewed-by: Wolfram Sang --- drivers/mmc/host/renesas_sdhi_sys_dmac.c | 5 ++--- drivers/mmc/host/tmio_mmc.h | 7 ++----- drivers/mmc/host/tmio_mmc_core.c | 10 ++++------ 3 files changed, 8 insertions(+), 14 deletions(-) diff --git a/drivers/mmc/host/renesas_sdhi_sys_dmac.c b/drivers/mmc/host/renesas_sdhi_sys_dmac.c index 99e3426df702..e9cc6c15d229 100644 --- a/drivers/mmc/host/renesas_sdhi_sys_dmac.c +++ b/drivers/mmc/host/renesas_sdhi_sys_dmac.c @@ -254,12 +254,11 @@ static void renesas_sdhi_sys_dmac_start_dma_tx(struct tmio_mmc_host *host) /* The only sg element can be unaligned, use our bounce buffer then */ if (!aligned) { - unsigned long flags; - void *sg_vaddr = tmio_mmc_kmap_atomic(sg, &flags); + void *sg_vaddr = tmio_mmc_kmap_atomic(sg); sg_init_one(&host->bounce_sg, host->bounce_buf, sg->length); memcpy(host->bounce_buf, sg_vaddr, host->bounce_sg.length); - tmio_mmc_kunmap_atomic(sg, &flags, sg_vaddr); + tmio_mmc_kunmap_atomic(sg, sg_vaddr); host->sg_ptr = &host->bounce_sg; sg = host->sg_ptr; } diff --git a/drivers/mmc/host/tmio_mmc.h b/drivers/mmc/host/tmio_mmc.h index 501613c74406..22375790b57b 100644 --- a/drivers/mmc/host/tmio_mmc.h +++ b/drivers/mmc/host/tmio_mmc.h @@ -204,18 +204,15 @@ void tmio_mmc_enable_mmc_irqs(struct tmio_mmc_host *host, u32 i); void tmio_mmc_disable_mmc_irqs(struct tmio_mmc_host *host, u32 i); irqreturn_t tmio_mmc_irq(int irq, void *devid); -static inline char *tmio_mmc_kmap_atomic(struct scatterlist *sg, - unsigned long *flags) +static inline char *tmio_mmc_kmap_atomic(struct scatterlist *sg) { - local_irq_save(*flags); return kmap_atomic(sg_page(sg)) + sg->offset; } static inline void tmio_mmc_kunmap_atomic(struct scatterlist *sg, - unsigned long *flags, void *virt) + void *virt) { kunmap_atomic(virt - sg->offset); - local_irq_restore(*flags); } #ifdef CONFIG_PM diff --git a/drivers/mmc/host/tmio_mmc_core.c b/drivers/mmc/host/tmio_mmc_core.c index 437048bb8027..6d50c0dd53fe 100644 --- a/drivers/mmc/host/tmio_mmc_core.c +++ b/drivers/mmc/host/tmio_mmc_core.c @@ -412,7 +412,6 @@ static void tmio_mmc_pio_irq(struct tmio_mmc_host *host) void *sg_virt; unsigned short *buf; unsigned int count; - unsigned long flags; if (host->dma_on) { pr_err("PIO IRQ in DMA mode!\n"); @@ -422,7 +421,7 @@ static void tmio_mmc_pio_irq(struct tmio_mmc_host *host) return; } - sg_virt = tmio_mmc_kmap_atomic(host->sg_ptr, &flags); + sg_virt = tmio_mmc_kmap_atomic(host->sg_ptr); buf = (unsigned short *)(sg_virt + host->sg_off); count = host->sg_ptr->length - host->sg_off; @@ -437,7 +436,7 @@ static void tmio_mmc_pio_irq(struct tmio_mmc_host *host) host->sg_off += count; - tmio_mmc_kunmap_atomic(host->sg_ptr, &flags, sg_virt); + tmio_mmc_kunmap_atomic(host->sg_ptr, sg_virt); if (host->sg_off == host->sg_ptr->length) tmio_mmc_next_sg(host); @@ -446,11 +445,10 @@ static void tmio_mmc_pio_irq(struct tmio_mmc_host *host) static void tmio_mmc_check_bounce_buffer(struct tmio_mmc_host *host) { if (host->sg_ptr == &host->bounce_sg) { - unsigned long flags; - void *sg_vaddr = tmio_mmc_kmap_atomic(host->sg_orig, &flags); + void *sg_vaddr = tmio_mmc_kmap_atomic(host->sg_orig); memcpy(sg_vaddr, host->bounce_buf, host->bounce_sg.length); - tmio_mmc_kunmap_atomic(host->sg_orig, &flags, sg_vaddr); + tmio_mmc_kunmap_atomic(host->sg_orig, sg_vaddr); } } From patchwork Wed Oct 5 10:19:49 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adrian Hunter X-Patchwork-Id: 12999117 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9BF3BC4332F for ; Wed, 5 Oct 2022 10:20:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229777AbiJEKUk (ORCPT ); Wed, 5 Oct 2022 06:20:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54886 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229685AbiJEKUj (ORCPT ); Wed, 5 Oct 2022 06:20:39 -0400 Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 28F9A75FD2 for ; Wed, 5 Oct 2022 03:20:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1664965239; x=1696501239; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=DBouPXkn19648vXl5QGVnrLRPK2p8QLNiXR5Fea/A5c=; b=JQozLggQHCpYhObA939S4aE3zlaY1ofRHZsdHuGLrId2qvDRm2kcd9n2 mkcwC4WxOoOf3L9xmpA2c5KK7uwkF+4f2vKqODAF4Rr+iuAols/Khd1rR a2jFHbZtxoUrbK3CYNme55AHat+ye7ALqMnAstEoYPDBvPBPq6LRsGg7w 7utDXwtCUDkZhueVH2LLezXB9Z+P6y7jLrd7grIhkOOpqgdV2AhEodRBl 07mmcI8NYjv7nHG2+yFp2cNBUmhxpq0TJVtw7/07sInsljM1NO+x0Rseo +WdPzT7E3gxLI7SjmLG9voBVh/Yi+Iy7hYL6gHNVMsbOI5bSypqjrSdPJ Q==; X-IronPort-AV: E=McAfee;i="6500,9779,10490"; a="304110470" X-IronPort-AV: E=Sophos;i="5.95,159,1661842800"; d="scan'208";a="304110470" Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by orsmga102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 05 Oct 2022 03:20:38 -0700 X-IronPort-AV: E=McAfee;i="6500,9779,10490"; a="728606018" X-IronPort-AV: E=Sophos;i="5.95,159,1661842800"; d="scan'208";a="728606018" Received: from ahunter6-mobl1.ger.corp.intel.com (HELO ahunter-VirtualBox.home\044ger.corp.intel.com) ([10.252.59.192]) by fmsmga002-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 05 Oct 2022 03:20:36 -0700 From: Adrian Hunter To: Ulf Hansson Cc: Stefan Wahren , Florian Fainelli , Wolfram Sang , Alex Dubov , Thierry Reding , linux-mmc@vger.kernel.org Subject: [PATCH 12/14] mmc: tmio_mmc_core: Replace kmap_atomic() with kmap_local_page() Date: Wed, 5 Oct 2022 13:19:49 +0300 Message-Id: <20221005101951.3165-13-adrian.hunter@intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20221005101951.3165-1-adrian.hunter@intel.com> References: <20221005101951.3165-1-adrian.hunter@intel.com> MIME-Version: 1.0 Organization: Intel Finland Oy, Registered Address: PL 281, 00181 Helsinki, Business Identity Code: 0357606 - 4, Domiciled in Helsinki Precedence: bulk List-ID: X-Mailing-List: linux-mmc@vger.kernel.org kmap_local_page() is equivalent to kmap_atomic() except that it does not disable page faults or preemption. Where possible kmap_local_page() is preferred to kmap_atomic() - refer kernel highmem documentation. In this case, there is no need to disable page faults or preemption, so replace kmap_atomic() with kmap_local_page(), and, correspondingly, kunmap_atomic() with kunmap_local(). Signed-off-by: Adrian Hunter Reviewed-by: Wolfram Sang --- drivers/mmc/host/tmio_mmc.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/mmc/host/tmio_mmc.h b/drivers/mmc/host/tmio_mmc.h index 22375790b57b..e36ff80108e6 100644 --- a/drivers/mmc/host/tmio_mmc.h +++ b/drivers/mmc/host/tmio_mmc.h @@ -206,13 +206,13 @@ irqreturn_t tmio_mmc_irq(int irq, void *devid); static inline char *tmio_mmc_kmap_atomic(struct scatterlist *sg) { - return kmap_atomic(sg_page(sg)) + sg->offset; + return kmap_local_page(sg_page(sg)) + sg->offset; } static inline void tmio_mmc_kunmap_atomic(struct scatterlist *sg, void *virt) { - kunmap_atomic(virt - sg->offset); + kunmap_local(virt - sg->offset); } #ifdef CONFIG_PM From patchwork Wed Oct 5 10:19:50 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adrian Hunter X-Patchwork-Id: 12999118 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8573AC433F5 for ; Wed, 5 Oct 2022 10:20:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229612AbiJEKUn (ORCPT ); Wed, 5 Oct 2022 06:20:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54948 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229685AbiJEKUm (ORCPT ); Wed, 5 Oct 2022 06:20:42 -0400 Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 66FBF75FCA for ; Wed, 5 Oct 2022 03:20:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1664965241; x=1696501241; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=cRbhPhG0W1B4mhSRGBLSoQqNQatbwceuvJPOUVg7haw=; b=OiZoa/QSIKLcVFJUkweKgmQgN5RBdjVJa6HHXwHqM90hlv1bVCOhkvr5 vrXJpr+V40TS4Raab/IozoA1yuwHuaV7S9qnXOF8yeSiggeG7Ac3kLXag fP/Za53sRPDq8UVfzBtgeqpQBNZ8AA/Aq8+PB/AzpbcfRNolyw4FcM/bk FPxhkuGCtoB94Pp6q1/2svNQcssYIy4E7jGN7X3wMm+Ou7jdB8X6xfDFT ClP+1SyTfWJCr5iozwmynWnl14/zQJP4c3Vg3e8razvehqx4zeS9OxWBJ DcQJFCLsZazoArWv+7xhd4vXCESbK4mF4xxM1TaamtJmcpiTfq/T4yXs4 w==; X-IronPort-AV: E=McAfee;i="6500,9779,10490"; a="304110474" X-IronPort-AV: E=Sophos;i="5.95,159,1661842800"; d="scan'208";a="304110474" Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by orsmga102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 05 Oct 2022 03:20:41 -0700 X-IronPort-AV: E=McAfee;i="6500,9779,10490"; a="728606021" X-IronPort-AV: E=Sophos;i="5.95,159,1661842800"; d="scan'208";a="728606021" Received: from ahunter6-mobl1.ger.corp.intel.com (HELO ahunter-VirtualBox.home\044ger.corp.intel.com) ([10.252.59.192]) by fmsmga002-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 05 Oct 2022 03:20:39 -0700 From: Adrian Hunter To: Ulf Hansson Cc: Stefan Wahren , Florian Fainelli , Wolfram Sang , Alex Dubov , Thierry Reding , linux-mmc@vger.kernel.org Subject: [PATCH 13/14] mmc: au1xmmc: Replace kmap_atomic() with kmap_local_page() Date: Wed, 5 Oct 2022 13:19:50 +0300 Message-Id: <20221005101951.3165-14-adrian.hunter@intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20221005101951.3165-1-adrian.hunter@intel.com> References: <20221005101951.3165-1-adrian.hunter@intel.com> MIME-Version: 1.0 Organization: Intel Finland Oy, Registered Address: PL 281, 00181 Helsinki, Business Identity Code: 0357606 - 4, Domiciled in Helsinki Precedence: bulk List-ID: X-Mailing-List: linux-mmc@vger.kernel.org kmap_local_page() is equivalent to kmap_atomic() except that it does not disable page faults or preemption. Where possible kmap_local_page() is preferred to kmap_atomic() - refer kernel highmem documentation. In this case, there is no need to disable page faults or preemption, so replace kmap_atomic() with kmap_local_page(), and, correspondingly, kunmap_atomic() with kunmap_local(). Signed-off-by: Adrian Hunter --- drivers/mmc/host/au1xmmc.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/mmc/host/au1xmmc.c b/drivers/mmc/host/au1xmmc.c index c88b039dc9fb..82dd0ae40305 100644 --- a/drivers/mmc/host/au1xmmc.c +++ b/drivers/mmc/host/au1xmmc.c @@ -388,7 +388,7 @@ static void au1xmmc_send_pio(struct au1xmmc_host *host) /* This is the pointer to the data buffer */ sg = &data->sg[host->pio.index]; - sg_ptr = kmap_atomic(sg_page(sg)) + sg->offset + host->pio.offset; + sg_ptr = kmap_local_page(sg_page(sg)) + sg->offset + host->pio.offset; /* This is the space left inside the buffer */ sg_len = data->sg[host->pio.index].length - host->pio.offset; @@ -409,7 +409,7 @@ static void au1xmmc_send_pio(struct au1xmmc_host *host) __raw_writel((unsigned long)val, HOST_TXPORT(host)); wmb(); /* drain writebuffer */ } - kunmap_atomic(sg_ptr); + kunmap_local(sg_ptr); host->pio.len -= count; host->pio.offset += count; @@ -446,7 +446,7 @@ static void au1xmmc_receive_pio(struct au1xmmc_host *host) if (host->pio.index < host->dma.len) { sg = &data->sg[host->pio.index]; - sg_ptr = kmap_atomic(sg_page(sg)) + sg->offset + host->pio.offset; + sg_ptr = kmap_local_page(sg_page(sg)) + sg->offset + host->pio.offset; /* This is the space left inside the buffer */ sg_len = sg_dma_len(&data->sg[host->pio.index]) - host->pio.offset; @@ -488,7 +488,7 @@ static void au1xmmc_receive_pio(struct au1xmmc_host *host) sg_ptr[count] = (unsigned char)(val & 0xFF); } if (sg_ptr) - kunmap_atomic(sg_ptr); + kunmap_local(sg_ptr); host->pio.len -= count; host->pio.offset += count; From patchwork Wed Oct 5 10:19:51 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adrian Hunter X-Patchwork-Id: 12999119 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 361D0C433FE for ; Wed, 5 Oct 2022 10:20:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229684AbiJEKUp (ORCPT ); Wed, 5 Oct 2022 06:20:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55032 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229672AbiJEKUo (ORCPT ); Wed, 5 Oct 2022 06:20:44 -0400 Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B472B75FC7 for ; Wed, 5 Oct 2022 03:20:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1664965243; x=1696501243; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=onzIt5MASyC6xh3XxFH9+6TRAHiS1pGAm15jvZpeKQk=; b=UN6s9sEADO42j888fLQ7wqteLSC+o/Ev08op8shEKL6f4baeMMfjyVOF UeYnRlZslmB1dBYH+CvsiuZc1GG9tB5XYJ2oOprANZ0h5N/csWVhFc0lF 0fENeiLikPFQPsJrLKMJIy0m6YoSkeuEUlUxJdRW09acbxHYQHD6VmhcV E7KfkUn1UluZLA9fJKWNYz2471Fnd+Mb6zOK0nfMwAxq9vdYCdxHc0ivO /mOjcB+bGoZNnqW3QAWFhSMFURSk9oFXvi/rMqk8VKz0IrMPBrj+G+P7u PudyND/IhT7RPgFFwF8GYL4596RjNM2xO0aC0coObz41xZhKciPgsf970 Q==; X-IronPort-AV: E=McAfee;i="6500,9779,10490"; a="304110479" X-IronPort-AV: E=Sophos;i="5.95,159,1661842800"; d="scan'208";a="304110479" Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by orsmga102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 05 Oct 2022 03:20:43 -0700 X-IronPort-AV: E=McAfee;i="6500,9779,10490"; a="728606027" X-IronPort-AV: E=Sophos;i="5.95,159,1661842800"; d="scan'208";a="728606027" Received: from ahunter6-mobl1.ger.corp.intel.com (HELO ahunter-VirtualBox.home\044ger.corp.intel.com) ([10.252.59.192]) by fmsmga002-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 05 Oct 2022 03:20:41 -0700 From: Adrian Hunter To: Ulf Hansson Cc: Stefan Wahren , Florian Fainelli , Wolfram Sang , Alex Dubov , Thierry Reding , linux-mmc@vger.kernel.org Subject: [PATCH 14/14] mmc: wbsd: Replace kmap_atomic() with kmap_local_page() Date: Wed, 5 Oct 2022 13:19:51 +0300 Message-Id: <20221005101951.3165-15-adrian.hunter@intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20221005101951.3165-1-adrian.hunter@intel.com> References: <20221005101951.3165-1-adrian.hunter@intel.com> MIME-Version: 1.0 Organization: Intel Finland Oy, Registered Address: PL 281, 00181 Helsinki, Business Identity Code: 0357606 - 4, Domiciled in Helsinki Precedence: bulk List-ID: X-Mailing-List: linux-mmc@vger.kernel.org kmap_local_page() is equivalent to kmap_atomic() except that it does not disable page faults or preemption. Where possible kmap_local_page() is preferred to kmap_atomic() - refer kernel highmem documentation. In this case, there is no need to disable page faults or preemption, so replace kmap_atomic() with kmap_local_page(), and, correspondingly, kunmap_atomic() with kunmap_local(). Signed-off-by: Adrian Hunter --- drivers/mmc/host/wbsd.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/mmc/host/wbsd.c b/drivers/mmc/host/wbsd.c index 67ecd342fe5f..2219144c166a 100644 --- a/drivers/mmc/host/wbsd.c +++ b/drivers/mmc/host/wbsd.c @@ -267,7 +267,7 @@ static inline int wbsd_next_sg(struct wbsd_host *host) static inline char *wbsd_map_sg(struct wbsd_host *host) { - return kmap_atomic(sg_page(host->cur_sg)) + host->cur_sg->offset; + return kmap_local_page(sg_page(host->cur_sg)) + host->cur_sg->offset; } static inline void wbsd_sg_to_dma(struct wbsd_host *host, struct mmc_data *data) @@ -439,7 +439,7 @@ static void wbsd_empty_fifo(struct wbsd_host *host) * End of scatter list entry? */ if (host->remain == 0) { - kunmap_atomic(buffer); + kunmap_local(buffer); /* * Get next entry. Check if last. */ @@ -451,7 +451,7 @@ static void wbsd_empty_fifo(struct wbsd_host *host) } } } - kunmap_atomic(buffer); + kunmap_local(buffer); /* * This is a very dirty hack to solve a @@ -505,7 +505,7 @@ static void wbsd_fill_fifo(struct wbsd_host *host) * End of scatter list entry? */ if (host->remain == 0) { - kunmap_atomic(buffer); + kunmap_local(buffer); /* * Get next entry. Check if last. */ @@ -517,7 +517,7 @@ static void wbsd_fill_fifo(struct wbsd_host *host) } } } - kunmap_atomic(buffer); + kunmap_local(buffer); /* * The controller stops sending interrupts for