Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp4394796imm; Mon, 30 Jul 2018 13:57:34 -0700 (PDT) X-Google-Smtp-Source: AAOMgpcVKK4eBru8BxyHSucqqxO5grdR4c1OoWsb20YgjVdWbyvpMxaFtSJl6GP0lLhtpK0OAkLm X-Received: by 2002:a63:ab4c:: with SMTP id k12-v6mr17516214pgp.386.1532984254673; Mon, 30 Jul 2018 13:57:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1532984254; cv=none; d=google.com; s=arc-20160816; b=Zt0rpstsl0UpLRT5TXlwn9qESORtt3D4JIEh+1nFbPCWb1yY8DrCJLijMidZs4Bu5N qIPztKkP2MOmKQgG9sNDLDvnGhSGWgAU78UBMkdoUBd8QzlclWH0vtloR7XigIIv2tZT lOEH1oNbXUOM03Ve764d0WWPD2STsBk5HfA6VGgIjBnK7nGnvn32WOSp21nMtw07LFUe Aojuuyg11cFNiQkfl1sVXo0I0w8EzNSIHmBXE7753SytBoaOUT+vQaoRKw7aFxXTM12c RVnBWqLSA6IrzlIZ8BFpc/cu4EfSmuNOy0onhBxnodFOeyOCCYij0Uo+nFGOLO72yThp PGWw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:reply-to:message-id:date:subject:cc:to :from:dkim-signature:arc-authentication-results; bh=cy/3pXjkep3M/L/Tj0ud/Zs1kpYrhFra5uDqMg77AVM=; b=alJaX8QWuRdo4GQ6oUXam47SW/Kdjbuehkpu5fLqNOEicnxE5TGo+EHjfGHjDTEL4P 7xXLZUC8s3L/NwbpP0AijCC8RXaQGhG27GM1zRhmz8s9CHVwc270bDu4vyAeHpnkZXry RfkuhxyGpUXxH1hTwrhwUuWNSr0B82swrZWUpXvCouY7duJUIETzM6iEfin0AGrKfouH B3DSM4l5GoOh3fePwv2MqghT9fHPUAwseYsTxH3Q/15wL7ry66MrN9Eue8QUMvmES+Ir T+00L4rg0hRtWzzxe3LnCZq9iwq5hI1m4Brnm1nTrDKN+0qtWGvE4xXAVJtbZe9oNRSR VSZQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=WMjywlV8; 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=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id o14-v6si1236614pll.185.2018.07.30.13.56.56; Mon, 30 Jul 2018 13:57: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=@gmail.com header.s=20161025 header.b=WMjywlV8; 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=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731864AbeG3Wbq (ORCPT + 99 others); Mon, 30 Jul 2018 18:31:46 -0400 Received: from mail-pg1-f193.google.com ([209.85.215.193]:44571 "EHLO mail-pg1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726378AbeG3Wbq (ORCPT ); Mon, 30 Jul 2018 18:31:46 -0400 Received: by mail-pg1-f193.google.com with SMTP id r1-v6so7878103pgp.11 for ; Mon, 30 Jul 2018 13:54:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:reply-to; bh=cy/3pXjkep3M/L/Tj0ud/Zs1kpYrhFra5uDqMg77AVM=; b=WMjywlV8I3n1mSRzGrNt5TdoIMSP3T3GboGAnn6MmWkjbL13Ekq0ZWrToy3WxEX02s KBIM/D3efpbFFnljRYlVAxlEwqGvY10GB9PvYUPuF2HBUqFoz9IveNBjP+uC8pk8y5BA Xj46z7+HCB4aqaemMpavJkXVFUAjic4VHAPlbAIh/BoBIEL3mWWjLcm2agrtkonA30X/ I9mDKdvrVMzfUll2jAT1j1Oseq3Yun0ZePSPY67ShVAnmwSdkZcYebm14+59rKiwc3Ca UH7avdzqJuUP/v9NuZ6eZAJvTTCa1IHkAZxIKQjVEjj4Dn0OYMjDq+v3EyYbLCQIET/I +Oxg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=cy/3pXjkep3M/L/Tj0ud/Zs1kpYrhFra5uDqMg77AVM=; b=l+ps3ezRD11wG/izh1z7dt94zBe25WbkG/vaxfKgWIwwtpvPLs4V55XqU3KQxWcPnm rFxM9YI9jQypwruRpif/INIFjJcBSwGlEqT5zJKQY9MHdBq67tWFC1xw+ndJbNm3z2Jt 49jiN9ScigqLa+dlu0CswyH/FTNHXhKu3/PgM9PZBkrImvhkZqX4U+kWpf+s9VhTC6LO G0rq9t+h2jEuDnpc8x2jeEkRF3e8ui/gZD2d26rgMu+kfnDyq0QOby029VJmoNIXqwi5 60IKNRMPN8QdlJQIwgvlpsoBm4PnMfVSbvdO8ngoWLkPB/uPmRBNh1lvY3lLsFalwpEz 60zA== X-Gm-Message-State: AOUpUlE9T3847fVZe0CYAnXAI1r7iZzcqN1V51ReC9NcC1LXzJu9rtT6 1KAP9BHde3GyL2OdQfKE+x0= X-Received: by 2002:a63:35c3:: with SMTP id c186-v6mr17706161pga.217.1532984099213; Mon, 30 Jul 2018 13:54:59 -0700 (PDT) Received: from mhkkerneltest.corp.microsoft.com ([131.107.160.207]) by smtp.gmail.com with ESMTPSA id y33-v6sm15347430pga.41.2018.07.30.13.54.58 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 30 Jul 2018 13:54:58 -0700 (PDT) From: mhkelley58@gmail.com X-Google-Original-From: mikelley@microsoft.com To: gregkh@linuxfoundation.org, linux-kernel@vger.kernel.org, devel@linuxdriverproject.org, olaf@aepfle.de, apw@canonical.com, vkuznets@redhat.com, jasowang@redhat.com, marcelo.cerri@canonical.com, sthemmin@microsoft.com, kys@microsoft.com Cc: mikelley@microsoft.com Subject: [PATCH char-misc 1/1] Drivers: hv: vmbus: Remove use of slow_virt_to_phys() Date: Mon, 30 Jul 2018 13:17:11 -0700 Message-Id: <1532981831-28816-1-git-send-email-mikelley@microsoft.com> X-Mailer: git-send-email 1.8.3.1 Reply-To: mikelley@microsoft.com Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Michael Kelley slow_virt_to_phys() is only implemented for arch/x86. Remove its use in arch independent Hyper-V drivers, and replace with test for vmalloc() address followed by appropriate v-to-p function. This follows the typical pattern of other drivers and avoids the need to implement slow_virt_to_phys() for Hyper-V on ARM64. Signed-off-by: Michael Kelley --- drivers/hv/channel.c | 27 ++++++++++++++++++++------- 1 file changed, 20 insertions(+), 7 deletions(-) diff --git a/drivers/hv/channel.c b/drivers/hv/channel.c index ba0a092..d972a12 100644 --- a/drivers/hv/channel.c +++ b/drivers/hv/channel.c @@ -29,12 +29,26 @@ #include #include #include +#include #include "hyperv_vmbus.h" #define NUM_PAGES_SPANNED(addr, len) \ ((PAGE_ALIGN(addr + len) >> PAGE_SHIFT) - (addr >> PAGE_SHIFT)) +static unsigned long virt_to_hvpfn(void *addr) +{ + unsigned long paddr; + + if (is_vmalloc_addr(addr)) + paddr = page_to_phys(vmalloc_to_page(addr)) + + offset_in_page(addr); + else + paddr = __pa(addr); + + return paddr >> PAGE_SHIFT; +} + /* * vmbus_setevent- Trigger an event notification on the specified * channel. @@ -298,8 +312,8 @@ static int create_gpadl_header(void *kbuffer, u32 size, gpadl_header->range[0].byte_offset = 0; gpadl_header->range[0].byte_count = size; for (i = 0; i < pfncount; i++) - gpadl_header->range[0].pfn_array[i] = slow_virt_to_phys( - kbuffer + PAGE_SIZE * i) >> PAGE_SHIFT; + gpadl_header->range[0].pfn_array[i] = virt_to_hvpfn( + kbuffer + PAGE_SIZE * i); *msginfo = msgheader; pfnsum = pfncount; @@ -350,9 +364,8 @@ static int create_gpadl_header(void *kbuffer, u32 size, * so the hypervisor guarantees that this is ok. */ for (i = 0; i < pfncurr; i++) - gpadl_body->pfn[i] = slow_virt_to_phys( - kbuffer + PAGE_SIZE * (pfnsum + i)) >> - PAGE_SHIFT; + gpadl_body->pfn[i] = virt_to_hvpfn( + kbuffer + PAGE_SIZE * (pfnsum + i)); /* add to msg header */ list_add_tail(&msgbody->msglistentry, @@ -380,8 +393,8 @@ static int create_gpadl_header(void *kbuffer, u32 size, gpadl_header->range[0].byte_offset = 0; gpadl_header->range[0].byte_count = size; for (i = 0; i < pagecount; i++) - gpadl_header->range[0].pfn_array[i] = slow_virt_to_phys( - kbuffer + PAGE_SIZE * i) >> PAGE_SHIFT; + gpadl_header->range[0].pfn_array[i] = virt_to_hvpfn( + kbuffer + PAGE_SIZE * i); *msginfo = msgheader; } -- 1.8.3.1