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 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 5FD80C47DDB for ; Tue, 23 Jan 2024 19:46:00 +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:In-Reply-To:MIME-Version:References: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=lOE3jAuo27GmsfIbWwCuMH/mdrwvNhH3PfLZTGMJFQY=; b=GH0Nc/Ujq6g59C j0LR0R0V2l6MWTRR2TQgFEIzLmkjGr9gTKmoLtJZcp40v0KKJC4TIaZsRJPZv8FQYctQxXp3KaL0B 6sHI6CU0lbiDSrKyAPvkrnisHhj3O1sPibQ96EzgotSWRFmWpK6hs4Hku10Jj7hL2sXI1JB/0HN7J wOvouFdl37qB4nzVxSN0Pt7UIeTtfAF3ass1BEcQyUlsNWIHOYX9U8yNI0KKuEKvWnngbYEEyqAZm k6lbCGqjy95InmPmY/iYET71WdKSCmnWMTXpPVBsHZ5OBGjfSzEydyt0HGaNrIjF/F+0uIZFcF/Cu tPia9IGJpST1rUYRUcTQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1rSMiB-000J5G-04; Tue, 23 Jan 2024 19:45:31 +0000 Received: from mail-wr1-x434.google.com ([2a00:1450:4864:20::434]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1rSMi7-000J4P-1m for linux-arm-kernel@lists.infradead.org; Tue, 23 Jan 2024 19:45:29 +0000 Received: by mail-wr1-x434.google.com with SMTP id ffacd0b85a97d-33922b66bd7so3234631f8f.2 for ; Tue, 23 Jan 2024 11:45:23 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1706039122; x=1706643922; darn=lists.infradead.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=i7dwQrVQjuGrZ7V6sgd9fGyyi43Z5qftzJ/GAk7ai4s=; b=UT7Qtr+kyXBFWah6TFuqeHDuHCbzaJHvWCswjUZVhMjFLZWOBhqeLk/moTHx4tUgdU v+FFSW07F5Gp6vC4DLtRmjjKHaJDVhAB+sd8Bb+AykvQJqUSsM82DZgMLxFBpKdT6m3m atb2XldCa5OuxATCZy8XGBi2X0FX+xDyBmc5tzLi6hcWLugIqzJ2+Nr/ZFOOs9ZRJqq4 Zkt/FnO0hkDiK+p3vve2KNnHhi9jOOPUC0x8V/mCaZnQpmzWSJovuBiPeaGkh+o4lSqG JyrrqLS+RhQO6uVjsUcxPQCYvpKFL4nhZNRIJtUVRey8IlWaT7xd6v7QNCCFFq3sGS0F 58KA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706039122; x=1706643922; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=i7dwQrVQjuGrZ7V6sgd9fGyyi43Z5qftzJ/GAk7ai4s=; b=tVyWaf+cM4oQhwYjlrVwervxHFDkewo/WwKlM3xJU4ZiFBGYLDodmwmK8JmY0WJ0Gu QeZenlvwVzaPaCdaqn9zfjG9JA5Qh07DKnrUFRIi5Vc/F2sG1bCllj9Dy9LggM0vb8sM WSEKHtUy3bTagmBdkja0vEtivz3aOeMJAXpIidCd0BHtlKLehgZMTteQA0q51vIFKm8U OHFqxNX5eMSLjHMnXduNL/XOdwGImQwYyA4bkyzlIh52uNvbMICZS537fPjxFeS1nW4x sr7/83/xeR7QVCrASg5Csm73B1bQiJGormwBqR1psOu+S5WmXm8Pl54YESSe2hDpsKa4 ggPQ== X-Gm-Message-State: AOJu0YwUEmjOUoFkSsE8q4PZBRuih1rz6raCLVWbfpg2s+I8t6uZRka4 HipwHc7XLdgZvH2l+ITEfIOMjO8uM9TCKfoIwAWvpUuFAZysYW2pQDZUSslr8pY= X-Google-Smtp-Source: AGHT+IHSC3czTD9DuPppBHvZE6fNTJXWMdah36NgM0rGQW3ZtaCxIuIBOl7kJLUASIBgn4YRMx4xaw== X-Received: by 2002:adf:f2c5:0:b0:337:c4ea:3023 with SMTP id d5-20020adff2c5000000b00337c4ea3023mr3144642wrp.38.1706039121651; Tue, 23 Jan 2024 11:45:21 -0800 (PST) Received: from myrica ([2.221.137.100]) by smtp.gmail.com with ESMTPSA id b1-20020a5d4b81000000b0033920dfd287sm11958305wrt.19.2024.01.23.11.45.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 23 Jan 2024 11:45:21 -0800 (PST) Date: Tue, 23 Jan 2024 19:45:30 +0000 From: Jean-Philippe Brucker To: Mostafa Saleh Cc: maz@kernel.org, catalin.marinas@arm.com, will@kernel.org, joro@8bytes.org, robin.murphy@arm.com, james.morse@arm.com, suzuki.poulose@arm.com, oliver.upton@linux.dev, yuzenghui@huawei.com, dbrazdil@google.com, ryan.roberts@arm.com, linux-arm-kernel@lists.infradead.org, kvmarm@lists.linux.dev, iommu@lists.linux.dev Subject: Re: [RFC PATCH 24/45] KVM: arm64: smmu-v3: Setup stream table Message-ID: <20240123194530.GA40099@myrica> References: <20230201125328.2186498-1-jean-philippe@linaro.org> <20230201125328.2186498-25-jean-philippe@linaro.org> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240123_114527_604189_68CD3C79 X-CRM114-Status: GOOD ( 16.75 ) 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: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Hi Mostafa, On Tue, Jan 16, 2024 at 08:59:41AM +0000, Mostafa Saleh wrote: > > +__maybe_unused > > +static int smmu_sync_ste(struct hyp_arm_smmu_v3_device *smmu, u32 sid) > > +{ > > + struct arm_smmu_cmdq_ent cmd = { > > + .opcode = CMDQ_OP_CFGI_STE, > > + .cfgi.sid = sid, > > + .cfgi.leaf = true, > > + }; > > + > > + return smmu_send_cmd(smmu, &cmd); > > +} > > + > I see the page tables are properly configured for ARM_SMMU_FEAT_COHERENCY but no > handling for the STE or CMDQ, I believe here we should have something as: > if (!(smmu->features & ARM_SMMU_FEAT_COHERENCY)) > kvm_flush_dcache_to_poc(step, STRTAB_STE_DWORDS << 3); > > Similarly in "smmu_add_cmd" for the command queue. Or use NC mapping > (which doesn't exist > upstream as far as I can see) Right, the host driver seems to do this. If I'm following correctly we end up with dma_direct_alloc() calling pgprot_dmacoherent() and get MT_NORMAL_NC, when the SMMU is declared non-coherent in DT/IORT. So we'd get mismatched attributes if hyp is then mapping these structures cacheable, but I don't remember how that works exactly. Might be fine since host donates the pages to hyp and we'd have a cache flush in between. I'll have to read up on that. Regardless, mapping NC seems cleaner, more readable. I'll see if I can add that attribute to kvm_pgtable_hyp_map(). Thanks, Jean _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel