Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp5814330pxb; Tue, 16 Feb 2021 08:13:44 -0800 (PST) X-Google-Smtp-Source: ABdhPJxtDc2W5vEf3wH+tvnO9Tv71EzS+QI5oJGfp4zWaQw3ZK6myUOW4+gDwO7KNUC4bZvoo5nc X-Received: by 2002:a17:906:240c:: with SMTP id z12mr1473649eja.314.1613492024198; Tue, 16 Feb 2021 08:13:44 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1613492024; cv=none; d=google.com; s=arc-20160816; b=iaDjhbfDWQm6hEZXpWn4cMEwinVgvmVx21MqzcHGPiPMeO7g0ynXdabsVjQWrT0MO5 8Hj5wiXJNDvMekVOHwaIPvNcNvLlm5DZuBxx8P4xKw8vb8R6iVMuwYlHMe07V2vavCEV TNanGpdI6UtC7K4qS3Vc08OEHZY72kreGAzSgd4D55dDir1MQRtGhsOEMB5Dw8PkUIwr QbDNbM01wwCGNojLi6QWRL8VfIsA7ZCbFgCn39CDfw4fd+069+jUcRyfRcVP9HatSm1x nDdkxuDJ7YsbPO2ZeUXrVUc+khfWp/8Xo3EauNVY658JzFIGK5aqoP/rqLEwrtsAix+o BzMg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :ironport-sdr:ironport-sdr; bh=MowSuCkBkhSY2TXH1HCnGOzwQxNljbxqbYeW+enIt6I=; b=MWShDbYsRk8gWCfoLR5maw36g62+1K3Yk1aq62BJp2+GBGnElApl5C7XQsglRwTjDU tWi1a+qlwMfZEtAm3Ks4Tm/MYJvHrO9y2ChyE4lCwLa5Vhmzw1Hb7yiBfKcbayiqAv1j MgY8kMLAogzTlKikk+CHNxl5qH2YZISrMkCIX0YSch3F9ciBMH2yRWnui+2jERBez1K3 h4FXDgn2usF7TgRo6FIFRUDCK7JOjOT++6Y8AV2QO+scKOck7ANoqOSNhCwpRmhCc3to 6IuE/CjNfd8e/LgSZpWpwfFH/eeXflDSdUCfvQ3MZ/DrXSS2Hlo1818SrVNj0aboUuEh ADZg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id x11si17168817edi.73.2021.02.16.08.13.09; Tue, 16 Feb 2021 08:13:44 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230474AbhBPQLs (ORCPT + 99 others); Tue, 16 Feb 2021 11:11:48 -0500 Received: from mga01.intel.com ([192.55.52.88]:31327 "EHLO mga01.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230464AbhBPQL1 (ORCPT ); Tue, 16 Feb 2021 11:11:27 -0500 IronPort-SDR: WUpvkNpQt70tY7W8iFjBHFo6cBojplwATU+g8OKTJBARLtv0zJ8J1REU4UYUipZJrYC5TcTl5r 4Sh4/gfRKuPw== X-IronPort-AV: E=McAfee;i="6000,8403,9897"; a="202118571" X-IronPort-AV: E=Sophos;i="5.81,184,1610438400"; d="scan'208";a="202118571" Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 16 Feb 2021 08:08:06 -0800 IronPort-SDR: MTa9uZTDMh1di0DSXzTM9oLHAJ1UNRaJaSKQ2cbSH8uWP+6Z/r+9kcxFYxVBt3wLb+ns/FJtu+ jKDno47CC1+A== X-IronPort-AV: E=Sophos;i="5.81,184,1610438400"; d="scan'208";a="493336670" Received: from gna-dev.igk.intel.com ([10.102.80.34]) by fmsmga001-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 16 Feb 2021 08:08:04 -0800 From: Maciej Kwapulinski To: Greg Kroah-Hartman , Arnd Bergmann , Jonathan Corbet , Derek Kiernan , Dragan Cvetic Cc: linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org, Maciej Kwapulinski , Tomasz Jankowski , Savo Novakovic Subject: [PATCH v1 05/12] gna: initialize mmu Date: Tue, 16 Feb 2021 17:05:18 +0100 Message-Id: <20210216160525.5028-6-maciej.kwapulinski@linux.intel.com> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20210216160525.5028-1-maciej.kwapulinski@linux.intel.com> References: <20210216160525.5028-1-maciej.kwapulinski@linux.intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Tomasz Jankowski Setup mmu in the driver with a new memory component. Signed-off-by: Tomasz Jankowski Tested-by: Savo Novakovic Signed-off-by: Maciej Kwapulinski --- drivers/misc/gna/gna_device.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/drivers/misc/gna/gna_device.c b/drivers/misc/gna/gna_device.c index f962c7e1e5e9..d6a6d3cab570 100644 --- a/drivers/misc/gna/gna_device.c +++ b/drivers/misc/gna/gna_device.c @@ -23,6 +23,16 @@ static int gna_dev_init(struct gna_private *gna_priv, struct pci_dev *pcidev, bld_reg = gna_reg_read(gna_priv->bar0.mem_addr, GNA_MMIO_IBUFFS); gna_priv->hw_info.in_buf_s = bld_reg & GENMASK(7, 0); + if (gna_mmu_alloc(gna_priv)) { + dev_err(&gna_priv->dev, "gna mmu allocation failed\n"); + return -EFAULT; + } + dev_dbg(&pcidev->dev, "maximum memory size %llu num pd %d\n", + gna_priv->info.max_hw_mem, gna_priv->info.num_pagetables); + dev_dbg(&pcidev->dev, "desc rsvd size %d mmu vamax size %d\n", + gna_priv->info.desc_info.rsvd_size, + gna_priv->info.desc_info.mmu_info.vamax_size); + mutex_init(&gna_priv->mmu_lock); idr_init(&gna_priv->memory_idr); @@ -35,6 +45,7 @@ static int gna_dev_init(struct gna_private *gna_priv, struct pci_dev *pcidev, static void gna_dev_deinit(struct gna_private *gna_priv) { idr_destroy(&gna_priv->memory_idr); + gna_mmu_free(gna_priv); pci_set_drvdata(gna_priv->pdev, NULL); } -- 2.28.0