From patchwork Sat Jul 2 21:37:21 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sam Protsenko X-Patchwork-Id: 12904097 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id DDBF2CCA47B for ; Sat, 2 Jul 2022 21:38:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=czSXNGWzFBZdvet2bUfW0qAU25mstubSDeWBbGgXrC4=; b=NBdmm7DKfZU9IO e9jy8ztLihGY87eX2DjjOaP1/4pk1R1G7Qvc1376cq1LFNeQkRUD5VWzLp7/O7iRzWxSRthgLwerS iz3C7sen6RfnoUZqEpVo481JquTUa7X4Kf7IZh9/Mii+GUFhkWoUiYlZhxuOe2Sa4SkBifnajiHJk f74W3hz3YVfpv/IQhnIRWBxNVOZiR/w7NkvhKsHukZvmpFR8Iff7TU+TAfI9o1LXRYGrwgghZ1ukE +TEjz5TAqpAEVdGYf0o7fAH4f1CAH+AJel/GvmZ/E2aTxQSGOZ350XQ0ijJR+7OITsw26eCAZgZt8 oTObDzWcTX0/+fYIooQg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1o7knz-00Bfai-Ne; Sat, 02 Jul 2022 21:37:31 +0000 Received: from mail-ej1-x62d.google.com ([2a00:1450:4864:20::62d]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1o7knw-00BfY9-Ja for linux-arm-kernel@lists.infradead.org; Sat, 02 Jul 2022 21:37:29 +0000 Received: by mail-ej1-x62d.google.com with SMTP id pk21so10095259ejb.2 for ; Sat, 02 Jul 2022 14:37:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=aWfZE2YpB25R+rCMwVNZi2s9IwZn0JfO+IgsGnjhYqY=; b=wVSILGBGUjVOC+cfuxxbSMyxpvn6GttZQpREPJStje8Jo1kxV0hOiJBQjYgcMjnGO8 HzrlHKacg6/F0WF0UTTYxmtVqmcttqofFOrJX6K+BP9MvvRdIR7qYrVcD7+DFCx3EKT0 v7Hte9vIx/BKEL3aPNq1az2t5Nf5ERiriNAhe4KwSJOAyDfa58FaLw+AHHh0SnQeL6jn UMtj1LphcAYF+SCg6rTx11cw/9TDH61FUx3QLb2jvIAt9clvxCy6iYOFU5DZ9Kgf8G9u J/kArGjS3bdmqxj4yPJLCgNcdbkBX/TWXfqGZSQ3YUT28PeuTlKYSuvKmAr01wazLM4f ZKnw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=aWfZE2YpB25R+rCMwVNZi2s9IwZn0JfO+IgsGnjhYqY=; b=JPWfzoMhOsqhw7daoipYKq0fInTkTmwm5wjZau8UDS3AlzI/DVPxq7afAiKkPr9Z3P 4i9qkvBgF09XynLfqgveO0oxOm7I+/MUjQRF5nqkhCtfZO4gVburSFljV9N/NYFadU2g Ealtc80Tw1hx+7FiRa6Yg5mBkgS06WGvVjBiRvkOfGkyAGZ+WkAFowE3RqCZCGmKH97T FL7ACIDhN1hZiyePHKs6fk2Jn+O5VGP8Pua76hqIa63MdLsHgimR372ljmCFp6GuZ3nN mdkSE0eNqDB7q1aNVmtWsq7VMQg+EPjqtsAcvrHI8OMwpzvtZUX7W9n1hYRQyc3DgxOx ZQ1A== X-Gm-Message-State: AJIora8jTyfKfOZL+/sHlVy5SJgOBUekQSeLqxM7mXRMYt3HW0wlz1Xe MZPXWD3C2TXfl7uvZtqCP+sOMP1xOqSLSZOz X-Google-Smtp-Source: AGRyM1sjE5ZjIaY+GfCnbQmj6BkapC2AnzQE+mzuISXF0GaEPi7w7Vucxh56Irz739GXVnorjZvvIA== X-Received: by 2002:a17:906:1018:b0:718:dd3f:f28c with SMTP id 24-20020a170906101800b00718dd3ff28cmr21490786ejm.55.1656797846558; Sat, 02 Jul 2022 14:37:26 -0700 (PDT) Received: from localhost ([31.134.121.151]) by smtp.gmail.com with ESMTPSA id a18-20020a170906671200b00718e4e64b7bsm12214247ejp.79.2022.07.02.14.37.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 02 Jul 2022 14:37:26 -0700 (PDT) From: Sam Protsenko To: Marek Szyprowski , Krzysztof Kozlowski Cc: Joerg Roedel , Will Deacon , Robin Murphy , Janghyuck Kim , Cho KyongHo , Daniel Mentz , Sumit Semwal , iommu@lists.linux-foundation.org, iommu@lists.linux.dev, linux-arm-kernel@lists.infradead.org, linux-samsung-soc@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 1/4] iommu/exynos: Set correct dma mask for SysMMU v5+ Date: Sun, 3 Jul 2022 00:37:21 +0300 Message-Id: <20220702213724.3949-2-semen.protsenko@linaro.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220702213724.3949-1-semen.protsenko@linaro.org> References: <20220702213724.3949-1-semen.protsenko@linaro.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220702_143728_720268_E5FD3859 X-CRM114-Status: GOOD ( 13.29 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org SysMMU v5+ supports 36 bit physical address space. Set corresponding DMA mask to avoid falling back to SWTLBIO usage in dma_map_single() because of failed dma_capable() check. The original code for this fix was suggested by Marek. Originally-by: Marek Szyprowski Signed-off-by: Sam Protsenko --- drivers/iommu/exynos-iommu.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/drivers/iommu/exynos-iommu.c b/drivers/iommu/exynos-iommu.c index 71f2018e23fe..28f8c8d93aa3 100644 --- a/drivers/iommu/exynos-iommu.c +++ b/drivers/iommu/exynos-iommu.c @@ -647,6 +647,14 @@ static int exynos_sysmmu_probe(struct platform_device *pdev) } } + if (MMU_MAJ_VER(data->version) >= 5) { + ret = dma_set_mask(dev, DMA_BIT_MASK(36)); + if (ret) { + dev_err(dev, "Unable to set DMA mask: %d\n", ret); + return ret; + } + } + /* * use the first registered sysmmu device for performing * dma mapping operations on iommu page tables (cpu cache flush)