From patchwork Fri Jun 7 19:38:42 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marcelo Henrique Cerri X-Patchwork-Id: 1112223 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.ubuntu.com (client-ip=91.189.94.19; helo=huckleberry.canonical.com; envelope-from=kernel-team-bounces@lists.ubuntu.com; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=canonical.com Received: from huckleberry.canonical.com (huckleberry.canonical.com [91.189.94.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 45LCXB3kYbz9sBp; Sat, 8 Jun 2019 05:39:22 +1000 (AEST) Received: from localhost ([127.0.0.1] helo=huckleberry.canonical.com) by huckleberry.canonical.com with esmtp (Exim 4.86_2) (envelope-from ) id 1hZKhp-0007Di-RB; Fri, 07 Jun 2019 19:39:17 +0000 Received: from youngberry.canonical.com ([91.189.89.112]) by huckleberry.canonical.com with esmtps (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:128) (Exim 4.86_2) (envelope-from ) id 1hZKhl-00079H-Sd for kernel-team@lists.ubuntu.com; Fri, 07 Jun 2019 19:39:13 +0000 Received: from mail-qt1-f197.google.com ([209.85.160.197]) by youngberry.canonical.com with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.76) (envelope-from ) id 1hZKhk-00071X-Bp for kernel-team@lists.ubuntu.com; Fri, 07 Jun 2019 19:39:12 +0000 Received: by mail-qt1-f197.google.com with SMTP id 97so2737150qtb.16 for ; Fri, 07 Jun 2019 12:39:12 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=kLLelfHGrBgvNiKw3MAy7PUDtPNwN09iWDm7TKN5ZPM=; b=ILXm8ea4lMznCIau9kjZBWbJIoR4fBj0nd89hWk8TTNymzE6fmal6WiXOiAIP0uJv1 hWsWbgP0e29i7U1yCheOtsupjnXQqH/rDiWUOhjXeQBPeK45+LxCEK4vQn+DT2oO5kmQ FQwp1o8jzjI3YZfUM6fXxZBZ99T0jpAsvUMgDJDJWmzX3j7kF7pEllvu0c4FzABLjbbw dz3wdjZk9iDcF+Mn0UbB0QX+dlcuYAcrpJRjH2uaucrsTEhDLzKGLQ1KSfYqWWeV3k/o GWtb8HRgdEDp8sIP3IErUjZBm3ilNoe14dIOPMfuOKRu67RDQj785Dxiu77/OnEYC+Ou s7Fg== X-Gm-Message-State: APjAAAVhj6wdYIFiwo7Ayelne766V1akZLVZVG77yr1A8ntaFVvnz3py zcROpAzxfF4qq9pE9MogLyiX1NDyzDiiScRlrVI4Msd6kc7FYU1l2VKwqzJRkEjno5X3rFCXIlD Ofo9p21oUh+JJxPK2mf9PcSktvK2u69H6NuXi2vWT X-Received: by 2002:ac8:34f4:: with SMTP id x49mr41281793qtb.95.1559936351117; Fri, 07 Jun 2019 12:39:11 -0700 (PDT) X-Google-Smtp-Source: APXvYqyTEEhFMtMqxm2nGdAkBBxWk3P3iSPhF0/IR2OPYK3++0d+4zb9yh3RPlSbFPjf0ybZJLaC5Q== X-Received: by 2002:ac8:34f4:: with SMTP id x49mr41281772qtb.95.1559936350797; Fri, 07 Jun 2019 12:39:10 -0700 (PDT) Received: from gallifrey.lan ([2804:14c:4e3:4a76:b1ae:211f:e30b:4e05]) by smtp.gmail.com with ESMTPSA id r2sm1318875qtp.8.2019.06.07.12.39.09 for (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Fri, 07 Jun 2019 12:39:10 -0700 (PDT) From: Marcelo Henrique Cerri To: kernel-team@lists.ubuntu.com Subject: [x/azure][PATCH 08/17] uio: introduce UIO_MEM_IOVA Date: Fri, 7 Jun 2019 16:38:42 -0300 Message-Id: <20190607193851.21914-9-marcelo.cerri@canonical.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190607193851.21914-1-marcelo.cerri@canonical.com> References: <20190607193851.21914-1-marcelo.cerri@canonical.com> MIME-Version: 1.0 X-BeenThere: kernel-team@lists.ubuntu.com X-Mailman-Version: 2.1.20 Precedence: list List-Id: Kernel team discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: kernel-team-bounces@lists.ubuntu.com Sender: "kernel-team" From: Stephen Hemminger BugLink: http://bugs.launchpad.net/bugs/1812123 Introduce the concept of mapping physical memory locations that are normal memory. The new type UIO_MEM_IOVA are similar to existing UIO_MEM_PHYS but the backing memory is not marked as uncached. Also, indent related switch to the currently used style. Signed-off-by: Stephen Hemminger Signed-off-by: Greg Kroah-Hartman (backported from commit bfddabfa230452cea32aae82f9cd85ab22601acf) [marcelo.cerri@canonical.com: fixed context in uio_mmap()] Signed-off-by: Marcelo Henrique Cerri --- drivers/uio/uio.c | 18 ++++++++++-------- include/linux/uio_driver.h | 1 + 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/drivers/uio/uio.c b/drivers/uio/uio.c index ff04b7f8549f..ff695bdee0a7 100644 --- a/drivers/uio/uio.c +++ b/drivers/uio/uio.c @@ -656,7 +656,8 @@ static int uio_mmap_physical(struct vm_area_struct *vma) return -EINVAL; vma->vm_ops = &uio_physical_vm_ops; - vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot); + if (idev->info->mem[mi].memtype == UIO_MEM_PHYS) + vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot); /* * We cannot use the vm_iomap_memory() helper here, @@ -703,13 +704,14 @@ static int uio_mmap(struct file *filep, struct vm_area_struct *vma) } switch (idev->info->mem[mi].memtype) { - case UIO_MEM_PHYS: - return uio_mmap_physical(vma); - case UIO_MEM_LOGICAL: - case UIO_MEM_VIRTUAL: - return uio_mmap_logical(vma); - default: - return -EINVAL; + case UIO_MEM_IOVA: + case UIO_MEM_PHYS: + return uio_mmap_physical(vma); + case UIO_MEM_LOGICAL: + case UIO_MEM_VIRTUAL: + return uio_mmap_logical(vma); + default: + return -EINVAL; } } diff --git a/include/linux/uio_driver.h b/include/linux/uio_driver.h index 3c85c81b0027..afa0bed36650 100644 --- a/include/linux/uio_driver.h +++ b/include/linux/uio_driver.h @@ -131,6 +131,7 @@ extern void uio_event_notify(struct uio_info *info); #define UIO_MEM_PHYS 1 #define UIO_MEM_LOGICAL 2 #define UIO_MEM_VIRTUAL 3 +#define UIO_MEM_IOVA 4 /* defines for uio_port->porttype */ #define UIO_PORT_NONE 0