From mboxrd@z Thu Jan 1 00:00:00 1970 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 gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (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 95747C7EE23 for ; Wed, 31 May 2023 13:42:52 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id D682910E4D0; Wed, 31 May 2023 13:42:51 +0000 (UTC) Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by gabe.freedesktop.org (Postfix) with ESMTPS id E48AE10E4D5 for ; Wed, 31 May 2023 13:42:49 +0000 (UTC) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 3E48C63B5D; Wed, 31 May 2023 13:42:49 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4E7EAC4339E; Wed, 31 May 2023 13:42:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1685540569; bh=awNbbUrZKfXcgaKH6JhIK8hfjJtLZGaowOiSziy/Zt0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=f4qjERDLuY8Y7zMSrdpuR643fLtyMLiI2TdS1tFe8SWSBGHzqk5l/5gc6JnqDnfK3 rr5ETFWMlurStWLXvtWFCu00pPG1wcL+EAF3xHZ4kEMszPuTcpHfux7oEfdP0fD6jH qm1V4ze7UaRv3FZNKcpLwwwcPkGyYvIGA8Nwa1YNVycZI2cI+wnsMOkw6mwfjdHN+d /wFVlQUV8+0ehMPyfY1JHY5DY+5vwO7D16/Vqkik+2NkAPe40U2Y34GiYy8vG86wSN 9FKA02PLNWcSHHplesHn2AIyayL+uYlxvweW6WRp/CwVSSNsKVRZIpfJPBsxNofo66 8NRsRnB4pLPhg== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Subject: [PATCH AUTOSEL 6.1 23/33] parisc: Flush gatt writes and adjust gatt mask in parisc_agp_mask_memory() Date: Wed, 31 May 2023 09:41:49 -0400 Message-Id: <20230531134159.3383703-23-sashal@kernel.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230531134159.3383703-1-sashal@kernel.org> References: <20230531134159.3383703-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Sasha Levin , linux-parisc@vger.kernel.org, Helge Deller , dri-devel@lists.freedesktop.org, James.Bottomley@HansenPartnership.com, airlied@redhat.com Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" From: Helge Deller [ Upstream commit d703797380c540bbeac03f104ebcfc364eaf47cc ] Flush caches after changing gatt entries and calculate entry according to SBA requirements. Signed-off-by: Helge Deller Signed-off-by: Sasha Levin --- drivers/char/agp/parisc-agp.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/drivers/char/agp/parisc-agp.c b/drivers/char/agp/parisc-agp.c index d68d05d5d3838..514f9f287a781 100644 --- a/drivers/char/agp/parisc-agp.c +++ b/drivers/char/agp/parisc-agp.c @@ -90,6 +90,9 @@ parisc_agp_tlbflush(struct agp_memory *mem) { struct _parisc_agp_info *info = &parisc_agp_info; + /* force fdc ops to be visible to IOMMU */ + asm_io_sync(); + writeq(info->gart_base | ilog2(info->gart_size), info->ioc_regs+IOC_PCOM); readq(info->ioc_regs+IOC_PCOM); /* flush */ } @@ -158,6 +161,7 @@ parisc_agp_insert_memory(struct agp_memory *mem, off_t pg_start, int type) info->gatt[j] = parisc_agp_mask_memory(agp_bridge, paddr, type); + asm_io_fdc(&info->gatt[j]); } } @@ -191,7 +195,16 @@ static unsigned long parisc_agp_mask_memory(struct agp_bridge_data *bridge, dma_addr_t addr, int type) { - return SBA_PDIR_VALID_BIT | addr; + unsigned ci; /* coherent index */ + dma_addr_t pa; + + pa = addr & IOVP_MASK; + asm("lci 0(%1), %0" : "=r" (ci) : "r" (phys_to_virt(pa))); + + pa |= (ci >> PAGE_SHIFT) & 0xff;/* move CI (8 bits) into lowest byte */ + pa |= SBA_PDIR_VALID_BIT; /* set "valid" bit */ + + return cpu_to_le64(pa); } static void -- 2.39.2