Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp2502545imm; Mon, 24 Sep 2018 05:33:52 -0700 (PDT) X-Google-Smtp-Source: ACcGV61A0JDWFsbDlUsLgkhgugM4dIHpuWPOtFl2v4GidvCY77uhzPPK+TGutNxmtVm148t3QN15 X-Received: by 2002:a65:58c3:: with SMTP id e3-v6mr9377779pgu.117.1537792432360; Mon, 24 Sep 2018 05:33:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1537792432; cv=none; d=google.com; s=arc-20160816; b=cGFGNgW/Z5jvyXA5sBN1dnQoSY6ix3vDlEkjjmdQhJOahm78g4MIVLSEMcVYzhko7Z 9DRM5RlD2b0ernAqHu6kcHx0QCUXFo5HDOe82Yq96arKUnvETy/x173zB1+IYVI9UHG/ vq+XW+ETrTX9DQVjjNjpzO+TgGa0RWyoRgbH4SwW/ldtdrBrodzAisRiTnPM41j+5h5O BcAxK4RQLaxgnb/RCdMdcZkhhr6OxcFfvYnfgdX9rv7O76NrloZl/XwGOp1i66uYJhej GXyrxnxeSxk9Sef0sQXdvXlDTZX8lIZ8u0y7KEBQA+0bWfp6OwZh1nW71Lb+Zgr2OO+J rXJA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from; bh=C0BJyJbHHwxl0YGKJRL9Q5ncYkCAuBrdnH0+GVM5vyM=; b=i+hAkLJbDAGXaCkl2E3Sbb5K2yF7rdUwa37cjNtYH0sDPUzfzTvpqHpko6Lh97NoiU IVVpIkIzVuaDsuLzQ/lfrSR234S6E4ph1OIAGuPXQ0NOWaXZfoE4xZ0RFO6whlRH7j3V cbdIyUaIHC+mgT4tFxEqsn9tKyqniWIWaIsT08UpFOcq57GuN6wue2EZQO+PPVTEX/0R A1NsgZejv961atT/DeDrrQkwqdEzT739+TrQ752nX4WDuZh/U1kqBpjOtMcx8SBf8cE8 wbNvXqdyAcQwItwD/0tVCbOBwLnqsjZ6ut8OqDfAoKyHYT9ZctjEbetRB7NLY12rKv74 nueA== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id m21-v6si34524317pgh.664.2018.09.24.05.33.37; Mon, 24 Sep 2018 05:33:52 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388154AbeIXSeQ (ORCPT + 99 others); Mon, 24 Sep 2018 14:34:16 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:58126 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730184AbeIXSeP (ORCPT ); Mon, 24 Sep 2018 14:34:15 -0400 Received: from localhost (ip-213-127-77-73.ip.prioritytelecom.net [213.127.77.73]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id 503951018; Mon, 24 Sep 2018 12:32:20 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Yoshihiro Shimoda , Joerg Roedel , Sasha Levin Subject: [PATCH 4.18 091/235] iommu/ipmmu-vmsa: IMUCTRn.TTSEL needs a special usage on R-Car Gen3 Date: Mon, 24 Sep 2018 13:51:17 +0200 Message-Id: <20180924113114.268291507@linuxfoundation.org> X-Mailer: git-send-email 2.19.0 In-Reply-To: <20180924113103.999624566@linuxfoundation.org> References: <20180924113103.999624566@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.18-stable review patch. If anyone has any objections, please let me know. ------------------ From: Yoshihiro Shimoda [ Upstream commit 2ae86955703e9e6a119af4bbe27f6b6dd7a43131 ] The TTSEL bit of IMUCTRn register of R-Car Gen3 needs to be set unused MMU context number even if uTLBs are disabled (The MMUEN bit of IMUCTRn register = 0). Since initial values of IMUCTRn.TTSEL on all IPMMU-domains are 0, this patch adds a new feature "reserved_context" to reserve IPMMU context number 0 as the unused MMU context. Signed-off-by: Yoshihiro Shimoda Signed-off-by: Joerg Roedel Signed-off-by: Sasha Levin Signed-off-by: Greg Kroah-Hartman --- drivers/iommu/ipmmu-vmsa.c | 8 ++++++++ 1 file changed, 8 insertions(+) --- a/drivers/iommu/ipmmu-vmsa.c +++ b/drivers/iommu/ipmmu-vmsa.c @@ -47,6 +47,7 @@ struct ipmmu_features { unsigned int number_of_contexts; bool setup_imbuscr; bool twobit_imttbcr_sl0; + bool reserved_context; }; struct ipmmu_vmsa_device { @@ -916,6 +917,7 @@ static const struct ipmmu_features ipmmu .number_of_contexts = 1, /* software only tested with one context */ .setup_imbuscr = true, .twobit_imttbcr_sl0 = false, + .reserved_context = false, }; static const struct ipmmu_features ipmmu_features_r8a7795 = { @@ -924,6 +926,7 @@ static const struct ipmmu_features ipmmu .number_of_contexts = 8, .setup_imbuscr = false, .twobit_imttbcr_sl0 = true, + .reserved_context = true, }; static const struct of_device_id ipmmu_of_ids[] = { @@ -1017,6 +1020,11 @@ static int ipmmu_probe(struct platform_d } ipmmu_device_reset(mmu); + + if (mmu->features->reserved_context) { + dev_info(&pdev->dev, "IPMMU context 0 is reserved\n"); + set_bit(0, mmu->ctx); + } } /*