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 X-Spam-Level: X-Spam-Status: No, score=-13.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id B11B5C433DB for ; Mon, 8 Mar 2021 16:41:50 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 467AB6522B for ; Mon, 8 Mar 2021 16:41:50 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 467AB6522B Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:56022 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lJIx3-0000Z8-E4 for qemu-devel@archiver.kernel.org; Mon, 08 Mar 2021 11:41:49 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:40732) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lJItC-0004hA-T3 for qemu-devel@nongnu.org; Mon, 08 Mar 2021 11:37:52 -0500 Received: from mail-ej1-x62e.google.com ([2a00:1450:4864:20::62e]:35845) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lJIt8-0000dE-8v for qemu-devel@nongnu.org; Mon, 08 Mar 2021 11:37:50 -0500 Received: by mail-ej1-x62e.google.com with SMTP id e19so21673233ejt.3 for ; Mon, 08 Mar 2021 08:37:45 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=Hdt0UPv1+JtE9WePGEuObIpZA5lYDhWSWdUZ/7HI64M=; b=bVjdIRx+u2Ravu+DV7y+kPgj6FXGmw1P2JNeCkVzho/S36Uc3n7jPKDCWw/ZpWBWUZ j6i3lwbQKF8+osWhXvrCchkFIRucMWbjKIOOK7qfQtg/blUl3Auh0W50g4AefzY4JJUO CM4ulnWqtvFW2XzjL1WcVsJh7AN3lM9QM/h50FCdsXw/u4VCQY8WhqrUIgHijXBRtXvI Aq6mJi4U/NWJBvvahGoMgFzivMrDMet7GYfVNGvWJR8Lx4k3iftSS7bMV7Q9HJd4R1qM ib45p1LofqCMkF0hqffd4Z6B6ixrLmkZTN3+TzSLlHQ1HnuZ4lhTQksf1GA+E9g1R18K KwCQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=Hdt0UPv1+JtE9WePGEuObIpZA5lYDhWSWdUZ/7HI64M=; b=oFnCczg3yEZXEF4/JwacOOgbHjgIxWNRnHqw4tX7vYR1XfSsyYKKG5f0PJCIibjr6O gDmE4M4cXOt7fIPO4XWnXfSy61pgI62PUFEWpxO98PsM49k5BOAtsDrVNlU898aaYK1w 8KrzkwV60RBamjCpBlEh+H/aHcaNGXu+3qvMUrSPl0/HUVlFN6FDJx16u2ycTCm517xC 5gnjnhpNxaRojCsYu/MsDn2ZilSpBoX3GsLSzCVjvyZee60Wjj5fYEoRvpNBobCjxp1f MqLKdBC3JKkeZlJMcftbTWF4TY/jjH4lNlH3yBTnD/5uPe9UTQwsCtS5DULYNrbRpy+g g5OQ== X-Gm-Message-State: AOAM533TpgKYroIPl4y0fHCWsZRtLkg95wyEKDKuhz9yVKytSatf7hS3 Y0R4vauW3ny+WuxHH+ev6VyjGVgVuYrJttEgNE1CGg== X-Google-Smtp-Source: ABdhPJyclgSLrIUYz/TsSvfYBUiw7CR2vxkuf5bNXW397tRKPtd+TKG3HiOZfwjTXuNPZ9DUHPXWE6bP0sPpGPmV5BI= X-Received: by 2002:a17:906:8a65:: with SMTP id hy5mr16219958ejc.250.1615221463915; Mon, 08 Mar 2021 08:37:43 -0800 (PST) MIME-Version: 1.0 References: <20210225091435.644762-1-eric.auger@redhat.com> <20210225091435.644762-5-eric.auger@redhat.com> In-Reply-To: <20210225091435.644762-5-eric.auger@redhat.com> From: Peter Maydell Date: Mon, 8 Mar 2021 16:37:27 +0000 Message-ID: Subject: Re: [PATCH v2 4/7] hw/arm/smmu-common: Fix smmu_iotlb_inv_iova when asid is not set To: Eric Auger Content-Type: text/plain; charset="UTF-8" Received-SPF: pass client-ip=2a00:1450:4864:20::62e; envelope-from=peter.maydell@linaro.org; helo=mail-ej1-x62e.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Jean-Philippe Brucker , Jason Wang , QEMU Developers , Peter Xu , vivek.gautam@arm.com, qemu-arm , Shameerali Kolothum Thodi , Paolo Bonzini , Eric Auger Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" On Thu, 25 Feb 2021 at 09:15, Eric Auger wrote: > > If the asid is not set, do not attempt to locate the key directly > as all inserted keys have a valid asid. > > Use g_hash_table_foreach_remove instead. > > Signed-off-by: Eric Auger > --- > hw/arm/smmu-common.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/hw/arm/smmu-common.c b/hw/arm/smmu-common.c > index 405d5c5325..e9ca3aebb2 100644 > --- a/hw/arm/smmu-common.c > +++ b/hw/arm/smmu-common.c > @@ -151,7 +151,7 @@ inline void > smmu_iotlb_inv_iova(SMMUState *s, int asid, dma_addr_t iova, > uint8_t tg, uint64_t num_pages, uint8_t ttl) > { > - if (ttl && (num_pages == 1)) { > + if (ttl && (num_pages == 1) && (asid >= 0)) { > SMMUIOTLBKey key = smmu_get_iotlb_key(asid, iova, tg, ttl); > > g_hash_table_remove(s->iotlb, &key); Do we also need to avoid the remove-by-key codepath if the tg is not set ? thanks -- PMM