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 A4242C47258 for ; Tue, 23 Jan 2024 19:51:17 +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=r+yryj/f4upStkdgNIrTLlLItuasX8bR/+VBTbH+SGg=; b=XI8SpPQFwsH3VT fVkJYq86bBvqdVTvxRgz9dyKFi1d5O3/U1y57Qjq3D/suEkWyZTJc0U/ENXA1MJ7h/Ayrg72dLfoE c22h+HfvKgq1KLhP/zeINUPHrGabtyMvqM7ADlMW7equ6RFNi0t3ptEfEsBcmLW+7Wfj59zA3a+DR jPI66+5Lp5wjZ/8cMMtWTUriYISWEoXtwQ6lRXXrmxDRauxeOuexwao/7nhUb2HY9QALbgAT9VV4L gjyhlsnakycfMYOemaJq8YG+zAY0ds9c4ECrOEyXmHJJFtmFgvrNJuuK+VqxcVQ6UQGysWN+tnwzd x/EzBZcEhpjCbdN3HrGQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1rSMnJ-000Jh7-2m; Tue, 23 Jan 2024 19:50:49 +0000 Received: from mail-wr1-x42d.google.com ([2a00:1450:4864:20::42d]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1rSMnF-000Jg3-36 for linux-arm-kernel@lists.infradead.org; Tue, 23 Jan 2024 19:50:47 +0000 Received: by mail-wr1-x42d.google.com with SMTP id ffacd0b85a97d-339231c062bso3294699f8f.0 for ; Tue, 23 Jan 2024 11:50:45 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1706039444; x=1706644244; 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=symCKlu70t5c2pz5MpkVzEsXKmD/I2ycs0+d/rCZY9k=; b=bdYC/xXZYHKRHN4LX5f55zTptQxVNJt1Xc8c/mhSCZrdh14zqmHWgO75jbMGa/z5bW Dc3eNUDjNhiMdcf9Q80ZapayatiVNSgVUHoCBJzjMiaHS1nKXjHUEl4qmGYG4mTvpWfM 6Vksn2pRMh+nvbmnmRxg6SbavpPSBJ3yhQZDVh3oNjRHj1JVovERBRFeUQYQ+Ptt6W0k nehZHFhF8Yp+VTGjTwj+jStEZuPvM5Gx9FE2mFatMQhTD94LE3dw5mVvd2WStvhmxbfZ yBr1Zg6fslTu/pP7ayRX3aBLyoGcxsZTs2VXsMs4FeCGc8JRx6LWsg7AF22tBPn1x6hV VMEg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706039444; x=1706644244; 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=symCKlu70t5c2pz5MpkVzEsXKmD/I2ycs0+d/rCZY9k=; b=lk3182mS2IadNA3UFmGnEEJXrt3S18Fkyhv5bUv1TdRzQl94prQw/aqYuKmeOjOMnG erIXyZ2OcOOaIFqag3czQ7kMiJZqpk3t/+OTix8SFTgY73YptMXg9hkMz1nKT+kAjTIh BTC2bJnOUyTYhmRsXpnXT7aI0xXug5zyLnVK03SerTYAYKhSKFxEaH1aqjDNHDR5I4KI Ao2IkahvTtCHV8dXnrAO7toGM8k8pFMV87F5puYaqQQaE6kzxfmJKdrghPpZN/PUwJpd 20KdLDk6oXb1ml7RzcsKT5yFscmjOwv26KrpLYVVCB7jPKxYB9SC5TxgKwyXprW1yMPS lxeg== X-Gm-Message-State: AOJu0YyXN2Rh3ZgQgd3oeuuvMxjgcAjxqI98K0hcDEsnwg+5qQrNcTl+ zxXa9l8k4RWwGh1Y1UvEjSNciX9NfG25w0SJNeZkgb59SeNRLxTrXK/v7zX1G5I= X-Google-Smtp-Source: AGHT+IGvK2nRgJqfqxTiFf7eYxXF/FLO4QS4slRNBAch0gl6IUsYo+a3YBQ4+CQ61hhuq9QUr9aw8Q== X-Received: by 2002:a5d:628c:0:b0:339:3f40:ffcd with SMTP id k12-20020a5d628c000000b003393f40ffcdmr1573778wru.129.1706039444344; Tue, 23 Jan 2024 11:50:44 -0800 (PST) Received: from myrica ([2.221.137.100]) by smtp.gmail.com with ESMTPSA id x8-20020a5d54c8000000b00337d3465997sm14205211wrv.38.2024.01.23.11.50.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 23 Jan 2024 11:50:44 -0800 (PST) Date: Tue, 23 Jan 2024 19:50:53 +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, Daniel Mentz Subject: Re: [RFC PATCH 27/45] KVM: arm64: smmu-v3: Setup domains and page table configuration Message-ID: <20240123195053.GC40099@myrica> References: <20230201125328.2186498-1-jean-philippe@linaro.org> <20230201125328.2186498-28-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_115046_013340_5E1B19AD X-CRM114-Status: GOOD ( 17.13 ) 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 On Mon, Jan 15, 2024 at 02:34:12PM +0000, Mostafa Saleh wrote: > > +static void smmu_tlb_inv_range(struct kvm_iommu_tlb_cookie *data, > > + unsigned long iova, size_t size, size_t granule, > > + bool leaf) > > +{ > > + struct hyp_arm_smmu_v3_device *smmu = to_smmu(data->iommu); > > + unsigned long end = iova + size; > > + struct arm_smmu_cmdq_ent cmd = { > > + .opcode = CMDQ_OP_TLBI_S2_IPA, > > + .tlbi.vmid = data->domain_id, > > + .tlbi.leaf = leaf, > > + }; > > + > > + /* > > + * There are no mappings at high addresses since we don't use TTB1, so > > + * no overflow possible. > > + */ > > + BUG_ON(end < iova); > > + > > + while (iova < end) { > > + cmd.tlbi.addr = iova; > > + WARN_ON(smmu_send_cmd(smmu, &cmd)); > > This would issue a sync command between each range, which is not needed, > maybe we can build the command first and then issue the sync, similar > to what the upstream driver does, what do you think? Yes, moving the sync out of the loop would be better. To keep things simple I'd just replace this with smmu_add_cmd() and add a smmu_sync_cmd() at the end, but maybe some implementations won't consume the TLBI itself fast enough, and we need to build a command list in software. Do you think smmu_add_cmd() is sufficient here? Thanks, Jean _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel